We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
union type, dynamic properties
Playground link with relevant code
declare const bar: 'name' | 'age' const obj = { any: 'any', [bar]: 'wow', }
const obj: { [x: string]: string; any: string; }
const obj: { name: string; any: string; } | { age: string; any: string; }
I think this is a predictable type.
The text was updated successfully, but these errors were encountered:
I currently use type assertions. Playground The test is as follows:
declare const bar: 'name' | 'age' declare const baz: 'my' | 'test' const obj = { any: 'any', [bar]: 'bar', [baz]: 'baz', } as C2 type T1<O, T, V> = O extends any ? T extends string | number | symbol ? { [C in T | keyof O]: C extends keyof O ? O[C] : V } : never : never type C1 = T1<{ any: string }, typeof bar, string> type C2 = T1<C1, typeof baz, string>
Sorry, something went wrong.
Duplicate #13948, #21030
No branches or pull requests
Bug Report
π Search Terms
union type, dynamic properties
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
π Expected behavior
I think this is a predictable type.
The text was updated successfully, but these errors were encountered: