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
constfoo: Record<never,never>={}// OKinterfaceRecordOfRecordsextendsRecord<keyofany,RecordOfRecords>{}constrecordOfRecords: RecordOfRecords={}recordOfRecords.propA={...(foo!==undefined ? {foo} : {})}// OKrecordOfRecords.propB={...(foo&&{foo})}// OKrecordOfRecords.propC={...(foo!==undefined&&{foo})}// Not OK// ^Error:// Type '{} | { foo: Record<never, never>; }' is not assignable to type 'RecordOfRecords'.// Type '{}' is not assignable to type 'RecordOfRecords'.// Index signature is missing in type '{}'.(2322)interfaceRecordOfRecordsOrEmptyextendsRecord<keyofany,RecordOfRecordsOrEmpty|{}>{}constrecordsOfRecordsOrEmpty: RecordOfRecordsOrEmpty={}recordsOfRecordsOrEmpty.propA={...(foo!==undefined ? {foo} : {})}// OKrecordsOfRecordsOrEmpty.propB={...(foo&&{foo})}// OKrecordsOfRecordsOrEmpty.propC={...(foo!==undefined&&{foo})}// OK
Expected behavior: Empty objects are always assignable to Records.
Actual behavior: Empty objects are only assignable to the non-recursive records.
Edit: sorry, but I couldn't find this issue in the tracker although I'm almost certain it must exist. If possible, please link this to any existing (possibly closed) issue.
TypeScript Version: 3.7.0-beta
Search Terms: recursive empty record
Code
Expected behavior: Empty objects are always assignable to Records.
Actual behavior: Empty objects are only assignable to the non-recursive records.
Playground Link
Related Issues: #25437
Edit: sorry, but I couldn't find this issue in the tracker although I'm almost certain it must exist. If possible, please link this to any existing (possibly closed) issue.