-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
BugA bug in TypeScriptA bug in TypeScript
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 and DamianoMagrini
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript