Commit Graph

2891 Commits

Author SHA1 Message Date
Wesley Wigham
deeee77f18 Check destructuring validity the same way element accesses and indexed accesses are checked (#24700)
* Check destructuring validity the same way element accesses and indexed accesses are checked

* Accept updated test baseline

* Use raw apparent type instead of passing in flag to sometimes make one

* Use `checkComputedPropertyName`
2018-11-01 13:46:41 -07:00
Wesley Wigham
3a2f7c0df1 Allow intersections of readonlys to be assignable to a readonly intersection (#28218)
* Allow intersections of readonlys to be assignable to a readonly intersection

* Add real motivating react example to test suite
2018-10-31 14:09:12 -07:00
Anders Hejlsberg
8e4b90da00 Merge pull request #28234 from Microsoft/genericSpread
Generic spread expressions in object literals
2018-10-31 12:52:16 -07:00
Anders Hejlsberg
2ed627aaf1 Update tests 2018-10-30 16:33:14 -07:00
Wesley Wigham
e2436f331a Use constraint for default default value if possible (#28222) 2018-10-30 14:55:30 -07:00
Wesley Wigham
4cfff8962c Fix declaration emit for cross-file enums (#28237) 2018-10-30 14:55:01 -07:00
Andy
176627c818 Support augmenting module with export as namespace (#27281)
* Support augmenting module with `export as namespace`

* Warn on use of merged symbol containing 'export as namespace'
2018-10-30 11:16:26 -07:00
Andy
24febc2445 Allow to combine --resolveJsonModule with --isolatedModules (#28207) 2018-10-29 11:56:49 -07:00
Wesley Wigham
a6952887e9 Use same condition in isReferencedAliasDeclaration as isAliasResolvedToValue (#28171) 2018-10-29 09:38:10 -07:00
Wesley Wigham
e2100cd2cc Measure variance of aliased conditional types using variance markers (#27804)
* Measure variance of aliased conditional types using variance markers

* Just do variance probing for all type aliases

* Small limiter for predictability

* Inline property set, remove unused functions
2018-10-26 16:26:20 -07:00
Wesley Wigham
972c403cd8 JSX uses mixed signatures and union sigs use subtype on partial match (#28141)
* JSX uses mixed signatures and union sigs use subtype on partial match

* Small improvement
2018-10-26 16:01:32 -07:00
Jack W
abce9ae0be Bring typeof switch inline with if (#27680)
- Narrow unknown
- Narrow union members (in addition to filtering)
2018-10-26 14:56:26 -07:00
Klaus Meinhardt
3fb8873bc2 don't resolve import types in JSDoc of TS files (#28158) 2018-10-26 09:50:12 -07:00
Anders Hejlsberg
ba8310ab8d Add regression test 2018-10-24 13:51:24 -07:00
Wesley Wigham
0a7c92864d Fix Object.defineProperty declaration expando-ness and renames (#28061)
* Allow object.defineProperty calls to be expando properties

* Fix rename locations for object.defineProperty assignments
2018-10-23 09:33:53 -07:00
Wesley Wigham
6e5e09cef8 Reject return type inferences to the autoType or autoArrayType (#27169)
* Reject return type inferences to the autoType or autoArrayType

* Accept new error positions
2018-10-22 16:44:32 -07:00
Andy
afa94c527c Un-consolidate overloads for Map and WeakMap (#28052) 2018-10-22 11:18:56 -07:00
Sheetal Nandi
71d8961ba0 Do not do any reduction (even if it contains any) to the union type when getting contextual type
Fixes #27975
2018-10-19 16:10:08 -07:00
Wesley Wigham
69b1cb5bac Add new special assignment kinds for recognizing Object.defineProperty calls (#27208)
* Add new special assignment kinds for recognizing Object.defineProperty calls

* Add support for prototype assignments, fix nits

* Fix code review comments

* Add test documenting behavior in a few more odd scenarios
2018-10-19 14:31:55 -07:00
Sheetal Nandi
7b9ae4d9d0 Merge pull request #27952 from Microsoft/contextualSignature
When contextual type doesnt find property in unit type, use the index signature from unit type(fix the incorrectly used union type to get the signature)
2018-10-17 14:59:42 -07:00
Wesley Wigham
9554f09d09 Add ability to infer to the simplified form of a type variable (#27953)
* Add ability to infer to the simplified form of a type variable

* Add test
2018-10-17 14:44:39 -07:00
Sheetal Nandi
31f4053d3e When contextual type doesnt find property, use the index signature from unit type(fix the incorrectly used union type to get the signature)
Fixes #27949
2018-10-17 14:15:56 -07:00
Wesley Wigham
7b5ef64e76 Unify JSX And Normal Call Checking Codepaths (#27627)
* Unify JSX Call Checking Codepaths

* Add tests for fixed issues

* Fix lint, move all error checking into the only-run-once resolveSignature call

* Remove unused (unreachable?) code path

* Consolidate a little more duplicated logic into signature checking

* Fix #19775 a bit more

* Cosmetic changes from CR
2018-10-16 20:16:00 -04:00
Sheetal Nandi
12cd3ea6ac Merge pull request #27849 from Microsoft/unionWithIndexedLiteral
Use string/number signature to get contextual type
2018-10-11 17:50:16 -07:00
Matt McCutchen
d19fb98ec6 When instantiating a mapped type, clone the type parameter. (#27597)
This gives the type parameter returned by getTypeParameterFromMappedType
an accurate constraint.

Fixes #27596.
2018-10-11 15:45:51 -07:00
Sheetal Nandi
c0729a22fd Use string/number signature to get contextual type
Fixes #26587
2018-10-11 15:12:13 -07:00
Sheetal Nandi
b2bae85cce Merge pull request #27609 from Microsoft/betterStaticError
Report the errors for static incompatibility only if instance types are assignable
2018-10-10 15:42:46 -07:00
Andy
dd9b8cab34 Have scanJsDocToken scan keywords (#27162)
* Have scanJsDocToken scan keywords

* Update API
2018-10-08 14:42:51 -07:00
Wesley Wigham
b85e9e1cc1 Use relative module specifiers in error messages if possible (#27441)
* Use relative module specifiers in error messages if possible

* Dont share number
2018-10-08 14:36:37 -07:00
Anders Hejlsberg
077bd1afd1 Add regression test 2018-10-08 10:00:15 -07:00
Wesley Wigham
6175e60fec Formatting a union should not create a 1-element union type node (#27582) 2018-10-05 16:11:47 -07:00
Sheetal Nandi
f30e73fc80 Report the errors for static incompatibility only if instance types are assignable
Fixes #26138
2018-10-05 15:38:13 -07:00
Wesley Wigham
10edf6fa58 Widen export assignment types so they arent accidentally fresh (#27397) 2018-10-04 14:27:19 -07:00
Nathan Shively-Sanders
04266aa617 narrowTypeByInstanceof understands ctor funcs (#27551)
* narrowTypeByInstanceof understands ctor funcs

* Rename test filename

* Fix whitespace lint
2018-10-04 13:52:38 -07:00
Anders Hejlsberg
81f8b47e5f Merge pull request #27370 from Microsoft/fixInstanceOfFunction
Fix instanceof with type Function for right argument
2018-10-03 10:59:50 -07:00
Wesley Wigham
1e55d650f3 Exclude the overlap between Type and Value when checking for parameter visibility (#27444) 2018-10-02 09:41:06 -07:00
Ryan Cavanaugh
70e26fc701 Merge pull request #27447 from mattmccutchen/issue-27117
Don't complain about `modules` and `outFile` options when `emitDeclarationOnly` is set.
2018-10-01 15:50:08 -07:00
Ryan Cavanaugh
3331d073c4 Merge pull request #26070 from ajafff/tuple-rest
Infer array rest as tuple if possible
2018-10-01 13:56:28 -07:00
Andy
8feddcd16d Clean up amalgamatedDuplicates (#27285)
* Clean up amalgamatedDuplicates

* Code review
2018-10-01 12:16:49 -07:00
Matt McCutchen
32e75e7ae7 Don't complain about modules and outFile options when
`emitDeclarationOnly` is set.

Fixes #27117.
2018-09-28 21:07:48 -04:00
Ron Buckton
9cf201c512 Merge pull request #27204 from Microsoft/fixPerIteration
Fix per-iteration bindings in for-loop head
2018-09-27 13:23:03 -07:00
Sheetal Nandi
1a63c67e8a Merge pull request #27260 from valera-rozuvan/fix-27086
Fix 27086. Ignore directories starting with a dot.
2018-09-26 11:11:37 -07:00
Anders Hejlsberg
32ea3b2cb0 Add regression test 2018-09-26 11:09:19 -07:00
Wesley Wigham
8e1cce4b8f Add regression test for #25485 as it is already fixed (#27320) 2018-09-24 17:52:52 -07:00
Wesley Wigham
e1c8dc2768 Limit the narrow-to-fresh rule added with boolean literals to only boolean literals (#27274)
* Remove the narrow-to-fresh rule added with boolean literals

* Revert "Remove the narrow-to-fresh rule added with boolean literals"

This reverts commit 9f96fe5da3.

* Only apply freshness to booleans for now

* Add largeish example from issue

* Should be AND not OR

* Add minor improvements suggested by @ahejelsberg

* Reorder conditional a bit
2018-09-24 12:37:13 -07:00
Wesley Wigham
b7fc092404 Fix non-selfclosing JSX tag contextual types (#27251) 2018-09-24 10:38:39 -07:00
Valera Rozuvan
8bd7f4e3f8 Fix 27086. Ignore directories starting with a dot. 2018-09-23 14:48:48 +03:00
Wesley Wigham
219bb44b4d Distribute indexes of indexed access types first (#27243) 2018-09-20 17:03:34 -07:00
Wesley Wigham
b56854a532 Set parent pointers on manufactured reference for property initialization check (#27246) 2018-09-20 16:54:01 -07:00
Andy
67d8263b30 Fix error message for class type in JSDoc missing type arguments (#27222) 2018-09-19 12:57:55 -07:00