We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
My compilation target is es2021 and my lib is es2021.
es2021
A generic type in get method of collections.
get
const m = new Map<string, string | number>(); m.set('key', 'value'); conat v = m.get('key') // Map<string, string | number>.get(key: string): string | number | undefined
const m = new Map<string, string | number>(); m.set('key', 'value'); conat v = m.get<string>('key') // Map<string, string | number>.get<string>(key: string): string | undefined
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get
The text was updated successfully, but these errors were encountered:
This would mistakingly lead people to believe they will surely get the specific type. Same reason why JSON.parse() is not generic. See this comment.
JSON.parse()
There's no reason to favour m.get<string>('key') over <string>m.get('key') (or m.get('key') as string).
m.get<string>('key')
<string>m.get('key')
m.get('key') as string
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
lib Update Request
Configuration Check
My compilation target is
es2021
and my lib ises2021
.Missing / Incorrect Definition
A generic type in
get
method of collections.Sample Code
Request
Documentation Link
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get
The text was updated successfully, but these errors were encountered: