microsoft / microsoft/DefinitelyTyped-tools
Generics with default and $ExpectType value
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 423
- Forks
- 237
- Avg merge
- 18h 18m
- Merged PRs (30d)
- 11
Description
Consider the following example:
class Foo<T = number> {
public bar: T;
}
declare const foo: Foo;
// $ExpectType Foo<number>
foo;
Should this be rendered instead as just Foo – ?
There's a situation that might motivate this further than just "it's simpler" which is that perhaps generics have been added to Foo but backwards compatibility is provided through the default type.
If a type is specified using just default types, should the tool drop those types from the output?
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 with the TypeScript example and trace how the tool evaluates $ExpectType assertions. No file or test entry point is named, so first locate that handling and review existing generic-type expectations. Done means establishing whether default generic arguments should be omitted and adding coverage for the chosen behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing-qa, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100