31595 Commits

Author SHA1 Message Date
TypeScript Bot
f6287c5997 Update package-lock.json 2020-12-31 06:32:26 +00:00
chenjigeng
ea93ee6db9
fix: host.isKnownTypesPackageName maybe undefined (#42050)
* fix: host.isKnownTypesPackageName maybe undefined

* feat: remove GH#18217 comment
2020-12-30 12:13:56 -08:00
Oleksandr T
e108257fb6
fix(41965): fix error in definite assignment assertion context (#41989) 2020-12-30 11:45:18 -08:00
Oleksandr T
dfe23421ba
fix(41867): completions - omit the deprecated flag if some declarations are not deprecated (#41941) 2020-12-30 10:42:38 -08:00
Nathan Shively-Sanders
3b222fe80c
Shrink error span on @type errors for signatures (#42024)
Previously, the error span was too large on @type errors on functions
when the type was not a function. The span covered the entire tag. This
PR changes the error node just to be the type of the type tag. In other words,
the error span was previously this:

```
@type {IncorrectType}
```

But is now just this:

```
IncorrectType
```

Fixes the first error from #41974, but not the other two.

Co-authored-by: Ashya Manning <ashyamanning@pursuit.org>
Co-authored-by: Nilber Remon <nilberremon@gmail.com>

Co-authored-by: Ashya Manning <ashyamanning@pursuit.org>
Co-authored-by: Nilber Remon <nilberremon@gmail.com>
2020-12-30 09:48:07 -08:00
Oleksandr T
303ed3a357
fix(42099): fix JSDoc optional properties declaration emit (#42116) 2020-12-28 13:34:55 -08:00
chenjigeng
ea03c2966b
Fix/jsx syntax quickinfo (#42124)
* feat: add jsx type invalid check

* feat: update jsxGenericQuickInfo test cases
2020-12-28 09:43:43 -08:00
Oleksandr T
fe297df9df
fix(42034): allow convert async function with empty catch (#42123) 2020-12-28 09:34:28 -08:00
Baptiste Darthenay
e4c4292807
fix(42128): Stricter type for ES5 Intl, redefine ES2020 intl (#42134) 2020-12-28 13:46:47 +00:00
TypeScript Bot
3b2c48f3cd Update package-lock.json 2020-12-24 06:31:15 +00:00
Jesse Trinity
8bbef818ed
Hierarchical refactorings (#41975)
* add hierarchical refactoring strings

* fourslash tests

* extractSymbol filters returned actions

* move refactorKind check to utilities

* rename parameters

* messaging for addOrRemoveBracesToArrowFunction

* fix up inferFunctionReturnType

* fix up convertArrowFunctionOrFunctionExpression

* add preferences to fourslash method

* fix up convert string

* fix up moveToNewFile

* fix lint errors

* remove extra arrow braces diagnostics

* break out tests

* add refactor helpers

* refactor refactors

* keep list of actions

* address PR comments

* response protocol

* address more comments
2020-12-23 12:50:03 -08:00
TypeScript Bot
d1ac4515c8 Update package-lock.json 2020-12-23 06:30:45 +00:00
Andrew Branch
c84838bd23
Avoid rewriting bare module specifiers on rename when fix is not verifiably correct (#41959) 2020-12-22 11:02:38 -08:00
orange4glace
1e4a5c9b37
fix(41259) : JS autocomplete doesn't work for object literal shorthands (#41539)
* fix: #41259

* fix: #41259

* fix: fourslash

* fix: remove nested if

* fix: change tc result for #41259

* fix: less restrictive shorthand completion rules

* fix: use typeMembers to find out whether properties are empty

* fix: typo

* fix: lint

* fix: exclude Object in completion

* fix: test

* fix: testcase tidy up

* fix: apply completions for unclosed literal and missing comma

* fix: ignore auto-imports

* fix: use exact to ensure the order of completions

* fix: use exact to ensure the order of completions

* fix: add new lines so it can easy to be distinguished
2020-12-22 10:36:52 -08:00
Ryan Cavanaugh
22f452c5cd
Update issue templates (#42049)
* Update issue templates

* Update .github/ISSUE_TEMPLATE/Bug_report.md

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

* Update .github/ISSUE_TEMPLATE/lib_change.md

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

* Update .github/ISSUE_TEMPLATE/lib_change.md

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

* Update .github/ISSUE_TEMPLATE/lib_change.md

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

* Update .github/ISSUE_TEMPLATE/lib_change.md

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

* Swap some orderings

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-12-22 09:04:56 -08:00
Song Gao
3442151f9d
completion for return const assertion. (#41475) 2020-12-22 09:16:30 +00:00
Baptiste Darthenay
bce412cb15
fix(40806): Add missing options and possible values of DateTimeFormat (#41880) 2020-12-22 09:13:01 +00:00
Martijn Pieters
a2ddfcfe0e
Add missing NumberFormatPartTypes types (#42066)
Adds 7 additional types found in ECMA-402, 7th ed. June 2020, https://www.ecma-international.org/ecma-402/#numberformat-objects (17 in total)
2020-12-21 16:34:16 -08:00
TypeScript Bot
6ea3885b8c Update package-lock.json 2020-12-21 06:27:53 +00:00
Anders Hejlsberg
22bee779d7
Properly make inferences from partial source type (#42038)
* Slightly less picky check in typesDefinitelyUnrelated

* Accept new baselines

* Add regression test
2020-12-19 07:18:44 -10:00
TypeScript Bot
777eb8459b Update package-lock.json 2020-12-19 06:27:42 +00:00
Andrew Branch
487be36919
Fix auto import completion inserting wrong module specifier (#41955)
* Don’t look for reëxports when import source was an ambient module

* Add additional assertion for clarity
2020-12-18 15:13:02 -08:00
Andrew Branch
e84a95f707
Fix find-all-refs crashing in some project references scenarios (#42025)
* Add failing test

* Fix test

* Accept baseline
2020-12-18 14:24:34 -08:00
Andrew Branch
49136f7879
Use getPropertiesForObjectExpression in string literal object completions (#42020)
Co-authored-by: Johanne Enama <jenama@users.noreply.github.com>
Co-authored-by: Kevin Wong <kwong0419@users.noreply.github.com>

Co-authored-by: Johanne Enama <jenama@users.noreply.github.com>
Co-authored-by: Kevin Wong <kwong0419@users.noreply.github.com>
2020-12-18 14:20:41 -08:00
Oleksandr T
a763600cc4
fix(41818): use last JSDoc comment related to host (#41858) 2020-12-18 13:24:58 -08:00
Wesley Wigham
c3ff0d4c17
Under jsx: preserve, actually preserve expressions which contain only comments (#41757)
* Under jsx: preserve, actually preserve expressions which contain only comments

* Even better best effort comment preservation in JSX comments
2020-12-18 11:42:33 -08:00
Wesley Wigham
caebbe6714
Dont check computed name visibility results when the computed name representation is not in use (#41806) 2020-12-18 11:41:55 -08:00
Andrew Branch
5cdb2e8899
Fix more inferred template literal types (#42039) 2020-12-18 10:31:42 -08:00
Ron Buckton
4239904517
Report implicit any error for 'yield' result with no contextual type (#41348) 2020-12-18 09:55:33 -08:00
Andrew Casey
902fcb0cc7
Use fs.realpathSync.native when available (#41292)
* Test that forceConsistentCasingInFileNames does not apply to Windows drive roots

* Add file symlink baselines

* Add directory symlink baselines

* Update test to retain its meaning

Its purpose is (apparently) to demonstrate that
forceConsistenCasingInFileNames can interact badly with synthesized
react imports.  Since the casing of the synthesized import has changed,
also modify the casing of the explicit reference to still conflict.

* Make VFSWithWatch.realpath use the path on disk

* Update VFS realpathSync to behave like realpathSync.native

* Use fs.realpathSync.native when available

In local measurements of an Office project, we saw initial project
loading get 5% faster on Windows and 13% faster on Linux.  The only
identified behavioral change is that it restores the case used on disk,
whereas realpathSync retains the input lowercase.

* Rename SortedMap.getKeyAndValue to getEntry
2020-12-18 09:23:42 -08:00
Ron Buckton
e789cb1356
Fix single-line comment disrupting return w/optional chain (#42026) 2020-12-17 18:55:09 -08:00
Wesley Wigham
052d7308e6
Add type annotation into services so _services_ API baseline is stable post-LKG (#42028) 2020-12-17 18:09:42 -08:00
Ron Buckton
2a736a88e3
Simplify visitNode's 'lift' argument (#42000) 2020-12-17 12:43:59 -08:00
Wesley Wigham
3722584029
Make the configurePrerelease script OK with version having a string type annotation (#42008) 2020-12-17 10:13:12 -08:00
Andrew Branch
3160b5cfcc
Don’t require fourslash completions tests to specify replacementSpan when it’s zero-length (#42013) 2020-12-17 09:45:49 -08:00
TypeScript Bot
c73e4805cc Update package-lock.json 2020-12-17 06:26:30 +00:00
Song Gao
8cbc576954
Fix #41800 correctly. (#41895)
* fix as suggestion.

* Update moduleSpecifiers.ts

* compare symbol rather than string

* fix typo.

* fix

* fix lint.

* better name and more clear code

* fix comment.

Co-authored-by: Orta Therox <git@orta.io>
2020-12-16 18:56:18 -08:00
Wesley Wigham
b217f22e79
Allow identical type parameter lists to merge in union signatures (#31023)
* Have signature identity checks look at the base constraint of type parameters, allow identical type parameter lists to merge in union signatures

* Update text in fourslash test

* Add whitespace to fix lint, remove duplicate impl

* Consolidate names

* Remove comparisons of type parameter defaults, add more test cases
2020-12-16 13:17:57 -08:00
Wesley Wigham
675cd4d7ce
Ensure factory symbol remains unused in react-jsx mode when not referenced in user code (#41905) 2020-12-16 13:11:48 -08:00
Wesley Wigham
4b8b0c861e
Fix post-LKG API baselines (#41973) 2020-12-16 11:31:39 -08:00
TypeScript Bot
0d8a868e91 Update package-lock.json 2020-12-16 06:26:03 +00:00
Anders Hejlsberg
bec8071c65
Simplify constraint depth limiter logic (#41972)
* Explore at least 10 levels of constraints before checking for deeply nested types

* Simplify constraint depth limiter logic

* Add regression test

* Accept new baselines
2020-12-15 17:08:36 -10:00
Wesley Wigham
b869c9cffa
Add text-based fastpaths into LS token matching (#41924)
* Add text-based fastpaths into LS token matching

* Update src/services/utilities.ts

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

* Update src/services/utilities.ts

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

* Update src/services/utilities.ts

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

* Limit search a bit

* Secretly, this was allowed to be `undefined` and was in fact used as such

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-12-15 15:40:48 -08:00
Oleksandr T
73df9eaec7
fix(41822): add isJSDocSeeTag (#41835) 2020-12-15 15:34:22 -08:00
Wesley Wigham
b9f372ed00
Generalize the fastpath for comparisons of unions which are correspondences (#41903)
* Generalize the fastpath for comparisons of unions which are correspondences to unions resulting from the application of intersections

* Add comment
2020-12-15 13:57:23 -08:00
Zen
422fd1962e
Spelling correction fixes should not be case-agnostic for two equally weighed options (#39060)
* Spelling correction fixes should not be case-agnostic when two equally weighed options occur. fixes #17219

* update tests

* Update src/compiler/core.ts

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

* init bestCaseSensitiveDistance lazily

* Add a test case with a class named the same as an instance, except for case

* make the core levenshtein distance check case-aware

* Update package-lock.json

* use fractional Levenshtein distance

* fix weight of Levenshtein distance

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update src/compiler/core.ts

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

* refactor

* Update package-lock.json

* revert unnecessary changes

* Update package-lock.json

* increase bestDistance

* increase bestDistance again

* make changes minimal

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-12-15 10:36:05 -08:00
Léo Meira Vital
4a9e2be386
fix(41868): Infer parameter from usage does not work on arrow functions that are a PropertyDeclaration of a Class (#41869) 2020-12-14 17:08:52 -08:00
Ron Buckton
9b2eab9da2
Merge pull request #41810 from microsoft/fixDeprecations
Fix deprecation messages to point to correct APIs
2020-12-14 12:51:48 -08:00
TypeScript Bot
e649b08c0d Update package-lock.json 2020-12-13 06:25:01 +00:00
Wesley Wigham
6bcb6bb369
Simplify expression type to fix build break (#41942) 2020-12-12 13:51:10 -08:00