You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeunknown={}|undefined|null|void;interfaceDict{[key: string]: unknown;}functionisDict(value: any): value is Dict{returnvalue!==null&&value!==undefined;}functionany(): any{}letnotSure: unknown=any();if(isDict(notSure)){notSure['foo'];// <- turn on strict mode to see error, `notSure` is `{}`}
A union with { } in it will eagerly collapse to { } as soon as it's examined by the type system; a union like this should never be written down on purpose. Did you mean unknown = object | undefined | null | void ?
We have switched to unknown = object | number | string | boolean | symbol | undefined | null | void as per #18196, just thought we would report this in case it is a bug that is not already known.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
chancancode commentedon Sep 12, 2017
This is only a problem with
{}involved – the definition suggested here worksRyanCavanaugh commentedon Sep 12, 2017
A union with
{ }in it will eagerly collapse to{ }as soon as it's examined by the type system; a union like this should never be written down on purpose. Did you meanunknown = object | undefined | null | void?chancancode commentedon Sep 12, 2017
We have switched to
unknown = object | number | string | boolean | symbol | undefined | null | voidas per #18196, just thought we would report this in case it is a bug that is not already known.mhegazy commentedon Oct 3, 2017
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.