Commit graph

14888 commits

Author SHA1 Message Date
Greg Hurrell
cfc4573c82 Fix (cosmetic) typos in checker.ts comments
Just some small things I noticed while looking at some recent PRs.
2020-05-14 19:40:41 +02:00
Anders Hejlsberg
c1f676dd3f
Perform intersection reduction before and after getApparentType (#38565)
* Perform intersection reduction before and after getApparentType

* Add regression tests
2020-05-13 20:57:17 -07:00
Daniel Rosenwasser
b682ee1a8a
Merge pull request #38489 from microsoft/removeDuplicateInfo
Remove duplicate JSDoc comments
2020-05-12 12:52:15 -07:00
Daniel Rosenwasser
c2b559403d
Merge pull request #38502 from alan-agius4/export-star-colon
fix: add missing semi-colon to `__exportStar` unnamed function
2020-05-12 10:59:03 -07:00
Nathan Shively-Sanders
cbf15bb6ed
feat(38225): change diagnostic message for remove braces from arrow function body (#38226) 2020-05-12 07:27:09 -07:00
Alan Agius
7ec21e93fe fix: add missing semi-colon to __exportStar unnamed function
Fixes #38501
2020-05-12 13:27:01 +02:00
Daniel Rosenwasser
f9e1bcd0c4
Merge pull request #38439 from lissein/void-0-template-strings
Changed template strings to emit void 0 instead of undefined (#38430)
2020-05-11 17:09:28 -07:00
Daniel
e9867a7353 Add and use the 'intersperse' helper function. 2020-05-11 22:17:01 +00:00
Ron Buckton
d07e866a28
Fix for jsdoc modifiers on constructor params (#38403)
* Fix for jsdoc modifiers on constructor params

* Update Public API baseline and fix unique symbol grammar check for js
2020-05-11 15:07:43 -07:00
Nathan Shively-Sanders
1a88430a7e
Improve assert message in binder (#38270)
* Improve assert message in binder

Looking at the code, I don't think the assert can ever fire, but it
clearly does, or did in the past. This will make it easier for people to
create a repro.

* fix lint

* Use BindableStaticNameExpression not BindableStaticAccessExpression

This type does allow identifiers, but those are ruled out earlier, so I added
an assert for that case.
2020-05-11 13:40:54 -07:00
Wenqi
1b7b3eb0f7
report error for duplicate @type declaration (#38340) 2020-05-11 12:47:49 -07:00
lissein
946abeadb0 Changed template strings to emit void 0 instead of undefined (#38430)
undefined is not a keyword in es5 and es3 so we now emit void 0 instead in template strings.
2020-05-09 04:53:14 +02:00
Wesley Wigham
7b03835b77
Fix js missing type arguments on existing nodes and jsdoc object literal declaration emit (#38368)
* Fix js missing type arguments on existing nodes and jsdoc object literal declaration emit

* Add special lookups test case, rename helper

* Accept slightly modified baselines
2020-05-08 10:46:28 -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
Alexander T
683b3ec058
feat(37782): 'declare method' quick fix for adding a private method (#37806)
* feat(37782): add quick-fix action to declare a private method for names that start from underscore

* better merge order in messages json

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-05-06 15:10:02 -07:00
Wenlu Wang
e66ce879a9
expose jsdoc factory (#29539)
* expose jsdoc factory

* refactor jsdoc factory

* correctly jsdoc factory types

* update jsdoc factory

* Add check for delete expression must be optional

* accept new basseline

* Revert "Add check for delete expression must be optional"

This reverts commit 76937c3b1a.

* remove newline

* make linter happy

* Add deprecated comment

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-05-06 15:06:12 -07:00
Nathan Shively-Sanders
35c1ba67ba
Update LKG 2020 05 06 (#38371)
* Update LKG

* remove now-extraneous casts
2020-05-06 14:42:05 -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
Ron Buckton
4b08c0582d
Fix regression in name resolution in parameter (#38351) 2020-05-06 12:04:28 -07:00
Alexander T
ec93a7cf7b
fix(36055): forbid union type with invalid types in the 'in' operator (#37786) 2020-05-06 11:41:50 -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
Alexander T
c219fdae08
fix(37703): forbid required parameter after optional (#38155) 2020-05-05 10:29:17 -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
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
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
Andrew Branch
53320f59a4
Fix crash on duplicate default exports (#38272) 2020-04-30 12:21:02 -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
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
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
57f161eaa8 feat(38225): change diagnostic message for remove braces from arrow function body 2020-04-28 10:44:36 +03: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
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
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
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