`ThisParameterType<(...args: X) => void>` expands to
`(...args: X) => void extends (this: infer U, ...args: any[]) => any`.
When `X` is an unresolved type parameter it is not possible to determine
that `any[]` is assignable to `X`. However `never` is always assignable
to `X`, so we use that instead.
* Permit type arguments in references to generic functions
* Accept new baselines
* Delete pointless fourslash test
* Fix lint issue
* Finalize implementation
* Add tests
* Accept new baselines
* Properly handle instantiation of instantiation expression types
* Accept new API baselines
* Fix lint error
* Add more tests
* Properly handle unions/intersections of generic types
* Add more tests
* More permissive parsing of type arguments in member expressions
* Update tests
* Accept new baselines
* Triple-slash reference type directives can override the import mode used for their resolution
They now use the file's default mode by default, rather than always using commonjs. The new arguments to the
reference directive look like:
```ts
///<reference types="pkg" resolution-mode="require" />
```
or
```ts
///<reference types="pkg" resolution-mode="import" />
```
* Omit redundant import modes in emitter
* Add test for #47806
* Add server test for triple-slash reference mode overrides
* Move FileReference mode into helper
* Update tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride3.ts
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Eliminate redundant or meaningless elaborations in type relations
* Accept new baselines
* Add resetErrorInfo (though, oddly, shouldn't be necessary)
* Less aggressive reduction in second pass union/intersection checks
* Accept new baselines
* Restructure and back off a little bit more
* Only cache union/intersection relations once
* Accept new baselines
* Properly cache identity relations, clean up error reporting
* Move more logic to cached side of relation checks
* Optimize and remove more redundant elaborations
* Accept new baselines
* Remove unnecessary error state capture
* More optimizing
* Cache isWeakType computation
* Revert "Cache isWeakType computation"
This reverts commit 25a71c4de61f6366ffac080d19685dcb200f42b9.
* Address CR feedback
* Accept new baselines
* Enable path completions for node12/nodenext
* Explicitly pull path completions from export maps when available
* Explicitly handle pattern exports by stopping up to the star
* Checker:Remove block-scoped duplicate declaration errors in plain JS
Previously they were issued in mergeSymbol, not they are not issued.
* fix semicolon lint
* Fix error term of declaration in modules
* fix test
* change error code of "An import declaration can only be used at the top level of a module."
* Separate js and ts files for export errors in module.
* Change non-top-level error in namespace
* format
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* WIP: pass in checkmode to getNarrowableTypeForReference
* add tests
* another pass through new check mode argument
* rename new check mode
* only use rest flag for rest elements in objects
* add and update tests
* change check mode flag name
* restore package-lock.json
* fix comments
* get rid of fourslash tests
* fix caching in checkExpressionCached when checkMode is not normal
* Don't distinguish between object and array rest elements
* get rid of undefined check mode
* don't make includeOptionality into checkmode flag
1. During name resolution, `@param` and `@return` tags should walk up
through the jsdoc comment and then jump to the host function. Previously they
did not, which would cause them to not resolve type parameters bound in
the scope of a host that was not a sibling of the comment. The example
from #46618 is a prototype method:
```js
/**
* @template {T}
* @param {T} t
*/
C.prototype.m = function (t) {
}
```
2. During name resolution, prototype methods are supposed to resolve
types both from the host function's location and from the containing
class' location. The containing class lookup happens in a separate call
to `resolveName`. Previously, the code that finds the containing class
only worked for the above style of comment, which is on the outer
ExpressionStatement, but not for the below style, which is on the
function expression itself:
```js
C.prototype.m =
/**
* @template {T}
* @param {T} t
*/
function (t) {
}
```