* 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>
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>
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>
* Expose EncodedSemanticClassificationsRequest in protocol.d.ts
* Adds the response for encoded semantic highlights too
* Update types:
* Also include classificationtype anyway
* Fix feedback
Component commits:
361e19bbe8 Ensure no duplicates in named union list
615050437b Add regression test
Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
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>
Component commits:
cfd472f7aa Make 'calendar' and 'numberingSystem' open strings in es2020.intl.
Co-authored-by: Daniel Rosenwasser <Daniel.Rosenwasser@microsoft.com>
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>
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>
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>
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>
* 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>
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.)
* 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
* 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 f0896f32ea3d523f1186e9bea2446f75f3a182de.
* 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
* 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
* 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
* Make object literal properties new identifier locations when not contextually typed
* Fix completions after comma in object literal
* Update other test