Add test for already fixed issue 49778 (#52668)

This commit is contained in:
Jake Bailey 2023-02-09 11:04:07 -08:00 коммит произвёл GitHub
Родитель 9a14949686
Коммит bec0fdac23
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 97 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,17 @@
//// [relatedViaDiscriminatedTypeNoError2.ts]
type AObjOrBObj = { name: "A" } | { name: "B" };
type AOrBObj = { name: "A" | "B" };
type Generic<T extends AObjOrBObj> = T;
type T = Generic<AOrBObj>;
declare let x: AObjOrBObj;
declare let y: AOrBObj;
x = y;
y = x;
//// [relatedViaDiscriminatedTypeNoError2.js]
"use strict";
x = y;
y = x;

Просмотреть файл

@ -0,0 +1,37 @@
=== tests/cases/compiler/relatedViaDiscriminatedTypeNoError2.ts ===
type AObjOrBObj = { name: "A" } | { name: "B" };
>AObjOrBObj : Symbol(AObjOrBObj, Decl(relatedViaDiscriminatedTypeNoError2.ts, 0, 0))
>name : Symbol(name, Decl(relatedViaDiscriminatedTypeNoError2.ts, 0, 19))
>name : Symbol(name, Decl(relatedViaDiscriminatedTypeNoError2.ts, 0, 35))
type AOrBObj = { name: "A" | "B" };
>AOrBObj : Symbol(AOrBObj, Decl(relatedViaDiscriminatedTypeNoError2.ts, 0, 48))
>name : Symbol(name, Decl(relatedViaDiscriminatedTypeNoError2.ts, 1, 16))
type Generic<T extends AObjOrBObj> = T;
>Generic : Symbol(Generic, Decl(relatedViaDiscriminatedTypeNoError2.ts, 1, 35))
>T : Symbol(T, Decl(relatedViaDiscriminatedTypeNoError2.ts, 2, 13))
>AObjOrBObj : Symbol(AObjOrBObj, Decl(relatedViaDiscriminatedTypeNoError2.ts, 0, 0))
>T : Symbol(T, Decl(relatedViaDiscriminatedTypeNoError2.ts, 2, 13))
type T = Generic<AOrBObj>;
>T : Symbol(T, Decl(relatedViaDiscriminatedTypeNoError2.ts, 2, 39))
>Generic : Symbol(Generic, Decl(relatedViaDiscriminatedTypeNoError2.ts, 1, 35))
>AOrBObj : Symbol(AOrBObj, Decl(relatedViaDiscriminatedTypeNoError2.ts, 0, 48))
declare let x: AObjOrBObj;
>x : Symbol(x, Decl(relatedViaDiscriminatedTypeNoError2.ts, 6, 11))
>AObjOrBObj : Symbol(AObjOrBObj, Decl(relatedViaDiscriminatedTypeNoError2.ts, 0, 0))
declare let y: AOrBObj;
>y : Symbol(y, Decl(relatedViaDiscriminatedTypeNoError2.ts, 7, 11))
>AOrBObj : Symbol(AOrBObj, Decl(relatedViaDiscriminatedTypeNoError2.ts, 0, 48))
x = y;
>x : Symbol(x, Decl(relatedViaDiscriminatedTypeNoError2.ts, 6, 11))
>y : Symbol(y, Decl(relatedViaDiscriminatedTypeNoError2.ts, 7, 11))
y = x;
>y : Symbol(y, Decl(relatedViaDiscriminatedTypeNoError2.ts, 7, 11))
>x : Symbol(x, Decl(relatedViaDiscriminatedTypeNoError2.ts, 6, 11))

Просмотреть файл

@ -0,0 +1,32 @@
=== tests/cases/compiler/relatedViaDiscriminatedTypeNoError2.ts ===
type AObjOrBObj = { name: "A" } | { name: "B" };
>AObjOrBObj : { name: "A"; } | { name: "B"; }
>name : "A"
>name : "B"
type AOrBObj = { name: "A" | "B" };
>AOrBObj : { name: "A" | "B"; }
>name : "A" | "B"
type Generic<T extends AObjOrBObj> = T;
>Generic : T
type T = Generic<AOrBObj>;
>T : AOrBObj
declare let x: AObjOrBObj;
>x : AObjOrBObj
declare let y: AOrBObj;
>y : AOrBObj
x = y;
>x = y : AOrBObj
>x : AObjOrBObj
>y : AOrBObj
y = x;
>y = x : AObjOrBObj
>y : AOrBObj
>x : AObjOrBObj

Просмотреть файл

@ -0,0 +1,11 @@
// @strict: true
type AObjOrBObj = { name: "A" } | { name: "B" };
type AOrBObj = { name: "A" | "B" };
type Generic<T extends AObjOrBObj> = T;
type T = Generic<AOrBObj>;
declare let x: AObjOrBObj;
declare let y: AOrBObj;
x = y;
y = x;