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
Unexpected "in"
Using esbuild 0.17.14 to compile this snippet:
const LAYERS: { [keyof in "bar"]?: boolean } = { bar: true, };
results in
✘ [ERROR] Unexpected "in" foo.ts:1:23: 1 │ const LAYERS: { [keyof in "bar"]?: boolean } = { ╵ ~~ 1 error
whereas the TS playground seems not to mind: https://www.typescriptlang.org/play?#code/MYewdgzgLgBAMgQQJoFEBKBlAXDA3jAbQGsBTATxADMYBLMGAIgCMBDAJwYF0B+HJkEABsSLegF8YAXjwAoGPJis2OKGwCuJADQyxAbhmhIQkgDpBIAOYAKRKkwBKIA
This approach is used here: https://github.com/maplibre/maplibre-gl-js/blob/3157c340e5573699e46ce4b3fc17e9e670442e1a/src/render/render_to_texture.ts#L13-L19 if a non-toy example is desired.
I am not familiar enough with the JS/TS ecosystem to judge what's wrong here, I am hoping you know.
The text was updated successfully, but these errors were encountered:
The keyof in this example is interpreted as a type name instead of a keyword. That is to say it is effectively the same as
keyof
const LAYERS: { [P in "bar"]?: boolean }
Sorry, something went wrong.
9fbf1fd
No branches or pull requests
Using esbuild 0.17.14 to compile this snippet:
results in
whereas the TS playground seems not to mind:
https://www.typescriptlang.org/play?#code/MYewdgzgLgBAMgQQJoFEBKBlAXDA3jAbQGsBTATxADMYBLMGAIgCMBDAJwYF0B+HJkEABsSLegF8YAXjwAoGPJis2OKGwCuJADQyxAbhmhIQkgDpBIAOYAKRKkwBKIA
This approach is used here: https://github.com/maplibre/maplibre-gl-js/blob/3157c340e5573699e46ce4b3fc17e9e670442e1a/src/render/render_to_texture.ts#L13-L19 if a non-toy example is desired.
I am not familiar enough with the JS/TS ecosystem to judge what's wrong here, I am hoping you know.
The text was updated successfully, but these errors were encountered: