Commit graph

31770 commits

Author SHA1 Message Date
Nathan Shively-Sanders 0eef927713
Update npm in user tests (#42841)
* Update npm in user tests

* Update npm baseline

* update tsconfig of npm user test

* Use source repo npm/cli instead

* update baseline
2021-02-18 17:06:58 -08:00
Oleksandr T e961916217
fix(42368): omit converting jsx spread attributes to Object.assign for ES2018 and up (#42554) 2021-02-18 17:06:08 -08:00
ExE Boss 0723904bfb
feat(lib/es2021): Add type parameter to FinalizationRegistry (#42274)
* feat(lib/es2021): Add type parameter to `FinalizationRegistry`

* test(lib/es2021): Add test for generic `FinalizationRegistry`
2021-02-18 16:43:36 -08:00
ZYSzys 9950b6e596
Improve error messages for computed class property names (#42675) 2021-02-18 15:58:18 -08:00
Titian Cernicova-Dragomir a2ed469022
Fix for crash when using ca call expression on private identifier coming from an any typed variable. (GH #42860) (#42861) 2021-02-18 13:54:10 -08:00
pushkine d2737ecd17
Update scriptInfo.ts (#42855) 2021-02-18 10:52:58 -08:00
Andrew Branch 1fd71478f9
Fix duplicate auto-import completions (#42850)
* Fix duplicate auto-import completions

* Update src/services/completions.ts

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

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-02-18 10:06:37 -08:00
TypeScript Bot 05ee94fba3 Update package-lock.json 2021-02-18 06:23:37 +00:00
Nathan Shively-Sanders 3d7ec8aab2
Improve @template lookup and resilience (#42851)
* Improve @template lookup and resilience

1. @template parsing may produce a template tag with a type parameter
whose name is the missing identifier. These tags should be skipped
in the checker because they receive an error in the parser.
2. The fix in #37819 was incorrect; there's no such thing as a type
parameter declared on a variable declaration. Instead, there needs to be a type
parameter declared on a jsdoc comment, because that's the scope for tags
like `@return` and `@typedef`.

There are 3 tests because either fix (1) and (2) fix the first test's
failure, but both are required to fix the last two tests' failures.

* remove containsParseError call
2021-02-17 17:21:17 -08:00
Josh Goldberg c3d7a56e90
Specified diagnostic for iterating known array type without --downlevelIteration (#40070)
* Specified error message for iterating known array types without --downlevelIteration

* Added extra target info to diagnostic

* NodeList too, a classic

* PR feedback: invert to allowsStrings; required param

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-02-17 17:12:32 -08:00
Oleksandr T 7fca9267e6
fix(41740): disallow renaming/exclude from references default keyword (#41947) 2021-02-17 17:07:31 -08:00
Amin Pakseresht 20ce292484
Provide completion for partial expression on closing jsx tags (#42029)
* Provide completion for partial expression on closing jsx tags

* Add more cases and cover opening tag is parent parent of location

* Fix code style indentation

* Add some more notes

* Guarding null pointer

* Guarding null pointer 2

* PR reviews & adjustments 1

* Fix typos

* Better namings

* Remove failing test-case

* PR reviews & adjustments 2 - new approach

* More comments

* More comments 2

* PR reviews & adjustments 3

* Revert previous test-case file changes

* Write explicit completions from ranges

* PR reviews & adjustments 4 - adding exact entry

* Add another missing test-case

* Find jsx closing element by findAncestor

* Walk up till find jsx closing element

* Add one more test-case

* PR reviews & adjustments 4 - Pattern matching to get jsx closing element

* Minor change

* Linting fixes
2021-02-17 17:06:13 -08:00
Ryan Cavanaugh f5618562ab
Check for missing type parameter names in JSDoc template tags (#42017)
* Check for missing type parameter names in JSDoc template tags

Fixes #36692

* Update baselines
2021-02-17 16:54:56 -08:00
Anders Hejlsberg 412ecbc291
Reduce void | undefined only in conjunction with subtype reduction (#42846)
* Reduce void | undefined only in conjunction with subtype reduction

* Accept new baselines

* Add regression test
2021-02-17 14:48:07 -10:00
Jesse Trinity d640313ff2
Expand extractSymbol ranges (#42770)
* allow partial selections of node ranges

* separate tests for better failure investigation

* gate span expansion behind invoked command

* add invoked test

* comment wording

* for test
2021-02-17 12:55:12 -08:00
TypeScript Bot 5cdc87032b
Update user baselines +cc @sandersn (#42611)
Co-authored-by: typescript-bot <typescript@microsoft.com>
2021-02-17 10:07:06 -08:00
Chakib Ljazouli 3fe05c8c81
fix(37578): Deprecate variable name AllowQualifedNameInPlaceOfIdentifier (#38726)
* Change variable name AllowQualifedNameInPlaceOfIdentifier to AllowQualifiedNameInPlaceOfIdentifier

* Change deleting AllowQualifedNameInPlaceOfIdentifier to deprecating it instead.

* Fix failing tests

* Replace old value
2021-02-16 16:07:44 -08:00
Long Ho 3910d9ede2
fix: fix RelativeTimeFormat type definition (#39661)
* fix: fix RelativeTimeFormat type definition
Changes:
1. Change BCP47LanguageTag to UnicodeBCP47LocaleIdentifier: Those mean 2
different things. BCP47LangTag allows _ as separator while UTS35
doesn't. It also allows grandfathered locales and UTS35 doesn't.

2. Combine RelativeTimeFormat interface and const declaration into a
single class. The old way of declaring as `interface` & `const` permits
calling `Intl.RelativeTimeFormat` without `new` which is no longer
possible after `Intl.DateTimeFormat` & `Intl.NumberFormat`. The spec
explicitly forbids it in
http://ecma-international.org/ecma-402/7.0/index.html#relativetimeformat-objects
where:

> If NewTarget is undefined, throw a TypeError exception.

Intl.RelativeTimeFormat is also extensible per spec. This is closer to a
`class` than the current declaration.

* address feedbacks
2021-02-16 15:56:56 -08:00
Daniel Rosenwasser 4d1dfab9e0
Ignore .devcontainer for npm (#42826) 2021-02-16 15:56:29 -08:00
Matt Bierner 51c73a1cee
Add a basic dev container (#42041)
* Add a basic dev container

Adds a basic dev container. This basic development environment has tools like gulp installed

* Update CONTRIBUTING.md

* Move development container seciton to be first tip

* Spaces to tabs and remove comments

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-02-16 14:20:15 -08:00
Wenlu Wang d6a32e31ae
Fix import fix on react or react dev (#41950) 2021-02-16 10:28:48 -08:00
Jack Works bb8b9db9f7 Add error for missing await in conditionals 2021-02-16 12:00:41 -05:00
TypeScript Bot ba994f1381 Update package-lock.json 2021-02-16 06:24:18 +00:00
TypeScript Bot 847992b64b Update package-lock.json 2021-02-15 06:23:37 +00:00
TypeScript Bot 19e7a89bbb Update package-lock.json 2021-02-14 06:23:08 +00:00
TypeScript Bot 31f3742fc4 Update package-lock.json 2021-02-13 06:23:11 +00:00
Andrew Branch d3055f0f29
--inspect can no longer be used as a flag through gulp (#42701)
* --inspect can no longer be used as a flag through gulp

* Add --break alias

* Update scripts/build/options.js
2021-02-12 16:01:22 -08:00
Oleksandr T e5294b4d3c
fix(42519): fix infer function return type quick fix with arrow functions without parens (#42532) 2021-02-12 14:38:29 -08:00
Sheetal Nandi e98f6b07ab
Refactor project references and source map tsserver tests so they are inline for easy editing (#42782) 2021-02-12 14:32:23 -08:00
Nathan Shively-Sanders 5deb676b3a
No did-you-mean-to-call error on casts Part 2 (#42779)
* 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.

* Skip parentheses
2021-02-12 10:07:59 -08:00
Nathan Shively-Sanders f2bcb2101b
No did-you-mean-to-call error on casts (#42626)
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.
2021-02-12 09:36:55 -08:00
TypeScript Bot e72c015bca Update package-lock.json 2021-02-12 06:23:08 +00:00
Oleksandr T ff5ae3561f
feat(42735): add single line comments to selection ranges (#42763) 2021-02-11 17:14:55 -08:00
Oleksandr T 475036950e
fix(42133): fix instantiated undefined type from JS initializer (#42662) 2021-02-11 17:07:14 -08:00
Eli Barzilay c7bac6f2e6 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
2021-02-11 18:56:47 -05:00
Masato Urai a3ead92046 Improve error message for overload that takes spread arguments
The original error message on the last line I have added to in
functionParameterArityMismatch.ts was

    No overload expects 5 arguments, but overloads do exist that expect
    either 4 or Infinity arguments.

even if we do not define a function that takes Infinity arguments.

This PR changes it to this:

    Expected 0-6 arguments, but got 5 or more.

I feel it is still a bit strange but much more understandable.

Fixes #42418
2021-02-11 16:49:21 -05:00
Eli Barzilay 4fc9c8446d Refactor the tracing namespace organization
Also changes the `tracingEnabled.Mode.*` enum to a string union.
2021-02-11 16:08:35 -05:00
Oleksandr T b7922147d3
fix(42714): do not show inferFunctionReturnType QF on function body (#42737) 2021-02-11 10:46:48 -08:00
TypeScript Bot d18b728e0b Update package-lock.json 2021-02-11 06:23:23 +00:00
Daniel Rosenwasser 290b0ea94d
Pin Node version for Volta users. (#42746) 2021-02-10 12:56:22 -08:00
TypeScript Bot 55cd98eaa3 Update package-lock.json 2021-02-10 06:23:21 +00:00
Daniel Rosenwasser 94747aa4e1
Bump version to 4.3. (#42728) 2021-02-09 17:07:28 -08: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