Closed
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, expected
Expected behavior:
declare const name: string | undefined;
Actual behavior:
declare const name: never;