Commit Graph

24118 Commits

Author SHA1 Message Date
Ron Buckton
0c78b837a1 Ensure dynamically imported plugins are loaded in the correct order 2022-05-24 18:52:56 -07:00
Matt Bierner
f40a867dee Remove eval
We should throw instead when dynamic import is not implemented
2022-05-10 12:00:28 -07:00
Ron Buckton
85e0fcad54 add tsserverWeb to patch in dynamic import 2022-05-04 11:18:26 -07:00
Matt Bierner
51680a1faa Addressing some comments
- Use result value instead of try/catch (`ImportPluginResult`)
- Add awaits
- Add logging
2022-03-07 18:42:57 -08:00
Matt Bierner
34a83a370d Allow configure plugin requests against any web servers in partial semantic mode 2022-03-04 13:40:03 -08:00
Matt Bierner
53d90b6636 use default export from plugins
This more or less matches how node plugins expect the plugin module to be an init function
2022-02-23 17:11:52 -08:00
Matt Bierner
e2bbb6c329 Prototype TS plugins on web
This prototype allows service plugins to be loaded on web TSServer

Main changes:

- Adds a new host entryPoint called `importServicePlugin` for overriding how plugins can be loaded. This may be async
- Implement `importServicePlugin` for webServer
- The web server plugin implementation looks for a `browser` field in the plugin's `package.json`
- It then uses `import(...)` to load the plugin (the plugin source must be compiled to support being loaded as a module)
2022-02-15 19:25:10 -08:00
Andrew Branch
852b1c2b73 Fix checker initialization crash with esModuleInterop and global merges resolving to ImportEquals aliases (#47348)
* Add minimal failing test

* Fix checker initialization crash with esModuleInterop global merges resolving to ImportEquals aliases
2022-01-10 16:04:12 -08:00
Kat Marchán
7f189b9701 fix ATA toplevel dep detection (#47164)
ATA tried to use the `_requiredBy` field to determine toplevel deps,
but this is not portable. Not only is it unavailable in npm@>=7, but
neither Yarn nor pnpm write this metadata to node_modules pkgjsons.

This also adds support for ATA acquiring types for scoped packages.

Fixes: https://github.com/microsoft/TypeScript/issues/44130
2022-01-07 13:48:31 -08:00
Orta Therox
8a8c71c147 Use relative paths for the end of compile report (#47344) 2022-01-07 19:55:55 +00:00
Oleksandr T
6fc0584dd5 fix(46402): create valid property keys/jsx attribute names (#46716) 2022-01-07 11:46:26 -08:00
Jake Bailey
484f1414d6 Prevent merged class/namespace from overlapping with Record<string, unknown> (#47088) 2022-01-07 11:02:48 -08:00
Anders Hejlsberg
a3d23d36cc Fix conditional type constraint exploration + signature relations (#47341) 2022-01-07 07:44:57 -10:00
Kagami Sascha Rosylight
363e3a78f4 Add Error.prototype.cause (#47020)
* Add `Error.prototype.cause`

Fixes #47019

* Update test baselines
2022-01-07 14:58:58 +00:00
Matt Bierner
69662090a3 Use node ipc for TS Server (#46418)
* Use node ipc for TS Server

For #46417

This lets us use Node's built-in ipc for passing messages to/from the typescript server instead of using stdio

* Remove extra parse

* Add extra logging when using node IPC

* Split out to subclass

* Extract common writeMessage method

* Baseline accept
2022-01-05 16:39:45 -08:00
Gabriela Araujo Britto
404a7d602d Gabritto/semicolons (#46832)
* call formatter in completions

* fixes

* add test

* update api baselines

* fix createModifiersFromModifierFlag to not return empty array
2022-01-04 11:50:49 -08:00
Anders Hejlsberg
f4e1efbc29 Control flow analysis for dependent parameters (#47190)
* Support control flow analysis for dependent parameters

* Add tests
2022-01-04 09:22:11 -10:00
gfyoung
9a75d2acc8 fix(46845): Add missing "locale" field to Intl.DisplayNamesOptions (#46849)
Closes https://github.com/microsoft/TypeScript/issues/46845
2022-01-03 20:10:20 +00:00
Zzzen
a42379179b fix merging of function and derived class (#47170) 2021-12-16 17:29:07 -08:00
Kagami Sascha Rosylight
20e86dab5b Emit class fields as-is with target: es2022 (#47018)
* Emit class fields as-is with `target: es2022`

Closes #47017

* wave 2
2021-12-16 15:15:33 -08:00
Oleksandr T
c282771d59 fix(47004): ignore arguments name in PropertyAssignment (#47054) 2021-12-16 13:05:48 -08:00
Oleksandr T
93bdfd2511 fix(47056): report errors for all properties with errors (#47057) 2021-12-16 12:58:15 -08:00
Andrew Nguyen
270b0d1c73 fix(46824): remove duplicate private identifier errors (#47116) 2021-12-16 12:07:12 -08:00
Tao Cumplido
2bbdb31b07 update es2020.intl DisplayNames#of (#47157)
fix return type of Intl.DisplayNames.prototype.of
was typed to return always string but can actually return undefined too
see spec https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype.of
2021-12-15 17:51:35 +00:00
Anders Hejlsberg
3d3825e783 Fix multiple issues with indexed access types applied to mapped types (#47109)
* Fix multiple issues with indexed access types applied to mapped types

* Add tests
2021-12-14 11:51:03 -08:00
LowR
7e0e8671fa fix(47134): show all meanings for type-only imports and exports (#47138) 2021-12-14 10:58:21 -08:00
Hiroshi Ogawa
8974fead2d fix(47062): support generic arrow function with default type parameter in tsx (#47112)
* fix(47062): support generic arrow function with default type parameter in tsx

* test: update test "completionListIsGlobalCompletion"
2021-12-14 09:02:36 -08:00
Armando Aguirre
67872a50d0 Fix enums and namespace merge (#47059)
* Fix enums and namespace merge

* Remove unused comment
2021-12-13 14:03:19 -08:00
Andrew Branch
430599722e Fix extract type crash (#47136) 2021-12-13 10:39:34 -08:00
Anders Hejlsberg
06746efbd9 Revert change to getFalsyFlags (#47125)
* Revert change to getFalsyFlags

* Add regression test
2021-12-13 09:05:55 -08:00
Oleksandr T
df87a8c12d fix(44693): emit declaration of JSDoc overridden properties with different types (#46797) 2021-12-10 11:06:59 -08:00
Jake Bailey
0ed9247e17 Explicitly Omit unspreadable properties from rest type in the generic case (#47078) 2021-12-09 11:45:52 -08:00
Song Gao
e2c89af335 use default type parameter rather than unknown when show quick help (#46792)
* use default type parameter rather than `unknown` when show quick help

* prefer default type parameter than constraint for quick info
2021-12-08 17:02:22 -08:00
David Sherret
921825585d fix: do not use ts.NodeArray in factory inputs (#46843) 2021-12-08 16:57:52 -08:00
Nathan Shively-Sanders
a2c7fa2d05 Add 12 more grammar errors (#47075)
These are the last ones that I know of. They come from calls to
`grammarErrorOnFirstToken`.

Fixes part of #45349
Follow-up to #47067
2021-12-08 16:54:58 -08:00
Ron Buckton
c8f1a874a3 Exempt tslib from indirect call transform (#47070) 2021-12-08 15:42:37 -08:00
Nathan Shively-Sanders
a72bf5410c Plain JS grammar errors (#47067)
* Plain JS grammar errors

From the list in
https://github.com/microsoft/TypeScript/issues/45349#issuecomment-974561208,
excluding the JSX errors, decorator errors and unresolved #private
error. The latter re-uses "Cannot resolve name X" which naturally shows
up a *lot* in plain JS.

* Add grammarErrorAtPos errors

Also remove checkGrammarArguments; it's blocked entirely by the same
parser error.
2021-12-08 15:16:23 -08:00
Oleksandr T
022542548e fix(47043): as const cast wrong colour when using typescript 4.5.2 (#47066) 2021-12-08 10:15:58 -08:00
Oleksandr T
5f372d9d7e fix(46606): show completion in jsdoc property tag (#46657) 2021-12-07 15:28:41 -08:00
Ron Buckton
67f84ef771 Fix Awaited<T> for onfulfilled callbacks with more than one argument (#46951) 2021-12-07 15:21:11 -08:00
Ryan Bargholz
7a12909ae3 fix(45713) Improve error report summaries (#45742)
* Improve error report summaries (#45713)

* fixup! Improve error report summaries (#45713)

* fixup! fixup! Improve error report summaries (#45713)

* Adds support for handling localization renaming the 'files' header due to localization

* fixup! Adds support for handling localization renaming the 'files' header due to localization

 - Fixed baseline error
 - Fixed linter error

Co-authored-by: Orta <git@orta.io>
Co-authored-by: Orta Therox <ortam@microsoft.com>
2021-12-07 10:50:44 +00:00
Jake Bailey
4013271cd8 Unwrap parens when checking for JSDocFunctionType in conditional expression (#46962) 2021-12-06 16:44:37 -08:00
Oleksandr T
4761ba6285 fix(46998): Hover on as const shows type const = /*unresolved*/ any (#47000) 2021-12-06 14:41:46 -08:00
Jay Clark
1fe9bfdd0e Fix strict/es5+ octal literal 2x error #46810 (#46823)
* Fix strict/es5+ octal literal 2x error #46810

Signed-off-by: Jay Clark <jay@jayeclark.dev>

* Accept baseline test changes

Signed-off-by: Jay Clark <jay@jayeclark.dev>

* Add test case

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-12-06 12:46:08 -08:00
Anders Hejlsberg
2a7eb58589 Properly union inferred template literal string types (#46782)
* Template literals and string mappings have 'string' as base type

* Add regression test

* Add tests for generic template literals

* One more test
2021-12-06 10:51:50 -08:00
Zzzen
7a1687de26 fix(42678): detect access to uninitialized variable in IIFE (#42776)
* fix(42678): detect access to uninitialized variable in IIFE

* improve performance

* Add missing space to match coding guidelines

* simplify the implementation

Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
2021-12-06 10:42:20 -08:00
Yuki Osaki
1f275d705d "No repeated property names" error in object literals is duplicated in strict mode (#46929)
* "No repeated property names" error in object literals is duplicated in strict mode

* fix indent
2021-12-06 10:22:28 -08:00
Wesley Wigham
97a7901f26 Use features for selected module resolution rather than all features for type reference directives, since they can add restrictions to resolutions (#47007) 2021-12-04 04:24:28 -08:00
Anders Hejlsberg
b2af6051ef Improve isValidSpreadType check (#47010)
* Fix getFalsyFlags for intersection types

* Fix and simplify isValidSpreadType

* Slight tweak

* Add tests
2021-12-03 16:11:01 -08:00
Andrew Branch
2ce05a8292 Completions sorting overhaul (#46703)
* Sort resolved auto-import completions by number of directory separators

* Sort completions in services layer

* Finish tests

* Fix more tests

* Respect SortText in completions

* Update tests to use `unsorted` assertion
2021-12-03 14:54:51 -08:00