-
Notifications
You must be signed in to change notification settings - Fork 2
Add support for computed properties #305
Copy link
Copy link
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
type Letters = 'a' | 'b' | 'c' | 'd' | 'e';
type Numbers = 1 | 2 | 3;
type Chars = '$' | '_';
type Names = `${Letters}${Uppercase<Letters>}${Numbers}${Chars}`;
// Quick fix available
// so computed properties, transforms, and long lists work
const names: { [K in Names]: K } = {};type Letters = 'a' | 'b' | 'c' | 'd' | 'e';
type Numbers = 1 | 2 | 3;
type Chars = '@' | '!'; // Difference is only this line
type Names = `${Letters}${Uppercase<Letters>}${Numbers}${Chars}`;
// Quick not available
const names: { [K in Names]: K } = {};The last example works in WebStorm via "implement all members" and would be a welcome addition to VSCode. The quick fix for microsoft/TypeScript#28491 was implemented via microsoft/TypeScript#44576 and solved some use cases, but not this one.
The error output does already suggest all the missing properties. It seems like the data is available to execute a quick fix.
Such names should be usable:
Additionally, when the quick fix does work, it only adds the properties and sets values as undefined even when the value is known (as in the above examples).
This issue was inspired by this tweet:
https://twitter.com/majidrazvi/status/1449493443743391746
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed




