-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
Description
the following is seen in [email protected]:
declare function onlyNullablePlease<T extends (null extends T ? any : never)>(value: T): void;
declare var z: string | null;
onlyNullablePlease(z); // works as expected
declare var y: string;
onlyNullablePlease(y); // error as expected
function f<T>(t: T) {
var x: T | null = Math.random() > 0.5 ? null : t;
onlyNullablePlease(x); // should work, unexpected error:
/*
Argument of type 'T | null' is not assignable to parameter of type 'null extends T | null ? any : never'.
Type 'null' is not assignable to type 'null extends T | null ? any : never'.ts(2345)
*/
}
cshaa
Metadata
Metadata
Assignees
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.