-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Closed
Copy link
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: master (2deb318)
Search Terms: conditional type variable parameter undefined null empty object constraint
Code
// With --strictNullChecks
type Test1 = [unknown] extends [{}] ? true : false; // false
type IsDefinitelyDefined<T extends unknown> = [T] extends [{}] ? true : false;
type Test2 = IsDefinitelyDefined<unknown>; // true, should be false
function oops<T extends unknown>(arg: T): {} {
return arg; // no error, should be an error (unknown not assignable to {})
}
console.log(oops(null).constructor); // bang!
Expected behavior / Actual behavior: as marked
Playground Link: link (remember to enable strictNullChecks
)
Related Issues: didn't find any
Discovered via https://stackoverflow.com/questions/52105268 .
NN---, Ailrun, movedoa, Igorbek, jasonkuhrt and 2 more
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueSuggestionAn idea for TypeScriptAn idea for TypeScript