Commit Graph
36555 Commits
Author SHA1 Message Date
Sheetal NandiandGitHub 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 NandiandGitHub 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 BarzilayandGitHub ec95c27b4d Fix getSignatureOfTypeTag (#37473)
Prevents infinite looping as in #37265.

Fixes #37265
2020-03-19 19:02:39 -04:00
Andrew BranchandGitHub 292d01880f Add code fix for importsNotUsedAsValues error (#37468) 2020-03-19 13:13:15 -08:00
Anders HejlsbergandGitHub e15a9fb3a8 Track tuple type recursion in inferFromObjectTypes (#37479)
* Track recursive tuple types in inferFromObjectTypes

* Add regression test
2020-03-19 14:05:33 -07:00
Sheetal NandiandGitHub 7e07a2b5d1 Allow rich response for compile on save (#37462)
Fixes #30739
2020-03-19 14:03:21 -07:00
Wesley WighamandGitHub c513a4adea Allow nested conditionals to be related via constraints (#37208)
* Allow nested conditionals to be related via constraints

* Delete word in comment
2020-03-19 12:03:50 -07:00
a83ce339c9 Fix poor error span for unclosed JSX tags in the presence of whitespace/comments (#37419)
* Improve jsx tag error span

* Move solution to parseJsxChild func

* Add tests and update baselines

* Update comment in src/compiler/parser.ts

Co-Authored-By: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Use skipTrivia to check for whitespaces and other trivia

* Import React into  errorSpanForUnclosedJsxTag.tsx

* .

* .

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-03-19 11:40:43 -07:00
Wesley WighamandGitHub e2156a1535 Add huge maximal length for noTruncation mode (#37461) 2020-03-19 10:45:00 -07:00
Andrew BranchandGitHub 237ea526f9 Preserve newlines from original source when printing nodes from TextChanges (#36688)
* Allow emitter to write multiple newlines in node lists

* Progress

* Progress

* Fix recomputeIndentation

* Add tests, fix leading line terminator count

* Do a bit less work when `preserveNewlines` is off

* Fix accidental find/replace rename

* Restore some monomorphism

* Fix single line writer

* Fix other writers

* Revert "Fix other writers"

This reverts commit 21b0cb8f3b.

* Revert "Fix single line writer"

This reverts commit e535e279f9.

* Revert "Restore some monomorphism"

This reverts commit e3ef42743a.

* Add equal position optimization to getLinesBetweenRangeEndAndRangeStart

* Add one more test

* Actually save the test file

* Rename preserveNewlines to preserveSourceNewlines

* Make ignoreSourceNewlines internal

* Optimize lines-between functions

* Add comment;

* Fix trailing line terminator count bug for function parameters

* Preserve newlines around parenthesized expressions

* Back to speculative microoptimizations, yay

* Don’t call getEffectiveLines during tsc emit at all
2020-03-19 09:46:00 -07:00
Wesley WighamandGitHub 667f3b411e Allow assertion signatures to narrow by discriminant (#37310) 2020-03-18 21:16:55 -07:00
Alexander TandGitHub ac3dc0c4d4 fix(37287): check appropriate context with enabled useDefineForClassFields (#37323) 2020-03-18 17:03:07 -07:00
Nathan Shively-SandersandGitHub 933c294923 Dom update 2020-03-18 (#37464)
* Copy over DOM updates from TSJS-lib-generator

* update baselines
2020-03-18 16:08:19 -07:00
Nathan Shively-SandersandGitHub 062104d9d5 Simplify return type of Object.fromEntries (#37457)
PropertyKey is accurate but not usable.

Fixes #31393
2020-03-18 14:35:19 -07:00
Sheetal NandiandGitHub 2df421b067 Always generate configFileDiag if file is going to be added to configured project (#37443)
Fixes #30623
2020-03-18 10:39:25 -07:00
Alexander TandGitHub 0aa2e2783c feat(37409): add fix all quick fix to fixInvalidJsxCharacters (#37436) 2020-03-18 09:54:17 -07:00
csigsandGitHub f8083d2917 LEGO: Merge pull request 37446
LEGO: Merge pull request 37446
2020-03-17 21:11:08 -07:00
csigs 5fd5690e14 LEGO: check in for master to temporary branch. 2020-03-18 04:10:28 +00:00
Anders HejlsbergandGitHub 0222211acb Support for/of variables in assertion checking (#37432)
* Support for/of variables in assertion checking

* Integrate with "dotted name" logic

* Add tests
2020-03-17 19:20:56 -07:00
Alexander TandGitHub c8e43d878f fix(37194): fix crash on go to the definition in variable assignment (#37253) 2020-03-17 16:16:28 -07:00
48e1745d6d Fix Node#getStart(sourceFile, true) throwing when node has a js doc and no parent (#37439)
* Fix missing source file argument.

* Add test

* fix lint

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-17 16:08:57 -07:00
Josh Goldberg 9adf2f84e2 Merge branch 'master' 2020-03-17 18:28:15 -04:00
Josh Goldberg c7b9edc863 Merge branch 'master' into extends-constructor-typeerror 2020-03-17 18:06:45 -04:00
Josh Goldberg f85ab2a5c3 Undind unintentional whitespace changes
This reverts commit 26c7615f58.
2020-03-17 18:02:47 -04:00
Jack WilliamsandGitHub c600aa7411 Fix #33732 (#36077)
* Fix #33732

* Remove code change but keep test
2020-03-17 14:58:52 -07:00
Alexander TandGitHub 66aa9e77bf fix(36247): disallow 'constructor' as a parameter property name (#37285) 2020-03-17 14:48:05 -07:00
878f447798 Clarified file-not-found error for reference paths without extensions (#35956)
* Clarified file-not-found error for reference paths without extensions

* Updated error message to include extensions

* update baselines missed in merge

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-17 14:21:23 -07:00
e60bbac84f Fix declaration emit when the packages are included through symlinks (#37438)
* Convert symlink scenarios to virtual FS where its symlinks are correctly maintained
Adds test for #36866

* Fix the casing issue when redirects differ in casing of the file

* Make ModuleSpecifierResolutionHost internal

* Refactoring for ModuleSpecifierResolutionHost

* If any of the file path option is from node_modules folder, consider only paths in node_modules folder

* Update src/services/utilities.ts

Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2020-03-17 13:21:40 -07:00
Alexander TandGitHub a510cad873 fix(36936): fix crash caused by resolving non existent export (#37077) 2020-03-17 13:21:20 -07:00
Alexander TandGitHub f1eb9898fb feat(36908): add 'property overwritten by spread' error for jsx attributes. add related span for conflicting declaration in spread (#37329) 2020-03-17 13:13:38 -07:00
b0450aed56 Add codefix for --noImplicitThis (#27565)
* Add codefix for --noImplicitThis

* Code review

* Back to building post-merge

* Remove redundant functions + update tests

Infer-from-usage also inserts `this: any` parameters when needed, so I
removed that from fixImplicitThis.

Otherwise, fixImplicitThis has better suggestions than inferFromUsage,
so I moved inferFromUsage later in the suggestion order.

* More redundancy removal

Don't need to add `@this` anymore either since inferFromUsage will do
that.

* More baseline updates

From moving inferFromUsage down in priority I think?

* remove now-redundant ad-hoc jsdoc emit

* fix more bad merge

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-17 13:00:14 -07:00
Ron BucktonandGitHub ec426eec8b Add script to work around GH issue with suggested reviewers (#37422) 2020-03-17 12:10:55 -07:00
9120497a33 Flatten immediately nested conditional types in the false position (#36583)
* Flatten immediately nested conditional types in the false position

* Add test

* Accept new baselines

* Handle nested distributive types with different checkType

* Allow deeply nested immediately resolving conditionals without any syntactic requirements or implementation contortions

Extract logic into function

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
2020-03-16 16:40:04 -07:00
Sheetal NandiandGitHub 2458c8a016 When the imported module is through node_modules and symlink to folder that isnt node_modules (#37387)
* Add tests that fail because of symlink to non common directory node_modules

* When the imported module is through node_modules and symlink to folder that isnt node_modules
Most of the monorepo like scenarios are like this so looking at symlink to decide if file can be imported is essential
Fixes #28689
2020-03-16 11:15:39 -07:00
Anders HejlsbergandGitHub b8baf48043 Fix assignment of intersections to objects with optional properties (#37195)
* Treat intersections of only objects as a single object in relations

* Exclude intersections containing non-inferrable types

* Accept new baselines

* Update test

* Accept new baselines

* Add tests
2020-03-14 09:45:05 -07:00
Josh Goldberg 26c7615f58 On second thought, removed the {}s 2020-03-13 20:32:42 -04:00
csigsandGitHub ad8d3d90a5 LEGO: Merge pull request 37390
LEGO: Merge pull request 37390
2020-03-13 15:11:19 -07:00
csigs fa8efcc11b LEGO: check in for master to temporary branch. 2020-03-13 22:10:43 +00:00
8b6bd41ce7 getPropertiesOfUnionOrIntersectionType: handle types with index signature (#31979)
* getPropertiesOfUnionOrIntersectionType: handle types with index signature

Fixes: #31565

* fix test

* more testing

* fix typo in checker.ts

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-13 14:30:53 -07:00
CaymanandGitHub 4432178ded Add valueOf declarations for TypedArrays (#36668) 2020-03-13 16:50:16 -04:00
Jesse TrinityandGitHub 4c160683c3 Add trimTrailingWhitespace Editor Option (#36905)
* add trim trailing whitespace option

* set default trimTrailingWhiteSpace to true

* add fourslash tests

* accept new baselines

* only preserce whitespace when setting is explicitly false

* format whitespace
2020-03-13 13:42:49 -07:00
Alexander TandGitHub fc30095e8b feat(33792): add new quick fix service to handle missing call in condition (#37152) 2020-03-13 13:38:44 -07:00
Wesley WighamandGitHub 47b60ece0b Make substitution types even if the substitution base isnt a type variable (#37348)
* Make substitution types even if the substitution base isnt a type variable

* Broaden usage of getConditionalFlowTypeOfType to _all_ type lookups

* Align comments
2020-03-13 11:02:11 -07:00
Andrew BranchandGitHub db44231e38 Add outlining spans for case clauses (#37374)
* Add outlining spans for case clauses

* Update old test

* Update other test

* Update yet another of the same test
2020-03-13 10:52:27 -07:00
Sheetal NandiandGitHub ba39113ab9 Handle when default project for file is solution with file actually referenced by one of the project references (#37239)
* Add test where file from referenced project of solution belongs to inferred project instead of referenced project

* Try to find project from project references if the default config project is solution
Fixes #36708

* Add test to verify the correct collection of projects

* Handle when default config project is indirectly referenced in the solution

* Include public API tests in unittests

* Make sure default project for script info is calculated correctly

* Handle reload projects

* Ensure to load solution project tree when project is referenced by solution

* Find all refs when the file is referenced via d.ts

* Some comments per feedback

* Fix typo
2020-03-13 10:46:58 -07:00
Alexander TandGitHub b41eb1bc61 feat(36249): add quick-fix action to declare a property as private which starts from underscore (#36632) 2020-03-13 10:33:56 -07:00
f1cc8e4e4e [minor] Adds some docs to the LSP interface (#36740)
* Adds some docs to the LSP dts

* Ensure that getProgramDiagnostic is included everywhere that getCompilerOptionsDiagnostic is

* Update baselines

* Apply suggestions from code review

Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>

* Remove the getCompilerOptionsDiagnostics -> getProgramDiagnostics change

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2020-03-13 13:26:39 -04:00
csigsandGitHub eaeee9cc31 LEGO: Merge pull request 37377
LEGO: Merge pull request 37377
2020-03-12 21:11:07 -07:00
csigs 98e45b40d1 LEGO: check in for master to temporary branch. 2020-03-13 04:10:29 +00:00
Sheetal Nandi a7b1717dcb Fix test failure as part of #35922 2020-03-12 18:26:39 -07:00