Commit graph

31579 commits

Author SHA1 Message Date
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
Anders Hejlsberg ee1f262698
Template literal types for template literal expressions (#41891)
* Infer template literal types for template literal expressions

* Update test

* Update another test

* Accept new baselines

* Minor fixes

* Add tests

* Accept new baselines

* Make new TypeFlags internal

* Accept new API baselines

* Ensure template literals assignable to String, Object, {}, etc.

* Add tests
2020-12-11 15:07:37 -10:00
Andrew Branch 78ded6577e
Make findAllReferences work on triple-slash reference paths that resolve to scripts (#41936)
* Support find-all-references on triple-slash references that resolve to scripts

* Rename terrible name

* Add test for <reference types="..." />

* Actually accept baselines
2020-12-11 15:46:11 -08:00
Andrew Branch 9dfbf07d8a
Find references of a module by filename (#41805)
* Naive implementation enough to build and write a test

* Add simple test

* Add project references test

* Add deduplication test, accept baselines

* Add test for referencing a script (doesn’t do anything)

* Update API baselines

* Use refFileMap for non-module references

* Fix find-all-refs on module specifier

* Remove unused util

* Don’t store text range on ts.RefFile

* Ensure string literal could itself be a file reference

* Remove unused utilities

* Improve baseline format

* Preserve old behavior of falling back to string literal references

* Update baselines from master

* Fix old RefFileMap code after merge

* Add test for additional response info

* Undo test change
2020-12-11 12:37:02 -08:00
Oleksandr T 1c1cd9b08d
fix(37539): extend scope for function expressions to include JSDoc (#41364) 2020-12-11 09:00:05 -08:00
TypeScript Bot 06d37a2318 Update package-lock.json 2020-12-11 06:24:37 +00:00
Michael Molisani 716b167f2b
Watch extended configs if present (#41493)
* Watch extended configs if present

* Address code review comments

Added new `WatchType` for extended config files. Refactored watch map
update to separate function, relocated call sites. Removed unnecessary
test cases and relocated with new tests in programUpdates.

* Unify extended config file watching between tsc/tsserver

Update `updateExtendedConfigFilesWatch` to read from a
`TsConfigSourceFile` to get `extendedSourceFiles`. Add watcher map to
`ConfiguredProject` in the server. New test cases to verify correct
events triggered and extended files are being watched properly.

* Simplify watcher callback, fix tests

Removes unnecessary actions in extended config watcher callback
function. Updates tests to match.

* Share extended config watchers across projects in server

New shared watcher map in ProjectService that stores callbacks per
project to be invoked when the file watcher is triggered. The
FileWatcher is created with the watch options of the first Project to
watch the extended config.

* Refactor shared extended config map and watchers

Remove all server-related utility functions/types from
watchUtilities. Store config-project mapping and config file watchers
inside ProjectService with new private methods to add or remove
projects.

* Store projects in extended config file watcher

Creates SharedExtendedConfigFileWatcher in both editorServices
(tsserver) and tsbuildPublic. The file watcher is responsible for
triggering a full project reload for the contained projects. Upon
reload, any configs that are no longer related to a project have their
watchers updated to match. New test cases to confirm that the file
watchers for extended configs are closed when the project is closed.

* Apply suggestions from code review

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>

* Map extended config files by path

* Move shared watcher into utilities and add more tests

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2020-12-10 17:20:02 -08:00
Andrew Casey 3e72526600
Detect comparisons between large unions or intersections (#41574)
* Detect comparisons between large unions or intersections

If their multiplied size is greater than 1E6 (chosen based on the repro
in #41517), then we'll expend a large amount of time and memory
comparing them, so record a trace event.

Related to #41517

* Make an exception for primitive union comparisons

* Address PR feedback

* Pick up baseline change from master

* Eliminate diagnostic and only trace

* Don't check reportErrors
2020-12-10 13:52:41 -08:00
Andrew Branch 035c7ca905
Elide export assignment when it does not resolve to a value (#41904)
* Only mark aliases that resolve to values referenced

* Update other affected baselines

* Remove redundant check
2020-12-10 10:17:28 -08:00
csigs d156bb805e
LEGO: Merge pull request 41908
LEGO: Merge pull request 41908
2020-12-09 16:11:17 -08:00
csigs b75e854a15 LEGO: check in for master to temporary branch. 2020-12-10 00:10:58 +00:00
Oleksandr T 4dc82fdfba
fix(41845): add missing values to diagnostic message related to jsx option (#41873) 2020-12-09 13:41:15 -08:00
csigs d93cadb1bd
LEGO: Merge pull request 41900
LEGO: Merge pull request 41900
2020-12-09 10:10:56 -08:00
csigs 219d52d33c LEGO: check in for master to temporary branch. 2020-12-09 18:10:38 +00:00
TypeScript Bot bfd2b07d26 Update package-lock.json 2020-12-09 06:24:46 +00:00
csigs 24ec3ba9a2
LEGO: Merge pull request 41892
LEGO: Merge pull request 41892
2020-12-08 22:10:55 -08:00
csigs b2db33d74c LEGO: check in for master to temporary branch. 2020-12-09 06:10:38 +00:00