* Account for type parameters in missing function codefix
* Apply suggestions from code review
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* WIP
* Synthesize new type parameters instead of deep unions and intersections
* Pass along type parameter constraints
* E.T. phone home
* Clean up comments just a bit
* Only widen the instance type sometimes
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* fix(49719): omit TS2301 error with enabled usedefineforclassfields
* show error for target lower than esnext with useddefineforclassfields enabled
* change target from esnext to es2022
* Copy type parameters to function with @type tag
Previously, type references to generic types would fail to copy type
parameters from type references in an `@type` tag. Now the type
parameter is copied.
Note that I left 3 places in the checker unchanged, even though they
should technically also get type parameters from type refereneces:
1. getOuterTypeParameters -- not fixing this means that nested function
still won't get instantiated correctly. I'll see how hard this is to
fix.
2. getLocalTypeParameterOfClassOrInterfaceOrTypeAlias -- only applies to
constructor functions which have a type annotation, which doesn't type
check in the first place.
3. isThislessType -- This function is conservative, so should be
possible to make it more conservative without writing a lot of code.
Fixes#49039
* Update API baselines
* Improve narrowing logic for instanceof, type predicates, and assertions
* Accept new baselines
* Add tests
* Tweak algorithm
* Accept new baselines
* Optimize for discriminated unions
* 🐛 Avoid grouping JSDoc nodes of propery signatures with others in smart selection
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
* ⚗️ Add test case for JSDoc smart selection (#39618)
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
* ⚗️ Add test baseline for JSDoc smart selection (#39618)
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
* 🐛 Fix skipping SyntaxList first child's JSDoc in smart selection
Signed-off-by: GitHub <noreply@github.com>
* ⚗️ Add tests to ensure not skipping first SyntaxList child's JSDoc
Signed-off-by: GitHub <noreply@github.com>
* 🔨 Exclude JSDoc token from tokens pivoting property signature
Signed-off-by: GitHub <noreply@github.com>
* ⚗️ Update test case to also include modifier
Signed-off-by: GitHub <noreply@github.com>
* ⚗️ Update test case reference baseline
Signed-off-by: GitHub <noreply@github.com>
* 'keyof undefined' and 'keyof null same as 'keyof never'
* Update tests
* Defer types like `keyof (T & {})`
* Restore test
* Update test
* Accept new baselines
* Add tests