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
{{ message }}
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
How do I write tests where types fail as expected in different typescript versions but on different lines, depending on the version?
Here's some code:
interfaceA{str: string}consta: A={// fails on this line in ts < 3.0str: 1// fails on this line in ts >= 3.0}
This fails on different lines depending on the TypeScript version.
DefinitelyTyped checks against multiple TypeScript versions, so no matter where I put the $ExpectError, the test as a whole will fail.
I can work around this problem by creating a variable from the literal first and assigning it to A1 later, or by disabling prettier and forcing everything on a single line, but I was hoping for a cleaner solution.
Is there maybe some kind of flag for $ExpectError which would specify a TypeScript version?
If not, should we make one?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
How do I write tests where types fail as expected in different typescript versions but on different lines, depending on the version?
Here's some code:
This fails on different lines depending on the TypeScript version.
DefinitelyTyped checks against multiple TypeScript versions, so no matter where I put the
$ExpectError
, the test as a whole will fail.I can work around this problem by creating a variable from the literal first and assigning it to
A1
later, or by disabling prettier and forcing everything on a single line, but I was hoping for a cleaner solution.Is there maybe some kind of flag for
$ExpectError
which would specify a TypeScript version?If not, should we make one?
The text was updated successfully, but these errors were encountered: