Commit Graph

31753 Commits

Author SHA1 Message Date
TypeScript Bot fb6c839268 Bump version to 4.2.4 and LKG v4.2.4 2021-04-05 18:48:03 +00:00
Andrew Casey 6b33949ad6 Only catalog types when tracing (#43446)
(cherry picked from commit 9fd2b48c51)
2021-03-31 15:09:07 -07:00
Andrew Casey 0d7b5e6db0 Un-reverse condition (#43385)
(cherry picked from commit 64f8bbbf45)
2021-03-25 17:12:59 -07:00
Orta Therox db131130f7 Don't inherit jsdoc tags from overloaded signatures (#43165) (#43180)
* Don't inherit jsdoc tags from overloaded signatures (#43165)

Previously, when getting jsdoc for signatures, the services layer would
get the jsdoc tags for the base symbol of a signature if it was
present. This is fine except when the base was overloaded. In that case,
the multiple signatures of the overload would all contribute jsdoc,
which is not correct.

A more correct fix would be to resolve overloads to the base, but
the compiler doesn't have this capability and adding it or jury-rigging
it seems like it would be complex, inappropriate for a fix to ship in a
patch version.

Co-authored-by: Orta Therox <git@orta.io>

Co-authored-by: Orta Therox <git@orta.io>

* Update baseline

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-24 22:01:45 +00:00
Orta Therox e462dfa347 Don't use _fs.realpathSync.native on windows, a semi-revert of #41292 (#43348)
* Don't use _fs.realpathSync.native on windows, a semi-revert of #41292

* Use useCaseSensitiveFileNames instead
2021-03-24 22:01:33 +00:00
TypeScript Bot 34f0e32dc6 Bump version to 4.2.3 and LKG v4.2.3 2021-03-03 19:24:22 +00:00
Oleksandr T 47b2632ddd fix(43006): skip trivia in a function name (#43021) 2021-03-03 00:33:04 +00:00
TypeScript Bot 7b14d41642 Cherry-pick PR #43024 into release-4.2 (#43032)
Component commits:
bd2fd3b5e0 Only filter ignored paths from module specifier generation if there exists a better option

a687bae32b Nit

7597f5236f Merge branch 'master' into bug/42785

Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-03-01 16:39:34 -08:00
TypeScript Bot d9710135fc Cherry-pick PR #42971 into release-4.2 (#42972)
Component commits:
9f9825a4f0 Fix: checkAliasSymbol crash when checking for @deprecated
It's possible that we shouldn't be creating symbol with no declarations
from non-homomorphic mapped types, but for 4.2, the right fix is to make
the @deprecated-check in checkAliasSymbol ensure that
target.declarations is defined.

75449de4be Add bug number and accept baselines

Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
2021-02-25 16:54:58 -08:00
Orta Therox acc5fa0945 Expose EncodedSemanticClassificationsRequest in protocol.d.ts (#42640) (#42965)
* Expose EncodedSemanticClassificationsRequest in protocol.d.ts

* Adds the response for encoded semantic highlights too

* Update types:

* Also include classificationtype anyway

* Fix feedback
2021-02-25 23:02:13 +00:00
TypeScript Bot 08ad0e2b88 Cherry-pick PR #42943 into release-4.2 (#42964)
Component commits:
361e19bbe8 Ensure no duplicates in named union list

615050437b Add regression test

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
2021-02-25 14:18:56 -08:00
TypeScript Bot 822cb3a9a3 Cherry-pick PR #42766 into release-4.2 (#42950)
Component commits:
ed2681639c Avoid getting undefined `callSignatures`/`constructSignatures` in `getPropertyOfType`
e350c357 (#40228) introduced a subtle bug: it switched the flags to an
alias, dropping `SymbolFlags.Property` --- and that makes
`symbolIsValue()` get to the `resolveAlias(symbol)` call, which leads to
`getPropertyOfType()` with`resolved.callSignatures`+`constructSignatures`
being `undefined`.  So initialize them in `setStructuredTypeMembers`
before calling `getNamedMembers()`.

Fixes #42350

Co-authored-by: Eli Barzilay <eli@barzilay.org>
2021-02-25 09:10:52 -08:00
Daniel Rosenwasser e213b2af34 Update LKG. v4.2.2 2021-02-23 02:36:09 +00:00
Daniel Rosenwasser 31aa1cf93d Fix version for 4.2.2. 2021-02-23 02:35:56 +00:00
TypeScript Bot 486f0c142e Bump version to 4.2.2 and LKG 2021-02-20 00:22:10 +00:00
TypeScript Bot 2b34f0ac7b Cherry-pick PR #42886 into release-4.2 (#42888)
Component commits:
cfd472f7aa Make 'calendar' and 'numberingSystem' open strings in es2020.intl.

Co-authored-by: Daniel Rosenwasser <Daniel.Rosenwasser@microsoft.com>
2021-02-19 16:06:02 -08:00
TypeScript Bot 30368d0426 Cherry-pick PR #42861 into release-4.2 (#42867)
Component commits:
21eb38bd7f Fix for crash when using ca call expression on private identifier coming from an any typed variable. (GH #42860)

Co-authored-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
2021-02-18 14:46:52 -08:00
TypeScript Bot 57ba6ddaee Cherry-pick PR #42846 into release-4.2 (#42852)
Component commits:
0edae127ae Reduce void | undefined only in conjunction with subtype reduction

6b487a6db5 Accept new baselines

e7b6601de7 Add regression test

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
2021-02-17 17:48:43 -08:00
TypeScript Bot 16f2556473 Cherry-pick PR #42779 into release-4.2 (#42820)
Component commits:
214ef0c750 No did-you-mean-to-call error on casts
I chose to do the ad-hoc check rather than yet another tree walk.

1. It's faster to run and easier to read.
2. This error came from looking at real code. It happened twice, so I
think the best estimate for other uses that happened zero times is in
fact zero.
3. I couldn't think of other places to put the cast, given the
restrictions on `testedNode` just before the new code.

1d347785de Merge branch 'master' into no-did-you-mean-to-call-error-on-casts

b3be79ad0f Skip parentheses

2a288127e9 Merge branch 'master' into no-did-you-mean-to-call-error-on-casts

Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
2021-02-16 13:19:19 -08:00
TypeScript Bot 7f64b3a82c Cherry-pick PR #42626 into release-4.2 (#42780)
Component commits:
214ef0c750 No did-you-mean-to-call error on casts
I chose to do the ad-hoc check rather than yet another tree walk.

1. It's faster to run and easier to read.
2. This error came from looking at real code. It happened twice, so I
think the best estimate for other uses that happened zero times is in
fact zero.
3. I couldn't think of other places to put the cast, given the
restrictions on `testedNode` just before the new code.

1d347785de Merge branch 'master' into no-did-you-mean-to-call-error-on-casts

Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
2021-02-16 11:25:58 -08:00
TypeScript Bot 980b273aa5 Bump version to 4.2.1-rc and LKG v4.2-rc 2021-02-10 00:52:29 +00:00
TypeScript Bot 12e76910b2 Merge remote-tracking branch 'origin/master' into release-4.2 2021-02-10 00:13:56 +00:00
Sheetal Nandi 5280ba400c Handle if plugin doesnt specify name (#42717)
Fixes microsoft/vscode#116219
2021-02-09 15:23:29 -08:00
Orta Therox 8c5fa5cc91 Revert assignability cases in getNarrowedType (#42231)
* Revert subtype narrowing changes from readonly array PRs

* Adds a test for the change

* More baselines
2021-02-09 15:03:11 -08:00
Jesse Trinity 1b19af0f14 Refactor params for interface (#42652)
* apply refactor to interface methods

* handle calls

* no available refactors for union type

* add tests

* Update src/services/refactors/convertParamsToDestructuredObject.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* address comments

* Update src/services/refactors/convertParamsToDestructuredObject.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Update src/services/refactors/convertParamsToDestructuredObject.ts

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-02-09 13:30:31 -08:00
Daniel Rosenwasser 664ed17ebd Allow only package names as plugin names (#42713)
* Allow only package names as plugin names

* Remove extra argument following merge from master branch.

* kipped -> Skipped

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2021-02-09 11:30:09 -08:00
Eli Barzilay fe2899c2ac Use a 10ms sampling frequency to filter tracing dumps
Currently hard-wired to 10ms, can be made configurable if needed later.
2021-02-08 17:01:45 -05:00
Eli Barzilay f462576ac2 Re-do tracing initialization and tests around calls
Make `tracing` either `undefined` or the same namespace as before.
Switching all calls to `tracing?.___` means that there is no cost for
a call or the arguments when tracing is not used.  Comparing two runs
without tracing (27 runs, drop 5+5, avg rest) I get:

    master:
      42.59s user 1.00s system 165% cpu 26.372 total
    changed:
      42.01s user 0.982 system 165% cpu 26.039 total

(Makes it all private, so no api changes.)
2021-02-08 15:41:35 -05:00
TypeScript Bot 7de5d0b83a Update package-lock.json 2021-02-07 06:22:44 +00:00
Oleksandr T 60a6240210 feat(42637): add generateReturn option to UserPreferences (#42642) 2021-02-05 15:24:48 -08:00
Wesley Wigham 4c43e09c9e Add fallback error locations for nameless declarations, better class error locations (#42585) 2021-02-05 12:07:14 -08:00
Nathan Shively-Sanders aba932aefa Create synthetic exports symbol for commonjs module (#42655)
* Commonjs module:create synthetic exports symbol

Previously, the `module` identifier in commonjs modules got a synthetic
type with a single property `exports`. The exports property reused the
file's symbol, which, for a module file, gives the correct exported
properties.

However, the name of this symbol was still the filename of the file, not
`exports`. This PR creates a synthetic symbol for `exports` by copying
in a similar way to esModuleInterop's `default` symbol in
`resolveESModuleSymbol` (although the intent there is to strip off
signatures from the symbol).

* correct parent of synthetic symbol
2021-02-05 10:56:03 -08:00
Andrew Branch 79ed041b6a Fix Format Selection on JSDoc comments (#42411) 2021-02-05 10:37:47 -08:00
Nathan Shively-Sanders f1583f08a0 Signature help turns off current-parameter display for non-trailing rest parameters (#42592)
* Signature help: support non-trailing rest parameters

In signature help, the first rest parameter will always be the *last*
'current' parameter (disregarding types). Previously, the signature help
current-parameter highlight was only correct for trailing rest
parameters. However, with tuple types, you can now create non-trailing
rest parameters. This PR now correctly highlights non-trailing rest
parameters as the last 'current' parameter.

For example, `names` should be the current parameter in all the calls
below:

```ts
declare function loading(...args: [...names: string[], allCaps: boolean, extra: boolean]): void;

leading(/**/
leading('one', /**/
leading('one', 'two', /**/
```

And, because signature help doesn't do real overload resolution, `names`
is also the current parameter for other calls:

```ts
leading(1, 2, 3, 'ill-typed', /**/
leading('fine', true, /**/
```

* Change 'variadic' to 'rest'

* fix missed rename

* use single, original tuple instead

* Revert "use single, original tuple instead"

This reverts commit f0896f32ea.

* Improve sig help of trailing rest too

1. Trailing rest keeps highlight at end instead of going off the end.
2. Non-trailing rest disable highlight entirely (by putting the index
one past the end).

* update API baselines
2021-02-05 09:37:28 -08:00
TypeScript Bot 215ee40dc8 Update package-lock.json 2021-02-05 06:23:09 +00:00
Wesley Wigham 19db9ad675 Swapping the quote style of a string for completions should swap _all_ quotes in the string (#42650) 2021-02-04 13:56:34 -08:00
Wesley Wigham f569aa3832 Use a (hopefully) more efficient regex for matching jquery in the safelist (#42653) 2021-02-04 13:53:05 -08:00
Wesley Wigham 62bc8bec4e Replace _all_ tabs in pretty output, not just the first on each line (#42649) 2021-02-04 13:25:53 -08:00
Wesley Wigham be18057792 Add check for no match into fs watch rename event handler (#42651) 2021-02-04 13:20:38 -08:00
Anders Hejlsberg ab2729a99b Smarter subtype reduction in union types (#42353)
* Exclude primitive types from union subtype reduction in most cases

* Accept new baselines

* Minor fixes

* Less aggressive checking of assertion function calls that don't affect control flow

* Accept new baselines
2021-02-04 11:18:30 -10:00
Andrew Branch 258be217a6 Fix completions crash on transient exported property named 'default' (#42583)
* Fix completions crash on transient exported property named default

* Revert simplification, both conditions were needed
2021-02-04 10:22:15 -08:00
TypeScript Bot 05e2f74fbe Update package-lock.json 2021-02-04 06:22:59 +00:00
Oleksandr T 4c118ae67b fix(39022): wrap export references UnaryExpression to ParenthesizedExpression (#41156) 2021-02-03 18:26:33 -08:00
Anders Hejlsberg e2318217fb Strip nullable types from 'this' type in inference with optional chain calls (#42536)
* Properly strip nullable types from this type in optional chain calls

* Add regression test
2021-02-03 13:50:23 -10:00
Daniel Rosenwasser cce4bfbc7c Revert changes for template literal types, keeping tests. (#42588)
* Revert changes for template literal types, keeping tests.

* Update Baselines and/or Applied Lint Fixes

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-02-03 14:49:03 -08:00
Daniel Rosenwasser 654975481f Use spaces instead of non-breaking spaces, narrow non-breaking spaces. (#42500) 2021-02-03 14:29:42 -08:00
Sheetal Nandi c3e132da59 Keep extended config's raw file, include, exclude relative to itself and correct it when setting extending options (#42544)
* Test when config file extends is incorrectly computed
Test for #40720

* Keep extended config's raw file, include, exclude relative to itself and correct it when setting extending options
Fixes #40720
2021-02-03 11:09:06 -08:00
Andrew Branch 1c25b009f2 Sort import fixes by number of directory separators (#42614)
* Add failing test

* Sort all import fixes by number of directory separators
2021-02-03 10:42:13 -08:00
TypeScript Bot bfc55b5762 Update package-lock.json 2021-02-03 06:25:50 +00:00
Andrew Branch 96cc9b96fe Make object literal properties new identifier locations when not contextually typed (#42612)
* Make object literal properties new identifier locations when not contextually typed

* Fix completions after comma in object literal

* Update other test
2021-02-02 16:17:55 -08:00