mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
regard TemplateLiteral as discriminant property (#44569)
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user