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
Hi !
This change improves the output of objects without properties by generating an object type with an index signature: { [key: string]: any }.
{ [key: string]: any }
Now that i think of it, perhaps it'd be better to have { [key: string]: unknown } instead?
{ [key: string]: unknown }
Thanks
PR: #488
The text was updated successfully, but these errors were encountered:
unknown
Thank you for your contribution! 👍
The type to change seems to be { [key: string]: any }. Record<string, any> is also good, but it's the same either way.
Record<string, any>
The {[key: string]: unkown} type seems to be treated differently from Record<string, any>, as shown below. https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#-k-string-unknown--is-no-longer-a-wildcard-assignment-target
{[key: string]: unkown}
In fact, in the following code, only the case of Record<string, unknown> in line 15 causes a compilation error. For this replacement type, Record<string, any> seems to be a better choice. https://typescript-play.js.org/?target=7#code/C4TwDgpgBAglC8UBKEDGB7ATgEwDwGdhMBLAOwHMAaKAQ1JAD4BuAKFEigFUFk0s9CJCtQCupANal0Ad1LMWLMsAiYAZjVTQAklADeLKFFXp0ALiikRAWwBGK1gF8WGUoSjFzOxLqMnzARigHVmd0V2Baf3M4b18zKEDg0PDaACZonmJWFzcaAGYMxH9ssNyAFkKLEQAbapKUmgBWSrFsCFUyCGx6txEorh4fY3jEnoiRdIHELOTegqmEsagRCoXLWqWRZoXW9s7u2Yj0frFJGVJBuICgpfRJ06lZTNv5h-OeYsOodFW3p8R1nUvuhtn8Lohdh1SF1WEA
Record<string, unknown>
Sorry, something went wrong.
Makes sense, wasn't sure about this behavior even if i encountered it lots of time already. So i think the PR is correct as is then. Thanks!
Successfully merging a pull request may close this issue.
Hi !
This change improves the output of objects without properties by generating an object type with an index signature:
{ [key: string]: any }
.Now that i think of it, perhaps it'd be better to have
{ [key: string]: unknown }
instead?Thanks
PR: #488
The text was updated successfully, but these errors were encountered: