Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intl type hints #226

Closed
dvlin-dev opened this issue Sep 18, 2023 · 0 comments
Closed

intl type hints #226

dvlin-dev opened this issue Sep 18, 2023 · 0 comments

Comments

@dvlin-dev
Copy link
Contributor

The api I often use is intl.get, which is a great api. But the problem is, when I type intl, there is no automatic prompt to import react-intl-universal.

image

To solve this problem, I used a code snippet, but it was not a good experience. I hope to solve this problem from the API level.

"import intl": {
	"prefix": "ii",
	"body": [
		"import intl from 'react-intl-universal';"
	],
},

I modified index.d.ts.

declare module "react-intl-universal" {

+  const intl: {
+      determineLocale: typeof determineLocale;
+      formatHTMLMessage: typeof formatHTMLMessage;
+      formatMessage: typeof formatMessage;
+      get: typeof get;
+      getHTML: typeof getHTML;
+      getInitOptions: typeof getInitOptions;
+      init: typeof init;
+      load: typeof load;
+    };
+
+  export default intl;

}

it solved the problem of code suggestions.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants