* Only issue @param suggestions with codefixes in TS
Previously, there were 2 JS errors that were issued as suggestions in TS
files. But there was no codefix for these errors, and the errors were
incorrect in TS.
This PR only issues the JS-specific errors on JS files.
* Minimise test
* fix issue where duplicate default exports aren't detected when there's an interface
* accept baseline change
* add `exportDefaultInterfaceClassAndValue` test
* add more tests for multiple default exports
* add two interfaces test
Co-authored-by: DetachHead <detachhead@users.noreply.github.com>
* Uncalled function checks only works with single conditional
* fix type errors in compiler
* remove uncalled function checks with negations
* review
* fix test
* Cleanup after merge, accept baselines
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
`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>
* 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
* 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) {
}
```