Skip to content

Commit 760b02b

Browse files
authored
Merge pull request #29420 from Microsoft/fix29108
Remove overzealous simple relationship check for unique symbols
2 parents d53619a + 5763e2c commit 760b02b

File tree

5 files changed

+419
-397
lines changed

5 files changed

+419
-397
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11667,7 +11667,6 @@ namespace ts {
1166711667
if (s & TypeFlags.Undefined && (!strictNullChecks || t & (TypeFlags.Undefined | TypeFlags.Void))) return true;
1166811668
if (s & TypeFlags.Null && (!strictNullChecks || t & TypeFlags.Null)) return true;
1166911669
if (s & TypeFlags.Object && t & TypeFlags.NonPrimitive) return true;
11670-
if (s & TypeFlags.UniqueESSymbol || t & TypeFlags.UniqueESSymbol) return false;
1167111670
if (relation === assignableRelation || relation === comparableRelation) {
1167211671
if (s & TypeFlags.Any) return true;
1167311672
// Type number or any numeric literal type is assignable to any numeric enum type or any

tests/baselines/reference/uniqueSymbols.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ var varInitToConstDeclAmbient = constType;
2828
const constInitToConstCallWithTypeQuery: typeof constCall = constCall;
2929
const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType;
3030

31+
// assignment from any
32+
// https://github.com/Microsoft/TypeScript/issues/29108
33+
const fromAny: unique symbol = {} as any;
34+
3135
// function return inference
3236
function funcReturnConstCall() { return constCall; }
3337
function funcReturnLetCall() { return letCall; }
@@ -286,6 +290,9 @@ var varInitToConstDeclAmbient = constType;
286290
// declaration from initializer with type query
287291
const constInitToConstCallWithTypeQuery = constCall;
288292
const constInitToConstDeclAmbientWithTypeQuery = constType;
293+
// assignment from any
294+
// https://github.com/Microsoft/TypeScript/issues/29108
295+
const fromAny = {};
289296
// function return inference
290297
function funcReturnConstCall() { return constCall; }
291298
function funcReturnLetCall() { return letCall; }

0 commit comments

Comments
 (0)