Created
February 15, 2025 07:13
-
-
Save crutchcorn/248320dd89c50564e6783bd2f86be45b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Base { | |
// @ts-ignore | |
other: number extends this['val'] ? number : string; | |
} | |
interface Other<T = undefined> { | |
val?: T extends undefined ? number : T; | |
} | |
interface Test<T = undefined> extends Base, Other<T> {} | |
const t = 0 as never as Test<string>; | |
t.other; | |
// ^? t.other is `string` | |
const tt = 0 as never as Test | |
tt.other; | |
// ^? tt.other is `number` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment