-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Index TypesIssues with `keyof`Issues with `keyof`Experimentation NeededSomeone needs to try this out to see what happensSomeone needs to try this out to see what happens
Milestone
Description
π Search Terms
object spread, object rest, object spreading
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about object spreading
β― Playground Link
π» Code
declare const c: { [key: string]: number }
const a: { [key: string]: string } = {
a: '',
...c
}π Actual behavior
It allows numbers to be in the object, when they shouldn't be allowed.
π Expected behavior
It shouldn't allow numbers.
Additional information about the issue
Because c has non-literal keys, in this case string, which could be any string, it doesn't care what's in it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Index TypesIssues with `keyof`Issues with `keyof`Experimentation NeededSomeone needs to try this out to see what happensSomeone needs to try this out to see what happens