You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeIndex="a"letobj:{[key: Index]: string}={}// Index型しか許容しない// Error An index signature parameter type must be 'string' or 'number'.// indexはstringかnumber型leta=obj["a"];console.log(a)// undefined
typeIndex="a"letobj:{[keyinIndex]: string}={}// 初期化時に満たされなくてはいけないようになってしまった// Property 'a' is missing in type '{}' but required in type '{ a: string; }'.leta=obj["a"];console.log(a)// undefined