mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-12 20:01:02 -05:00
Merge pull request #29420 from Microsoft/fix29108
Remove overzealous simple relationship check for unique symbols
This commit is contained in:
@@ -11667,7 +11667,6 @@ namespace ts {
|
||||
if (s & TypeFlags.Undefined && (!strictNullChecks || t & (TypeFlags.Undefined | TypeFlags.Void))) return true;
|
||||
if (s & TypeFlags.Null && (!strictNullChecks || t & TypeFlags.Null)) return true;
|
||||
if (s & TypeFlags.Object && t & TypeFlags.NonPrimitive) return true;
|
||||
if (s & TypeFlags.UniqueESSymbol || t & TypeFlags.UniqueESSymbol) return false;
|
||||
if (relation === assignableRelation || relation === comparableRelation) {
|
||||
if (s & TypeFlags.Any) return true;
|
||||
// Type number or any numeric literal type is assignable to any numeric enum type or any
|
||||
|
||||
@@ -28,6 +28,10 @@ var varInitToConstDeclAmbient = constType;
|
||||
const constInitToConstCallWithTypeQuery: typeof constCall = constCall;
|
||||
const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType;
|
||||
|
||||
// assignment from any
|
||||
// https://github.com/Microsoft/TypeScript/issues/29108
|
||||
const fromAny: unique symbol = {} as any;
|
||||
|
||||
// function return inference
|
||||
function funcReturnConstCall() { return constCall; }
|
||||
function funcReturnLetCall() { return letCall; }
|
||||
@@ -286,6 +290,9 @@ var varInitToConstDeclAmbient = constType;
|
||||
// declaration from initializer with type query
|
||||
const constInitToConstCallWithTypeQuery = constCall;
|
||||
const constInitToConstDeclAmbientWithTypeQuery = constType;
|
||||
// assignment from any
|
||||
// https://github.com/Microsoft/TypeScript/issues/29108
|
||||
const fromAny = {};
|
||||
// function return inference
|
||||
function funcReturnConstCall() { return constCall; }
|
||||
function funcReturnLetCall() { return letCall; }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -85,6 +85,13 @@ const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType;
|
||||
>constType : unique symbol
|
||||
>constType : unique symbol
|
||||
|
||||
// assignment from any
|
||||
// https://github.com/Microsoft/TypeScript/issues/29108
|
||||
const fromAny: unique symbol = {} as any;
|
||||
>fromAny : unique symbol
|
||||
>{} as any : any
|
||||
>{} : {}
|
||||
|
||||
// function return inference
|
||||
function funcReturnConstCall() { return constCall; }
|
||||
>funcReturnConstCall : () => symbol
|
||||
|
||||
@@ -31,6 +31,10 @@ var varInitToConstDeclAmbient = constType;
|
||||
const constInitToConstCallWithTypeQuery: typeof constCall = constCall;
|
||||
const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType;
|
||||
|
||||
// assignment from any
|
||||
// https://github.com/Microsoft/TypeScript/issues/29108
|
||||
const fromAny: unique symbol = {} as any;
|
||||
|
||||
// function return inference
|
||||
function funcReturnConstCall() { return constCall; }
|
||||
function funcReturnLetCall() { return letCall; }
|
||||
|
||||
Reference in New Issue
Block a user