Commit Graph
14864 Commits
Author SHA1 Message Date
Alexander TandGitHub c219fdae08 fix(37703): forbid required parameter after optional (#38155) 2020-05-05 10:29:17 -07:00
Marcel LaverdetandGitHub 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
Anders HejlsbergandGitHub 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 WighamandGitHub 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 NandiandGitHub aa37b28246 Fix incorrect line text computation to stop comment directive searching (#38296)
Fixes #38289
2020-05-04 13:02:54 -07:00
Anders HejlsbergandGitHub a09470f013 Fix index signatures on unions of intersections (#38278)
* Add missing getApparentType call

* Add regression tests
2020-05-04 12:46:14 -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 TandEli Barzilay 0503da225d feat(36266): add a quick fix for incorrect return types in async functions 2020-05-04 13:18:52 -04:00
LekoandEli Barzilay 275ed548df disallows exponentials with BigInts for targets lower than ES2016 2020-05-04 13:14:48 -04:00
Wesley WighamandGitHub 5b0194b311 Fix jsdoc variadic type nodes not being remapped to equivalent TS in output (#38276) 2020-05-02 01:43:59 -07:00
Andrew BranchandGitHub 53320f59a4 Fix crash on duplicate default exports (#38272) 2020-04-30 12:21:02 -07:00
OrtaandGitHub 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 HejlsbergandGitHub 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 HejlsbergandGitHub 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 HejlsbergandGitHub a0ebd2c26e Guard against recursion in inferTypeForHomomorphicMappedType (#38224)
* Guard against recursion in inferTypeForHomomorphicMappedType

* Add regression test
2020-04-28 16:56:35 -07:00
Anders HejlsbergandGitHub 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
Nathan Shively-SandersandGitHub 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
Daniel RosenwasserandGitHub 466d0c0ecb Bump version number to 4.0 (#38215) 2020-04-27 14:09:58 -07:00
Daniel RosenwasserandGitHub 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
Wesley WighamandGitHub 4a5eeb0bb2 Skip comparing optional property flag when comparing against discriminant properties (#38101) 2020-04-24 18:33:30 -07:00
Daniel RosenwasserandGitHub 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 CavanaughandGitHub 84c83da3a9 Revert #37106 (#38172) 2020-04-24 16:04:33 -07:00
Ron BucktonandGitHub 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
Andrew BranchandGitHub 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 WighamandGitHub 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 BranchandGitHub fe140acc09 Fix truthiness call check for this-property access (#38163) 2020-04-24 13:02:17 -07:00
Ron BucktonandGitHub 38ff7762ec Fix temp variable scoping in async generators (#38121) 2020-04-24 12:10:29 -07:00
Ron BucktonandGitHub a7d6825e25 Fix temp vars referenced in parameter (#38130)
* Fix temp vars referenced in parameter

* Update error message
2020-04-23 20:45:39 -07:00
Wesley WighamandGitHub 815dc90dc5 Issue an error on cross-file merges we cant emit (#38148) 2020-04-23 19:01:16 -07:00
Andrew BranchandGitHub 9569e8aaa4 Fix newline issues when adding multiple imports (#38119)
* Add new import declarations in a single TextChanges call

* Refactor
2020-04-23 11:59:38 -07:00
Nathan Shively-SandersandGitHub 032aa90289 Filter undefined from binding elements with initialisers without undefined in the type (#38122)
* Filter undefined from binding elts w/o undefined-containing inits

* use getTypeOfInitializer instead

* improve comment based on Wesleys suggestion
2020-04-22 15:45:15 -07:00
Nathan Shively-SandersandGitHub f248567dab Filter undefined only in binding patterns in params (#38116)
initialiser. But this is only correct when the initialiser is for a
parameter. For example:

```ts
declare let x: { s: string } | undefined;
const { s } = x;
```

This PR removes undefined from the type of a binding pattern only when
the binding pattern's parent is a parameter. This fixes the regression
from 3.8. However, it's still not the ideal fix; we should be able to
use control flow to solve this problem. Consider:

```ts
const { s }: { s: string } | undefined = { s: 'hi' }
declare function f({ s }: { s: string } | undefined = { s: 'hi' }): void
```

Neither line should have an error, but the first does in 3.8 and after
this change.
2020-04-22 09:56:32 -07:00
Wenlu WangandGitHub 39beb1d011 Add check for delete expression must be optional (#37921)
* Add check for delete expression must be optional

* Add more tests
2020-04-22 03:12:01 -07:00
Andrew BranchandGitHub 7d4fc73331 Fix preserveNewlines printer option when a list child has the same start or end as its parent (#37846)
* Fix preserveNewlines printer option when a list child has the same start or end as its parent

* Fix leading line separator calculation and JSX bug
2020-04-21 15:34:30 -07:00
Wesley WighamandGitHub a72e49e875 Delay pulling on signature contextual type until absolutely needed (#37851) 2020-04-21 13:29:45 -07:00
Wesley WighamandGitHub 136f728bb0 Fix js declaration emit for inherited and this-typed inherited fields (#37970) 2020-04-21 13:13:50 -07:00
Nathan Shively-SandersandGitHub 6ea291a142 Remove superCallShouldBeFirst error (#37947)
* Remove superCallShouldBeFirst error

It seems redundant since TS gives an error on any use of `this` before
super, and non-`this` uses before `super` should be fine.

Fixes #37371

* Revert "Remove superCallShouldBeFirst error"

This reverts commit 3c09153c8a.

* error except for target:"esnext" && useDefineForClassFields
2020-04-21 12:58:37 -07:00
Nathan Shively-SandersandGitHub 63ff6572ae Fix use-before-def with methods on esnext+useDefineForClassFields (#38033)
* Fix use-before-def with methods on esnext+useDefineForClassFields

It was incorrectly flagging methods as used before their definition, but
this is allowed under any emit.

* Add instance function test case
2020-04-21 08:09:25 -07:00
Sheetal NandiandGitHub e7774c6144 Handle non literal computed name when trying to get the name for object literal property name in json object (#37988)
Fixes #37984
2020-04-20 12:58:38 -07:00
Eli BarzilayandGitHub 9c1157a801 fix(37242): add reference to return type for JSDocFunctionType (#37911) 2020-04-20 14:17:03 -04:00
Anders HejlsbergandGitHub 5d78cbdbbd Propagate nonInferrableType in &&, || and ?? operators (#38035)
* Propagate nonInferrableType in &&, || and ?? operators

* Add regression test

* Simpler solution: getTypeFacts(neverType) should return TypeFacts.None
2020-04-20 11:04:24 -07:00
Alexander T a2628c9088 fix(37242): add reference to return type for JSDocFunctionType 2020-04-17 09:05:23 +03:00
Wesley WighamandGitHub deb5bac520 Use string representation for negative numeric property names (#37936) 2020-04-15 21:11:05 -07:00
Wesley WighamandGitHub cdc384006c Fix crash on declaration emit for globalThis (#37992) 2020-04-15 13:37:51 -07:00
Alexander TandGitHub a16c44180a fix(37940): add space after parameter decorator (#37959) 2020-04-15 11:42:29 -07:00
okmttdhrandGitHub 06e05f25e1 Improve error message for computed enums (#37790)
* Add error message for computed enums

* Add test case for computed enums

* Accept baselines

* Fix returned value when error
2020-04-15 13:50:33 -04:00
Anders HejlsbergandGitHub 92cd3ae299 No iteration type errors during CFA (#37965)
* No iteration type errors during CFA

* Add regression test
2020-04-15 10:34:07 -07:00
Ashley ClaymoreandGitHub 4538640d8a Added error when Enum member initaliser references itself (#34655)
Fixes #34606
2020-04-14 15:20:19 -04:00
Wesley WighamandGitHub edd4e0a42b Add fastpath to isRelatedTo for type references (#37481)
* Add fastpath to isRelatedTo for type references

* Do not check intersections or unions to ignore propegating reference flags, properly set comparing jsx flag

* Re-remove unneeded check

* Just check for TypeFlags.Object

* Remove else clause
2020-04-13 15:54:37 -07:00
Wesley WighamandGitHub 6a5508b343 Update __exportStar helper to skip default and __esModule members (#37236)
* Update __exportStar helper to skip default and __esModule

* Accept new baselines

* Remove esmodule check from helper
2020-04-13 13:10:24 -07:00