-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 3.0.1
Search Terms:
spread index signature, spread indexer
Code
declare var v: Record<string, string>;
let v2 = {...v}; // works
let v3 = {a: '', ...v}; // index signature lost
let v4 = {...v, a: ''}; // same as above
let v5 = {a: 1, ...v}; // index signature lost, should be '{a: number, [x: string]: number | string}'
let v6 = {[Number()]: 1, ...v}; // empty object type ò,Ó, should be '{[x: string]: number | string}'Expected behavior:
Index signature exists on all object types.
Actual behavior:
Index signature is lost if object literal contains another property assignment. I'm not entirely sure what the type of v6 should be.
cshaa, Doeke, jsingerlenovo, joealden, bmillwood and 15 more
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript