Compare commits

...

164 commits

Author SHA1 Message Date
TypeScript Bot 90600e1b17 Update package-lock.json 2021-11-24 06:07:09 +00:00
Daniel Rosenwasser a90389a22d
Switch deferredNodes from a Map to a Set. (#46751) 2021-11-23 17:46:33 -08:00
TypeScript Bot 0163a624b7 Update package-lock.json 2021-11-20 06:06:42 +00:00
TypeScript Bot 9766757ee6 Update package-lock.json 2021-11-19 06:06:13 +00:00
Nathan Shively-Sanders 868c275fdf
Plain JS binder errors (#46816)
* Plain JS binder errors

Issue select errors from the binder in JS files that do not have checkJS
explicitly turned on or off. These errors mirror runtime checks done by
Javascript.

* Rest of plain JS binder errors

* address PR comments

* Only issue binder errors in plain JS.

Checker errors require requesting diagnostics, which stll needs to be
peformance tested.

This commit removes one cross-file duplicate declaration error in the tests.

* fix const lint
2021-11-18 17:13:06 -08:00
Oleksandr T 6143237376
fix(46366): handle enum string access as enumMemberName (#46431) 2021-11-18 15:50:32 -08:00
Andrew Casey 1ade73df2b
Stop calling our own @deprecrated APIs (#46831)
* Clean up createMap

* Delete dead createMapFromTemplate

* Clean up assertDefined

* Delete dead assertEachDefined

* Delete dead createUnderscoreEscapedMap

* Delete dead hasEntries

* Delete dead ReadonlyNodeSet, NodeSet, ReadonlyNodeMap, NodeMap

* Use updated SyntaxKind names

* Update API baselines
2021-11-18 10:37:55 -08:00
Zzzen de4ba0f208
enable go-to-type-definition on type nodes (#46714)
* enable go-to-type-definition on type nodes

* only go when symbol has no value meaning

* Update formatting of src/services/goToDefinition.ts

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-11-18 08:55:54 -08:00
Oleksandr T a75f26e68b
fix(42238): emit this parameter in function declaration (#46511) 2021-11-17 15:43:27 -08:00
Andrew Branch f11f14baba
Fix broken module resolution after large/rapid edits in nodenext (#46818)
* Fix broken module resolution after edits in nodenext

* Move field copying to a better place I guess
2021-11-17 13:04:43 -08:00
Andrew Branch 009dd487a6
Update symlink cache from AutoImportProvider resolution even if host project already contains the file via its realpath (#46830) 2021-11-16 16:39:10 -08:00
Wesley Wigham 0bf97296d6
Allow nightly-only flags in -insiders builds (#46829) 2021-11-16 12:53:37 -08:00
Kevin Tan fcdbc932bf
implement code fix for override of js files (#45780)
* feat: code fix for override in js files

Co-Authored-By: Wenlu Wang <kingwenlu@gmail.com>

* fix comments

Co-Authored-By: Wenlu Wang <kingwenlu@gmail.com>

* remove tryMergeJsdocTags

* fix: bring the two methods back as functions

* revert emitter changes

* fix comments

* fix: test failures

Co-authored-by: Wenlu Wang <kingwenlu@gmail.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-11-16 08:01:43 -08:00
TypeScript Bot 7615547d42 Update package-lock.json 2021-11-15 06:06:28 +00:00
Oleksandr T 719ab0b477
fix(43359): emit default exports with named exports that have the same names with types (#44718) 2021-11-12 11:25:52 -08:00
Mohammad Aziz fe3e117cb2
fix(46712): Add "exceptZero" for "signDisplay" option of Intl.NumberFormat() (#46740) 2021-11-12 11:12:21 +00:00
Andrew Branch 1298f498f4
Revert changes to matchFiles/readDirectory made since 4.3 (#46787)
* Revert "Fix RWC missing file detection (#46673)"

This reverts commit 4a065f524c.

* Revert "Pass absolute path to directoryExists (#46086)"

This reverts commit 55b4928e82.

* Revert "Reduce exceptions (#44710)"

This reverts commit c0d5c29080.

* Add back system watcher limit
2021-11-11 15:24:20 -08:00
Armando Aguirre 7b86a65f22
Removed replacement from jsx completions (#46767)
* Removed replacement from jsx completions

* Fixed tests
2021-11-10 18:18:15 -08:00
Oleksandr T b12d5c5dc5
fix(46605): show completions in object literal parameters (#46743) 2021-11-09 14:50:26 -08:00
Daniel Rosenwasser 416571ca90
Remove unnecessary annotations/casts/aliases (#46727)
* Remove unnecessary annotation.

* Remove more unnecessary stuff.

* Remove unnecessary assertion.
2021-11-09 12:17:54 -08:00
Gabriela Araujo Britto e5a6ae397d
Fix extra newline in class member snippet completions (#46737)
* fix extra newline

* fix test
2021-11-09 12:03:07 -08:00
Wesley Wigham 4a065f524c
Fix RWC missing file detection (#46673) 2021-11-09 10:41:18 -08:00
TypeScript Bot e040e8516f Update package-lock.json 2021-11-09 06:06:42 +00:00
Oleksandr T a05d851dc3
fix(45907): don't use static member name to inherit JSDocs from instance members (#46274) 2021-11-08 15:05:08 -08:00
Nathan Shively-Sanders 9713cc1a75
Big[U]Int64Array.at returns bigint, not number (#46733)
bigint is needed to represent all 64-bit ints that these arrays could
contain.
2021-11-08 09:50:02 -08:00
Oleksandr T 3ef3cdddb3
fix(45692): merge non-primitive in spread-union (#45729) 2021-11-05 15:41:06 -07:00
Oleksandr T 0a628ff0c9
fix(44059): omit duplicate types (#45739) 2021-11-05 15:36:08 -07:00
Oleksandr T 2d4b243195
fix(33325): allow extract refactoring on selected statement without trailing semicolon (#45765) 2021-11-05 10:00:31 -07:00
Oleksandr T 4fca1e1fcd
fix(46666): add outlining spans for comments preceding call expressions (#46682) 2021-11-04 12:43:01 -07:00
Kagami Sascha Rosylight ae582a22ee
Add target: "es2022" (#46291)
* Add `target: "es2022"`

* Add Object.hasOwn

* formatToParts is es2018

* ref update

* optional parameter

* Revert "optional parameter"

This reverts commit e67d6e5f60.

* undefined

* error cause

* Lint fix

Co-authored-by: Orta <git@orta.io>
2021-11-04 10:55:11 -07:00
Oleksandr T ff75b8a180
fix(46615): remove useless assertion. change error suggestion for rest params (#46628) 2021-11-03 14:11:39 -07:00
Wesley Wigham d53630fac3
Make specifier generation from export map information conditional on module resolution mode (#46670) 2021-11-03 13:10:44 -07:00
Oleksandr T 7264cf7db5
fix(46589): omit ? in method signature completion for optional methods (#46594) 2021-11-03 12:56:17 -07:00
Andrew Casey e2f47a2db1
Duplicate GDPR fragment from VS Code repo (#46625)
* Duplicate GDPR fragment from VS Code repo

...because the tool doesn't handle cross-repro references.

* Explain functionality in more detail
2021-11-03 10:37:31 -07:00
Anders Hejlsberg 831b770b95
Control flow analysis for destructured discriminated unions (#46266)
* CFA for dependent variables destructured from discriminated union

* Accept new baselines

* Add tests

* Limit calls to isSymbolAssigned

* Fix wrong operator
2021-11-02 15:48:13 -07:00
Wesley Wigham de23842e45
Allow import assertions on esm imports under module: nodenext (#46630)
* Allow import assertions on esm imports under module: nodenext

* Changes to copy

Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-11-02 15:34:37 -07:00
Oleksandr T b8f8fd7a3e
fix(46512): allow to use tag names containing keywords with - (#46546) 2021-11-02 15:12:10 -07:00
Anders Hejlsberg 33fe1b6ffc
Fix contextual typing for symbol-named properties (#46558)
* Properly handle symbol-named properties in contextual types

* Update index signature in PropertyDescriptorMap

* Add regression tests
2021-11-02 14:05:41 -07:00
Anders Hejlsberg 373accf28f
Improve recursion depth checks (#46599)
* Decrease recursion depth limit to 3 + smarter check for recursion

* Accept new baselines

* Always set last type id

* Keep indexed access recursion depth check

* Less expensive and corrected check for broadest equivalent keys
2021-11-02 14:05:17 -07:00
Anders Hejlsberg 56f81075f9
Properly check whether union type contains only primitive types (#46645)
* Properly check whether union type contains only primitive types

* Add regression test

* Remove 'export' modifier from test
2021-11-02 12:46:26 -07:00
Andrew Branch 7f8bf0b9c4
Fix git remote in cherry pick script (#46647) 2021-11-02 12:39:42 -07:00
Anders Hejlsberg 7cbcfeea99
Exclude identity relation from mapped type relation check (#46632)
* Exclude identity relation from mapped type relation check

* Add regression test
2021-11-02 06:54:35 -07:00
TypeScript Bot 2424d0e575 Update package-lock.json 2021-11-02 06:06:22 +00:00
Oleksandr T 5142e37f2d
fix(43292): forbid highlighting multiline template strings (#46531) 2021-11-01 14:21:38 -07:00
Eli Barzilay fa2ad1a35a Fix findUpDir.ts and uses
Missed a bunch of stuff in #46414 (556098e).
2021-11-01 16:45:49 -04:00
Daniel Rosenwasser d89076381e
Bump version to 4.6 and accept baselines. (#46612) 2021-11-01 11:45:22 -07:00
Daniel Rosenwasser 6d33d8797b
Check for type parameters on original type when getting type argument completions (#46614)
* Add failing test.

* Check for type parameters on the original type when asking for the type argument constraint.

* Update tests/cases/fourslash/stringLiteralTypeCompletionsInTypeArgForNonGeneric1.ts
2021-11-01 11:41:43 -07:00
csigs bf6d164bd5
LEGO: Merge pull request 46601
LEGO: Merge pull request 46601
2021-10-29 22:17:49 -07:00
Gabriela Araujo Britto 6b1e8f7baf
remove placeholders in class member snippets (#46598) 2021-10-29 16:55:59 -07:00
csigs e3fab9fc20
LEGO: Merge pull request 46597
LEGO: Merge pull request 46597
2021-10-29 16:13:23 -07:00
Andrew Branch 7742cf2180
Set hasAddedOrRemovedSymlinks when discovering an existing file by its link (#46569)
* Set hasAddedOrRemovedSymlinks when discovering an existing file by its link

* Make it optional
2021-10-29 15:47:48 -07:00
Andrew Branch eeaa595196
Enable auto imports in member snippet completions (#46592) 2021-10-29 14:43:32 -07:00
Anders Hejlsberg b0ab2a54bb
Fix mapped type instantiation circularity (#46586)
* Don't obtain constraint if doing so would cause circularity

* Add regression test

* Address CR feedback
2021-10-29 14:01:27 -07:00
Wesley Wigham 28e3cd3a80
Add error on new module/moduleResolution modes when used in non-nightly TS (#46557)
* Add error on new module/moduleResolution modes when used in non-nightly TS

* Update diagnostic
2021-10-29 11:46:19 -07:00
Jack Bates 9b1ba8f1e3
Fix react-jsx spread children invalid emit (#46565)
* Fix react-jsx spread children invalid emit

* Update Baselines and/or Applied Lint Fixes

* Change childrenLength parameter -> isStaticChildren

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-10-29 10:54:46 -07:00
Andrew Casey 325435891a
Update GDPR comment formatting (#46585)
...so that they are picked up properly by the tooling.
2021-10-29 10:48:28 -07:00
Gabriela Araujo Britto 9cdbb7248b
Improve errors on module: node12 and extensionless relative imports (#46486)
* add new error + suggestions

* push down assert defined

* remove comment

* fix esm module import detection, update baselines

* add and update new tests

* fix review comments

* remove renamed baseline references

* update node modules test baselines

* fix error message, add new tests

* update old tests with new error message
2021-10-29 10:25:03 -07:00
csigs f1a69ec93e
LEGO: Merge pull request 46584
LEGO: Merge pull request 46584
2021-10-29 10:14:21 -07:00
Gabriela Araujo Britto fd620c93f6
Add method signature completions (#46370)
* prototype creation for method override completion snippet

* WIP: start using codefix `addNewNodeForMemberSymbol` to create method decl node

* update type of addNewNodeForMemberSymbol

* add more tests and support more cases

* add more tests and fix some details

* wip: more fixes and tests

* expose check override modifier in checker

* fix test

* WIP: add snippet support

* WIP: snippet support on emitter, adding snippets in completions

* make add snippets work with overloads (not synced)

* fix snippet adding

* rebase

* WIP: try to add snippet escaping in emitter

* support escaping in snippets

* small fixes; fixed tests

* more tests and fixes

* fix new tests

* fix modifier inheritance for overloads

* merge conflict fixes; remove comments

* throw error if setOptions is called but not implemented

* fix newline handling

* fix weird stuff

* fix tests

* fix more tests

* Fix unbound host.getNewLine

* fix isParameterDeclaration changes

* rename diagnostic to status and remove snippets from public api

* rename emitter functions + fix indentation

* check completion kind before calling isclasslikemembercompletion

* fix missing type parameters

* Revert "fix missing type parameters"

This reverts commit 7bdeaa86da.

* add isAmbient flag to addNewNodeForMemberSymbol

* add test for abstract overloads

* refactor snippet escaping support

* add user preference flag for enabling class member snippets

* update API baseline

* update tabstop order

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2021-10-28 16:05:36 -07:00
csigs 566758d6cb
LEGO: Merge pull request 46566
LEGO: Merge pull request 46566
2021-10-28 10:13:44 -07:00
TypeScript Bot 4e237ed66f
🤖 Update TypeScript DOM Libs (#46222)
Co-authored-by: orta <orta@users.noreply.github.com>
2021-10-28 09:14:26 -07:00
TypeScript Bot 8173afbb8a Update package-lock.json 2021-10-28 06:06:31 +00:00
Daniel Rosenwasser f494742ce9
Check for array types when instantiating mapped type constraints with any (#46218)
* Added/updated tests.

* Accepted baselines.

* Update test.

* Update instantiateMappedType to work specially when 'any' replaced an array.

* Accepted baselines.

* Ensure check works when constraint is a union of arrayish types, just like in `Promise.all`.

* Accepted baselines.

* Update test for indirect instantiation of a mapped type.

* Accepted baselines.

* Update test comment.

* Accepted baselines.

* Added tuple test case.

* Accepted baselines.

* Don't add special behavior for tuples.

* Accepted baselines.

* Revert "Don't add special behavior for tuples."

This reverts commit f01ae16e65.

* Accepted baselines.
2021-10-27 15:03:01 -07:00
Wesley Wigham abfd537503
Support resolveJsonModule in new module modes (#46434)
* Support resolveJsonModule in new module modes

* Formatting feedback
2021-10-27 12:30:06 -07:00
Zzzen 8a68c8616d
allow typeof this after for-loops (#46181) 2021-10-27 10:26:05 -07:00
Anders Hejlsberg f424dfc18a
Slightly less conservative check in isConstraintPosition (#46526)
* Slight adjustment to check in isConstraintPosition

* Add regression test
2021-10-26 11:54:46 -07:00
Anders Hejlsberg 44c63a757e
Always cache relations involving intersection types (#46523)
* Always cache relations involving intersection types

* Accept new baselines

* Add regression test
2021-10-26 09:36:19 -07:00
Anders Hejlsberg 658764e499
Bypass caching in removeStringLiteralsMatchedByTemplateLiterals (#46525)
* Bypass caching in removeStringLiteralsMatchedByTemplateLiterals

* Add regression test
2021-10-26 09:34:15 -07:00
TypeScript Bot e1a2c2c5a9 Update package-lock.json 2021-10-26 06:07:59 +00:00
Andrew Branch 3519af0bab
Fix crash pulling on global types before they're initialized (#46471)
* Add failing test

* Dumb fix

* Compute error message info more lazily

* One more laziness
2021-10-25 10:53:41 -07:00
csigs 6b6665e6ae
LEGO: Merge pull request 46520
LEGO: Merge pull request 46520
2021-10-25 10:13:29 -07:00
Adam Burgess 61f5ceb832
Fix isNewIdentifierLocation after generator (#46491) 2021-10-24 23:49:31 -07:00
csigs 7799113e9a
LEGO: Merge pull request 46510
LEGO: Merge pull request 46510
2021-10-24 22:14:38 -07:00
csigs e88e596126
LEGO: Merge pull request 46504
LEGO: Merge pull request 46504
2021-10-24 10:14:16 -07:00
csigs dd89e06520
LEGO: Merge pull request 46502
LEGO: Merge pull request 46502
2021-10-24 04:13:27 -07:00
csigs c2a4bda133
LEGO: Merge pull request 46501
LEGO: Merge pull request 46501
2021-10-23 22:14:29 -07:00
csigs 1055119164
LEGO: Merge pull request 46496
LEGO: Merge pull request 46496
2021-10-23 10:14:28 -07:00
TypeScript Bot cb07891d19 Update package-lock.json 2021-10-23 06:06:04 +00:00
Andrew Branch 907fc72db4
Fix auto import crash on weird JS aliasing (#46490)
* Fix auto import crash on weird JS aliasing

* Comment up the weird test

* Fix setting members on union/intersection type, happens later
2021-10-22 16:09:32 -07:00
Daniel Rosenwasser 334b8eaa57
Bind assignments to 'this' within static blocks in JS files (#46472)
* Add failing test case.

* Handle 'this' assignments on class static blocks in JavaScript.

* Accepted baselines.
2021-10-22 15:44:35 -07:00
Andrew Branch de1ac8191e
Fix isNewIdentifierLocation after async (#46485) 2021-10-22 12:28:04 -07:00
Oleksandr T ce676d0963
fix(46433): forbid using keywords as parameter names (#46459) 2021-10-22 09:58:01 -07:00
Anders Hejlsberg 449aaa118f
Defer computation of isDistributionDependent to avoid circularities (#46474)
* Defer computation of isDistributionDependent to avoid circularities

* Accept new API baselines
2021-10-22 09:13:54 -07:00
TypeScript Bot 65ae16cdea Update package-lock.json 2021-10-22 06:06:14 +00:00
Anders Hejlsberg f2f35ae78b
Simplify relationship check for conditional type on target side (#46429)
* Simplify relationship check for conditional type on target side

* Accept new baselines

* Better support for non-distribution-dependent types

* Accept new API baselines

* Accept new baselines
2021-10-21 17:35:23 -07:00
Oleksandr T bd12ae2454
fix(46466): add missing async keyword before type parameters (#46467) 2021-10-21 15:56:45 -07:00
Andrew Casey 55b4928e82
Pass absolute path to directoryExists (#46086)
* Pass absolute path to directoryExists

As pointed out by @gretzkiy, the `directoryExists` call added to
`matchFiles` in #44710 should have been passing the absolute path (since
the current directory might not match `currentDirectory`).

* Add test, simplify/clarify/fix matchFiles and friends

Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-10-21 12:22:53 -07:00
Warren Lu 5725cfeb10
Fix typos in es5.d.ts (#46321) 2021-10-21 11:59:01 -07:00
Andrew Branch 22f37cda85
Fix ordering of module specifiers based on package.json presence (#46437)
* Add failing test

* Fix ordering of module specifiers based on package.json presence
2021-10-21 11:43:57 -07:00
Nathan Shively-Sanders f2e5947935
@link parses trailing <...> as part of linkName (#46450)
Similar to #46428.

Fixes #44818
2021-10-20 17:01:01 -07:00
csigs 0d022130be
LEGO: Merge pull request 46451
LEGO: Merge pull request 46451
2021-10-20 10:13:33 -07:00
Nathan Shively-Sanders 98b4ac2cde
@link: format trailing () as part of linkName (#46428)
Parsing separates the identifier part of the link tag from its text, but
the editor should present an identifier followed by `()` as a single
identifier since people use that syntax as a function sigil.

I prefer `#'` personally, you know, xkcd 297, nudge nudge.
2021-10-20 08:36:40 -07:00
csigs 48e96f56be
LEGO: Merge pull request 46447
LEGO: Merge pull request 46447
2021-10-20 04:31:11 -07:00
TypeScript Bot dea48531f1 Update package-lock.json 2021-10-20 06:06:17 +00:00
Jack Bates 248d478956
Remove defaultValueDescription: "n/a" from options (#46280)
* Remove defaultValueDescription: "n/a" from options

* CommandLineOption type <-> defaultValueDescription

* Require defaultValueDescription of number/boolean options
2021-10-19 15:19:19 -07:00
csigs 53fa2a6494
LEGO: Merge pull request 46430
LEGO: Merge pull request 46430
2021-10-19 10:13:07 -07:00
Anders Hejlsberg 56b6279818
Improve logic for choosing between co- and contra-variant inferences (#46392)
* Improve logic for choosing between co- and contra-variant inferences

* Add tests
2021-10-19 09:58:10 -07:00
csigs fd6552a3c2
LEGO: Merge pull request 46424
LEGO: Merge pull request 46424
2021-10-19 04:15:18 -07:00
Eli Barzilay 556098ed50 Avoid hard-wired build-tree paths
Instead, search for stuff up the directory tree, with the main
functionality being to look for `Gulpfile.js` and assume the resulting
directory is the root.

(Unfortunatley, this is implemented twice, one in `scripts` and another
in `src`.  It's not possible to use a single implementation for both
since that would require assuming a directory structure which this is
intended to avoid.)

Also, in `scripts/build/projects.js`, abstracdt common exec
functionality into a local helper, and use full paths based on the above
search instead of assuming relative paths assuming CWD being in the
project root.
2021-10-18 17:43:45 -04:00
Eli Barzilay 7c3f607032 scripts/build/utils simplify exec
Using shell-based execution is always a bad idea; this thing didn't do
that via an option, but instead did it manually by constructing a shell
command so it suffers from the same diseases.

Perhaps there was need for this at some point in the past, but things
are pretty robust now, so there's no need to avoid running the command
normally.  The only thing that is needed is to add `which` which also
handles windows executable suffixes.

I tried this with a fresh clone on windows, where the tree and TS are
installed in paths that have spaces, and everything works as it should.
2021-10-18 17:43:19 -04:00
csigs 605788d4ab
LEGO: Merge pull request 46415
LEGO: Merge pull request 46415
2021-10-18 10:29:16 -07:00
Nathan Shively-Sanders 8d715ff53e
Error on mapped type w/properties (#46346)
* Error on mapped types with properties

1. Error on properties of type literals with computed properties whose name is a
binary expression with `in`, because that's a good sign of a mapped
type.
2. Parse following properties on mapped types, and error on them.
3. Stop checking computed property names in (1) to avoid producing
errors based on misinterpreting mapped type syntax as an expression.

* add comment in types.ts

* Update API again

* Check interfaces and classes too

* Add missed check in updateMappedTypeNode
2021-10-18 09:00:00 -07:00
TypeScript Bot 26aea0df61 Update package-lock.json 2021-10-17 06:07:02 +00:00
Eli Barzilay 39ff1568e9 Changes to enable the module conversion script
* shorthand -> long for `factory` since the typeformer script doesn't
  know how to handle it.

* Use setter to change `ts.sys` (similar to #35399).

* Fix `loggedIO` with empty namespaces to indicate dependency
  (similar to 50603eda).

* Move `Map` / `Set` stuff from `core.ts` to `corePublic.ts` since the
  types are there.
2021-10-16 08:12:59 -04:00
TypeScript Bot 506a95b5a5 Update package-lock.json 2021-10-16 06:06:14 +00:00
Sidharth Vinod dfb40549fc
fix: ES6 Modules => ES Modules in error messages (#46378)
* fix: ES6 Modules => ES Modules in error messages

* chore: Rename test file names

* chore: Rename function names
2021-10-15 14:51:14 -07:00
Nathan Shively-Sanders 6a75689a25
Import assertion: do no parse } if { is not present (#46388)
Previously, import assertion parsing would try to parse both { and },
even if both were missing. If both were missing, the error for } could
occur past the end of the file, causing an assertion.

Fixes #46364
2021-10-15 13:26:46 -07:00
Oleksandr T 7582b1bbae
fix(45799): skip checking arguments used as a key in object literals (#45814) 2021-10-15 10:34:57 -07:00
Andrew Branch b1f39a705e
Fix React auto-import blocking component imports in --preserve (#46368) 2021-10-15 09:31:47 -07:00
TypeScript Bot cf9d38fe52 Update package-lock.json 2021-10-15 06:06:32 +00:00
Wesley Wigham 2c7b13b830
Fix explainFiles on files under nodenext with types references (#46367)
* Fix explainFiles on files under nodenext with types references

* Fix explainFiles crash on module nodenext
2021-10-14 17:00:55 -07:00
Nathan Shively-Sanders d16d7779a8
No error for markdown links in @see (#46348)
This only shows up in checkJS files, but should still be ignored.
2021-10-14 15:22:59 -07:00
Oleksandr T 80e1a29248
fix(46305): omit converting jsx (react-jsx) spread attributes to Object.assign for ES2018 and up (#46317) 2021-10-14 14:23:50 -07:00
Anders Hejlsberg 8718df3dc1
Fix stack overflow in JSX discriminated union logic (#46354)
* Use getContextFreeTypeOfExpression to avoid circularities

* Add regression test
2021-10-14 10:11:44 -07:00
Sidharth Vinod 5185ef55e3
fix(suggestion): Remove 80001 from cjs/cts files. (#46270)
* fix(suggestion): Remove 80001 from cjs/cts files.

* tests: Cover more cases in a single file.

* tests: Cover more cases in a single file.
2021-10-14 09:55:59 -07:00
TypeScript Bot 3b086e1813 Update package-lock.json 2021-10-14 06:07:58 +00:00
Wesley Wigham 1c5d4e1740
Pass symbol under inspection into checkIndexConstraints (#46350) 2021-10-13 17:04:33 -07:00
Wesley Wigham ac345849e3
Set impliedNodeFormat on sourceFiles maufactured in watch mode (#46349) 2021-10-13 17:04:13 -07:00
LowR cd0434aa76
fix(39744): make template literals more spec compliant (#45304)
* fix(39744): make template literals more spec compliant

* Add evaluation test for template literals

* Add test for template literals with source map
2021-10-13 12:03:31 -07:00
Anders Hejlsberg 0d2aeb7c65
Improve checks for infinitely expanding recursive conditional types (#46326)
* Improve checks for infinitely expanding recursive conditional types

* Accept new baselines

* Add regression tests

* Remove 'export' modifier

* Accept new baselines
2021-10-13 07:08:01 -07:00
TypeScript Bot 315b807489 Update package-lock.json 2021-10-13 06:06:54 +00:00
Wesley Wigham 713afe2227
Set import mode on synthetic imports (#46327) 2021-10-12 16:23:37 -07:00
Yuya Tanaka 9e2fc16c32
Improve perf of unions with many primitives (#45220) 2021-10-12 16:07:21 -07:00
Oleksandr T 44deb84460
fix(45336): add a blank line before the comment expression to avoid disrupting return statement (#46287) 2021-10-11 16:41:49 -07:00
TypeScript Bot 68ff7380d2 Update package-lock.json 2021-10-11 06:06:14 +00:00
TypeScript Bot feac9eb126 Update package-lock.json 2021-10-09 06:06:31 +00:00
Andrew Branch 64b8172f06
Auto-imports: fix some exports being incorrectly stored as re-exports of others due to key conflict (#45792)
* Ensure symbol key unique when target is a local symbol exported elsewhere

* Add test

* Support targets without declarations

* Best key yet

* A-ha moment

* Clean up types

* Update API

* Update unit test
2021-10-08 15:20:12 -07:00
TypeScript Bot f6c0231f08 Update package-lock.json 2021-10-08 06:06:15 +00:00
csigs 613c43287b
LEGO: Merge pull request 46264
LEGO: Merge pull request 46264
2021-10-07 16:14:04 -07:00
Wesley Wigham 82822fc1e9
Use a binary search when looking for the token at a given position (#46250) 2021-10-07 15:06:18 -07:00
csigs bbd9ff51f5
LEGO: Merge pull request 46260
LEGO: Merge pull request 46260
2021-10-07 10:13:49 -07:00
Nathan Shively-Sanders 8c270757b2
In plain JS files, only suggestion did-you-mean errors (#46151)
They will have code fixes, and are tuned for high precision. Others are
not.
2021-10-07 08:41:06 -07:00
csigs fbff13105a
LEGO: Merge pull request 46255
LEGO: Merge pull request 46255
2021-10-07 04:15:20 -07:00
csigs 08361e3d3c
LEGO: Merge pull request 46248
LEGO: Merge pull request 46248
2021-10-06 16:14:13 -07:00
Wesley Wigham 7108646713
Fix extension automatic script kind detection for new extensions (#46205)
* Fix extension script kind detection for new extensions

* Accept (correct) changes to existing baselines affected by correct ScriptKind detection
2021-10-06 13:23:54 -07:00
Wesley Wigham ed9c522fd6
Accept new moduleResolution options on commandline (#46239) 2021-10-06 13:17:27 -07:00
csigs cb158e7eb6
LEGO: Merge pull request 46238
LEGO: Merge pull request 46238
2021-10-06 10:14:06 -07:00
TypeScript Bot f8cb5fa1d7 Update package-lock.json 2021-10-06 06:06:16 +00:00
Wesley Wigham 1cee9731d2
Properly support scoped package self name lookups (#46212) 2021-10-05 12:41:44 -07:00
Wesley Wigham 47cd4d3ecf
Only set package data map under watch mode (#46211) 2021-10-05 11:13:26 -07:00
Wesley Wigham a0cf126513
Limit package.json realpath lookup to only successful resolutions (#46209) 2021-10-05 10:24:08 -07:00
chenjigeng d60747f043
Feat/quick fix for types (#42126)
* feat: add quick fix for types

* feat: add test case for quick fix of types

* feat: add did-you-mean error when Cannot_find_name_0 and Cannot_find_namespace_0

* feat: add Cannot_find_namespace_0_Did_you_mean_1 error and only suggest when resolve type

* feat: update baselines

* feat: update baselines

* feat: update baselines

* chore: fix style problem

* Always suggest spelling corrections

* suggest primitives instead of their wrappers

* Add primitives to suggestions

Instead of altering wrappers to look like primitives.

* add semicolons

* revert unneeded change

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-10-05 08:14:16 -07:00
TypeScript Bot ee24e2ee7e Update package-lock.json 2021-10-05 06:06:56 +00:00
csigs 5423501c37
LEGO: Merge pull request 46203
LEGO: Merge pull request 46203
2021-10-04 10:14:44 -07:00
TypeScript Bot 91117b6763 Update package-lock.json 2021-10-04 06:07:14 +00:00
TypeScript Bot a0b6eadda0 Update package-lock.json 2021-10-03 06:06:00 +00:00
csigs 66182554c8
LEGO: Merge pull request 46179
LEGO: Merge pull request 46179
2021-10-02 22:14:20 -07:00
csigs f3cc868499
LEGO: Merge pull request 46178
LEGO: Merge pull request 46178
2021-10-02 16:14:17 -07:00
csigs 33581aedbd
LEGO: Merge pull request 46173
LEGO: Merge pull request 46173
2021-10-02 04:15:28 -07:00
csigs 49fbeefcf1
LEGO: Merge pull request 46170
LEGO: Merge pull request 46170
2021-10-01 22:17:03 -07:00
csigs a6af833d14
LEGO: Merge pull request 46168
LEGO: Merge pull request 46168
2021-10-01 16:14:26 -07:00
Or Ouziel b2d2f085e2
improve response time of invalid rename attempts (#46158)
* improve response time in invalid rename attempts

* account for simplifiedResult and revert unrelated change
2021-10-01 15:07:54 -07:00
Wesley Wigham a02a7ab8e9
Follow and respect export maps when generating module specifiers (#46159)
* Follow and respect export maps when generating module specifiers

* Type baseline updates from master merge
2021-10-01 13:54:07 -07:00
csigs 9ed49b6ba7
LEGO: Merge pull request 46161
LEGO: Merge pull request 46161
2021-10-01 10:13:58 -07:00
Orta Therox 1a000c8422
Fix main (#46160) 2021-10-01 09:50:00 -07:00
Wesley Wigham ccc19092ff
Modify synthetic default generation code for dual-mode module resolution (#46156) 2021-10-01 09:18:44 -07:00
Orta Therox 016d78b09e
Allow for class static vars to be called static (#44813)
* Allow for class static vars to be called static - re: #41127

* Add the baselines
2021-10-01 14:28:08 +01:00
Alex Munoz 95ef2a503d
feat: display the tsconfig generated when running tsc --init (#45930)
* feat: display the tsconfig generated when running tsc --init

* fix: fix lint issues

* refactor: minor changes
2021-10-01 14:08:06 +01:00
Joel Einbinder 46a12fdb8a
fix(sourcemap): accept a sourceMappingURL that ends with a newline (#45983)
* fix(sourcemap): accept a sourceMappingURL that ends with a newline

* Update src/compiler/sourcemap.ts

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2021-10-01 05:16:05 -07:00
TypeScript Bot cadd115a55 Update package-lock.json 2021-10-01 06:06:44 +00:00
Wesley Wigham 612c92d603
Track source and target relationship stack depth seperately, only increase on change in value (#41821)
* Track source and target relationship stack depth seperately, only increase on change in value

* Add baselines for test from #43485

* Bail on unwrapping conditional constraints on the source side when the source conditional is already known to be spooling out of control

* More usage of isDeeplyNestedType to block _specifically_ conditional recursion on only one side

* Negative cases of getNarrowedType that match the exact type should be filtered out, even when generic

* Add test and fix for #44404

* Swap to manually specifying left and right recursion

* Rename Left -> Source, Right -> Target

Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-09-30 16:58:40 -07:00
Andrew Branch 96f259ddcc
Minimal fix for auto-importing node_modules in node12/nodenext (#46148) 2021-09-30 13:42:06 -07:00
Oleksandr T d613748932
fix(45919): allow using JSDoc types for arrow function with type predicate (#45952) 2021-09-30 10:50:25 -07:00
Oleksandr T e0f436c628
feat(36080): forbid to use JSDoc visibility modifiers in private fields (#46056) 2021-09-30 09:48:56 -07:00
813 changed files with 23164 additions and 3291 deletions

153
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "typescript",
"version": "4.5.0",
"version": "4.6.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -325,18 +325,18 @@
}
},
"@octokit/openapi-types": {
"version": "10.6.1",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.6.1.tgz",
"integrity": "sha512-53YKy8w8+sHQhUONhTiYt6MqNqPolejYr6rK/3VOevpORAIYGQEX2pmXnnhgdSsjHy176e5ZBgVt0ppOGziS7g==",
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz",
"integrity": "sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA==",
"dev": true
},
"@octokit/plugin-paginate-rest": {
"version": "2.16.5",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.5.tgz",
"integrity": "sha512-2PfRGymdBypqRes4Xelu0BAZZRCV/Qg0xgo8UB10UKoghCM+zg640+T5WkRsRD0edwfLBPP3VsJgDyDTG4EIYg==",
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.17.0.tgz",
"integrity": "sha512-tzMbrbnam2Mt4AhuyCHvpRkS0oZ5MvwwcQPYGtMv4tUa5kkzG58SVB0fcsLulOZQeRnOgdkZWkRUiyBlh0Bkyw==",
"dev": true,
"requires": {
"@octokit/types": "^6.31.0"
"@octokit/types": "^6.34.0"
}
},
"@octokit/plugin-request-log": {
@ -346,19 +346,19 @@
"dev": true
},
"@octokit/plugin-rest-endpoint-methods": {
"version": "5.11.3",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.11.3.tgz",
"integrity": "sha512-E19gqHqfP3uJa2/hx6Abhx2NrVP5tsNbst2/AeqGxlGM+eL4N8fRbzhd+NEIsGAB4y3R7e9kVE0y8OOghlXUXw==",
"version": "5.13.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz",
"integrity": "sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA==",
"dev": true,
"requires": {
"@octokit/types": "^6.31.1",
"@octokit/types": "^6.34.0",
"deprecation": "^2.3.1"
}
},
"@octokit/request": {
"version": "5.6.1",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.1.tgz",
"integrity": "sha512-Ls2cfs1OfXaOKzkcxnqw5MR6drMA/zWX/LIS/p8Yjdz7QKTPQLMsB3R+OvoxE6XnXeXEE2X7xe4G4l4X0gRiKQ==",
"version": "5.6.2",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.2.tgz",
"integrity": "sha512-je66CvSEVf0jCpRISxkUcCa0UkxmFs6eGDRSbfJtAVwbLH5ceqF+YEyC8lj8ystKyZTy8adWr0qmkY52EfOeLA==",
"dev": true,
"requires": {
"@octokit/endpoint": "^6.0.1",
@ -381,24 +381,24 @@
}
},
"@octokit/rest": {
"version": "18.11.3",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.11.3.tgz",
"integrity": "sha512-k4uCg4PVo6r9ncguSD4fXt6pYkM/FXs7759sYfpvIEhGNPJbFROooOJpkagKPAcSPoEGyEbIR+A9KYIv4jNe4A==",
"version": "18.12.0",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.12.0.tgz",
"integrity": "sha512-gDPiOHlyGavxr72y0guQEhLsemgVjwRePayJ+FcKc2SJqKUbxbkvf5kAZEWA/MKvsfYlQAMVzNJE3ezQcxMJ2Q==",
"dev": true,
"requires": {
"@octokit/core": "^3.5.1",
"@octokit/plugin-paginate-rest": "^2.16.4",
"@octokit/plugin-paginate-rest": "^2.16.8",
"@octokit/plugin-request-log": "^1.0.4",
"@octokit/plugin-rest-endpoint-methods": "5.11.3"
"@octokit/plugin-rest-endpoint-methods": "^5.12.0"
}
},
"@octokit/types": {
"version": "6.31.1",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.31.1.tgz",
"integrity": "sha512-xkF46eaYcpT8ieO78mZWhMq3bt37zIsP5BUkN+zWgX+mTYDB7jOtUP1MOxcSF8hhJhsjjlB1YDgQAhX0z0oqPw==",
"version": "6.34.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.34.0.tgz",
"integrity": "sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw==",
"dev": true,
"requires": {
"@octokit/openapi-types": "^10.6.1"
"@octokit/openapi-types": "^11.2.0"
}
},
"@types/browserify": {
@ -430,9 +430,9 @@
"dev": true
},
"@types/glob": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.4.tgz",
"integrity": "sha512-w+LsMxKyYQm347Otw+IfBXOv9UWVjpHpCDdbBMt8Kz/xbvCYNjP+0qPh91Km3iKfSRLBB0P7fAMf0KHrPu+MyA==",
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz",
"integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==",
"dev": true,
"requires": {
"@types/minimatch": "*",
@ -676,9 +676,9 @@
"dev": true
},
"@types/node": {
"version": "16.10.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz",
"integrity": "sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ==",
"version": "16.11.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz",
"integrity": "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==",
"dev": true
},
"@types/node-fetch": {
@ -1316,9 +1316,9 @@
"dev": true
},
"async": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.1.tgz",
"integrity": "sha512-XdD5lRO/87udXCMC9meWdYiR+Nq6ZjUfXidViUZGu2F1MO4T3XwZ1et0hb2++BgLfhyJwy44BGB/yx80ABx8hg==",
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.2.tgz",
"integrity": "sha512-H0E+qZaDEfx/FY4t7iLRv1W2fFI6+pyCeTw1uN20AQPiwqwM6ojPxHxdLv4z8hi2DtnW9BOckSspLucW7pIE5g==",
"dev": true
},
"async-done": {
@ -1658,9 +1658,9 @@
}
},
"is-core-module": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.7.0.tgz",
"integrity": "sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ==",
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz",
"integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==",
"dev": true,
"requires": {
"has": "^1.0.3"
@ -4694,6 +4694,12 @@
"is-unc-path": "^1.0.0"
}
},
"is-shared-array-buffer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz",
"integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==",
"dev": true
},
"is-string": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz",
@ -4723,9 +4729,9 @@
},
"dependencies": {
"es-abstract": {
"version": "1.18.7",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.7.tgz",
"integrity": "sha512-uFG1gyVX91tZIiDWNmPsL8XNpiCk/6tkB7MZphoSJflS4w+KgWyQ2gjCVDnsPxFAo9WjRXG3eqONNYdfbJjAtw==",
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz",
"integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
@ -4739,7 +4745,9 @@
"is-callable": "^1.2.4",
"is-negative-zero": "^2.0.1",
"is-regex": "^1.1.4",
"is-shared-array-buffer": "^1.0.1",
"is-string": "^1.0.7",
"is-weakref": "^1.0.1",
"object-inspect": "^1.11.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.2",
@ -4852,6 +4860,15 @@
"integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=",
"dev": true
},
"is-weakref": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz",
"integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==",
"dev": true,
"requires": {
"call-bind": "^1.0.0"
}
},
"is-windows": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
@ -5322,9 +5339,9 @@
"dev": true
},
"mocha": {
"version": "9.1.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.2.tgz",
"integrity": "sha512-ta3LtJ+63RIBP03VBjMGtSqbe6cWXRejF9SyM9Zyli1CKZJZ+vfCTj3oW24V7wAphMJdpOFLoMI3hjJ1LWbs0w==",
"version": "9.1.3",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.3.tgz",
"integrity": "sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw==",
"dev": true,
"requires": {
"@ungap/promise-all-settled": "1.1.2",
@ -5713,9 +5730,9 @@
}
},
"is-core-module": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.7.0.tgz",
"integrity": "sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ==",
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz",
"integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==",
"dev": true,
"requires": {
"has": "^1.0.3"
@ -5762,12 +5779,6 @@
"dev": true,
"optional": true
},
"nanocolors": {
"version": "0.2.12",
"resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.2.12.tgz",
"integrity": "sha512-SFNdALvzW+rVlzqexid6epYdt8H9Zol7xDoQarioEFcFN0JHo4CYNztAxmtfgGTVRCmFlEOqqhBpoFGKqSAMug==",
"dev": true
},
"nanoid": {
"version": "3.1.25",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz",
@ -6209,6 +6220,12 @@
"sha.js": "^2.4.8"
}
},
"picocolors": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz",
"integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==",
"dev": true
},
"picomatch": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
@ -6273,12 +6290,12 @@
"dev": true
},
"postcss": {
"version": "7.0.38",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.38.tgz",
"integrity": "sha512-wNrSHWjHDQJR/IZL5IKGxRtFgrYNaAA/UrkW2WqbtZO6uxSLMxMN+s2iqUMwnAWm3fMROlDYZB41dr0Mt7vBwQ==",
"version": "7.0.39",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.39.tgz",
"integrity": "sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==",
"dev": true,
"requires": {
"nanocolors": "^0.2.2",
"picocolors": "^0.2.1",
"source-map": "^0.6.1"
},
"dependencies": {
@ -6780,9 +6797,9 @@
}
},
"shell-quote": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz",
"integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==",
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz",
"integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==",
"dev": true
},
"side-channel": {
@ -6980,9 +6997,9 @@
}
},
"source-map-support": {
"version": "0.5.20",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz",
"integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==",
"version": "0.5.21",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
@ -8029,9 +8046,9 @@
},
"dependencies": {
"es-abstract": {
"version": "1.18.7",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.7.tgz",
"integrity": "sha512-uFG1gyVX91tZIiDWNmPsL8XNpiCk/6tkB7MZphoSJflS4w+KgWyQ2gjCVDnsPxFAo9WjRXG3eqONNYdfbJjAtw==",
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz",
"integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
@ -8045,7 +8062,9 @@
"is-callable": "^1.2.4",
"is-negative-zero": "^2.0.1",
"is-regex": "^1.1.4",
"is-shared-array-buffer": "^1.0.1",
"is-string": "^1.0.7",
"is-weakref": "^1.0.1",
"object-inspect": "^1.11.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.2",
@ -8404,9 +8423,9 @@
},
"dependencies": {
"camelcase": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
"integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==",
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz",
"integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==",
"dev": true
},
"decamelize": {

View file

@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "4.5.0",
"version": "4.6.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [

View file

@ -0,0 +1,21 @@
const { join, resolve, dirname } = require("path");
const { existsSync } = require("fs");
// search directories upward to avoid hard-wired paths based on the
// build tree (same as src/harness/findUpDir.ts)
function findUpFile(name) {
let dir = __dirname;
while (true) {
const fullPath = join(dir, name);
if (existsSync(fullPath)) return fullPath;
const up = resolve(dir, "..");
if (up === dir) return name; // it'll fail anyway
dir = up;
}
}
exports.findUpFile = findUpFile;
const findUpRoot = () =>
findUpRoot.cached || (findUpRoot.cached = dirname(findUpFile("Gulpfile.js")));
exports.findUpRoot = findUpRoot;

View file

@ -1,5 +1,7 @@
// @ts-check
const { exec, Debouncer } = require("./utils");
const { resolve } = require("path");
const { findUpRoot } = require("./findUpDir");
class ProjectQueue {
/**
@ -33,7 +35,13 @@ class ProjectQueue {
}
}
const projectBuilder = new ProjectQueue((projects, lkg, force) => exec(process.execPath, [lkg ? "./lib/tsc" : "./built/local/tsc", "-b", ...(force ? ["--force"] : []), ...projects], { hidePrompt: true }));
const execTsc = (lkg, ...args) =>
exec(process.execPath,
[resolve(findUpRoot(), lkg ? "./lib/tsc" : "./built/local/tsc"),
"-b", ...args],
{ hidePrompt: true });
const projectBuilder = new ProjectQueue((projects, lkg, force) => execTsc(lkg, ...(force ? ["--force"] : []), ...projects));
/**
* @param {string} project
@ -43,14 +51,14 @@ const projectBuilder = new ProjectQueue((projects, lkg, force) => exec(process.e
*/
exports.buildProject = (project, { lkg, force } = {}) => projectBuilder.enqueue(project, { lkg, force });
const projectCleaner = new ProjectQueue((projects, lkg) => exec(process.execPath, [lkg ? "./lib/tsc" : "./built/local/tsc", "-b", "--clean", ...projects], { hidePrompt: true }));
const projectCleaner = new ProjectQueue((projects, lkg) => execTsc(lkg, "--clean", ...projects));
/**
* @param {string} project
*/
exports.cleanProject = (project) => projectCleaner.enqueue(project);
const projectWatcher = new ProjectQueue((projects) => exec(process.execPath, ["./lib/tsc", "-b", "--watch", ...projects], { hidePrompt: true }));
const projectWatcher = new ProjectQueue((projects) => execTsc(true, "--watch", ...projects));
/**
* @param {string} project

View file

@ -9,6 +9,7 @@ const log = require("fancy-log");
const cmdLineOptions = require("./options");
const { CancellationToken } = require("prex");
const { exec } = require("./utils");
const { findUpFile } = require("./findUpDir");
const mochaJs = require.resolve("mocha/bin/_mocha");
exports.localBaseline = "tests/baselines/local/";
@ -73,11 +74,11 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
/** @type {string[]} */
let args = [];
// timeout normally isn"t necessary but Travis-CI has been timing out on compiler baselines occasionally
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
if (!runInParallel) {
args.push(mochaJs);
args.push("-R", "scripts/failed-tests");
args.push("-R", findUpFile("scripts/failed-tests.js"));
args.push("-O", '"reporter=' + reporter + (keepFailed ? ",keepFailed=true" : "") + '"');
if (tests) {
args.push("-g", `"${tests}"`);

View file

@ -9,12 +9,11 @@ const del = require("del");
const File = require("vinyl");
const ts = require("../../lib/typescript");
const chalk = require("chalk");
const which = require("which");
const { spawn } = require("child_process");
const { CancellationToken, CancelError, Deferred } = require("prex");
const { Readable, Duplex } = require("stream");
const isWindows = /^win/.test(process.platform);
/**
* Executes the provided command once with the supplied arguments.
* @param {string} cmd
@ -32,12 +31,8 @@ function exec(cmd, args, options = {}) {
const { ignoreExitCode, cancelToken = CancellationToken.none, waitForExit = true } = options;
cancelToken.throwIfCancellationRequested();
// TODO (weswig): Update child_process types to add windowsVerbatimArguments to the type definition
const subshellFlag = isWindows ? "/c" : "-c";
const command = isWindows ? [possiblyQuote(cmd), ...args] : [`${cmd} ${args.join(" ")}`];
if (!options.hidePrompt) log(`> ${chalk.green(cmd)} ${args.join(" ")}`);
const proc = spawn(isWindows ? "cmd" : "/bin/sh", [subshellFlag, ...command], { stdio: waitForExit ? "inherit" : "ignore", windowsVerbatimArguments: true });
const proc = spawn(which.sync(cmd), args, { stdio: waitForExit ? "inherit" : "ignore" });
const registration = cancelToken.register(() => {
log(`${chalk.red("killing")} '${chalk.green(cmd)} ${args.join(" ")}'...`);
proc.kill("SIGINT");
@ -68,13 +63,6 @@ function exec(cmd, args, options = {}) {
}
exports.exec = exec;
/**
* @param {string} cmd
*/
function possiblyQuote(cmd) {
return cmd.indexOf(" ") >= 0 ? `"${cmd}"` : cmd;
}
/**
* @param {ts.Diagnostic[]} diagnostics
* @param {{ cwd?: string, pretty?: boolean }} [options]
@ -440,4 +428,4 @@ class Debouncer {
}
}
}
exports.Debouncer = Debouncer;
exports.Debouncer = Debouncer;

View file

@ -33,9 +33,9 @@ async function main() {
const inputPR = (await gh.pulls.get({ pull_number: +process.env.SOURCE_ISSUE, owner: "microsoft", repo: "TypeScript" })).data;
let remoteName = "origin";
if (inputPR.base.repo.git_url !== `git:github.com/microsoft/TypeScript`) {
if (inputPR.base.repo.git_url !== `git:github.com/microsoft/TypeScript` && inputPR.base.repo.git_url !== `git://github.com/microsoft/TypeScript`) {
runSequence([
["git", ["remote", "add", "nonlocal", inputPR.base.repo.git_url]]
["git", ["remote", "add", "nonlocal", inputPR.base.repo.git_url.replace(/^git:(?:\/\/)?/, "https://")]]
]);
remoteName = "nonlocal";
}

View file

@ -2947,6 +2947,7 @@ namespace ts {
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.ClassStaticBlockDeclaration:
// this.foo assignment in a JavaScript class
// Bind this property to the containing class
const containingClass = thisContainer.parent;

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
namespace ts {
/* @internal */
export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean" };
export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean", defaultValueDescription: "false" };
const jsxOptionMap = new Map(getEntries({
"preserve": JsxEmit.Preserve,
@ -29,6 +29,7 @@ namespace ts {
["es2019", "lib.es2019.d.ts"],
["es2020", "lib.es2020.d.ts"],
["es2021", "lib.es2021.d.ts"],
["es2022", "lib.es2022.d.ts"],
["esnext", "lib.esnext.d.ts"],
// Host only
["dom", "lib.dom.d.ts"],
@ -72,12 +73,16 @@ namespace ts {
["es2021.string", "lib.es2021.string.d.ts"],
["es2021.weakref", "lib.es2021.weakref.d.ts"],
["es2021.intl", "lib.es2021.intl.d.ts"],
["esnext.array", "lib.es2019.array.d.ts"],
["es2022.array", "lib.es2022.array.d.ts"],
["es2022.error", "lib.es2022.error.d.ts"],
["es2022.object", "lib.es2022.object.d.ts"],
["es2022.string", "lib.es2022.string.d.ts"],
["esnext.array", "lib.es2022.array.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
["esnext.intl", "lib.esnext.intl.d.ts"],
["esnext.bigint", "lib.es2020.bigint.d.ts"],
["esnext.string", "lib.es2021.string.d.ts"],
["esnext.string", "lib.es2022.string.d.ts"],
["esnext.promise", "lib.es2021.promise.d.ts"],
["esnext.weakref", "lib.es2021.weakref.d.ts"]
];
@ -140,6 +145,7 @@ namespace ts {
type: "boolean",
category: Diagnostics.Watch_and_Build_Modes,
description: Diagnostics.Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_support_recursive_watching_natively,
defaultValueDescription: "false",
},
{
name: "excludeDirectories",
@ -176,11 +182,13 @@ namespace ts {
showInSimplifiedHelpView: true,
category: Diagnostics.Command_line_Options,
description: Diagnostics.Print_this_message,
defaultValueDescription: "false",
},
{
name: "help",
shortName: "?",
type: "boolean"
type: "boolean",
defaultValueDescription: "false",
},
{
name: "watch",
@ -190,6 +198,7 @@ namespace ts {
isCommandLineOnly: true,
category: Diagnostics.Command_line_Options,
description: Diagnostics.Watch_input_files,
defaultValueDescription: "false",
},
{
name: "preserveWatchOutput",
@ -197,7 +206,7 @@ namespace ts {
showInSimplifiedHelpView: false,
category: Diagnostics.Output_Formatting,
description: Diagnostics.Disable_wiping_the_console_in_watch_mode,
defaultValueDescription: "n/a"
defaultValueDescription: "false",
},
{
name: "listFiles",
@ -210,7 +219,8 @@ namespace ts {
name: "explainFiles",
type: "boolean",
category: Diagnostics.Compiler_Diagnostics,
description: Diagnostics.Print_files_read_during_the_compilation_including_why_it_was_included
description: Diagnostics.Print_files_read_during_the_compilation_including_why_it_was_included,
defaultValueDescription: "false",
},
{
name: "listEmittedFiles",
@ -281,7 +291,8 @@ namespace ts {
affectsSemanticDiagnostics: true,
affectsEmit: true,
category: Diagnostics.Watch_and_Build_Modes,
description: Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it
description: Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it,
defaultValueDescription: "false",
},
{
name: "locale",
@ -308,6 +319,7 @@ namespace ts {
es2019: ScriptTarget.ES2019,
es2020: ScriptTarget.ES2020,
es2021: ScriptTarget.ES2021,
es2022: ScriptTarget.ES2022,
esnext: ScriptTarget.ESNext,
})),
affectsSourceFile: true,
@ -328,6 +340,7 @@ namespace ts {
showInSimplifiedHelpView: true,
category: Diagnostics.Command_line_Options,
description: Diagnostics.Show_all_compiler_options,
defaultValueDescription: "false",
},
{
name: "version",
@ -336,6 +349,7 @@ namespace ts {
showInSimplifiedHelpView: true,
category: Diagnostics.Command_line_Options,
description: Diagnostics.Print_the_compiler_s_version,
defaultValueDescription: "false",
},
{
name: "init",
@ -343,6 +357,7 @@ namespace ts {
showInSimplifiedHelpView: true,
category: Diagnostics.Command_line_Options,
description: Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file,
defaultValueDescription: "false",
},
{
name: "project",
@ -360,7 +375,8 @@ namespace ts {
shortName: "b",
showInSimplifiedHelpView: true,
category: Diagnostics.Command_line_Options,
description: Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date
description: Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date,
defaultValueDescription: "false",
},
{
name: "showConfig",
@ -368,7 +384,8 @@ namespace ts {
showInSimplifiedHelpView: true,
category: Diagnostics.Command_line_Options,
isCommandLineOnly: true,
description: Diagnostics.Print_the_final_configuration_instead_of_building
description: Diagnostics.Print_the_final_configuration_instead_of_building,
defaultValueDescription: "false",
},
{
name: "listFilesOnly",
@ -377,7 +394,8 @@ namespace ts {
affectsSemanticDiagnostics: true,
affectsEmit: true,
isCommandLineOnly: true,
description: Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing
description: Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
defaultValueDescription: "false",
},
// Basic
@ -499,7 +517,6 @@ namespace ts {
category: Diagnostics.Emit,
description: Diagnostics.Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output,
transpileOptionValue: undefined,
defaultValueDescription: "n/a"
},
{
name: "outDir",
@ -510,7 +527,6 @@ namespace ts {
showInSimplifiedHelpView: true,
category: Diagnostics.Emit,
description: Diagnostics.Specify_an_output_folder_for_all_emitted_files,
defaultValueDescription: "n/a"
},
{
name: "rootDir",
@ -668,6 +684,7 @@ namespace ts {
strictFlag: true,
category: Diagnostics.Type_Checking,
description: Diagnostics.Type_catch_clause_variables_as_unknown_instead_of_any,
defaultValueDescription: "false",
},
{
name: "alwaysStrict",
@ -701,7 +718,8 @@ namespace ts {
type: "boolean",
affectsSemanticDiagnostics: true,
category: Diagnostics.Type_Checking,
description: Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined
description: Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
defaultValueDescription: "false",
},
{
name: "noImplicitReturns",
@ -717,21 +735,24 @@ namespace ts {
affectsBindDiagnostics: true,
affectsSemanticDiagnostics: true,
category: Diagnostics.Type_Checking,
description: Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements
description: Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
defaultValueDescription: "false",
},
{
name: "noUncheckedIndexedAccess",
type: "boolean",
affectsSemanticDiagnostics: true,
category: Diagnostics.Type_Checking,
description: Diagnostics.Include_undefined_in_index_signature_results
description: Diagnostics.Include_undefined_in_index_signature_results,
defaultValueDescription: "false",
},
{
name: "noImplicitOverride",
type: "boolean",
affectsSemanticDiagnostics: true,
category: Diagnostics.Type_Checking,
description: Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier
description: Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
defaultValueDescription: "false",
},
{
name: "noPropertyAccessFromIndexSignature",
@ -748,6 +769,8 @@ namespace ts {
type: new Map(getEntries({
node: ModuleResolutionKind.NodeJs,
classic: ModuleResolutionKind.Classic,
node12: ModuleResolutionKind.Node12,
nodenext: ModuleResolutionKind.NodeNext,
})),
affectsModuleResolution: true,
paramType: Diagnostics.STRATEGY,
@ -839,7 +862,7 @@ namespace ts {
type: "boolean",
category: Diagnostics.Interop_Constraints,
description: Diagnostics.Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node,
defaultValueDescription: "n/a"
defaultValueDescription: "false",
},
{
name: "allowUmdGlobalAccess",
@ -890,7 +913,8 @@ namespace ts {
type: "boolean",
affectsSemanticDiagnostics: true,
category: Diagnostics.Language_and_Environment,
description: Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators
description: Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
defaultValueDescription: "false",
},
{
name: "emitDecoratorMetadata",
@ -898,7 +922,8 @@ namespace ts {
affectsSemanticDiagnostics: true,
affectsEmit: true,
category: Diagnostics.Language_and_Environment,
description: Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files
description: Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
defaultValueDescription: "false",
},
// Advanced
@ -943,7 +968,6 @@ namespace ts {
category: Diagnostics.Backwards_Compatibility,
paramType: Diagnostics.FILE,
transpileOptionValue: undefined,
defaultValueDescription: "n/a",
description: Diagnostics.Deprecated_setting_Use_outFile_instead,
},
{
@ -1024,6 +1048,7 @@ namespace ts {
affectsEmit: true,
category: Diagnostics.Emit,
description: Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
defaultValueDescription: "false",
},
{
name: "disableSizeLimit",
@ -1038,21 +1063,24 @@ namespace ts {
type: "boolean",
isTSConfigOnly: true,
category: Diagnostics.Projects,
description: Diagnostics.Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects
description: Diagnostics.Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects,
defaultValueDescription: "false",
},
{
name: "disableSolutionSearching",
type: "boolean",
isTSConfigOnly: true,
category: Diagnostics.Projects,
description: Diagnostics.Opt_a_project_out_of_multi_project_reference_checking_when_editing
description: Diagnostics.Opt_a_project_out_of_multi_project_reference_checking_when_editing,
defaultValueDescription: "false",
},
{
name: "disableReferencedProjectLoad",
type: "boolean",
isTSConfigOnly: true,
category: Diagnostics.Projects,
description: Diagnostics.Reduce_the_number_of_projects_loaded_automatically_by_TypeScript
description: Diagnostics.Reduce_the_number_of_projects_loaded_automatically_by_TypeScript,
defaultValueDescription: "false",
},
{
name: "noImplicitUseStrict",
@ -1085,7 +1113,7 @@ namespace ts {
affectsEmit: true,
category: Diagnostics.Emit,
description: Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
defaultValueDescription: "n/a"
defaultValueDescription: "false",
},
{
name: "declarationDir",
@ -1096,7 +1124,6 @@ namespace ts {
category: Diagnostics.Emit,
transpileOptionValue: undefined,
description: Diagnostics.Specify_the_output_directory_for_generated_declaration_files,
defaultValueDescription: "n/a"
},
{
name: "skipLibCheck",
@ -1178,6 +1205,7 @@ namespace ts {
affectsEmit: true,
category: Diagnostics.Emit,
description: Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
defaultValueDescription: "false",
},
{
@ -1240,27 +1268,31 @@ namespace ts {
shortName: "v",
category: Diagnostics.Command_line_Options,
description: Diagnostics.Enable_verbose_logging,
type: "boolean"
type: "boolean",
defaultValueDescription: "false",
},
{
name: "dry",
shortName: "d",
category: Diagnostics.Command_line_Options,
description: Diagnostics.Show_what_would_be_built_or_deleted_if_specified_with_clean,
type: "boolean"
type: "boolean",
defaultValueDescription: "false",
},
{
name: "force",
shortName: "f",
category: Diagnostics.Command_line_Options,
description: Diagnostics.Build_all_projects_including_those_that_appear_to_be_up_to_date,
type: "boolean"
type: "boolean",
defaultValueDescription: "false",
},
{
name: "clean",
category: Diagnostics.Command_line_Options,
description: Diagnostics.Delete_the_outputs_of_all_projects,
type: "boolean"
type: "boolean",
defaultValueDescription: "false",
}
];
@ -1278,10 +1310,12 @@ namespace ts {
*/
name: "enableAutoDiscovery",
type: "boolean",
defaultValueDescription: "false",
},
{
name: "enable",
type: "boolean",
defaultValueDescription: "false",
},
{
name: "include",
@ -1302,6 +1336,7 @@ namespace ts {
{
name: "disableFilenameBasedTypeAcquisition",
type: "boolean",
defaultValueDescription: "false",
},
];
@ -2283,7 +2318,7 @@ namespace ts {
return getCustomTypeMapOfCommandLineOption(optionDefinition.element);
}
else {
return (optionDefinition as CommandLineOptionOfCustomType).type;
return optionDefinition.type;
}
}
@ -2351,6 +2386,47 @@ namespace ts {
return result;
}
/**
* Generate a list of the compiler options whose value is not the default.
* @param options compilerOptions to be evaluated.
/** @internal */
export function getCompilerOptionsDiffValue(options: CompilerOptions, newLine: string): string {
const compilerOptionsMap = getSerializedCompilerOption(options);
return getOverwrittenDefaultOptions();
function makePadding(paddingLength: number): string {
return Array(paddingLength + 1).join(" ");
}
function getOverwrittenDefaultOptions() {
const result: string[] = [];
const tab = makePadding(2);
commandOptionsWithoutBuild.forEach(cmd => {
if (!compilerOptionsMap.has(cmd.name)) {
return;
}
const newValue = compilerOptionsMap.get(cmd.name);
const defaultValue = getDefaultValueForOption(cmd);
if (newValue !== defaultValue) {
result.push(`${tab}${cmd.name}: ${newValue}`);
}
else if (hasProperty(defaultInitCompilerOptions, cmd.name)) {
result.push(`${tab}${cmd.name}: ${defaultValue}`);
}
});
return result.join(newLine) + newLine;
}
}
/**
* Get the compiler options to be written into the tsconfig.json.
* @param options commandlineOptions to be included in the compileOptions.
*/
function getSerializedCompilerOption(options: CompilerOptions): ESMap<string, CompilerOptionsValue> {
const compilerOptions = extend(options, defaultInitCompilerOptions);
return serializeCompilerOptions(compilerOptions);
}
/**
* Generate tsconfig configuration when running command line "--init"
* @param options commandlineOptions to be generated into tsconfig.json
@ -2358,29 +2434,9 @@ namespace ts {
*/
/* @internal */
export function generateTSConfig(options: CompilerOptions, fileNames: readonly string[], newLine: string): string {
const compilerOptions = extend(options, defaultInitCompilerOptions);
const compilerOptionsMap = serializeCompilerOptions(compilerOptions);
const compilerOptionsMap = getSerializedCompilerOption(options);
return writeConfigurations();
function getDefaultValueForOption(option: CommandLineOption) {
switch (option.type) {
case "number":
return 1;
case "boolean":
return true;
case "string":
return option.isFilePath ? "./" : "";
case "list":
return [];
case "object":
return {};
default:
const iterResult = option.type.keys().next();
if (!iterResult.done) return iterResult.value;
return Debug.fail("Expected 'option.type' to have entries.");
}
}
function makePadding(paddingLength: number): string {
return Array(paddingLength + 1).join(" ");
}
@ -3542,4 +3598,24 @@ namespace ts {
})!; // TODO: GH#18217
}
}
function getDefaultValueForOption(option: CommandLineOption) {
switch (option.type) {
case "number":
return 1;
case "boolean":
return true;
case "string":
return option.isFilePath ? "./" : "";
case "list":
return [];
case "object":
return {};
default:
const iterResult = option.type.keys().next();
if (!iterResult.done) return iterResult.value;
return Debug.fail("Expected 'option.type' to have entries.");
}
}
}

View file

@ -1,25 +1,5 @@
/* @internal */
namespace ts {
type GetIteratorCallback = <I extends readonly any[] | ReadonlySet<any> | ReadonlyESMap<any, any> | undefined>(iterable: I) => Iterator<
I extends ReadonlyESMap<infer K, infer V> ? [K, V] :
I extends ReadonlySet<infer T> ? T :
I extends readonly (infer T)[] ? T :
I extends undefined ? undefined :
never>;
function getCollectionImplementation<
K1 extends MatchingKeys<typeof NativeCollections, () => any>,
K2 extends MatchingKeys<typeof ShimCollections, (getIterator?: GetIteratorCallback) => ReturnType<(typeof NativeCollections)[K1]>>
>(name: string, nativeFactory: K1, shimFactory: K2): NonNullable<ReturnType<(typeof NativeCollections)[K1]>> {
// NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it.
const constructor = NativeCollections[nativeFactory]() ?? ShimCollections?.[shimFactory](getIterator);
if (constructor) return constructor as NonNullable<ReturnType<(typeof NativeCollections)[K1]>>;
throw new Error(`TypeScript requires an environment that provides a compatible native ${name} implementation.`);
}
export const Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim");
export const Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim");
export function getIterator<I extends readonly any[] | ReadonlySet<any> | ReadonlyESMap<any, any> | undefined>(iterable: I): Iterator<
I extends ReadonlyESMap<infer K, infer V> ? [K, V] :
I extends ReadonlySet<infer T> ? T :
@ -43,34 +23,6 @@ namespace ts {
export const emptyMap: ReadonlyESMap<never, never> = new Map<never, never>();
export const emptySet: ReadonlySet<never> = new Set<never>();
/**
* Create a new map.
* @deprecated Use `new Map()` instead.
*/
export function createMap<K, V>(): ESMap<K, V>;
export function createMap<T>(): ESMap<string, T>;
export function createMap<K, V>(): ESMap<K, V> {
return new Map<K, V>();
}
/**
* Create a new map from a template object is provided, the map will copy entries from it.
* @deprecated Use `new Map(getEntries(template))` instead.
*/
export function createMapFromTemplate<T>(template: MapLike<T>): ESMap<string, T> {
const map: ESMap<string, T> = new Map<string, T>();
// Copies keys/values from template. Note that for..in will not throw if
// template is undefined, and instead will just exit the loop.
for (const key in template) {
if (hasOwnProperty.call(template, key)) {
map.set(key, template[key]);
}
}
return map;
}
export function length(array: readonly any[] | undefined): number {
return array ? array.length : 0;
}

View file

@ -1,7 +1,7 @@
namespace ts {
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configurePrerelease` too.
export const versionMajorMinor = "4.5";
export const versionMajorMinor = "4.6";
// The following is baselined as a literal template type without intervention
/** The version of the TypeScript compiler release */
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
@ -113,7 +113,7 @@ namespace ts {
}
/* @internal */
export namespace NativeCollections {
namespace NativeCollections {
declare const Map: MapConstructor | undefined;
declare const Set: SetConstructor | undefined;
@ -135,4 +135,28 @@ namespace ts {
return typeof Set !== "undefined" && "entries" in Set.prototype && new Set([0]).size === 1 ? Set : undefined;
}
}
}
/* @internal */
export const Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim");
/* @internal */
export const Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim");
/* @internal */
type GetIteratorCallback = <I extends readonly any[] | ReadonlySet<any> | ReadonlyESMap<any, any> | undefined>(iterable: I) => Iterator<
I extends ReadonlyESMap<infer K, infer V> ? [K, V] :
I extends ReadonlySet<infer T> ? T :
I extends readonly (infer T)[] ? T :
I extends undefined ? undefined :
never>;
/* @internal */
function getCollectionImplementation<
K1 extends MatchingKeys<typeof NativeCollections, () => any>,
K2 extends MatchingKeys<typeof ShimCollections, (getIterator?: GetIteratorCallback) => ReturnType<(typeof NativeCollections)[K1]>>
>(name: string, nativeFactory: K1, shimFactory: K2): NonNullable<ReturnType<(typeof NativeCollections)[K1]>> {
// NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it.
const constructor = NativeCollections[nativeFactory]() ?? ShimCollections?.[shimFactory](getIterator);
if (constructor) return constructor as NonNullable<ReturnType<(typeof NativeCollections)[K1]>>;
throw new Error(`TypeScript requires an environment that provides a compatible native ${name} implementation.`);
}
}

View file

@ -171,12 +171,6 @@ namespace ts {
return value;
}
/**
* @deprecated Use `checkDefined` to check whether a value is defined inline. Use `assertIsDefined` to check whether
* a value is defined at the statement level.
*/
export const assertDefined = checkDefined;
export function assertEachIsDefined<T extends Node>(value: NodeArray<T>, message?: string, stackCrawlMark?: AnyFunction): asserts value is NodeArray<T>;
export function assertEachIsDefined<T>(value: readonly T[], message?: string, stackCrawlMark?: AnyFunction): asserts value is readonly NonNullable<T>[];
export function assertEachIsDefined<T>(value: readonly T[], message?: string, stackCrawlMark?: AnyFunction) {
@ -190,12 +184,6 @@ namespace ts {
return value;
}
/**
* @deprecated Use `checkEachDefined` to check whether the elements of an array are defined inline. Use `assertEachIsDefined` to check whether
* the elements of an array are defined at the statement level.
*/
export const assertEachDefined = checkEachDefined;
export function assertNever(member: never, message = "Illegal value:", stackCrawlMark?: AnyFunction): never {
const detail = typeof member === "object" && hasProperty(member, "kind") && hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind((member as Node).kind) : JSON.stringify(member);
return fail(`${message} ${detail}`, stackCrawlMark || assertNever);
@ -351,6 +339,10 @@ namespace ts {
return formatEnum(kind, (ts as any).SyntaxKind, /*isFlags*/ false);
}
export function formatSnippetKind(kind: SnippetKind | undefined): string {
return formatEnum(kind, (ts as any).SnippetKind, /*isFlags*/ false);
}
export function formatNodeFlags(flags: NodeFlags | undefined): string {
return formatEnum(flags, (ts as any).NodeFlags, /*isFlags*/ true);
}

View file

@ -924,7 +924,7 @@
"category": "Error",
"code": 1323
},
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.": {
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.": {
"category": "Error",
"code": 1324
},
@ -1164,6 +1164,10 @@
"category": "Error",
"code": 1389
},
"'{0}' is not allowed as a parameter name.": {
"category": "Error",
"code": 1390
},
"An import alias cannot use 'import type'": {
"category": "Error",
"code": 1392
@ -3329,7 +3333,7 @@
"category": "Error",
"code": 2820
},
"Import assertions are only supported when the '--module' option is set to 'esnext'.": {
"Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.": {
"category": "Error",
"code": 2821
},
@ -3337,6 +3341,22 @@
"category": "Error",
"code": 2822
},
"Cannot find namespace '{0}'. Did you mean '{1}'?": {
"category": "Error",
"code": 2833
},
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.": {
"category": "Error",
"code": 2834
},
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?": {
"category": "Error",
"code": 2835
},
"Import assertions are not allowed on statements that transpile to commonjs 'require' calls.": {
"category": "Error",
"code": 2836
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
@ -3762,6 +3782,11 @@
"category": "Error",
"code": 4123
},
"Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.": {
"category": "Error",
"code": 4124
},
"The current host does not support the '{0}' option.": {
"category": "Error",
"code": 5001
@ -5989,7 +6014,14 @@
"category": "Error",
"code": 7060
},
"A mapped type may not declare properties or methods.": {
"category": "Error",
"code": 7061
},
"JSON imports are experimental in ES module mode imports.": {
"category": "Error",
"code": 7062
},
"You cannot rename this element.": {
"category": "Error",
@ -6212,7 +6244,7 @@
"code": 18003
},
"File is a CommonJS module; it may be converted to an ES6 module.": {
"File is a CommonJS module; it may be converted to an ES module.": {
"category": "Suggestion",
"code": 80001
},
@ -6405,6 +6437,11 @@
"category": "Message",
"code": 90053
},
"Includes imports of types referenced by '{0}'": {
"category": "Message",
"code": 90054
},
"Convert function to an ES2015 class": {
"category": "Message",
"code": 95001
@ -6461,7 +6498,7 @@
"category": "Message",
"code": 95016
},
"Convert to ES6 module": {
"Convert to ES module": {
"category": "Message",
"code": 95017
},

View file

@ -1283,7 +1283,13 @@ namespace ts {
currentParenthesizerRule = undefined;
}
function pipelineEmitWithHintWorker(hint: EmitHint, node: Node): void {
function pipelineEmitWithHintWorker(hint: EmitHint, node: Node, allowSnippets = true): void {
if (allowSnippets) {
const snippet = getSnippetElement(node);
if (snippet) {
return emitSnippetNode(hint, node, snippet);
}
}
if (hint === EmitHint.SourceFile) return emitSourceFile(cast(node, isSourceFile));
if (hint === EmitHint.IdentifierName) return emitIdentifier(cast(node, isIdentifier));
if (hint === EmitHint.JsxAttributeValue) return emitLiteral(cast(node, isStringLiteral), /*jsxAttributeEscape*/ true);
@ -1598,6 +1604,7 @@ namespace ts {
return emitJSDocSignature(node as JSDocSignature);
case SyntaxKind.JSDocTag:
case SyntaxKind.JSDocClassTag:
case SyntaxKind.JSDocOverrideTag:
return emitJSDocSimpleTag(node as JSDocTag);
case SyntaxKind.JSDocAugmentsTag:
case SyntaxKind.JSDocImplementsTag:
@ -1610,7 +1617,6 @@ namespace ts {
case SyntaxKind.JSDocPrivateTag:
case SyntaxKind.JSDocProtectedTag:
case SyntaxKind.JSDocReadonlyTag:
case SyntaxKind.JSDocOverrideTag:
return;
case SyntaxKind.JSDocCallbackTag:
return emitJSDocCallbackTag(node as JSDocCallbackTag);
@ -1924,6 +1930,32 @@ namespace ts {
}
}
//
// Snippet Elements
//
function emitSnippetNode(hint: EmitHint, node: Node, snippet: SnippetElement) {
switch (snippet.kind) {
case SnippetKind.Placeholder:
emitPlaceholder(hint, node, snippet);
break;
case SnippetKind.TabStop:
emitTabStop(snippet);
break;
}
}
function emitPlaceholder(hint: EmitHint, node: Node, snippet: Placeholder) {
nonEscapingWrite(`\$\{${snippet.order}:`); // `${2:`
pipelineEmitWithHintWorker(hint, node, /*allowSnippets*/ false); // `...`
nonEscapingWrite(`\}`); // `}`
// `${2:...}`
}
function emitTabStop(snippet: TabStop) {
nonEscapingWrite(`\$${snippet.order}`);
}
//
// Identifiers
//
@ -4457,6 +4489,16 @@ namespace ts {
writer.writeProperty(s);
}
function nonEscapingWrite(s: string) {
// This should be defined in a snippet-escaping text writer.
if (writer.nonEscapingWrite) {
writer.nonEscapingWrite(s);
}
else {
writer.write(s);
}
}
function writeLine(count = 1) {
for (let i = 0; i < count; i++) {
writer.writeLine(i > 0);

View file

@ -256,6 +256,24 @@ namespace ts {
}
}
/**
* Gets the SnippetElement of a node.
*/
/* @internal */
export function getSnippetElement(node: Node): SnippetElement | undefined {
return node.emitNode?.snippetElement;
}
/**
* Sets the SnippetElement of a node.
*/
/* @internal */
export function setSnippetElement<T extends Node>(node: T, snippet: SnippetElement): T {
const emitNode = getOrCreateEmitNode(node);
emitNode.snippetElement = snippet;
return node;
}
/* @internal */
export function ignoreSourceNewlines<T extends Node>(node: T): T {
getOrCreateEmitNode(node).flags |= EmitFlags.IgnoreSourceNewlines;

View file

@ -2112,25 +2112,27 @@ namespace ts {
}
// @api
function createMappedTypeNode(readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined): MappedTypeNode {
function createMappedTypeNode(readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined, members: readonly TypeElement[] | undefined): MappedTypeNode {
const node = createBaseNode<MappedTypeNode>(SyntaxKind.MappedType);
node.readonlyToken = readonlyToken;
node.typeParameter = typeParameter;
node.nameType = nameType;
node.questionToken = questionToken;
node.type = type;
node.members = members && createNodeArray(members);
node.transformFlags = TransformFlags.ContainsTypeScript;
return node;
}
// @api
function updateMappedTypeNode(node: MappedTypeNode, readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined): MappedTypeNode {
function updateMappedTypeNode(node: MappedTypeNode, readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined, members: NodeArray<TypeElement> | undefined): MappedTypeNode {
return node.readonlyToken !== readonlyToken
|| node.typeParameter !== typeParameter
|| node.nameType !== nameType
|| node.questionToken !== questionToken
|| node.type !== type
? update(createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type), node)
|| node.members !== members
? update(createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), node)
: node;
}
@ -6385,7 +6387,7 @@ namespace ts {
sourceMapText = mapTextOrStripInternal as string;
}
const node = oldFileOfCurrentEmit ?
parseOldFileOfCurrentEmit(Debug.assertDefined(bundleFileInfo)) :
parseOldFileOfCurrentEmit(Debug.checkDefined(bundleFileInfo)) :
parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
node.fileName = fileName;
node.sourceMapPath = sourceMapPath;
@ -6585,13 +6587,13 @@ namespace ts {
};
node.javascriptPath = declarationTextOrJavascriptPath;
node.javascriptMapPath = javascriptMapPath;
node.declarationPath = Debug.assertDefined(javascriptMapTextOrDeclarationPath);
node.declarationPath = Debug.checkDefined(javascriptMapTextOrDeclarationPath);
node.declarationMapPath = declarationMapPath;
node.buildInfoPath = declarationMapTextOrBuildInfoPath;
Object.defineProperties(node, {
javascriptText: { get() { return definedTextGetter(declarationTextOrJavascriptPath); } },
javascriptMapText: { get() { return textGetter(javascriptMapPath); } }, // TODO:: if there is inline sourceMap in jsFile, use that
declarationText: { get() { return definedTextGetter(Debug.assertDefined(javascriptMapTextOrDeclarationPath)); } },
declarationText: { get() { return definedTextGetter(Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
declarationMapText: { get() { return textGetter(declarationMapPath); } }, // TODO:: if there is inline sourceMap in dtsFile, use that
buildInfo: { get() { return getAndCacheBuildInfo(() => textGetter(declarationMapTextOrBuildInfoPath)); } }
});

View file

@ -1708,7 +1708,8 @@ namespace ts {
return idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) };
}
function allKeysStartWithDot(obj: MapLike<unknown>) {
/* @internal */
export function allKeysStartWithDot(obj: MapLike<unknown>) {
return every(getOwnKeys(obj), k => startsWith(k, "."));
}
@ -1723,11 +1724,15 @@ namespace ts {
if (!scope || !scope.packageJsonContent.exports) {
return undefined;
}
const parts = getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry
if (scope.packageJsonContent.name !== parts[1]) {
if (typeof scope.packageJsonContent.name !== "string") {
return undefined;
}
const trailingParts = parts.slice(2);
const parts = getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry
const nameParts = getPathComponents(scope.packageJsonContent.name);
if (!every(nameParts, (p, i) => parts[i] === p)) {
return undefined;
}
const trailingParts = parts.slice(nameParts.length);
return loadModuleFromExports(scope, extensions, !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`, state, cache, redirectedReference);
}
@ -1922,14 +1927,15 @@ namespace ts {
}
return toSearchResult(/*value*/ undefined);
}
}
function isApplicableVersionedTypesKey(conditions: string[], key: string) {
if (conditions.indexOf("types") === -1) return false; // only apply versioned types conditions if the types condition is applied
if (!startsWith(key, "types@")) return false;
const range = VersionRange.tryParse(key.substring("types@".length));
if (!range) return false;
return range.test(version);
}
/* @internal */
export function isApplicableVersionedTypesKey(conditions: string[], key: string) {
if (conditions.indexOf("types") === -1) return false; // only apply versioned types conditions if the types condition is applied
if (!startsWith(key, "types@")) return false;
const range = VersionRange.tryParse(key.substring("types@".length));
if (!range) return false;
return range.test(version);
}
function loadModuleFromNearestNodeModulesDirectory(extensions: Extensions, moduleName: string, directory: string, state: ModuleResolutionState, cache: ModuleResolutionCache | undefined, redirectedReference: ResolvedProjectReference | undefined): SearchResult<Resolved> {

View file

@ -555,6 +555,77 @@ namespace ts.moduleSpecifiers {
}
}
const enum MatchingMode {
Exact,
Directory,
Pattern
}
function tryGetModuleNameFromExports(options: CompilerOptions, targetFilePath: string, packageDirectory: string, packageName: string, exports: unknown, conditions: string[], mode = MatchingMode.Exact): { moduleFileToTry: string } | undefined {
if (typeof exports === "string") {
const pathOrPattern = getNormalizedAbsolutePath(combinePaths(packageDirectory, exports), /*currentDirectory*/ undefined);
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : undefined;
switch (mode) {
case MatchingMode.Exact:
if (comparePaths(targetFilePath, pathOrPattern) === Comparison.EqualTo || (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === Comparison.EqualTo)) {
return { moduleFileToTry: packageName };
}
break;
case MatchingMode.Directory:
if (containsPath(pathOrPattern, targetFilePath)) {
const fragment = getRelativePathFromDirectory(pathOrPattern, targetFilePath, /*ignoreCase*/ false);
return { moduleFileToTry: getNormalizedAbsolutePath(combinePaths(combinePaths(packageName, exports), fragment), /*currentDirectory*/ undefined) };
}
break;
case MatchingMode.Pattern:
const starPos = pathOrPattern.indexOf("*");
const leadingSlice = pathOrPattern.slice(0, starPos);
const trailingSlice = pathOrPattern.slice(starPos + 1);
if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) {
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
return { moduleFileToTry: packageName.replace("*", starReplacement) };
}
if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
return { moduleFileToTry: packageName.replace("*", starReplacement) };
}
break;
}
}
else if (Array.isArray(exports)) {
return forEach(exports, e => tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions));
}
else if (typeof exports === "object" && exports !== null) { // eslint-disable-line no-null/no-null
if (allKeysStartWithDot(exports as MapLike<unknown>)) {
// sub-mappings
// 3 cases:
// * directory mappings (legacyish, key ends with / (technically allows index/extension resolution under cjs mode))
// * pattern mappings (contains a *)
// * exact mappings (no *, does not end with /)
return forEach(getOwnKeys(exports as MapLike<unknown>), k => {
const subPackageName = getNormalizedAbsolutePath(combinePaths(packageName, k), /*currentDirectory*/ undefined);
const mode = endsWith(k, "/") ? MatchingMode.Directory
: stringContains(k, "*") ? MatchingMode.Pattern
: MatchingMode.Exact;
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, (exports as MapLike<unknown>)[k], conditions, mode);
});
}
else {
// conditional mapping
for (const key of getOwnKeys(exports as MapLike<unknown>)) {
if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
const subTarget = (exports as MapLike<unknown>)[key];
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions);
if (result) {
return result;
}
}
}
}
}
return undefined;
}
function tryGetModuleNameFromRootDirs(rootDirs: readonly string[], moduleFileName: string, sourceDirectory: string, getCanonicalFileName: (file: string) => string, ending: Ending, compilerOptions: CompilerOptions): string | undefined {
const normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
if (normalizedTargetPath === undefined) {
@ -586,7 +657,15 @@ namespace ts.moduleSpecifiers {
let moduleFileNameForExtensionless: string | undefined;
while (true) {
// If the module could be imported by a directory name, use that directory's name
const { moduleFileToTry, packageRootPath } = tryDirectoryWithPackageJson(packageRootIndex);
const { moduleFileToTry, packageRootPath, blockedByExports, verbatimFromExports } = tryDirectoryWithPackageJson(packageRootIndex);
if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Classic) {
if (blockedByExports) {
return undefined; // File is under this package.json, but is not publicly exported - there's no way to name it via `node_modules` resolution
}
if (verbatimFromExports) {
return moduleFileToTry;
}
}
if (packageRootPath) {
moduleSpecifier = packageRootPath;
isPackageRootPath = true;
@ -619,14 +698,25 @@ namespace ts.moduleSpecifiers {
const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
const packageName = getPackageNameFromTypesPackageName(nodeModulesDirectoryName);
// For classic resolution, only allow importing from node_modules/@types, not other node_modules
return getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs && packageName === nodeModulesDirectoryName ? undefined : packageName;
return getEmitModuleResolutionKind(options) === ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
function tryDirectoryWithPackageJson(packageRootIndex: number) {
function tryDirectoryWithPackageJson(packageRootIndex: number): { moduleFileToTry: string, packageRootPath?: string, blockedByExports?: true, verbatimFromExports?: true } {
const packageRootPath = path.substring(0, packageRootIndex);
const packageJsonPath = combinePaths(packageRootPath, "package.json");
let moduleFileToTry = path;
if (host.fileExists(packageJsonPath)) {
const packageJsonContent = JSON.parse(host.readFile!(packageJsonPath)!);
// TODO: Inject `require` or `import` condition based on the intended import mode
if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node12 || getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext) {
const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, packageJsonContent.name, packageJsonContent.exports, ["node", "types"]) : undefined;
if (fromExports) {
const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
return { ...withJsExtension, verbatimFromExports: true };
}
if (packageJsonContent.exports) {
return { moduleFileToTry: path, blockedByExports: true };
}
}
const versionPaths = packageJsonContent.typesVersions
? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions)
: undefined;
@ -641,7 +731,6 @@ namespace ts.moduleSpecifiers {
moduleFileToTry = combinePaths(packageRootPath, fromPaths);
}
}
// If the file is the main module, it can be imported by the package name
const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
if (isString(mainFileRelative)) {

View file

@ -212,7 +212,8 @@ namespace ts {
visitNode(cbNode, (node as MappedTypeNode).typeParameter) ||
visitNode(cbNode, (node as MappedTypeNode).nameType) ||
visitNode(cbNode, (node as MappedTypeNode).questionToken) ||
visitNode(cbNode, (node as MappedTypeNode).type);
visitNode(cbNode, (node as MappedTypeNode).type) ||
visitNodes(cbNode, cbNodes, (node as MappedTypeNode).members);
case SyntaxKind.LiteralType:
return visitNode(cbNode, (node as LiteralTypeNode).literal);
case SyntaxKind.NamedTupleMember:
@ -1974,7 +1975,6 @@ namespace ts {
case SyntaxKind.DefaultKeyword:
return nextTokenCanFollowDefaultKeyword();
case SyntaxKind.StaticKeyword:
return nextTokenIsOnSameLineAndCanFollowModifier();
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
nextToken();
@ -2611,7 +2611,10 @@ namespace ts {
case ParsingContext.ObjectLiteralMembers: return parseErrorAtCurrentToken(Diagnostics.Property_assignment_expected);
case ParsingContext.ArrayLiteralMembers: return parseErrorAtCurrentToken(Diagnostics.Expression_or_comma_expected);
case ParsingContext.JSDocParameters: return parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
case ParsingContext.Parameters: return parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
case ParsingContext.Parameters:
return isKeyword(token())
? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_parameter_name, tokenToString(token()))
: parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
case ParsingContext.TypeParameters: return parseErrorAtCurrentToken(Diagnostics.Type_parameter_declaration_expected);
case ParsingContext.TypeArguments: return parseErrorAtCurrentToken(Diagnostics.Type_argument_expected);
case ParsingContext.TupleElementTypes: return parseErrorAtCurrentToken(Diagnostics.Type_expected);
@ -3535,8 +3538,9 @@ namespace ts {
}
const type = parseTypeAnnotation();
parseSemicolon();
const members = parseList(ParsingContext.TypeMembers, parseTypeMember);
parseExpected(SyntaxKind.CloseBraceToken);
return finishNode(factory.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type), pos);
return finishNode(factory.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), pos);
}
function parseTupleElementType() {
@ -6870,7 +6874,7 @@ namespace ts {
return list && createNodeArray(list, pos);
}
function tryParseModifier(permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): Modifier | undefined {
function tryParseModifier(permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean, hasSeenStaticModifier?: boolean): Modifier | undefined {
const pos = getNodePos();
const kind = token();
@ -6884,6 +6888,9 @@ namespace ts {
else if (stopOnStartOfClassStaticBlock && token() === SyntaxKind.StaticKeyword && lookAhead(nextTokenIsOpenBrace)) {
return undefined;
}
else if (hasSeenStaticModifier && token() === SyntaxKind.StaticKeyword) {
return undefined;
}
else {
if (!parseAnyContextualModifier()) {
return undefined;
@ -6902,8 +6909,9 @@ namespace ts {
*/
function parseModifiers(permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): NodeArray<Modifier> | undefined {
const pos = getNodePos();
let list, modifier;
while (modifier = tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock)) {
let list, modifier, hasSeenStatic = false;
while (modifier = tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStatic)) {
if (modifier.kind === SyntaxKind.StaticKeyword) hasSeenStatic = true;
list = append(list, modifier);
}
return list && createNodeArray(list, pos);
@ -7274,19 +7282,24 @@ namespace ts {
const pos = getNodePos();
parseExpected(SyntaxKind.AssertKeyword);
const openBracePosition = scanner.getTokenPos();
parseExpected(SyntaxKind.OpenBraceToken);
const multiLine = scanner.hasPrecedingLineBreak();
const elements = parseDelimitedList(ParsingContext.AssertEntries, parseAssertEntry, /*considerSemicolonAsDelimiter*/ true);
if (!parseExpected(SyntaxKind.CloseBraceToken)) {
const lastError = lastOrUndefined(parseDiagnostics);
if (lastError && lastError.code === Diagnostics._0_expected.code) {
addRelatedInfo(
lastError,
createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)
);
if (parseExpected(SyntaxKind.OpenBraceToken)) {
const multiLine = scanner.hasPrecedingLineBreak();
const elements = parseDelimitedList(ParsingContext.AssertEntries, parseAssertEntry, /*considerSemicolonAsDelimiter*/ true);
if (!parseExpected(SyntaxKind.CloseBraceToken)) {
const lastError = lastOrUndefined(parseDiagnostics);
if (lastError && lastError.code === Diagnostics._0_expected.code) {
addRelatedInfo(
lastError,
createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)
);
}
}
return finishNode(factory.createAssertClause(elements, multiLine), pos);
}
else {
const elements = createNodeArray([], getNodePos(), /*end*/ undefined, /*hasTrailingComma*/ false);
return finishNode(factory.createAssertClause(elements, /*multiLine*/ false), pos);
}
return finishNode(factory.createAssertClause(elements, multiLine), pos);
}
function tokenAfterImportDefinitelyProducesImportDeclaration() {
@ -8253,8 +8266,9 @@ namespace ts {
}
function parseSeeTag(start: number, tagName: Identifier, indent?: number, indentText?: string): JSDocSeeTag {
const isLink = lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenValue() === "link");
const nameExpression = isLink ? undefined : parseJSDocNameReference();
const isMarkdownOrJSDocLink = token() === SyntaxKind.OpenBracketToken
|| lookAhead(() => nextTokenJSDoc() === SyntaxKind.AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenValue() === "link");
const nameExpression = isMarkdownOrJSDocLink ? undefined : parseJSDocNameReference();
const comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, getNodePos(), indent, indentText) : undefined;
return finishNode(factory.createJSDocSeeTag(tagName, nameExpression, comments), start);
}

View file

@ -685,7 +685,7 @@ namespace ts {
break;
case FileIncludeKind.TypeReferenceDirective:
({ pos, end } = file.typeReferenceDirectives[index]);
packageId = file.resolvedTypeReferenceDirectiveNames?.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), getModeForResolutionAtIndex(file, index))?.packageId;
packageId = file.resolvedTypeReferenceDirectiveNames?.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), file.impliedNodeFormat)?.packageId;
break;
case FileIncludeKind.LibReferenceDirective:
({ pos, end } = file.libReferenceDirectives[index]);
@ -818,6 +818,25 @@ namespace ts {
}
}
/** @internal */
export const plainJSErrors: Set<number> = new Set([
Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
Diagnostics.A_module_cannot_have_multiple_default_exports.code,
Diagnostics.Another_export_default_is_here.code,
Diagnostics.The_first_export_default_is_here.code,
Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
Diagnostics.constructor_is_a_reserved_word.code,
Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode.code,
Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
Diagnostics.Invalid_use_of_0_in_strict_mode.code,
Diagnostics.A_label_is_not_allowed_here.code,
Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
]);
/**
* Determine if source file needs to be re-created even if its text hasn't changed
*/
@ -1577,6 +1596,7 @@ namespace ts {
newSourceFile.originalFileName = oldSourceFile.originalFileName;
newSourceFile.resolvedPath = oldSourceFile.resolvedPath;
newSourceFile.fileName = oldSourceFile.fileName;
newSourceFile.impliedNodeFormat = oldSourceFile.impliedNodeFormat;
const packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path);
if (packageName !== undefined) {
@ -1674,8 +1694,8 @@ namespace ts {
const typesReferenceDirectives = map(newSourceFile.typeReferenceDirectives, ref => toFileNameLowerCase(ref.fileName));
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
// ensure that types resolutions are still correct
const typeReferenceEesolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, typeDirectiveIsEqualTo);
if (typeReferenceEesolutionsChanged) {
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, typeDirectiveIsEqualTo);
if (typeReferenceResolutionsChanged) {
structureIsReused = StructureIsReused.SafeModules;
newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
}
@ -2004,15 +2024,24 @@ namespace ts {
Debug.assert(!!sourceFile.bindDiagnostics);
const isCheckJs = isCheckJsEnabledForFile(sourceFile, options);
const isJs = sourceFile.scriptKind === ScriptKind.JS || sourceFile.scriptKind === ScriptKind.JSX;
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
const isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
const isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
// By default, only type-check .ts, .tsx, 'Deferred' and 'External' files (external files are added by plugins)
const includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === ScriptKind.TS || sourceFile.scriptKind === ScriptKind.TSX
|| sourceFile.scriptKind === ScriptKind.External || isCheckJs || sourceFile.scriptKind === ScriptKind.Deferred);
const bindDiagnostics: readonly Diagnostic[] = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray;
const checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray;
return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
// By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
// - plain JS: .js files with no // ts-check and checkJs: undefined
// - check JS: .js files with either // ts-check or checkJs: true
// - external: files that are added by plugins
const includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === ScriptKind.TS || sourceFile.scriptKind === ScriptKind.TSX
|| sourceFile.scriptKind === ScriptKind.External || isPlainJs || isCheckJs || sourceFile.scriptKind === ScriptKind.Deferred);
let bindDiagnostics: readonly Diagnostic[] = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray;
const checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray;
if (isPlainJs) {
bindDiagnostics = filter(bindDiagnostics, d => plainJSErrors.has(d.code));
}
// skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
});
}
@ -3160,6 +3189,21 @@ namespace ts {
}
function verifyCompilerOptions() {
const isNightly = stringContains(version, "-dev") || stringContains(version, "-insiders");
if (!isNightly) {
if (getEmitModuleKind(options) === ModuleKind.Node12) {
createOptionValueDiagnostic("module", Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12");
}
else if (getEmitModuleKind(options) === ModuleKind.NodeNext) {
createOptionValueDiagnostic("module", Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "nodenext");
}
else if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node12) {
createOptionValueDiagnostic("moduleResolution", Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "node12");
}
else if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext) {
createOptionValueDiagnostic("moduleResolution", Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "nodenext");
}
}
if (options.strictPropertyInitialization && !getStrictOptionValue(options, "strictNullChecks")) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
}
@ -3333,7 +3377,9 @@ namespace ts {
}
if (options.resolveJsonModule) {
if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs) {
if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs &&
getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Node12 &&
getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeNext) {
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
}
// Any emit other than common js, amd, es2015 or esnext is error
@ -3694,8 +3740,8 @@ namespace ts {
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2, option3);
}
function createOptionValueDiagnostic(option1: string, message: DiagnosticMessage, arg0?: string) {
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0);
function createOptionValueDiagnostic(option1: string, message: DiagnosticMessage, arg0?: string, arg1?: string) {
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0, arg1);
}
function createDiagnosticForReference(sourceFile: JsonSourceFile | undefined, index: number, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number) {

View file

@ -66,6 +66,7 @@ namespace ts {
getCurrentProgram(): Program | undefined;
fileIsOpen(filePath: Path): boolean;
getCompilerHost?(): CompilerHost | undefined;
onDiscoveredSymlink?(): void;
}
interface DirectoryWatchesOfFailedLookup {
@ -431,6 +432,9 @@ namespace ts {
else {
resolution = loader(name, containingFile, compilerOptions, resolutionHost.getCompilerHost?.() || resolutionHost, redirectedReference, containingSourceFile);
perDirectoryResolution.set(name, mode, resolution);
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
resolutionHost.onDiscoveredSymlink();
}
}
resolutionsInFile.set(name, mode, resolution);
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
@ -615,7 +619,7 @@ namespace ts {
) {
if (resolution.refCount) {
resolution.refCount++;
Debug.assertDefined(resolution.files);
Debug.assertIsDefined(resolution.files);
}
else {
resolution.refCount = 1;
@ -692,7 +696,7 @@ namespace ts {
filePath: Path,
getResolutionWithResolvedFileName: GetResolutionWithResolvedFileName<T, R>,
) {
unorderedRemoveItem(Debug.assertDefined(resolution.files), filePath);
unorderedRemoveItem(Debug.checkDefined(resolution.files), filePath);
resolution.refCount!--;
if (resolution.refCount) {
return;
@ -794,7 +798,7 @@ namespace ts {
for (const resolution of resolutions) {
if (resolution.isInvalidated || !canInvalidate(resolution)) continue;
resolution.isInvalidated = invalidated = true;
for (const containingFilePath of Debug.assertDefined(resolution.files)) {
for (const containingFilePath of Debug.checkDefined(resolution.files)) {
(filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new Set())).add(containingFilePath);
// When its a file with inferred types resolution, invalidate type reference directive resolution
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || endsWith(containingFilePath, inferredTypesContainingFile);
@ -965,4 +969,11 @@ namespace ts {
return dirPath === rootPath || canWatchDirectory(dirPath);
}
}
function resolutionIsSymlink(resolution: ResolutionWithFailedLookupLocations) {
return !!(
(resolution as ResolvedModuleWithFailedLookupLocations).resolvedModule?.originalPath ||
(resolution as ResolvedTypeReferenceDirectiveWithFailedLookupLocations).resolvedTypeReferenceDirective?.originalPath
);
}
}

View file

@ -2374,6 +2374,7 @@ namespace ts {
tokenValue = tokenValue.slice(0, -1);
pos--;
}
return getIdentifierToken();
}
return token;
}

View file

@ -322,7 +322,8 @@ namespace ts {
}
// Sometimes tools can see the following line as a source mapping url comment, so we mangle it a bit (the [M])
const sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)$/;
const sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)\r?\n?$/;
const whitespaceOrMapCommentRegExp = /^\s*(\/\/[@#] .*)?$/;
export interface LineInfo {

View file

@ -1625,7 +1625,6 @@ namespace ts {
sysLog(`sysLog:: ${fileOrDirectory}:: Defaulting to fsWatchFile`);
return watchPresentFileSystemEntryWithFsWatchFile();
}
try {
const presentWatcher = _fs.watch(
fileOrDirectory,
@ -1804,7 +1803,7 @@ namespace ts {
}
function readDirectory(path: string, extensions?: readonly string[], excludes?: readonly string[], includes?: readonly string[], depth?: number): string[] {
return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath, directoryExists);
return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
}
function fileSystemEntryExists(path: string, entryKind: FileSystemEntryKind): boolean {
@ -1900,6 +1899,11 @@ namespace ts {
return sys!;
})();
/*@internal*/
export function setSys(s: System) {
sys = s;
}
if (sys && sys.getEnvironmentVariable) {
setCustomPollingValues(sys);
Debug.setAssertionLevel(/^development$/i.test(sys.getEnvironmentVariable("NODE_ENV"))

View file

@ -566,7 +566,7 @@ namespace ts {
}
export const nullTransformationContext: TransformationContext = {
factory,
factory: factory, // eslint-disable-line object-shorthand
getCompilerOptions: () => ({}),
getEmitResolver: notImplemented,
getEmitHost: notImplemented,

View file

@ -4102,86 +4102,22 @@ namespace ts {
* @param node A TemplateExpression node.
*/
function visitTemplateExpression(node: TemplateExpression): Expression {
const expressions: Expression[] = [];
addTemplateHead(expressions, node);
addTemplateSpans(expressions, node);
// createAdd will check if each expression binds less closely than binary '+'.
// If it does, it wraps the expression in parentheses. Otherwise, something like
// `abc${ 1 << 2 }`
// becomes
// "abc" + 1 << 2 + ""
// which is really
// ("abc" + 1) << (2 + "")
// rather than
// "abc" + (1 << 2) + ""
const expression = reduceLeft(expressions, factory.createAdd)!;
if (nodeIsSynthesized(expression)) {
setTextRange(expression, node);
}
return expression;
}
/**
* Gets a value indicating whether we need to include the head of a TemplateExpression.
*
* @param node A TemplateExpression node.
*/
function shouldAddTemplateHead(node: TemplateExpression) {
// If this expression has an empty head literal and the first template span has a non-empty
// literal, then emitting the empty head literal is not necessary.
// `${ foo } and ${ bar }`
// can be emitted as
// foo + " and " + bar
// This is because it is only required that one of the first two operands in the emit
// output must be a string literal, so that the other operand and all following operands
// are forced into strings.
//
// If the first template span has an empty literal, then the head must still be emitted.
// `${ foo }${ bar }`
// must still be emitted as
// "" + foo + bar
// There is always atleast one templateSpan in this code path, since
// NoSubstitutionTemplateLiterals are directly emitted via emitLiteral()
Debug.assert(node.templateSpans.length !== 0);
return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0;
}
/**
* Adds the head of a TemplateExpression to an array of expressions.
*
* @param expressions An array of expressions.
* @param node A TemplateExpression node.
*/
function addTemplateHead(expressions: Expression[], node: TemplateExpression): void {
if (!shouldAddTemplateHead(node)) {
return;
}
expressions.push(factory.createStringLiteral(node.head.text));
}
/**
* Visits and adds the template spans of a TemplateExpression to an array of expressions.
*
* @param expressions An array of expressions.
* @param node A TemplateExpression node.
*/
function addTemplateSpans(expressions: Expression[], node: TemplateExpression): void {
let expression: Expression = factory.createStringLiteral(node.head.text);
for (const span of node.templateSpans) {
expressions.push(visitNode(span.expression, visitor, isExpression));
const args = [visitNode(span.expression, visitor, isExpression)];
// Only emit if the literal is non-empty.
// The binary '+' operator is left-associative, so the first string concatenation
// with the head will force the result up to this point to be a string.
// Emitting a '+ ""' has no semantic effect for middles and tails.
if (span.literal.text.length !== 0) {
expressions.push(factory.createStringLiteral(span.literal.text));
if (span.literal.text.length > 0) {
args.push(factory.createStringLiteral(span.literal.text));
}
expression = factory.createCallExpression(
factory.createPropertyAccessExpression(expression, "concat"),
/*typeArguments*/ undefined,
args,
);
}
return setTextRange(expression, node);
}
/**

View file

@ -282,7 +282,7 @@ namespace ts {
function visitYieldExpression(node: YieldExpression) {
if (enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator) {
if (node.asteriskToken) {
const expression = visitNode(Debug.assertDefined(node.expression), visitor, isExpression);
const expression = visitNode(Debug.checkDefined(node.expression), visitor, isExpression);
return setOriginalNode(
setTextRange(

View file

@ -26,12 +26,12 @@ namespace ts {
return currentFileState.filenameDeclaration.name;
}
function getJsxFactoryCalleePrimitive(childrenLength: number): "jsx" | "jsxs" | "jsxDEV" {
return compilerOptions.jsx === JsxEmit.ReactJSXDev ? "jsxDEV" : childrenLength > 1 ? "jsxs" : "jsx";
function getJsxFactoryCalleePrimitive(isStaticChildren: boolean): "jsx" | "jsxs" | "jsxDEV" {
return compilerOptions.jsx === JsxEmit.ReactJSXDev ? "jsxDEV" : isStaticChildren ? "jsxs" : "jsx";
}
function getJsxFactoryCallee(childrenLength: number) {
const type = getJsxFactoryCalleePrimitive(childrenLength);
function getJsxFactoryCallee(isStaticChildren: boolean) {
const type = getJsxFactoryCalleePrimitive(isStaticChildren);
return getImplicitImportForName(type);
}
@ -48,11 +48,11 @@ namespace ts {
return existing.name;
}
if (!currentFileState.utilizedImplicitRuntimeImports) {
currentFileState.utilizedImplicitRuntimeImports = createMap();
currentFileState.utilizedImplicitRuntimeImports = new Map();
}
let specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
if (!specifierSourceImports) {
specifierSourceImports = createMap();
specifierSourceImports = new Map();
currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
}
const generatedName = factory.createUniqueName(`_${name}`, GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel | GeneratedIdentifierFlags.AllowNameSubstitution);
@ -200,69 +200,54 @@ namespace ts {
}
function convertJsxChildrenToChildrenPropObject(children: readonly JsxChild[]) {
const prop = convertJsxChildrenToChildrenPropAssignment(children);
return prop && factory.createObjectLiteralExpression([prop]);
}
function convertJsxChildrenToChildrenPropAssignment(children: readonly JsxChild[]) {
const nonWhitespaceChildren = getSemanticJsxChildren(children);
if (length(nonWhitespaceChildren) === 1) {
if (length(nonWhitespaceChildren) === 1 && !(nonWhitespaceChildren[0] as JsxExpression).dotDotDotToken) {
const result = transformJsxChildToExpression(nonWhitespaceChildren[0]);
return result && factory.createObjectLiteralExpression([
factory.createPropertyAssignment("children", result)
]);
return result && factory.createPropertyAssignment("children", result);
}
const result = mapDefined(children, transformJsxChildToExpression);
return !result.length ? undefined : factory.createObjectLiteralExpression([
factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result))
]);
return length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
}
function visitJsxOpeningLikeElementJSX(node: JsxOpeningLikeElement, children: readonly JsxChild[] | undefined, isChild: boolean, location: TextRange) {
const tagName = getTagName(node);
let objectProperties: Expression;
const childrenProp = children && children.length ? convertJsxChildrenToChildrenPropAssignment(children) : undefined;
const keyAttr = find(node.attributes.properties, p => !!p.name && isIdentifier(p.name) && p.name.escapedText === "key") as JsxAttribute | undefined;
const attrs = keyAttr ? filter(node.attributes.properties, p => p !== keyAttr) : node.attributes.properties;
let segments: Expression[] = [];
if (attrs.length) {
// Map spans of JsxAttribute nodes into object literals and spans
// of JsxSpreadAttribute nodes into expressions.
segments = flatten(
spanMap(attrs, isJsxSpreadAttribute, (attrs, isSpread) => isSpread
? map(attrs, transformJsxSpreadAttributeToExpression)
: factory.createObjectLiteralExpression(map(attrs, transformJsxAttributeToObjectLiteralElement))
)
);
if (isJsxSpreadAttribute(attrs[0])) {
// We must always emit at least one object literal before a spread
// argument.factory.createObjectLiteral
segments.unshift(factory.createObjectLiteralExpression());
}
}
if (children && children.length) {
const result = convertJsxChildrenToChildrenPropObject(children);
if (result) {
segments.push(result);
}
}
if (segments.length === 0) {
objectProperties = factory.createObjectLiteralExpression([]);
// When there are no attributes, React wants {}
}
else {
// Either emit one big object literal (no spread attribs), or
// a call to the __assign helper.
objectProperties = singleOrUndefined(segments) || emitHelpers().createAssignHelper(segments);
}
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, length(getSemanticJsxChildren(children || emptyArray)), isChild, location);
const objectProperties = length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) :
factory.createObjectLiteralExpression(childrenProp ? [childrenProp] : emptyArray); // When there are no attributes, React wants {}
return visitJsxOpeningLikeElementOrFragmentJSX(
tagName,
objectProperties,
keyAttr,
children || emptyArray,
isChild,
location
);
}
function visitJsxOpeningLikeElementOrFragmentJSX(tagName: Expression, objectProperties: Expression, keyAttr: JsxAttribute | undefined, childrenLength: number, isChild: boolean, location: TextRange) {
function visitJsxOpeningLikeElementOrFragmentJSX(
tagName: Expression,
objectProperties: Expression,
keyAttr: JsxAttribute | undefined,
children: readonly JsxChild[],
isChild: boolean,
location: TextRange
) {
const nonWhitespaceChildren = getSemanticJsxChildren(children);
const isStaticChildren =
length(nonWhitespaceChildren) > 1 || !!(nonWhitespaceChildren[0] as JsxExpression)?.dotDotDotToken;
const args: Expression[] = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
if (compilerOptions.jsx === JsxEmit.ReactJSXDev) {
const originalFile = getOriginalNode(currentSourceFile);
if (originalFile && isSourceFile(originalFile)) {
// isStaticChildren development flag
args.push(childrenLength > 1 ? factory.createTrue() : factory.createFalse());
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
// __source development flag
const lineCol = getLineAndCharacterOfPosition(originalFile, location.pos);
args.push(factory.createObjectLiteralExpression([
@ -274,7 +259,10 @@ namespace ts {
args.push(factory.createThis());
}
}
const element = setTextRange(factory.createCallExpression(getJsxFactoryCallee(childrenLength), /*typeArguments*/ undefined, args), location);
const element = setTextRange(
factory.createCallExpression(getJsxFactoryCallee(isStaticChildren), /*typeArguments*/ undefined, args),
location
);
if (isChild) {
startOnNewLine(element);
@ -285,47 +273,9 @@ namespace ts {
function visitJsxOpeningLikeElementCreateElement(node: JsxOpeningLikeElement, children: readonly JsxChild[] | undefined, isChild: boolean, location: TextRange) {
const tagName = getTagName(node);
let objectProperties: Expression | undefined;
const attrs = node.attributes.properties;
if (attrs.length === 0) {
objectProperties = factory.createNull();
// When there are no attributes, React wants "null"
}
else {
const target = getEmitScriptTarget(compilerOptions);
if (target && target >= ScriptTarget.ES2018) {
objectProperties = factory.createObjectLiteralExpression(
flatten<SpreadAssignment | PropertyAssignment>(
spanMap(attrs, isJsxSpreadAttribute, (attrs, isSpread) =>
isSpread ? map(attrs, transformJsxSpreadAttributeToSpreadAssignment) : map(attrs, transformJsxAttributeToObjectLiteralElement)
)
)
);
}
else {
// Map spans of JsxAttribute nodes into object literals and spans
// of JsxSpreadAttribute nodes into expressions.
const segments = flatten<Expression | ObjectLiteralExpression>(
spanMap(attrs, isJsxSpreadAttribute, (attrs, isSpread) => isSpread
? map(attrs, transformJsxSpreadAttributeToExpression)
: factory.createObjectLiteralExpression(map(attrs, transformJsxAttributeToObjectLiteralElement))
)
);
if (isJsxSpreadAttribute(attrs[0])) {
// We must always emit at least one object literal before a spread
// argument.factory.createObjectLiteral
segments.unshift(factory.createObjectLiteralExpression());
}
// Either emit one big object literal (no spread attribs), or
// a call to the __assign helper.
objectProperties = singleOrUndefined(segments);
if (!objectProperties) {
objectProperties = emitHelpers().createAssignHelper(segments);
}
}
}
const objectProperties = length(attrs) ? transformJsxAttributesToObjectProps(attrs) :
factory.createNull(); // When there are no attributes, React wants "null"
const callee = currentFileState.importSpecifier === undefined
? createJsxFactoryExpression(
@ -364,7 +314,7 @@ namespace ts {
getImplicitJsxFragmentReference(),
childrenProps || factory.createObjectLiteralExpression([]),
/*keyAttr*/ undefined,
length(getSemanticJsxChildren(children)),
children,
isChild,
location
);
@ -392,6 +342,44 @@ namespace ts {
return factory.createSpreadAssignment(visitNode(node.expression, visitor, isExpression));
}
function transformJsxAttributesToObjectProps(attrs: readonly(JsxSpreadAttribute | JsxAttribute)[], children?: PropertyAssignment) {
const target = getEmitScriptTarget(compilerOptions);
return target && target >= ScriptTarget.ES2018 ? factory.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) :
transformJsxAttributesToExpression(attrs, children);
}
function transformJsxAttributesToProps(attrs: readonly(JsxSpreadAttribute | JsxAttribute)[], children?: PropertyAssignment) {
const props = flatten<SpreadAssignment | PropertyAssignment>(spanMap(attrs, isJsxSpreadAttribute, (attrs, isSpread) =>
map(attrs, attr => isSpread ? transformJsxSpreadAttributeToSpreadAssignment(attr as JsxSpreadAttribute) : transformJsxAttributeToObjectLiteralElement(attr as JsxAttribute))));
if (children) {
props.push(children);
}
return props;
}
function transformJsxAttributesToExpression(attrs: readonly(JsxSpreadAttribute | JsxAttribute)[], children?: PropertyAssignment) {
// Map spans of JsxAttribute nodes into object literals and spans
// of JsxSpreadAttribute nodes into expressions.
const expressions = flatten(
spanMap(attrs, isJsxSpreadAttribute, (attrs, isSpread) => isSpread
? map(attrs, transformJsxSpreadAttributeToExpression)
: factory.createObjectLiteralExpression(map(attrs, transformJsxAttributeToObjectLiteralElement))
)
);
if (isJsxSpreadAttribute(attrs[0])) {
// We must always emit at least one object literal before a spread
// argument.factory.createObjectLiteral
expressions.unshift(factory.createObjectLiteralExpression());
}
if (children) {
expressions.push(factory.createObjectLiteralExpression([children]));
}
return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
}
function transformJsxSpreadAttributeToExpression(node: JsxSpreadAttribute) {
return visitNode(node.expression, visitor, isExpression);
}

View file

@ -872,12 +872,12 @@ namespace ts {
getConfigFileParsingDiagnostics(config),
config.projectReferences
);
state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && map(
state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
([path, data]) => ([state.host.realpath ? toPath(state, state.host.realpath(path)) : path, data] as const)
));
if (state.watch) {
state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && map(
state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
([path, data]) => ([state.host.realpath && data ? toPath(state, state.host.realpath(path)) : path, data] as const)
));
state.builderPrograms.set(projectPath, program);
}
step++;

View file

@ -1609,7 +1609,7 @@ namespace ts {
export interface TypePredicateNode extends TypeNode {
readonly kind: SyntaxKind.TypePredicate;
readonly parent: SignatureDeclaration | JSDocTypeExpression;
readonly assertsModifier?: AssertsToken;
readonly assertsModifier?: AssertsKeyword;
readonly parameterName: Identifier | ThisTypeNode;
readonly type?: TypeNode;
}
@ -1702,11 +1702,13 @@ namespace ts {
export interface MappedTypeNode extends TypeNode, Declaration {
readonly kind: SyntaxKind.MappedType;
readonly readonlyToken?: ReadonlyToken | PlusToken | MinusToken;
readonly readonlyToken?: ReadonlyKeyword | PlusToken | MinusToken;
readonly typeParameter: TypeParameterDeclaration;
readonly nameType?: TypeNode;
readonly questionToken?: QuestionToken | PlusToken | MinusToken;
readonly type?: TypeNode;
/** Used only to produce grammar errors */
readonly members?: NodeArray<TypeElement>;
}
export interface LiteralTypeNode extends TypeNode {
@ -2754,7 +2756,7 @@ namespace ts {
export interface ForOfStatement extends IterationStatement {
readonly kind: SyntaxKind.ForOfStatement;
readonly awaitModifier?: AwaitKeywordToken;
readonly awaitModifier?: AwaitKeyword;
readonly initializer: ForInitializer;
readonly expression: Expression;
}
@ -4412,6 +4414,14 @@ namespace ts {
/* @internal */ isDeclarationVisible(node: Declaration | AnyImportSyntax): boolean;
/* @internal */ isPropertyAccessible(node: Node, isSuper: boolean, isWrite: boolean, containingType: Type, property: Symbol): boolean;
/* @internal */ getTypeOnlyAliasDeclaration(symbol: Symbol): TypeOnlyAliasDeclaration | undefined;
/* @internal */ getMemberOverrideModifierStatus(node: ClassLikeDeclaration, member: ClassElement): MemberOverrideStatus;
}
/* @internal */
export const enum MemberOverrideStatus {
Ok,
NeedsOverride,
HasInvalidOverride
}
/* @internal */
@ -5073,6 +5083,7 @@ namespace ts {
ConstructorReferenceInClass = 0x02000000, // Binding to a class constructor inside of the class's body.
ContainsClassWithPrivateIdentifiers = 0x04000000, // Marked on all block-scoped containers containing a class with private identifiers.
ContainsSuperPropertyInStaticInitializer = 0x08000000, // Marked on all block-scoped containers containing a static initializer with 'super.x' or 'super[x]'.
InCheckIdentifier = 0x10000000,
}
/* @internal */
@ -5096,7 +5107,7 @@ namespace ts {
jsxNamespace?: Symbol | false; // Resolved jsx namespace symbol for this node
jsxImplicitImportContainer?: Symbol | false; // Resolved module symbol the implicit jsx import of this file should refer to
contextFreeType?: Type; // Cached context-free type used by the first pass of inference; used when a function's return is partially contextually sensitive
deferredNodes?: ESMap<NodeId, Node>; // Set of nodes whose checking has been deferred
deferredNodes?: Set<Node>; // Set of nodes whose checking has been deferred
capturedBlockScopeBindings?: Symbol[]; // Block-scoped bindings captured beneath this part of an IterationStatement
outerTypeParameters?: TypeParameter[]; // Outer type parameters of anonymous object type
isExhaustive?: boolean; // Is node an exhaustive switch statement
@ -5177,8 +5188,6 @@ namespace ts {
// 'Narrowable' types are types where narrowing actually narrows.
// This *should* be every type other than null, undefined, void, and never
Narrowable = Any | Unknown | StructuredOrInstantiable | StringLike | NumberLike | BigIntLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive,
/* @internal */
NotPrimitiveUnion = Any | Unknown | Enum | Void | Never | Object | Intersection | Instantiable,
// The following flags are aggregated during union and intersection type construction
/* @internal */
IncludesMask = Any | Unknown | Primitive | Never | Object | Union | Intersection | NonPrimitive | TemplateLiteral,
@ -5191,6 +5200,10 @@ namespace ts {
IncludesWildcard = IndexedAccess,
/* @internal */
IncludesEmptyObject = Conditional,
/* @internal */
IncludesInstantiable = Substitution,
/* @internal */
NotPrimitiveUnion = Any | Unknown | Enum | Void | Never | Object | Intersection | IncludesInstantiable,
}
export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
@ -5577,6 +5590,7 @@ namespace ts {
/* @internal */
export interface SyntheticDefaultModuleType extends Type {
syntheticType?: Type;
defaultOnlyType?: Type;
}
export interface InstantiableType extends Type {
@ -5981,7 +5995,7 @@ namespace ts {
export enum ModuleResolutionKind {
Classic = 1,
NodeJs = 2,
// Starting with node12, node's module resolver has significant departures from tranditional cjs resolution
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
// to better support ecmascript modules and their use within node - more features are still being added, so
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
// version-anchored resolution target
@ -6254,6 +6268,7 @@ namespace ts {
ES2019 = 6,
ES2020 = 7,
ES2021 = 8,
ES2022 = 9,
ESNext = 99,
JSON = 100,
Latest = ESNext,
@ -6338,8 +6353,20 @@ namespace ts {
}
/* @internal */
export interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase {
type: "string" | "number" | "boolean";
export interface CommandLineOptionOfStringType extends CommandLineOptionBase {
type: "string";
}
/* @internal */
export interface CommandLineOptionOfNumberType extends CommandLineOptionBase {
type: "number";
defaultValueDescription: `${number | undefined}` | DiagnosticMessage;
}
/* @internal */
export interface CommandLineOptionOfBooleanType extends CommandLineOptionBase {
type: "boolean";
defaultValueDescription: `${boolean | undefined}` | DiagnosticMessage;
}
/* @internal */
@ -6371,11 +6398,11 @@ namespace ts {
/* @internal */
export interface CommandLineOptionOfListType extends CommandLineOptionBase {
type: "list";
element: CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType | TsConfigOnlyOption;
element: CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | TsConfigOnlyOption;
}
/* @internal */
export type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType | TsConfigOnlyOption | CommandLineOptionOfListType;
export type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | TsConfigOnlyOption | CommandLineOptionOfListType;
/* @internal */
export const enum CharacterCodes {
@ -6699,15 +6726,16 @@ namespace ts {
ContainsTypeScript = 1 << 0,
ContainsJsx = 1 << 1,
ContainsESNext = 1 << 2,
ContainsES2021 = 1 << 3,
ContainsES2020 = 1 << 4,
ContainsES2019 = 1 << 5,
ContainsES2018 = 1 << 6,
ContainsES2017 = 1 << 7,
ContainsES2016 = 1 << 8,
ContainsES2015 = 1 << 9,
ContainsGenerator = 1 << 10,
ContainsDestructuringAssignment = 1 << 11,
ContainsES2022 = 1 << 3,
ContainsES2021 = 1 << 4,
ContainsES2020 = 1 << 5,
ContainsES2019 = 1 << 6,
ContainsES2018 = 1 << 7,
ContainsES2017 = 1 << 8,
ContainsES2016 = 1 << 9,
ContainsES2015 = 1 << 10,
ContainsGenerator = 1 << 11,
ContainsDestructuringAssignment = 1 << 12,
// Markers
// - Flags used to indicate that a subtree contains a specific transformation.
@ -6736,6 +6764,7 @@ namespace ts {
AssertTypeScript = ContainsTypeScript,
AssertJsx = ContainsJsx,
AssertESNext = ContainsESNext,
AssertES2022 = ContainsES2022,
AssertES2021 = ContainsES2021,
AssertES2020 = ContainsES2020,
AssertES2019 = ContainsES2019,
@ -6801,6 +6830,31 @@ namespace ts {
externalHelpers?: boolean;
helpers?: EmitHelper[]; // Emit helpers for the node
startsOnNewLine?: boolean; // If the node should begin on a new line
snippetElement?: SnippetElement; // Snippet element of the node
}
/* @internal */
export type SnippetElement = TabStop | Placeholder;
/* @internal */
export interface TabStop {
kind: SnippetKind.TabStop;
order: number;
}
/* @internal */
export interface Placeholder {
kind: SnippetKind.Placeholder;
order: number;
}
// Reference: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax
/* @internal */
export const enum SnippetKind {
TabStop, // `$1`, `$2`
Placeholder, // `${1:foo}`
Choice, // `${1|one,two,three|}`
Variable, // `$name`, `${name:default}`
}
export const enum EmitFlags {
@ -7212,8 +7266,8 @@ namespace ts {
updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode;
createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode;
updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode;
createMappedTypeNode(readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined): MappedTypeNode;
updateMappedTypeNode(node: MappedTypeNode, readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined): MappedTypeNode;
createMappedTypeNode(readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined, members: NodeArray<TypeElement> | undefined): MappedTypeNode;
updateMappedTypeNode(node: MappedTypeNode, readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined, members: NodeArray<TypeElement> | undefined): MappedTypeNode;
createLiteralTypeNode(literal: LiteralTypeNode["literal"]): LiteralTypeNode;
updateLiteralTypeNode(node: LiteralTypeNode, literal: LiteralTypeNode["literal"]): LiteralTypeNode;
createTemplateLiteralType(head: TemplateHead, templateSpans: readonly TemplateLiteralTypeSpan[]): TemplateLiteralTypeNode;
@ -8263,6 +8317,7 @@ namespace ts {
hasTrailingComment(): boolean;
hasTrailingWhitespace(): boolean;
getTextPosWithWriteLine?(): number;
nonEscapingWrite?(text: string): void;
}
export interface GetEffectiveTypeRootsHost {
@ -8608,6 +8663,7 @@ namespace ts {
readonly includeCompletionsWithSnippetText?: boolean;
readonly includeAutomaticOptionalChainCompletions?: boolean;
readonly includeCompletionsWithInsertText?: boolean;
readonly includeCompletionsWithClassMemberSnippets?: boolean;
readonly allowIncompleteCompletions?: boolean;
readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */

View file

@ -20,21 +20,6 @@ namespace ts {
return undefined;
}
/**
* Create a new escaped identifier map.
* @deprecated Use `new Map<__String, T>()` instead.
*/
export function createUnderscoreEscapedMap<T>(): UnderscoreEscapedMap<T> {
return new Map<__String, T>();
}
/**
* @deprecated Use `!!map?.size` instead
*/
export function hasEntries(map: ReadonlyCollection<any> | undefined): map is ReadonlyCollection<any> {
return !!map && !!map.size;
}
export function createSymbolTable(symbols?: readonly Symbol[]): SymbolTable {
const result = new Map<__String, Symbol>();
if (symbols) {
@ -606,6 +591,7 @@ namespace ts {
AsyncIterableIterator: emptyArray,
AsyncGenerator: emptyArray,
AsyncGeneratorFunction: emptyArray,
NumberFormat: ["formatToParts"]
},
es2019: {
Array: ["flat", "flatMap"],
@ -627,8 +613,21 @@ namespace ts {
PromiseConstructor: ["any"],
String: ["replaceAll"]
},
esnext: {
NumberFormat: ["formatToParts"]
es2022: {
Array: ["at"],
String: ["at"],
Int8Array: ["at"],
Uint8Array: ["at"],
Uint8ClampedArray: ["at"],
Int16Array: ["at"],
Uint16Array: ["at"],
Int32Array: ["at"],
Uint32Array: ["at"],
Float32Array: ["at"],
Float64Array: ["at"],
BigInt64Array: ["at"],
BigUint64Array: ["at"],
ObjectConstructor: ["hasOwn"]
}
};
}
@ -3161,7 +3160,7 @@ namespace ts {
return undefined;
}
export function isKeyword(token: SyntaxKind): boolean {
export function isKeyword(token: SyntaxKind): token is KeywordSyntaxKind {
return SyntaxKind.FirstKeyword <= token && token <= SyntaxKind.LastKeyword;
}
@ -3346,7 +3345,7 @@ namespace ts {
return node.escapedText === "push" || node.escapedText === "unshift";
}
export function isParameterDeclaration(node: VariableLikeDeclaration) {
export function isParameterDeclaration(node: VariableLikeDeclaration): boolean {
const root = getRootDeclaration(node);
return root.kind === SyntaxKind.Parameter;
}
@ -6168,6 +6167,8 @@ namespace ts {
case ModuleKind.ES2020:
case ModuleKind.ES2022:
case ModuleKind.ESNext:
case ModuleKind.Node12:
case ModuleKind.NodeNext:
return true;
default:
return false;
@ -6622,7 +6623,7 @@ namespace ts {
}
/** @param path directory of the tsconfig.json */
export function matchFiles(path: string, extensions: readonly string[] | undefined, excludes: readonly string[] | undefined, includes: readonly string[] | undefined, useCaseSensitiveFileNames: boolean, currentDirectory: string, depth: number | undefined, getFileSystemEntries: (path: string) => FileSystemEntries, realpath: (path: string) => string, directoryExists: (path: string) => boolean): string[] {
export function matchFiles(path: string, extensions: readonly string[] | undefined, excludes: readonly string[] | undefined, includes: readonly string[] | undefined, useCaseSensitiveFileNames: boolean, currentDirectory: string, depth: number | undefined, getFileSystemEntries: (path: string) => FileSystemEntries, realpath: (path: string) => string): string[] {
path = normalizePath(path);
currentDirectory = normalizePath(currentDirectory);
@ -6638,9 +6639,7 @@ namespace ts {
const visited = new Map<string, true>();
const toCanonical = createGetCanonicalFileName(useCaseSensitiveFileNames);
for (const basePath of patterns.basePaths) {
if (directoryExists(basePath)) {
visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
}
visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
}
return flatten(results);
@ -6743,10 +6742,14 @@ namespace ts {
const ext = fileName.substr(fileName.lastIndexOf("."));
switch (ext.toLowerCase()) {
case Extension.Js:
case Extension.Cjs:
case Extension.Mjs:
return ScriptKind.JS;
case Extension.Jsx:
return ScriptKind.JSX;
case Extension.Ts:
case Extension.Cts:
case Extension.Mts:
return ScriptKind.TS;
case Extension.Tsx:
return ScriptKind.TSX;
@ -6976,18 +6979,6 @@ namespace ts {
return { min, max };
}
/** @deprecated Use `ReadonlySet<TNode>` instead. */
export type ReadonlyNodeSet<TNode extends Node> = ReadonlySet<TNode>;
/** @deprecated Use `Set<TNode>` instead. */
export type NodeSet<TNode extends Node> = Set<TNode>;
/** @deprecated Use `ReadonlyMap<TNode, TValue>` instead. */
export type ReadonlyNodeMap<TNode extends Node, TValue> = ReadonlyESMap<TNode, TValue>;
/** @deprecated Use `Map<TNode, TValue>` instead. */
export type NodeMap<TNode extends Node, TValue> = ESMap<TNode, TValue>;
export function rangeOfNode(node: Node): TextRange {
return { pos: getTokenPosOfNode(node), end: node.end };
}
@ -7415,4 +7406,12 @@ namespace ts {
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
}
export function isFunctionExpressionOrArrowFunction(node: Node): node is FunctionExpression | ArrowFunction {
return node.kind === SyntaxKind.FunctionExpression || node.kind === SyntaxKind.ArrowFunction;
}
export function escapeSnippetText(text: string): string {
return text.replace(/\$/gm, "\\$");
}
}

View file

@ -14,6 +14,8 @@ namespace ts {
switch (getEmitScriptTarget(options)) {
case ScriptTarget.ESNext:
return "lib.esnext.full.d.ts";
case ScriptTarget.ES2022:
return "lib.es2022.full.d.ts";
case ScriptTarget.ES2021:
return "lib.es2021.full.d.ts";
case ScriptTarget.ES2020:

View file

@ -629,7 +629,8 @@ namespace ts {
nodeVisitor(node.typeParameter, visitor, isTypeParameterDeclaration),
nodeVisitor(node.nameType, visitor, isTypeNode),
nodeVisitor(node.questionToken, tokenVisitor, isQuestionOrPlusOrMinusToken),
nodeVisitor(node.type, visitor, isTypeNode));
nodeVisitor(node.type, visitor, isTypeNode),
nodesVisitor(node.members, visitor, isTypeElement));
case SyntaxKind.LiteralType:
Debug.type<LiteralTypeNode>(node);

View file

@ -560,6 +560,9 @@ namespace ts {
sourceFilesCache.set(path, false);
}
}
if (sourceFile) {
sourceFile.impliedNodeFormat = getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
}
return sourceFile;
}
return hostSourceFile.sourceFile;

View file

@ -184,7 +184,7 @@ namespace ts {
const rootResult = tryReadDirectory(rootDir, rootDirPath);
let rootSymLinkResult: FileSystemEntries | undefined;
if (rootResult !== undefined) {
return matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath, directoryExists);
return matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath);
}
return host.readDirectory!(rootDir, extensions, excludes, includes, depth);

View file

@ -354,7 +354,7 @@ namespace ts {
function printEasyHelp(sys: System, simpleOptions: readonly CommandLineOption[]) {
const colors = createColors(sys);
let output: string[] = [...getHelpHeader(sys)];
let output: string[] = [...getHeader(sys,`${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
output.push(colors.bold(getDiagnosticText(Diagnostics.COMMON_COMMANDS)) + sys.newLine + sys.newLine);
example("tsc", Diagnostics.Compiles_the_current_project_tsconfig_json_in_the_working_directory);
@ -388,7 +388,7 @@ namespace ts {
}
function printAllHelp(sys: System, compilerOptions: readonly CommandLineOption[], buildOptions: readonly CommandLineOption[], watchOptions: readonly CommandLineOption[]) {
let output: string[] = [...getHelpHeader(sys)];
let output: string[] = [...getHeader(sys,`${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.ALL_COMPILER_OPTIONS), compilerOptions, /*subCategory*/ true, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))];
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.WATCH_OPTIONS), watchOptions, /*subCategory*/ false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))];
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.BUILD_OPTIONS), buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))];
@ -398,32 +398,31 @@ namespace ts {
}
function printBuildHelp(sys: System, buildOptions: readonly CommandLineOption[]) {
let output: string[] = [...getHelpHeader(sys)];
let output: string[] = [...getHeader(sys,`${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.BUILD_OPTIONS), buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))];
for (const line of output) {
sys.write(line);
}
}
function getHelpHeader(sys: System) {
function getHeader(sys: System, message: string) {
const colors = createColors(sys);
const header: string[] = [];
const tscExplanation = `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`;
const terminalWidth = sys.getWidthOfTerminal?.() ?? 0;;
const tsIconLength = 5;
const tsIconFirstLine = colors.blueBackground(padLeft("", tsIconLength));
const tsIconSecondLine = colors.blueBackground(colors.brightWhite(padLeft("TS ", tsIconLength)));
// If we have enough space, print TS icon.
if (terminalWidth >= tscExplanation.length + tsIconLength) {
if (terminalWidth >= message.length + tsIconLength) {
// right align of the icon is 120 at most.
const rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
const leftAlign = rightAlign - tsIconLength;
header.push(padRight(tscExplanation, leftAlign) + tsIconFirstLine + sys.newLine);
header.push(padRight(message, leftAlign) + tsIconFirstLine + sys.newLine);
header.push(padLeft("", leftAlign) + tsIconSecondLine + sys.newLine);
}
else {
header.push(tscExplanation + sys.newLine);
header.push(message + sys.newLine);
header.push(sys.newLine);
}
return header;
@ -1035,7 +1034,12 @@ namespace ts {
}
else {
sys.writeFile(file, generateTSConfig(options, fileNames, sys.newLine));
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file));
const output: string[] = [sys.newLine, ...getHeader(sys,"Created a new tsconfig.json with:")];
output.push(getCompilerOptionsDiffValue(options, sys.newLine) + sys.newLine + sys.newLine);
output.push(`You can learn more at https://aka.ms/tsconfig.json` + sys.newLine);
for (const line of output) {
sys.write(line);
}
}
return;

View file

@ -95,7 +95,7 @@ namespace fakes {
}
public readDirectory(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[] {
return ts.matchFiles(path, extensions, exclude, include, this.useCaseSensitiveFileNames, this.getCurrentDirectory(), depth, path => this.getAccessibleFileSystemEntries(path), path => this.realpath(path), path => this.directoryExists(path));
return ts.matchFiles(path, extensions, exclude, include, this.useCaseSensitiveFileNames, this.getCurrentDirectory(), depth, path => this.getAccessibleFileSystemEntries(path), path => this.realpath(path));
}
public getAccessibleFileSystemEntries(path: string): ts.FileSystemEntries {

21
src/harness/findUpDir.ts Normal file
View file

@ -0,0 +1,21 @@
namespace Utils {
const { join, resolve, dirname } = require("path") as typeof import("path");
const { existsSync } = require("fs") as typeof import("fs");
// search directories upward to avoid hard-wired paths based on the
// build tree (same as scripts/build/findUpDir.js)
export function findUpFile(name: string): string {
let dir = __dirname;
while (true) {
const fullPath = join(dir, name);
if (existsSync(fullPath)) return fullPath;
const up = resolve(dir, "..");
if (up === dir) return name; // it'll fail anyway
dir = up;
}
}
export const findUpRoot: { (): string; cached?: string; } = () =>
findUpRoot.cached ||= dirname(findUpFile("Gulpfile.js"));
}

View file

@ -637,7 +637,8 @@ namespace FourSlash {
ts.forEachKey(this.inputFiles, fileName => {
if (!ts.isAnySupportedFileExtension(fileName)
|| Harness.getConfigNameFromFileName(fileName)
|| !ts.getAllowJSCompilerOption(this.getProgram().getCompilerOptions()) && !ts.resolutionExtensionIsTSOrJson(ts.extensionFromPath(fileName))
// Can't get a Program in Server tests
|| this.testType !== FourSlashTestType.Server && !ts.getAllowJSCompilerOption(this.getProgram().getCompilerOptions()) && !ts.resolutionExtensionIsTSOrJson(ts.extensionFromPath(fileName))
|| ts.getBaseFileName(fileName) === "package.json") return;
const errors = this.getDiagnostics(fileName).filter(e => e.category !== ts.DiagnosticCategory.Suggestion);
if (errors.length) {
@ -942,7 +943,7 @@ namespace FourSlash {
expected = typeof expected === "string" ? { name: expected } : expected;
if (actual.insertText !== expected.insertText) {
this.raiseError(`Expected completion insert text to be ${expected.insertText}, got ${actual.insertText}`);
this.raiseError(`Completion insert text did not match: ${showTextDiff(expected.insertText || "", actual.insertText || "")}`);
}
const convertedReplacementSpan = expected.replacementSpan && ts.createTextSpanFromRange(expected.replacementSpan);
if (convertedReplacementSpan?.length) {

View file

@ -41,6 +41,7 @@ namespace Harness {
export const virtualFileSystemRoot = "/";
function createNodeIO(): IO {
const workspaceRoot = Utils.findUpRoot();
let fs: any, pathModule: any;
if (require) {
fs = require("fs");
@ -154,7 +155,7 @@ namespace Harness {
log: s => console.log(s),
args: () => ts.sys.args,
getExecutingFilePath: () => ts.sys.getExecutingFilePath(),
getWorkspaceRoot: () => vpath.resolve(__dirname, "../.."),
getWorkspaceRoot: () => workspaceRoot,
exit: exitCode => ts.sys.exit(exitCode),
readDirectory: (path, extension, exclude, include, depth) => ts.sys.readDirectory(path, extension, exclude, include, depth),
getAccessibleFileSystemEntries,
@ -303,21 +304,21 @@ namespace Harness {
// Additional options not already in ts.optionDeclarations
const harnessOptionDeclarations: ts.CommandLineOption[] = [
{ name: "allowNonTsExtensions", type: "boolean" },
{ name: "useCaseSensitiveFileNames", type: "boolean" },
{ name: "allowNonTsExtensions", type: "boolean", defaultValueDescription: "false" },
{ name: "useCaseSensitiveFileNames", type: "boolean", defaultValueDescription: "false" },
{ name: "baselineFile", type: "string" },
{ name: "includeBuiltFile", type: "string" },
{ name: "fileName", type: "string" },
{ name: "libFiles", type: "string" },
{ name: "noErrorTruncation", type: "boolean" },
{ name: "suppressOutputPathCheck", type: "boolean" },
{ name: "noImplicitReferences", type: "boolean" },
{ name: "noErrorTruncation", type: "boolean", defaultValueDescription: "false" },
{ name: "suppressOutputPathCheck", type: "boolean", defaultValueDescription: "false" },
{ name: "noImplicitReferences", type: "boolean", defaultValueDescription: "false" },
{ name: "currentDirectory", type: "string" },
{ name: "symlink", type: "string" },
{ name: "link", type: "string" },
{ name: "noTypesAndSymbols", type: "boolean" },
{ name: "noTypesAndSymbols", type: "boolean", defaultValueDescription: "false" },
// Emitted js baseline will print full paths for every output file
{ name: "fullEmitPaths", type: "boolean" }
{ name: "fullEmitPaths", type: "boolean", defaultValueDescription: "false" }
];
let optionsIndex: ts.ESMap<string, ts.CommandLineOption>;

View file

@ -28,6 +28,7 @@
"evaluatorImpl.ts",
"fakesHosts.ts",
"client.ts",
"findUpDir.ts",
"runnerbase.ts",
"sourceMapRecorder.ts",

View file

@ -922,7 +922,7 @@ interface Array<T> { length: number; [n: number]: T; }`
});
}
return { directories, files };
}, path => this.realpath(path), path => this.directoryExists(path));
}, path => this.realpath(path));
}
createHash(s: string): string {

View file

@ -53,8 +53,8 @@ interface AnimationEventInit extends EventInit {
}
interface AnimationPlaybackEventInit extends EventInit {
currentTime?: number | null;
timelineTime?: number | null;
currentTime?: CSSNumberish | null;
timelineTime?: CSSNumberish | null;
}
interface AssignedNodesOptions {
@ -808,6 +808,7 @@ interface MediaTrackCapabilities {
interface MediaTrackConstraintSet {
aspectRatio?: ConstrainDouble;
autoGainControl?: ConstrainBoolean;
channelCount?: ConstrainULong;
deviceId?: ConstrainDOMString;
echoCancellation?: ConstrainBoolean;
@ -816,6 +817,7 @@ interface MediaTrackConstraintSet {
groupId?: ConstrainDOMString;
height?: ConstrainULong;
latency?: ConstrainDouble;
noiseSuppression?: ConstrainBoolean;
sampleRate?: ConstrainULong;
sampleSize?: ConstrainULong;
suppressLocalAudioPlayback?: ConstrainBoolean;
@ -828,12 +830,14 @@ interface MediaTrackConstraints extends MediaTrackConstraintSet {
interface MediaTrackSettings {
aspectRatio?: number;
autoGainControl?: boolean;
deviceId?: string;
echoCancellation?: boolean;
facingMode?: string;
frameRate?: number;
groupId?: string;
height?: number;
noiseSuppression?: boolean;
restrictOwnAudio?: boolean;
sampleRate?: number;
sampleSize?: number;
@ -842,12 +846,14 @@ interface MediaTrackSettings {
interface MediaTrackSupportedConstraints {
aspectRatio?: boolean;
autoGainControl?: boolean;
deviceId?: boolean;
echoCancellation?: boolean;
facingMode?: boolean;
frameRate?: boolean;
groupId?: boolean;
height?: boolean;
noiseSuppression?: boolean;
sampleRate?: boolean;
sampleSize?: boolean;
suppressLocalAudioPlayback?: boolean;
@ -1463,7 +1469,7 @@ interface RequestInit {
/** An AbortSignal to set request's signal. */
signal?: AbortSignal | null;
/** Can only be null. Used to disassociate request from any Window. */
window?: any;
window?: null;
}
interface ResizeObserverOptions {
@ -1867,7 +1873,7 @@ interface AbortSignal extends EventTarget {
declare var AbortSignal: {
prototype: AbortSignal;
new(): AbortSignal;
// abort(): AbortSignal;
// abort(): AbortSignal; - To be re-added in the future
};
interface AbstractRange {
@ -1930,7 +1936,7 @@ interface AnimationEventMap {
}
interface Animation extends EventTarget {
currentTime: number | null;
currentTime: CSSNumberish | null;
effect: AnimationEffect | null;
readonly finished: Promise<Animation>;
id: string;
@ -1942,7 +1948,7 @@ interface Animation extends EventTarget {
playbackRate: number;
readonly ready: Promise<Animation>;
readonly replaceState: AnimationReplaceState;
startTime: number | null;
startTime: CSSNumberish | null;
timeline: AnimationTimeline | null;
cancel(): void;
commitStyles(): void;
@ -1992,8 +1998,8 @@ interface AnimationFrameProvider {
}
interface AnimationPlaybackEvent extends Event {
readonly currentTime: number | null;
readonly timelineTime: number | null;
readonly currentTime: CSSNumberish | null;
readonly timelineTime: CSSNumberish | null;
}
declare var AnimationPlaybackEvent: {
@ -2208,6 +2214,7 @@ declare var AudioScheduledSourceNode: {
new(): AudioScheduledSourceNode;
};
/** Available only in secure contexts. */
interface AudioWorklet extends Worklet {
}
@ -2220,6 +2227,7 @@ interface AudioWorkletNodeEventMap {
"processorerror": Event;
}
/** Available only in secure contexts. */
interface AudioWorkletNode extends AudioNode {
onprocessorerror: ((this: AudioWorkletNode, ev: Event) => any) | null;
readonly parameters: AudioParamMap;
@ -2235,6 +2243,7 @@ declare var AudioWorkletNode: {
new(context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode;
};
/** Available only in secure contexts. */
interface AuthenticatorAssertionResponse extends AuthenticatorResponse {
readonly authenticatorData: ArrayBuffer;
readonly signature: ArrayBuffer;
@ -2246,6 +2255,7 @@ declare var AuthenticatorAssertionResponse: {
new(): AuthenticatorAssertionResponse;
};
/** Available only in secure contexts. */
interface AuthenticatorAttestationResponse extends AuthenticatorResponse {
readonly attestationObject: ArrayBuffer;
}
@ -2255,6 +2265,7 @@ declare var AuthenticatorAttestationResponse: {
new(): AuthenticatorAttestationResponse;
};
/** Available only in secure contexts. */
interface AuthenticatorResponse {
readonly clientDataJSON: ArrayBuffer;
}
@ -2278,6 +2289,7 @@ interface BaseAudioContextEventMap {
}
interface BaseAudioContext extends EventTarget {
/** Available only in secure contexts. */
readonly audioWorklet: AudioWorklet;
readonly currentTime: number;
readonly destination: AudioDestinationNode;
@ -2600,6 +2612,7 @@ declare var CSSRuleList: {
/** An object that is a CSS declaration block, and exposes style information and various style-related methods and properties. */
interface CSSStyleDeclaration {
accentColor: string;
alignContent: string;
alignItems: string;
alignSelf: string;
@ -2773,11 +2786,14 @@ interface CSSStyleDeclaration {
gridAutoRows: string;
gridColumn: string;
gridColumnEnd: string;
/** @deprecated This is a legacy alias of `columnGap`. */
gridColumnGap: string;
gridColumnStart: string;
/** @deprecated This is a legacy alias of `gap`. */
gridGap: string;
gridRow: string;
gridRowEnd: string;
/** @deprecated This is a legacy alias of `rowGap`. */
gridRowGap: string;
gridRowStart: string;
gridTemplate: string;
@ -3016,15 +3032,15 @@ interface CSSStyleDeclaration {
webkitBorderTopLeftRadius: string;
/** @deprecated This is a legacy alias of `borderTopRightRadius`. */
webkitBorderTopRightRadius: string;
/** @deprecated */
/** @deprecated This is a legacy alias of `boxAlign`. */
webkitBoxAlign: string;
/** @deprecated */
/** @deprecated This is a legacy alias of `boxFlex`. */
webkitBoxFlex: string;
/** @deprecated */
/** @deprecated This is a legacy alias of `boxOrdinalGroup`. */
webkitBoxOrdinalGroup: string;
/** @deprecated */
/** @deprecated This is a legacy alias of `boxOrient`. */
webkitBoxOrient: string;
/** @deprecated */
/** @deprecated This is a legacy alias of `boxPack`. */
webkitBoxPack: string;
/** @deprecated This is a legacy alias of `boxShadow`. */
webkitBoxShadow: string;
@ -3179,7 +3195,10 @@ declare var CSSTransition: {
new(): CSSTransition;
};
/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */
/**
* Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec.
* Available only in secure contexts.
*/
interface Cache {
add(request: RequestInfo): Promise<void>;
addAll(requests: RequestInfo[]): Promise<void>;
@ -3195,7 +3214,10 @@ declare var Cache: {
new(): Cache;
};
/** The storage for Cache objects. */
/**
* The storage for Cache objects.
* Available only in secure contexts.
*/
interface CacheStorage {
delete(cacheName: string): Promise<boolean>;
has(cacheName: string): Promise<boolean>;
@ -3427,6 +3449,7 @@ interface ChildNode extends Node {
interface ClientRect extends DOMRect {
}
/** Available only in secure contexts. */
interface Clipboard extends EventTarget {
read(): Promise<ClipboardItems>;
readText(): Promise<string>;
@ -3530,6 +3553,7 @@ declare var CountQueuingStrategy: {
new(init: QueuingStrategyInit): CountQueuingStrategy;
};
/** Available only in secure contexts. */
interface Credential {
readonly id: string;
readonly type: string;
@ -3540,6 +3564,7 @@ declare var Credential: {
new(): Credential;
};
/** Available only in secure contexts. */
interface CredentialsContainer {
create(options?: CredentialCreationOptions): Promise<Credential | null>;
get(options?: CredentialRequestOptions): Promise<Credential | null>;
@ -3554,6 +3579,7 @@ declare var CredentialsContainer: {
/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
interface Crypto {
/** Available only in secure contexts. */
readonly subtle: SubtleCrypto;
getRandomValues<T extends ArrayBufferView | null>(array: T): T;
}
@ -3563,7 +3589,10 @@ declare var Crypto: {
new(): Crypto;
};
/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */
/**
* The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
* Available only in secure contexts.
*/
interface CryptoKey {
readonly algorithm: KeyAlgorithm;
readonly extractable: boolean;
@ -4071,7 +4100,10 @@ declare var DelayNode: {
new(context: BaseAudioContext, options?: DelayOptions): DelayNode;
};
/** The DeviceMotionEvent provides web developers with information about the speed of changes for the device's position and orientation. */
/**
* The DeviceMotionEvent provides web developers with information about the speed of changes for the device's position and orientation.
* Available only in secure contexts.
*/
interface DeviceMotionEvent extends Event {
readonly acceleration: DeviceMotionEventAcceleration | null;
readonly accelerationIncludingGravity: DeviceMotionEventAcceleration | null;
@ -4084,19 +4116,24 @@ declare var DeviceMotionEvent: {
new(type: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent;
};
/** Available only in secure contexts. */
interface DeviceMotionEventAcceleration {
readonly x: number | null;
readonly y: number | null;
readonly z: number | null;
}
/** Available only in secure contexts. */
interface DeviceMotionEventRotationRate {
readonly alpha: number | null;
readonly beta: number | null;
readonly gamma: number | null;
}
/** The DeviceOrientationEvent provides web developers with information from the physical orientation of the device running the web page. */
/**
* The DeviceOrientationEvent provides web developers with information from the physical orientation of the device running the web page.
* Available only in secure contexts.
*/
interface DeviceOrientationEvent extends Event {
readonly absolute: boolean;
readonly alpha: number | null;
@ -4394,13 +4431,6 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad
* @param filter A custom NodeFilter function to use.
*/
createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker;
/**
* Returns the element for the specified x coordinate and the specified y coordinate.
* @param x The x-offset
* @param y The y-offset
*/
elementFromPoint(x: number, y: number): Element | null;
elementsFromPoint(x: number, y: number): Element[];
/**
* Executes a command on the current document, current selection, or the given range.
* @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
@ -4558,6 +4588,13 @@ interface DocumentOrShadowRoot {
readonly pointerLockElement: Element | null;
/** Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */
readonly styleSheets: StyleSheetList;
/**
* Returns the element for the specified x coordinate and the specified y coordinate.
* @param x The x-offset
* @param y The y-offset
*/
elementFromPoint(x: number, y: number): Element | null;
elementsFromPoint(x: number, y: number): Element[];
getAnimations(): Animation[];
}
@ -4785,6 +4822,16 @@ interface ElementContentEditable {
readonly isContentEditable: boolean;
}
interface ElementInternals extends ARIAMixin {
/** Returns the ShadowRoot for internals's target element, if the target element is a shadow host, or null otherwise. */
readonly shadowRoot: ShadowRoot | null;
}
declare var ElementInternals: {
prototype: ElementInternals;
new(): ElementInternals;
};
/** Events providing information related to errors in scripts or in files. */
interface ErrorEvent extends Event {
readonly colno: number;
@ -5024,13 +5071,10 @@ declare var FileSystemDirectoryEntry: {
new(): FileSystemDirectoryEntry;
};
/** @deprecated */
interface FileSystemDirectoryReader {
/** @deprecated */
readEntries(successCallback: FileSystemEntriesCallback, errorCallback?: ErrorCallback): void;
}
/** @deprecated */
declare var FileSystemDirectoryReader: {
prototype: FileSystemDirectoryReader;
new(): FileSystemDirectoryReader;
@ -5167,7 +5211,10 @@ declare var GainNode: {
new(context: BaseAudioContext, options?: GainOptions): GainNode;
};
/** This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. */
/**
* This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id.
* Available only in secure contexts.
*/
interface Gamepad {
readonly axes: ReadonlyArray<number>;
readonly buttons: ReadonlyArray<GamepadButton>;
@ -5184,7 +5231,10 @@ declare var Gamepad: {
new(): Gamepad;
};
/** An individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device. */
/**
* An individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device.
* Available only in secure contexts.
*/
interface GamepadButton {
readonly pressed: boolean;
readonly touched: boolean;
@ -5196,7 +5246,10 @@ declare var GamepadButton: {
new(): GamepadButton;
};
/** This Gamepad API interface contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. */
/**
* This Gamepad API interface contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to.
* Available only in secure contexts.
*/
interface GamepadEvent extends Event {
readonly gamepad: Gamepad;
}
@ -5233,6 +5286,7 @@ declare var Geolocation: {
new(): Geolocation;
};
/** Available only in secure contexts. */
interface GeolocationCoordinates {
readonly accuracy: number;
readonly altitude: number | null;
@ -5248,6 +5302,7 @@ declare var GeolocationCoordinates: {
new(): GeolocationCoordinates;
};
/** Available only in secure contexts. */
interface GeolocationPosition {
readonly coords: GeolocationCoordinates;
readonly timestamp: DOMTimeStamp;
@ -6072,6 +6127,7 @@ interface HTMLElement extends Element, DocumentAndElementEventHandlers, ElementC
spellcheck: boolean;
title: string;
translate: boolean;
attachInternals(): ElementInternals;
click(): void;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@ -6933,6 +6989,7 @@ interface HTMLMediaElement extends HTMLElement {
readonly error: MediaError | null;
/** Gets or sets a flag to specify whether playback should restart after it completes. */
loop: boolean;
/** Available only in secure contexts. */
readonly mediaKeys: MediaKeys | null;
/** Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. */
muted: boolean;
@ -6970,6 +7027,7 @@ interface HTMLMediaElement extends HTMLElement {
pause(): void;
/** Loads and starts playback of a media resource. */
play(): Promise<void>;
/** Available only in secure contexts. */
setMediaKeys(mediaKeys: MediaKeys | null): Promise<void>;
readonly HAVE_CURRENT_DATA: number;
readonly HAVE_ENOUGH_DATA: number;
@ -7523,6 +7581,7 @@ declare var HTMLSelectElement: {
interface HTMLSlotElement extends HTMLElement {
name: string;
assign(...nodes: (Element | Text)[]): void;
assignedElements(options?: AssignedNodesOptions): Element[];
assignedNodes(options?: AssignedNodesOptions): Node[];
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLSlotElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@ -8797,7 +8856,10 @@ declare var MediaCapabilities: {
new(): MediaCapabilities;
};
/** The MediaDevicesInfo interface contains information that describes a single media input or output device. */
/**
* The MediaDevicesInfo interface contains information that describes a single media input or output device.
* Available only in secure contexts.
*/
interface MediaDeviceInfo {
readonly deviceId: string;
readonly groupId: string;
@ -8815,7 +8877,10 @@ interface MediaDevicesEventMap {
"devicechange": Event;
}
/** Provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data. */
/**
* Provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data.
* Available only in secure contexts.
*/
interface MediaDevices extends EventTarget {
ondevicechange: ((this: MediaDevices, ev: Event) => any) | null;
enumerateDevices(): Promise<MediaDeviceInfo[]>;
@ -8872,7 +8937,10 @@ declare var MediaError: {
readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;
};
/** This EncryptedMediaExtensions API interface contains the content and related data when the content decryption module generates a message for the session. */
/**
* This EncryptedMediaExtensions API interface contains the content and related data when the content decryption module generates a message for the session.
* Available only in secure contexts.
*/
interface MediaKeyMessageEvent extends Event {
readonly message: ArrayBuffer;
readonly messageType: MediaKeyMessageType;
@ -8888,7 +8956,10 @@ interface MediaKeySessionEventMap {
"message": MediaKeyMessageEvent;
}
/** This EncryptedMediaExtensions API interface represents a context for message exchange with a content decryption module (CDM). */
/**
* This EncryptedMediaExtensions API interface represents a context for message exchange with a content decryption module (CDM).
* Available only in secure contexts.
*/
interface MediaKeySession extends EventTarget {
readonly closed: Promise<MediaKeySessionClosedReason>;
readonly expiration: number;
@ -8912,7 +8983,10 @@ declare var MediaKeySession: {
new(): MediaKeySession;
};
/** This EncryptedMediaExtensions API interface is a read-only map of media key statuses by key IDs. */
/**
* This EncryptedMediaExtensions API interface is a read-only map of media key statuses by key IDs.
* Available only in secure contexts.
*/
interface MediaKeyStatusMap {
readonly size: number;
get(keyId: BufferSource): MediaKeyStatus | undefined;
@ -8925,7 +8999,10 @@ declare var MediaKeyStatusMap: {
new(): MediaKeyStatusMap;
};
/** This EncryptedMediaExtensions API interface provides access to a Key System for decryption and/or a content protection provider. You can request an instance of this object using the Navigator.requestMediaKeySystemAccess method. */
/**
* This EncryptedMediaExtensions API interface provides access to a Key System for decryption and/or a content protection provider. You can request an instance of this object using the Navigator.requestMediaKeySystemAccess method.
* Available only in secure contexts.
*/
interface MediaKeySystemAccess {
readonly keySystem: string;
createMediaKeys(): Promise<MediaKeys>;
@ -8937,7 +9014,10 @@ declare var MediaKeySystemAccess: {
new(): MediaKeySystemAccess;
};
/** This EncryptedMediaExtensions API interface the represents a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback. */
/**
* This EncryptedMediaExtensions API interface the represents a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback.
* Available only in secure contexts.
*/
interface MediaKeys {
createSession(sessionType?: MediaKeySessionType): MediaKeySession;
setServerCertificate(serverCertificate: BufferSource): Promise<boolean>;
@ -9011,7 +9091,7 @@ declare var MediaQueryListEvent: {
interface MediaRecorderEventMap {
"dataavailable": BlobEvent;
"error": Event;
"error": MediaRecorderErrorEvent;
"pause": Event;
"resume": Event;
"start": Event;
@ -9022,7 +9102,7 @@ interface MediaRecorder extends EventTarget {
readonly audioBitsPerSecond: number;
readonly mimeType: string;
ondataavailable: ((this: MediaRecorder, ev: BlobEvent) => any) | null;
onerror: ((this: MediaRecorder, ev: Event) => any) | null;
onerror: ((this: MediaRecorder, ev: MediaRecorderErrorEvent) => any) | null;
onpause: ((this: MediaRecorder, ev: Event) => any) | null;
onresume: ((this: MediaRecorder, ev: Event) => any) | null;
onstart: ((this: MediaRecorder, ev: Event) => any) | null;
@ -9441,20 +9521,27 @@ declare var NamedNodeMap: {
/** The state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities. */
interface Navigator extends NavigatorAutomationInformation, NavigatorConcurrentHardware, NavigatorContentUtils, NavigatorCookies, NavigatorID, NavigatorLanguage, NavigatorNetworkInformation, NavigatorOnLine, NavigatorPlugins, NavigatorStorage {
/** Available only in secure contexts. */
readonly clipboard: Clipboard;
/** Available only in secure contexts. */
readonly credentials: CredentialsContainer;
readonly doNotTrack: string | null;
readonly geolocation: Geolocation;
readonly maxTouchPoints: number;
readonly mediaCapabilities: MediaCapabilities;
/** Available only in secure contexts. */
readonly mediaDevices: MediaDevices;
readonly mediaSession: MediaSession;
readonly permissions: Permissions;
readonly pointerEnabled: boolean;
/** Available only in secure contexts. */
readonly serviceWorker: ServiceWorkerContainer;
/** Available only in secure contexts. */
canShare(data?: ShareData): boolean;
getGamepads(): (Gamepad | null)[];
/** Available only in secure contexts. */
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise<MediaKeySystemAccess>;
sendBeacon(url: string | URL, data?: BodyInit | null): boolean;
/** Available only in secure contexts. */
share(data?: ShareData): Promise<void>;
vibrate(pattern: VibratePattern): boolean;
}
@ -9473,6 +9560,7 @@ interface NavigatorConcurrentHardware {
}
interface NavigatorContentUtils {
/** Available only in secure contexts. */
registerProtocolHandler(scheme: string, url: string | URL): void;
}
@ -9521,6 +9609,7 @@ interface NavigatorPlugins {
javaEnabled(): boolean;
}
/** Available only in secure contexts. */
interface NavigatorStorage {
readonly storage: StorageManager;
}
@ -9948,41 +10037,7 @@ declare var Path2D: {
new(path?: Path2D | string): Path2D;
};
/**
* This Payment Request API interface is used to store shipping or payment address information.
* @deprecated
*/
interface PaymentAddress {
/** @deprecated */
readonly addressLine: ReadonlyArray<string>;
/** @deprecated */
readonly city: string;
/** @deprecated */
readonly country: string;
/** @deprecated */
readonly dependentLocality: string;
/** @deprecated */
readonly organization: string;
/** @deprecated */
readonly phone: string;
/** @deprecated */
readonly postalCode: string;
/** @deprecated */
readonly recipient: string;
/** @deprecated */
readonly region: string;
/** @deprecated */
readonly sortingCode: string;
/** @deprecated */
toJSON(): any;
}
/** @deprecated */
declare var PaymentAddress: {
prototype: PaymentAddress;
new(): PaymentAddress;
};
/** Available only in secure contexts. */
interface PaymentMethodChangeEvent extends PaymentRequestUpdateEvent {
readonly methodDetails: any;
readonly methodName: string;
@ -9997,7 +10052,10 @@ interface PaymentRequestEventMap {
"paymentmethodchange": Event;
}
/** This Payment Request API interface is the primary access point into the API, and lets web content and apps accept payments from the end user. */
/**
* This Payment Request API interface is the primary access point into the API, and lets web content and apps accept payments from the end user.
* Available only in secure contexts.
*/
interface PaymentRequest extends EventTarget {
readonly id: string;
onpaymentmethodchange: ((this: PaymentRequest, ev: Event) => any) | null;
@ -10015,7 +10073,10 @@ declare var PaymentRequest: {
new(methodData: PaymentMethodData[], details: PaymentDetailsInit): PaymentRequest;
};
/** This Payment Request API interface enables a web page to update the details of a PaymentRequest in response to a user action. */
/**
* This Payment Request API interface enables a web page to update the details of a PaymentRequest in response to a user action.
* Available only in secure contexts.
*/
interface PaymentRequestUpdateEvent extends Event {
updateWith(detailsPromise: PaymentDetailsUpdate | PromiseLike<PaymentDetailsUpdate>): void;
}
@ -10025,7 +10086,10 @@ declare var PaymentRequestUpdateEvent: {
new(type: string, eventInitDict?: PaymentRequestUpdateEventInit): PaymentRequestUpdateEvent;
};
/** This Payment Request API interface is returned after a user selects a payment method and approves a payment request. */
/**
* This Payment Request API interface is returned after a user selects a payment method and approves a payment request.
* Available only in secure contexts.
*/
interface PaymentResponse extends EventTarget {
readonly details: any;
readonly methodName: string;
@ -10425,6 +10489,7 @@ interface PointerEvent extends MouseEvent {
readonly tiltY: number;
readonly twist: number;
readonly width: number;
/** Available only in secure contexts. */
getCoalescedEvents(): PointerEvent[];
getPredictedEvents(): PointerEvent[];
}
@ -10479,6 +10544,7 @@ declare var PromiseRejectionEvent: {
new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent;
};
/** Available only in secure contexts. */
interface PublicKeyCredential extends Credential {
readonly rawId: ArrayBuffer;
readonly response: AuthenticatorResponse;
@ -10491,7 +10557,10 @@ declare var PublicKeyCredential: {
isUserVerifyingPlatformAuthenticatorAvailable(): Promise<boolean>;
};
/** This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */
/**
* This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications.
* Available only in secure contexts.
*/
interface PushManager {
getSubscription(): Promise<PushSubscription | null>;
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
@ -10504,7 +10573,10 @@ declare var PushManager: {
readonly supportedContentEncodings: ReadonlyArray<string>;
};
/** This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. */
/**
* This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service.
* Available only in secure contexts.
*/
interface PushSubscription {
readonly endpoint: string;
readonly options: PushSubscriptionOptions;
@ -10518,6 +10590,7 @@ declare var PushSubscription: {
new(): PushSubscription;
};
/** Available only in secure contexts. */
interface PushSubscriptionOptions {
readonly applicationServerKey: ArrayBuffer | null;
}
@ -10910,7 +10983,6 @@ interface ReadableStream<R = any> {
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
tee(): [ReadableStream<R>, ReadableStream<R>];
forEach(callbackfn: (value: any, key: number, parent: ReadableStream<R>) => void, thisArg?: any): void;
}
declare var ReadableStream: {
@ -12898,7 +12970,10 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap {
"statechange": Event;
}
/** This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */
/**
* This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object.
* Available only in secure contexts.
*/
interface ServiceWorker extends EventTarget, AbstractWorker {
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
readonly scriptURL: string;
@ -12922,7 +12997,10 @@ interface ServiceWorkerContainerEventMap {
"messageerror": MessageEvent;
}
/** The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. */
/**
* The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations.
* Available only in secure contexts.
*/
interface ServiceWorkerContainer extends EventTarget {
readonly controller: ServiceWorker | null;
oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null;
@ -12948,7 +13026,10 @@ interface ServiceWorkerRegistrationEventMap {
"updatefound": Event;
}
/** This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */
/**
* This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin.
* Available only in secure contexts.
*/
interface ServiceWorkerRegistration extends EventTarget {
readonly active: ServiceWorker | null;
readonly installing: ServiceWorker | null;
@ -13266,6 +13347,7 @@ declare var StorageEvent: {
new(type: string, eventInitDict?: StorageEventInit): StorageEvent;
};
/** Available only in secure contexts. */
interface StorageManager {
estimate(): Promise<StorageEstimate>;
persist(): Promise<boolean>;
@ -13321,7 +13403,10 @@ declare var SubmitEvent: {
new(type: string, eventInitDict?: SubmitEventInit): SubmitEvent;
};
/** This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). */
/**
* This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto).
* Available only in secure contexts.
*/
interface SubtleCrypto {
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<any>;
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
@ -13348,7 +13433,6 @@ declare var SubtleCrypto: {
/** The textual content of Element or Attr. If an element has no markup within its content, it has a single child implementing Text that contains the element's text. However, if the element contains markup, it is parsed into information items and Text nodes that form its children. */
interface Text extends CharacterData, Slottable {
readonly assignedSlot: HTMLSlotElement | null;
/** Returns the combined data of all direct Text node siblings. */
readonly wholeText: string;
/** Splits data at the given offset and returns the remainder as Text node. */
@ -16032,7 +16116,9 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
readonly menubar: BarProp;
name: string;
readonly navigator: Navigator;
/** Available only in secure contexts. */
ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null;
/** Available only in secure contexts. */
ondeviceorientation: ((this: Window, ev: DeviceOrientationEvent) => any) | null;
/** @deprecated */
onorientationchange: ((this: Window, ev: Event) => any) | null;
@ -16180,6 +16266,7 @@ interface WindowLocalStorage {
}
interface WindowOrWorkerGlobalScope {
/** Available only in secure contexts. */
readonly caches: CacheStorage;
readonly crossOriginIsolated: boolean;
readonly crypto: Crypto;
@ -16228,6 +16315,7 @@ declare var Worker: {
new(scriptURL: string | URL, options?: WorkerOptions): Worker;
};
/** Available only in secure contexts. */
interface Worklet {
/**
* Loads and executes the module script given by moduleURL into all of worklet's global scopes. It can also create additional global scopes as part of this process, depending on the worklet type. The returned promise will fulfill once the script has been successfully loaded and run in all global scopes.
@ -16573,7 +16661,8 @@ declare namespace WebAssembly {
var CompileError: {
prototype: CompileError;
new(): CompileError;
new(message?: string): CompileError;
(message?: string): CompileError;
};
interface Global {
@ -16600,7 +16689,8 @@ declare namespace WebAssembly {
var LinkError: {
prototype: LinkError;
new(): LinkError;
new(message?: string): LinkError;
(message?: string): LinkError;
};
interface Memory {
@ -16629,7 +16719,8 @@ declare namespace WebAssembly {
var RuntimeError: {
prototype: RuntimeError;
new(): RuntimeError;
new(message?: string): RuntimeError;
(message?: string): RuntimeError;
};
interface Table {
@ -16774,7 +16865,7 @@ interface PositionErrorCallback {
}
interface QueuingStrategySize<T = any> {
(chunk?: T): number;
(chunk: T): number;
}
interface RTCPeerConnectionErrorCallback {
@ -17066,7 +17157,9 @@ declare var menubar: BarProp;
/** @deprecated */
declare const name: void;
declare var navigator: Navigator;
/** Available only in secure contexts. */
declare var ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null;
/** Available only in secure contexts. */
declare var ondeviceorientation: ((this: Window, ev: DeviceOrientationEvent) => any) | null;
/** @deprecated */
declare var onorientationchange: ((this: Window, ev: Event) => any) | null;
@ -17447,6 +17540,7 @@ declare var onstorage: ((this: Window, ev: StorageEvent) => any) | null;
declare var onunhandledrejection: ((this: Window, ev: PromiseRejectionEvent) => any) | null;
declare var onunload: ((this: Window, ev: Event) => any) | null;
declare var localStorage: Storage;
/** Available only in secure contexts. */
declare var caches: CacheStorage;
declare var crossOriginIsolated: boolean;
declare var crypto: Crypto;
@ -17609,7 +17703,7 @@ type OscillatorType = "custom" | "sawtooth" | "sine" | "square" | "triangle";
type OverSampleType = "2x" | "4x" | "none";
type PanningModelType = "HRTF" | "equalpower";
type PaymentComplete = "fail" | "success" | "unknown";
type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock";
type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock" | "xr-spatial-tracking";
type PermissionState = "denied" | "granted" | "prompt";
type PlaybackDirection = "alternate" | "alternate-reverse" | "normal" | "reverse";
type PositionAlignSetting = "auto" | "center" | "line-left" | "line-right";

View file

@ -135,6 +135,7 @@ interface NamedNodeMap {
}
interface Navigator {
/** Available only in secure contexts. */
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: Iterable<MediaKeySystemConfiguration>): Promise<MediaKeySystemAccess>;
vibrate(pattern: Iterable<number>): boolean;
}
@ -170,13 +171,6 @@ interface PluginArray {
interface RTCStatsReport extends ReadonlyMap<string, any> {
}
interface ReadableStream<R = any> {
[Symbol.iterator](): IterableIterator<any>;
entries(): IterableIterator<[number, any]>;
keys(): IterableIterator<number>;
values(): IterableIterator<any>;
}
interface SVGLengthList {
[Symbol.iterator](): IterableIterator<SVGLength>;
}

View file

@ -200,7 +200,7 @@ declare namespace Intl {
interface NumberFormatOptions {
compactDisplay?: "short" | "long" | undefined;
notation?: "standard" | "scientific" | "engineering" | "compact" | undefined;
signDisplay?: "auto" | "never" | "always" | undefined;
signDisplay?: "auto" | "never" | "always" | "exceptZero" | undefined;
unit?: string | undefined;
unitDisplay?: "short" | "long" | "narrow" | undefined;
}
@ -208,7 +208,7 @@ declare namespace Intl {
interface ResolvedNumberFormatOptions {
compactDisplay?: "short" | "long";
notation?: "standard" | "scientific" | "engineering" | "compact";
signDisplay?: "auto" | "never" | "always";
signDisplay?: "auto" | "never" | "always" | "exceptZero";
unit?: string;
unitDisplay?: "short" | "long" | "narrow";
}

103
src/lib/es2022.array.d.ts vendored Normal file
View file

@ -0,0 +1,103 @@
interface Array<T> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): T | undefined;
}
interface ReadonlyArray<T> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): T | undefined;
}
interface Int8Array {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): number | undefined;
}
interface Uint8Array {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): number | undefined;
}
interface Uint8ClampedArray {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): number | undefined;
}
interface Int16Array {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): number | undefined;
}
interface Uint16Array {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): number | undefined;
}
interface Int32Array {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): number | undefined;
}
interface Uint32Array {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): number | undefined;
}
interface Float32Array {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): number | undefined;
}
interface Float64Array {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): number | undefined;
}
interface BigInt64Array {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): bigint | undefined;
}
interface BigUint64Array {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): bigint | undefined;
}

5
src/lib/es2022.d.ts vendored Normal file
View file

@ -0,0 +1,5 @@
/// <reference lib="es2021" />
/// <reference lib="es2022.array" />
/// <reference lib="es2022.error" />
/// <reference lib="es2022.object" />
/// <reference lib="es2022.string" />

8
src/lib/es2022.error.d.ts vendored Normal file
View file

@ -0,0 +1,8 @@
interface ErrorOptions {
cause?: Error;
}
interface ErrorConstructor {
new(message?: string, options?: ErrorOptions): Error;
(message?: string, options?: ErrorOptions): Error;
}

5
src/lib/es2022.full.d.ts vendored Normal file
View file

@ -0,0 +1,5 @@
/// <reference lib="es2022" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />

8
src/lib/es2022.object.d.ts vendored Normal file
View file

@ -0,0 +1,8 @@
interface Object {
/**
* Determines whether an object has a property with the specified name.
* @param o An object.
* @param v A property name.
*/
hasOwn(o: object, v: PropertyKey): boolean;
}

7
src/lib/es2022.string.d.ts vendored Normal file
View file

@ -0,0 +1,7 @@
interface String {
/**
* Returns a new String consisting of the single UTF-16 code unit located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
*/
at(index: number): string | undefined;
}

6
src/lib/es5.d.ts vendored
View file

@ -96,7 +96,7 @@ interface PropertyDescriptor {
}
interface PropertyDescriptorMap {
[s: string]: PropertyDescriptor;
[key: PropertyKey]: PropertyDescriptor;
}
interface Object {
@ -196,13 +196,13 @@ interface ObjectConstructor {
/**
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
* @param o Object on which to lock the attributes.
* @param a Object on which to lock the attributes.
*/
freeze<T>(a: T[]): readonly T[];
/**
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
* @param o Object on which to lock the attributes.
* @param f Object on which to lock the attributes.
*/
freeze<T extends Function>(f: T): T;

2
src/lib/esnext.d.ts vendored
View file

@ -1,2 +1,2 @@
/// <reference lib="es2021" />
/// <reference lib="es2022" />
/// <reference lib="esnext.intl" />

View file

@ -9,6 +9,7 @@
"es2019",
"es2020",
"es2021",
"es2022",
"esnext",
// Host only
"dom.generated",
@ -52,6 +53,10 @@
"es2021.promise",
"es2021.weakref",
"es2021.intl",
"es2022.array",
"es2022.error",
"es2022.object",
"es2022.string",
"esnext.intl",
// Default libraries
"es5.full",
@ -62,6 +67,7 @@
"es2019.full",
"es2020.full",
"es2021.full",
"es2022.full",
"esnext.full"
],
"paths": {

View file

@ -477,7 +477,7 @@ interface RequestInit {
/** An AbortSignal to set request's signal. */
signal?: AbortSignal | null;
/** Can only be null. Used to disassociate request from any Window. */
window?: any;
window?: null;
}
interface ResponseInit {
@ -671,7 +671,7 @@ interface AbortSignal extends EventTarget {
declare var AbortSignal: {
prototype: AbortSignal;
new(): AbortSignal;
// abort(): AbortSignal;
// abort(): AbortSignal; - To be re-added in the future
};
interface AbstractWorkerEventMap {
@ -752,7 +752,10 @@ declare var ByteLengthQueuingStrategy: {
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
};
/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */
/**
* Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec.
* Available only in secure contexts.
*/
interface Cache {
add(request: RequestInfo): Promise<void>;
addAll(requests: RequestInfo[]): Promise<void>;
@ -768,7 +771,10 @@ declare var Cache: {
new(): Cache;
};
/** The storage for Cache objects. */
/**
* The storage for Cache objects.
* Available only in secure contexts.
*/
interface CacheStorage {
delete(cacheName: string): Promise<boolean>;
has(cacheName: string): Promise<boolean>;
@ -876,6 +882,7 @@ declare var CountQueuingStrategy: {
/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
interface Crypto {
/** Available only in secure contexts. */
readonly subtle: SubtleCrypto;
getRandomValues<T extends ArrayBufferView | null>(array: T): T;
}
@ -885,7 +892,10 @@ declare var Crypto: {
new(): Crypto;
};
/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */
/**
* The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
* Available only in secure contexts.
*/
interface CryptoKey {
readonly algorithm: KeyAlgorithm;
readonly extractable: boolean;
@ -2137,6 +2147,7 @@ interface NavigatorOnLine {
readonly onLine: boolean;
}
/** Available only in secure contexts. */
interface NavigatorStorage {
readonly storage: StorageManager;
}
@ -2431,7 +2442,10 @@ declare var PromiseRejectionEvent: {
new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent;
};
/** This Push API interface represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription. */
/**
* This Push API interface represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription.
* Available only in secure contexts.
*/
interface PushEvent extends ExtendableEvent {
readonly data: PushMessageData | null;
}
@ -2441,7 +2455,10 @@ declare var PushEvent: {
new(type: string, eventInitDict?: PushEventInit): PushEvent;
};
/** This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */
/**
* This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications.
* Available only in secure contexts.
*/
interface PushManager {
getSubscription(): Promise<PushSubscription | null>;
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
@ -2454,7 +2471,10 @@ declare var PushManager: {
readonly supportedContentEncodings: ReadonlyArray<string>;
};
/** This Push API interface provides methods which let you retrieve the push data sent by a server in various formats. */
/**
* This Push API interface provides methods which let you retrieve the push data sent by a server in various formats.
* Available only in secure contexts.
*/
interface PushMessageData {
arrayBuffer(): ArrayBuffer;
blob(): Blob;
@ -2467,7 +2487,10 @@ declare var PushMessageData: {
new(): PushMessageData;
};
/** This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. */
/**
* This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service.
* Available only in secure contexts.
*/
interface PushSubscription {
readonly endpoint: string;
readonly options: PushSubscriptionOptions;
@ -2481,6 +2504,7 @@ declare var PushSubscription: {
new(): PushSubscription;
};
/** Available only in secure contexts. */
interface PushSubscriptionOptions {
readonly applicationServerKey: ArrayBuffer | null;
}
@ -2498,7 +2522,6 @@ interface ReadableStream<R = any> {
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
tee(): [ReadableStream<R>, ReadableStream<R>];
forEach(callbackfn: (value: any, key: number, parent: ReadableStream<R>) => void, thisArg?: any): void;
}
declare var ReadableStream: {
@ -2613,7 +2636,10 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap {
"statechange": Event;
}
/** This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */
/**
* This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object.
* Available only in secure contexts.
*/
interface ServiceWorker extends EventTarget, AbstractWorker {
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
readonly scriptURL: string;
@ -2637,7 +2663,10 @@ interface ServiceWorkerContainerEventMap {
"messageerror": MessageEvent;
}
/** The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. */
/**
* The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations.
* Available only in secure contexts.
*/
interface ServiceWorkerContainer extends EventTarget {
readonly controller: ServiceWorker | null;
oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null;
@ -2698,7 +2727,10 @@ interface ServiceWorkerRegistrationEventMap {
"updatefound": Event;
}
/** This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */
/**
* This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin.
* Available only in secure contexts.
*/
interface ServiceWorkerRegistration extends EventTarget {
readonly active: ServiceWorker | null;
readonly installing: ServiceWorker | null;
@ -2743,6 +2775,7 @@ declare var SharedWorkerGlobalScope: {
new(): SharedWorkerGlobalScope;
};
/** Available only in secure contexts. */
interface StorageManager {
estimate(): Promise<StorageEstimate>;
persisted(): Promise<boolean>;
@ -2753,7 +2786,10 @@ declare var StorageManager: {
new(): StorageManager;
};
/** This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). */
/**
* This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto).
* Available only in secure contexts.
*/
interface SubtleCrypto {
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<any>;
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
@ -5030,6 +5066,7 @@ declare var WindowClient: {
};
interface WindowOrWorkerGlobalScope {
/** Available only in secure contexts. */
readonly caches: CacheStorage;
readonly crossOriginIsolated: boolean;
readonly crypto: Crypto;
@ -5352,7 +5389,8 @@ declare namespace WebAssembly {
var CompileError: {
prototype: CompileError;
new(): CompileError;
new(message?: string): CompileError;
(message?: string): CompileError;
};
interface Global {
@ -5379,7 +5417,8 @@ declare namespace WebAssembly {
var LinkError: {
prototype: LinkError;
new(): LinkError;
new(message?: string): LinkError;
(message?: string): LinkError;
};
interface Memory {
@ -5408,7 +5447,8 @@ declare namespace WebAssembly {
var RuntimeError: {
prototype: RuntimeError;
new(): RuntimeError;
new(message?: string): RuntimeError;
(message?: string): RuntimeError;
};
interface Table {
@ -5485,7 +5525,7 @@ interface PerformanceObserverCallback {
}
interface QueuingStrategySize<T = any> {
(chunk?: T): number;
(chunk: T): number;
}
interface TransformerFlushCallback<O> {
@ -5560,6 +5600,7 @@ declare function importScripts(...urls: (string | URL)[]): void;
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
declare function dispatchEvent(event: Event): boolean;
declare var fonts: FontFaceSet;
/** Available only in secure contexts. */
declare var caches: CacheStorage;
declare var crossOriginIsolated: boolean;
declare var crypto: Crypto;
@ -5648,7 +5689,7 @@ type MediaDecodingType = "file" | "media-source" | "webrtc";
type MediaEncodingType = "record" | "webrtc";
type NotificationDirection = "auto" | "ltr" | "rtl";
type NotificationPermission = "default" | "denied" | "granted";
type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock";
type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock" | "xr-spatial-tracking";
type PermissionState = "denied" | "granted" | "prompt";
type PredefinedColorSpace = "display-p3" | "srgb";
type PremultiplyAlpha = "default" | "none" | "premultiply";

View file

@ -56,13 +56,6 @@ interface MessageEvent<T = any> {
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void;
}
interface ReadableStream<R = any> {
[Symbol.iterator](): IterableIterator<any>;
entries(): IterableIterator<[number, any]>;
keys(): IterableIterator<number>;
values(): IterableIterator<any>;
}
interface SubtleCrypto {
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>;

View file

@ -468,6 +468,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[映射的类型可能不声明属性或方法。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -3003,6 +3012,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[找不到命名空间“{0}”。你是否指的是“{1}”?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4056,11 +4074,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[转换为 ES6 模块]]></Val>
<Val><![CDATA[转换为 ES 模块]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5205,15 +5223,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[仅当 '--module' 标志设置为 'es2020'、'esnext'、 'commonjs'、'amd'、'system'、'umd'、'node12' 或 'nodenext' 时,才支持动态导入。]]></Val>
<Val><![CDATA[仅当 '--module' 标志设置为 'es2020'、'es2022'、'esnext'、 'commonjs'、'amd'、'system'、'umd'、'node12' 或 'nodenext' 时,才支持动态导入。]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6288,11 +6303,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[文件是 CommonJS 模块;它可能会转换为 ES6 模块。]]></Val>
<Val><![CDATA[文件是 CommonJS 模块; 它可能会转换为 ES 模块。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7749,6 +7764,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[JSON 导入在 ES 模块模式导入中是实验性的。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12534,11 +12558,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[仅当 '--module' 选项为 'es2020'、'esnext'、 'system'、'node12' 或 'nodenext' 时,才允许 'import.meta' 元属性。]]></Val>
<Val><![CDATA[仅当 '--module' 选项为 'es2020'、'es2022'、'esnext'、 'system'、'node12' 或 'nodenext' 时,才允许 'import.meta' 元属性。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13437,11 +13461,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[仅当 'module' 选项设置为 'esnext'、'system' 或 'nodenext',且 'target' 选项设置为 'es2017' 或更高版本时,才允许顶级 'await' 表达式。]]></Val>
<Val><![CDATA[仅当 'module' 选项设置为 'es2022'、'esnext'、'system' 或 'nodenext',且 'target' 选项设置为 'es2017' 或更高版本时,才允许顶级 'await' 表达式。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13455,11 +13479,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[仅当 'module' 选项设置为 'esnext'、'system' 或 'nodenext',且 'target' 选项设置为 'es2017' 或更高版本时,才允许顶级 'for await' 循环。]]></Val>
<Val><![CDATA[仅当 'module' 选项设置为 'es2022'、'esnext'、'system' 或 'nodenext',且 'target' 选项设置为 'es2017' 或更高版本时,才允许顶级 'for await' 循环。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15252,6 +15276,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[不允许将 '{0}' 作为参数名。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -468,6 +468,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[對應型別不能宣告屬性或方法。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -3003,6 +3012,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[找不到命名空間 '{0}'。您是不是指 '{1}'?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4056,11 +4074,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[轉換為 ES6 模組]]></Val>
<Val><![CDATA[轉換為 ES 模組]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5205,15 +5223,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[只有在 '--module' 旗標設定為 'es2020'、'esnext'、'commonjs'、'amd'、'system'、'umd'、'node12' 或 'nodenext',才支援動態匯入。]]></Val>
<Val><![CDATA[只有在 '--module' 旗標設定為 'es2020'、'es2022'、'esnext'、'commonjs'、'amd'、'system'、'umd'、'node12' 或 'nodenext',才支援動態匯入。]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6288,11 +6303,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[檔案為 CommonJS 模組; 其可轉換為 ES6 模組。]]></Val>
<Val><![CDATA[檔案為 CommonJS 模組; 其可轉換為 ES 模組。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7749,6 +7764,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[JSON 匯入在 ES 模組模式匯入中為實驗性。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12534,11 +12558,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[只有當 '--module' 選項為 'es2020'、'esnext'、'system'、, 'node12' 或 'nodenext' 時,才允許 'import.meta' 中繼屬性。]]></Val>
<Val><![CDATA[只有當 '--module' 選項為 'es2020'、'es2022'、'esnext'、'system'、, 'node12' 或 'nodenext' 時,才允許 'import.meta' 中繼屬性。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13437,11 +13461,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[只有在 'module' 選項設定為 'esnext'、'system' 或 'nodenext',而且 'target' 選項設定為 'es2017' 或更高版本時,才允許最上層的 'await' 運算式。]]></Val>
<Val><![CDATA[只有在 'module' 選項設定為 'es2022'、'esnext'、'system' 或 'nodenext',而且 'target' 選項設定為 'es2017' 或更高版本時,才允許最上層的 'await' 運算式。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13455,11 +13479,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[只有在 'module' 選項設為 'esnext'、'system' 或 'nodenext',而且 'target' 選項設為 'es2017' 或更高版本時,才允許最上層的 'for await' 迴圈。]]></Val>
<Val><![CDATA[只有在 'module' 選項設為 'es2022'、'esnext'、'system' 或 'nodenext',而且 'target' 選項設為 'es2017' 或更高版本時,才允許最上層的 'for await' 迴圈。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15252,6 +15276,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[不允許 '{0}' 做為參數名稱。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -477,6 +477,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Mapovaný typ nemůže deklarovat vlastnosti nebo metody.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -3012,6 +3021,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Obor názvů {0} nejde najít. Měli jste na mysli „{1}“?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4065,11 +4083,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Převést na modul ES6]]></Val>
<Val><![CDATA[Převést na modul ES]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5214,15 +5232,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Dynamické importy se podporují jen v případě, že příznak --module je nastavený na es2020, esnext, commonjs, amd, system, umd, node12 nebo nodenext.]]></Val>
<Val><![CDATA[Dynamické importy se podporují jen v případě, že příznak --module je nastavený na es2020, es2022, esnext, commonjs, amd, system, umd, node12 nebo nodenext.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6297,11 +6312,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Soubor je modul CommonJS; může se převést na modul ES6.]]></Val>
<Val><![CDATA[Soubor je modul CommonJS; může být převeden na modul ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7758,6 +7773,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Importy JSON jsou v importech režimu modulu ES experimentální.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12543,11 +12567,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Metavlastnost import.meta se povoluje jen v případě, že možnost --module je nastavená na es2020, esnext, system, node12 nebo nodenext.]]></Val>
<Val><![CDATA[Metavlastnost import.meta se povoluje jen v případě, že možnost --module je nastavená na es2020, es2022, esnext, system, node12 nebo nodenext.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13446,11 +13470,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Výrazy await nejvyšší úrovně se povolují jen v případě, že možnost module je nastavená na esnext, system nebo nodenext a možnost target je nastavená na es2017 nebo vyšší.]]></Val>
<Val><![CDATA[Výrazy await nejvyšší úrovně se povolují jen v případě, že možnost module je nastavená na es2022, esnext, system nebo nodenext a možnost target je nastavená na es2017 nebo vyšší.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13464,11 +13488,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Smyčky for await nejvyšší úrovně se povolují jen v případě, že možnost module je nastavená na esnext, system nebo nodenext a možnost target je nastavená na es2017 nebo vyšší.]]></Val>
<Val><![CDATA[Smyčky for await nejvyšší úrovně se povolují jen v případě, že možnost module je nastavená na es2022, esnext, system nebo nodenext a možnost target je nastavená na es2017 nebo vyšší.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15261,6 +15285,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[{0} není povolen jako název parametru.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -468,6 +468,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Ein zugeordneter Typ darf keine Eigenschaften oder Methoden deklarieren.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -3000,6 +3009,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Namespace "{0}" wurde nicht gefunden. Meinten Sie "{1}"?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4053,11 +4071,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[In ES6-Modul konvertieren]]></Val>
<Val><![CDATA[In ES-Modul konvertieren]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5202,15 +5220,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Dynamische Importe werden nur unterstützt, wenn das Kennzeichen "--module" auf "es2020", "esnext", "commonjs", "amd", "system", "umd", "node12" oder "nodenext" festgelegt ist.]]></Val>
<Val><![CDATA[Dynamische Importe werden nur unterstützt, wenn das "--module"-Kennzeichen auf "es2020", "es2022", "esnext", "commonjs", "amd", "system", "umd", "node12" oder "nodenext" festgelegt ist.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6285,11 +6300,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Die Datei ist ein CommonJS-Modul, sie kann in ein ES6-Modul konvertiert werden.]]></Val>
<Val><![CDATA[Die Datei ist ein CommonJS-Modul und kann möglicherweise in ein ES-Modul konvertiert werden.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7746,6 +7761,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[JSON-Importe sind experimentell in Importen im ES-Modulmodus.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12528,11 +12552,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Die Metaeigenschaft „import.meta“ ist nur zulässig, wenn die Option „--module“ den Wert „es2020“, „esnext“, „system“, „node12“, oder „nodenext“ aufweist.]]></Val>
<Val><![CDATA[Die Metaeigenschaft "import.meta" ist nur zulässig, wenn die „--module“-Option "es2020", "es2022", "esnext", "system", "node12" oder "nodenext" lautet.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13431,11 +13455,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[„Await“-Schleifen der obersten Ebene sind nur zulässig, wenn die Option "module" auf "esnext", "system" oder "nodenext", und die Option "target" auf "es2017" oder höher festgelegt ist.]]></Val>
<Val><![CDATA[„Await“-Ausdrücke der obersten Ebene sind nur zulässig, wenn die Option "module" auf "es2022", "esnext", "system" oder "nodenext" festgelegt ist und die Option "target" auf "es2017" oder höher festgelegt ist.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13449,11 +13473,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[„For Await“-Schleifen der obersten Ebene sind nur zulässig, wenn die Option "module" auf "esnext", "system" oder "nodenext" und die Option "target" auf "es2017" oder höher festgelegt ist.]]></Val>
<Val><![CDATA[„For Await“-Schleifen der obersten Ebene sind nur zulässig, wenn die „module“-Option auf "es2022", "esnext", "system" oder "nodenext" festgelegt ist und die Option "target" auf "es2017" oder höher festgelegt ist.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15246,6 +15270,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA["{0}" ist als Parametername nicht zulässig.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -477,6 +477,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Un tipo asignado no puede declarar propiedades ni métodos.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -3015,6 +3024,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[No se encuentra el espacio de nombres "{0}". ¿Quería decir "{1}"?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4068,11 +4086,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Convertir en módulo ES6]]></Val>
<Val><![CDATA[Convertir en módulo ES]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5217,15 +5235,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Las importaciones dinámicas solo se admiten cuando la marca "--módulo" se establece en "es2020", "esnext", "commonjs", "amd", "system", "umd", "node12" o "nodenext".]]></Val>
<Val><![CDATA[Las importaciones dinámicas solo se admiten cuando la marca "--módulo" está establecida en "es2020", "es2022", "esnext", "commonjs", "amd", "system", "umd", "node12" o "nodenext".]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6300,11 +6315,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[El archivo es un módulo CommonJS; se puede convertir a un módulo ES6.]]></Val>
<Val><![CDATA[El archivo es un módulo CommonJS; se puede convertir en un módulo ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7761,6 +7776,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Las importaciones de JSON son experimentales en las importaciones del modo de módulo ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12546,11 +12570,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La metapropiedad "import.meta" solo se permite cuando la opción "--módulo" es "es2020", "esnext", "system", "node12" o "nodenext".]]></Val>
<Val><![CDATA[La metapropiedad "import.meta" solo se permite cuando la opción "--módulo" es "es2020", "es2022", "esnext", "system", "node12" o "nodenext".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13449,11 +13473,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Las expresiones "await" de nivel superior solo se permiten cuando la opción "módulo" se establece en "esnext", "system" o "nodenext" y la opción "destino" se establece en "es2017" o superior.]]></Val>
<Val><![CDATA[Las expresiones "await" de nivel superior solo se permiten cuando la opción "módulo" está establecida en "es2022", "esnext", "system" o "nodenext", y la opción "destino" está establecida en "es2017" o superior.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13467,11 +13491,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Los bucles "for await" de nivel superior solo se permiten cuando la opción "módulo" se establece en "esnext", "system" o "nodenext", y la opción "destino" se establece en "es2017" o superior.]]></Val>
<Val><![CDATA[Los bucles "for await" de nivel superior solo se permiten cuando la opción "módulo" está establecida en "es2022", "esnext", "system" o "nodenext", y la opción "destino" está establecida en "es2017" o superior.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15264,6 +15288,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[No se permite “{0}” como nombre de parámetro.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -477,6 +477,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Un type mappé ne peut pas déclarer de propriétés ou de méthodes.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -3015,6 +3024,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Impossible de trouver l'espace de noms '{0}'. Vouliez-vous dire '{1}'?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4068,11 +4086,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Convertir en module ES6]]></Val>
<Val><![CDATA[Convertir en module ES]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5217,15 +5235,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Les importations dynamiques ne sont prises en charge que lorsque lindicateur « --module » est défini sur « es2020 », « esnext », « commonjs », « amd », « system », « umd », « node12 » ou « nodenext ».]]></Val>
<Val><![CDATA[Les importations dynamiques sont prises en charge uniquement lorsque lindicateur « --module » est défini sur « es2020 », « es2022 », « esnext », « commonjs », « amd », « system », « umd », « node12 » ou « nodenext ».]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6300,11 +6315,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Le fichier est un module CommonJS ; il peut être converti en module ES6.]]></Val>
<Val><![CDATA[Le fichier est un module CommonJS ; il peut être converti en module ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7761,6 +7776,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Les importations JSON sont expérimentales dans les importations en mode module ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12546,11 +12570,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La métapropriété « import.meta » n'est autorisée que lorsque l'option « --module » est « es2020 », « esnext », « system », « node12 » ou « nodenext ».]]></Val>
<Val><![CDATA[La méta-propriété « import.meta » est autorisée uniquement lorsque loption « --module » est « es2020 », « es2022 », « esnext », « system », « node12 » ou « nodenext ».]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13449,11 +13473,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Les expressions « await » de niveau supérieur ne sont autorisées que lorsque loption « module » est définie sur « esnext », « system » ou « nodenext » et que loption « target » est définie sur « es2017 » ou plus.]]></Val>
<Val><![CDATA[Les expressions « await » de niveau supérieur sont autorisées uniquement lorsque loption « module » a la valeur « es2022 », « esnext », « system » ou « nodenext », et que loption « target » a la valeur « es2017 » ou une valeur supérieure.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13467,11 +13491,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Les boucles « for await » de niveau supérieur ne sont autorisées que lorsque l'option « module » est définie sur « esnext », « system » ou « nodenext » et que loption « target » est définie sur « es2017 » ou plus.]]></Val>
<Val><![CDATA[Les boucles « for await » de niveau supérieur sont autorisées uniquement lorsque loption « module » a la valeur « es2022 », « esnext », « system » ou « nodenext », et que loption « target » est définie sur « es2017 » ou une version ultérieure.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15264,6 +15288,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' n'est pas autorisé comme nom de paramètre.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -468,6 +468,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Un tipo di cui è stato eseguito il mapping non può dichiarare proprietà o metodi.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -3003,6 +3012,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Il nome '{0}' non è stato trovato. Intendevi '{1}'?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4056,11 +4074,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Convertire nel modulo ES6]]></Val>
<Val><![CDATA[Converti nel modulo ES6]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5205,15 +5223,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Le importazioni dinamiche sono supportate solo quando il flag '--module' è impostato su 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'node12' o 'nodenext'.]]></Val>
<Val><![CDATA[Le importazioni dinamiche sono supportate solo quando il flag '--module' è impostato su 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12' o 'nodenext'.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6288,11 +6303,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Il file è un modulo CommonJS; può essere convertito in un modulo ES6.]]></Val>
<Val><![CDATA[Il file è un modulo CommonJS e può essere convertito in un modulo ES6.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7749,6 +7764,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Le importazioni JSON sono sperimentali nelle importazioni in modalità modulo ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12534,11 +12558,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La metaproprietà 'import.meta' è consentita solo se l'opzione '--module' è impostata su 'es2020', 'esnext', 'system', 'node12' o 'nodenext'.]]></Val>
<Val><![CDATA[La metaproprietà 'import.meta' è consentita solo se l'opzione '--module' è impostata su 'es2020', 'es2022', 'esnext', 'system', 'node12' o 'nodenext'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13437,11 +13461,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Le espressioni 'await' di primo livello sono consentite solo quando l'opzione 'module' è impostata su 'esnext', 'system' o 'nodenext' e l'opzione 'target' è impostata su 'es2017' o versione successiva.]]></Val>
<Val><![CDATA[Le espressioni 'await' di primo livello sono consentite solo quando l'opzione 'module' è impostata su 'es2022', 'esnext', 'system' o 'nodenext' e l'opzione 'target' è impostata su 'es2017' o versione successiva.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13455,11 +13479,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[I cicli 'for await' di primo livello sono consentiti solo quando l'opzione 'module' è impostata su 'esnext', 'system' o 'nodenext' e l'opzione 'target' è impostata su 'es2017' o versione successiva.]]></Val>
<Val><![CDATA[I cicli 'for await' di primo livello sono consentiti solo quando l'opzione 'module' è impostata su 'es2022', 'esnext', 'system' o 'nodenext' e l'opzione 'target' è impostata su 'es2017' o versione successiva.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15252,6 +15276,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' non è un nome di parametro consentito.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -468,6 +468,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[マップされた型では、プロパティまたはメソッドを宣言しない場合があります。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -3003,6 +3012,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' という名前空間は見つかりません。'{1}' ですか?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4056,11 +4074,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[ES6 モジュールに変換します]]></Val>
<Val><![CDATA[ES モジュールに変換す]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5205,15 +5223,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[動的インポートは、'--module' フラグが 'es2020'、'esnext'、'commonjs'、'amd'、'system'、'umd'、'node12'、'nodenext' に設定されている場合にのみサポートされます。]]></Val>
<Val><![CDATA[動的インポートは、'--module' フラグが 'es2022'、'es2020'、'esnext'、'commonjs'、'amd'、'system'、'umd'、'node12'、'nodenext' に設定されている場合にのみサポートされます。]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6288,11 +6303,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[ファイルは CommonJS モジュールです。ES6 モジュールに変換される可能性があります。]]></Val>
<Val><![CDATA[ファイルは CommonJS モジュールです。ES モジュールに変換される可能性があります。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7749,6 +7764,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[JSON インポートは、ES モジュール モードのインポートでは試験的な機能です。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12534,11 +12558,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['import.meta' メタプロパティは、'--module' オプションが 'es2020'、'esnext'、'system'、'node12'、または 'nodenext' の場合にのみ許可されます。]]></Val>
<Val><![CDATA['import.meta' メタプロパティは、'--module' オプションが 'es2020'、'es2022'、'esnext'、'system'、'node12'、または 'nodenext' の場合にのみ許可されます。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13437,11 +13461,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[トップレベルの 'await' 式は、'module' オプションが 'esnext'、'system'、または 'nodenext' に設定されていて、'target' オプションが 'es2017' 以上に設定されている場合にのみ使用できます。]]></Val>
<Val><![CDATA[トップレベルの 'await' 式は、'module' オプションが 'es2022'、'esnext'、'system'、または 'nodenext' に設定されていて、'target' オプションが 'es2017' 以上に設定されている場合にのみ使用できます。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13455,11 +13479,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[トップレベルの 'for await' ループは、'module' オプションが 'esnext'、'system'、または 'nodenext' に設定されていて、'target' オプションが 'es2017' 以上に設定されている場合にのみ使用できます。]]></Val>
<Val><![CDATA[トップレベルの 'for await' ループは、'module' オプションが 'es2022'、'esnext'、'system'、または 'nodenext' に設定されていて、'target' オプションが 'es2017' 以上に設定されている場合にのみ使用できます。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15252,6 +15276,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' はパラメーター名として使用できません。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -468,6 +468,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[매핑된 형식은 속성 또는 메서드를 선언할 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -3003,6 +3012,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[네임스페이스 '{0}'을(를) 찾을 수 없습니다. '{1}'을(를) 의미했나요?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4056,11 +4074,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[ES6 모듈로 변환]]></Val>
<Val><![CDATA[ES 모듈로 변환]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5205,15 +5223,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[동적 가져오기는 '--module' 플래그가 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12' 또는 'nodenext'로 설정된 경우에만 지원됩니다.]]></Val>
<Val><![CDATA[동적 가져오기는 '--module' 플래그가 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12' 또는 'nodenext'로 설정된 경우에만 지원됩니다.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6288,11 +6303,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[파일이 CommonJS 모듈입니다. ES6 모듈로 변환될 수 있습니다.]]></Val>
<Val><![CDATA[파일이 CommonJS 모듈입니다. ES 모듈로 변환될 수 있습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7749,6 +7764,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[JSON 가져오기는 ES 모듈 모드 가져오기에서 실험적입니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12534,11 +12558,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['import.meta' 메타 속성은 '--module' 옵션이 'es2020', 'esnext', 'system', 'node12' 또는 'nodenext'인 경우에만 허용됩니다.]]></Val>
<Val><![CDATA['import.meta' 메타 속성은 '--module' 옵션이 'es2020', 'es2022', 'esnext', 'system', 'node12' 또는 'nodenext'인 경우에만 허용됩니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13437,11 +13461,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[최상위 'await' 식은 'module' 옵션이 'esnext', 'system' 또는 'nodenext'로 설정되고 'target' 옵션이 'es2017' 이상으로 설정된 경우에만 허용됩니다.]]></Val>
<Val><![CDATA[최상위 'await' 식은 'module' 옵션이 'es2022', 'esnext', 'system' 또는 'nodenext'로 설정되고 'target' 옵션이 'es2017' 이상으로 설정된 경우에만 허용됩니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13455,11 +13479,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[최상위 'for await' 루프는 'module' 옵션이 'esnext', 'system' 또는 'nodenext'로 설정되고 'target' 옵션이 'es2017' 이상으로 설정된 경우에만 허용됩니다.]]></Val>
<Val><![CDATA[최상위 'for await' 루프는 'module' 옵션이 'es2022', 'esnext', 'system' 또는 'nodenext'로 설정되고 'target' 옵션이 'es2017' 이상으로 설정된 경우에만 허용됩니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15252,6 +15276,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}'은(는) 매개 변수 이름으로 사용할 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -461,6 +461,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Zmapowany typ nie może deklarować właściwości ani metod.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -2993,6 +3002,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Nie można odnaleźć przestrzeni nazw „{0}”. Czy chodziło Ci o „{1}”?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4046,11 +4064,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Konwertuj na moduł ES6]]></Val>
<Val><![CDATA[Konwertuj na moduł ES]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5195,15 +5213,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Dynamiczne importy są obsługiwane tylko wtedy, gdy flaga „--module” jest ustawiona na wartość „es2020”, „esnext”, „commonjs”, „amd”, „system”, „umd”, „node12” lub „nodenext”.]]></Val>
<Val><![CDATA[Dynamiczne importy są obsługiwane tylko wtedy, gdy flaga „--module” jest ustawiona na „es2020”, „es2022”, „esnext”, „commonjs”, „amd”, „system”, „umd”, „node12” lub „nodenext”.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6278,11 +6293,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Plik jest modułem CommonJS. Może zostać przekonwertowany na moduł ES6.]]></Val>
<Val><![CDATA[Plik jest modułem CommonJS; może zostać przekonwertowany na moduł ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7739,6 +7754,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Importy JSON są eksperymentalne w importach w trybie modułu ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12521,11 +12545,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Metawłaściwość „import.meta” jest dozwolona tylko wtedy, gdy opcja „--module” ma wartość „es2020”, „esnext”, „system”, „node12” lub „nodenext”.]]></Val>
<Val><![CDATA[Meta-właściwość „import.meta” jest dozwolona tylko wtedy, gdy opcja „--module” ma wartość „es2020”, „es2022”, „esnext”, „system”, „node12” lub „nodenext”.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13424,11 +13448,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Pętle najwyższego poziomu „await” są dozwolone tylko wtedy, gdy opcja „module” jest ustawiona na wartość „esnext”, „system” lub „nodenext”, a opcja „target” jest ustawiona na wartość „es2017” lub wyższą.]]></Val>
<Val><![CDATA[Wyrażenia „await” najwyższego poziomu są dozwolone tylko wtedy, gdy opcja „module” jest ustawiona na wartość „es2022”, „esnext”, „system” lub „nodenext”, a opcja „target” jest ustawiona na wartość „es2017” lub wyższą.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13442,11 +13466,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Pętle najwyższego poziomu „for await” są dozwolone tylko wtedy, gdy opcja „module” jest ustawiona na wartość „esnext”, „system” lub „nodenext”, a opcja „target” jest ustawiona na wartość „es2017” lub wyższą.]]></Val>
<Val><![CDATA[Pętle najwyższego poziomu „for await” są dozwolone tylko wtedy, gdy opcja „module” jest ustawiona na wartość „es2022”, „esnext”, „system” lub „nodenext”, a opcja „target” jest ustawiona na wartość „es2017” lub wyższą.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15239,6 +15263,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[„{0}” jest niedozwolone jako nazwa parametru.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -461,6 +461,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Um tipo mapeado não pode declarar propriedades ou métodos.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -2996,6 +3005,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Não é possível localizar o namespace '{0}'. Você quis dizer '{1}'?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4049,11 +4067,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Converter em módulo ES6]]></Val>
<Val><![CDATA[Converter em módulo ES]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5198,15 +5216,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Importações dinâmicas são suportadas apenas quando o sinalizador 'módulo' é definido como 'es2020', 'esnext', 'commonjs', 'amd', 'sistema', 'umd', 'node12' ou 'nodenext'.]]></Val>
<Val><![CDATA[Importações dinâmicas são suportadas apenas quando o sinalizador '--module' é definido como 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', ou 'nodenext'.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6281,11 +6296,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[O arquivo é um módulo CommonJS; ele pode ser convertido em um módulo ES6.]]></Val>
<Val><![CDATA[O arquivo é um módulo CommonJS; ele pode ser convertido em um módulo ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7742,6 +7757,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[As importações JSON são experimentais em importações de modo de módulo ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12524,11 +12548,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[A meta da propriedade 'import.meta' é permitida quando a opção '--module' é 'es2020', 'esnext', 'sistema', 'node12' ou 'nodenext'.]]></Val>
<Val><![CDATA[A metapropriedade 'import.meta' é permitida apenas quando a opção '--module' é 'es2020', 'es2022', 'esnext', 'system', 'node12', ou 'nodenext'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13427,11 +13451,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Expressões de nível superior 'em espera' são permitidas apenas quando a opção 'módulo' é definida como 'esnext', 'sistema' ou 'nodenext', e a opção 'destino' é definida como 'es2017' ou superior.]]></Val>
<Val><![CDATA[Expressões de nível superior 'await' são permitidas apenas quando a opção 'module' está definida como 'es2022', 'esnext', 'system' ou 'nodenext' e a opção 'target' está definida como 'es2017 ou superior.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13445,11 +13469,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Os loops de nível superior 'for await' só são permitidos quando a opção 'module' está definida como 'esnext', 'system' ou 'nodenext' e a opção 'target' está definida como 'es2017' ou superior.]]></Val>
<Val><![CDATA[Loops de nível superior 'for await' são permitidos apenas quando a opção 'module' está definida como 'es2022', 'esnext', 'system' ou 'nodenext' e a opção 'target' está definida como 'es2017' ou superior.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15242,6 +15266,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' não é permitido como um nome de parâmetro.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -467,6 +467,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Сопоставленный тип не может объявлять свойства и методы.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -3002,6 +3011,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Невозможно найти пространство имен "{0}". Вы имели в виду "{1}"?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4055,11 +4073,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Преобразовать в модуль ES6]]></Val>
<Val><![CDATA[Преобразовать в модуль ES]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5204,15 +5222,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Динамические импорты поддерживаются только в том случае, если флаг "--module" имеет значение "es2020", "esnext", "commonjs", "amd", "system", "umd", "node12" или "nodenext".]]></Val>
<Val><![CDATA[Динамический импорт поддерживаются только в том случае, если флагу "--module" присвоено значение "es2020", "es2022", "esnext", "commonjs", "amd", "system", "umd", "node12" или "nodenext".]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6287,11 +6302,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Файл является модулем CommonJS; его можно преобразовать в модуль ES6.]]></Val>
<Val><![CDATA[Файл является модулем CommonJS. Его можно преобразовать в модуль ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7748,6 +7763,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Импорт данных JSON — экспериментальная функция импорта в режиме модуля ES.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12533,11 +12557,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Метасвойство "import.meta" разрешено, только когда параметр "--module" имеет значение "es2020", "esnext", "system", "node12" или "nodenext".]]></Val>
<Val><![CDATA[Метасвойство "import.meta" допускается, только если параметру "--module" присвоено значение "es2020", "es2022", "esnext", "system", "node12" или "nodenext".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13436,11 +13460,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Выражения "await" верхнего уровня допускаются, только если для параметра "module" задано значение "esnext", "system" или "nodenext", а для параметра "target" задано значение "es2017" или выше.]]></Val>
<Val><![CDATA[Выражения "await" верхнего уровня допускаются, только если параметру "module" присвоено значение "es2022", "esnext", "system" или "nodenext", а параметру "target" присвоено значение "es2017" или выше.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13454,11 +13478,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Циклы "for await" верхнего уровня допускаются, только если для параметра "module" задано значение "esnext", "system" или "nodenext", а для параметра "target" задано значение "es2017" или выше.]]></Val>
<Val><![CDATA[Циклы "for await" верхнего уровня допускаются, только если параметру "module" присвоено значение "es2022", "esnext", "system" или "nodenext", а параметру "target" присвоено значение "es2017" или выше.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15251,6 +15275,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA["{0}" не является допустимым именем параметра.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -461,6 +461,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_mapped_type_may_not_declare_properties_or_methods_7061" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A mapped type may not declare properties or methods.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Eşlenmiş bir tür özellik veya metot bildiremez.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.]]></Val>
@ -2996,6 +3005,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_namespace_0_Did_you_mean_1_2833" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find namespace '{0}'. Did you mean '{1}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Ad alanı '{0}' bulunamıyor. Bunu mu demek istediniz: '{1}'?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Cannot_find_parameter_0_1225" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Cannot find parameter '{0}'.]]></Val>
@ -4049,11 +4067,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_ES6_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Convert_to_ES_module_95017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to ES6 module]]></Val>
<Val><![CDATA[Convert to ES module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[ES6 modülüne dönüştür]]></Val>
<Val><![CDATA[ES modülüne dönüştür]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -5198,15 +5216,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Dinamik içeri aktarmalar yalnızca '--module' bayrağı 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12' veya 'nodenext' olarak ayarlandığında desteklenir.]]></Val>
<Val><![CDATA[Dinamik içeri aktarmalar yalnızca '--module' bayrağı 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12' veya 'nodenext' olarak ayarlandığında desteklenir.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@ -6281,11 +6296,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES module.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Bir CommonJS modülü olan dosya, ES6 modülüne dönüştürülebilir.]]></Val>
<Val><![CDATA[Bir CommonJS modülü olan dosya bir ES modülüne dönüştürülebilir.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -7742,6 +7757,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSON_imports_are_experimental_in_ES_module_mode_imports_7062" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSON imports are experimental in ES module mode imports.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[JSON içeri aktarmaları, ES modül modu içeri aktarmaları için deneyseldir.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attributes must only be assigned a non-empty 'expression'.]]></Val>
@ -12527,11 +12551,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Val><![CDATA[The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['import.meta' meta özelliğine yalnızca '--module' seçeneği 'es2020', 'esnext', 'system', 'node12' veya 'nodenext' olduğunda izin verilir.]]></Val>
<Val><![CDATA['import.meta' meta özelliğine yalnızca '--module' seçeneği 'es2020', 'es2022', 'esnext', 'system', 'node12' veya 'nodenext' olduğunda izin verilir.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13430,11 +13454,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Üst düzey 'for await' ifadelerine yalnızca 'module' seçeneği 'esnext', 'system' veya 'nodenext' olarak ayarlandığında ve 'target' seçeneği 'es2017' veya üzeri olarak ayarlandığında izin verilir.]]></Val>
<Val><![CDATA[Üst düzey 'await' ifadelerine yalnızca 'module' seçeneği 'es2022', 'esnext', 'system' veya 'nodenext' olarak ayarlandığında ve 'target' seçeneği 'es2017' veya üzeri olarak ayarlandığında izin verilir.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -13448,11 +13472,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Val><![CDATA[Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Üst düzey 'for await' döngülerine yalnızca 'module' seçeneği 'esnext', 'system' veya 'nodenext' olarak ayarlandığında ve 'target' seçeneği 'es2017' veya üzeri olarak ayarlandığında izin verilir.]]></Val>
<Val><![CDATA[Üst düzey 'for await' döngülerine yalnızca 'module' seçeneği 'es2022', 'esnext', 'system' veya 'nodenext' olarak ayarlandığında ve 'target' seçeneği 'es2017' veya üzeri olarak ayarlandığında izin verilir.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@ -15245,6 +15269,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_parameter_name_1390" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a parameter name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' öğesine parametre adı olarak izin verilmiyor.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>

View file

@ -1,4 +1,4 @@
namespace Playback {
namespace Playback { // eslint-disable-line one-namespace-per-file
interface FileInformation {
contents?: string;
contentsPath?: string;
@ -445,3 +445,7 @@ namespace Playback {
return wrapper;
}
}
// empty modules for the module migration script
namespace ts.server { } // eslint-disable-line one-namespace-per-file
namespace Harness { } // eslint-disable-line one-namespace-per-file

View file

@ -49,24 +49,23 @@ namespace ts.server {
readonly data: ProjectInfoTelemetryEventData;
}
/*
* __GDPR__
* "projectInfo" : {
* "${include}": ["${TypeScriptCommonProperties}"],
* "projectId": { "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight", "endpoint": "ProjectId" },
* "fileStats": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "compilerOptions": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "extends": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "files": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "include": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "exclude": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "compileOnSave": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "typeAcquisition": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "configFileName": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "projectType": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "languageServiceEnabled": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "version": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
* }
/* __GDPR__
"projectInfo" : {
"${include}": ["${TypeScriptCommonProperties}"],
"projectId": { "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight", "endpoint": "ProjectId" },
"fileStats": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"compilerOptions": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"extends": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"files": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"include": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"exclude": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"compileOnSave": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"typeAcquisition": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"configFileName": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"projectType": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"languageServiceEnabled": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"version": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
export interface ProjectInfoTelemetryEventData {
/** Cryptographically secure hash of project file location. */

View file

@ -1031,6 +1031,11 @@ namespace ts.server {
}
}
/* @internal */
onDiscoveredSymlink() {
this.hasAddedOrRemovedSymlinks = true;
}
/**
* Updates set of files that contribute to this project
* @returns: true if set of files in the project stays the same and false - otherwise.
@ -1939,15 +1944,15 @@ namespace ts.server {
for (const resolution of resolutions) {
if (!resolution.resolvedFileName) continue;
const { resolvedFileName, originalPath } = resolution;
if (originalPath) {
symlinkCache.setSymlinkedDirectoryFromSymlinkedFile(originalPath, resolvedFileName);
}
if (!program.getSourceFile(resolvedFileName) && (!originalPath || !program.getSourceFile(originalPath))) {
rootNames = append(rootNames, resolvedFileName);
// Avoid creating a large project that would significantly slow down time to editor interactivity
if (dependencySelection === PackageJsonAutoImportPreference.Auto && rootNames.length > this.maxDependencies) {
return ts.emptyArray;
}
if (originalPath) {
symlinkCache.setSymlinkedDirectoryFromSymlinkedFile(originalPath, resolvedFileName);
}
}
}
}

View file

@ -2289,7 +2289,7 @@ namespace ts.server.protocol {
/**
* Human-readable description of the `source`.
*/
sourceDisplay?: SymbolDisplayPart[];
sourceDisplay?: SymbolDisplayPart[];
/**
* If true, this completion should be highlighted as recommended. There will only be one of these.
* This will be set when we know the user should write an expression with a certain type and that type is an enum or constructable class.
@ -3199,14 +3199,32 @@ namespace ts.server.protocol {
payload: TypingsInstalledTelemetryEventPayload;
}
/*
* __GDPR__
* "typingsinstalled" : {
* "${include}": ["${TypeScriptCommonProperties}"],
* "installedPackages": { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" },
* "installSuccess": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
* "typingsInstallerVersion": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
* }
// A __GDPR__FRAGMENT__ has no meaning until it is ${include}d by a __GDPR__ comment, at which point
// the included properties are effectively inlined into the __GDPR__ declaration. In this case, for
// example, any __GDPR__ comment including the TypeScriptCommonProperties will be updated with an
// additional version property with the classification below. Obviously, the purpose of such a construct
// is to reduce duplication and keep multiple use sites consistent (e.g. by making sure that all reflect
// any newly added TypeScriptCommonProperties). Unfortunately, the system has limits - in particular,
// these reusable __GDPR__FRAGMENT__s are not accessible across repo boundaries. Therefore, even though
// the code for adding the common properties (i.e. version), along with the corresponding __GDPR__FRAGMENT__,
// lives in the VS Code repo (see https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/src/utils/telemetry.ts)
// we have to duplicate it here. It would be nice to keep them in sync, but the only likely failure mode
// is adding a property to the VS Code repro but not here and the only consequence would be having that
// property suppressed on the events (i.e. __GDPT__ comments) in this repo that reference the out-of-date
// local __GDPR__FRAGMENT__.
/* __GDPR__FRAGMENT__
"TypeScriptCommonProperties" : {
"version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
/* __GDPR__
"typingsinstalled" : {
"${include}": ["${TypeScriptCommonProperties}"],
"installedPackages": { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" },
"installSuccess": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"typingsInstallerVersion": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
export interface TypingsInstalledTelemetryEventPayload {
/**
@ -3381,6 +3399,13 @@ namespace ts.server.protocol {
* values, with insertion text to replace preceding `.` tokens with `?.`.
*/
readonly includeAutomaticOptionalChainCompletions?: boolean;
/**
* If enabled, completions for class members (e.g. methods and properties) will include
* a whole declaration for the member.
* E.g., `class A { f| }` could be completed to `class A { foo(): number {} }`, instead of
* `class A { foo }`.
*/
readonly includeCompletionsWithClassMemberSnippets?: boolean;
readonly allowIncompleteCompletions?: boolean;
readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
@ -3509,6 +3534,7 @@ namespace ts.server.protocol {
ES2019 = "ES2019",
ES2020 = "ES2020",
ES2021 = "ES2021",
ES2022 = "ES2022",
ESNext = "ESNext"
}

View file

@ -1536,19 +1536,21 @@ namespace ts.server {
const file = toNormalizedPath(args.file);
const position = this.getPositionInFile(args, file);
const projects = this.getProjects(args);
const defaultProject = this.getDefaultProject(args);
const renameInfo: protocol.RenameInfo = this.mapRenameInfo(
defaultProject.getLanguageService().getRenameInfo(file, position, { allowRenameOfImportPath: this.getPreferences(file).allowRenameOfImportPath }), Debug.checkDefined(this.projectService.getScriptInfo(file)));
if (!renameInfo.canRename) return simplifiedResult ? { info: renameInfo, locs: [] } : [];
const locations = combineProjectOutputForRenameLocations(
projects,
this.getDefaultProject(args),
defaultProject,
{ fileName: args.file, pos: position },
!!args.findInStrings,
!!args.findInComments,
this.getPreferences(file)
);
if (!simplifiedResult) return locations;
const defaultProject = this.getDefaultProject(args);
const renameInfo: protocol.RenameInfo = this.mapRenameInfo(defaultProject.getLanguageService().getRenameInfo(file, position, { allowRenameOfImportPath: this.getPreferences(file).allowRenameOfImportPath }), Debug.checkDefined(this.projectService.getScriptInfo(file)));
return { info: renameInfo, locs: this.toSpanGroups(locations) };
}
@ -2110,7 +2112,7 @@ namespace ts.server {
private getFullNavigateToItems(args: protocol.NavtoRequestArgs): CombineOutputResult<NavigateToItem> {
const { currentFileOnly, searchValue, maxResultCount, projectFileName } = args;
if (currentFileOnly) {
Debug.assertDefined(args.file);
Debug.assertIsDefined(args.file);
const { file, project } = this.getFileAndProject(args as protocol.FileRequestArgs);
return [{ project, result: project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file) }];
}

View file

@ -3,13 +3,6 @@ namespace ts.codefix {
const errorCodeToFixes = createMultiMap<CodeFixRegistration>();
const fixIdToRegistration = new Map<string, CodeFixRegistration>();
export type DiagnosticAndArguments = DiagnosticMessage | [DiagnosticMessage, string] | [DiagnosticMessage, string, string];
function diagnosticToString(diag: DiagnosticAndArguments): string {
return isArray(diag)
? formatStringFromArgs(getLocaleSpecificMessage(diag[0]), diag.slice(1) as readonly string[])
: getLocaleSpecificMessage(diag);
}
export function createCodeFixActionWithoutFixAll(fixName: string, changes: FileTextChanges[], description: DiagnosticAndArguments) {
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
}

View file

@ -14,24 +14,24 @@ namespace ts.codefix {
function makeChange(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number) {
const token = getTokenAtPosition(sourceFile, pos);
if (!isIdentifier(token)) {
return Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + Debug.formatSyntaxKind(token.kind));
}
const param = token.parent;
if (!isParameter(param)) {
return Debug.fail("Tried to add a parameter name to a non-parameter: " + Debug.formatSyntaxKind(token.kind));
}
const i = param.parent.parameters.indexOf(param);
Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
Debug.assert(i > -1, "Parameter not found in parent parameter list.");
const typeNode = factory.createTypeReferenceNode(param.name as Identifier, /*typeArguments*/ undefined);
const replacement = factory.createParameterDeclaration(
/*decorators*/ undefined,
param.modifiers,
param.dotDotDotToken,
"arg" + i,
param.questionToken,
factory.createTypeReferenceNode(token, /*typeArguments*/ undefined),
param.dotDotDotToken ? factory.createArrayTypeNode(typeNode) : typeNode,
param.initializer);
changeTracker.replaceNode(sourceFile, token, replacement);
changeTracker.replaceNode(sourceFile, param, replacement);
}
}

View file

@ -47,7 +47,12 @@ namespace ts.codefix {
}
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, { container, typeNode, constraint, name }: Info): void {
changes.replaceNode(sourceFile, container, factory.createMappedTypeNode(/*readonlyToken*/ undefined,
factory.createTypeParameterDeclaration(name, factory.createTypeReferenceNode(constraint)), /*nameType*/ undefined, /*questionToken*/ undefined, typeNode));
changes.replaceNode(sourceFile, container, factory.createMappedTypeNode(
/*readonlyToken*/ undefined,
factory.createTypeParameterDeclaration(name, factory.createTypeReferenceNode(constraint)),
/*nameType*/ undefined,
/*questionToken*/ undefined,
typeNode,
/*members*/ undefined));
}
}

View file

@ -1,11 +1,11 @@
/* @internal */
namespace ts.codefix {
registerCodeFix({
errorCodes: [Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module.code],
errorCodes: [Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code],
getCodeActions(context) {
const { sourceFile, program, preferences } = context;
const changes = textChanges.ChangeTracker.with(context, changes => {
const moduleExportsChangedToDefault = convertFileToEs6Module(sourceFile, program.getTypeChecker(), changes, getEmitScriptTarget(program.getCompilerOptions()), getQuotePreference(sourceFile, preferences));
const moduleExportsChangedToDefault = convertFileToEsModule(sourceFile, program.getTypeChecker(), changes, getEmitScriptTarget(program.getCompilerOptions()), getQuotePreference(sourceFile, preferences));
if (moduleExportsChangedToDefault) {
for (const importingFile of program.getSourceFiles()) {
fixImportOfModuleExports(importingFile, sourceFile, changes, getQuotePreference(importingFile, preferences));
@ -13,7 +13,7 @@ namespace ts.codefix {
}
});
// No support for fix-all since this applies to the whole file at once anyway.
return [createCodeFixActionWithoutFixAll("convertToEs6Module", changes, Diagnostics.Convert_to_ES6_module)];
return [createCodeFixActionWithoutFixAll("convertToEsModule", changes, Diagnostics.Convert_to_ES_module)];
},
});
@ -39,7 +39,7 @@ namespace ts.codefix {
}
/** @returns Whether we converted a `module.exports =` to a default export. */
function convertFileToEs6Module(sourceFile: SourceFile, checker: TypeChecker, changes: textChanges.ChangeTracker, target: ScriptTarget, quotePreference: QuotePreference): ModuleExportsChanged {
function convertFileToEsModule(sourceFile: SourceFile, checker: TypeChecker, changes: textChanges.ChangeTracker, target: ScriptTarget, quotePreference: QuotePreference): ModuleExportsChanged {
const identifiers: Identifiers = { original: collectFreeIdentifiers(sourceFile), additional: new Set() };
const exports = collectExportRenames(sourceFile, checker, identifiers);
convertExportsAccesses(sourceFile, exports, changes);
@ -210,7 +210,7 @@ namespace ts.codefix {
// `const a = require("b").c` --> `import { c as a } from "./b";
return convertedImports([makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)]);
default:
return Debug.assertNever(name, `Convert to ES6 module got invalid syntax form ${(name as BindingName).kind}`);
return Debug.assertNever(name, `Convert to ES module got invalid syntax form ${(name as BindingName).kind}`);
}
}
@ -408,9 +408,7 @@ namespace ts.codefix {
const importSpecifiers = mapAllOrFail(name.elements, e =>
e.dotDotDotToken || e.initializer || e.propertyName && !isIdentifier(e.propertyName) || !isIdentifier(e.name)
? undefined
// (TODO: GH#18217)
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
: makeImportSpecifier(e.propertyName && (e.propertyName as Identifier).text, e.name.text));
: makeImportSpecifier(e.propertyName && e.propertyName.text, e.name.text));
if (importSpecifiers) {
return convertedImports([makeImport(/*name*/ undefined, importSpecifiers, moduleSpecifier, quotePreference)]);
}
@ -430,7 +428,7 @@ namespace ts.codefix {
case SyntaxKind.Identifier:
return convertSingleIdentifierImport(name, moduleSpecifier, checker, identifiers, quotePreference);
default:
return Debug.assertNever(name, `Convert to ES6 module got invalid name kind ${(name as BindingName).kind}`);
return Debug.assertNever(name, `Convert to ES module got invalid name kind ${(name as BindingName).kind}`);
}
}

View file

@ -46,7 +46,8 @@ namespace ts.codefix {
mappedTypeParameter,
/*nameType*/ undefined,
indexSignature.questionToken,
indexSignature.type);
indexSignature.type,
/*members*/ undefined);
const intersectionType = factory.createIntersectionTypeNode([
...getAllSuperTypeNodes(container),
mappedIntersectionType,

View file

@ -53,7 +53,8 @@ namespace ts.codefix {
insertBefore = findChildOfKind(containingFunction, SyntaxKind.FunctionKeyword, sourceFile);
break;
case SyntaxKind.ArrowFunction:
insertBefore = findChildOfKind(containingFunction, SyntaxKind.OpenParenToken, sourceFile) || first(containingFunction.parameters);
const kind = containingFunction.typeParameters ? SyntaxKind.LessThanToken : SyntaxKind.OpenParenToken;
insertBefore = findChildOfKind(containingFunction, kind, sourceFile) || first(containingFunction.parameters);
break;
default:
return;

View file

@ -42,7 +42,7 @@ namespace ts.codefix {
const abstractAndNonPrivateExtendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType).filter(symbolPointsToNonPrivateAndAbstractMember);
const importAdder = createImportAdder(sourceFile, context.program, preferences, context.host);
createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, sourceFile, context, preferences, importAdder, member => changeTracker.insertNodeAtClassStart(sourceFile, classDeclaration, member));
createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, sourceFile, context, preferences, importAdder, member => changeTracker.insertNodeAtClassStart(sourceFile, classDeclaration, member as ClassElement));
importAdder.writeFixes(changeTracker);
}

View file

@ -64,7 +64,7 @@ namespace ts.codefix {
}
const importAdder = createImportAdder(sourceFile, context.program, preferences, context.host);
createMissingMemberNodes(classDeclaration, nonPrivateAndNotExistedInHeritageClauseMembers, sourceFile, context, preferences, importAdder, member => insertInterfaceMemberNode(sourceFile, classDeclaration, member));
createMissingMemberNodes(classDeclaration, nonPrivateAndNotExistedInHeritageClauseMembers, sourceFile, context, preferences, importAdder, member => insertInterfaceMemberNode(sourceFile, classDeclaration, member as ClassElement));
importAdder.writeFixes(changeTracker);
function createMissingIndexSignatureDeclaration(type: InterfaceType, kind: IndexKind): void {

View file

@ -26,9 +26,9 @@ namespace ts.codefix {
if (!isFunctionDeclaration(fn) && !isFunctionExpression(fn)) return undefined;
if (!isSourceFile(getThisContainer(fn, /*includeArrowFunctions*/ false))) { // 'this' is defined outside, convert to arrow function
const fnKeyword = Debug.assertDefined(findChildOfKind(fn, SyntaxKind.FunctionKeyword, sourceFile));
const fnKeyword = Debug.checkDefined(findChildOfKind(fn, SyntaxKind.FunctionKeyword, sourceFile));
const { name } = fn;
const body = Debug.assertDefined(fn.body); // Should be defined because the function contained a 'this' expression
const body = Debug.checkDefined(fn.body); // Should be defined because the function contained a 'this' expression
if (isFunctionExpression(fn)) {
if (name && FindAllReferences.Core.isSymbolReferencedInFile(name, checker, sourceFile, body)) {
// Function expression references itself. To fix we would have to extract it to a const.

View file

@ -17,37 +17,81 @@ namespace ts.codefix {
Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code,
Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code,
Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code,
Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code
Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code,
Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code,
Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code,
Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code,
Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code,
];
const errorCodeFixIdMap: Record<number, [DiagnosticMessage, string | undefined, DiagnosticMessage | undefined]> = {
[Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code]: [
Diagnostics.Add_override_modifier, fixAddOverrideId, Diagnostics.Add_all_missing_override_modifiers,
],
[Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code]: [
Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_unnecessary_override_modifiers
],
[Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code]: [
Diagnostics.Add_override_modifier, fixAddOverrideId, Diagnostics.Add_all_missing_override_modifiers,
],
[Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code]: [
Diagnostics.Add_override_modifier, fixAddOverrideId, Diagnostics.Remove_all_unnecessary_override_modifiers
],
[Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code]: [
Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_unnecessary_override_modifiers
]
interface ErrorCodeFixInfo {
descriptions: DiagnosticMessage;
fixId?: string | undefined;
fixAllDescriptions?: DiagnosticMessage | undefined;
}
const errorCodeFixIdMap: Record<number, ErrorCodeFixInfo> = {
// case #1:
[Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code]: {
descriptions: Diagnostics.Add_override_modifier,
fixId: fixAddOverrideId,
fixAllDescriptions: Diagnostics.Add_all_missing_override_modifiers,
},
[Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code]: {
descriptions: Diagnostics.Add_override_modifier,
fixId: fixAddOverrideId,
fixAllDescriptions: Diagnostics.Add_all_missing_override_modifiers
},
// case #2:
[Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code]: {
descriptions: Diagnostics.Remove_override_modifier,
fixId: fixRemoveOverrideId,
fixAllDescriptions: Diagnostics.Remove_all_unnecessary_override_modifiers,
},
[Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code]: {
descriptions: Diagnostics.Remove_override_modifier,
fixId: fixRemoveOverrideId,
fixAllDescriptions: Diagnostics.Remove_override_modifier
},
// case #3:
[Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code]: {
descriptions: Diagnostics.Add_override_modifier,
fixId: fixAddOverrideId,
fixAllDescriptions: Diagnostics.Add_all_missing_override_modifiers,
},
[Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code]: {
descriptions: Diagnostics.Add_override_modifier,
fixId: fixAddOverrideId,
fixAllDescriptions: Diagnostics.Add_all_missing_override_modifiers,
},
// case #4:
[Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code]: {
descriptions: Diagnostics.Add_override_modifier,
fixId: fixAddOverrideId,
fixAllDescriptions: Diagnostics.Remove_all_unnecessary_override_modifiers,
},
// case #5:
[Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code]: {
descriptions: Diagnostics.Remove_override_modifier,
fixId: fixRemoveOverrideId,
fixAllDescriptions: Diagnostics.Remove_all_unnecessary_override_modifiers,
},
[Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code]: {
descriptions: Diagnostics.Remove_override_modifier,
fixId: fixRemoveOverrideId,
fixAllDescriptions: Diagnostics.Remove_all_unnecessary_override_modifiers,
}
};
registerCodeFix({
errorCodes,
getCodeActions: context => {
const { errorCode, span, sourceFile } = context;
const { errorCode, span } = context;
const info = errorCodeFixIdMap[errorCode];
if (!info) return emptyArray;
const [ descriptions, fixId, fixAllDescriptions ] = info;
if (isSourceFileJS(sourceFile)) return emptyArray;
const { descriptions, fixId, fixAllDescriptions } = info;
const changes = textChanges.ChangeTracker.with(context, changes => dispatchChanges(changes, context, errorCode, span.start));
return [
@ -57,9 +101,9 @@ namespace ts.codefix {
fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
getAllCodeActions: context =>
codeFixAll(context, errorCodes, (changes, diag) => {
const { code, start, file } = diag;
const { code, start } = diag;
const info = errorCodeFixIdMap[code];
if (!info || info[1] !== context.fixId || isSourceFileJS(file)) {
if (!info || info.fixId !== context.fixId) {
return;
}
@ -74,11 +118,15 @@ namespace ts.codefix {
pos: number) {
switch (errorCode) {
case Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code:
case Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code:
case Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code:
case Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code:
case Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code:
return doAddOverrideModifierChange(changeTracker, context.sourceFile, pos);
case Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code:
case Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code:
case Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code:
case Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code:
return doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos);
default:
Debug.fail("Unexpected error code: " + errorCode);
@ -87,6 +135,10 @@ namespace ts.codefix {
function doAddOverrideModifierChange(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number) {
const classElement = findContainerClassElementLike(sourceFile, pos);
if (isSourceFileJS(sourceFile)) {
changeTracker.addJSDocTags(sourceFile, classElement, [factory.createJSDocOverrideTag(factory.createIdentifier("override"))]);
return;
}
const modifiers = classElement.modifiers || emptyArray;
const staticModifier = find(modifiers, isStaticModifier);
const abstractModifier = find(modifiers, isAbstractModifier);
@ -101,6 +153,10 @@ namespace ts.codefix {
function doRemoveOverrideModifierChange(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number) {
const classElement = findContainerClassElementLike(sourceFile, pos);
if (isSourceFileJS(sourceFile)) {
changeTracker.filterJSDocTags(sourceFile, classElement, not(isJSDocOverrideTag));
return;
}
const overrideModifier = classElement.modifiers && find(classElement.modifiers, modifier => modifier.kind === SyntaxKind.OverrideKeyword);
Debug.assertIsDefined(overrideModifier);

View file

@ -6,6 +6,7 @@ namespace ts.codefix {
Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
Diagnostics.Could_not_find_name_0_Did_you_mean_1.code,
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,
Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2.code,

View file

@ -7,11 +7,18 @@ namespace ts.codefix {
* @param importAdder If provided, type annotations will use identifier type references instead of ImportTypeNodes, and the missing imports will be added to the importAdder.
* @returns Empty string iff there are no member insertions.
*/
export function createMissingMemberNodes(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: readonly Symbol[], sourceFile: SourceFile, context: TypeConstructionContext, preferences: UserPreferences, importAdder: ImportAdder | undefined, addClassElement: (node: ClassElement) => void): void {
export function createMissingMemberNodes(
classDeclaration: ClassLikeDeclaration,
possiblyMissingSymbols: readonly Symbol[],
sourceFile: SourceFile,
context: TypeConstructionContext,
preferences: UserPreferences,
importAdder: ImportAdder | undefined,
addClassElement: (node: AddNode) => void): void {
const classMembers = classDeclaration.symbol.members!;
for (const symbol of possiblyMissingSymbols) {
if (!classMembers.has(symbol.escapedName)) {
addNewNodeForMemberSymbol(symbol, classDeclaration, sourceFile, context, preferences, importAdder, addClassElement);
addNewNodeForMemberSymbol(symbol, classDeclaration, sourceFile, context, preferences, importAdder, addClassElement, /* body */ undefined);
}
}
}
@ -28,10 +35,30 @@ namespace ts.codefix {
host: LanguageServiceHost;
}
type AddNode = PropertyDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction;
export const enum PreserveOptionalFlags {
Method = 1 << 0,
Property = 1 << 1,
All = Method | Property
}
/**
* @returns Empty string iff there we can't figure out a representation for `symbol` in `enclosingDeclaration`.
* `addClassElement` will not be called if we can't figure out a representation for `symbol` in `enclosingDeclaration`.
* @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub.
*/
function addNewNodeForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassLikeDeclaration, sourceFile: SourceFile, context: TypeConstructionContext, preferences: UserPreferences, importAdder: ImportAdder | undefined, addClassElement: (node: Node) => void): void {
export function addNewNodeForMemberSymbol(
symbol: Symbol,
enclosingDeclaration: ClassLikeDeclaration,
sourceFile: SourceFile,
context: TypeConstructionContext,
preferences: UserPreferences,
importAdder: ImportAdder | undefined,
addClassElement: (node: AddNode) => void,
body: Block | undefined,
preserveOptional = PreserveOptionalFlags.All,
isAmbient = false,
): void {
const declarations = symbol.getDeclarations();
if (!(declarations && declarations.length)) {
return undefined;
@ -44,7 +71,7 @@ namespace ts.codefix {
const modifiers = visibilityModifier ? factory.createNodeArray([visibilityModifier]) : undefined;
const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
const optional = !!(symbol.flags & SymbolFlags.Optional);
const ambient = !!(enclosingDeclaration.flags & NodeFlags.Ambient);
const ambient = !!(enclosingDeclaration.flags & NodeFlags.Ambient) || isAmbient;
const quotePreference = getQuotePreference(sourceFile, preferences);
switch (declaration.kind) {
@ -63,7 +90,7 @@ namespace ts.codefix {
/*decorators*/ undefined,
modifiers,
name,
optional ? factory.createToken(SyntaxKind.QuestionToken) : undefined,
optional && (preserveOptional & PreserveOptionalFlags.Property) ? factory.createToken(SyntaxKind.QuestionToken) : undefined,
typeNode,
/*initializer*/ undefined));
break;
@ -89,7 +116,7 @@ namespace ts.codefix {
name,
emptyArray,
typeNode,
ambient ? undefined : createStubbedMethodBody(quotePreference)));
ambient ? undefined : body || createStubbedMethodBody(quotePreference)));
}
else {
Debug.assertNode(accessor, isSetAccessorDeclaration, "The counterpart to a getter should be a setter");
@ -100,7 +127,7 @@ namespace ts.codefix {
modifiers,
name,
createDummyParameters(1, [parameterName], [typeNode], 1, /*inJs*/ false),
ambient ? undefined : createStubbedMethodBody(quotePreference)));
ambient ? undefined : body || createStubbedMethodBody(quotePreference)));
}
}
break;
@ -122,7 +149,7 @@ namespace ts.codefix {
if (declarations.length === 1) {
Debug.assert(signatures.length === 1, "One declaration implies one signature");
const signature = signatures[0];
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : createStubbedMethodBody(quotePreference));
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference));
break;
}
@ -134,18 +161,18 @@ namespace ts.codefix {
if (!ambient) {
if (declarations.length > signatures.length) {
const signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1] as SignatureDeclaration)!;
outputMethod(quotePreference, signature, modifiers, name, createStubbedMethodBody(quotePreference));
outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference));
}
else {
Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count");
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference));
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & PreserveOptionalFlags.Method), modifiers, quotePreference, body));
}
}
break;
}
function outputMethod(quotePreference: QuotePreference, signature: Signature, modifiers: NodeArray<Modifier> | undefined, name: PropertyName, body?: Block): void {
const method = createSignatureDeclarationFromSignature(SyntaxKind.MethodDeclaration, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder);
const method = createSignatureDeclarationFromSignature(SyntaxKind.MethodDeclaration, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & PreserveOptionalFlags.Method), enclosingDeclaration, importAdder);
if (method) addClassElement(method);
}
}
@ -348,6 +375,7 @@ namespace ts.codefix {
optional: boolean,
modifiers: readonly Modifier[] | undefined,
quotePreference: QuotePreference,
body: Block | undefined,
): MethodDeclaration {
/** This is *a* signature with the maximal number of arguments,
* such that if there is a "maximal" signature without rest arguments,
@ -389,7 +417,8 @@ namespace ts.codefix {
/*typeParameters*/ undefined,
parameters,
getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration),
quotePreference);
quotePreference,
body);
}
function getReturnTypeFromSignatures(signatures: readonly Signature[], checker: TypeChecker, context: TypeConstructionContext, enclosingDeclaration: ClassLikeDeclaration): TypeNode | undefined {
@ -406,7 +435,8 @@ namespace ts.codefix {
typeParameters: readonly TypeParameterDeclaration[] | undefined,
parameters: readonly ParameterDeclaration[],
returnType: TypeNode | undefined,
quotePreference: QuotePreference
quotePreference: QuotePreference,
body: Block | undefined
): MethodDeclaration {
return factory.createMethodDeclaration(
/*decorators*/ undefined,
@ -417,7 +447,7 @@ namespace ts.codefix {
typeParameters,
parameters,
returnType,
createStubbedMethodBody(quotePreference));
body || createStubbedMethodBody(quotePreference));
}
function createStubbedMethodBody(quotePreference: QuotePreference) {

View file

@ -33,6 +33,7 @@ namespace ts.codefix {
});
export interface ImportAdder {
hasFixes(): boolean;
addImportFromDiagnostic: (diagnostic: DiagnosticWithLocation, context: CodeFixContextBase) => void;
addImportFromExportedSymbol: (exportedSymbol: Symbol, isValidTypeOnlyUseSite?: boolean) => void;
writeFixes: (changeTracker: textChanges.ChangeTracker) => void;
@ -59,7 +60,7 @@ namespace ts.codefix {
type NewImportsKey = `${0 | 1}|${string}`;
/** Use `getNewImportEntry` for access */
const newImports = new Map<NewImportsKey, Mutable<ImportsCollection & { useRequire: boolean }>>();
return { addImportFromDiagnostic, addImportFromExportedSymbol, writeFixes };
return { addImportFromDiagnostic, addImportFromExportedSymbol, writeFixes, hasFixes };
function addImportFromDiagnostic(diagnostic: DiagnosticWithLocation, context: CodeFixContextBase) {
const info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
@ -217,6 +218,10 @@ namespace ts.codefix {
insertImports(changeTracker, sourceFile, newDeclarations, /*blankLineBetween*/ true);
}
}
function hasFixes() {
return addToNamespace.length > 0 || importType.length > 0 || addToExisting.size > 0 || newImports.size > 0;
}
}
// Sorted with the preferred fix coming first.
@ -268,7 +273,7 @@ namespace ts.codefix {
}
export function getImportCompletionAction(
exportedSymbol: Symbol,
targetSymbol: Symbol,
moduleSymbol: Symbol,
sourceFile: SourceFile,
symbolName: string,
@ -280,8 +285,8 @@ namespace ts.codefix {
): { readonly moduleSpecifier: string, readonly codeAction: CodeAction } {
const compilerOptions = program.getCompilerOptions();
const exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name))
? [getSymbolExportInfoForSymbol(exportedSymbol, moduleSymbol, program, host)]
: getAllReExportingModules(sourceFile, exportedSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
: getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
const useRequire = shouldUseRequire(sourceFile, program);
const isValidTypeOnlyUseSite = isValidTypeOnlyAliasUseSite(getTokenAtPosition(sourceFile, position));
const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@ -326,7 +331,7 @@ namespace ts.codefix {
}
}
function getAllReExportingModules(importingFile: SourceFile, exportedSymbol: Symbol, exportingModuleSymbol: Symbol, symbolName: string, host: LanguageServiceHost, program: Program, preferences: UserPreferences, useAutoImportProvider: boolean): readonly SymbolExportInfo[] {
function getAllReExportingModules(importingFile: SourceFile, targetSymbol: Symbol, exportingModuleSymbol: Symbol, symbolName: string, host: LanguageServiceHost, program: Program, preferences: UserPreferences, useAutoImportProvider: boolean): readonly SymbolExportInfo[] {
const result: SymbolExportInfo[] = [];
const compilerOptions = program.getCompilerOptions();
const getModuleSpecifierResolutionHost = memoizeOne((isFromPackageJson: boolean) => {
@ -341,12 +346,12 @@ namespace ts.codefix {
}
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, getEmitScriptTarget(compilerOptions)) === symbolName) && skipAlias(defaultInfo.symbol, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, getEmitScriptTarget(compilerOptions)) === symbolName) && skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
result.push({ symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: moduleFile?.fileName, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson });
}
for (const exported of checker.getExportsAndPropertiesOfModule(moduleSymbol)) {
if (exported.name === symbolName && skipAlias(exported, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
if (exported.name === symbolName && checker.getMergedSymbol(skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
result.push({ symbol: exported, moduleSymbol, moduleFileName: moduleFile?.fileName, exportKind: ExportKind.Named, targetFlags: skipAlias(exported, checker).flags, isFromPackageJson });
}
}
@ -663,13 +668,15 @@ namespace ts.codefix {
}
const { allowsImportingSpecifier } = createPackageJsonImportFilter(sourceFile, preferences, host);
return fixes.reduce((best, fix) =>
// Takes true branch of conditional if `fix` is better than `best`
compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === Comparison.LessThan ? fix : best
);
}
/** @returns `Comparison.LessThan` if `a` is better than `b`. */
function compareModuleSpecifiers(a: ImportFix, b: ImportFix, importingFile: SourceFile, program: Program, allowsImportingSpecifier: (specifier: string) => boolean): Comparison {
if (a.kind !== ImportFixKind.UseNamespace && b.kind !== ImportFixKind.UseNamespace) {
return compareBooleans(allowsImportingSpecifier(a.moduleSpecifier), allowsImportingSpecifier(b.moduleSpecifier))
return compareBooleans(allowsImportingSpecifier(b.moduleSpecifier), allowsImportingSpecifier(a.moduleSpecifier))
|| compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program)
|| compareNumberOfDirectorySeparators(a.moduleSpecifier, b.moduleSpecifier);
}
@ -766,9 +773,13 @@ namespace ts.codefix {
return { fixes, symbolName };
}
function jsxModeNeedsExplicitImport(jsx: JsxEmit | undefined) {
return jsx === JsxEmit.React || jsx === JsxEmit.ReactNative;
}
function getSymbolName(sourceFile: SourceFile, checker: TypeChecker, symbolToken: Identifier, compilerOptions: CompilerOptions): string {
const parent = symbolToken.parent;
if ((isJsxOpeningLikeElement(parent) || isJsxClosingElement(parent)) && parent.tagName === symbolToken && compilerOptions.jsx !== JsxEmit.ReactJSX && compilerOptions.jsx !== JsxEmit.ReactJSXDev) {
if ((isJsxOpeningLikeElement(parent) || isJsxClosingElement(parent)) && parent.tagName === symbolToken && jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
const jsxNamespace = checker.getJsxNamespace(sourceFile);
if (isIntrinsicJsxName(symbolToken.text) || !checker.resolveName(jsxNamespace, parent, SymbolFlags.Value, /*excludeGlobals*/ true)) {
return jsxNamespace;

View file

@ -131,7 +131,7 @@ namespace ts.codefix {
if (typeNode) {
// Note that the codefix will never fire with an existing `@type` tag, so there is no need to merge tags
const typeTag = factory.createJSDocTypeTag(/*tagName*/ undefined, factory.createJSDocTypeExpression(typeNode), /*comment*/ undefined);
addJSDocTags(changes, sourceFile, cast(parent.parent.parent, isExpressionStatement), [typeTag]);
changes.addJSDocTags(sourceFile, cast(parent.parent.parent, isExpressionStatement), [typeTag]);
}
importAdder.writeFixes(changes);
return parent;
@ -271,7 +271,7 @@ namespace ts.codefix {
}
function annotateJSDocThis(changes: textChanges.ChangeTracker, sourceFile: SourceFile, containingFunction: SignatureDeclaration, typeNode: TypeNode) {
addJSDocTags(changes, sourceFile, containingFunction, [
changes.addJSDocTags(sourceFile, containingFunction, [
factory.createJSDocThisTag(/*tagName*/ undefined, factory.createJSDocTypeExpression(typeNode)),
]);
}
@ -311,7 +311,7 @@ namespace ts.codefix {
}
const typeExpression = factory.createJSDocTypeExpression(typeNode);
const typeTag = isGetAccessorDeclaration(declaration) ? factory.createJSDocReturnTag(/*tagName*/ undefined, typeExpression, /*comment*/ undefined) : factory.createJSDocTypeTag(/*tagName*/ undefined, typeExpression, /*comment*/ undefined);
addJSDocTags(changes, sourceFile, parent, [typeTag]);
changes.addJSDocTags(sourceFile, parent, [typeTag]);
}
else if (!tryReplaceImportTypeNodeWithAutoImport(typeNode, declaration, sourceFile, changes, importAdder, getEmitScriptTarget(program.getCompilerOptions()))) {
changes.tryInsertTypeAnnotation(sourceFile, declaration, typeNode);
@ -378,46 +378,7 @@ namespace ts.codefix {
else {
const paramTags = map(inferences, ({ name, typeNode, isOptional }) =>
factory.createJSDocParameterTag(/*tagName*/ undefined, name, /*isBracketed*/ !!isOptional, factory.createJSDocTypeExpression(typeNode), /* isNameFirst */ false, /*comment*/ undefined));
addJSDocTags(changes, sourceFile, signature, paramTags);
}
}
export function addJSDocTags(changes: textChanges.ChangeTracker, sourceFile: SourceFile, parent: HasJSDoc, newTags: readonly JSDocTag[]): void {
const comments = flatMap(parent.jsDoc, j => typeof j.comment === "string" ? factory.createJSDocText(j.comment) : j.comment) as JSDocComment[];
const oldTags = flatMapToMutable(parent.jsDoc, j => j.tags);
const unmergedNewTags = newTags.filter(newTag => !oldTags || !oldTags.some((tag, i) => {
const merged = tryMergeJsdocTags(tag, newTag);
if (merged) oldTags[i] = merged;
return !!merged;
}));
const tag = factory.createJSDocComment(factory.createNodeArray(intersperse(comments, factory.createJSDocText("\n"))), factory.createNodeArray([...(oldTags || emptyArray), ...unmergedNewTags]));
const jsDocNode = parent.kind === SyntaxKind.ArrowFunction ? getJsDocNodeForArrowFunction(parent) : parent;
jsDocNode.jsDoc = parent.jsDoc;
jsDocNode.jsDocCache = parent.jsDocCache;
changes.insertJsdocCommentBefore(sourceFile, jsDocNode, tag);
}
function getJsDocNodeForArrowFunction(signature: ArrowFunction): HasJSDoc {
if (signature.parent.kind === SyntaxKind.PropertyDeclaration) {
return signature.parent as HasJSDoc;
}
return signature.parent.parent as HasJSDoc;
}
function tryMergeJsdocTags(oldTag: JSDocTag, newTag: JSDocTag): JSDocTag | undefined {
if (oldTag.kind !== newTag.kind) {
return undefined;
}
switch (oldTag.kind) {
case SyntaxKind.JSDocParameterTag: {
const oldParam = oldTag as JSDocParameterTag;
const newParam = newTag as JSDocParameterTag;
return isIdentifier(oldParam.name) && isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
? factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment)
: undefined;
}
case SyntaxKind.JSDocReturnTag:
return factory.createJSDocReturnTag(/*tagName*/ undefined, (newTag as JSDocReturnTag).typeExpression, oldTag.comment);
changes.addJSDocTags(sourceFile, signature, paramTags);
}
}
@ -1000,13 +961,25 @@ namespace ts.codefix {
if (usage.numberIndex) {
types.push(checker.createArrayType(combineFromUsage(usage.numberIndex)));
}
if (usage.properties?.size || usage.calls?.length || usage.constructs?.length || usage.stringIndex) {
if (usage.properties?.size || usage.constructs?.length || usage.stringIndex) {
types.push(inferStructuralType(usage));
}
types.push(...(usage.candidateTypes || []).map(t => checker.getBaseTypeOfLiteralType(t)));
types.push(...inferNamedTypesFromProperties(usage));
const candidateTypes = (usage.candidateTypes || []).map(t => checker.getBaseTypeOfLiteralType(t));
const callsType = usage.calls?.length ? inferStructuralType(usage) : undefined;
if (callsType && candidateTypes) {
types.push(checker.getUnionType([callsType, ...candidateTypes], UnionReduction.Subtype));
}
else {
if (callsType) {
types.push(callsType);
}
if (length(candidateTypes)) {
types.push(...candidateTypes);
}
}
types.push(...inferNamedTypesFromProperties(usage));
return types;
}

View file

@ -57,7 +57,9 @@ namespace ts.Completions {
*/
export enum CompletionSource {
/** Completions that require `this.` insertion text */
ThisProperty = "ThisProperty/"
ThisProperty = "ThisProperty/",
/** Auto-import that comes attached to a class member snippet */
ClassMemberSnippet = "ClassMemberSnippet/",
}
const enum SymbolOriginInfoKind {
@ -74,13 +76,9 @@ namespace ts.Completions {
interface SymbolOriginInfo {
kind: SymbolOriginInfoKind;
symbolName?: string;
moduleSymbol?: Symbol;
isDefaultExport?: boolean;
isFromPackageJson?: boolean;
exportName?: string;
fileName?: string;
moduleSpecifier?: string;
}
interface SymbolOriginInfoExport extends SymbolOriginInfo {
@ -88,9 +86,13 @@ namespace ts.Completions {
moduleSymbol: Symbol;
isDefaultExport: boolean;
exportName: string;
exportMapKey: string;
}
interface SymbolOriginInfoResolvedExport extends SymbolOriginInfoExport {
interface SymbolOriginInfoResolvedExport extends SymbolOriginInfo {
symbolName: string;
moduleSymbol: Symbol;
exportName: string;
moduleSpecifier: string;
}
@ -244,7 +246,6 @@ namespace ts.Completions {
// If the request is a continuation of an earlier `isIncomplete` response,
// we can continue it from the cached previous response.
const typeChecker = program.getTypeChecker();
const compilerOptions = program.getCompilerOptions();
const incompleteCompletionsCache = preferences.allowIncompleteCompletions ? host.getIncompleteCompletionsCache?.() : undefined;
if (incompleteCompletionsCache && completionKind === CompletionTriggerKind.TriggerForIncompleteCompletions && previousToken && isIdentifier(previousToken)) {
@ -257,7 +258,7 @@ namespace ts.Completions {
incompleteCompletionsCache?.clear();
}
const stringCompletions = StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken, typeChecker, compilerOptions, host, log, preferences);
const stringCompletions = StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
if (stringCompletions) {
return stringCompletions;
}
@ -274,7 +275,7 @@ namespace ts.Completions {
switch (completionData.kind) {
case CompletionDataKind.Data:
const response = completionInfoFromData(sourceFile, typeChecker, compilerOptions, log, completionData, preferences);
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences);
if (response?.isIncomplete) {
incompleteCompletionsCache?.set(response);
}
@ -294,6 +295,10 @@ namespace ts.Completions {
}
}
function completionEntryDataIsResolved(data: CompletionEntryDataAutoImport | undefined): data is CompletionEntryDataResolved {
return !!data?.moduleSpecifier;
}
function continuePreviousIncompleteResponse(
cache: IncompleteCompletionsCache,
file: SourceFile,
@ -308,9 +313,6 @@ namespace ts.Completions {
const lowerCaseTokenText = location.text.toLowerCase();
const exportMap = getExportInfoMap(file, host, program, cancellationToken);
const checker = program.getTypeChecker();
const autoImportProvider = host.getPackageJsonAutoImportProvider?.();
const autoImportProviderChecker = autoImportProvider?.getTypeChecker();
const newEntries = resolvingModuleSpecifiers(
"continuePreviousIncompleteResponse",
host,
@ -320,7 +322,7 @@ namespace ts.Completions {
/*isForImportStatementCompletion*/ false,
context => {
const entries = mapDefined(previousResponse.entries, entry => {
if (!entry.hasAction || !entry.source || !entry.data || entry.data.moduleSpecifier) {
if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
// Not an auto import or already resolved; keep as is
return entry;
}
@ -329,13 +331,8 @@ namespace ts.Completions {
return undefined;
}
const { symbol, origin } = Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host));
const info = exportMap.get(
file.path,
entry.name,
symbol,
origin.moduleSymbol.name,
origin.isFromPackageJson ? autoImportProviderChecker! : checker);
const { origin } = Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host));
const info = exportMap.get(file.path, entry.data.exportMapKey);
const result = info && context.tryResolve(info, !isExternalModuleNameRelative(stripQuotes(origin.moduleSymbol.name)));
if (!result) return entry;
@ -407,7 +404,15 @@ namespace ts.Completions {
return location?.kind === SyntaxKind.Identifier ? createTextSpanFromNode(location) : undefined;
}
function completionInfoFromData(sourceFile: SourceFile, typeChecker: TypeChecker, compilerOptions: CompilerOptions, log: Log, completionData: CompletionData, preferences: UserPreferences): CompletionInfo | undefined {
function completionInfoFromData(
sourceFile: SourceFile,
host: LanguageServiceHost,
program: Program,
compilerOptions: CompilerOptions,
log: Log,
completionData: CompletionData,
preferences: UserPreferences,
): CompletionInfo | undefined {
const {
symbols,
contextToken,
@ -447,7 +452,8 @@ namespace ts.Completions {
contextToken,
location,
sourceFile,
typeChecker,
host,
program,
getEmitScriptTarget(compilerOptions),
log,
completionKind,
@ -476,7 +482,8 @@ namespace ts.Completions {
contextToken,
location,
sourceFile,
typeChecker,
host,
program,
getEmitScriptTarget(compilerOptions),
log,
completionKind,
@ -618,7 +625,8 @@ namespace ts.Completions {
contextToken: Node | undefined,
location: Node,
sourceFile: SourceFile,
typeChecker: TypeChecker,
host: LanguageServiceHost,
program: Program,
name: string,
needsConvertPropertyAccess: boolean,
origin: SymbolOriginInfo | undefined,
@ -629,14 +637,17 @@ namespace ts.Completions {
useSemicolons: boolean,
options: CompilerOptions,
preferences: UserPreferences,
completionKind: CompletionKind,
): CompletionEntry | undefined {
let insertText: string | undefined;
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
let data: CompletionEntryData | undefined;
let isSnippet: true | undefined;
let source = getSourceFromOrigin(origin);
let sourceDisplay;
let hasAction;
const typeChecker = program.getTypeChecker();
const insertQuestionDot = origin && originIsNullableMember(origin);
const useBraces = origin && originIsSymbolMember(origin) || needsConvertPropertyAccess;
if (origin && originIsThisType(origin)) {
@ -690,13 +701,16 @@ namespace ts.Completions {
}
}
if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) {
return undefined;
}
if (originIsExport(origin) || originIsResolvedExport(origin)) {
data = originToCompletionEntryData(origin);
hasAction = !importCompletionNode;
if (preferences.includeCompletionsWithClassMemberSnippets &&
preferences.includeCompletionsWithInsertText &&
completionKind === CompletionKind.MemberLike &&
isClassLikeMemberCompletion(symbol, location)) {
let importAdder;
({ insertText, isSnippet, importAdder } = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken));
if (importAdder?.hasFixes()) {
hasAction = true;
source = CompletionSource.ClassMemberSnippet;
}
}
const kind = SymbolDisplay.getSymbolKind(typeChecker, symbol, location);
@ -724,10 +738,15 @@ namespace ts.Completions {
insertText = `${escapeSnippetText(name)}={$1}`;
isSnippet = true;
}
}
if (isSnippet) {
replacementSpan = createTextSpanFromNode(location, sourceFile);
}
if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) {
return undefined;
}
if (originIsExport(origin) || originIsResolvedExport(origin)) {
data = originToCompletionEntryData(origin);
hasAction = !importCompletionNode;
}
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
@ -743,7 +762,7 @@ namespace ts.Completions {
kind,
kindModifiers: SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
sortText,
source: getSourceFromOrigin(origin),
source,
hasAction: hasAction ? true : undefined,
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || undefined,
insertText,
@ -756,18 +775,284 @@ namespace ts.Completions {
};
}
function escapeSnippetText(text: string): string {
return text.replace(/\$/gm, "\\$");
function isClassLikeMemberCompletion(symbol: Symbol, location: Node): boolean {
// TODO: support JS files.
if (isInJSFile(location)) {
return false;
}
// Completion symbol must be for a class member.
const memberFlags =
SymbolFlags.ClassMember
& SymbolFlags.EnumMemberExcludes;
/* In
`class C {
|
}`
`location` is a class-like declaration.
In
`class C {
m|
}`
`location` is an identifier,
`location.parent` is a class element declaration,
and `location.parent.parent` is a class-like declaration.
In
`abstract class C {
abstract
abstract m|
}`
`location` is a syntax list (with modifiers as children),
and `location.parent` is a class-like declaration.
*/
return !!(symbol.flags & memberFlags) &&
(
isClassLike(location) ||
(
location.parent &&
location.parent.parent &&
isClassElement(location.parent) &&
location === location.parent.name &&
isClassLike(location.parent.parent)
) ||
(
location.parent &&
isSyntaxList(location) &&
isClassLike(location.parent)
)
);
}
function originToCompletionEntryData(origin: SymbolOriginInfoExport): CompletionEntryData | undefined {
function getEntryForMemberCompletion(
host: LanguageServiceHost,
program: Program,
options: CompilerOptions,
preferences: UserPreferences,
name: string,
symbol: Symbol,
location: Node,
contextToken: Node | undefined,
): { insertText: string, isSnippet?: true, importAdder?: codefix.ImportAdder } {
const classLikeDeclaration = findAncestor(location, isClassLike);
if (!classLikeDeclaration) {
return { insertText: name };
}
let isSnippet: true | undefined;
let insertText: string = name;
const checker = program.getTypeChecker();
const sourceFile = location.getSourceFile();
const printer = createSnippetPrinter({
removeComments: true,
module: options.module,
target: options.target,
omitTrailingSemicolon: false,
newLine: getNewLineKind(getNewLineCharacter(options, maybeBind(host, host.getNewLine))),
});
const importAdder = codefix.createImportAdder(sourceFile, program, preferences, host);
let body;
if (preferences.includeCompletionsWithSnippetText) {
isSnippet = true;
// We are adding a tabstop (i.e. `$0`) in the body of the suggested member,
// if it has one, so that the cursor ends up in the body once the completion is inserted.
// Note: this assumes we won't have more than one body in the completion nodes, which should be the case.
const emptyStatement = factory.createExpressionStatement(factory.createIdentifier(""));
setSnippetElement(emptyStatement, { kind: SnippetKind.TabStop, order: 0 });
body = factory.createBlock([emptyStatement], /* multiline */ true);
}
else {
body = factory.createBlock([], /* multiline */ true);
}
let modifiers = ModifierFlags.None;
// Whether the suggested member should be abstract.
// e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`.
// Note: We are relying on checking if the context token is `abstract`,
// since other visibility modifiers (e.g. `protected`) should come *before* `abstract`.
// However, that is not true for the e.g. `override` modifier, so this check has its limitations.
const isAbstract = contextToken && isModifierLike(contextToken) === SyntaxKind.AbstractKeyword;
const completionNodes: Node[] = [];
codefix.addNewNodeForMemberSymbol(
symbol,
classLikeDeclaration,
sourceFile,
{ program, host },
preferences,
importAdder,
// `addNewNodeForMemberSymbol` calls this callback function for each new member node
// it adds for the given member symbol.
// We store these member nodes in the `completionNodes` array.
// Note: there might be:
// - No nodes if `addNewNodeForMemberSymbol` cannot figure out a node for the member;
// - One node;
// - More than one node if the member is overloaded (e.g. a method with overload signatures).
node => {
let requiredModifiers = ModifierFlags.None;
if (isAbstract) {
requiredModifiers |= ModifierFlags.Abstract;
}
if (isClassElement(node)
&& checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === MemberOverrideStatus.NeedsOverride) {
requiredModifiers |= ModifierFlags.Override;
}
let presentModifiers = ModifierFlags.None;
if (!completionNodes.length) {
// Omit already present modifiers from the first completion node/signature.
if (contextToken) {
presentModifiers = getPresentModifiers(contextToken);
}
// Keep track of added missing required modifiers and modifiers already present.
// This is needed when we have overloaded signatures,
// so this callback will be called for multiple nodes/signatures,
// and we need to make sure the modifiers are uniform for all nodes/signatures.
modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers;
}
node = factory.updateModifiers(node, modifiers & (~presentModifiers));
completionNodes.push(node);
},
body,
codefix.PreserveOptionalFlags.Property,
isAbstract);
if (completionNodes.length) {
insertText = printer.printSnippetList(
ListFormat.MultiLine | ListFormat.NoTrailingNewLine,
factory.createNodeArray(completionNodes),
sourceFile);
}
return { insertText, isSnippet, importAdder };
}
function getPresentModifiers(contextToken: Node): ModifierFlags {
let modifiers = ModifierFlags.None;
let contextMod;
/*
Cases supported:
In
`class C {
public abstract |
}`
`contextToken` is ``abstract`` (as an identifier),
`contextToken.parent` is property declaration,
`location` is class declaration ``class C { ... }``.
In
`class C {
protected override m|
}`
`contextToken` is ``override`` (as a keyword),
`contextToken.parent` is property declaration,
`location` is identifier ``m``,
`location.parent` is property declaration ``protected override m``,
`location.parent.parent` is class declaration ``class C { ... }``.
*/
if (contextMod = isModifierLike(contextToken)) {
modifiers |= modifierToFlag(contextMod);
}
if (isPropertyDeclaration(contextToken.parent)) {
modifiers |= modifiersToFlags(contextToken.parent.modifiers);
}
return modifiers;
}
function isModifierLike(node: Node): ModifierSyntaxKind | undefined {
if (isModifier(node)) {
return node.kind;
}
if (isIdentifier(node) && node.originalKeywordKind && isModifierKind(node.originalKeywordKind)) {
return node.originalKeywordKind;
}
return undefined;
}
function createSnippetPrinter(
printerOptions: PrinterOptions,
) {
const printer = createPrinter(printerOptions);
const baseWriter = createTextWriter(getNewLineCharacter(printerOptions));
const writer: EmitTextWriter = {
...baseWriter,
write: s => baseWriter.write(escapeSnippetText(s)),
nonEscapingWrite: baseWriter.write,
writeLiteral: s => baseWriter.writeLiteral(escapeSnippetText(s)),
writeStringLiteral: s => baseWriter.writeStringLiteral(escapeSnippetText(s)),
writeSymbol: (s, symbol) => baseWriter.writeSymbol(escapeSnippetText(s), symbol),
writeParameter: s => baseWriter.writeParameter(escapeSnippetText(s)),
writeComment: s => baseWriter.writeComment(escapeSnippetText(s)),
writeProperty: s => baseWriter.writeProperty(escapeSnippetText(s)),
};
return {
printSnippetList,
};
/* Snippet-escaping version of `printer.printList`. */
function printSnippetList(
format: ListFormat,
list: NodeArray<Node>,
sourceFile: SourceFile | undefined,
): string {
writer.clear();
printer.writeList(format, list, sourceFile, writer);
return writer.getText();
}
}
function originToCompletionEntryData(origin: SymbolOriginInfoExport | SymbolOriginInfoResolvedExport): CompletionEntryData | undefined {
const ambientModuleName = origin.fileName ? undefined : stripQuotes(origin.moduleSymbol.name);
const isPackageJsonImport = origin.isFromPackageJson ? true : undefined;
if (originIsResolvedExport(origin)) {
const resolvedData: CompletionEntryDataResolved = {
exportName: origin.exportName,
moduleSpecifier: origin.moduleSpecifier,
ambientModuleName,
fileName: origin.fileName,
isPackageJsonImport,
};
return resolvedData;
}
const unresolvedData: CompletionEntryDataUnresolved = {
exportName: origin.exportName,
exportMapKey: origin.exportMapKey,
fileName: origin.fileName,
ambientModuleName: origin.fileName ? undefined : stripQuotes(origin.moduleSymbol.name),
isPackageJsonImport: origin.isFromPackageJson ? true : undefined,
moduleSpecifier: originIsResolvedExport(origin) ? origin.moduleSpecifier : undefined,
};
return unresolvedData;
}
function completionEntryDataToSymbolOriginInfo(data: CompletionEntryData, completionName: string, moduleSymbol: Symbol): SymbolOriginInfoExport | SymbolOriginInfoResolvedExport {
const isDefaultExport = data.exportName === InternalSymbolName.Default;
const isFromPackageJson = !!data.isPackageJsonImport;
if (completionEntryDataIsResolved(data)) {
const resolvedOrigin: SymbolOriginInfoResolvedExport = {
kind: SymbolOriginInfoKind.ResolvedExport,
exportName: data.exportName,
moduleSpecifier: data.moduleSpecifier,
symbolName: completionName,
fileName: data.fileName,
moduleSymbol,
isDefaultExport,
isFromPackageJson,
};
return resolvedOrigin;
}
const unresolvedOrigin: SymbolOriginInfoExport = {
kind: SymbolOriginInfoKind.Export,
exportName: data.exportName,
exportMapKey: data.exportMapKey,
symbolName: completionName,
fileName: data.fileName,
moduleSymbol,
isDefaultExport,
isFromPackageJson,
};
return unresolvedOrigin;
}
function getInsertTextAndReplacementSpanForImportCompletion(name: string, importCompletionNode: Node, contextToken: Node | undefined, origin: SymbolOriginInfoResolvedExport, useSemicolons: boolean, options: CompilerOptions, preferences: UserPreferences) {
@ -825,7 +1110,8 @@ namespace ts.Completions {
contextToken: Node | undefined,
location: Node,
sourceFile: SourceFile,
typeChecker: TypeChecker,
host: LanguageServiceHost,
program: Program,
target: ScriptTarget,
log: Log,
kind: CompletionKind,
@ -843,6 +1129,7 @@ namespace ts.Completions {
const start = timestamp();
const variableDeclaration = getVariableDeclaration(location);
const useSemicolons = probablyUsesSemicolons(sourceFile);
const typeChecker = program.getTypeChecker();
// Tracks unique names.
// Value is set to false for global variables or completions from external module exports, because we can have multiple of those;
// true otherwise. Based on the order we add things we will always see locals first, then globals, then module exports.
@ -866,7 +1153,8 @@ namespace ts.Completions {
contextToken,
location,
sourceFile,
typeChecker,
host,
program,
name,
needsConvertPropertyAccess,
origin,
@ -876,7 +1164,8 @@ namespace ts.Completions {
importCompletionNode,
useSemicolons,
compilerOptions,
preferences
preferences,
kind,
);
if (!entry) {
continue;
@ -983,6 +1272,7 @@ namespace ts.Completions {
location: Node;
origin: SymbolOriginInfo | SymbolOriginInfoExport | SymbolOriginInfoResolvedExport | undefined;
previousToken: Node | undefined;
contextToken: Node | undefined;
readonly isJsxInitializer: IsJsxInitializer;
readonly isTypeOnlyLocation: boolean;
}
@ -998,11 +1288,13 @@ namespace ts.Completions {
if (entryId.data) {
const autoImport = getAutoImportSymbolFromCompletionEntryData(entryId.name, entryId.data, program, host);
if (autoImport) {
const { contextToken, previousToken } = getRelevantTokens(position, sourceFile);
return {
type: "symbol",
symbol: autoImport.symbol,
location: getTouchingPropertyName(sourceFile, position),
previousToken: findPrecedingToken(position, sourceFile, /*startNode*/ undefined)!,
previousToken,
contextToken,
isJsxInitializer: false,
isTypeOnlyLocation: false,
origin: autoImport.origin,
@ -1019,7 +1311,7 @@ namespace ts.Completions {
return { type: "request", request: completionData };
}
const { symbols, literals, location, completionKind, symbolToOriginInfoMap, previousToken, isJsxInitializer, isTypeOnlyLocation } = completionData;
const { symbols, literals, location, completionKind, symbolToOriginInfoMap, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } = completionData;
const literal = find(literals, l => completionNameForLiteral(sourceFile, preferences, l) === entryId.name);
if (literal !== undefined) return { type: "literal", literal };
@ -1031,8 +1323,8 @@ namespace ts.Completions {
return firstDefined(symbols, (symbol, index): SymbolCompletion | undefined => {
const origin = symbolToOriginInfoMap[index];
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
? { type: "symbol" as const, symbol, location, origin, previousToken, isJsxInitializer, isTypeOnlyLocation }
return info && info.name === entryId.name && (entryId.source === CompletionSource.ClassMemberSnippet && symbol.flags & SymbolFlags.ClassMember || getSourceFromOrigin(origin) === entryId.source)
? { type: "symbol" as const, symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation }
: undefined;
}) || { type: "none" };
}
@ -1056,7 +1348,7 @@ namespace ts.Completions {
): CompletionEntryDetails | undefined {
const typeChecker = program.getTypeChecker();
const compilerOptions = program.getCompilerOptions();
const { name } = entryId;
const { name, source, data } = entryId;
const contextToken = findPrecedingToken(position, sourceFile);
if (isInString(sourceFile, position, contextToken)) {
@ -1082,8 +1374,8 @@ namespace ts.Completions {
}
}
case "symbol": {
const { symbol, location, origin, previousToken } = symbolCompletion;
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, entryId.data);
const { symbol, location, contextToken, origin, previousToken } = symbolCompletion;
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source);
return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217
}
case "literal": {
@ -1119,6 +1411,9 @@ namespace ts.Completions {
readonly sourceDisplay: SymbolDisplayPart[] | undefined;
}
function getCompletionEntryCodeActionsAndSourceDisplay(
name: string,
location: Node,
contextToken: Node | undefined,
origin: SymbolOriginInfo | SymbolOriginInfoExport | SymbolOriginInfoResolvedExport | undefined,
symbol: Symbol,
program: Program,
@ -1130,6 +1425,7 @@ namespace ts.Completions {
formatContext: formatting.FormatContext,
preferences: UserPreferences,
data: CompletionEntryData | undefined,
source: string | undefined,
): CodeActionsAndSourceDisplay {
if (data?.moduleSpecifier) {
const { contextToken, previousToken } = getRelevantTokens(position, sourceFile);
@ -1139,15 +1435,39 @@ namespace ts.Completions {
}
}
if (source === CompletionSource.ClassMemberSnippet) {
const { importAdder } = getEntryForMemberCompletion(
host,
program,
compilerOptions,
preferences,
name,
symbol,
location,
contextToken);
if (importAdder) {
const changes = textChanges.ChangeTracker.with(
{ host, formatContext, preferences },
importAdder.writeFixes);
return {
sourceDisplay: undefined,
codeActions: [{
changes,
description: diagnosticToString([Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
}],
};
}
}
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
return { codeActions: undefined, sourceDisplay: undefined };
}
const checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider!()!.getTypeChecker() : program.getTypeChecker();
const { moduleSymbol } = origin;
const exportedSymbol = checker.getMergedSymbol(skipAlias(symbol.exportSymbol || symbol, checker));
const targetSymbol = checker.getMergedSymbol(skipAlias(symbol.exportSymbol || symbol, checker));
const { moduleSpecifier, codeAction } = codefix.getImportCompletionAction(
exportedSymbol,
targetSymbol,
moduleSymbol,
sourceFile,
getNameForExportedSymbol(symbol, getEmitScriptTarget(compilerOptions)),
@ -1762,19 +2082,35 @@ namespace ts.Completions {
const index = symbols.length;
symbols.push(firstAccessibleSymbol);
const moduleSymbol = firstAccessibleSymbol.parent;
if (!moduleSymbol || !isExternalModuleSymbol(moduleSymbol)) {
if (!moduleSymbol ||
!isExternalModuleSymbol(moduleSymbol) ||
typeChecker.tryGetMemberInModuleExportsAndProperties(firstAccessibleSymbol.name, moduleSymbol) !== firstAccessibleSymbol
) {
symbolToOriginInfoMap[index] = { kind: getNullableSymbolOriginInfoKind(SymbolOriginInfoKind.SymbolMemberNoExport) };
}
else {
const origin: SymbolOriginInfoExport = {
kind: getNullableSymbolOriginInfoKind(SymbolOriginInfoKind.SymbolMemberExport),
const fileName = isExternalModuleNameRelative(stripQuotes(moduleSymbol.name)) ? getSourceFileOfModule(moduleSymbol)?.fileName : undefined;
const { moduleSpecifier } = codefix.getModuleSpecifierForBestExportInfo([{
exportKind: ExportKind.Named,
moduleFileName: fileName,
isFromPackageJson: false,
moduleSymbol,
isDefaultExport: false,
symbolName: firstAccessibleSymbol.name,
exportName: firstAccessibleSymbol.name,
fileName: isExternalModuleNameRelative(stripQuotes(moduleSymbol.name)) ? cast(moduleSymbol.valueDeclaration, isSourceFile).fileName : undefined,
};
symbolToOriginInfoMap[index] = origin;
symbol: firstAccessibleSymbol,
targetFlags: skipAlias(firstAccessibleSymbol, typeChecker).flags,
}], sourceFile, program, host, preferences) || {};
if (moduleSpecifier) {
const origin: SymbolOriginInfoResolvedExport = {
kind: getNullableSymbolOriginInfoKind(SymbolOriginInfoKind.SymbolMemberExport),
moduleSymbol,
isDefaultExport: false,
symbolName: firstAccessibleSymbol.name,
exportName: firstAccessibleSymbol.name,
fileName,
moduleSpecifier,
};
symbolToOriginInfoMap[index] = origin;
}
}
}
else if (preferences.includeCompletionsWithInsertText) {
@ -1939,10 +2275,10 @@ namespace ts.Completions {
if (isNonContextualObjectLiteral) return false;
// If not already a module, must have modules enabled.
if (!preferences.includeCompletionsForModuleExports) return false;
// If already using ES6 modules, OK to continue using them.
// If already using ES modules, OK to continue using them.
if (sourceFile.externalModuleIndicator || sourceFile.commonJsModuleIndicator) return true;
// If module transpilation is enabled or we're targeting es6 or above, or not emitting, OK.
if (compilerOptionsIndicateEs6Modules(program.getCompilerOptions())) return true;
if (compilerOptionsIndicateEsModules(program.getCompilerOptions())) return true;
// If some file is using ES6 modules, assume that it's OK to add more.
return programContainsModules(program);
}
@ -2034,7 +2370,7 @@ namespace ts.Completions {
preferences,
!!importCompletionNode,
context => {
exportInfo.forEach(sourceFile.path, (info, symbolName, isFromAmbientModule) => {
exportInfo.forEach(sourceFile.path, (info, symbolName, isFromAmbientModule, exportMapKey) => {
if (!isIdentifierText(symbolName, getEmitScriptTarget(host.getCompilationSettings()))) return;
if (!detailsEntryId && isStringANonContextualKeyword(symbolName)) return;
// `targetFlags` should be the same for each `info`
@ -2056,6 +2392,7 @@ namespace ts.Completions {
kind: moduleSpecifier ? SymbolOriginInfoKind.ResolvedExport : SymbolOriginInfoKind.Export,
moduleSpecifier,
symbolName,
exportMapKey,
exportName: exportInfo.exportKind === ExportKind.ExportEquals ? InternalSymbolName.ExportEquals : exportInfo.symbol.name,
fileName: exportInfo.moduleFileName,
isDefaultExport,
@ -2154,8 +2491,9 @@ namespace ts.Completions {
function isNewIdentifierDefinitionLocation(): boolean {
if (contextToken) {
const containingNodeKind = contextToken.parent.kind;
const tokenKind = keywordForNode(contextToken);
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(contextToken)) {
switch (tokenKind) {
case SyntaxKind.CommaToken:
return containingNodeKind === SyntaxKind.CallExpression // func( a, |
|| containingNodeKind === SyntaxKind.Constructor // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
@ -2199,10 +2537,16 @@ namespace ts.Completions {
case SyntaxKind.TemplateMiddle:
return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${|
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public |
case SyntaxKind.AsyncKeyword:
return containingNodeKind === SyntaxKind.MethodDeclaration // const obj = { async c|()
|| containingNodeKind === SyntaxKind.ShorthandPropertyAssignment; // const obj = { async c|
case SyntaxKind.AsteriskToken:
return containingNodeKind === SyntaxKind.MethodDeclaration; // const obj = { * c|
}
if (isClassMemberCompletionKeyword(tokenKind)) {
return true;
}
}
@ -2974,7 +3318,7 @@ namespace ts.Completions {
return { contextToken: previousToken as Node, previousToken: previousToken as Node };
}
function getAutoImportSymbolFromCompletionEntryData(name: string, data: CompletionEntryData, program: Program, host: LanguageServiceHost): { symbol: Symbol, origin: SymbolOriginInfoExport } | undefined {
function getAutoImportSymbolFromCompletionEntryData(name: string, data: CompletionEntryData, program: Program, host: LanguageServiceHost): { symbol: Symbol, origin: SymbolOriginInfoExport | SymbolOriginInfoResolvedExport } | undefined {
const containingProgram = data.isPackageJsonImport ? host.getPackageJsonAutoImportProvider!()! : program;
const checker = containingProgram.getTypeChecker();
const moduleSymbol =
@ -2989,18 +3333,7 @@ namespace ts.Completions {
if (!symbol) return undefined;
const isDefaultExport = data.exportName === InternalSymbolName.Default;
symbol = isDefaultExport && getLocalSymbolForExportDefault(symbol) || symbol;
return {
symbol,
origin: {
kind: data.moduleSpecifier ? SymbolOriginInfoKind.ResolvedExport : SymbolOriginInfoKind.Export,
moduleSymbol,
symbolName: name,
isDefaultExport,
exportName: data.exportName,
fileName: data.fileName,
isFromPackageJson: !!data.isPackageJsonImport,
}
};
return { symbol, origin: completionEntryDataToSymbolOriginInfo(data, name, moduleSymbol) };
}
interface CompletionEntryDisplayNameForSymbol {
@ -3192,6 +3525,7 @@ namespace ts.Completions {
// function f<T>(x: T) {}
// f({ abc/**/: "" }) // `abc` is a member of `T` but only because it declares itself
function hasDeclarationOtherThanSelf(member: Symbol) {
if (!length(member.declarations)) return true;
return some(member.declarations, decl => decl.parent !== obj);
}
}
@ -3555,5 +3889,6 @@ namespace ts.Completions {
}
return charCode;
}
}

View file

@ -46,8 +46,8 @@ namespace ts {
isUsableByFile(importingFile: Path): boolean;
clear(): void;
add(importingFile: Path, symbol: Symbol, key: __String, moduleSymbol: Symbol, moduleFile: SourceFile | undefined, exportKind: ExportKind, isFromPackageJson: boolean, scriptTarget: ScriptTarget, checker: TypeChecker): void;
get(importingFile: Path, importedName: string, symbol: Symbol, moduleName: string, checker: TypeChecker): readonly SymbolExportInfo[] | undefined;
forEach(importingFile: Path, action: (info: readonly SymbolExportInfo[], name: string, isFromAmbientModule: boolean) => void): void;
get(importingFile: Path, key: string): readonly SymbolExportInfo[] | undefined;
forEach(importingFile: Path, action: (info: readonly SymbolExportInfo[], name: string, isFromAmbientModule: boolean, key: string) => void): void;
releaseSymbols(): void;
isEmpty(): boolean;
/** @returns Whether the change resulted in the cache being cleared */
@ -79,19 +79,24 @@ namespace ts {
}
const isDefault = exportKind === ExportKind.Default;
const namedSymbol = isDefault && getLocalSymbolForExportDefault(symbol) || symbol;
// A re-export merged with an export from a module augmentation can result in `symbol`
// being an external module symbol; the name it is re-exported by will be `symbolTableKey`
// (which comes from the keys of `moduleSymbol.exports`.)
const importedName = isExternalModuleSymbol(namedSymbol)
// 1. A named export must be imported by its key in `moduleSymbol.exports` or `moduleSymbol.members`.
// 2. A re-export merged with an export from a module augmentation can result in `symbol`
// being an external module symbol; the name it is re-exported by will be `symbolTableKey`
// (which comes from the keys of `moduleSymbol.exports`.)
// 3. Otherwise, we have a default/namespace import that can be imported by any name, and
// `symbolTableKey` will be something undesirable like `export=` or `default`, so we try to
// get a better name.
const importedName = exportKind === ExportKind.Named || isExternalModuleSymbol(namedSymbol)
? unescapeLeadingUnderscores(symbolTableKey)
: getNameForExportedSymbol(namedSymbol, scriptTarget);
const moduleName = stripQuotes(moduleSymbol.name);
const id = exportInfoId++;
const target = skipAlias(symbol, checker);
const storedSymbol = symbol.flags & SymbolFlags.Transient ? undefined : symbol;
const storedModuleSymbol = moduleSymbol.flags & SymbolFlags.Transient ? undefined : moduleSymbol;
if (!storedSymbol || !storedModuleSymbol) symbols.set(id, [symbol, moduleSymbol]);
exportInfo.add(key(importedName, symbol, moduleName, checker), {
exportInfo.add(key(importedName, symbol, isExternalModuleNameRelative(moduleName) ? undefined : moduleName, checker), {
id,
symbolTableKey,
symbolName: importedName,
@ -99,22 +104,22 @@ namespace ts {
moduleFile,
moduleFileName: moduleFile?.fileName,
exportKind,
targetFlags: skipAlias(symbol, checker).flags,
targetFlags: target.flags,
isFromPackageJson,
symbol: storedSymbol,
moduleSymbol: storedModuleSymbol,
});
},
get: (importingFile, importedName, symbol, moduleName, checker) => {
get: (importingFile, key) => {
if (importingFile !== usableByFileName) return;
const result = exportInfo.get(key(importedName, symbol, moduleName, checker));
const result = exportInfo.get(key);
return result?.map(rehydrateCachedInfo);
},
forEach: (importingFile, action) => {
if (importingFile !== usableByFileName) return;
exportInfo.forEach((info, key) => {
const { symbolName, ambientModuleName } = parseKey(key);
action(info.map(rehydrateCachedInfo), symbolName, !!ambientModuleName);
action(info.map(rehydrateCachedInfo), symbolName, !!ambientModuleName, key);
});
},
releaseSymbols: () => {
@ -183,29 +188,18 @@ namespace ts {
};
}
function key(importedName: string, symbol: Symbol, moduleName: string, checker: TypeChecker) {
const unquoted = stripQuotes(moduleName);
const moduleKey = isExternalModuleNameRelative(unquoted) ? "/" : unquoted;
const target = skipAlias(symbol, checker);
return `${importedName}|${createSymbolKey(target)}|${moduleKey}`;
function key(importedName: string, symbol: Symbol, ambientModuleName: string | undefined, checker: TypeChecker): string {
const moduleKey = ambientModuleName || "";
return `${importedName}|${getSymbolId(skipAlias(symbol, checker))}|${moduleKey}`;
}
function parseKey(key: string) {
const symbolName = key.substring(0, key.indexOf("|"));
const moduleKey = key.substring(key.lastIndexOf("|") + 1);
const ambientModuleName = moduleKey === "/" ? undefined : moduleKey;
const ambientModuleName = moduleKey === "" ? undefined : moduleKey;
return { symbolName, ambientModuleName };
}
function createSymbolKey(symbol: Symbol) {
let key = symbol.name;
while (symbol.parent) {
key += `,${symbol.parent.name}`;
symbol = symbol.parent;
}
return key;
}
function fileIsGlobalOnly(file: SourceFile) {
return !file.commonJsModuleIndicator && !file.externalModuleIndicator && !file.moduleAugmentations && !file.ambientModuleNames;
}
@ -331,7 +325,7 @@ namespace ts {
let moduleCount = 0;
forEachExternalModuleToImportFrom(program, host, /*useAutoImportProvider*/ true, (moduleSymbol, moduleFile, program, isFromPackageJson) => {
if (++moduleCount % 100 === 0) cancellationToken?.throwIfCancellationRequested();
const seenExports = new Map<Symbol, true>();
const seenExports = new Map<__String, true>();
const checker = program.getTypeChecker();
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
// Note: I think we shouldn't actually see resolved module symbols here, but weird merges
@ -349,7 +343,7 @@ namespace ts {
checker);
}
checker.forEachExportAndPropertyOfModule(moduleSymbol, (exported, key) => {
if (exported !== defaultInfo?.symbol && isImportableSymbol(exported, checker) && addToSeen(seenExports, exported)) {
if (exported !== defaultInfo?.symbol && isImportableSymbol(exported, checker) && addToSeen(seenExports, key)) {
cache.add(
importingFile.path,
exported,

View file

@ -1323,7 +1323,7 @@ namespace ts.FindAllReferences {
if (!symbol) return undefined;
for (const token of getPossibleSymbolReferenceNodes(sourceFile, symbol.name, searchContainer)) {
if (!isIdentifier(token) || token === definition || token.escapedText !== definition.escapedText) continue;
const referenceSymbol: Symbol = checker.getSymbolAtLocation(token)!; // See GH#19955 for why the type annotation is necessary
const referenceSymbol = checker.getSymbolAtLocation(token)!;
if (referenceSymbol === symbol
|| checker.getShorthandAssignmentValueSymbol(token.parent) === symbol
|| isExportSpecifier(token.parent) && getLocalSymbolForExportSpecifier(token, referenceSymbol, token.parent, checker) === symbol) {
@ -2021,7 +2021,8 @@ namespace ts.FindAllReferences {
}
}
else {
return nodeEntry(ref, EntryKind.StringLiteral);
return isNoSubstitutionTemplateLiteral(ref) && !rangeIsOnSingleLine(ref, sourceFile) ? undefined :
nodeEntry(ref, EntryKind.StringLiteral);
}
}
});

View file

@ -198,14 +198,17 @@ namespace ts.GoToDefinition {
return undefined;
}
const symbol = typeChecker.getSymbolAtLocation(node);
const symbol = getSymbol(node, typeChecker);
if (!symbol) return undefined;
const typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
const returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
const fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
// If a function returns 'void' or some other type with no definition, just return the function definition.
return fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
const typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
return typeDefinitions.length ? typeDefinitions
: !(symbol.flags & SymbolFlags.Value) && symbol.flags & SymbolFlags.Type ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node)
: undefined;
}
function definitionFromType(type: Type, checker: TypeChecker, node: Node): readonly DefinitionInfo[] {

View file

@ -34,7 +34,7 @@ namespace ts.OutliningElementsCollector {
if (depthRemaining === 0) return;
cancellationToken.throwIfCancellationRequested();
if (isDeclaration(n) || isVariableStatement(n) || isReturnStatement(n) || n.kind === SyntaxKind.EndOfFileToken) {
if (isDeclaration(n) || isVariableStatement(n) || isReturnStatement(n) || isCallOrNewExpression(n) || n.kind === SyntaxKind.EndOfFileToken) {
addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out);
}

View file

@ -314,8 +314,7 @@ namespace ts.refactor.extractSymbol {
return { errors: [createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
}
const statements: Statement[] = [];
const start2 = start; // TODO: GH#18217 Need to alias `start` to get this to compile. See https://github.com/Microsoft/TypeScript/issues/19955#issuecomment-344118248
for (const statement of (start2.parent as BlockLike).statements) {
for (const statement of start.parent.statements) {
if (statement === start || statements.length) {
const errors = checkNode(statement);
if (errors) {
@ -364,10 +363,11 @@ namespace ts.refactor.extractSymbol {
return node.expression;
}
}
else if (isVariableStatement(node)) {
else if (isVariableStatement(node) || isVariableDeclarationList(node)) {
const declarations = isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
let numInitializers = 0;
let lastInitializer: Expression | undefined;
for (const declaration of node.declarationList.declarations) {
for (const declaration of declarations) {
if (declaration.initializer) {
numInitializers++;
lastInitializer = declaration.initializer;
@ -383,7 +383,6 @@ namespace ts.refactor.extractSymbol {
return node.initializer;
}
}
return node;
}

View file

@ -138,9 +138,9 @@ namespace ts.refactor {
return [...prologueDirectives, ...toMove.all];
}
const useEs6ModuleSyntax = !!oldFile.externalModuleIndicator;
const useEsModuleSyntax = !!oldFile.externalModuleIndicator;
const quotePreference = getQuotePreference(oldFile, preferences);
const importsFromNewFile = createOldFileImportsFromNewFile(usage.oldFileImportsFromNewFile, newModuleName, useEs6ModuleSyntax, quotePreference);
const importsFromNewFile = createOldFileImportsFromNewFile(usage.oldFileImportsFromNewFile, newModuleName, useEsModuleSyntax, quotePreference);
if (importsFromNewFile) {
insertImports(changes, oldFile, importsFromNewFile, /*blankLineBetween*/ true);
}
@ -149,8 +149,8 @@ namespace ts.refactor {
deleteMovedStatements(oldFile, toMove.ranges, changes);
updateImportsInOtherFiles(changes, program, oldFile, usage.movedSymbols, newModuleName);
const imports = getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByNewFile, usage.newFileImportsFromOldFile, changes, checker, useEs6ModuleSyntax, quotePreference);
const body = addExports(oldFile, toMove.all, usage.oldFileImportsFromNewFile, useEs6ModuleSyntax);
const imports = getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByNewFile, usage.newFileImportsFromOldFile, changes, checker, useEsModuleSyntax, quotePreference);
const body = addExports(oldFile, toMove.all, usage.oldFileImportsFromNewFile, useEsModuleSyntax);
if (imports.length && body.length) {
return [
...prologueDirectives,
@ -429,7 +429,7 @@ namespace ts.refactor {
newFileImportsFromOldFile: ReadonlySymbolSet,
changes: textChanges.ChangeTracker,
checker: TypeChecker,
useEs6ModuleSyntax: boolean,
useEsModuleSyntax: boolean,
quotePreference: QuotePreference,
): readonly SupportedImportStatement[] {
const copiedOldImports: SupportedImportStatement[] = [];
@ -454,7 +454,7 @@ namespace ts.refactor {
const top = getTopLevelDeclarationStatement(decl);
if (markSeenTop(top)) {
addExportToChanges(oldFile, top, name, changes, useEs6ModuleSyntax);
addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax);
}
if (hasSyntacticModifier(decl, ModifierFlags.Default)) {
oldFileDefault = name;
@ -465,7 +465,7 @@ namespace ts.refactor {
}
});
append(copiedOldImports, makeImportOrRequire(oldFileDefault, oldFileNamedImports, removeFileExtension(getBaseFileName(oldFile.fileName)), useEs6ModuleSyntax, quotePreference));
append(copiedOldImports, makeImportOrRequire(oldFileDefault, oldFileNamedImports, removeFileExtension(getBaseFileName(oldFile.fileName)), useEsModuleSyntax, quotePreference));
return copiedOldImports;
}

View file

@ -111,7 +111,7 @@ namespace ts.Rename {
return createTextSpan(start, width);
}
function nodeIsEligibleForRename(node: Node): boolean {
export function nodeIsEligibleForRename(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.PrivateIdentifier:

View file

@ -599,10 +599,11 @@ namespace ts {
}
function findBaseOfDeclaration<T>(checker: TypeChecker, declaration: Declaration, cb: (symbol: Symbol) => T[] | undefined): T[] | undefined {
if (hasStaticModifier(declaration)) return;
const classOrInterfaceDeclaration = declaration.parent?.kind === SyntaxKind.Constructor ? declaration.parent.parent : declaration.parent;
if (!classOrInterfaceDeclaration) {
return;
}
if (!classOrInterfaceDeclaration) return;
return firstDefined(getAllSuperTypeNodes(classOrInterfaceDeclaration), superTypeNode => {
const symbol = checker.getPropertyOfType(checker.getTypeAtLocation(superTypeNode), declaration.symbol.name);
return symbol ? cb(symbol) : undefined;
@ -1750,6 +1751,7 @@ namespace ts {
synchronizeHostData();
const sourceFile = getValidSourceFile(fileName);
const node = getAdjustedRenameLocation(getTouchingPropertyName(sourceFile, position));
if (!Rename.nodeIsEligibleForRename(node)) return undefined;
if (isIdentifier(node) && (isJsxOpeningElement(node.parent) || isJsxClosingElement(node.parent)) && isIntrinsicJsxName(node.escapedText)) {
const { openingElement, closingElement } = node.parent.parent;
return [openingElement, closingElement].map((node): RenameLocation => {

View file

@ -1,18 +1,35 @@
/* @internal */
namespace ts.Completions.StringCompletions {
export function getStringLiteralCompletions(sourceFile: SourceFile, position: number, contextToken: Node | undefined, checker: TypeChecker, options: CompilerOptions, host: LanguageServiceHost, log: Log, preferences: UserPreferences): CompletionInfo | undefined {
export function getStringLiteralCompletions(
sourceFile: SourceFile,
position: number,
contextToken: Node | undefined,
options: CompilerOptions,
host: LanguageServiceHost,
program: Program,
log: Log,
preferences: UserPreferences): CompletionInfo | undefined {
if (isInReferenceComment(sourceFile, position)) {
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
return entries && convertPathCompletions(entries);
}
if (isInString(sourceFile, position, contextToken)) {
if (!contextToken || !isStringLiteralLike(contextToken)) return undefined;
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, checker, options, host, preferences);
return convertStringLiteralCompletions(entries, contextToken, sourceFile, checker, log, options, preferences);
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences);
}
}
function convertStringLiteralCompletions(completion: StringLiteralCompletion | undefined, contextToken: StringLiteralLike, sourceFile: SourceFile, checker: TypeChecker, log: Log, options: CompilerOptions, preferences: UserPreferences): CompletionInfo | undefined {
function convertStringLiteralCompletions(
completion: StringLiteralCompletion | undefined,
contextToken: StringLiteralLike,
sourceFile: SourceFile,
host: LanguageServiceHost,
program: Program,
log: Log,
options: CompilerOptions,
preferences: UserPreferences,
): CompletionInfo | undefined {
if (completion === undefined) {
return undefined;
}
@ -30,7 +47,8 @@ namespace ts.Completions.StringCompletions {
contextToken,
sourceFile,
sourceFile,
checker,
host,
program,
ScriptTarget.ESNext,
log,
CompletionKind.String,

View file

@ -6,11 +6,13 @@ namespace ts {
program.getSemanticDiagnostics(sourceFile, cancellationToken);
const diags: DiagnosticWithLocation[] = [];
const checker = program.getTypeChecker();
const isCommonJSFile = sourceFile.impliedNodeFormat === ModuleKind.CommonJS || fileExtensionIsOneOf(sourceFile.fileName, [Extension.Cts, Extension.Cjs]) ;
if (sourceFile.commonJsModuleIndicator &&
(programContainsEs6Modules(program) || compilerOptionsIndicateEs6Modules(program.getCompilerOptions())) &&
if (!isCommonJSFile &&
sourceFile.commonJsModuleIndicator &&
(programContainsEsModules(program) || compilerOptionsIndicateEsModules(program.getCompilerOptions())) &&
containsTopLevelCommonjs(sourceFile)) {
diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module));
diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module));
}
const isJsFile = isSourceFileJS(sourceFile);
@ -64,7 +66,7 @@ namespace ts {
}
}
// convertToEs6Module only works on top-level, so don't trigger it if commonjs code only appears in nested scopes.
// convertToEsModule only works on top-level, so don't trigger it if commonjs code only appears in nested scopes.
function containsTopLevelCommonjs(sourceFile: SourceFile): boolean {
return sourceFile.statements.some(statement => {
switch (statement.kind) {

Some files were not shown because too many files have changed in this diff Show more