regard TemplateLiteral as discriminant property (#44569)

This commit is contained in:
Zzzen
2021-06-24 06:48:39 +08:00
committed by GitHub
parent 6452cfbad0
commit ce8e873bf8
5 changed files with 130 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
// @strict: true
// Repro from #44435
type Correct = {
code: string
property: true
err: undefined
}
type Err = {
err: `${string} is wrong!`
}
type SomeReturnType = Correct | Err;
const example: SomeReturnType = {} as SomeReturnType;
if (example.err === undefined) {
example.property; // true
}