3499 Commits

Author SHA1 Message Date
Ron Buckton
eb27d3ec00 Improve inference for Promise.all of 'never[]' 2020-06-29 18:09:45 -07:00
ShuiRuTian
4601a786aa
not narrow static property without type annotation in constructor. (#39252)
* fix #39226

* fix lint.
2020-06-26 11:08:35 -07:00
Wesley Wigham
a3ee09ddc9
Handle recursive type references up to a certain level of expansion in inference (#38011)
* Handle recursive type references up to a certain level of expansion in inference

* Move object cases into the same conditional branch
2020-06-24 14:24:34 -07:00
Wesley Wigham
d1ebf126d2
Do not consider binding patterns in contextual types for return type inference where all the signature type parameters have defaults (#39081) 2020-06-24 13:45:17 -07:00
Wesley Wigham
7893c9fc7e
Do not add reexported names to the exportSpecifiers list of moduleinfo (#39213) 2020-06-23 17:56:44 -07:00
Daniel Rosenwasser
e6aedfd38b
Merge pull request #37907 from Jack-Works/feat/class-to-classname
feat: add a codefix to fix class to className in react & add spelling suggest for JSX attributes
2020-06-22 18:32:24 -07:00
ShuiRuTian
d76e85d94e
Update bigint declaration file (#38526)
* update toLocalString function signature

* update test.

* fix lint

* follow review advice.

* format and better comment.

* format

* add case

* fix symbol.

* remove subtype and string union in interface.

* remove useless code.

Co-authored-by: Song Gao <song.gao@laserfiche.com>
2020-06-22 14:55:04 -07:00
Jack Works
ffb35a3eb1 test: add test for it 2020-06-19 10:50:35 +08:00
Noj Vek
f697d26ca1
reset soft with master for single commit (#38720) 2020-06-18 00:22:32 -07:00
Dmitri
0bc29acc08
Add a type-guard overload of Array.every (#38200)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-06-17 13:02:30 -07:00
Eli Barzilay
7611579421 Small fix in getObjectLiteralIndexInfo
Fixes #38175
2020-06-17 03:29:10 -04:00
Eli Barzilay
f560560f82 Fix two test typos 2020-06-17 03:28:55 -04:00
Wesley Wigham
6a777ff6b3
Fix crash when serializing the return type of a generic call to Array.prototype.flat (#38904)
* Add declaration emit error and checking for circularly referential unions produced by recursive conditionals

* Allow indexed accesses to produce alias symbols on types

* Add test that still triggers the declaration emit error

* Fix spelling
2020-06-15 11:46:10 -07:00
Eli Barzilay
0432954f2d Small fix in getIsContextSensitiveAssignmentOrContextType
Test that `parentSymbol.valueDeclaration` exists.

Fixes #38532
2020-06-13 07:10:04 -04:00
Eli Barzilay
8231519b85 Simplify visitObjectLiteralExpression
I ran into it and the comment at the top tripped me, then I proceeded to
simplify the code.  Patched a bit more of the function to make sure that
the indentation doesn't change, and added tests.
2020-06-13 07:05:21 -04:00
Eli Barzilay
f447838f95 Fix handling of aruments in the emitter
Two problems are fixed:

* `isArgumentsLocalBinding` did only `PropertyAccessExpression`, now
  it's also doing `PropertyAssignment` (doesn't affect other files,
  since it's only used in the emitter).

* `visitShorthandPropertyAssignment` should call `visitIdentifier` on
  the synthesized id.  (For completion it might be better to make it
  visit the the original?)

Fixes #38594.
2020-06-13 07:05:21 -04:00
Andrew Branch
b63ea4b6df
Fix declaration emit for property references of imported object literal types (#39055)
* Fix declaration emit for property references of imported object literal types

* Add declaration file to test
2020-06-12 17:48:19 -07:00
Eli Barzilay
ffa35d3272 Allow e: unknown in catch arguments
In addition, allow an explicit `any`; anything else throws an error.

Also adjust and reorganize existing tests.

Fixes #36775.
2020-06-10 18:24:20 -04:00
Wesley Wigham
08cb0b23e8
Serialize (noncontextual) keyword named namespace members with export declarations in both declaration emitters (#38982)
* fix(38750): create unique names for keywords and re-export them with original names

* Serialize (noncontextual) keyword named namespace members with export declarations in both declaration emitters

* Add exhaustive keyword emit test for js declaration emitter and fix it up

Co-authored-by: Alexander T <alexander.tarasyuk@outlook.com>
2020-06-10 14:42:49 -07:00
Andrew Branch
0d6ae004d7
Fix isSameEntityName (#38999)
* Fix isSameEntityName

* Add baseline

* Fix baseline
2020-06-10 10:53:02 -07:00
Wesley Wigham
f41398e100
Make isEntityNameVisible duplicate the node builder logic to always consider type parameters as visible if they are the resolution result (#38921) 2020-06-09 13:40:17 -07:00
Eli Barzilay
4ee013d1a7 Fix merging of JS value & TS type decl
Fixes #38383
2020-06-04 19:28:33 -04:00
Anders Hejlsberg
c5b8f4fcd4
Fix relation between generic mapped types and types with index signatures (#38761)
* Fix relation between generic mapped type and type with index signature(s)

* Add tests
2020-05-25 09:55:41 -07:00
Nathan Shively-Sanders
fc83d10388 Merge branch 'master' into diagnose-accidental-accessor-call 2020-05-20 16:46:34 -07:00
Nathan Shively-Sanders
3340142dda
Merge pull request #38607 from a-tarasyuk/bug/38295
fix(38295): Duplicated object key in const not detected when the key is a number preceded by `-` or `+`
2020-05-20 14:52:09 -07:00
Alexander T
4e945fbc98
fix(38299): use string literals as keys to creating rest result (#38600) 2020-05-20 13:52:52 -07:00
Alexander T
bbf56b044b Merge branch 'master' of https://github.com/microsoft/TypeScript into bug/38295 2020-05-20 20:13:50 +03:00
Alexander T
e04ab6938a fix(38295): handle duplicate object literal keys which contain '+' and '-' tokens 2020-05-20 14:32:41 +03:00
Anders Hejlsberg
7ba0a6592d
No contextual types from circular mapped type properties (#38653)
* No contextual types from circular mapped type properties

* Add regression test
2020-05-19 13:42:30 -07:00
Anders Hejlsberg
3c1f37e913
Use control flow analysis to check 'super(...)' call before 'this' access (#38612)
* Use CFA graph to check this/super accesses are preceded by super() call

* Accept cleaned-up API baselines

* Accept new baselines

* Add tests
2020-05-16 19:58:17 -07:00
Eli Barzilay
33c3e9e2c6 Make processTaggedTemplateExpression visit a returned node
This problem was introduced in 70399e146e2 (from PR #23801), which added
a `visitTaggedTemplateExpression` case for `TaggedTemplateExpression`,
before that, it would fallback to the default of `visitNode`.  So re-add
that happen in `processTaggedTemplateExpression`.

Since it doesn't hurt, I left a `Debug.checkDefined(property.name)`
instead of `!`-ing it.

Fixes #38558.
2020-05-15 19:46:45 -04:00
Wesley Wigham
7fc456f2d7
Include unknown in spread prop override check (#38577) 2020-05-14 14:36:38 -07:00
Anders Hejlsberg
0091fd6c64
Exclude arrays and tuples from full intersection property check (#38395)
* Exclude arrays and tuples from full intersection property check

* Add regression test
2020-05-07 15:03:51 -07:00
Anders Hejlsberg
7798f532df
Fix crash caused by assertion with evolving array type (#38398)
* Properly finalize evolving array type in getTypeAtFlowCall

* Add regression test
2020-05-07 14:05:57 -07:00
Jack Williams
05d59a1f1a
Unify logic in typeof narrowing (#33434) 2020-05-06 15:15:24 -07:00
Josh Goldberg
be2eb8a2e1
Allowed comment directives to be multiline (#38228)
* Allowed comment directives to be multiline

* Added tests, and perhaps fixed a test runner bug?

* I think it's going to need a consistent variable to loop over

* Used dynamically computed indexes in verifies

* Added multiline tests

* Increased flexibility for multiline comment parsing

* Undid a couple of formatting changes; removed backslashes from multiline regexp

* Added baseline tests for multiline comment skipping

Co-authored-by: Orta Therox <orta.therox@gmail.com>
2020-05-06 13:09:29 -07:00
Anders Hejlsberg
2524fb164a
Consistent narrowing by discriminant (#38311)
* Consistent requirements for narrowing by discriminant

* Add tests
2020-05-05 20:06:07 -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
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
Leko
275ed548df disallows exponentials with BigInts for targets lower than ES2016 2020-05-04 13:14:48 -04:00
Andrew Branch
53320f59a4
Fix crash on duplicate default exports (#38272) 2020-04-30 12:21:02 -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
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
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
Daniel Rosenwasser
6a6c83cf9a
Revert "Revert "Add check for delete expression must be optional (#37921)" (#38154)" (#38173)
This reverts commit 1b8c68d7463e22903978bcb4a8c7dc8e3f7b3beb.
2020-04-27 13:23:45 -07: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 39beb1d011a6bc412a67e1dfa2ec1cb1de438b4f.
2020-04-24 16:05:18 -07:00
Daniel Rosenwasser
d28e38f573
Revert "make splice deleteCount required in es5.d.ts (#32643)" (#38169)
This reverts commit ddcf139668c3a0aeda1da6a0d44887735ad37cdf.
2020-04-24 14:30:28 -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