Commit Graph

26317 Commits

Author SHA1 Message Date
Anders Hejlsberg 2524fb164a Consistent narrowing by discriminant (#38311)
* Consistent requirements for narrowing by discriminant

* Add tests
2020-05-05 20:06:07 -07:00
Alexander T c219fdae08 fix(37703): forbid required parameter after optional (#38155) 2020-05-05 10:29:17 -07:00
Alexander T d86bdf4e5c add outlining spans for the tuple type (#38179) 2020-05-05 09:48:33 -07:00
Alexander T 2bdc8fdc94 add outlining spans for array destructuring elements (#38191) 2020-05-05 09:29:24 -07:00
Marcel Laverdet 44c6cf74cb Fix updateBinary operator parameter (#38129)
* Fix `updateBinary` `operator` parameter

There is an issue in `updateBinary` where attempting to update
`operator` without updating `left` or `right` results in a silent no-op.

* Use defaulted parameter in `updateBinary`
2020-05-05 09:05:02 -07:00
Daniel Rosenwasser 94c5c3ff47 Add missing arguments to typeToTypeNode. (#38336)
* Add missing arguments to typeToTypeNode.

* Use returnTypeNode as the enclosingDeclaration.

* Add a test.
2020-05-04 19:32:27 -07:00
Anders Hejlsberg e6390efb01 Properly handle private/protected members in unions of object types (#38277)
* Property handle private/protected properties in unions of object types

* Add regression test
2020-05-04 15:28:00 -07:00
Wesley Wigham d9c9c9d9e4 Harden node builder APIs to no longer return undefined for a node when NodeBuilderFlags.IgnoreErrors is provided (#38273) 2020-05-04 14:47:39 -07:00
Sheetal Nandi aa37b28246 Fix incorrect line text computation to stop comment directive searching (#38296)
Fixes #38289
2020-05-04 13:02:54 -07:00
Anders Hejlsberg a09470f013 Fix index signatures on unions of intersections (#38278)
* Add missing getApparentType call

* Add regression tests
2020-05-04 12:46:14 -07:00
Alexander T 5e0e254ef7 fix(38177): add auto-import for missing argument type in new functions/methods (#38213) 2020-05-04 12:37:04 -07:00
Eli Barzilay ba02f4303e Make getAwaitedType private
Also, fix an additional baseline change and break up huge line.
2020-05-04 13:18:52 -04:00
Alexander T 0503da225d feat(36266): add a quick fix for incorrect return types in async functions 2020-05-04 13:18:52 -04:00
Leko 275ed548df disallows exponentials with BigInts for targets lower than ES2016 2020-05-04 13:14:48 -04:00
Wesley Wigham 5b0194b311 Fix jsdoc variadic type nodes not being remapped to equivalent TS in output (#38276) 2020-05-02 01:43:59 -07:00
csigs e746c6883b LEGO: check in for master to temporary branch. 2020-04-30 22:10:46 +00:00
Andrew Branch 53320f59a4 Fix crash on duplicate default exports (#38272) 2020-04-30 12:21:02 -07:00
Jack Works 6f7faa7636 Fix: convertFunctionToEs6Class cannot recognize x.prototype = {} pattern (#35219)
* fix: convertFunctionToEs6Class cannot recognize `x.prototype = {}` pattern

* test: add test for convert fn to es6

* chore: add more tests

* chore: move tests around

* chore: make code more clear
2020-04-30 11:06:46 -07:00
csigs 836d9aaac0 LEGO: check in for master to temporary branch. 2020-04-30 16:10:36 +00:00
Jacob Bandes-Storch 0b1cb74530 fix order and tests 2020-04-29 23:04:24 -07:00
Jacob Bandes-Storch fd4eccee6c Merge remote-tracking branch 'upstream/master' into diagnose-accidental-accessor-call 2020-04-29 23:00:16 -07:00
Jacob Bandes-Storch 6051fc1814 move to invocationErrorDetails 2020-04-29 22:58:18 -07:00
csigs 10fd1fa347 LEGO: check in for master to temporary branch. 2020-04-29 22:10:59 +00:00
csigs 6916387597 LEGO: check in for master to temporary branch. 2020-04-29 16:10:44 +00:00
Orta 0258db2210 Adds support for looking up past Blocks in expando objects (#38031)
* Adds support for looking up past Blocks in expando objects

* Adds JS tests to validate the JS parsing also works

* Get the top level block expando tests green
2020-04-29 10:35:33 -04:00
Anders Hejlsberg d9ad27f2dd Early couldContainTypeVariables check in instantiateType (#37844)
* Shared early couldContainTypeVariables check in instantiateType

* Defer creation of map object in createUnionOrIntersectionProperty

* Types with top-level non-generic type alias reference no type variables
2020-04-28 17:02:52 -07:00
Anders Hejlsberg 3919042c7f Control flow for constructor initialized properties (#37920)
* Use CFA to determine types of properties declared by this.xxx assignments

* Accept new baselines

* Also use CFA in constructor functions

* Accept new baselines

* Fix lint error

* Only widen fresh literal types in CFA of assignment to auto-typed

* Auto-typing for declared properties with no type annotation or initializer

* Add optionality if declaration includes '?' modifier

* Always use CFA for properties with no initializer in .js files

* Small fix
2020-04-28 16:59:03 -07:00
Anders Hejlsberg a0ebd2c26e Guard against recursion in inferTypeForHomomorphicMappedType (#38224)
* Guard against recursion in inferTypeForHomomorphicMappedType

* Add regression test
2020-04-28 16:56:35 -07:00
Anders Hejlsberg 16d2eb7075 Error on this.xxx access of previously declared but uninitialized property (#38030)
* Error on this.xxx access of previously declared but uninitialized property

* Add tests

* Accept new baselines
2020-04-28 12:52:14 -07:00
Andrew Casey 9d8a70c809 Include a stack in InitializationFailedResponse (#38223)
* Include a stack in InitializationFailedResponse

* Update API baselines
2020-04-28 11:12:38 -07:00
Nathan Shively-Sanders 12cd15c867 this: undefined in modules (#37784)
It's always supposed to have been this way, but I was worried about how
breaky the change would be when adding globalThisType. This PR is
experiment to see how much.

Fixes #35882 maybe
2020-04-28 10:42:24 -07:00
Alexander T ef72e84314 Merge branch 'master' of https://github.com/microsoft/TypeScript into feat/add-outlining-spans-for-object-destructuring-elements 2020-04-28 17:15:25 +03:00
Alexander T 57f161eaa8 feat(38225): change diagnostic message for remove braces from arrow function body 2020-04-28 10:44:36 +03:00
Josh Goldberg d4825ab90f I did everything you said I followed all the rules 2020-04-27 19:59:41 -04:00
Andrew Casey 167f954ec7 Handle undefined in indent helper (#38217)
* Handle undefined in indent helper

Telemetry shows that it's called with undefined (probably `stderr` in an
error scenario?).

* Add undefined to parameter type
2020-04-27 16:18:39 -07:00
Daniel Rosenwasser 466d0c0ecb Bump version number to 4.0 (#38215) 2020-04-27 14:09:58 -07:00
Daniel Rosenwasser 6a6c83cf9a Revert "Revert "Add check for delete expression must be optional (#37921)" (#38154)" (#38173)
This reverts commit 1b8c68d746.
2020-04-27 13:23:45 -07:00
csigs 730bec81d1 LEGO: check in for master to temporary branch. 2020-04-25 04:11:05 +00:00
Wesley Wigham 4a5eeb0bb2 Skip comparing optional property flag when comparing against discriminant properties (#38101) 2020-04-24 18:33:30 -07:00
Daniel Rosenwasser 1b8c68d746 Revert "Add check for delete expression must be optional (#37921)" (#38154)
This reverts commit 39beb1d011.
2020-04-24 16:05:18 -07:00
Ryan Cavanaugh 84c83da3a9 Revert #37106 (#38172) 2020-04-24 16:04:33 -07:00
csigs b0b677649a LEGO: check in for master to temporary branch. 2020-04-24 22:10:50 +00:00
Ron Buckton 968943f355 Reset error variable in downlevel for-await-of loop (#38170)
* Rename forAwait tests

* Reset error var in for-await loop
2020-04-24 14:59:41 -07:00
Daniel Rosenwasser d28e38f573 Revert "make splice deleteCount required in es5.d.ts (#32643)" (#38169)
This reverts commit ddcf139668.
2020-04-24 14:30:28 -07:00
Alexander T 31b81bafe7 fix(38138): show suggestions for identifier in class property initializer (#38157) 2020-04-24 13:50:34 -07:00
Andrew Branch ce95d9ca6b Fix values and types merging in JS module exports (#37896)
* Fix values and types merging in JS module exports

* Fix everything

* Share `setValueDeclaration` between binder (local merge) and checker (cross-file merge)

* Revert accidental changes to baselines

* Update baseline from master merge
2020-04-24 13:49:48 -07:00
Wesley Wigham 1785d6c707 Special-case export assigned namespaces in getSpecifierForModuleSymbol so they behave like their containing module symbol (#38151) 2020-04-24 13:10:34 -07:00
Andrew Branch fe140acc09 Fix truthiness call check for this-property access (#38163) 2020-04-24 13:02:17 -07:00
Ron Buckton 38ff7762ec Fix temp variable scoping in async generators (#38121) 2020-04-24 12:10:29 -07:00
Andrew Branch 689822c183 convertToAsyncFunction: Disable for .then with both fulfillment and rejection handlers (#38152)
* Disable convert to async for `.then` with both fulfillment and rejection handlers

* Delete baselines

* Also disable refactor for 3+ arguments
2020-04-24 09:52:18 -07:00