Closed
Description
TypeScript Version: 3.0.0-dev.20180609 & 2.9.1
Search Terms:
Narrowing unique symbol union
Code
declare const phantom: unique symbol;
type Phantom = typeof phantom;
type PhantomString = string & Phantom;
const fn = (arg?: PhantomString) => arg;
const fn2 = (arg: Array<PhantomString | null>) => arg;
Expected behavior:
fn
and fn2
should be reported as:
const fn: (arg?: PhantomString) => PhantomString | undefined;
const fn2: (arg: Array<PhantomString | null>) => Array<PhantomString | null>;
Actual behavior:
fn
and fn2
are reported as:
const fn: (arg?: undefined) => undefined;
const fn2: (arg: null[]) => null[];
Playground Link:
Appears to be partially related to strictNullChecks