TS Dynamic Attribute
index type
class Foo { hello = "hello"; world = 1234; // This is an index signature: [propName: string]: string | number | undefined; } let instance = new Foo(); // Valid assigment instance["whatever"] = 42; // Has type 'string | number | undefined'. let x = instance["something"];
Common errors
An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type insteadclass Foo { static hello = "hello"; static world = 1234; static [propName: string]: string | number | undefined; } // Valid. Foo["whatever"] = 42; // Has type 'string | number | undefined' let x = Foo["something"];
Announcing TypeScript 4.3 | TypeScript
Today we're excited to announce the availability of TypeScript 4.3! If you're not yet familiar with TypeScript, it's a language that builds on JavaScript by adding syntax for static types. Tools like the TypeScript compiler can just erase TypeScript syntax, leaving you with clean readable JavaScript that works anywhere.
https://devblogs.microsoft.com/typescript/announcing-typescript-4-3/


Seonglae Cho