Commit Graph
11308 Commits
Author SHA1 Message Date
fbc2b677bc Cherry-pick PR #48463 into release-4.6 (#48477)
Component commits:
91631435ca Fix newline inserted in empty block at end of formatting range

79b600aaa3 Clean up

19ef6b67c5 Fix refactoring mistake

Co-authored-by: Andrew Branch <andrew@wheream.io>
2022-03-29 15:13:22 -07:00
014dc3dc89 🤖 Pick PR #48067 (Fix incorrect parser error assumpti...) into release-4.6 (#48068)
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
2022-03-01 10:22:42 -08:00
78ee4cacaf 🤖 Pick PR #47927 (Don't error if binding pattern type...) into release-4.6 (#48005)
* Cherry-pick PR #47927 into release-4.6

Component commits:
c4aa31b67f early return if pattern type is never

* Update LKG

Co-authored-by: Gabriela Araujo Britto <gabrielaa@microsoft.com>
Co-authored-by: typescript-bot <typescript@microsoft.com>
2022-02-23 00:56:14 -08:00
ec6ae0f26c Cherry-pick PR #47959 into release-4.6 (#47962)
Component commits:
465042e278 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.

4056b38860 Minimise test

4fb10f170a Merge branch 'main' into only-suggest-param-codefixes-in-ts

72499acabf Merge branch 'main' into only-suggest-param-codefixes-in-ts

Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
2022-02-18 16:39:47 -08:00
ded20c63fe Cherry-pick PR #47953 into release-4.6 (#47957)
Component commits:
aa1c25d35d Remove unnecessary check in getNarrowableTypeForReference

f4dcf881dc Add regression test

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
2022-02-18 16:39:32 -08:00
ea5a43a290 Cherry-pick PR #47830 into release-4.6 (#47928)
Component commits:
8f0e9356c3 fix(47820): forbid extraction jsdoc

Co-authored-by: Oleksandr T <oleksandr.tarasiuk@outlook.com>
2022-02-17 16:59:09 -08:00
b6ec37aac2 Cherry-pick PR #47909 into release-4.6 (#47912)
Component commits:
f4a5562543 wip: possible fixes

75cb7392f3 pass parameter type to assignBindingElementTypes

4a7de63c83 undo unnecessary changes

b618cf9371 update baselines

Co-authored-by: Gabriela Araujo Britto <gabrielaa@microsoft.com>
2022-02-16 09:05:17 -08:00
Andrew BranchandGitHub 0655f32e05 Add missing isolatedModules error for export import (#47838)
* Add missing isolatedModules error for `export import`

* Update existing baseline
2022-02-10 16:13:04 -08:00
Andrew BranchandGitHub 954d0442eb Avoid auto-importing from barrel re-exporting index files that are likely to make an import cycle (#47516)
* Avoid auto-importing from barrel re-exporting index files that are likely to make an import cycle

* Finish fixing merge conflict
2022-02-10 15:05:08 -08:00
Oleksandr TandGitHub b456702755 feat(11378): check param names in JSDoc (#47257) 2022-02-10 10:02:07 -08:00
Oleksandr TandGitHub 954ce5b278 fix(46611): allow to use jsdoc type on class methods (#46688) 2022-02-10 09:17:30 -08:00
95c22d1750 fix(47076):Fix error term of declaration in modules (#47087)
* 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>
2022-02-09 13:19:30 -08:00
Gabriela Araujo BrittoandGitHub 2d0a00d457 Fix destructuring and narrowing interaction (#47337)
* 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
2022-02-09 12:25:07 -08:00
Nathan Shively-SandersandGitHub d5c3015516 Constructor function methods:Add two missing tag lookups (#47742)
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) {
}
```
2022-02-09 11:22:33 -08:00
Andrew BranchandGitHub 2cf5afd49e Avoid pulling on setter type when only getter type is needed to break circularity (#47818) 2022-02-09 10:56:29 -08:00
Oleksandr TandGitHub c06849ad16 fix(47787): show QF to delete parameter in getter (#47797) 2022-02-08 13:39:54 -08:00
Andrew BranchandGitHub c5b1011e94 Compute writeType from set accessors for union and intersection properties (#47674)
* Compute write type from set accessors for union and intersection properties

* Add test for deferred writeType

* Always check for writeType of symbol
2022-02-08 12:57:34 -08:00
Oleksandr TandGitHub 17b97ccc43 fix(47788): forbid convertToMappedObjectType QF in invalid index signatures (#47798) 2022-02-08 11:36:45 -08:00
Andrew BranchandGitHub d8ac54bfb1 Fix substitution types of indexed access types of substitution types (#47791)
* Fix substitution types of indexed access types of substitution types

* Add tests

* Fix accidental unindentation
2022-02-07 15:53:13 -08:00
Oleksandr TandGitHub 867470ca26 fix(47783): show globals completion in case keyword outside of switch statement (#47786) 2022-02-07 14:08:35 -08:00
Oleksandr TandGitHub afeacf41bd fix(47782): forbid super() extraction outside this container (#47784) 2022-02-07 13:26:39 -08:00
Andrew BranchandGitHub 9c3b41d3cc Refactor named imports to default instead of namespace when esModuleInterop is on and module is an export= (#47744) 2022-02-04 17:11:25 -08:00
Oleksandr TandGitHub 8ddead50eb fix(32941): include Template tag constraint to QuickInfo response (#47567) 2022-02-04 16:12:23 -08:00
Ron BucktonandGitHub 3328feb799 Use 'static {}' for static fields when available and useDefineForClassFields is false (#47707) 2022-02-04 12:34:29 -08:00
Oleksandr TandGitHub ceee975052 fix(45917): show completions in string literal followed by a comma (#46970) 2022-02-04 12:15:02 -08:00
Oleksandr TandGitHub 0d5abd8a15 feat(27601): include JSDoc comments for destructuring arguments (#46886) 2022-02-03 11:27:40 -08:00
Oliver Joseph AshandGitHub b7d011777e "Convert parameters to destructured object": enable for functions with just one parameter (#46945)
* "Convert parameters to destructured object": enable for functions with just one parameter

Fixes https://github.com/microsoft/TypeScript/issues/41753

* Add test
2022-02-03 10:13:05 -08:00
Nathan Shively-SandersandGitHub c4fd0028f5 Fix @link https:// formatting (#47705)
* Fix @link https:// formatting

Also improve .d.ts formatting of `@link`,`@linkcode`,`@linkplain`.

Fixes #46734

1. Previously, `@link` incorrectly put a space between "https" and "://"
when formatting jsdoc for editors. Now it does not.
2. When fixing the same output for .d.ts, I discovered that all `@link` tags
were formatted as `@link`, even if they were `@linkcode` or
`@linkplain`. I fixed that too.

* semicolon lint
2022-02-02 14:00:08 -08:00
Oleksandr TandGitHub 854cec7387 fix(47670): remove import alias that uses the same name (#47676) 2022-02-02 10:45:18 -08:00
ZzzenandGitHub 880e2c0783 support quickinfo and go-to-definition on typeof this (#47085)
* support quickinfo and go-to-definition on `typeof this`

* update baseline

* move code to checkIdentifier
2022-02-01 16:16:01 -08:00
Ryan CavanaughandGitHub 2172e1964f Correctly check computed property names in type-space get/set accessors (#47156)
* Add test that should fail

* Make it fail

Fixes #47146

* Baselines
2022-02-01 12:49:05 -08:00
Gabriela Araujo BrittoandGitHub 46e7ab4dbf fix typefacts of intersection (#47583) 2022-02-01 12:10:43 -08:00
Ron BucktonandGitHub 21bbb576ad Fix captured const in downlevel for-await (#47680) 2022-02-01 11:47:29 -08:00
Ron BucktonandGitHub 63d9d4c8bf Transform param patterns/initializers after object rest (#47095) 2022-02-01 11:46:29 -08:00
Nathan Shively-SandersandGitHub 1ebdcc6fb8 Fix inlay hint crash for jsdoc function type syntax (#47684)
* Fix inlay hint crash for jsdoc function type syntax

Parameters in JSDoc function types do not have names. The type does not
reflect this. This PR fixes the crash; I'll see how much churn it causes
to fix the type as well.

Fixes #47606

* make inlay hints test smaller
2022-02-01 10:11:39 -08:00
Oleksandr TandGitHub 2d501b1d98 fix(47582): skip extraction if the type node is in the range of the type parameter declaration (#47596) 2022-01-28 12:19:48 -08:00
Andrew BranchandGitHub 3de032fd0d Allow usage of local value symbol merged with type-only import (#47642) 2022-01-27 16:18:14 -08:00
Gabriela Araujo BrittoandGitHub 90280518ae Add assert keyword in completions (#47644)
* add contextual keyword assert in completions

* clean up
2022-01-27 16:17:43 -08:00
Andrew BranchandGitHub 4d298591db Fix duplicate completions from two different copies of a node_modules package (#47584)
* Fix duplicate completions from two different copies of a node_modules package

* Fix logic for scoped packages

* Fix errors from merge

* Less gross way to reconcile these two conflicting PRs
2022-01-27 14:35:36 -08:00
Andrew BranchandGitHub e9092f3723 Proposal: simplify auto import descriptions (#47631)
* Simplify import fix descriptions

* Update tests

* Fix new test
2022-01-27 10:21:08 -08:00
Andrew BranchandGitHub 5813a3541c Allow moduleSymbolToValidIdentifier to be uppercase for JSX tags (#47625)
* Allow moduleSymbolToValidIdentifier to be uppercase for JSX tags

* Cleaner way of getting the uppercase name when needed

* Fix build errors, get rid of basically unnecessary ScriptTarget

* More accurate name for parameter

* Rename other parameter too

* Fix failing test
2022-01-26 16:12:40 -08:00
Andrew BranchandGitHub 0d3ff0cce8 Add codefix and completions for promoting existing type-only imports to non-type-only (#47552)
* Import fix

* Wire up completions, add sorting to fix

* Fix overlapping changes when there’s only one import specifier

* Update API baseline

* Add sorting and filtering back to UMD fix
2022-01-26 15:07:41 -08:00
Jake BaileyandGitHub 3718182a13 Don't block completion after end of type parameters in JSX elements (#47501) 2022-01-26 14:45:21 -08:00
magic-akariandGitHub 0f3809eff1 fix: enum self reference (#47287)
* fix: enum self reference

* fix: add test case

* chore: clean code

* fix: check `errorType` directly

* chore: revert refactor of `isConstantMemberAccess`
2022-01-26 14:13:34 -08:00
Oleksandr TandGitHub 3206df8e6d fix(47561): use parameter name from enclosing declaration (#47609) 2022-01-26 04:00:14 -08:00
Oleksandr TandGitHub 20b5523830 feat(42684): allow deprecated JSDoc tag to be used on aliased nodes (#47293) 2022-01-25 15:49:33 -08:00
Song GaoandGitHub 0673f0288c Fix JsDocTags inheritage and setter/getter quickInfo (#46801)
* tmp

* fix jsdoc inheritage for property and setter/getter

* fix test

* fix test

* fix mirrors

* add more tests

* add tests of jsdoc for intance of class
2022-01-25 15:43:12 -08:00
Gabriela Araujo BrittoandGitHub 3cbc8d2231 Fix narrowing of intersection with function type (#47483)
* add and and or mask to typefacts

* add comment
2022-01-21 12:05:34 -08:00
Oleksandr TandGitHub 5e38082a9e fix(47165): ignore spaces in goToDefinition imports (#47541) 2022-01-21 10:09:10 -08:00
Oleksandr TandGitHub e9453f411a fix(47524): skip assertion on checking this in fixImplicitThis QF (#47527) 2022-01-20 14:58:28 -08:00