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
In #20898@rozzzly discovered a bug that was tangential to that issue:
On a side note, I think I may have found a bug. So while typing up this issue, I found that I am able to achieve the desired behavior by using an intersection with a "tagged" object literal:
exporttypeFOO=symbol&{FOO: true};exportconstFOO: FOO=Symbol('FOO');// ❓️ no error
We also don't see the error for declarations like:
constFOO: string=Symbol();
Expected behavior:
This should report the error: error TS2322: Type 'unique symbol' is not assignable to type 'symbol & { FOO: true; }'.
Actual behavior:
No error is reported. This is because getESSymbolLikeTypeForNode uses the type property on SymbolLinks which already has a type from the declaration, so it gets symbol & { FOO: true }.
TypeScript Version: 2.8.0-dev.20180202
In #20898 @rozzzly discovered a bug that was tangential to that issue:
We also don't see the error for declarations like:
Expected behavior:
This should report the error:
error TS2322: Type 'unique symbol' is not assignable to type 'symbol & { FOO: true; }'.
Actual behavior:
No error is reported. This is because
getESSymbolLikeTypeForNode
uses thetype
property onSymbolLinks
which already has a type from the declaration, so it getssymbol & { FOO: true }
.Related Issues:
Symbol()
. #20898The text was updated successfully, but these errors were encountered: