Commit graph

29516 commits

Author SHA1 Message Date
Nathan Shively-Sanders 09f409cfcb improve test 2020-01-24 14:04:37 -08:00
Nathan Shively-Sanders 231d0d1be4 ESNext+[[Define]]: reference to param props illegal
When target: "esnext" and useDefineForClassFields: true, property
declaration initialisers should not be able to reference parameter
properties; class fields are initialised before the constructor runs,
but parameter properties are not:

```ts
class C {
  foo = this.bar
  constructor(public bar: string) { }
}
```

emits code that looks like this:

```js
class C {
  bar
  foo = this.bar
  constructor(bar) {
    this.bar = bar
  }
}
new C('x').foo.length // crashes; foo is undefined
```

This PR adds an error on foo's declaration with ESNext+[[Define]].
2020-01-24 13:55:46 -08:00
Sheetal Nandi 29895e8906
Handle header comments better by comparing its end line with first node line (#36413)
Fixes #31508
2020-01-24 11:20:41 -08:00
Andrii Dieiev 420b478c65 Add prefix/suffix only to binding element name (#33538) 2020-01-24 10:46:41 -08:00
Wesley Wigham 9e712dd097
Consider SymbolFlags.Method as function-esque during js declaration emit (#36274) 2020-01-24 10:29:23 -08:00
ExE Boss 6f0c6417e8 fix(lib/es2019): Symbol.description may be undefined (#36263)
* fix(lib/es2019): `Symbol.description` may be `undefined`

* Update user baselines (EB-Forks#1)

Co-authored-by: TypeScript Bot <ts_bot@rcavanaugh.com>
2020-01-24 10:06:04 -08:00
TypeScript Bot 3b919e2ab1 Update user baselines (#36382) 2020-01-23 14:12:40 -08:00
Klaus Meinhardt 49eb0d7a2b Disallow 'declare' modifier on private named properties (#36381)
Fixes: #36345
2020-01-23 13:18:10 -08:00
Sheetal Nandi 677e45ccb8
Dont add "use strict" prologue in json emit (#36380)
* Add test for strict with isolated modules and resolveJson
Test for #36372

* Dont add "use strict" prologue in json emit
Fixes #36372
2020-01-23 13:01:11 -08:00
Andrew Branch b05dde747c
Update type-only import semantics to allow type queries (#36092)
* Change type-only semantics to allow type queries

* Don’t error using type-only import in ambient context

* Fix default import

* Fix namespace import

* Update more baselines

* Prevent circular resolution

* Track const enum expression usage

* Update baselines

* Perf tuning 1

* Test commit for perf impact

* Weave type-only alias declaration finding into alias resolution

* Fix namespace import of type-only exported symbols

* type-only exports do not contribute to the module object type

* Update APIs

* Fix enum casing, remove type-only conversion suggestion

* Short circuit type-only checks in resolveEntityName faster

* Fix casing in API

* Remove unused parameter

* Fix error on qualified names in type queries

* Allow type-only imports in computed property names

* Fix computed property names of types and abstract members

* Remove unused util

* Commit missing baselines

* Rename “check” functions so as not to overload the word “check”
2020-01-23 12:53:36 -08:00
Klaus Meinhardt 0276e7f910 noErrorTruncation affects semantic diagnostics (#36306) 2020-01-23 11:10:05 -08:00
Nathan Shively-Sanders ef5573b266
Add as completions (#36359) 2020-01-23 08:29:06 -08:00
Wesley Wigham 75f88eee48
Do not short-circuit module visibility calculation when alias visibility is requested (#36339) 2020-01-22 14:49:29 -08:00
Andrew Branch eac2180e40
Be more tolerant with private identifier parsing, issue more targeted errors, and support private identifiers in forgotten 'this' codefix (#36188)
* Support private identifiers in forgotten this codefix

* Parse invalid private identifiers as identifiers and issue targeted errors

* Update codefix

* Remove accidentally deleted newline
2020-01-22 13:41:15 -08:00
Nathan Shively-Sanders 770fbcb42f
Add jest to fp-ts user test (#36360)
It was missing because I *think* they just added it.
2020-01-22 13:38:25 -08:00
Andrew Branch 1d5749ef78
Fix local and exported type alias merging (#36237)
* Fix local and exported type alias merging

* Add baselines
2020-01-22 13:16:49 -08:00
Orta 82a3eb5b5f
Add a list of PR owners for tooling to use (#36357) 2020-01-22 15:09:01 -05:00
Anders Hejlsberg da61231039
Include super.XXX(...) assertion method calls in CFA (#36293)
* Support super.XXX in assertions

* Add tests
2020-01-22 11:21:11 -08:00
Nathan Shively-Sanders c8e2f58ec5
Completions for asserts and declare (#36355)
* Add completions for `asserts`

* Add declare assertions.
2020-01-22 10:43:33 -08:00
Orta 5e59eece34
Adds support for showing default exports in the navtree (#35477)
* Adds support for showing default exports in the navtree - Fixes #34601

* Handle the feedback in #35477

* Navigation items using default export or export = will get noted if they are a const vs function
2020-01-22 08:13:04 -05:00
Alexander T 38eccbab2a feat(29624): better errors for non-exported types (#36187) 2020-01-21 13:03:22 -08:00
Klaus Meinhardt 342f4c0b54 forceConsistentCasingInFileNames affects module resolution (#36334) 2020-01-21 12:45:13 -08:00
Daniel Rosenwasser 8976ac96aa Update LKG. 2020-01-21 12:35:42 -08:00
Klaus Meinhardt 1fbe20fe75 resolveJsonModule affectsModuleResolution (#36290)
* resolveJsonModule affectsModuleResolutionFixes: #36251

* fix lint
2020-01-21 11:49:38 -08:00
Klaus Meinhardt bc1e7728df experimentalDecorators and emitDecoratorMetadata affect builder state (#36297)
* experimentalDecorators and emitDecoratorMetadata affect builder state

* better test
2020-01-21 11:28:55 -08:00
Klaus Meinhardt 2dd21a08f5 useDefineForClassFields affects emit (#36308)
* useDefineForClassFields affects emit

* fix lint
2020-01-21 11:28:04 -08:00
Yacine Hmito 4445e1147c Fix isProgramUpToDate when changing rootFileNames (#36011) 2020-01-21 11:26:17 -08:00
Orta f588c78aab
Remove the compiler diag 1360 after it got missed in #35751 (#36332) 2020-01-21 11:54:48 -05:00
Wenlu Wang d2c5d54242 remove duplicate message (#36125) 2020-01-18 14:00:53 -08:00
Alexander T 0dd4c9cebe feat(36231): Improve message for "Remove declaration for: ..." (#36283) 2020-01-18 13:28:19 -08:00
Ron Buckton 50adabe32d
Improve diagnostics and add code fixes for top-level await (#36173) 2020-01-18 12:24:08 -08:00
Alexander T afa11d3c7a fix(34621): show suggestions in class property initializer (#35999) 2020-01-17 14:27:12 -08:00
Alexander T 94e8db7e07 fix(35043): TS Server: references does not mark isDefinition o… (#36051) 2020-01-17 14:26:36 -08:00
Alexander T ce4c4b6183 fix(36023): fix crash in document highlight service (#36233) 2020-01-17 14:24:46 -08:00
Sheon Han 96e8fbc657 Fix for issue #32528: Prevent meta property from appearing twice (#35844)
* fix meta property from appearing twice

* handle case where ImportMeta has props defined

* rename file

* use exclude instead of exact

* undo comment

* this file should have no change

* change file name back

* add more test cases

* remove comment and text validation

* fix formatting
2020-01-17 13:56:50 -08:00
Anders Hejlsberg 1a10e712e6
Improve variance measurement (#36261)
* No covariance default for recursive references in variance measurement

* Add tests

* Accept new baselines
2020-01-17 11:50:38 -08:00
csigs e2e1f6fd85
LEGO: Merge pull request 36253
LEGO: Merge pull request 36253
2020-01-16 20:10:43 -08:00
csigs 70ba8512bb LEGO: check in for master to temporary branch. 2020-01-17 04:10:10 +00:00
Sheetal Nandi 57925d4e35
Instead of checking if file exists before file read, handle exceptions from file read (#36244)
Fixes #36236
2020-01-16 17:24:03 -08:00
Anders Hejlsberg 8517df6fa2
Fix erroneous optional chain narrowing (#36145)
* Not all optional chains are narrowable references

* Add regression test
2020-01-16 16:49:51 -08:00
Sheetal Nandi b2a7d42032
Handle untitled files from vscode which are of format: untitled:^Untitled-1 (#36240)
* Test for #36200

* Handle dynamic files by vscode
Fixes #36200
2020-01-16 15:38:55 -08:00
Andrew Branch 797c5362a2
Codefix: Don’t return a fixId if there’s definitely nothing else that can be fixed (#35765)
* Start fixing fixId

* Fix tests

* Add comment

* Fix unit tests, remove fixAllDescription when unavailable

* Add codeFixAllAvailable to fourslash harness
2020-01-16 10:07:37 -08:00
Alexander T eeff036519 fix(35954): Change spelling for private field incorrectly fixes to a string property (#36079)
* fix(35954): code fix incorrectly fixes private properties spelling issues

* remove duplicate function calls
2020-01-16 09:01:21 -08:00
Alexander T dbd55b3928 fix(35944): show spell checking quick fix for non-existent private named property access (#36195) 2020-01-15 16:56:40 -08:00
Andrew Casey f99072593d
Move individual duration properties into a performanceData object (#36210) 2020-01-15 16:48:00 -08:00
Klaus Meinhardt f220e62ce7 importsNotUsedAsValue affects semantic diagnostics (#36001)
* importsNotUsedAsValue affects semantic diagnostics

* add tests
2020-01-15 15:08:16 -08:00
Andrew Branch 81a942e7b9
Fix completions triggered on existing private identifier property access (#36191) 2020-01-15 13:13:11 -08:00
Andrew Casey a9cbea4259
Use fs.existsSync to check for cancellation (#36190)
Unlike statSync, it doesn't throw if the file doesn't exist, saving both
time and allocations.
2020-01-15 12:53:40 -08:00
Anders Kaseorg 64704a160d sys: Use readdir withFileTypes option to skip lots of stat syscalls (#35286)
This makes walking large directory trees much more efficient on Node
10.10 or later.

See:
https://lwn.net/Articles/606995/
https://www.python.org/dev/peps/pep-0471/
https://github.com/nodejs/node/pull/22020
https://nodejs.org/en/blog/release/v10.10.0/

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2020-01-15 12:42:38 -08:00
Orta 1dafd09a06
Revert "Add related diagnostic to "used before defined" if type is a function that returns a union with undefined (#33171)" (#35751)
This reverts commit be960fa356.
2020-01-15 12:50:52 -05:00