Commit graph

29961 commits

Author SHA1 Message Date
Ron Buckton 065a996345
Rerun LKG to remove 'awaited' type (#37616) 2020-03-31 11:54:02 -07:00
Jesse Trinity ef377d5a66
Don't delete comments when deleting unused declarations (#37467)
* don't delete comment on variable declaration

* add more declaration kinds

* don't copy comment in convertes6 class

* don't copy comments in convertToES6Class

* add tests

* use isAnyImportSyntax

* handle mixed comment types

* update tests
2020-03-31 10:18:06 -07:00
Anders Hejlsberg 2b0f351005
Fix narrow-by-constructor logic (#37698)
* Fix narrow-by-constructor logic

* Add regression test
2020-03-30 19:31:16 -07:00
TypeScript Bot 6ffbffbe62
Update user baselines (#37498)
Co-authored-by: typescript-bot <typescript@microsoft.com>
2020-03-30 16:20:51 -07:00
Nathan Shively-Sanders f17174ceb0 Fix build after merging #35862 2020-03-30 15:13:20 -07:00
Titian Cernicova-Dragomir 3433434142
Fixed issue where missing method call went unreported if the call target symbol did no have an id assigned or if the called property was used inside the if block on a different target. (#35862) 2020-03-30 14:45:32 -07:00
Jack Williams 0e15b9f245
Make never rest type top-like (#35438)
* Make never rest type top-like

* Add higher-order test

* properly support types which reduce to never

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2020-03-30 14:16:07 -07:00
Wesley Wigham 2f0cc51fee
Fix contextual types for maybe-async callbacks (#37205)
* Fix contextual types for maybe-async callbacks

* Remove comment
2020-03-30 14:15:51 -07:00
Neal Burger 9cd4b070ab
Add link to documentation in tsconfig.json template generated by tsc --init (#34686)
* Add Advanced Compile Options to --init command

* removed advanced options and descriptioncolumn

* tests: fix tsconfig.json baselines

* tests: fix failing tests

* feat: adjusted link to specification

* fix: removed duplicate increment flag

* chore: moved position back

* return of the comments

* fix for missalignment

* return of the comment
2020-03-30 14:14:00 -07:00
uhyo 1f56ab02f0
Improve error message for invalid return type of JSX component (#32702)
* New diagnostic message for wrong JSX function component

* Component and Mixed type

* fix existing tests

* add new test for JSX component return type error

* fix tslint error

* update diagnostic message to include component name

* accept baseline

* update tests

* missing semicolon

* accept baseline

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2020-03-30 13:04:33 -07:00
Jack Williams 4c440e5e5b
Fix #31319 : Narrow unit-unit inequality tests using comparability (#33071)
* Narrow unit-unit inequality tests using comparability

* Accept updated baselines

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2020-03-30 12:49:53 -07:00
Alexander T 64cb578945
update baseline (#37692) 2020-03-30 11:52:09 -07:00
Alexander T d8170faee1
fix(33054): allow variables starting with an underscore in for/of statement (#36739) 2020-03-30 11:18:18 -07:00
Alexander T 96f01227d4
fix(36909): wrong error message when trying to named-import an export (#36925) 2020-03-28 12:16:50 -07:00
Stephen Hicks 6d7539a211
Fix Number.is* to accept unknown again (#34932)
Fixes #34931

This essentially reapplies #24436 which incorrectly updated the generated files rather than the sources, and so was wiped out by 2f73986b44.

Note that this is specifically _not_ the same as #4002, which pertains to the global functions that coerce their arguments and therefore should _not_ accept `unknown`.  This change was already accepted 18 months ago, but was applied incorrectly.
2020-03-27 17:48:45 -04:00
Alexander T 3c130d1317
feat(37092): improve error message about missing default export (#37212) 2020-03-27 14:33:01 -07:00
Sheetal Nandi 7f5994958b
Handle comment directives in incremental parsing (#37632)
* Add test case that shows failure to handle commentDirectives in incremental parsing
Testcase for #37536

* Handle comment directives in incremental parsing
Fixes #37536
2020-03-27 12:00:34 -07:00
Andrew Branch 0f3a9d4d4b
Support completions for local named exports (#37606)
* Support completions for local named exports

* Add JSDoc

* Use sort text instead of filtering

* Revert new CompletionKind

* Return valid completions even when export declaration is in an invalid place
2020-03-27 10:47:02 -07:00
falsandtru 7f1df6e53e
Fix import order (#37510) 2020-03-26 13:55:56 -07:00
Orta 6afd5c996c
Adds a preview link to the baseline emits for sourcemaps (#37111) 2020-03-26 11:37:37 -04:00
Sheetal Nandi 0ae938b718
Report error when cannot read file (#37611)
This also consolidates helper for readFile failure
2020-03-25 21:29:02 -07:00
Ron Buckton 9119fe3797
Fix sys.debugMode when using VSCode's new preview debugger (#37558) 2020-03-25 19:18:36 -07:00
Ron Buckton 4fc4c4e3d6
Revert 'awaited' type (#37610) 2020-03-25 18:39:45 -07:00
Sheetal Nandi 84a3252e76
Handle packages inside another node modules package when auto importing (#37561)
Fixes #37542
2020-03-25 16:27:02 -07:00
Sheetal Nandi fd9e602fcf
When the global file is deleted mark all files as changed (#37538)
* Add test case when the errors are not refreshed if global file is deleted
Testcase for #36728

* When the global file is deleted mark all files as changed
Fixes #36728

* Update other baselines to fix file info
2020-03-25 16:26:10 -07:00
Sheetal Nandi 6bd68a83b4
Release the documents from language service using key instead of calculating it on the spot since we want to use correct paths for the files (#37596)
Fixes #37500
2020-03-25 15:51:07 -07:00
Ron Buckton b58a29b808
Fix emit for optional chain with non-null assertion (#36539)
* Fix emit for optional chain with non-null assertion

* Treat '!' differently inside chain vs end of chain

* remove dead code and fix comment
2020-03-25 15:28:13 -07:00
Andrew Branch a04225dbec
Don’t suppress completions after yield (#37609) 2020-03-25 15:27:47 -07:00
Wesley Wigham 4567fc4f1a
Ensure computed property names are always checked (#37307) 2020-03-25 15:16:54 -07:00
Sheetal Nandi 6c1e8aa0ad
Sort the arrays of fileNames in the build info (#37541)
* Sort the arrays of fileNames in the build info
Earlier we did this in testing to ensure we could baseline now moved to actual build info writing
Fixes #37156

* Sort using compareStringsCaseSensitive
2020-03-25 14:57:46 -07:00
Andrew Casey e1772fa40e
Add test for #35011 (#37312)
* Add test for #35011

When searching for a default configured project, stop at
`node_modules`.

* Be more explicit about inferred projects

* Move test into tsserver/projects.ts

* Use existing helpers to simplify tests
2020-03-25 14:48:54 -07:00
Rustin 8615eecfc1
Enhancement new expression with type arguments without parenthesized argument list error message (#37576)
* Enhancement new expression with type arguments without parenthesized argument list error message

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>

* add baselines

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>

* use parseErrorAt

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>

* refine code

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>

* Space before paren

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-03-25 12:37:46 -07:00
Sheetal Nandi b7b2c333a9
Handle if reading tsconfig file fails (#37563)
Fixes #36862
2020-03-25 10:14:31 -07:00
Nathan Shively-Sanders a1c8608f68
Revert cloneNode overrides in the DOM (#37568)
* Revert cloneNode overrides in the DOM

See microsoft/TSJS-lib-generator#842

* update baselines
2020-03-24 17:56:27 -07:00
Andrew Branch 37569d01f6
Convert to async function: handle type arguments to then/catch (#37463)
* Handle type arguments to then/catch

* Keep single-line types on a single line
2020-03-24 09:56:47 -07:00
Sheetal Nandi 9f296ce96d
Do not include global errors in semantic errors from the file (#37545)
Fixes #37084
2020-03-24 09:53:27 -07:00
csigs 7ade67da09
LEGO: Merge pull request 37553
LEGO: Merge pull request 37553
2020-03-24 09:11:09 -07:00
csigs f55cb455ba LEGO: check in for master to temporary branch. 2020-03-24 16:10:28 +00:00
Sheetal Nandi 11043b0951
Check JSDocPropetyTag (#37544)
Fixes #37040
2020-03-23 17:20:35 -07:00
Jack Works 38e717a244
fix: hyphened name not auto-completed by the ls (#37455)
* fix: hyphened name not auto-completed by the ls

* fix: accept new baseline

* Adds a test to validate the hypened identifiers in JSX

Co-authored-by: Orta Therox <orta.therox@gmail.com>
2020-03-23 17:08:44 -04:00
Sheetal Nandi 221a2aeb1b
Handle import type and export type in preprocess (#37508)
Fixes #37338
2020-03-23 10:11:01 -07:00
csigs 5fa066f6a6
LEGO: Merge pull request 37517
LEGO: Merge pull request 37517
2020-03-22 09:11:05 -07:00
csigs fa32f40a9d LEGO: check in for master to temporary branch. 2020-03-22 16:10:26 +00:00
Orta fbd83b848c
Bring over last 3.9 dom changes (#37502)
* Bring over last 3.9 dom changes

* Addresses feedback
2020-03-20 17:17:27 -07:00
Anders Hejlsberg fde9c7f555
Narrowing from truthy unknown to object (#37507)
* For x && typeof x === 'object', narrow x to just type object

* Add tests

* Allow arbitrary nesting / add comments

* Add additional tests
2020-03-20 17:09:24 -07:00
Ron Buckton e3ec7b18b8
Add the 'awaited' type operator (#35998)
* Add the 'awaited' type operator

* Add script to manually add reviewers to a PR when GH 'Suggested Reviewers' breaks

* Fix lint error in review script

* Only defer generic awaited type for possible thenable

* Add variance-like behavior for awaited

* Switch awaited type params to 'unreliable' variance

* fix typo in inferTypes

* LKG without syntax in lib

* LKG with new syntax in lib

* Add 'strictAwaitedTypes' flag

* Treat strictAwaitedTypes as strict-mode flag

* Rename TAll, remove duplicate definition of 'race'

* Apply suggestions from code review

Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>

* Fix inference priority

* Update comment to isGenericAwaitableType

* Add overloads for then/catch to Promise

* Add inference heuristic for T | PromiseLike<T> (for any PromiseLike)

* Remove strictAwaitedTypes flag

Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
2020-03-20 16:09:01 -07:00
TypeScript Bot 114fe4deab
Update user baselines (#37354)
Co-authored-by: typescript-bot <typescript@microsoft.com>
2020-03-20 10:28:12 -07:00
Sheetal Nandi 8f64d667f2
If emitting declaration file, update the d.ts signature in state to not have to save all files when different file changes without changing its shape (#37483)
* Add test that calling getAffectedFiles on two different files (even if the second one is saved) returns all files

* If emitting declaration file, update the d.ts signature in state to not have to save all files when different file changes without changing its shape
Fixes #30508
2020-03-20 10:16:41 -07:00
Sheetal Nandi 5e9c43607f
Handle auto import scenarios when using project references (#37482)
* Add test for project reference and auto import
Test for #34677

* Add project reference redirect to the possible file name to import if file is source of project reference redirect
Fixes the auto import suggestion when project is built

* Use fileExists that mimics presence of project reference redirect file when trying to get auto import file name
2020-03-19 16:53:44 -07:00
Eli Barzilay ec95c27b4d
Fix getSignatureOfTypeTag (#37473)
Prevents infinite looping as in #37265.

Fixes #37265
2020-03-19 19:02:39 -04:00