Closed
Description
openedon Oct 12, 2020
Describe the bug
Type definitions in default-i18n.d.ts
for the @wordpress/i18n
package generated by npm run build:package-types
are all of type any
. For example, the __
function definition looks like this:
/**
* Retrieve the translation of text.
*
* @see https://developer.wordpress.org/reference/functions/__/
*
* @param {string} text Text to translate.
* @param {string} [domain] Domain to retrieve the translated text.
*
* @return {string} Translated text.
*/
export const __: any;
To reproduce
Steps to reproduce the behavior:
npm run build:package-types
- Or, from a plugin/theme context, after installing
@wordpress/i18n
, import the function:import { __ } from '@wordpress/i18n'
Expected behavior
I expect the type definitions to be similar, if not the same, as described in #18942, like so:
/**
* Retrieve the translation of text.
*
* @see https://developer.wordpress.org/reference/functions/__/
*
* @param {string} text Text to translate.
* @param {string} [domain] Domain to retrieve the translated text.
*
* @return {string} Translated text.
*/
export function __(text: string, domain?: string | undefined): string;
Screenshots
I'm developing a plugin with TypeScript React that uses the @wordpress/i18n
package and excludes it from my webpack build. The following screenshot is what intellisense shows me in vscode (sorry about the small screenshot):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment