-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
name global variable is still assignable to string type. So name is still unsafe. name: string | undefined works better than current definition name: never.
TypeScript Version: master
Code
const n1: string = <never>name; // pass
const n2: string = <string | never>name; // pass
const n3: string = <string | undefined>name; // error, expectedExpected behavior:
declare const name: string | undefined;Actual behavior:
declare const name: never;despairblue, OlegVo and aluanhaddad
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug