We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Version: 3.7.5, 3.8.0-dev.20200201
Search Terms: assertion signature
Code
interface Foo { action(): void bar?: string } declare function assertFooBar(foo: any): asserts foo is ((Foo & { bar: string })|true) declare const x: Foo | true assertFooBar(x) const y = x
Expected behavior: y has type (Foo & { bar: string }) | true
y
(Foo & { bar: string }) | true
Actual behavior: y has type true.
true
Playground Link: https://www.typescriptlang.org/play/?ts=3.8.0-dev.20200201&ssl=11&ssc=12&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgGIHt3IN4ChkHKJjDogAUAlAFzIBu6wAJvoQEZxQD8tAzmFFABzXAF9cuJhAQAbTihgBXEAhJkivXtDAZ0AIU7kYmWnBABPGhq1QwvZMazB75cruQAyHMg5Q+A4WRRSgAfAUUISgkpWXlkBDJ+ZAAPWncQ5HCIXDhNbV0DKHJkqNwEkCTzZABeFIkwcwAHFAAVGuRXN0xPb19-QRAhIMpkDKzKEa8urDGoCNKG5uQADXbdAHVgMAALQoAedMy5iAA+ZHqmlA2t3c49lrPatohkyBAme3cuNG6vbB9OP1AqJkLQWrhFldMJsdoUAIIWNbQm77MzmE64IA Related Issues:
The text was updated successfully, but these errors were encountered:
Duplicate of #35953
Sorry, something went wrong.
@RyanCavanaugh Yeah, I was half expecting this to be by design due to some type system subtlety. Thanks in any case.
No branches or pull requests
TypeScript Version: 3.7.5, 3.8.0-dev.20200201
Search Terms:
assertion signature
Code
Expected behavior:
y
has type(Foo & { bar: string }) | true
Actual behavior:
y
has typetrue
.Playground Link:
https://www.typescriptlang.org/play/?ts=3.8.0-dev.20200201&ssl=11&ssc=12&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgGIHt3IN4ChkHKJjDogAUAlAFzIBu6wAJvoQEZxQD8tAzmFFABzXAF9cuJhAQAbTihgBXEAhJkivXtDAZ0AIU7kYmWnBABPGhq1QwvZMazB75cruQAyHMg5Q+A4WRRSgAfAUUISgkpWXlkBDJ+ZAAPWncQ5HCIXDhNbV0DKHJkqNwEkCTzZABeFIkwcwAHFAAVGuRXN0xPb19-QRAhIMpkDKzKEa8urDGoCNKG5uQADXbdAHVgMAALQoAedMy5iAA+ZHqmlA2t3c49lrPatohkyBAme3cuNG6vbB9OP1AqJkLQWrhFldMJsdoUAIIWNbQm77MzmE64IA
Related Issues:
The text was updated successfully, but these errors were encountered: