Commit Graph

9040 Commits

Author SHA1 Message Date
Wesley Wigham
7a3e68fc5c Only return the substitute in substitution instantiation when assignability fails (rather than subtype) (#31027)
* Only return the substitute in substitution instantiation when assignability fails (rather than subtype)

* Add test from issue
2019-04-19 16:02:11 -07:00
Wesley Wigham
40a2eb2b4b Unify couldContainTypeVariables and the similar check done during instantiation (#30969)
* Stop symbol based filtering in couldContainTypeVariables

* Unify couldContainTypeVariables and the similar check done during instantiation
2019-04-19 16:01:53 -07:00
Wesley Wigham
1a4c15fb11 handle generic types in getArrayifiedType (#30606) 2019-04-19 14:32:33 -07:00
Daniel Rosenwasser
2eea21636b Merge pull request #29242 from Kingwl/attach_property_to_default_export
add transformer for emit add property to default export
2019-04-18 23:30:48 -04:00
Andrew Branch
b6a0988052 Merge pull request #30776 from andrewbranch/feature/10178
Add flag to allow access to UMD globals from modules
2019-04-18 18:05:44 -07:00
Nathan Shively-Sanders
c3a9429420 Handle JSDoc backticks in the parser, not scanner (#30939)
* Scan backticks in jsdoc as a single token less often

Previously, matching backticks in jsdoc would always be scanned as one
token to aid parsing incorrect jsdoc that uses backticks for parameter
names:

``js
/** @param {string} `nope`
 * @param {number} `not needed`
 */
```

However, this is wrong for code fences, which use triple backticks. This
fix parses a single backtick as a single token if it's immediately
followed by another backtick or by a newline. It retains the
questionable tokenisation of backticks-as-pairs in other cases, however.
A better fix might be to have the parser ignore backticks in jsdoc
instead.

* Add test case

* Handle jsdoc backticks in the parser, not scanner

Previously, the jsdoc scanner had ad-hoc handling of backticks that was
similar in structure to the normal scanner's handling, but much simpler.
This was a smaller code change, but is handled backwards: the special
case of backtick-quoted parameter names was handled in the scanner
instead of in the jsdoc identifier parsing code. That made it overapply
and block correct handling of asterisks across newlines, which was most
obvious in code fences inside jsdoc, as in #23517.

Fixes #23517

* More cleanup
2019-04-18 09:35:40 -07:00
Anders Hejlsberg
33c3ce9cd0 Merge pull request #31002 from Microsoft/fixIsStringIndexSignatureOnlyType
Fix isStringIndexSignatureOnlyType function
2019-04-17 17:19:34 -07:00
Sheetal Nandi
0c18d032e7 Merge branch 'master' into incrementalLateSymbol 2019-04-17 15:41:53 -07:00
Sheetal Nandi
d919f2c113 Add test for #28334 2019-04-17 15:13:09 -07:00
Anders Hejlsberg
a40b08d1d7 Merge pull request #30944 from Microsoft/fixInferenceToMappedType
Fix inference from enum object type to generic mapped type
2019-04-17 15:10:34 -07:00
Anders Hejlsberg
4d0244c798 Add regression test 2019-04-17 15:05:57 -07:00
Wesley Wigham
169e485d90 Perform excess property checking on intersection and union members (#30853)
* Perform excess property checking on intersection and union members

* Allow partial union props to contain the undefined type

* Add test case from #30771

* Un-terse getPossiblePropertiesOfUnionType side-effecting code

* Fix bug exposed in RWC

* Cache results of getPossiblePropertiesOfUnionType

* Fix whitespace
2019-04-16 21:58:48 -07:00
Anders Hejlsberg
f617d1641b Merge pull request #30963 from Microsoft/fixObjectFlagsPropagation
Fix object flags propagation
2019-04-16 07:25:41 -10:00
Anders Hejlsberg
dbe71a2ddd Add regression test 2019-04-16 10:00:49 -07:00
Wesley Wigham
d405662eb6 Explicitly encode keyof behaviors for never and unknown into getIndexType (#30753)
* Explicitly encode keyof behaviors for never and unknown into getIndexType

* Merge similar cases
2019-04-15 17:52:13 -07:00
Anders Hejlsberg
83f3d2ee17 Add regression test 2019-04-15 15:06:55 -07:00
Daniel Rosenwasser
3dc78b6f3b Merge pull request #30916 from jack-williams/array-elaboration
Elaborate array and tuple relation errors
2019-04-15 14:00:22 -07:00
Jack Williams
2ea91a0e9c Elaborate array and tuple relation errors 2019-04-15 18:16:38 +01:00
Anders Hejlsberg
2c951b3ca9 Add regression test 2019-04-13 08:24:27 -10:00
Adam Postma
e951455215 Update misspelling 'identifer' to 'identifier' (#30894)
* fix typo - identifer to identifier

* fix typo - identifer to identifier
2019-04-12 13:29:00 -07:00
Anders Hejlsberg
4574c7a375 Merge pull request #30877 from Microsoft/fixConditionalTypeSimplification
Fix conditional type simplification
2019-04-12 07:35:19 -10:00
Anders Hejlsberg
6282645e3c Merge pull request #30857 from Microsoft/fixInferenceToIntersection
Fix inference to intersections
2019-04-12 07:34:40 -10:00
Anders Hejlsberg
6cd229b4b9 Merge pull request #30769 from Microsoft/saferIndexedAccessTypes
Improve soundness of indexed access types
2019-04-12 07:33:50 -10:00
Anders Hejlsberg
e44a52a011 Add regression test 2019-04-11 16:22:01 -10:00
Anders Hejlsberg
42302705f6 Merge pull request #30856 from Microsoft/nonInferrableType
Add a proper non-inferrable type
2019-04-11 11:45:17 -10:00
Anders Hejlsberg
a764729b38 Add tests 2019-04-10 17:42:08 -10:00
Anders Hejlsberg
8cd5d61644 Add regression test 2019-04-10 17:13:04 -10:00
Nathan Shively-Sanders
ff959096df Fix some bad jsdoc comment indent (#30838)
* First draft

Solves the initial problem but breaks commentCommentParsing. I also
found a couple more interesting cases.

* Add more tests and fix their bugs

* Another test case

* Some cleanup

I may try do a little more; `margin += tag.end - tag.pos` bothers me a
bit.

* More cleanup
2019-04-10 08:22:09 -07:00
Anders Hejlsberg
68eb7b9fe2 Add test 2019-04-09 15:29:51 -10:00
Nathan Shively-Sanders
90b304aa5e Merge pull request #30786 from Microsoft/always-check-class-extends
Always check extends clause of classes
2019-04-08 10:25:05 -07:00
Andrew Branch
6d1d680c0e Add test 2019-04-08 09:46:47 -07:00
Andrew Branch
bafa4c90c1 Merge pull request #30758 from andrewbranch/bug/30647
Fix crash when checking function call
2019-04-08 09:22:39 -07:00
Anders Hejlsberg
2b6e7304c1 Merge branch 'master' into tweakUnionTypeInference 2019-04-06 08:12:45 -10:00
Anders Hejlsberg
cd646dab7e Add tests 2019-04-06 07:59:39 -10:00
Anders Hejlsberg
294580287d Merge branch 'master' into saferIndexedAccessTypes 2019-04-05 16:23:48 -10:00
Nathan Shively-Sanders
1218f29662 Merge branch 'master' into always-check-class-extends 2019-04-05 16:41:15 -07:00
Nathan Shively-Sanders
dabf2a6af2 Always check extends clause of classes
Even if (1) @extends is provided and (2) we're not producing
diagnostics. That's because we need to know whether the extends clause
references an imported alias.
2019-04-05 16:37:27 -07:00
Wesley Wigham
0ddd847e03 Small addition to user PR script to support fork/branch PRs 2019-04-05 16:28:25 -07:00
Nathan Shively-Sanders
9e2446073d Merge pull request #30773 from Microsoft/update-user-tests
Update TypeScript-React-Native-Starter
2019-04-05 11:18:27 -07:00
Nathan Shively-Sanders
0b3b4ea127 Added error for class properties used within their own declaration (#29395)
* Added error for class properties used within their own declaration

Fixes #5987.

Usages of a class property in a preceding property already gave an error, but the following doesn't yet:

```ts
class Test {
    x: number = this.x;
}
```

As with other use-before-declare checking, IIFEs are not treated as invalid uses.

* Accepted 'witness' baselines; removed unnecessary !==

* Addressed quick feedback items

* Accepted odd new baseline

* Fixed post-merge introduced lint errors

* Updated baselines again
2019-04-05 09:06:36 -07:00
Anders Hejlsberg
739acee1c9 Add tests 2019-04-04 16:30:26 -07:00
Wesley Wigham
16450a027a Change the default type parameter constraints and defaults to unknown from {} (#30637)
* Change the default type parameter constraint and default to unknown from {}

* Relax unknown checking outside of strictNullChecks a bit

* Increase strictness on index signatures with type `unknown` so inference doesnt change surprisingly

* Remove redundant switch
2019-04-04 12:25:15 -07:00
Andrew Branch
8576018af1 Add failing test for function calls that have at least one non-spread argument, a spread argument, and overall potentially too few arguments 2019-04-04 11:47:25 -07:00
Nathan Shively-Sanders
762a557fcc Update TypeScript-React-Native-Starter
Add a 'path' field to test.json.
2019-04-04 11:37:15 -07:00
Josh Goldberg
e767ee0472 Merge branch 'master' into property-use-before-declare 2019-04-04 14:05:19 -04:00
Daniel Rosenwasser
1dae8fcc30 Fix tests to be non-global. 2019-04-04 10:02:46 -07:00
Ron Buckton
8a19e4bcf9 Merge pull request #30726 from Microsoft/fix30653
Treat hoisted temp variables as a custom prologue.
2019-04-03 11:54:37 -07:00
Andrew Branch
fed46ea3bf Merge pull request #30719 from andrewbranch/bug/30668
Fix crash when binding deep module.exports assignment
2019-04-03 09:19:36 -07:00
Josh Goldberg
ee4e90c1fb Merge branch 'master' into property-use-before-declare 2019-04-03 08:35:22 -04:00
Ron Buckton
f04a40dd49 Treat hoisted temp variables as a custom prologue 2019-04-02 17:35:26 -07:00