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
Search Terms: empty object, broken inference, Record
Code
exportclassBar<Keyextendsstring,Valueextendsstring>{getfoo(): Record<Key,Value>{return{};// [tsserver 2322] [E] Type '{}' is not assignable to type 'Record<Key, Value>'.}}
Expected behavior:
The empty object type should be inferred as Record<Key, Value>
Actual behavior:
[tsserver 2322] [E] Type '{}' is not assignable to type 'Record<Key, Value>'.
exportclassBar<Keyextendsstring,Valueextendsstring>{getfoo(): Record<Key,Value>{return{};// [tsserver 2322] [E] Type '{}' is not assignable to type 'Record<Key, Value>'.}}constk=newBar<"bla","baz">();// No error, crashesk.foo.bla.toLowerCase();
TypeScript Version: 3.9.7
Search Terms: empty object, broken inference, Record
Code
Expected behavior:
The empty object type should be inferred as
Record<Key, Value>
Actual behavior:
Playground Link:
https://www.typescriptlang.org/play/#code/KYDwDg9gTgLgBAYwDYEMDOa4CEVTgHgCg44BpYATzlBmADsATTNGKASzoHMAaYuANRRIArsGohajZqw6dCAPjgBvPp2DwAZhAhwAFAEoAXHABKwBNAb5yFbgKGjFKkiSjrhUOsoC+Abj7ehN5AA
I used the default version in the playground because the nightly version is completely broken and very slow.
Related Issues:
This problem is similar but not equal to #14930
The text was updated successfully, but these errors were encountered: