-
Notifications
You must be signed in to change notification settings - Fork 155
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
Wrong typings of intl.get()
#101
Comments
Will you use |
I don't. But after upgrading, this change broke our buggy app, cause we wrote codes like
Of course, that sounds better to me. thanks! |
Though it's a breaking change, we may not bump major version since few people would use it in that way. But we will mention it in release log. Is this ok for you guys? |
So you are gonna to keep this change and update type definitions, right? |
https://github.com/alibaba/react-intl-universal/blob/master/typings/index.d.ts#L31-L4
shows
intl.get()
will return a string forever.But here's a exception:
It's fine to visit
intl.get('categroy.dog')
orintl.get('category.cat')
, but when I visitintl.get('category')
, it returns an object to me, which isn't synced to type definitions.I think it's related to this line change, https://github.com/alibaba/react-intl-universal/blob/master/src/index.js#L113 , which returns an empty string in
1.11.6
.The actual type should be:
But this definition isn't so friendly to ts codes.
will raise an error in this code in typescript. cause type of
intl.get('category.dog')
isn't a string now.Suggestion
Make a breaking change to
.get()
api in next major version ofreact-intl-universal
, let it accept an another argumentonlyString: boolean
.new definition:
The text was updated successfully, but these errors were encountered: