You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to Reproduce:
Write the following code in a new Typescript file:
type X = A | B;
type A = string;
type B = number;
function foo<T extends X>(arg: T): T extends B ? number : string {
if (arg === "A") return <T extends B ? number : never>111;
return <T extends B ? never : string>"returning a string";
}
foo("A");
foo(1);
In my project, I need to use a function with the typing described in the code above. This is of course a simplified version of my code. The code passes the Typescript 3.4.3 without errors, and also works at run time.
However, the colorization of the code bugs after the if statement.
If I remove the parameters from the return statements, then the colorization works. But the code doesn't pass the type-check anymore.
I get the same result with and without extensions. Also with the latest insiders build of VS Code.
The text was updated successfully, but these errors were encountered:
Steps to Reproduce:
Write the following code in a new Typescript file:
In my project, I need to use a function with the typing described in the code above. This is of course a simplified version of my code. The code passes the Typescript 3.4.3 without errors, and also works at run time.

However, the colorization of the code bugs after the
if
statement.If I remove the parameters from the return statements, then the colorization works. But the code doesn't pass the type-check anymore.

I get the same result with and without extensions. Also with the latest insiders build of VS Code.
The text was updated successfully, but these errors were encountered: