30014 Commits

Author SHA1 Message Date
Andrew Branch
aca7df39d4
Update baselines 2020-04-08 16:31:35 -07:00
Andrew Branch
926810b704
Write line after helpers 2020-04-08 16:31:24 -07:00
Andrew Branch
3d04ff490d
Update baselines 2020-04-08 16:15:13 -07:00
Andrew Branch
dd5413623a
Add some missing original nodes 2020-04-08 16:15:04 -07:00
Andrew Branch
df2db9737f
More sophisticated check for source position comparability 2020-04-08 16:14:43 -07:00
Andrew Branch
9cf2fc866d
Update baselines 2020-04-08 14:39:59 -07:00
Andrew Branch
3c77e19e2b
Merge branch 'bug/37813' into preserveSourceNewlinesAllTheThings 2020-04-08 14:36:49 -07:00
Andrew Branch
f18347358e
Merge branch 'master' into preserveSourceNewlinesAllTheThings 2020-04-08 14:36:41 -07:00
Andrew Branch
a15ea78a12
Fix leading line separator calculation and JSX bug 2020-04-08 14:28:53 -07:00
Andrew Branch
a2e9e6919d
Fix preserveNewlines printer option when a list child has the same start or end as its parent 2020-04-08 14:01:18 -07:00
Ron Buckton
5a7916962d
Fix metadata serialization for invalid jsdoc types (#37836) 2020-04-08 12:06:40 -07:00
zhangciwu
126c6ab80d
Fix easy misunderstanding "! ===" (#37838)
* Remove unnecessary Non-null assertion operator

* Wrap Non-null assertion operator inside parentheses
2020-04-08 08:17:22 -07:00
Alexander T
e897eb1b2a
fix(37817): omit comments in name accessor (#37822) 2020-04-07 16:59:54 -07:00
Eli Barzilay
e4babd40e0 Skip isBlockScopedNameDeclaredBeforeUse error in interface or type declarations
Fixes #35947.
2020-04-07 16:12:18 -04:00
Eli Barzilay
dcc6c9461e Minor improvement
Get the `declaration` container just once instead of in three places.
(Minor change: one place used to start looking from
`declaration.parent`, but that shouldn't make any difference.)  Also,
don't pass it to the helper functions since they're local anyway.
2020-04-07 16:12:18 -04:00
Orta
3398c9bfe1
Make skipLibCheck: true the default in --init (#37808) 2020-04-07 15:00:44 -04:00
Andrew Branch
3e86f15f51
Disambiguate types with same name from different namespaces in mapToTypeNodes (#37543)
* Disambiguate types with same name from different namespaces in mapToTypeNodes

* Update baseline with additional example

* Fix typo
2020-04-07 10:55:56 -07:00
Bannerets
c47aca0da3
Accurate Array.prototype.flat definition (#32131)
* Better Array.prototype.flat definition

* Use more meaningful names

* Rename 'Flat' to 'FlatArray'
2020-04-07 09:16:20 -07:00
Nathan Shively-Sanders
7ca6334dbd
Look for outer type parameters on VariableStatements (#37819)
This only applies in JS, where `@template` tags can apply to
initialisers of variable declarations:

```js
/**
 * @template T
 * @returns {(b: T) => T}
 */
const seq = a => b => b
```

Fixes #36201
2020-04-07 08:04:33 -07:00
Anders Hejlsberg
a2609b1f1b
Extra check in assignment of intersections with generic constituents (#37537)
* Consolidated extra property check with intersections

* Fix comment

* Add tests

* Properly propagate intersectionState

* Route property check through recursive type tracking logic

* Accept new baselines

* Skip check when apparent type of source is never

* Accept new baselines

* Only check when apparent type of source is a structured type
2020-04-06 13:36:20 -07:00
Daniel
f2c0bbb1a7 Update baselines. 2020-04-06 20:09:48 +00:00
Daniel
e4a6208f05 Update emitter to preserve source newlines. 2020-04-06 20:09:27 +00:00
Anders Hejlsberg
5a4024dd9d
Generic functions are never context sensitive (#37811)
* Functions with type parameters are never contextsensitive

* Add tests
2020-04-06 11:55:39 -07:00
Nathan Shively-Sanders
eac073894b
Fix serialisation of static class members in JS (#37780)
* Fix serialisation of static class members in JS

Previously static class members would be treated the same way as expando
namespace assignments to a class:

```ts
class C {
  static get x() { return 1 }
}
C.y = 12
```

This PR adds a syntactic check to the static/namespace filter that
treats symbols whose valueDeclaration.parent is a class as statics.

Fixes #37289

* fix messed-up indent

* Extract function
2020-04-03 20:06:05 -07:00
Orta
20ecbb0f46
Allow Source Mapping inside destructuring assignment (#37298)
* Add support for source maps inside of destructured code

* Adds tests for the source maps inside destructured code
2020-04-03 17:23:02 -04:00
Wesley Wigham
7317292782
Consider arrays and tuples within one another as possibly requiring deferral (#37776) 2020-04-03 14:14:13 -07:00
Nathan Shively-Sanders
7cf4b12d88
Fix crash for private identifier in expando assignments (#37764)
* Fix crash for private identifier in expando assignments

It does this by disallowing private identifiers from expando assignments
entirely. I haven't thought of a scenario where they make sense, but I
haven't thought about it exhaustively either.

Fixes #37356

* Update baselines

I think the new error is probably better. It's certainly different!
2020-04-03 10:29:22 -07:00
csigs
d68295e74e
LEGO: Merge pull request 37766
LEGO: Merge pull request 37766
2020-04-03 03:11:13 -07:00
csigs
c787252e00 LEGO: check in for master to temporary branch. 2020-04-03 10:10:33 +00:00
Wesley Wigham
6d25c01d09
Cache the regularized form of union types (#37749)
* Cache the regularized form of union types

* Inline function because why not

* Introduce two fastpasths into isRelatedTo
2020-04-02 23:54:24 -07:00
Anders Hejlsberg
349ae45a2c
Reduce intersections with conflicting privates, elaborate on reasons (#37762)
* Elaborate on reasons for 'never' intersections

* Accept new API baselines

* Accept new baselines

* Add tests

* Accept new baselines

* Address CR feedback
2020-04-02 18:00:59 -07:00
Andrew Branch
2187ba1f84
Fix variable name collisions (#37761) 2020-04-02 15:12:19 -07:00
Nathan Shively-Sanders
527f467926
Remove error when spreading optional any (#37757)
Previously, spreading an optional any gave a bogus error when the name
conflicted with earlier properties in the object literal. Now the code
checks any types for optionality before issuing the error.

Fixes #37740
2020-04-02 15:04:45 -07:00
Alexander T
696413749b
fix(37456): add tests for JsxOpeningElement nodes (#37752) 2020-04-02 10:38:31 -07:00
Wenlu Wang
afc41f095d
Quick fix for functions lacking return expressions (#26434)
* stash

* add surmise for return type

* add support for more case

* add more test case

* add more testcase and fix all test

* fix changed diagnosis

* fix broken test case

* add more case

* rename quickfix

* fix conflict

* fix fix desc

* fix semi

* Avoid replace brace with paren

* Split fix all action

* Add return work in same line

* fix test cases

* rename baseline

* refactor and handle comment

* Support semi

* make helper internal
2020-04-02 10:06:14 -07:00
Zixiang Li
54b0e4acc5
Fix goto implementation does not suggest all subtypes (#33652) 2020-04-02 09:57:48 -07:00
Andrew Branch
3810c2fe6b
Fix rename for type symbols imported as a different name (#37745)
* Add failing test

* Fix getMeaningFromLocation for imports

* Only the name of an ImportEqualsDeclaration counts

* Commit baseline
2020-04-02 09:06:19 -07:00
Alexander T
72a0411776
fix(37431): allow only one space between async keyword and method name (#37504) 2020-04-02 11:30:05 -04:00
Wesley Wigham
78a99241d8
Reuse input type nodes when serializing signature parameter and return types (#37444)
* Accept change

* Accept the huge set of ever so slightly changed baselines

* Update return type logic to only reuse nodes if original nodes share scope with current node, like property types, only reuse nodes if symbols referened are acessible, reuse nodes for property signatures, too

* Only reuse nodes when a context is provided (otherwise identifier printback may fail)

* Only track symbol if symbol is found and no error is recorded

* Fix type parameter reuse lookup

* Forbid cjs module.exports references in retained nodes

* Adjust check for cjs export references to not include bad module type in output

* Add symbol to all identifiers we see in existing nodes for quickinfo

* Accept fourslash baseline updates

* Accept slightly updated baseline post-merge

* Do not copy original nodes for error types, replace empty type references with any
2020-04-01 19:50:21 -07:00
Wenlu Wang
5596ed80d7
Add replacement span for string literal (#37490)
* Add replacement span for string literal

* fix change requests

* fix lint

* Avoid flag

* Fix baseline

* ADd misising baseline
2020-04-01 17:58:16 -07:00
Wesley Wigham
15aff05ff6
Explicitly merge module augmentation members into the exports added by export * declarations (#37691)
* Explicitly merge module augmentation members into the exports added by export * declarations

* Use ?., add namespace merge test

* Add missing merged symbol call to handle enum/ns merges during entity name lookup

* Add test with error case

* Handle missing value declarations in more places, unify duplicate declaration error handling to improve assignment declaration duplicate errors
2020-04-01 16:36:28 -07:00
Alexander T
c546988e50
fix(37456): omit type arguments from JsxSelfClosingElement, JsxOpeningElement nodes (#37739) 2020-04-01 16:27:33 -07:00
Linus Unnebäck
a98adefd00
Add replacer function overload for replaceAll (#37476) 2020-04-01 16:25:16 -07:00
Wesley Wigham
326e1c9ff8
Disallow partial matches for discriminant properties when generating error messages (#37589) 2020-04-01 15:39:12 -07:00
Alexander T
697d1042eb
fix(37519): forbid trailing comma in a index signature (#37535) 2020-04-01 15:38:10 -07:00
Nathan Shively-Sanders
95a124f802
Fix crash on bad namespace parse (#37626)
* Fix crash on bad namespace parse

`global` inside a class body is parsed as a module declaration, and in
the following example has no body:

```ts
class C {
  global x
}
```

`x` is parsed as a separate ExpressionStatement. This caused a crash in
emit because the code didn't expect a module declaration with no body.

* inline node.body variable

* fix missed references to body
2020-04-01 15:05:49 -07:00
Nathan Shively-Sanders
ed1863b3e6
Add node to zone.js' tsconfig types (#37499) 2020-04-01 14:40:01 -07:00
Sheetal Nandi
0b38a9a2b0
Add support for extraFileExtensions on WatchCompilerHost (#37726)
To support typescript-eslint/typescript-eslint#1813
2020-04-01 11:13:21 -07:00
Wesley Wigham
0e48e68ed1
Fix post-LKG build 2020-04-01 10:53:46 -07:00
Simon Jaeger
9c4cbd64fb
fix #32843 : evaluate right scope when checked if all type parameter are unused for jsdoc @template (#33320)
Co-authored-by: magierjones <simon.jaeger@magierjones.de>
2020-03-31 15:32:15 -07:00