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
{{ message }}
Repository navigation
Intersection of empty object type with empty object type is missing index signature #20225
typeDictionary={[name: string]: string};constintersectDictionaries=<F1extendsDictionary,F2extendsDictionary>(d1: F1,d2: F2,): F1&F2=>Object.assign({},d1,d2);consttestDictionary=<TextendsDictionary>(_value: T)=>{};constd1={};testDictionary(d1);// OK, d1 is inferred to be {}constd2=intersectDictionaries(d1,d1);testDictionary(d2);// error, d2 is inferred to be {}// compile error on the above line:// ts-braces-not-assignable.ts(13,16): error TS2345: Argument of type '{}' // is not assignable to parameter of type 'Dictionary'.// Index signature is missing in type '{}'.constd3={s: '',};testDictionary(d3);// OKconstd4=intersectDictionaries(d1,d3);testDictionary(d4);// OKconstd5=intersectDictionaries(d3,d1);testDictionary(d5);// OKconstd6=intersectDictionaries(d3,d3);testDictionary(d6);// OK
Expected behavior:
No error
Actual behavior:
Error:
ts-braces-not-assignable.ts(13,16): error TS2345: Argument of type '{}' is not assignable to parameter of type 'Dictionary'.
Index signature is missing in type '{}'.
Activity