dtslint changes output type based on $ExpectType values
marekdedic opened this issue · 3 comments
marekdedic commented
Hi,
I'm looking at commit 886607f and trying to get the tests to pass by modifying Line 379.
Currently I get the error:
ERROR: 380:1 expect TypeScript@4.9 expected type to be:
Page | Post
got:
Page<"edit"> | Post<"edit">
however, if I change the expected value to be the returned value, I get
ERROR: 380:1 expect TypeScript@4.9 expected type to be:
Page<"edit"> | Post<"edit">
got:
Page | Post
so it seems like dtslint can't decide whether it wants the type parameter ("edit"
is actually the default value) or not.
marekdedic commented
I managed to track the issue down to
DefinitelyTyped-tools/packages/dtslint/src/rules/expectRule.ts
Lines 414 to 420 in 15d48f4
So... it seems TypeScript itself is changing the type output based on the surroundings?
marekdedic commented
Possibly related:
marekdedic commented
Ok, I'm dumb, the 2 errors were on different TS versions.