Commit graph

29302 commits

Author SHA1 Message Date
Pierre-Antoine Mills
9a766c3197 test(ts-toolbelt): recursive iteration types (#33810)
* test: recursive iteration types for ts-toolbelt

* fix: implementation details

* fix: comment

* Update index.ts
2019-12-05 09:47:25 -08:00
Anders Hejlsberg
09271f107d
Make no inferences from binding patterns with no defaults (#35454)
* Use nonInferrableAnyType in types inferred from binding patterns

* Add regression tests

* Accept new baselines
2019-12-05 07:09:45 -08:00
Andrew Branch
b39b4e05be
Use namespace import for esnext when esModuleInterop is off (#35475) 2019-12-04 12:07:25 -08:00
Nathan Shively-Sanders
a816162923
Remove unneeded Array and Promise JS rewrites (#35482)
Type-argument defaulting is handled elsewhere in the compiler.
This is a small drive-by improvement, so I didn't change the handling of
'array' or 'promise'; they still manually create `any[]` and
`Promise<any>`, respectively.
2019-12-04 09:06:42 -08:00
TypeScript Bot
7e572b6585 Update user baselines (#35490) 2019-12-04 08:31:39 -08:00
Wesley Wigham
e8748f8162
Add nested global member creation to shim (#35473) 2019-12-03 11:31:30 -08:00
Orta
a08d6ba4cf
Update config.yml (#35388) 2019-12-03 10:59:11 -05:00
TypeScript Bot
2ab1b71fff Update user baselines (#35450) 2019-12-02 13:46:59 -08:00
Wesley Wigham
7bfffa745f
Remove redundant checker functions and use patterns more friendly to modules (#35399)
* Remove redundant checker functions, use patterns more friendly to modules

* Also use a helper for localizedDiagnosticMessages

* Move types into same file as consts

* Accept slightly changed api baseline

* Whitespace!
2019-12-02 13:44:25 -08:00
Wesley Wigham
85ec9bf175
Remove duplicate definition of Push (#35397)
It's also defined in `corePublic.ts` - there's no errors because they're (almost) identical and merge (creating a redundant overload for `push`). Ironically, while this definition was internal, the other is public (and more complete).
2019-12-02 11:47:42 -08:00
TypeScript Bot
facafc7cb0 Update user baselines (#35436) 2019-12-02 11:41:33 -08:00
Andrew Branch
97aba45d6f
Emit unused identifier suggestion diagnostics in declaration files and ambient nodes (#35119) 2019-12-02 09:52:40 -08:00
TypeScript Bot
7c14aff093 Update user baselines (#35401) 2019-11-27 16:19:26 -08:00
Eli Barzilay
d6740cf410 Fix getTypeFromJSDocValueReference
When using `{import('./b').FOO}` which is defined as a string literal,
`valueType` doesn't have a `symbol`.  Leave it for the fallback value
for now.

This was exposed in 8223c0752.

Fixes #34869.
2019-11-27 17:53:11 -06:00
Eli Barzilay
d6bd3ac552 Don't filter away private completions if in the same context
Fixes #34405, which was introduced in PR #16953.
2019-11-27 17:41:58 -06:00
Wesley Wigham
c84afa1b9e
Fix build from incomplete merge 2019-11-27 14:08:16 -08:00
Sheetal Nandi
d02531f650
Fix compileOnSaveEmit when using source of project reference redirect with --out (#35335)
* Fix compileOnSaveEmit when using source of project reference redirect with --out
Fixes #35226

* Fix typo
2019-11-27 13:47:19 -08:00
Wesley Wigham
c447ebc59c
Refactor: No more than 1 namespace declaration per file (#35373)
* Refactor: No more than 1 namespace declaration per file

* Simplify refs where possible
2019-11-27 13:44:31 -08:00
Anders Hejlsberg
1320c36165
Fix control flow analysis for break/continue with label (#35377)
* Use existing 'continue' target labels for labeled statements

* Use linked list for active labels

* Add regression test

* Accept new baselines
2019-11-27 12:28:06 -08:00
Sheetal Nandi
25ec62f892
Handle when output file would be in subFolder specified by outDir/declarationDir (#35366)
Fixes #35328
2019-11-27 09:36:52 -08:00
Anders Hejlsberg
ea4e6b31ba
Improve control flow type caching (#35332)
* Cache getTypeOfExpression results when CFA was invoked

* Add tests

* Accept new baselines
2019-11-25 15:10:09 -08:00
Anders Hejlsberg
0c2c58c42f
Create returnOnlySignature only when inferences will possibly be made (#35173)
* Create returnOnlySignature only when inferences will possibly be made

* Add regression test

* Accept new baselines
2019-11-25 15:05:53 -08:00
Alexander T
0c17476d09 assign error to method definition node if a return type is empty (#35309) 2019-11-24 20:18:04 -08:00
Wesley Wigham
b9689228b5
When calculating spreads, merge empty object into nonempty object to … (#34853)
* When calculating spreads, merge empty object into nonempty object to produce partial object to reduce complexity

* Actually accept remainder of baselines

* Limit simplification to single prop or partial types
2019-11-22 17:19:17 -08:00
Anders Hejlsberg
58a05f3e87
Normalize type references before relating them (#35266)
* Normalize type references before relating them in isRelatedTo

* Add comments

* Accept new baselines

* Add regression tests

* Accept new baselines

* Use aliases when available in error reporting

* Accept new baselines
2019-11-22 15:40:18 -08:00
Nathan Shively-Sanders
369900bb07
Emit defineProperty calls before param prop assignments (#34987)
* Emit defineProperty calls before param prop assignments

Note that I restricted this to --useDefineForClassFields is true.
Nothing changes when it's off. I think this is the correct fix for a
patch release.

However, in principal there's nothing wrong with moving parameter
property initialisation after property declaration initialisation. It
would be Extremely Bad and Wrong to rely on this working:

```ts
class C {
  p = this.q // what is q?
  constructor(public q: number) { }
}
```

But today it does, and probably somebody relies on it without knowing.

* Put parameter property initialiser into defineProperty's value

* Combine ES5/ESNext into one test
2019-11-22 15:37:24 -08:00
Nathan Shively-Sanders
2075f74fef useDefineForClassFields skips emit of ambient properties (#35058)
* useDefineForClassFields skips emit of ambient properties

Previously:

```ts
class C {
  declare p
}
```

would incorrectly emit

```js
class C {
    constructor() {
        Object.defineProperty(this, "p", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: void 0
        });
    }
}
```

when useDefineForClassFields was turned on (for targets <ESNext).

* Fix bug for ESNext as well

This moves the check earlier in the pipeline.

* update baselines
2019-11-22 14:52:29 -08:00
Daniel Rosenwasser
3da85df511
Clean up error messages for using TypeScript syntax in JavaScr… (#35254)
* Fix up quotation marks in error messages in JavaScript files.

* Accepted baselines.

* Typescript -> TypeScript

* Accepted baselines.

* Migrate syntactic diagnostics tests to baselining tests.

* Accepted baselines.

* Update diagnosticMessages.json

* Removed markers.

* Add ability to baseline both semantic and syntactic diagnostics.

* Fix up broken diagnostics when using a server LS.

* Accepted baselines.

* Lints.

* Fake up sourcefile objects in the tsserver session client instead.

* Fewer allocations.
2019-11-22 14:51:22 -08:00
Wesley Wigham
3e329469c1
Actually use the moer complete update function in visitEachChild (#35301) 2019-11-22 14:36:22 -08:00
Jack Bates
1388f873a3 Add fp-ts to .gitignore (#35295) 2019-11-22 13:15:17 -08:00
Eli Barzilay
f017fa04c4 Scan types of yield expressions in classes too
Also, drop the other cases where they were ignored, since they're
forbidden in enums, and the others are fine wrt the comment that was
there.

Fixes #34892
2019-11-22 08:51:00 -05:00
Eli Barzilay
20b246c83a Fix getIntrinsicAttributesTypeFromJsxOpeningLikeElement
Use `getIndexTypeOfType`+`getDeclaredTypeOfSymbol` instead of `getIndexInfoOfSymbol`.

Fixes #34730.
2019-11-22 08:43:24 -05:00
Eli Barzilay
cfefe841b7 Allow --inspect=port in gulp runtests
Makes it possible to run two debuggers side-by-side.
2019-11-22 08:42:38 -05:00
Wesley Wigham
dc1c45aa9b
Fix azure-sdk dockerfile for latest rush 2019-11-21 17:02:57 -08:00
Nathan Shively-Sanders
02348895c9
Add fp-ts to user tests (#35249) 2019-11-21 16:07:55 -08:00
Wesley Wigham
663a42be94
Allow references to globalThis to be made in declaration emit (#35279) 2019-11-21 15:21:35 -08:00
Wesley Wigham
cfa367d7f9
Have definite assignment assertions on property signatures mark them as typescript (#35270) 2019-11-21 13:13:46 -08:00
TypeScript Bot
9b78599c63 Update user baselines (#35275) 2019-11-21 13:10:21 -08:00
Anders Hejlsberg
94d4023043
Add inference priority level for conditional types in contravariant positions (#35199)
* Add inference priority level for conditional types in contravariant positions

* Accept new API baselines

* Add regression tests

* Accept new baselines
2019-11-21 13:05:44 -08:00
TypeScript Bot
84c84d8dbc Update user baselines (#35272) 2019-11-21 12:36:55 -08:00
TypeScript Bot
5f1e8cb9b0 Update user baselines (#35271) 2019-11-21 11:34:10 -08:00
Wesley Wigham
614a07c7d5
Fix printing and emit for definite assignment assertions (#35095)
* Fix printing and emit for definite assignment assertions

* Make factories that handle definite assertions internal
2019-11-21 11:20:57 -08:00
Wesley Wigham
a6d44aa52e
Map stale empty object type in union into fresh empty object type after spread is complete (#34839)
* Map stale empty object type in union into fresh empty object type after spread is complete

* Accept minor baseline diff
2019-11-21 10:57:55 -08:00
TypeScript Bot
0d993ac592 Update user baselines (#35251) 2019-11-20 15:55:13 -08:00
Eli Barzilay
77ec756960 Make getSourceFileToImportFromResolved prefer files in program.getSourceFiles()
Fixes #30550
2019-11-20 18:00:10 -05:00
TypeScript Bot
ca4486a065 Update user baselines (#35218) 2019-11-20 14:56:28 -08:00
Sheetal Nandi
0e736a7438
Fix the usage of pattern matching in module resolution for check of hasZeroOrOneAsteriskCharacter (#35209)
* Fix the usage of pattern matching for check of hasZeroOrOneAsteriskCharacter
Fixes #35171

* Fix error message
2019-11-20 10:55:40 -08:00
Kārlis Gaņģis
17f5469a2c Fix crash with Object.defineProperty for imported alias (--allowJs) (#35198)
Fixes #35196
2019-11-20 10:50:47 -08:00
Nathan Shively-Sanders
75301c8e2c
DOM update 2019-11-19 (#35207)
* DOM update 2019-11-19

* update baselines

* update more baselines
2019-11-19 15:02:51 -08:00
Andrew Branch
571ca60b08
Add preceding semicolon on await insertion when parentheses are included (#34627)
* Add preceding semicolon on await insertion when parentheses are included

* Just start with precedingToken

* Fix semicolon formatter regression

* Delete test with debatable expected behavior

* Lint after control flow changes
2019-11-19 13:11:42 -08:00