Commit graph

30954 commits

Author SHA1 Message Date
Alexander T 2dd7a4bf93
fix(31046): add new diagnostic message for incompatible constructor signature (#40073) 2020-08-22 13:26:13 -07:00
Alexander T 9569198df6
fix(25770): add diagnostic message for the possible mapped type used as an index (#39973) 2020-08-21 10:42:48 -07:00
Alexander T 6ec3629ef4
fix(26325): use a unique name for reserved words in 'constructor like' function name (#39684) 2020-08-21 09:47:37 -07:00
cherryblossom000 e8dbc2dd07
Fix typo in (Readonly)Set.keys comment (fixes #40164) (#40176) 2020-08-21 09:15:29 -07:00
Neil Kistner 585603e934
Add compactDisplay and signDisplay to NumberFormatOptions (#40039) 2020-08-21 00:49:22 -07:00
TypeScript Bot 8429ddd4f0 Update package-lock.json 2020-08-21 06:17:39 +00:00
Andrew Casey 54bc0ed93f
Merge pull request #40161 from amcasey/NoNpmUpdate
Delete extra npm update
2020-08-20 18:39:24 -07:00
Andrew Casey 4778cda0b2 Delete extra npm update 2020-08-20 18:16:28 -07:00
Andrew Casey 4eb9fb4bd2
Merge pull request #40146 from amcasey/PackageLock
Adopt package-lock.json
2020-08-20 17:50:23 -07:00
Eli Barzilay f9e360d44b Add missing contextual type to static PropertyDeclarations
Makes it possible to type class static fields.

Fixes #33897.
2020-08-20 19:12:55 -04:00
Ron Buckton 598e9b2e88
Allow trailing params of 'undefined', 'unknown', and 'any' to be optional in non-strictNullChecks JS (#40057) 2020-08-20 13:38:14 -07:00
Wesley Wigham 76639f1585
Revamp dockerfile for office-ui-fabric to reduce noise (#40147)
* Revamp dockerfile for office-ui-fabric to reduce noise and better handle recent changes to project structure

* Revert baseline change so it can be in the normal update, use node 12 since its LTS
2020-08-20 12:01:26 -07:00
TypeScript Bot a7c306f384
Update user baselines +cc @sandersn (#39881)
Co-authored-by: typescript-bot <typescript@microsoft.com>
2020-08-20 09:38:34 -07:00
Nitish Awasthi aa8742ae41
Typescript Language Specification amended (#40120)
fixes #39185
2020-08-20 07:53:24 -07:00
Andrew Casey c12bc7b906 Update bot email address 2020-08-19 18:01:29 -07:00
Andrew Casey 00d7d52729 Git ignore package-lock.json and forcibly update in workflow 2020-08-19 17:57:22 -07:00
Andrew Casey 4d57d35949 Add a workflow to update package-lock.json daily 2020-08-19 17:16:24 -07:00
Andrew Casey 5bcb353e18 Adopt package-lock.json and npm ci 2020-08-19 16:50:23 -07:00
Joost Koehoorn 2f2b679436
Optimize external source maps without full cache (#40130) 2020-08-19 16:05:32 -07:00
Nathan Shively-Sanders 55ca5e91b9
Fixes crash on chained property access on require (#40135)
From the user tests:

```js
const x = require('y').z.ka
```

would cause the crash because I forgot to call
getLeftMmostPropertyAccessExpression in one place.

Note that this doesn't fix the alias, it just stops the crash.
2020-08-19 12:59:22 -07:00
Wesley Wigham 44d2350e5f
Fix tuple name homogeneity check (#40118) 2020-08-19 12:08:17 -07:00
Daniel Rosenwasser 31f4957494
Revert "Optimize source mapping into external source map sources (#40055)" (#40126)
This reverts commit 1e84ffc703.
2020-08-19 11:46:52 -07:00
devsnek a0d457e14c
Add missing properties to stdlib (#38678) 2020-08-18 23:05:38 -07:00
csigs c51aacac44
LEGO: Merge pull request 40127
LEGO: Merge pull request 40127
2020-08-18 21:11:37 -07:00
csigs f27a11d0df LEGO: check in for master to temporary branch. 2020-08-19 04:10:48 +00:00
Joost Koehoorn 1e84ffc703
Optimize source mapping into external source map sources (#40055) 2020-08-18 18:09:05 -07:00
csigs 6a622a11c9
LEGO: Merge pull request 40119
LEGO: Merge pull request 40119
2020-08-18 15:11:59 -07:00
csigs a9277b7e02 LEGO: check in for master to temporary branch. 2020-08-18 22:11:06 +00:00
Andrew Casey 5ff1b75aff
Merge pull request #40043 from gluxon/uvException-hotspot
Set stackTraceLimit to 0 in fileSystemEntryExists
2020-08-18 13:54:58 -07:00
Wesley Wigham 56a2e34991
Ping @sandersn on new user baseline commits (#40117)
* Ping @sandersn on new user baseline commits

You asked for this~

* Update whitespace/comment
2020-08-18 13:28:33 -07:00
Nathan Shively-Sanders 6fea7ff536
Add unit tests for VersionRange (#40114)
* Add unit tests for VersionRange

Make it easier to understand the intended semantics next time I have to
read this code.

* I miss prettier
2020-08-18 13:06:17 -07:00
Andrew Branch dbab46c363
The falsy part of any/unknown is any/unknown (#39529) 2020-08-18 11:06:44 -07:00
csigs 24832e8100
LEGO: Merge pull request 40112
LEGO: Merge pull request 40112
2020-08-18 09:11:35 -07:00
csigs c191f10ed6 LEGO: check in for master to temporary branch. 2020-08-18 16:10:44 +00:00
csigs a2d20a2f4d
LEGO: Merge pull request 40108
LEGO: Merge pull request 40108
2020-08-18 03:11:43 -07:00
csigs 9bf6b7bf53 LEGO: check in for master to temporary branch. 2020-08-18 10:10:53 +00:00
Alexander T 9f3af67929
fix(10019): allow renaming labels (#40064) 2020-08-18 01:04:49 -07:00
Wesley Wigham f9cca25cd7
Fix lack of error on default export of nonexistant name (#40094)
* Modify test harness so it can report underlying issue, fix small parent pointer issue

* Fix underlying export asignment check issue and fix lints

* Ensure class/function duplicate declaration errors are reported regarless of which is encountered first

* Ensure flag conflict errors are reported regardless of which declaration is encountered first
2020-08-17 15:30:19 -07:00
csigs 156a6e2713
LEGO: Merge pull request 40099
LEGO: Merge pull request 40099
2020-08-17 15:12:25 -07:00
csigs e0b494b34a LEGO: check in for master to temporary branch. 2020-08-17 22:11:16 +00:00
Nathan Shively-Sanders c3d41bbb73
Alias for commonjs require in JS (#39770)
* First attempt at aliases for require

* test+initial support for const x=require

* 1st round of baseline improvements

* 2nd round of baseline updates

* support property access after require

* check @type tag on require

* forbid expando missing namespaces on aliases

taken from #39558 as soon as it was created

* accept error baselines that are good, actually

* Scribbling on d.ts emit code

* use getSpecifierForModuleSymbol

* hideous hack for module.exports of aliases

* Fix module.exports.x --> export list emit

* fix isLocalImport predicate

* require only creates aliases in JS

* re-handle json imports

* update fourslash baseline

* Cleanup in the checker

1. Simplify alias resolution.
2. Simplify variable-like checking.
3. Make binding skip require calls with type tags -- they fall back to
the old require-call code and then check from there.

I haven't started on the declaration emit code since I don't know what
is going on there nearly as well.

* Function for getting module name from require call

* First round of cleanup plus a new test

Found one missing feature, not sure it's worth adding.

* more small cleanup

* more cleanup, including lint

* use trackSymbol, not serializeTypeForDeclaration

* Code review comments, plus remove unneeded code

Ad-hoc type reference resolution for `require` isn't needed anymore.

* find all refs works

* remove old ad-hoc code

* make it clear that old behaviour is not that correct

* update api baselines

* remove outdated comment

* PR feedback

1. Fix indentation
2. Add comment for exported JSON emit
3. Add test case for nested-namespace exports.

* add a fail-case test (which passes!)
2020-08-17 14:00:37 -07:00
Daniel Rosenwasser 97a072926f
Revert "Add '(approximate)' to the beginning of quick info requests in PartialSemantic mode (#40061)" (#40072)
This reverts commit 2426eb4980.
2020-08-17 11:45:39 -07:00
Anders Hejlsberg cd30534327
Recursive conditional types (#40002)
* Support recursive conditional types

* Accept new API baselines

* Accept new baselines

* Simplify recursive type tracking in type inference

* Accept new baselines

* Add tests

* Accept new baselines

* Revise recursion tracking in type inference

* Revise tests

* Accept new baselines

* Add more tests

* Accept new baselines
2020-08-15 18:22:30 -07:00
Daniel Rosenwasser 2426eb4980
Add '(approximate)' to the beginning of quick info requests in PartialSemantic mode (#40061)
* Add '(approximate)' to the beginning of quick info requests.

* Use 'approximation' instead of 'approximate'.
2020-08-14 17:54:10 -07:00
Brandon Cheng 930b81cc45
Set stackTraceLimit to 0 in fileSystemEntryExists
The exception thrown by Node.js's fs.statSync function contains a stack
trace that can be expensive to compute. Since this exception isn't used
by fileSystemEntryExists, we can safely set Error.stackTraceLimit to 0
without a change in behavior.

---

A significant performance improvement was noticed with this change while
profiling tsserver on packages within a proprietary monorepo.
Specifically, my team saw high self time percentages for Node.js's
uvException and handleErrorFromBinding internal functions. These
functions are executed within fs.statSync when it fails to find the
given path.

https://user-images.githubusercontent.com/906558/90183227-220cb800-dd81-11ea-8d61-f41f89481f46.png

fs.statSync: https://github.com/nodejs/node/blob/v14.4.0/lib/fs.js#L1030-L1037
handleErrorFromBinding: https://github.com/nodejs/node/blob/v14.4.0/lib/internal/fs/utils.js#L254-L269
uvException: https://github.com/nodejs/node/blob/v14.4.0/lib/internal/errors.js#L390-L443

 ## Measurements

After adding Error.stackTraceLimit = 0, we saw:

- For a large configured project with 12,565 files, tsserver reached the
  projectLoadingFinish event 48.78% faster. (~46.786s vs ~31.447s)
- For a medium project with 7,064 files, tsserver was 25.75% faster.
  (~20.897s vs ~16.618s)
- For a small project with 796 files, tsserver was only a negligible
  3.00% faster. (~3.545s vs ~3.442)

Measurements were taken on macOS 10.15.6, Node.js 14.4.0, and a recent
master commit of TypeScript (610fa28d). The average of 3 runs before and
after this change were taken.

I would normally include .cpuprofile and isolate-*-*-*.log files, but
can't post them publicly in this case. If there's any other summaries
the TypeScript team would be curious about I can report them.

 ## fs.statSync Misses

Within our monorepo, the fs.statSync misses were mostly searches for
alternative file extensions of module imports.

- For node_modules imports, a lot of .ts/.tsx lookups failed until the
  .d.ts file was found.
- Within projects with a lot of JSX files, .ts files were looked for
  before finding the .tsx version.
- In the medium scale project mentioned above, a total of 38,515
  non-existent files were queried during createProgram.
2020-08-14 16:22:09 -04:00
Sheetal Nandi c95cffe111
Ensure file, include and exclude specs used are strings (#40041)
* Test displaying failure when specs used are not strings

* Ensure specs used are strings
Fixes #38164, #39856

* Feedback
2020-08-13 17:08:20 -07:00
Zen 0ed523bb60
fix jsx completions after attributes (#39859)
closes #39530
2020-08-13 16:14:12 -07:00
Alexander T edc88c51ca
fix(15230): change the diagnostic message about a non-module file in an --isolatedModules project (#40032) 2020-08-13 14:03:17 -07:00
Wesley Wigham 44d9ceaf14
Small branch sync script change 2020-08-13 13:17:05 -07:00
Alexander T 610fa28de5
feat(40004): make isNamedTupleMember public (#40005) 2020-08-12 20:46:40 -07:00