Commit graph

29782 commits

Author SHA1 Message Date
Wesley Wigham ff0422091f
Update LKG (#37175)
* Update LKG

* Remove unneeded check (handled by top of function)
2020-03-02 15:15:41 -08:00
Wesley Wigham af4201ff51
Retain reexports in js emit even when they export nothing (#37124) 2020-03-02 14:33:53 -08:00
csigs 478dbfda93
LEGO: Merge pull request 37172
LEGO: Merge pull request 37172
2020-03-02 14:11:27 -08:00
csigs 8c19102e59 LEGO: check in for master to temporary branch. 2020-03-02 22:10:50 +00:00
Wesley Wigham d209092ccc
Use merged symbol to pick up js-alias-merged members on export assignments (#37162) 2020-03-02 12:57:00 -08:00
TypeScript Bot 24b926f0f9
Update user baselines (#37147) 2020-03-02 11:52:41 -08:00
Nathan Shively-Sanders 392fd0ac0b
Remove bogus @implements errors (#37114)
* Remove bogus @implements errors

Make the search for the actual host more comprehensive by reusing the
code that previously only searched for functions. I don't know what to
call this function now, since the old name wasn't accurate either.

* undo gratuitous name change

* Improve name and make calling more uniform

It's slightly less efficient but I think worthwhile for readability.
2020-03-02 09:48:53 -08:00
csigs 1e46185506
LEGO: Merge pull request 37154
LEGO: Merge pull request 37154
2020-03-02 08:11:08 -08:00
csigs 8443ed0fa3 LEGO: check in for master to temporary branch. 2020-03-02 16:10:31 +00:00
csigs c7f27c3316
LEGO: Merge pull request 37146
LEGO: Merge pull request 37146
2020-03-01 20:10:59 -08:00
csigs 88fd33944f LEGO: check in for master to temporary branch. 2020-03-02 04:10:23 +00:00
Anders Hejlsberg a5796cf3b2
Remove ordering restrictions in control flow analysis (#37134)
* Don't reset CFA type for x.y when x is narrowed

* Add tests

* Accept new baselines

* Remove unnecessary type assertion
2020-02-29 12:03:09 -08:00
csigs f914db0667
LEGO: Merge pull request 37133
LEGO: Merge pull request 37133
2020-02-29 08:11:01 -08:00
csigs a3d4822938 LEGO: check in for master to temporary branch. 2020-02-29 16:10:24 +00:00
csigs 4e25aedb7b
LEGO: Merge pull request 37128
LEGO: Merge pull request 37128
2020-02-28 20:11:06 -08:00
csigs 9ad4c5fcd3 LEGO: check in for master to temporary branch. 2020-02-29 04:10:25 +00:00
Anders Hejlsberg be4b814a4c
Reduce intersections by discriminants (#36696)
* Treat never-like intersections as never

* Accept new baselines

* Fix compiler issues revealed by increased intersection correctness

* Delete fourslash tests that are no longer applicable

* Include isNeverLikeIntersection check in getNormalizedType

* Erase never-like types in several more places

* Check that base types are not never-like

* Add comments

* Revert isNeverLikeType check in getIndexType (keyof shouldn't resolve member types)

* Introduce getReducedType for union and intersection types

* Don't reduce in getApparentType

* Avoid relationship check in resolveMappedTypeMembers

* Accept new baselines

* Don't call getReducedType in getIndexType

* Ensure reduced and unreduced forms of a type can compare identical

* Reduce types before converting them to string representation

* Accept new baselines

* Reduce intersections before obtaining keyof X

* Add tests

* Accept new baselines

* Fix comment in tests

* Don't infer from empty intersection types

* Add tests

* Accept new baselines

* Defer instantiation of mapped type property types

* Accept new baselines

* Include more precise type in diagnostic

* Accept new baselines

* Minor optimization

* Improve error message

* Optional properties in intersections are never discriminants
2020-02-28 17:06:44 -08:00
Wesley Wigham f31ff2dac0
Revert #36907 (#37122) 2020-02-28 15:53:24 -08:00
Andrew Branch f9945f5acf
Full support for CommonJS auto-imports in JS (#37027)
* Support add new requires

* Always use destructuring for requiring default exports

* Add more tests

* Update existing fourslash tests

* Use `getExportsAndPropertiesOfModule`

* Add UMD test

* Apply suggestions from code review

Fix typos

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

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-28 14:34:20 -08:00
Wesley Wigham 6a1e474cac
Update LKG (#37116) 2020-02-28 14:02:40 -08:00
Wesley Wigham c6c2c4c8d5
Hoist initial assignment to exported names in cjs to they are not blocked by bindings made by __exportStar (#37093)
* Hoist initial assignment to exported names in cjs to they are not blocked by bindings made by __exportStar

* Copy hoisted identifiers so they do not create sourcemaps

* Accept updated baselines
2020-02-28 13:25:28 -08:00
csigs 634d51431a
LEGO: Merge pull request 37098
LEGO: Merge pull request 37098
2020-02-27 20:11:15 -08:00
csigs c09001cf65 LEGO: check in for master to temporary branch. 2020-02-28 04:10:26 +00:00
Andrew Branch 0a6ee7753d
Grammar error on export type * (#37064)
* Recognize `export type *` syntax, but disallow it

* Add more comments to test

* Revert recognizing invalid forms as type-only

* Revert more
2020-02-27 16:35:15 -08:00
Nathan Shively-Sanders f1457c1c47 office-ui-fabric: silence progress counter again 2020-02-27 15:29:09 -08:00
Ryan Cavanaugh f4e371c731
Harden findAllReferences.ts against symbol.declarations = undefined cases (#37088)
Fixes #37086
2020-02-27 14:55:49 -08:00
Wesley Wigham 241b3b942a
Forcibly remove _the other_ submodules 2020-02-27 14:36:08 -08:00
Wesley Wigham a792fbb1a1
Forcibly remove submodules 2020-02-27 14:30:50 -08:00
Wesley Wigham 0326534a2a
Update LKG (#37087) 2020-02-27 14:24:21 -08:00
csigs d0c1a520b3
LEGO: Merge pull request 37089
LEGO: Merge pull request 37089
2020-02-27 14:11:21 -08:00
csigs 3d23f0888f LEGO: check in for master to temporary branch. 2020-02-27 22:10:46 +00:00
Pathurs 5c85febb0c
Fix Get/Set being enumerable (#32264)
* Fix Get/Set being enumerable

fixes #3610

* fix tests

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-27 14:08:20 -08:00
Wesley Wigham e7c578a67d
Reapply contextual type when recalculating array literals as tuples (#37071) 2020-02-27 14:02:28 -08:00
Eli Barzilay e71614a185 Proper treatment of splicing tuples in array literals
Fixes #32465.

After this was done, I continued to extend the implementation to handle
TupleLike types but it'ss broken since JS doesn't allow splicing
TupleLike values into array literals so pulled that out, and instead
keeping it for reference below.  (It Includes tests, which are broken
too.)

modified   src/compiler/checker.ts
@@ -22268,6 +22268,21 @@ namespace ts {
                         else hasNonEndingSpreadElement = true;
                     }
                 }
+                else if (spreadType && isTupleLikeType(spreadType)) {
+                    let i = 0, tupleEltType: Type | undefined;
+                    while (tupleEltType = getTypeOfPropertyOfType(spreadType, "" + i as __String)) {
+                        elementTypes.push(tupleEltType);
+                        i++;
+                    }
+                    const stringIndexInfo = getIndexInfoOfType(spreadType, IndexKind.String);
+                    const numberIndexInfo = getIndexInfoOfType(spreadType, IndexKind.Number);
+                    if (stringIndexInfo || numberIndexInfo) {
+                        if (stringIndexInfo) elementTypes.push(stringIndexInfo.type);
+                        if (numberIndexInfo) elementTypes.push(numberIndexInfo.type);
+                        if (i === elementCount - 1) hasEndingSpreadElement = true;
+                        else hasNonEndingSpreadElement = true;
+                    }
+                }
                 else {
                     if (inDestructuringPattern && spreadType) {
                         // Given the following situation:
new file   tests/cases/compiler/spliceTupleLikesWIntegers.ts
@@ -0,0 +1,23 @@
+declare const sb: { [0]: string, [1]: boolean };
+
+let k1: [number, string, boolean];
+k1 = [1, ...sb];
+
+let k2: [number, string, boolean, number];
+k2 = [1, ...sb, 1];
+
+// declare const sb_: [string, ...boolean[]];
+
+// let k3: [number, string, ...boolean[]];
+// k3 = [1, ...sb_];
+
+// declare const sbb_: [string, boolean, ...boolean[]];
+
+// let k4: [number, string, ...boolean[]];
+// k4 = [1, ...sbb_];
+
+// let k5: [number, string, boolean, ...boolean[]];
+// k5 = [1, ...sbb_];
+
+// let k6: [number, string, boolean, boolean, ...boolean[]];
+// k6 = [1, ...sbb_];
new file   tests/cases/compiler/spliceTupleLikesWStrings.ts
@@ -0,0 +1,23 @@
+declare const sb: { 0: string, 1: boolean };
+
+let k1: [number, string, boolean];
+k1 = [1, ...sb];
+
+let k2: [number, string, boolean, number];
+k2 = [1, ...sb, 1];
+
+declare const sb_: { 0: string, [s: string]: (boolean|string) };
+
+let k3: [number, string, ...(boolean|string)[]];
+k3 = [1, ...sb_];
+
+declare const sbb_: { 0: string, 1: boolean, [s: string]: (boolean|string) };
+
+let k4: [number, string, boolean, ...(boolean|string)[]];
+k4 = [1, ...sbb_];
+
+// let k5: [number, string, boolean, ...(boolean|string)[]];
+// k5 = [1, ...sbb_];
+
+// let k6: [number, string, boolean, boolean, ...(boolean|string)[]];
+// k6 = [1, ...sbb_];
2020-02-27 16:43:29 -05:00
Nathan Shively-Sanders 6c5c48c74c
Exempt ambient [#]private from unused error (#37050)
* Exempt ambient [#]private from unused error

These declarations exist to create nominality so they _must_ be unused.
There should be no error for them.

* Switch to fourslash test

I don't know how to baseline suggestion diagnostics in the compiler
tests.
2020-02-27 13:18:43 -08:00
Ryan Cavanaugh 35aea8bbfa
Remove crashing diagnostic code that wasn't helping us (#36913) 2020-02-27 12:45:28 -08:00
Wesley Wigham d33fb87da8
Include input PR title in bot PR title 2020-02-27 11:07:32 -08:00
Sheetal Nandi 188c3b7046
Measure module and type reference directive times (#37054) 2020-02-27 10:22:40 -08:00
Orta e804dc8900
Update the authors script to generate the content of authors.md (#36867) 2020-02-27 12:47:09 -05:00
Orta 2c4155c351
Adds underlines to differences in strings (#36409) 2020-02-27 12:46:15 -05:00
Titian Cernicova-Dragomir f883bf3acb
Adding support for @implements. (#36292)
* Adding support for @implements.

* Fixed code review issues for @implements, added some more tests.

* Fixed declaration emit for @interface

* Improved getImplementsTypes to not cache the results since it is only used once.

* Removed unnecessary checks from getImplementsTypes
2020-02-27 09:27:37 -08:00
csigs e3ec3d1942
LEGO: Merge pull request 37080
LEGO: Merge pull request 37080
2020-02-27 08:11:08 -08:00
csigs 5d38883d14 LEGO: check in for master to temporary branch. 2020-02-27 16:10:31 +00:00
csigs a6393b3b85
LEGO: Merge pull request 37074
LEGO: Merge pull request 37074
2020-02-27 02:11:09 -08:00
csigs 97157b460d LEGO: check in for master to temporary branch. 2020-02-27 10:10:32 +00:00
Alexander T baff821594
fix(36989): 'async' modifier cannot be used in an ambient context.ts (#37010)
* fix(36989): omit 'async' modifier for methods in declaration files.

* remove useless condition
2020-02-27 00:11:29 -08:00
csigs 60f50e22bb
LEGO: Merge pull request 37068
LEGO: Merge pull request 37068
2020-02-26 20:11:06 -08:00
csigs 91df1c8b53 LEGO: check in for master to temporary branch. 2020-02-27 04:10:29 +00:00
Sheetal Nandi d07761fe39
Allow --composite false or --composite null on the command line (#36997)
* Add tests for specifying composite as command line option

* Allow passing --composite false on commandline

* Add test to verify tsc --composite false from command line

* Handle "undefined" as option value to be set to undefined for that option

* Support "null" as option to be converted to undefined which is normally end result from our config file as well

* Support null as option for any tsconfig only option as well, and dont support undefined

* Fix public api test case

* Validates objects instead of stringify result

* Add composite true to base source
2020-02-26 15:26:26 -08:00
Sheetal Nandi 05c9ec3f12
Remove unnecessary assert (since we allow already open file to be opened again even through openFile command - partially) from updateOpen command (#37059)
Fixes #35034
2020-02-26 15:25:51 -08:00