microsoft / microsoft/DefinitelyTyped-tools
$ExpectType doesn't expand types?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 423
- Forks
- 237
- Avg merge
- 18h 18m
- Merged PRs (30d)
- 11
Description
I'm contributing to a DT package, sometimes I got message implying it doesn't compare types structurally:
1. eslint: TypeScript expected type to be:
boolean | "yes or no"
got:
"yes or no" | NonNullable<boolean | undefined> [@definitelytyped/expect]
It's inconvenient for writing tests as the result type might be wrapped inside another generic in the future.
If the wrapper type is not a simple utility type, it can be confusing what exact type this test is expecting.
I know I can add & {} to the return type in the definition, but that would also make it confusing for maintainers.
And I did have a grep on the DT codebase, it turns out I would be the first one to do & {} for the return type 😅
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the @definitelytyped/expect implementation and its existing $ExpectType comparison tests. Trace how the expected and actual types are obtained and compared, then extend the relevant behavior and add coverage showing the reported wrapped type is handled as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing-qa, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 66/100