📝 Docs: Note that & why Twoslash and $ExpectType
have different behavior
#74
Labels
area: documentation
Improvements or additions to docs 📝
status: accepting prs
Please, send a pull request to resolve this! 🙏
🐛 Bug Report
eslint-plugin-expect-type
version: 0.2.2Actual Behavior
Full reduced test case here: https://github.com/OliverJAsh/eslint-plugin-expect-type-issue
Contents inlined below.
package.json
:tsconfig.json
:.eslintrc.js
:source.ts
:test.ts
:$ExpectType
expects:Compact<Record<"a" | "b", number> | Record<"a" | "c", number>>
I believe the reason for this difference is because Twoslash and
$ExpectType
use different mechanisms to generate the "actual" value:languageService.getQuickInfoAtPosition
$ExpectType
:checker.typeToString
This particular issue started after we upgraded to TypeScript 5. Prior to this,
$ExpectType
had the same behavior as Twoslash in this particular example. I'm not sure why this has changed.Expected Behavior
Twoslash queries and
$ExpectType
should behave the same.Reproduction
https://github.com/OliverJAsh/eslint-plugin-expect-type-issue
The text was updated successfully, but these errors were encountered: