-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Mapped TypesThe issue relates to mapped typesThe issue relates to mapped types
Milestone
Description
TypeScript Version: 3.8.2
Search Terms:
- strictNullChecks
- object spread
- computed key
Code
const b = { a: 'hello' };
const key: string = 'hello';
const a: Record<string, string> = { ...b, [key]: undefined };Expected behavior:
Type check fails
Actual behavior:
No Typecheck error.
It is interesting that if we remove explicit string type for key the code is not compilable as expected.
Buggytheclown, arnodb, bogdan, chrisdoble, DamianoMagrini and 1 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Mapped TypesThe issue relates to mapped typesThe issue relates to mapped types