9421 Commits

Author SHA1 Message Date
Andrew Branch
5d04250ea8
Improve “Add missing await” fix-all (#32922)
* Improve codeFixAll for add missing await

* Improve add missing await for initializers and fix-all

* Fix when only one side of a binary expression can have its initializer fixed
2019-08-20 16:53:28 -07:00
Wesley Wigham
a34ac8084c
Walk up parenthesized type nodes when looking for the type alias hosting a node (#32924) 2019-08-20 16:43:06 -07:00
Zixiang Li
24201cfe6e Add support for jsdoc properties with hyphen (#32631) 2019-08-20 14:49:40 -07:00
Nathan Shively-Sanders
6ca9d04b60
Constructor functions as classes (#32944)
* Initial implementation

The original test passes but I haven't run any other tests yet, so I
assume the world is now broken.

* Append constructor function construct sigs

Instead of overwriting them

* Grab bag of improvements.

1. Mark @class-tagged functions with Class too.
2. Only gather local type parameters of constructor functions.
3. Remove getJSClassType calls with getDeclaredTypeOfSymbol.
4. Add a couple more failing tests.

getDeclaredTypeOfClassOrInterface now needs to understand prototype
assignment. That's next, I think.

* Prototype assignments work now

1. Binder marks prototype assignments as Class now.
2. Checker merges prototype assignments using the same merge code as for
functions and their declarations. No more intersections.

Many fewer failing tests now.

* Mark prototype-property assignments as Class

Even if there are no this-property assignments in them. (Then why are
you using a class?).

* Simplify getJSClassType, remove calls to its guts

It's probably not needed because now it's just a conditional call to
getDeclaredTypeOfSymbol, and I think most callers already know whether
they have a JS constructor function beforehand.

* isJSDocConstructor doesn't need to check prototype anymore

Because all the properties are merged during getDeclaredTypeOfSymbol.

* outer type parameter lookup follow prototype assignment

* this-type and -expression support in ctor funcs

Pretty cool!

* Fix remaining tests

* Fix minor lint

* Delete now-unused code

* Add class flag to nested class declarations

Also remove old TODOs
2019-08-19 14:12:53 -07:00
Wesley Wigham
fd1e22bbf1
Instantiate generic conditional infer source types in the context of the target conditional (#31545)
* Instantiate generic conditional infer source types in the context of the target conditional

* Add test case from #26627
2019-08-19 13:01:08 -07:00
rChaser53
d75de60548 Fix Cannot read property 'text' of undefined crash (#32734)
* Fix Cannot read property 'text' of undefined crash

* fix condition for tsx

* Rename and improve the method
2019-08-19 12:08:34 -07:00
Wesley Wigham
d9f0212324
Resolve SymbolFlags.Type only at first in jsdoc getTypeFromTypeReference (#32947)
* Fix lookup of exported eunm type alias in local scope in JS

* Fix by adjusting type lookup fallback behavior to not include SymbolFlags.Value in its initial lookup instead
2019-08-19 11:31:47 -07:00
TypeScript Bot
2cde3b722a Update user baselines (#32975) 2019-08-19 10:46:30 -07:00
Collins Abitekaniza
0341c2fe75 add baseline for unknown type spread 2019-08-19 16:32:09 +03:00
TypeScript Bot
b57b5fe5ee Update user baselines (#32946) 2019-08-16 15:47:15 -07:00
Nathan Shively-Sanders
2b8ccf40ae
jsdoc template tags might be unmatched (#32936)
* jsdoc template tags might be unmatched

* Update fourslash test
2019-08-16 13:39:57 -07:00
Wesley Wigham
e145f322d8
Add produceLKG flag to cherry-pick PR script 2019-08-16 13:01:18 -07:00
Hoang Pham
46b7972885 Add JSX codefix if available (#32281)
* Add JSX codefix if available

* Update react jsx.

* Update diagnostic code.
2019-08-16 12:46:55 -07:00
Brendan Kenny
f45add0a7d checkJs: require JSDoc type argument for Array, Object, and Promise in noImplicitAny (#32829)
* Require type argument for JSDoc Array, Object, and Promise in noImplicitAny

* add jsdoc Array/Object/Promise noImplicitAny tests
2019-08-16 12:41:09 -07:00
Anders Hejlsberg
489abcacd4
Merge pull request #32919 from microsoft/fix32752
Stricter criteria for eliminating types in unions during inference
2019-08-16 10:55:48 -07:00
Anders Hejlsberg
c816cf2562 Add additional test 2019-08-16 07:45:02 -07:00
阿卡琳
a53e4a19ef Allow to omit the begin parameter of %TypedArray%.prototype.subarray (#32125)
* Allow to omit the begin parameter of %TypedArray%.prototype.subarray

* update baselines
2019-08-15 15:58:24 -07:00
Tan Li Hau
dcb763f624 Report error when using generic class in js file (#31723)
* Report error when using generic class in js file

* Replace "ClassDeclaration | ClassExpression" to ClassLikeDeclaration

Co-Authored-By: Klaus Meinhardt <klaus.meinhardt1@gmail.com>

* add noEmit:true
2019-08-15 15:49:50 -07:00
Orta
6cd8bcd6c9
Merge pull request #31185 from collin5/b30851
Restrict spreading for Instantiable Type with non object constraint
2019-08-15 13:50:01 -07:00
Kagami Sascha Rosylight
f304b81fa5 Point es2020 in esnext.d.ts (#32776) 2019-08-15 10:06:46 -07:00
Anders Hejlsberg
f929a25407 Add regression test 2019-08-15 10:02:32 -07:00
Wesley Wigham
1747ee7a55
Perfer the non-module name of a symbol when writing the name of a symbol (#32880) 2019-08-14 17:16:17 -07:00
Andrew Branch
2217f0b859
Fix export=global auto import exclusion (#32898) 2019-08-14 15:50:25 -07:00
Ryan Cavanaugh
11c28d6dd0
Update versions to 3.7 (#32879)
* Update versions to 3.7

* Update API baselines
2019-08-14 13:00:26 -07:00
Klaus Meinhardt
8eeb763cdd report invalid modifiers on class expression properties
Fixes: #32532
2019-08-14 21:00:19 +02:00
Sheetal Nandi
0e93cf61fc Disallow incremental with noEmit
Fixes #32882
2019-08-14 09:47:49 -07:00
Wesley Wigham
602966ba4e
Fix references to path-mapped ambient modules in declaration files (#32878)
* Fix references to path-mapped ambient modules in declaration files

* Fix lint
2019-08-13 16:34:03 -07:00
Daniel Rosenwasser
c8d937ecd3
Merge pull request #32726 from fuafa/completion-after-private
Fix completion disappear after a property declaration with a private modifier
2019-08-13 11:09:32 -07:00
Ron Buckton
decc3cd671
Elide /index from auto-import when using rootDirs compiler option (#32828) 2019-08-12 16:05:15 -07:00
Wesley Wigham
4ab85bbf35
Add error message for keywords with escapes in them (#32718)
* Add error message for keywords with escapes in them

* Move check into parser during advance to next token to utilize context for contextual keywords

* git add .

* Add tests for extended escapes

* Better error courtesy of @DanielRossenwaser

* Add test of browser-inconsistent case and alter condition to match spec

* Merge adjacent conditions

* Use seperate functions for checking keywords vs not

* Use flags to track unicode escape presence

* Adjust error text
2019-08-12 16:00:38 -07:00
Ron Buckton
bf054ae796
Add support for import.meta in System modules (#32797) 2019-08-12 13:00:58 -07:00
Orta
2a2866c3a9
Merge pull request #32563 from orta/fix_31298
Handle namepaths inside JSDoc type expressions a bit better
2019-08-09 16:15:50 -07:00
Ron Buckton
98b6db81d9
Allow accessors in ambient class declarations (#32787)
* Allow accessors in ambient class declarations

* Update src/compiler/transformers/declarations.ts

Co-Authored-By: Wesley Wigham <wewigham@microsoft.com>
2019-08-09 16:11:25 -07:00
Wesley Wigham
f2719f95b4
Allow functions and ambient classes to merge (#32584) 2019-08-09 16:10:10 -07:00
Sheetal Nandi
b7e49d1d1c Ignore unknown files to search from in document highlights 2019-08-09 15:06:51 -07:00
Ron Buckton
05af8faac6
Support tree-shakable imports for --target es2015 (#32742)
* Support tree-shakable imports for --target es2015

* Alias external helper imports for --module es2015
2019-08-09 14:02:18 -07:00
Nathan Shively-Sanders
85b8d27ea3
Remove error on invalid jsdoc tokens (#32769)
* Remove error on invalid jsdoc tokens

In JSDoc:

1. In the scanner, don't issue an error, even for invalid identifiers.
2. In the binder, don't issue an error for reserved (but otherwise valid)
identifiers.

/**
 * Example of 1: "\"
 * Example of 2: @private
 */

* Update baselines

* Add invalid unicode escape test for JSDoc

* Add quotes around invalid unicode escape

* Add another unicode escape JSDoc test
2019-08-09 12:53:15 -07:00
Nathan Shively-Sanders
b24050aefd
Excess discriminated types match all discriminable properties (#32755)
* Target types in excess property checking must match all discriminable properties

This allows fewer types to be discriminated in excess properties, which
fixes some examples.

* Add excess property test

* Fix semicolon lint

* Remove extra semicolon!

* Improve EPC for unions with multiple discriminants
2019-08-08 15:34:52 -07:00
Andrew Branch
984956afec
Only add unnecessary-await suggestion on await expressions (#32754) 2019-08-07 11:27:36 -07:00
Wesley Wigham
abd127f308
Only check import = reference when target is Value (#32747) 2019-08-06 16:44:42 -07:00
Wesley Wigham
f333684179
Fix unicode escapes in jsx identifiers and extended unicode characters in jsdoc (#32716)
* Fix unicode escapes in jsx identifiers and extended unicode characters in jsdoc

* Support unicode escapes in JSDoc

* Add tests for extended escapes
2019-08-06 15:14:32 -07:00
Nathan Shively-Sanders
480b73915f
Improve excess property checking for intersections (#32582)
* Improve excess property checking for intersections

Still a draft, the implementation needs improvement

* Use mutable isIntersection in checkTypeRelatedTo

This makes parameter lists a lot shorter. Seems like a slight
improvement, although I can revert if I change my mind.

* Fix semicolon lint

* Remove TODOOOO

* Revert "Use mutable isIntersection in checkTypeRelatedTo"

This reverts commit b8dccff2a25495867cff070b94601015e689b8ff.
2019-08-06 15:03:24 -07:00
Wesley Wigham
d00056f096
Support extended unicode escapes in identifiers, per es6 spec (#32725) 2019-08-06 14:43:41 -07:00
Orta Therox
77cdca2971 Adds another test around parsing jsdoc 2019-08-06 15:45:28 -04:00
Orta Therox
487e2ffe2a Merge master 2019-08-06 15:34:06 -04:00
Nathan Shively-Sanders
269c3d3a56
Suggestions now use diagnosticCollection (#32740)
Previously they used multiMaps, unlike all the other diagnostics. This
prevents duplicate suggestions, like other kinds diagnostics.

Fixes #28710
2019-08-06 11:15:06 -07:00
Wesley Wigham
7adc175dfc
Adjust isIdentifierText to skip multiple characters when a code point is multiple chars long (#32720)
* Adjust isIdentifierText to skip multiple characters when a code point is multiple chars long

* Add a few examples with mixed unicode characters

* for posterity, add some unicode cursive script characters

* Test some more planes more explicitly
2019-08-05 23:37:26 -07:00
xiaofa
e1bca8ff2a Fix class member completion disappear after a property declaration with a private modifier 2019-08-06 08:35:34 +08:00
Ron Buckton
e3f4979736
Fix emit for object rest on a module export (#32699)
* Fix emit for object rest on a module export

* Add tests for exports of empty object/array binding patterns

* Add delay for exec to ensure diff tool has enough time to start
2019-08-05 16:53:21 -07:00
Wesley Wigham
3b54ffcf0e
Preserve const enums should keep import refs (#28498)
* Preserve const enums should keep import refs

for exported const enums exported via export default

Move some functionality around, small cleanup

Remove unneeded const enum check

* Only mark const enums as references with preserveConstEnums on in export assignments

* Limit change to declarations and preserveConstEnums mode
2019-08-05 16:47:29 -07:00