-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
TypeScript Version: 3.7.2
Search Terms:
ObjectConstructor, Object, assign, target, null
Code
Object.assign(null, {a:1})
this works because
assign<T, U>(target: T, source: U): T & U;
but T can't be null
Expected behavior:
type error is risen ts and reported by typescript-eslint
Actual behavior:
type error in js
TypeError: Cannot convert undefined or null to object
at Function.assign (<anonymous>)
Playground Link:
http://www.typescriptlang.org/play/?ssl=1&ssc=26&pln=1&pc=21#code/PIIwVgpgxgLgdAQwM5IJYHMB2AKTBXAGwIBoACAbwQC4BGAXwEog
Related Issues:
#3429
bezreyhan and Joozty
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone