diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6ecd1d66ae..756b2a12028 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,216 +1,203 @@ -# Instructions for Logging Issues - -## 1. Read the FAQ - -Please [read the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) before logging new issues, even if you think you have found a bug. - -Issues that ask questions answered in the FAQ will be closed without elaboration. - -## 2. Search for Duplicates - -[Search the existing issues](https://github.com/Microsoft/TypeScript/search?type=Issues) before logging a new one. - -Some search tips: - * *Don't* restrict your search to only open issues. An issue with a title similar to yours may have been closed as a duplicate of one with a less-findable title. - * Check for synonyms. For example, if your bug involves an interface, it likely also occurs with type aliases or classes. - * Search for the title of the issue you're about to log. This sounds obvious but 80% of the time this is sufficient to find a duplicate when one exists. - * Read more than the first page of results. Many bugs here use the same words so relevancy sorting is not particularly strong. - * If you have a crash, search for the first few topmost function names shown in the call stack. - -## 3. Do you have a question? - -The issue tracker is for **issues**, in other words, bugs and suggestions. -If you have a *question*, please use [Stack Overflow](http://stackoverflow.com/questions/tagged/typescript), [Gitter](https://gitter.im/Microsoft/TypeScript), your favorite search engine, or other resources. -Due to increased traffic, we can no longer answer questions in the issue tracker. - -## 4. Did you find a bug? - -When logging a bug, please be sure to include the following: - * What version of TypeScript you're using (run `tsc --v`) - * If at all possible, an *isolated* way to reproduce the behavior - * The behavior you expect to see, and the actual behavior - -You can try out the nightly build of TypeScript (`npm install typescript@next`) to see if the bug has already been fixed. - -## 5. Do you have a suggestion? - -We also accept suggestions in the issue tracker. -Be sure to [check the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) and [search](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) first. - -In general, things we find useful when reviewing suggestions are: -* A description of the problem you're trying to solve -* An overview of the suggested solution -* Examples of how the suggestion would work in various places - * Code examples showing e.g. "this would be an error, this wouldn't" - * Code examples showing the generated JavaScript (if applicable) -* If relevant, precedent in other languages can be useful for establishing context and expected behavior - -# Instructions for Contributing Code - -## Tips - -### Faster clones - -The TypeScript repository is relatively large. To save some time, you might want to clone it without the repo's full history using `git clone --depth=1`. - -### Using local builds - -Run `gulp` to build a version of the compiler/language service that reflects changes you've made. You can then run `node /built/local/tsc.js` in place of `tsc` in your project. For example, to run `tsc --watch` from within the root of the repository on a file called `test.ts`, you can run `node ./built/local/tsc.js --watch test.ts`. - -## Contributing bug fixes - -TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved (labelled ["help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) or in the "Backlog milestone") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort. - -## Contributing features - -Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (labelled ["help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) or in the "Backlog" milestone) by a TypeScript project maintainer) in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted. - -Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue. - -## Legal - -You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright. Upon submitting a pull request, you will automatically be given instructions on how to sign the CLA. - -## Housekeeping - -Your pull request should: - -* Include a description of what your change intends to do -* Be a child commit of a reasonably recent commit in the **master** branch - * Requests need not be a single commit, but should be a linear sequence of commits (i.e. no merge commits in your PR) -* It is desirable, but not necessary, for the tests to pass at each commit -* Have clear commit messages - * e.g. "Minor refactor in goToTypeDefinition", "Fix iterated type in for-await-of", "Add test for preserveWatchOutput on command line" -* Include adequate tests - * At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why - * Tests should include reasonable permutations of the target fix/change - * Include baseline changes with your change - * All changed code must have 100% code coverage -* Follow the code conventions described in [Coding guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines) -* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration - -## Contributing `lib.d.ts` fixes - -There are three relevant locations to be aware of when it comes to TypeScript's library declaration files: - -* `src/lib`: the location of the sources themselves. -* `lib`: the location of the last-known-good (LKG) versions of the files which are updated periodically. -* `built/local`: the build output location, including where `src/lib` files will be copied to. - -Any changes should be made to [src/lib](https://github.com/Microsoft/TypeScript/tree/master/src/lib). **Most** of these files can be updated by hand, with the exception of any generated files (see below). - -Library files in `built/local/` are updated automatically by running the standard build task: - -```sh -gulp -``` - -The files in `lib/` are used to bootstrap compilation and usually **should not** be updated unless publishing a new version or updating the LKG. - -### Modifying generated library files - -The files `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts` both represent type declarations for the DOM and are auto-generated. To make any modifications to them, you will have to direct changes to https://github.com/Microsoft/TSJS-lib-generator - -## Running the Tests - -To run all tests, invoke the `runtests-parallel` target using gulp: - -```Shell -gulp runtests-parallel -``` - -This will run all tests; to run only a specific subset of tests, use: - -```Shell -gulp runtests --tests= -``` - -e.g. to run all compiler baseline tests: - -```Shell -gulp runtests --tests=compiler -``` - -or to run a specific test: `tests\cases\compiler\2dArrays.ts` - -```Shell -gulp runtests --tests=2dArrays -``` - -## Debugging the tests - -To debug the tests, invoke the `runtests-browser` task from gulp. -You will probably only want to debug one test at a time: - -```Shell -gulp runtests-browser --tests=2dArrays -``` - -You can specify which browser to use for debugging. Currently, Chrome and IE are supported: - -```Shell -gulp runtests-browser --tests=2dArrays --browser=chrome -``` - -You can debug with VS Code or Node instead with `gulp runtests --inspect=true`: - -```Shell -gulp runtests --tests=2dArrays --inspect=true -``` - -You can also use the [provided VS Code launch configuration](./.vscode/launch.template.json) to launch a debug session for an open test file. Rename the file 'launch.json', open the test file of interest, and launch the debugger from the debug panel (or press F5). - -## Adding a Test - -To add a new test case, simply place a `.ts` file in `tests\cases\compiler` containing code that exemplifies the bugfix or change you are making. - -These files support metadata tags in the format `// @metaDataName: value`. -The supported names and values are the same as those supported in the compiler itself, with the addition of the `fileName` flag. -`fileName` tags delimit sections of a file to be used as separate compilation units. -They are useful for tests relating to modules. -See below for examples. - -**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in `tests\cases\conformance` in an appropriately-named subfolder. -**Note** that filenames here must be distinct from all other compiler testcase names, so you may have to work a bit to find a unique name if it's something common. - -### Tests for multiple files - -When one needs to test for scenarios which require multiple files, it is useful to use the `fileName` metadata tag as such: - -```TypeScript -// @fileName: file1.ts -export function f() { -} - -// @fileName: file2.ts -import { f as g } from "file1"; - -var x = g(); -``` - -One can also write a project test, but it is slightly more involved. - -## Managing the Baselines - -Compiler testcases generate baselines that track the emitted `.js`, the errors produced by the compiler, and the type of each expression in the file. Additionally, some testcases opt in to baselining the source map output. - -When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use - -```Shell -gulp diff -``` - -After verifying that the changes in the baselines are correct, run - -```Shell -gulp baseline-accept -``` - -to establish the new baselines as the desired behavior. This will change the files in `tests\baselines\reference`, which should be included as part of your commit. It's important to carefully validate changes in the baselines. - -## Localization - -All strings the user may see are stored in [`diagnosticMessages.json`](./src/compiler/diagnosticMessages.json). -If you make changes to it, run `gulp generate-diagnostics` to push them to the `Diagnostic` interface in `diagnosticInformationMap.generated.ts`. - -See [coding guidelines on diagnostic messages](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#diagnostic-messages). +# Instructions for Logging Issues + +## 1. Read the FAQ + +Please [read the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) before logging new issues, even if you think you have found a bug. + +Issues that ask questions answered in the FAQ will be closed without elaboration. + +## 2. Search for Duplicates + +[Search the existing issues](https://github.com/Microsoft/TypeScript/search?type=Issues) before logging a new one. + +Some search tips: + * *Don't* restrict your search to only open issues. An issue with a title similar to yours may have been closed as a duplicate of one with a less-findable title. + * Check for synonyms. For example, if your bug involves an interface, it likely also occurs with type aliases or classes. + * Search for the title of the issue you're about to log. This sounds obvious but 80% of the time this is sufficient to find a duplicate when one exists. + * Read more than the first page of results. Many bugs here use the same words so relevancy sorting is not particularly strong. + * If you have a crash, search for the first few topmost function names shown in the call stack. + +## 3. Do you have a question? + +The issue tracker is for **issues**, in other words, bugs and suggestions. +If you have a *question*, please use [Stack Overflow](http://stackoverflow.com/questions/tagged/typescript), [Gitter](https://gitter.im/Microsoft/TypeScript), your favorite search engine, or other resources. +Due to increased traffic, we can no longer answer questions in the issue tracker. + +## 4. Did you find a bug? + +When logging a bug, please be sure to include the following: + * What version of TypeScript you're using (run `tsc --v`) + * If at all possible, an *isolated* way to reproduce the behavior + * The behavior you expect to see, and the actual behavior + +You can try out the nightly build of TypeScript (`npm install typescript@next`) to see if the bug has already been fixed. + +## 5. Do you have a suggestion? + +We also accept suggestions in the issue tracker. +Be sure to [check the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) and [search](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) first. + +In general, things we find useful when reviewing suggestions are: +* A description of the problem you're trying to solve +* An overview of the suggested solution +* Examples of how the suggestion would work in various places + * Code examples showing e.g. "this would be an error, this wouldn't" + * Code examples showing the generated JavaScript (if applicable) +* If relevant, precedent in other languages can be useful for establishing context and expected behavior + +# Instructions for Contributing Code + +## Tips + +### Faster clones + +The TypeScript repository is relatively large. To save some time, you might want to clone it without the repo's full history using `git clone --depth=1`. + +### Using local builds + +Run `gulp` to build a version of the compiler/language service that reflects changes you've made. You can then run `node /built/local/tsc.js` in place of `tsc` in your project. For example, to run `tsc --watch` from within the root of the repository on a file called `test.ts`, you can run `node ./built/local/tsc.js --watch test.ts`. + +## Contributing bug fixes + +TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved (labelled ["help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) or in the "Backlog milestone") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort. + +## Contributing features + +Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (labelled ["help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) or in the "Backlog" milestone) by a TypeScript project maintainer) in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted. + +Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue. + +## Legal + +You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright. Upon submitting a pull request, you will automatically be given instructions on how to sign the CLA. + +## Housekeeping + +Your pull request should: + +* Include a description of what your change intends to do +* Be a child commit of a reasonably recent commit in the **master** branch + * Requests need not be a single commit, but should be a linear sequence of commits (i.e. no merge commits in your PR) +* It is desirable, but not necessary, for the tests to pass at each commit +* Have clear commit messages + * e.g. "Minor refactor in goToTypeDefinition", "Fix iterated type in for-await-of", "Add test for preserveWatchOutput on command line" +* Include adequate tests + * At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why + * Tests should include reasonable permutations of the target fix/change + * Include baseline changes with your change + * All changed code must have 100% code coverage +* Follow the code conventions described in [Coding guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines) +* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration + +## Contributing `lib.d.ts` fixes + +There are three relevant locations to be aware of when it comes to TypeScript's library declaration files: + +* `src/lib`: the location of the sources themselves. +* `lib`: the location of the last-known-good (LKG) versions of the files which are updated periodically. +* `built/local`: the build output location, including where `src/lib` files will be copied to. + +Any changes should be made to [src/lib](https://github.com/Microsoft/TypeScript/tree/master/src/lib). **Most** of these files can be updated by hand, with the exception of any generated files (see below). + +Library files in `built/local/` are updated automatically by running the standard build task: + +```sh +gulp +``` + +The files in `lib/` are used to bootstrap compilation and usually **should not** be updated unless publishing a new version or updating the LKG. + +### Modifying generated library files + +The files `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts` both represent type declarations for the DOM and are auto-generated. To make any modifications to them, you will have to direct changes to https://github.com/Microsoft/TSJS-lib-generator + +## Running the Tests + +To run all tests, invoke the `runtests-parallel` target using gulp: + +```Shell +gulp runtests-parallel +``` + +This will run all tests; to run only a specific subset of tests, use: + +```Shell +gulp runtests --tests= +``` + +e.g. to run all compiler baseline tests: + +```Shell +gulp runtests --tests=compiler +``` + +or to run a specific test: `tests\cases\compiler\2dArrays.ts` + +```Shell +gulp runtests --tests=2dArrays +``` + +## Debugging the tests + +You can debug with VS Code or Node instead with `gulp runtests --inspect`: + +```Shell +gulp runtests --tests=2dArrays --inspect +``` + +You can also use the [provided VS Code launch configuration](./.vscode/launch.template.json) to launch a debug session for an open test file. Rename the file 'launch.json', open the test file of interest, and launch the debugger from the debug panel (or press F5). + +## Adding a Test + +To add a new test case, simply place a `.ts` file in `tests\cases\compiler` containing code that exemplifies the bugfix or change you are making. + +These files support metadata tags in the format `// @metaDataName: value`. +The supported names and values are the same as those supported in the compiler itself, with the addition of the `fileName` flag. +`fileName` tags delimit sections of a file to be used as separate compilation units. +They are useful for tests relating to modules. +See below for examples. + +**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in `tests\cases\conformance` in an appropriately-named subfolder. +**Note** that filenames here must be distinct from all other compiler testcase names, so you may have to work a bit to find a unique name if it's something common. + +### Tests for multiple files + +When one needs to test for scenarios which require multiple files, it is useful to use the `fileName` metadata tag as such: + +```TypeScript +// @fileName: file1.ts +export function f() { +} + +// @fileName: file2.ts +import { f as g } from "file1"; + +var x = g(); +``` + +One can also write a project test, but it is slightly more involved. + +## Managing the Baselines + +Compiler testcases generate baselines that track the emitted `.js`, the errors produced by the compiler, and the type of each expression in the file. Additionally, some testcases opt in to baselining the source map output. + +When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use + +```Shell +gulp diff +``` + +After verifying that the changes in the baselines are correct, run + +```Shell +gulp baseline-accept +``` + +to establish the new baselines as the desired behavior. This will change the files in `tests\baselines\reference`, which should be included as part of your commit. It's important to carefully validate changes in the baselines. + +## Localization + +All strings the user may see are stored in [`diagnosticMessages.json`](./src/compiler/diagnosticMessages.json). +If you make changes to it, run `gulp generate-diagnostics` to push them to the `Diagnostic` interface in `diagnosticInformationMap.generated.ts`. + +See [coding guidelines on diagnostic messages](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#diagnostic-messages). diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 07a26a7b837..8809c34d060 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -50,7 +50,7 @@ namespace ts { // 3. non-exported import declarations case SyntaxKind.ImportDeclaration: case SyntaxKind.ImportEqualsDeclaration: - if (!(hasModifier(node, ModifierFlags.Export))) { + if (!(hasSyntacticModifier(node, ModifierFlags.Export))) { return ModuleInstanceState.NonInstantiated; } break; @@ -413,7 +413,7 @@ namespace ts { function declareSymbol(symbolTable: SymbolTable, parent: Symbol | undefined, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags, isReplaceableByMethod?: boolean): Symbol { Debug.assert(!hasDynamicName(node)); - const isDefaultExport = hasModifier(node, ModifierFlags.Default) || isExportSpecifier(node) && node.name.escapedText === "default"; + const isDefaultExport = hasSyntacticModifier(node, ModifierFlags.Default) || isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" const name = isDefaultExport && parent ? InternalSymbolName.Default : getDeclarationName(node); @@ -508,7 +508,7 @@ namespace ts { } const relatedInformation: DiagnosticRelatedInformation[] = []; - if (isTypeAliasDeclaration(node) && nodeIsMissing(node.type) && hasModifier(node, ModifierFlags.Export) && symbol.flags & (SymbolFlags.Alias | SymbolFlags.Type | SymbolFlags.Namespace)) { + if (isTypeAliasDeclaration(node) && nodeIsMissing(node.type) && hasSyntacticModifier(node, ModifierFlags.Export) && symbol.flags & (SymbolFlags.Alias | SymbolFlags.Type | SymbolFlags.Namespace)) { // export type T; - may have meant export type { T }? relatedInformation.push(createDiagnosticForNode(node, Diagnostics.Did_you_mean_0, `export type { ${unescapeLeadingUnderscores(node.name.escapedText)} }`)); } @@ -572,7 +572,7 @@ namespace ts { // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. if (isJSDocTypeAlias(node)) Debug.assert(isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if ((!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) || isJSDocTypeAlias(node)) { - if (!container.locals || (hasModifier(node, ModifierFlags.Default) && !getDeclarationName(node))) { + if (!container.locals || (hasSyntacticModifier(node, ModifierFlags.Default) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports!, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } const exportKind = symbolFlags & SymbolFlags.Value ? SymbolFlags.ExportValue : 0; @@ -637,7 +637,7 @@ namespace ts { const saveExceptionTarget = currentExceptionTarget; const saveActiveLabelList = activeLabelList; const saveHasExplicitReturn = hasExplicitReturn; - const isIIFE = containerFlags & ContainerFlags.IsFunctionExpression && !hasModifier(node, ModifierFlags.Async) && + const isIIFE = containerFlags & ContainerFlags.IsFunctionExpression && !hasSyntacticModifier(node, ModifierFlags.Async) && !(node).asteriskToken && !!getImmediatelyInvokedFunctionExpression(node); // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. @@ -985,7 +985,7 @@ namespace ts { return initFlowNode({ flags: FlowFlags.SwitchClause, antecedent, switchStatement, clauseStart, clauseEnd }); } - function createFlowMutation(flags: FlowFlags, antecedent: FlowNode, node: Node): FlowNode { + function createFlowMutation(flags: FlowFlags, antecedent: FlowNode, node: Expression | VariableDeclaration | ArrayBindingElement): FlowNode { setFlowNodeReferenced(antecedent); const result = initFlowNode({ flags, antecedent, node }); if (currentExceptionTarget) { @@ -1341,7 +1341,7 @@ namespace ts { // is potentially an assertion and is therefore included in the control flow. if (node.expression.kind === SyntaxKind.CallExpression) { const call = node.expression; - if (isDottedName(call.expression)) { + if (isDottedName(call.expression) && call.expression.kind !== SyntaxKind.SuperKeyword) { currentFlow = createFlowCall(currentFlow, call); } } @@ -1747,6 +1747,9 @@ namespace ts { } else { bindEachChild(node); + if (node.expression.kind === SyntaxKind.SuperKeyword) { + currentFlow = createFlowCall(currentFlow, node); + } } } if (node.expression.kind === SyntaxKind.PropertyAccessExpression) { @@ -1906,7 +1909,7 @@ namespace ts { } function declareClassMember(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) { - return hasModifier(node, ModifierFlags.Static) + return hasSyntacticModifier(node, ModifierFlags.Static) ? declareSymbol(container.symbol.exports!, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members!, container.symbol, node, symbolFlags, symbolExcludes); } @@ -1936,7 +1939,7 @@ namespace ts { function bindModuleDeclaration(node: ModuleDeclaration) { setExportContextFlag(node); if (isAmbientModule(node)) { - if (hasModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { errorOnFirstToken(node, Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (isModuleAugmentationExternal(node)) { @@ -2464,6 +2467,9 @@ namespace ts { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); + case SyntaxKind.SuperKeyword: + node.flowNode = currentFlow; + break; case SyntaxKind.PrivateIdentifier: return checkPrivateIdentifier(node as PrivateIdentifier); case SyntaxKind.PropertyAccessExpression: @@ -2869,7 +2875,7 @@ namespace ts { // this.foo assignment in a JavaScript class // Bind this property to the containing class const containingClass = thisContainer.parent; - const symbolTable = hasModifier(thisContainer, ModifierFlags.Static) ? containingClass.symbol.exports! : containingClass.symbol.members!; + const symbolTable = hasSyntacticModifier(thisContainer, ModifierFlags.Static) ? containingClass.symbol.exports! : containingClass.symbol.members!; if (hasDynamicName(node)) { bindDynamicallyNamedThisPropertyAssignment(node, containingClass.symbol); } @@ -2977,15 +2983,13 @@ namespace ts { // util.property = function ... bindExportsPropertyAssignment(node as BindableStaticPropertyAssignmentExpression); } + else if (hasDynamicName(node)) { + bindAnonymousDeclaration(node, SymbolFlags.Property | SymbolFlags.Assignment, InternalSymbolName.Computed); + const sym = bindPotentiallyMissingNamespaces(parentSymbol, node.left.expression, isTopLevelNamespaceAssignment(node.left), /*isPrototype*/ false, /*containerIsClass*/ false); + addLateBoundAssignmentDeclarationToSymbol(node, sym); + } else { - if (hasDynamicName(node)) { - bindAnonymousDeclaration(node, SymbolFlags.Property | SymbolFlags.Assignment, InternalSymbolName.Computed); - const sym = bindPotentiallyMissingNamespaces(parentSymbol, node.left.expression, isTopLevelNamespaceAssignment(node.left), /*isPrototype*/ false, /*containerIsClass*/ false); - addLateBoundAssignmentDeclarationToSymbol(node, sym); - } - else { - bindStaticPropertyAssignment(cast(node.left, isBindableStaticAccessExpression)); - } + bindStaticPropertyAssignment(cast(node.left, isBindableStaticNameExpression)); } } @@ -2993,7 +2997,8 @@ namespace ts { * For nodes like `x.y = z`, declare a member 'y' on 'x' if x is a function (or IIFE) or class or {}, or not declared. * Also works for expression statements preceded by JSDoc, like / ** @type number * / x.y; */ - function bindStaticPropertyAssignment(node: BindableStaticAccessExpression) { + function bindStaticPropertyAssignment(node: BindableStaticNameExpression) { + Debug.assert(!isIdentifier(node)); node.expression.parent = node; bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); } @@ -3403,7 +3408,7 @@ namespace ts { case SyntaxKind.ModuleDeclaration: return getModuleInstanceState(s as ModuleDeclaration) !== ModuleInstanceState.Instantiated; case SyntaxKind.EnumDeclaration: - return hasModifier(s, ModifierFlags.Const); + return hasSyntacticModifier(s, ModifierFlags.Const); default: return false; } @@ -3637,7 +3642,7 @@ namespace ts { } // If a parameter has an accessibility modifier, then it is TypeScript syntax. - if (hasModifier(node, ModifierFlags.ParameterPropertyModifier)) { + if (hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier)) { transformFlags |= TransformFlags.AssertTypeScript | TransformFlags.ContainsTypeScriptClassSyntax; } @@ -3676,7 +3681,7 @@ namespace ts { function computeClassDeclaration(node: ClassDeclaration, subtreeFlags: TransformFlags) { let transformFlags: TransformFlags; - if (hasModifier(node, ModifierFlags.Ambient)) { + if (hasSyntacticModifier(node, ModifierFlags.Ambient)) { // An ambient declaration is TypeScript syntax. transformFlags = TransformFlags.AssertTypeScript; } @@ -3767,7 +3772,7 @@ namespace ts { let transformFlags = subtreeFlags; // TypeScript-specific modifiers and overloads are TypeScript syntax - if (hasModifier(node, ModifierFlags.TypeScriptModifier) + if (hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier) || !node.body) { transformFlags |= TransformFlags.AssertTypeScript; } @@ -3788,7 +3793,7 @@ namespace ts { // Decorators, TypeScript-specific modifiers, type parameters, type annotations, and // overloads are TypeScript syntax. if (node.decorators - || hasModifier(node, ModifierFlags.TypeScriptModifier) + || hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier) || node.typeParameters || node.type || !node.body @@ -3802,7 +3807,7 @@ namespace ts { } // An async method declaration is ES2017 syntax. - if (hasModifier(node, ModifierFlags.Async)) { + if (hasSyntacticModifier(node, ModifierFlags.Async)) { transformFlags |= node.asteriskToken ? TransformFlags.AssertES2018 : TransformFlags.AssertES2017; } @@ -3820,7 +3825,7 @@ namespace ts { // Decorators, TypeScript-specific modifiers, type annotations, and overloads are // TypeScript syntax. if (node.decorators - || hasModifier(node, ModifierFlags.TypeScriptModifier) + || hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier) || node.type || !node.body) { transformFlags |= TransformFlags.AssertTypeScript; @@ -3839,7 +3844,7 @@ namespace ts { let transformFlags = subtreeFlags | TransformFlags.ContainsClassFields; // Decorators, TypeScript-specific modifiers, and type annotations are TypeScript syntax. - if (some(node.decorators) || hasModifier(node, ModifierFlags.TypeScriptModifier) || node.type || node.questionToken || node.exclamationToken) { + if (some(node.decorators) || hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier) || node.type || node.questionToken || node.exclamationToken) { transformFlags |= TransformFlags.AssertTypeScript; } @@ -3854,7 +3859,7 @@ namespace ts { function computeFunctionDeclaration(node: FunctionDeclaration, subtreeFlags: TransformFlags) { let transformFlags: TransformFlags; - const modifierFlags = getModifierFlags(node); + const modifierFlags = getSyntacticModifierFlags(node); const body = node.body; if (!body || (modifierFlags & ModifierFlags.Ambient)) { @@ -3902,14 +3907,14 @@ namespace ts { // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript // syntax. - if (hasModifier(node, ModifierFlags.TypeScriptModifier) + if (hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier) || node.typeParameters || node.type) { transformFlags |= TransformFlags.AssertTypeScript; } // An async function expression is ES2017 syntax. - if (hasModifier(node, ModifierFlags.Async)) { + if (hasSyntacticModifier(node, ModifierFlags.Async)) { transformFlags |= node.asteriskToken ? TransformFlags.AssertES2018 : TransformFlags.AssertES2017; } @@ -3935,14 +3940,14 @@ namespace ts { // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript // syntax. - if (hasModifier(node, ModifierFlags.TypeScriptModifier) + if (hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier) || node.typeParameters || node.type) { transformFlags |= TransformFlags.AssertTypeScript; } // An async arrow function is ES2017 syntax. - if (hasModifier(node, ModifierFlags.Async)) { + if (hasSyntacticModifier(node, ModifierFlags.Async)) { transformFlags |= TransformFlags.AssertES2017; } @@ -4016,7 +4021,7 @@ namespace ts { const declarationListTransformFlags = node.declarationList.transformFlags; // An ambient declaration is TypeScript syntax. - if (hasModifier(node, ModifierFlags.Ambient)) { + if (hasSyntacticModifier(node, ModifierFlags.Ambient)) { transformFlags = TransformFlags.AssertTypeScript; } else { @@ -4064,7 +4069,7 @@ namespace ts { function computeModuleDeclaration(node: ModuleDeclaration, subtreeFlags: TransformFlags) { let transformFlags = TransformFlags.AssertTypeScript; - const modifierFlags = getModifierFlags(node); + const modifierFlags = getSyntacticModifierFlags(node); if ((modifierFlags & ModifierFlags.Ambient) === 0) { transformFlags |= subtreeFlags; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3ac6cc094fe..7bd58c379ea 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -911,6 +911,7 @@ namespace ts { const sharedFlowNodes: FlowNode[] = []; const sharedFlowTypes: FlowType[] = []; const flowNodeReachable: (boolean | undefined)[] = []; + const flowNodePostSuper: (boolean | undefined)[] = []; const potentialThisCollisions: Node[] = []; const potentialNewTargetCollisions: Node[] = []; const potentialWeakMapCollisions: Node[] = []; @@ -1470,13 +1471,13 @@ namespace ts { (current.parent).initializer === current; if (initializerOfProperty) { - if (hasModifier(current.parent, ModifierFlags.Static)) { + if (hasSyntacticModifier(current.parent, ModifierFlags.Static)) { if (declaration.kind === SyntaxKind.MethodDeclaration) { return true; } } else { - const isDeclarationInstanceProperty = declaration.kind === SyntaxKind.PropertyDeclaration && !hasModifier(declaration, ModifierFlags.Static); + const isDeclarationInstanceProperty = declaration.kind === SyntaxKind.PropertyDeclaration && !hasSyntacticModifier(declaration, ModifierFlags.Static); if (!isDeclarationInstanceProperty || getContainingClass(usage) !== getContainingClass(declaration)) { return true; } @@ -1739,7 +1740,7 @@ namespace ts { // local variables of the constructor. This effectively means that entities from outer scopes // by the same name as a constructor parameter or local variable are inaccessible // in initializer expressions for instance member variables. - if (!hasModifier(location, ModifierFlags.Static)) { + if (!hasSyntacticModifier(location, ModifierFlags.Static)) { const ctor = findConstructorDeclaration(location.parent as ClassLikeDeclaration); if (ctor && ctor.locals) { if (lookup(ctor.locals, name, meaning & SymbolFlags.Value)) { @@ -1761,7 +1762,7 @@ namespace ts { result = undefined; break; } - if (lastLocation && hasModifier(lastLocation, ModifierFlags.Static)) { + if (lastLocation && hasSyntacticModifier(lastLocation, ModifierFlags.Static)) { // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. @@ -2046,14 +2047,14 @@ namespace ts { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return isTypeQueryNode(location) || (( isFunctionLikeDeclaration(location) || - (location.kind === SyntaxKind.PropertyDeclaration && !hasModifier(location, ModifierFlags.Static)) + (location.kind === SyntaxKind.PropertyDeclaration && !hasSyntacticModifier(location, ModifierFlags.Static)) ) && (!lastLocation || lastLocation !== (location as FunctionLike | PropertyDeclaration).name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === (location as FunctionExpression | ArrowFunction).name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if ((location as FunctionExpression | ArrowFunction).asteriskToken || hasModifier(location, ModifierFlags.Async)) { + if ((location as FunctionExpression | ArrowFunction).asteriskToken || hasSyntacticModifier(location, ModifierFlags.Async)) { return true; } return !getImmediatelyInvokedFunctionExpression(location); @@ -2113,7 +2114,7 @@ namespace ts { // No static member is present. // Check if we're in an instance method and look for a relevant instance member. - if (location === container && !hasModifier(location, ModifierFlags.Static)) { + if (location === container && !hasSyntacticModifier(location, ModifierFlags.Static)) { const instanceType = (getDeclaredTypeOfSymbol(classSymbol)).thisType!; // TODO: GH#18217 if (getPropertyOfType(instanceType, name)) { error(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg)); @@ -2404,7 +2405,7 @@ namespace ts { } function isSyntacticDefault(node: Node) { - return ((isExportAssignment(node) && !node.isExportEquals) || hasModifier(node, ModifierFlags.Default) || isExportSpecifier(node)); + return ((isExportAssignment(node) && !node.isExportEquals) || hasSyntacticModifier(node, ModifierFlags.Default) || isExportSpecifier(node)); } function canHaveSyntheticDefault(file: SourceFile | undefined, moduleSymbol: Symbol, dontResolveAlias: boolean) { @@ -4007,17 +4008,17 @@ namespace ts { const anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !hasModifier(anyImportSyntax, ModifierFlags.Export) && // import clause without export + !hasSyntacticModifier(anyImportSyntax, ModifierFlags.Export) && // import clause without export isDeclarationVisible(anyImportSyntax.parent)) { return addVisibleAlias(declaration, anyImportSyntax); } else if (isVariableDeclaration(declaration) && isVariableStatement(declaration.parent.parent) && - !hasModifier(declaration.parent.parent, ModifierFlags.Export) && // unexported variable statement + !hasSyntacticModifier(declaration.parent.parent, ModifierFlags.Export) && // unexported variable statement isDeclarationVisible(declaration.parent.parent.parent)) { return addVisibleAlias(declaration, declaration.parent.parent); } else if (isLateVisibilityPaintedStatement(declaration) // unexported top-level statement - && !hasModifier(declaration, ModifierFlags.Export) + && !hasSyntacticModifier(declaration, ModifierFlags.Export) && isDeclarationVisible(declaration.parent)) { return addVisibleAlias(declaration, declaration); } @@ -4466,7 +4467,7 @@ namespace ts { } function shouldWriteTypeOfFunctionSymbol() { const isStaticMethodSymbol = !!(symbol.flags & SymbolFlags.Method) && // typeof static method - some(symbol.declarations, declaration => hasModifier(declaration, ModifierFlags.Static)); + some(symbol.declarations, declaration => hasSyntacticModifier(declaration, ModifierFlags.Static)); const isNonLocalFunctionSymbol = !!(symbol.flags & SymbolFlags.Function) && (symbol.parent || // is exported function symbol forEach(symbol.declarations, declaration => @@ -4563,17 +4564,32 @@ namespace ts { const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context); const hasRestElement = (type.target).hasRestElement; if (tupleConstituentNodes) { - for (let i = (type.target).minLength; i < Math.min(arity, tupleConstituentNodes.length); i++) { - tupleConstituentNodes[i] = hasRestElement && i === arity - 1 ? - createRestTypeNode(createArrayTypeNode(tupleConstituentNodes[i])) : - createOptionalTypeNode(tupleConstituentNodes[i]); + if ((type.target as TupleType).labeledElementDeclarations) { + for (let i = 0; i < tupleConstituentNodes.length; i++) { + const isOptionalOrRest = i >= (type.target).minLength; + const isRest = isOptionalOrRest && hasRestElement && i === arity - 1; + const isOptional = isOptionalOrRest && !isRest; + tupleConstituentNodes[i] = createNamedTupleMember( + isRest ? createToken(SyntaxKind.DotDotDotToken) : undefined, + createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel((type.target as TupleType).labeledElementDeclarations![i]))), + isOptional ? createToken(SyntaxKind.QuestionToken) : undefined, + isRest ? createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i] + ); + } } - const tupleTypeNode = createTupleTypeNode(tupleConstituentNodes); + else { + for (let i = (type.target).minLength; i < Math.min(arity, tupleConstituentNodes.length); i++) { + tupleConstituentNodes[i] = hasRestElement && i === arity - 1 ? + createRestTypeNode(createArrayTypeNode(tupleConstituentNodes[i])) : + createOptionalTypeNode(tupleConstituentNodes[i]); + } + } + const tupleTypeNode = setEmitFlags(createTupleTypeNode(tupleConstituentNodes), EmitFlags.SingleLine); return (type.target).readonly ? createTypeOperatorNode(SyntaxKind.ReadonlyKeyword, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & NodeBuilderFlags.AllowEmptyTuple)) { - const tupleTypeNode = createTupleTypeNode([]); + const tupleTypeNode = setEmitFlags(createTupleTypeNode([]), EmitFlags.SingleLine); return (type.target).readonly ? createTypeOperatorNode(SyntaxKind.ReadonlyKeyword, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; @@ -4907,7 +4923,7 @@ namespace ts { typeParameters = signature.typeParameters && signature.typeParameters.map(parameter => typeParameterToDeclaration(parameter, context)); } - const parameters = getExpandedParameters(signature).map(parameter => symbolToParameterDeclaration(parameter, context, kind === SyntaxKind.Constructor, privateSymbolVisitor, bundledImports)); + const parameters = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0].map(parameter => symbolToParameterDeclaration(parameter, context, kind === SyntaxKind.Constructor, privateSymbolVisitor, bundledImports)); if (signature.thisParameter) { const thisParameter = symbolToParameterDeclaration(signature.thisParameter, context); parameters.unshift(thisParameter); @@ -5555,6 +5571,7 @@ namespace ts { cancellationToken.throwIfCancellationRequested(); } let hadError = false; + const file = getSourceFileOfNode(existing); const transformed = visitNode(existing, visitExistingNodeTreeSymbols); if (hadError) { return undefined; @@ -5683,6 +5700,10 @@ namespace ts { } } + if (file && isTupleTypeNode(node) && (getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line)) { + setEmitFlags(node, EmitFlags.SingleLine); + } + return visitEachChild(node, visitExistingNodeTreeSymbols, nullTransformationContext); function getEffectiveDotDotDotForParameter(p: ParameterDeclaration) { @@ -5793,7 +5814,7 @@ namespace ts { ns.body && isModuleBlock(ns.body)) { // Pass 0: Correct situations where a module has both an `export = ns` and multiple top-level exports by stripping the export modifiers from // the top-level exports and exporting them in the targeted ns, as can occur when a js file has both typedefs and `module.export` assignments - const excessExports = filter(statements, s => !!(getModifierFlags(s) & ModifierFlags.Export)); + const excessExports = filter(statements, s => !!(getEffectiveModifierFlags(s) & ModifierFlags.Export)); if (length(excessExports)) { ns.body.statements = createNodeArray([...ns.body.statements, createExportDeclaration( /*decorators*/ undefined, @@ -5906,7 +5927,7 @@ namespace ts { } function addExportModifier(statement: Statement) { - const flags = (getModifierFlags(statement) | ModifierFlags.Export) & ~ModifierFlags.Ambient; + const flags = (getEffectiveModifierFlags(statement) | ModifierFlags.Export) & ~ModifierFlags.Ambient; statement.modifiers = createNodeArray(createModifiersFromModifierFlags(flags)); statement.modifierFlagsCache = 0; } @@ -5949,6 +5970,7 @@ namespace ts { } } + // Synthesize declarations for a symbol - might be an Interface, a Class, a Namespace, a Type, a Variable (const, let, or var), an Alias // or a merge of some number of those. // An interesting challenge is ensuring that when classes merge with namespaces and interfaces, is keeping @@ -6068,7 +6090,7 @@ namespace ts { newModifierFlags |= ModifierFlags.Default; } if (newModifierFlags) { - node.modifiers = createNodeArray(createModifiersFromModifierFlags(newModifierFlags | getModifierFlags(node))); + node.modifiers = createNodeArray(createModifiersFromModifierFlags(newModifierFlags | getEffectiveModifierFlags(node))); node.modifierFlagsCache = 0; // Reset computed flags cache } results.push(node); @@ -6317,7 +6339,10 @@ namespace ts { const baseTypes = getBaseTypes(classType); const implementsTypes = getImplementsTypes(classType); const staticType = getTypeOfSymbol(symbol); - const staticBaseType = getBaseConstructorTypeOfClass(staticType as InterfaceType); + const isClass = !!staticType.symbol?.valueDeclaration && isClassLike(staticType.symbol.valueDeclaration); + const staticBaseType = isClass + ? getBaseConstructorTypeOfClass(staticType as InterfaceType) + : anyType; const heritageClauses = [ ...!length(baseTypes) ? [] : [createHeritageClause(SyntaxKind.ExtendsKeyword, map(baseTypes, b => serializeBaseType(b, staticBaseType, localName)))], ...!length(implementsTypes) ? [] : [createHeritageClause(SyntaxKind.ImplementsKeyword, map(implementsTypes, b => serializeBaseType(b, staticBaseType, localName)))] @@ -6353,7 +6378,17 @@ namespace ts { const staticMembers = flatMap( filter(getPropertiesOfType(staticType), p => !(p.flags & SymbolFlags.Prototype) && p.escapedName !== "prototype" && !isNamespaceMember(p)), p => serializePropertySymbolForClass(p, /*isStatic*/ true, staticBaseType)); - const constructors = serializeSignatures(SignatureKind.Construct, staticType, baseTypes[0], SyntaxKind.Constructor) as ConstructorDeclaration[]; + // When we encounter an `X.prototype.y` assignment in a JS file, we bind `X` as a class regardless as to whether + // the value is ever initialized with a class or function-like value. For cases where `X` could never be + // created via `new`, we will inject a `private constructor()` declaration to indicate it is not createable. + const isNonConstructableClassLikeInJsFile = + !isClass && + !!symbol.valueDeclaration && + isInJSFile(symbol.valueDeclaration) && + !some(getSignaturesOfType(staticType, SignatureKind.Construct)); + const constructors = isNonConstructableClassLikeInJsFile ? + [createConstructor(/*decorators*/ undefined, createModifiersFromModifierFlags(ModifierFlags.Private), [], /*body*/ undefined)] : + serializeSignatures(SignatureKind.Construct, staticType, baseTypes[0], SyntaxKind.Constructor) as ConstructorDeclaration[]; for (const c of constructors) { // A constructor's return type and type parameters are supposed to be controlled by the enclosing class declaration // `signatureToSignatureDeclarationHelper` appends them regardless, so for now we delete them here @@ -6752,7 +6787,7 @@ namespace ts { let privateProtected: ModifierFlags = 0; for (const s of signatures) { if (s.declaration) { - privateProtected |= getSelectedModifierFlags(s.declaration, ModifierFlags.Private | ModifierFlags.Protected); + privateProtected |= getSelectedEffectiveModifierFlags(s.declaration, ModifierFlags.Private | ModifierFlags.Protected); } } if (privateProtected) { @@ -6929,7 +6964,7 @@ namespace ts { function getTypeAliasForTypeLiteral(type: Type): Symbol | undefined { if (type.symbol && type.symbol.flags & SymbolFlags.TypeLiteral) { - const node = findAncestor(type.symbol.declarations[0].parent, n => n.kind !== SyntaxKind.ParenthesizedType)!; + const node = walkUpParenthesizedTypes(type.symbol.declarations[0].parent); if (node.kind === SyntaxKind.TypeAliasDeclaration) { return getSymbolOfNode(node); } @@ -7095,7 +7130,7 @@ namespace ts { case SyntaxKind.SetAccessor: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - if (hasModifier(node, ModifierFlags.Private | ModifierFlags.Protected)) { + if (hasEffectiveModifier(node, ModifierFlags.Private | ModifierFlags.Protected)) { // Private/protected properties/methods are not visible return false; } @@ -7117,6 +7152,7 @@ namespace ts { case SyntaxKind.UnionType: case SyntaxKind.IntersectionType: case SyntaxKind.ParenthesizedType: + case SyntaxKind.NamedTupleMember: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible @@ -7594,10 +7630,10 @@ namespace ts { if (isPropertyDeclaration(declaration) && (noImplicitAny || isInJSFile(declaration))) { // We have a property declaration with no type annotation or initializer, in noImplicitAny mode or a .js file. - // Use control flow analysis of this.xxx assignments the constructor to determine the type of the property. + // Use control flow analysis of this.xxx assignments in the constructor to determine the type of the property. const constructor = findConstructorDeclaration(declaration.parent); const type = constructor ? getFlowTypeInConstructor(declaration.symbol, constructor) : - getModifierFlags(declaration) & ModifierFlags.Ambient ? getTypeOfPropertyInBaseClass(declaration.symbol) : + getEffectiveModifierFlags(declaration) & ModifierFlags.Ambient ? getTypeOfPropertyInBaseClass(declaration.symbol) : undefined; return type && addOptionality(type, isOptional); } @@ -7619,7 +7655,7 @@ namespace ts { } function isConstructorDeclaredProperty(symbol: Symbol) { - // A propery is considered a constructor declared property when all declaration sites are this.xxx assignments, + // A property is considered a constructor declared property when all declaration sites are this.xxx assignments, // when no declaration sites have JSDoc type annotations, and when at least one declaration site is in the body of // a class constructor. if (symbol.valueDeclaration && isBinaryExpression(symbol.valueDeclaration)) { @@ -7667,7 +7703,7 @@ namespace ts { } function getFlowTypeOfProperty(reference: Node, prop: Symbol | undefined) { - const initialType = prop && (!isAutoTypedProperty(prop) || getModifierFlags(prop.valueDeclaration) & ModifierFlags.Ambient) && getTypeOfPropertyInBaseClass(prop) || undefinedType; + const initialType = prop && (!isAutoTypedProperty(prop) || getEffectiveModifierFlags(prop.valueDeclaration) & ModifierFlags.Ambient) && getTypeOfPropertyInBaseClass(prop) || undefinedType; return getFlowTypeOfReference(reference, autoType, initialType); } @@ -9127,7 +9163,7 @@ namespace ts { } function isStaticPrivateIdentifierProperty(s: Symbol): boolean { - return !!s.valueDeclaration && isPrivateIdentifierPropertyDeclaration(s.valueDeclaration) && hasModifier(s.valueDeclaration, ModifierFlags.Static); + return !!s.valueDeclaration && isPrivateIdentifierPropertyDeclaration(s.valueDeclaration) && hasSyntacticModifier(s.valueDeclaration, ModifierFlags.Static); } function resolveDeclaredMembers(type: InterfaceType): InterfaceTypeWithDeclaredMembers { @@ -9520,27 +9556,36 @@ namespace ts { return result; } - function getExpandedParameters(sig: Signature): readonly Symbol[] { + function getExpandedParameters(sig: Signature, skipUnionExpanding?: boolean): readonly (readonly Symbol[])[] { if (signatureHasRestParameter(sig)) { const restIndex = sig.parameters.length - 1; - const restParameter = sig.parameters[restIndex]; - const restType = getTypeOfSymbol(restParameter); + const restType = getTypeOfSymbol(sig.parameters[restIndex]); if (isTupleType(restType)) { - const elementTypes = getTypeArguments(restType); - const minLength = restType.target.minLength; - const tupleRestIndex = restType.target.hasRestElement ? elementTypes.length - 1 : -1; - const restParams = map(elementTypes, (t, i) => { - const name = getParameterNameAtPosition(sig, restIndex + i); - const checkFlags = i === tupleRestIndex ? CheckFlags.RestParameter : - i >= minLength ? CheckFlags.OptionalParameter : 0; - const symbol = createSymbol(SymbolFlags.FunctionScopedVariable, name, checkFlags); - symbol.type = i === tupleRestIndex ? createArrayType(t) : t; - return symbol; - }); - return concatenate(sig.parameters.slice(0, restIndex), restParams); + return [expandSignatureParametersWithTupleMembers(restType, restIndex)]; + } + else if (!skipUnionExpanding && restType.flags & TypeFlags.Union && every((restType as UnionType).types, isTupleType)) { + return map((restType as UnionType).types, t => expandSignatureParametersWithTupleMembers(t as TupleTypeReference, restIndex)); } } - return sig.parameters; + return [sig.parameters]; + + function expandSignatureParametersWithTupleMembers(restType: TupleTypeReference, restIndex: number) { + const elementTypes = getTypeArguments(restType); + const minLength = restType.target.minLength; + const tupleRestIndex = restType.target.hasRestElement ? elementTypes.length - 1 : -1; + const associatedNames = restType.target.labeledElementDeclarations; + const restParams = map(elementTypes, (t, i) => { + // Lookup the label from the individual tuple passed in before falling back to the signature `rest` parameter name + const tupleLabelName = !!associatedNames && getTupleElementLabel(associatedNames[i]); + const name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i); + const checkFlags = i === tupleRestIndex ? CheckFlags.RestParameter : + i >= minLength ? CheckFlags.OptionalParameter : 0; + const symbol = createSymbol(SymbolFlags.FunctionScopedVariable, name, checkFlags); + symbol.type = i === tupleRestIndex ? createArrayType(t) : t; + return symbol; + }); + return concatenate(sig.parameters.slice(0, restIndex), restParams); + } } function getDefaultConstructSignatures(classType: InterfaceType): Signature[] { @@ -10202,7 +10247,7 @@ namespace ts { } function getPropertiesOfType(type: Type): Symbol[] { - type = getApparentType(getReducedType(type)); + type = getReducedApparentType(type); return type.flags & TypeFlags.UnionOrIntersection ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); @@ -10558,6 +10603,14 @@ namespace ts { t; } + function getReducedApparentType(type: Type): Type { + // Since getApparentType may return a non-reduced union or intersection type, we need to perform + // type reduction both before and after obtaining the apparent type. For example, given a type parameter + // 'T extends A | B', the type 'T & X' becomes 'A & X | B & X' after obtaining the apparent type, and + // that type may need further reduction to remove empty intersections. + return getReducedType(getApparentType(getReducedType(type))); + } + function createUnionOrIntersectionProperty(containingType: UnionOrIntersectionType, name: __String): Symbol | undefined { let singleProp: Symbol | undefined; let propSet: Map | undefined; @@ -10779,7 +10832,7 @@ namespace ts { * @param name a name of property to look up in a given type */ function getPropertyOfType(type: Type, name: __String): Symbol | undefined { - type = getApparentType(getReducedType(type)); + type = getReducedApparentType(type); if (type.flags & TypeFlags.Object) { const resolved = resolveStructuredTypeMembers(type); const symbol = resolved.members.get(name); @@ -10817,7 +10870,7 @@ namespace ts { * maps primitive types and type parameters are to their apparent types. */ function getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[] { - return getSignaturesOfStructuredType(getApparentType(getReducedType(type)), kind); + return getSignaturesOfStructuredType(getReducedApparentType(type), kind); } function getIndexInfoOfStructuredType(type: Type, kind: IndexKind): IndexInfo | undefined { @@ -10835,13 +10888,13 @@ namespace ts { // Return the indexing info of the given kind in the given type. Creates synthetic union index types when necessary and // maps primitive types and type parameters are to their apparent types. function getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined { - return getIndexInfoOfStructuredType(getApparentType(getReducedType(type)), kind); + return getIndexInfoOfStructuredType(getReducedApparentType(type), kind); } // Return the index type of the given kind in the given type. Creates synthetic union index types when necessary and // maps primitive types and type parameters are to their apparent types. function getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined { - return getIndexTypeOfStructuredType(getApparentType(getReducedType(type)), kind); + return getIndexTypeOfStructuredType(getReducedApparentType(type), kind); } function getImplicitIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined { @@ -11409,7 +11462,7 @@ namespace ts { const declaration = getIndexDeclarationOfSymbol(symbol, kind); if (declaration) { return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, - hasModifier(declaration, ModifierFlags.Readonly), declaration); + hasEffectiveModifier(declaration, ModifierFlags.Readonly), declaration); } return undefined; } @@ -11575,7 +11628,7 @@ namespace ts { const typeArguments = !node ? emptyArray : node.kind === SyntaxKind.TypeReference ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters!)) : node.kind === SyntaxKind.ArrayType ? [getTypeFromTypeNode(node.elementType)] : - map(node.elementTypes, getTypeFromTypeNode); + map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; } @@ -11781,11 +11834,11 @@ namespace ts { } function isUnaryTupleTypeNode(node: TypeNode) { - return node.kind === SyntaxKind.TupleType && (node).elementTypes.length === 1; + return node.kind === SyntaxKind.TupleType && (node).elements.length === 1; } function getImpliedConstraint(type: Type, checkNode: TypeNode, extendsNode: TypeNode): Type | undefined { - return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, (checkNode).elementTypes[0], (extendsNode).elementTypes[0]) : + return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, (checkNode).elements[0], (extendsNode).elements[0]) : getActualTypeVariable(getTypeFromTypeNode(checkNode)) === type ? getTypeFromTypeNode(extendsNode) : undefined; } @@ -12081,15 +12134,24 @@ namespace ts { return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]); } + function isTupleRestElement(node: TypeNode) { + return node.kind === SyntaxKind.RestType || (node.kind === SyntaxKind.NamedTupleMember && !!(node as NamedTupleMember).dotDotDotToken); + } + + function isTupleOptionalElement(node: TypeNode) { + return node.kind === SyntaxKind.OptionalType || (node.kind === SyntaxKind.NamedTupleMember && !!(node as NamedTupleMember).questionToken); + } + function getArrayOrTupleTargetType(node: ArrayTypeNode | TupleTypeNode): GenericType { const readonly = isReadonlyTypeOperator(node.parent); - if (node.kind === SyntaxKind.ArrayType || node.elementTypes.length === 1 && node.elementTypes[0].kind === SyntaxKind.RestType) { + if (node.kind === SyntaxKind.ArrayType || node.elements.length === 1 && isTupleRestElement(node.elements[0])) { return readonly ? globalReadonlyArrayType : globalArrayType; } - const lastElement = lastOrUndefined(node.elementTypes); - const restElement = lastElement && lastElement.kind === SyntaxKind.RestType ? lastElement : undefined; - const minLength = findLastIndex(node.elementTypes, n => n.kind !== SyntaxKind.OptionalType && n !== restElement) + 1; - return getTupleTypeOfArity(node.elementTypes.length, minLength, !!restElement, readonly, /*associatedNames*/ undefined); + const lastElement = lastOrUndefined(node.elements); + const restElement = lastElement && isTupleRestElement(lastElement) ? lastElement : undefined; + const minLength = findLastIndex(node.elements, n => !isTupleOptionalElement(n) && n !== restElement) + 1; + const missingName = some(node.elements, e => e.kind !== SyntaxKind.NamedTupleMember); + return getTupleTypeOfArity(node.elements.length, minLength, !!restElement, readonly, /*associatedNames*/ missingName ? undefined : node.elements as readonly NamedTupleMember[]); } // Return true if the given type reference node is directly aliased or if it needs to be deferred @@ -12097,7 +12159,7 @@ namespace ts { function isDeferredTypeReferenceNode(node: TypeReferenceNode | ArrayTypeNode | TupleTypeNode, hasDefaultTypeArguments?: boolean) { return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && ( node.kind === SyntaxKind.ArrayType ? mayResolveTypeAlias(node.elementType) : - node.kind === SyntaxKind.TupleType ? some(node.elementTypes, mayResolveTypeAlias) : + node.kind === SyntaxKind.TupleType ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias)); } @@ -12108,6 +12170,7 @@ namespace ts { const parent = node.parent; switch (parent.kind) { case SyntaxKind.ParenthesizedType: + case SyntaxKind.NamedTupleMember: case SyntaxKind.TypeReference: case SyntaxKind.UnionType: case SyntaxKind.IntersectionType: @@ -12135,11 +12198,12 @@ namespace ts { return (node).operator !== SyntaxKind.UniqueKeyword && mayResolveTypeAlias((node).type); case SyntaxKind.ParenthesizedType: case SyntaxKind.OptionalType: + case SyntaxKind.NamedTupleMember: case SyntaxKind.JSDocOptionalType: case SyntaxKind.JSDocNullableType: case SyntaxKind.JSDocNonNullableType: case SyntaxKind.JSDocTypeExpression: - return mayResolveTypeAlias((node).type); + return mayResolveTypeAlias((node).type); case SyntaxKind.RestType: return (node).type.kind !== SyntaxKind.ArrayType || mayResolveTypeAlias(((node).type).elementType); case SyntaxKind.UnionType: @@ -12162,11 +12226,11 @@ namespace ts { links.resolvedType = emptyObjectType; } else if (isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === SyntaxKind.TupleType && node.elementTypes.length === 0 ? target : + links.resolvedType = node.kind === SyntaxKind.TupleType && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - const elementTypes = node.kind === SyntaxKind.ArrayType ? [getTypeFromTypeNode(node.elementType)] : map(node.elementTypes, getTypeFromTypeNode); + const elementTypes = node.kind === SyntaxKind.ArrayType ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode); links.resolvedType = createTypeReference(target, elementTypes); } } @@ -12184,7 +12248,7 @@ namespace ts { // // Note that the generic type created by this function has no symbol associated with it. The same // is true for each of the synthesized type parameters. - function createTupleTypeOfArity(arity: number, minLength: number, hasRestElement: boolean, readonly: boolean, associatedNames: __String[] | undefined): TupleType { + function createTupleTypeOfArity(arity: number, minLength: number, hasRestElement: boolean, readonly: boolean, namedMemberDeclarations: readonly (NamedTupleMember | ParameterDeclaration)[] | undefined): TupleType { let typeParameters: TypeParameter[] | undefined; const properties: Symbol[] = []; const maxLength = hasRestElement ? arity - 1 : arity; @@ -12195,6 +12259,7 @@ namespace ts { if (i < maxLength) { const property = createSymbol(SymbolFlags.Property | (i >= minLength ? SymbolFlags.Optional : 0), "" + i as __String, readonly ? CheckFlags.Readonly : 0); + property.tupleLabelDeclaration = namedMemberDeclarations?.[i]; property.type = typeParameter; properties.push(property); } @@ -12224,25 +12289,25 @@ namespace ts { type.minLength = minLength; type.hasRestElement = hasRestElement; type.readonly = readonly; - type.associatedNames = associatedNames; + type.labeledElementDeclarations = namedMemberDeclarations; return type; } - function getTupleTypeOfArity(arity: number, minLength: number, hasRestElement: boolean, readonly: boolean, associatedNames?: __String[]): GenericType { - const key = arity + (hasRestElement ? "+" : ",") + minLength + (readonly ? "R" : "") + (associatedNames && associatedNames.length ? "," + associatedNames.join(",") : ""); + function getTupleTypeOfArity(arity: number, minLength: number, hasRestElement: boolean, readonly: boolean, namedMemberDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]): GenericType { + const key = arity + (hasRestElement ? "+" : ",") + minLength + (readonly ? "R" : "") + (namedMemberDeclarations && namedMemberDeclarations.length ? "," + map(namedMemberDeclarations, getNodeId).join(",") : ""); let type = tupleTypes.get(key); if (!type) { - tupleTypes.set(key, type = createTupleTypeOfArity(arity, minLength, hasRestElement, readonly, associatedNames)); + tupleTypes.set(key, type = createTupleTypeOfArity(arity, minLength, hasRestElement, readonly, namedMemberDeclarations)); } return type; } - function createTupleType(elementTypes: readonly Type[], minLength = elementTypes.length, hasRestElement = false, readonly = false, associatedNames?: __String[]) { + function createTupleType(elementTypes: readonly Type[], minLength = elementTypes.length, hasRestElement = false, readonly = false, namedMemberDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]) { const arity = elementTypes.length; if (arity === 1 && hasRestElement) { return createArrayType(elementTypes[0], readonly); } - const tupleType = getTupleTypeOfArity(arity, minLength, arity > 0 && hasRestElement, readonly, associatedNames); + const tupleType = getTupleTypeOfArity(arity, minLength, arity > 0 && hasRestElement, readonly, namedMemberDeclarations); return elementTypes.length ? createTypeReference(tupleType, elementTypes) : tupleType; } @@ -12257,7 +12322,7 @@ namespace ts { Math.max(0, tuple.minLength - index), tuple.hasRestElement, tuple.readonly, - tuple.associatedNames && tuple.associatedNames.slice(index), + tuple.labeledElementDeclarations && tuple.labeledElementDeclarations.slice(index), ); } @@ -13215,7 +13280,7 @@ namespace ts { // In the following we resolve T[K] to the type of the property in T selected by K. // We treat boolean as different from other unions to improve errors; // skipping straight to getPropertyTypeForIndexType gives errors with 'boolean' instead of 'true'. - const apparentObjectType = getApparentType(getReducedType(objectType)); + const apparentObjectType = getReducedApparentType(objectType); if (indexType.flags & TypeFlags.Union && !(indexType.flags & TypeFlags.Boolean)) { const propTypes: Type[] = []; let wasMissingProp = false; @@ -13804,7 +13869,7 @@ namespace ts { const container = getThisContainer(node, /*includeArrowFunctions*/ false); const parent = container && container.parent; if (parent && (isClassLike(parent) || parent.kind === SyntaxKind.InterfaceDeclaration)) { - if (!hasModifier(container, ModifierFlags.Static) && + if (!hasSyntacticModifier(container, ModifierFlags.Static) && (!isConstructorDeclaration(container) || isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent as ClassLikeDeclaration | InterfaceDeclaration)).thisType!; } @@ -13836,6 +13901,21 @@ namespace ts { return links.resolvedType; } + function getTypeFromNamedTupleTypeNode(node: NamedTupleMember): Type { + const links = getNodeLinks(node); + if (!links.resolvedType) { + let type = getTypeFromTypeNode(node.type); + if (node.dotDotDotToken) { + type = getElementTypeOfArrayType(type) || errorType; + } + if (node.questionToken && strictNullChecks) { + type = getOptionalType(type); + } + links.resolvedType = type; + } + return links.resolvedType; + } + function getTypeFromTypeNode(node: TypeNode): Type { return getConditionalFlowTypeOfType(getTypeFromTypeNodeWorker(node), node); } @@ -13894,10 +13974,12 @@ namespace ts { return getTypeFromJSDocNullableTypeNode(node); case SyntaxKind.JSDocOptionalType: return addOptionality(getTypeFromTypeNode((node as JSDocOptionalType).type)); + case SyntaxKind.NamedTupleMember: + return getTypeFromNamedTupleTypeNode(node as NamedTupleMember); case SyntaxKind.ParenthesizedType: case SyntaxKind.JSDocNonNullableType: case SyntaxKind.JSDocTypeExpression: - return getTypeFromTypeNode((node).type); + return getTypeFromTypeNode((node).type); case SyntaxKind.RestType: return getElementTypeOfArrayType(getTypeFromTypeNode((node).type)) || errorType; case SyntaxKind.JSDocVariadicType: @@ -14256,7 +14338,7 @@ namespace ts { minLength; const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, modifiers); return contains(elementTypes, errorType) ? errorType : - createTupleType(elementTypes, newMinLength, tupleType.target.hasRestElement, newReadonly, tupleType.target.associatedNames); + createTupleType(elementTypes, newMinLength, tupleType.target.hasRestElement, newReadonly, tupleType.target.labeledElementDeclarations); } function instantiateMappedTypeTemplate(type: MappedType, key: Type, isOptional: boolean, mapper: TypeMapper) { @@ -17246,8 +17328,8 @@ namespace ts { return true; } - const sourceAccessibility = getSelectedModifierFlags(sourceSignature.declaration, ModifierFlags.NonPublicAccessibilityModifier); - const targetAccessibility = getSelectedModifierFlags(targetSignature.declaration, ModifierFlags.NonPublicAccessibilityModifier); + const sourceAccessibility = getSelectedEffectiveModifierFlags(sourceSignature.declaration, ModifierFlags.NonPublicAccessibilityModifier); + const targetAccessibility = getSelectedEffectiveModifierFlags(targetSignature.declaration, ModifierFlags.NonPublicAccessibilityModifier); // A public, protected and private signature is assignable to a private signature. if (targetAccessibility === ModifierFlags.Private) { @@ -18513,7 +18595,7 @@ namespace ts { const elementTypes = map(getTypeArguments(source), t => inferReverseMappedType(t, target, constraint)); const minLength = getMappedTypeModifiers(target) & MappedTypeModifiers.IncludeOptional ? getTypeReferenceArity(source) - (source.target.hasRestElement ? 1 : 0) : source.target.minLength; - return createTupleType(elementTypes, minLength, source.target.hasRestElement, source.target.readonly, source.target.associatedNames); + return createTupleType(elementTypes, minLength, source.target.hasRestElement, source.target.readonly, source.target.labeledElementDeclarations); } // For all other object types we infer a new object type where the reverse mapping has been // applied to the type of each property. @@ -20126,7 +20208,7 @@ namespace ts { noCacheCheck = false; } if (flags & (FlowFlags.Assignment | FlowFlags.Condition | FlowFlags.ArrayMutation)) { - flow = (flow).antecedent; + flow = (flow).antecedent; } else if (flags & FlowFlags.Call) { const signature = getEffectsSignature((flow).node); @@ -20176,6 +20258,51 @@ namespace ts { } } + // Return true if the given flow node is preceded by a 'super(...)' call in every possible code path + // leading to the node. + function isPostSuperFlowNode(flow: FlowNode, noCacheCheck: boolean): boolean { + while (true) { + const flags = flow.flags; + if (flags & FlowFlags.Shared) { + if (!noCacheCheck) { + const id = getFlowNodeId(flow); + const postSuper = flowNodePostSuper[id]; + return postSuper !== undefined ? postSuper : (flowNodePostSuper[id] = isPostSuperFlowNode(flow, /*noCacheCheck*/ true)); + } + noCacheCheck = false; + } + if (flags & (FlowFlags.Assignment | FlowFlags.Condition | FlowFlags.ArrayMutation | FlowFlags.SwitchClause)) { + flow = (flow).antecedent; + } + else if (flags & FlowFlags.Call) { + if ((flow).node.expression.kind === SyntaxKind.SuperKeyword) { + return true; + } + flow = (flow).antecedent; + } + else if (flags & FlowFlags.BranchLabel) { + // A branching point is post-super if every branch is post-super. + return every((flow).antecedents, f => isPostSuperFlowNode(f, /*noCacheCheck*/ false)); + } + else if (flags & FlowFlags.LoopLabel) { + // A loop is post-super if the control flow path that leads to the top is post-super. + flow = (flow).antecedents![0]; + } + else if (flags & FlowFlags.ReduceLabel) { + const target = (flow).target; + const saveAntecedents = target.antecedents; + target.antecedents = (flow).antecedents; + const result = isPostSuperFlowNode((flow).antecedent, /*noCacheCheck*/ false); + target.antecedents = saveAntecedents; + return result; + } + else { + // Unreachable nodes are considered post-super to silence errors + return !!(flags & FlowFlags.Unreachable); + } + } + } + function getFlowTypeOfReference(reference: Node, declaredType: Type, initialType = declaredType, flowContainer?: Node, couldBeUninitialized?: boolean) { let key: string | undefined; let keySet = false; @@ -21309,7 +21436,7 @@ namespace ts { if (container.kind === SyntaxKind.ArrowFunction) { error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (hasModifier(container, ModifierFlags.Async)) { + else if (hasSyntacticModifier(container, ModifierFlags.Async)) { error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -21351,7 +21478,7 @@ namespace ts { let container = getThisContainer(node, /*includeArrowFunctions*/ false); while (container.kind !== SyntaxKind.SourceFile) { if (container.parent === declaration) { - if (container.kind === SyntaxKind.PropertyDeclaration && hasModifier(container, ModifierFlags.Static)) { + if (container.kind === SyntaxKind.PropertyDeclaration && hasSyntacticModifier(container, ModifierFlags.Static)) { getNodeLinks(declaration).flags |= NodeCheckFlags.ClassWithConstructorReference; getNodeLinks(node).flags |= NodeCheckFlags.ConstructorReferenceInClass; } @@ -21575,31 +21702,10 @@ namespace ts { } } - function findFirstSuperCall(n: Node): SuperCall | undefined { - if (isSuperCall(n)) { - return n; - } - else if (isFunctionLike(n)) { - return undefined; - } - return forEachChild(n, findFirstSuperCall); - } - - /** - * Return a cached result if super-statement is already found. - * Otherwise, find a super statement in a given constructor function and cache the result in the node-links of the constructor - * - * @param constructor constructor-function to look for super statement - */ - function getSuperCallInConstructor(constructor: ConstructorDeclaration): SuperCall | undefined { - const links = getNodeLinks(constructor); - - // Only trying to find super-call if we haven't yet tried to find one. Once we try, we will record the result - if (links.hasSuperCall === undefined) { - links.superCall = findFirstSuperCall(constructor.body!); - links.hasSuperCall = links.superCall ? true : false; - } - return links.superCall!; + function findFirstSuperCall(node: Node): SuperCall | undefined { + return isSuperCall(node) ? node : + isFunctionLike(node) ? undefined : + forEachChild(node, findFirstSuperCall); } /** @@ -21622,17 +21728,7 @@ namespace ts { // If a containing class does not have extends clause or the class extends null // skip checking whether super statement is called before "this" accessing. if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - const superCall = getSuperCallInConstructor(container); - - // We should give an error in the following cases: - // - No super-call - // - "this" is accessing before super-call. - // i.e super(this) - // this.x; super(); - // We want to make sure that super-call is done before accessing "this" so that - // "this" is not accessed as a parameter of the super-call. - if (!superCall || superCall.end > node.pos) { - // In ES6, super inside constructor of class-declaration has to precede "this" accessing + if (node.flowNode && !isPostSuperFlowNode(node.flowNode, /*noCacheCheck*/ false)) { error(node, diagnosticMessage); } } @@ -21671,7 +21767,7 @@ namespace ts { break; case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: - if (hasModifier(container, ModifierFlags.Static) && !(compilerOptions.target === ScriptTarget.ESNext && compilerOptions.useDefineForClassFields)) { + if (hasSyntacticModifier(container, ModifierFlags.Static) && !(compilerOptions.target === ScriptTarget.ESNext && compilerOptions.useDefineForClassFields)) { error(node, Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } @@ -21741,7 +21837,7 @@ namespace ts { if (isClassLike(container.parent)) { const symbol = getSymbolOfNode(container.parent); - const type = hasModifier(container, ModifierFlags.Static) ? getTypeOfSymbol(symbol) : (getDeclaredTypeOfSymbol(symbol) as InterfaceType).thisType!; + const type = hasSyntacticModifier(container, ModifierFlags.Static) ? getTypeOfSymbol(symbol) : (getDeclaredTypeOfSymbol(symbol) as InterfaceType).thisType!; return getFlowTypeOfReference(node, type); } @@ -21777,7 +21873,7 @@ namespace ts { } if (isClassLike(container.parent)) { const symbol = getSymbolOfNode(container.parent); - return hasModifier(container, ModifierFlags.Static) ? getTypeOfSymbol(symbol) : (getDeclaredTypeOfSymbol(symbol) as InterfaceType).thisType!; + return hasSyntacticModifier(container, ModifierFlags.Static) ? getTypeOfSymbol(symbol) : (getDeclaredTypeOfSymbol(symbol) as InterfaceType).thisType!; } } @@ -21857,7 +21953,8 @@ namespace ts { function checkSuperExpression(node: Node): Type { const isCallExpression = node.parent.kind === SyntaxKind.CallExpression && (node.parent).expression === node; - let container = getSuperContainer(node, /*stopOnFunctions*/ true); + const immediateContainer = getSuperContainer(node, /*stopOnFunctions*/ true); + let container = immediateContainer; let needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting @@ -21893,11 +21990,11 @@ namespace ts { return errorType; } - if (!isCallExpression && container.kind === SyntaxKind.Constructor) { + if (!isCallExpression && immediateContainer.kind === SyntaxKind.Constructor) { checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } - if (hasModifier(container, ModifierFlags.Static) || isCallExpression) { + if (hasSyntacticModifier(container, ModifierFlags.Static) || isCallExpression) { nodeCheckFlag = NodeCheckFlags.SuperStatic; } else { @@ -21965,7 +22062,7 @@ namespace ts { // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === SyntaxKind.MethodDeclaration && hasModifier(container, ModifierFlags.Async)) { + if (container.kind === SyntaxKind.MethodDeclaration && hasSyntacticModifier(container, ModifierFlags.Async)) { if (isSuperProperty(node.parent) && isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= NodeCheckFlags.AsyncMethodWithSuperBinding; } @@ -22033,7 +22130,7 @@ namespace ts { // topmost container must be something that is directly nested in the class declaration\object literal expression if (isClassLike(container.parent) || container.parent.kind === SyntaxKind.ObjectLiteralExpression) { - if (hasModifier(container, ModifierFlags.Static)) { + if (hasSyntacticModifier(container, ModifierFlags.Static)) { return container.kind === SyntaxKind.MethodDeclaration || container.kind === SyntaxKind.MethodSignature || container.kind === SyntaxKind.GetAccessor || @@ -22431,6 +22528,10 @@ namespace ts { } } + function isCircularMappedProperty(symbol: Symbol) { + return !!(getCheckFlags(symbol) & CheckFlags.Mapped && !(symbol).type && findResolutionCycleStartIndex(symbol, TypeSystemPropertyName.Type) >= 0); + } + function getTypeOfPropertyOfContextualType(type: Type, name: __String) { return mapType(type, t => { if (isGenericMappedType(t)) { @@ -22444,7 +22545,7 @@ namespace ts { else if (t.flags & TypeFlags.StructuredType) { const prop = getPropertyOfType(t, name); if (prop) { - return getTypeOfSymbol(prop); + return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop); } if (isTupleType(t)) { const restType = getRestTypeOfTupleType(t); @@ -23584,7 +23685,7 @@ namespace ts { for (const right of getPropertiesOfType(type)) { const left = props.get(right.escapedName); const rightType = getTypeOfSymbol(right); - if (left && !maybeTypeOfKind(rightType, TypeFlags.Nullable) && !(maybeTypeOfKind(rightType, TypeFlags.Any) && right.flags & SymbolFlags.Optional)) { + if (left && !maybeTypeOfKind(rightType, TypeFlags.Nullable) && !(maybeTypeOfKind(rightType, TypeFlags.AnyOrUnknown) && right.flags & SymbolFlags.Optional)) { const diagnostic = error(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName)); addRelatedInfo(diagnostic, createDiagnosticForNode(spread, Diagnostics.This_spread_always_overwrites_this_property)); } @@ -24499,7 +24600,7 @@ namespace ts { function typeHasStaticProperty(propName: __String, containingType: Type): boolean { const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName); - return prop !== undefined && prop.valueDeclaration && hasModifier(prop.valueDeclaration, ModifierFlags.Static); + return prop !== undefined && prop.valueDeclaration && hasSyntacticModifier(prop.valueDeclaration, ModifierFlags.Static); } function getSuggestedSymbolForNonexistentProperty(name: Identifier | PrivateIdentifier | string, containingType: Type): Symbol | undefined { @@ -24608,7 +24709,7 @@ namespace ts { if (!valueDeclaration) { return; } - const hasPrivateModifier = hasModifier(valueDeclaration, ModifierFlags.Private); + const hasPrivateModifier = hasEffectiveModifier(valueDeclaration, ModifierFlags.Private); const hasPrivateIdentifier = isNamedDeclaration(prop.valueDeclaration) && isPrivateIdentifier(prop.valueDeclaration.name); if (!hasPrivateModifier && !hasPrivateIdentifier) { return; @@ -25093,7 +25194,7 @@ namespace ts { function getArrayifiedType(type: Type) { return type.flags & TypeFlags.Union ? mapType(type, getArrayifiedType) : type.flags & (TypeFlags.Any | TypeFlags.Instantiable) || isMutableArrayOrTuple(type) ? type : - isTupleType(type) ? createTupleType(getTypeArguments(type), type.target.minLength, type.target.hasRestElement, /*readonly*/ false, type.target.associatedNames) : + isTupleType(type) ? createTupleType(getTypeArguments(type), type.target.minLength, type.target.hasRestElement, /*readonly*/ false, type.target.labeledElementDeclarations) : createArrayType(getIndexedAccessType(type, numberType)); } @@ -25109,6 +25210,7 @@ namespace ts { } } const types = []; + const names: (ParameterDeclaration | NamedTupleMember)[] = []; let spreadIndex = -1; for (let i = index; i < argCount; i++) { const contextualType = getIndexedAccessType(restType, getLiteralType(i - index)); @@ -25116,12 +25218,15 @@ namespace ts { if (spreadIndex < 0 && isSpreadArgument(args[i])) { spreadIndex = i - index; } + if (args[i].kind === SyntaxKind.SyntheticExpression && (args[i] as SyntheticExpression).tupleNameSource) { + names.push((args[i] as SyntheticExpression).tupleNameSource!); + } const hasPrimitiveContextualType = maybeTypeOfKind(contextualType, TypeFlags.Primitive | TypeFlags.Index); types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); } return spreadIndex < 0 ? - createTupleType(types) : - createTupleType(append(types.slice(0, spreadIndex), getUnionType(types.slice(spreadIndex))), spreadIndex, /*hasRestElement*/ true); + createTupleType(types, /*minLength*/ undefined, /*hasRestElement*/ undefined, /*readonly*/ undefined, length(names) === length(types) ? names : undefined) : + createTupleType(append(types.slice(0, spreadIndex), getUnionType(types.slice(spreadIndex))), spreadIndex, /*hasRestElement*/ true, /*readonly*/ undefined); } function checkTypeArguments(signature: Signature, typeArgumentNodes: readonly TypeNode[], reportErrors: boolean, headMessage?: DiagnosticMessage): Type[] | undefined { @@ -25372,11 +25477,12 @@ namespace ts { } } - function createSyntheticExpression(parent: Node, type: Type, isSpread?: boolean) { + function createSyntheticExpression(parent: Node, type: Type, isSpread?: boolean, tupleNameSource?: ParameterDeclaration | NamedTupleMember) { const result = createNode(SyntaxKind.SyntheticExpression, parent.pos, parent.end); result.parent = parent; result.type = type; result.isSpread = isSpread || false; + result.tupleNameSource = tupleNameSource; return result; } @@ -25411,7 +25517,7 @@ namespace ts { if (isTupleType(type)) { const typeArguments = getTypeArguments(type); const restIndex = type.target.hasRestElement ? typeArguments.length - 1 : -1; - const syntheticArgs = map(typeArguments, (t, i) => createSyntheticExpression(spreadArgument, t, /*isSpread*/ i === restIndex)); + const syntheticArgs = map(typeArguments, (t, i) => createSyntheticExpression(spreadArgument, t, /*isSpread*/ i === restIndex, type.target.labeledElementDeclarations?.[i])); return concatenate(args.slice(0, length - 1), syntheticArgs); } } @@ -26176,7 +26282,7 @@ namespace ts { // In the case of a merged class-module or class-interface declaration, // only the class declaration node will have the Abstract flag set. const valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && hasModifier(valueDecl, ModifierFlags.Abstract)) { + if (valueDecl && hasSyntacticModifier(valueDecl, ModifierFlags.Abstract)) { error(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -26244,7 +26350,7 @@ namespace ts { } const declaration = signature.declaration; - const modifiers = getSelectedModifierFlags(declaration, ModifierFlags.NonPublicAccessibilityModifier); + const modifiers = getSelectedEffectiveModifierFlags(declaration, ModifierFlags.NonPublicAccessibilityModifier); // (1) Public constructors and (2) constructor functions are always accessible. if (!modifiers || declaration.kind !== SyntaxKind.Constructor) { @@ -26953,6 +27059,11 @@ namespace ts { return type; } + function getTupleElementLabel(d: ParameterDeclaration | NamedTupleMember) { + Debug.assert(isIdentifier(d.name)); // Parameter declarations could be binding patterns, but we only allow identifier names + return d.name.escapedText; + } + function getParameterNameAtPosition(signature: Signature, pos: number) { const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); if (pos < paramCount) { @@ -26961,13 +27072,33 @@ namespace ts { const restParameter = signature.parameters[paramCount] || unknownSymbol; const restType = getTypeOfSymbol(restParameter); if (isTupleType(restType)) { - const associatedNames = ((restType).target).associatedNames; + const associatedNames = ((restType).target).labeledElementDeclarations; const index = pos - paramCount; - return associatedNames && associatedNames[index] || restParameter.escapedName + "_" + index as __String; + return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index as __String; } return restParameter.escapedName; } + function isValidDeclarationForTupleLabel(d: Declaration): d is NamedTupleMember | (ParameterDeclaration & { name: Identifier }) { + return d.kind === SyntaxKind.NamedTupleMember || (isParameter(d) && d.name && isIdentifier(d.name)); + } + + function getNameableDeclarationAtPosition(signature: Signature, pos: number) { + const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); + if (pos < paramCount) { + const decl = signature.parameters[pos].valueDeclaration; + return decl && isValidDeclarationForTupleLabel(decl) ? decl : undefined; + } + const restParameter = signature.parameters[paramCount] || unknownSymbol; + const restType = getTypeOfSymbol(restParameter); + if (isTupleType(restType)) { + const associatedNames = ((restType).target).labeledElementDeclarations; + const index = pos - paramCount; + return associatedNames && associatedNames[index]; + } + return restParameter.valueDeclaration && isValidDeclarationForTupleLabel(restParameter.valueDeclaration) ? restParameter.valueDeclaration : undefined; + } + function getTypeAtPosition(signature: Signature, pos: number): Type { return tryGetTypeAtPosition(signature, pos) || anyType; } @@ -26998,14 +27129,26 @@ namespace ts { return restType; } const types = []; - const names = []; + let names: (NamedTupleMember | ParameterDeclaration)[] | undefined = []; for (let i = pos; i < nonRestCount; i++) { types.push(getTypeAtPosition(source, i)); - names.push(getParameterNameAtPosition(source, i)); + const name = getNameableDeclarationAtPosition(source, i); + if (name && names) { + names.push(name); + } + else { + names = undefined; + } } if (restType) { types.push(getIndexedAccessType(restType, numberType)); - names.push(getParameterNameAtPosition(source, nonRestCount)); + const name = getNameableDeclarationAtPosition(source, nonRestCount); + if (name && names) { + names.push(name); + } + else { + names = undefined; + } } const minArgumentCount = getMinArgumentCount(source); const minLength = minArgumentCount < pos ? 0 : minArgumentCount - pos; @@ -29427,7 +29570,7 @@ namespace ts { checkVariableLikeDeclaration(node); const func = getContainingFunction(node)!; - if (hasModifier(node, ModifierFlags.ParameterPropertyModifier)) { + if (hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier)) { if (!(func.kind === SyntaxKind.Constructor && nodeIsPresent(func.body))) { error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } @@ -29654,7 +29797,7 @@ namespace ts { } } else { - const isStatic = hasModifier(member, ModifierFlags.Static); + const isStatic = hasSyntacticModifier(member, ModifierFlags.Static); const name = member.name; if (!name) { return; @@ -29721,7 +29864,7 @@ namespace ts { function checkClassForStaticPropertyNameConflicts(node: ClassLikeDeclaration) { for (const member of node.members) { const memberNameNode = member.name; - const isStatic = hasModifier(member, ModifierFlags.Static); + const isStatic = hasSyntacticModifier(member, ModifierFlags.Static); if (isStatic && memberNameNode) { const memberName = getPropertyNameForPropertyNameNode(memberNameNode); switch (memberName) { @@ -29844,7 +29987,7 @@ namespace ts { // Abstract methods cannot have an implementation. // Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node. - if (hasModifier(node, ModifierFlags.Abstract) && node.kind === SyntaxKind.MethodDeclaration && node.body) { + if (hasSyntacticModifier(node, ModifierFlags.Abstract) && node.kind === SyntaxKind.MethodDeclaration && node.body) { error(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name)); } } @@ -29879,7 +30022,7 @@ namespace ts { return true; } return n.kind === SyntaxKind.PropertyDeclaration && - !hasModifier(n, ModifierFlags.Static) && + !hasSyntacticModifier(n, ModifierFlags.Static) && !!(n).initializer; } @@ -29890,7 +30033,7 @@ namespace ts { if (getClassExtendsHeritageElement(containingClassDecl)) { captureLexicalThis(node.parent, containingClassDecl); const classExtendsNull = classDeclarationExtendsNull(containingClassDecl); - const superCall = getSuperCallInConstructor(node); + const superCall = findFirstSuperCall(node.body!); if (superCall) { if (classExtendsNull) { error(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); @@ -29904,7 +30047,7 @@ namespace ts { const superCallShouldBeFirst = (compilerOptions.target !== ScriptTarget.ESNext || !compilerOptions.useDefineForClassFields) && (some((node.parent).members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || - some(node.parameters, p => hasModifier(p, ModifierFlags.ParameterPropertyModifier))); + some(node.parameters, p => hasSyntacticModifier(p, ModifierFlags.ParameterPropertyModifier))); // Skip past any prologue directives to find the first statement // to ensure that it was a super call. @@ -29961,8 +30104,8 @@ namespace ts { const otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor; const otherAccessor = getDeclarationOfKind(getSymbolOfNode(node), otherKind); if (otherAccessor) { - const nodeFlags = getModifierFlags(node); - const otherFlags = getModifierFlags(otherAccessor); + const nodeFlags = getEffectiveModifierFlags(node); + const otherFlags = getEffectiveModifierFlags(otherAccessor); if ((nodeFlags & ModifierFlags.AccessibilityModifier) !== (otherFlags & ModifierFlags.AccessibilityModifier)) { error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } @@ -30081,11 +30224,19 @@ namespace ts { } function checkTupleType(node: TupleTypeNode) { - const elementTypes = node.elementTypes; + const elementTypes = node.elements; let seenOptionalElement = false; + let seenNamedElement = false; for (let i = 0; i < elementTypes.length; i++) { const e = elementTypes[i]; - if (e.kind === SyntaxKind.RestType) { + if (e.kind === SyntaxKind.NamedTupleMember) { + seenNamedElement = true; + } + else if (seenNamedElement) { + grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); + break; + } + if (isTupleRestElement(e)) { if (i !== elementTypes.length - 1) { grammarErrorOnNode(e, Diagnostics.A_rest_element_must_be_last_in_a_tuple_type); break; @@ -30094,7 +30245,7 @@ namespace ts { error(e, Diagnostics.A_rest_element_type_must_be_an_array_type); } } - else if (e.kind === SyntaxKind.OptionalType) { + else if (isTupleOptionalElement(e)) { seenOptionalElement = true; } else if (seenOptionalElement) { @@ -30102,7 +30253,7 @@ namespace ts { break; } } - forEach(node.elementTypes, checkSourceElement); + forEach(node.elements, checkSourceElement); } function checkUnionOrIntersectionType(node: UnionOrIntersectionTypeNode) { @@ -30188,8 +30339,22 @@ namespace ts { getTypeFromTypeNode(node); } + function checkNamedTupleMember(node: NamedTupleMember) { + if (node.dotDotDotToken && node.questionToken) { + grammarErrorOnNode(node, Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); + } + if (node.type.kind === SyntaxKind.OptionalType) { + grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); + } + if (node.type.kind === SyntaxKind.RestType) { + grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); + } + checkSourceElement(node.type); + getTypeFromTypeNode(node); + } + function isPrivateWithinAmbient(node: Node): boolean { - return (hasModifier(node, ModifierFlags.Private) || isPrivateIdentifierPropertyDeclaration(node)) && !!(node.flags & NodeFlags.Ambient); + return (hasEffectiveModifier(node, ModifierFlags.Private) || isPrivateIdentifierPropertyDeclaration(node)) && !!(node.flags & NodeFlags.Ambient); } function getEffectiveDeclarationFlags(n: Declaration, flagsToCheck: ModifierFlags): ModifierFlags { @@ -30308,13 +30473,13 @@ namespace ts { )) { const reportError = (node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) && - hasModifier(node, ModifierFlags.Static) !== hasModifier(subsequentNode, ModifierFlags.Static); + hasSyntacticModifier(node, ModifierFlags.Static) !== hasSyntacticModifier(subsequentNode, ModifierFlags.Static); // we can get here in two cases // 1. mixed static and instance class members // 2. something with the same name was defined before the set of overloads that prevents them from merging // here we'll report error only for the first case since for second we should already report error in binder if (reportError) { - const diagnostic = hasModifier(node, ModifierFlags.Static) ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static; + const diagnostic = hasSyntacticModifier(node, ModifierFlags.Static) ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static; error(errorNode, diagnostic); } return; @@ -30332,7 +30497,7 @@ namespace ts { else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (hasModifier(node, ModifierFlags.Abstract)) { + if (hasSyntacticModifier(node, ModifierFlags.Abstract)) { error(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -30423,7 +30588,7 @@ namespace ts { // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !hasModifier(lastSeenNonAmbientDeclaration, ModifierFlags.Abstract) && !lastSeenNonAmbientDeclaration.questionToken) { + !hasSyntacticModifier(lastSeenNonAmbientDeclaration, ModifierFlags.Abstract) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } @@ -30967,6 +31132,7 @@ namespace ts { return getEntityNameForDecoratorMetadataFromTypeList([(node).trueType, (node).falseType]); case SyntaxKind.ParenthesizedType: + case SyntaxKind.NamedTupleMember: return getEntityNameForDecoratorMetadata((node).type); case SyntaxKind.TypeReference: @@ -30978,8 +31144,8 @@ namespace ts { function getEntityNameForDecoratorMetadataFromTypeList(types: readonly TypeNode[]): EntityName | undefined { let commonEntityName: EntityName | undefined; for (let typeNode of types) { - while (typeNode.kind === SyntaxKind.ParenthesizedType) { - typeNode = (typeNode as ParenthesizedTypeNode).type; // Skip parens if need be + while (typeNode.kind === SyntaxKind.ParenthesizedType || typeNode.kind === SyntaxKind.NamedTupleMember) { + typeNode = (typeNode as ParenthesizedTypeNode | NamedTupleMember).type; // Skip parens if need be } if (typeNode.kind === SyntaxKind.NeverKeyword) { continue; // Always elide `never` from the union/intersection if possible @@ -31367,14 +31533,14 @@ namespace ts { } const symbol = getSymbolOfNode(member); if (!symbol.isReferenced - && (hasModifier(member, ModifierFlags.Private) || isNamedDeclaration(member) && isPrivateIdentifier(member.name)) + && (hasEffectiveModifier(member, ModifierFlags.Private) || isNamedDeclaration(member) && isPrivateIdentifier(member.name)) && !(member.flags & NodeFlags.Ambient)) { addDiagnostic(member, UnusedKind.Local, createDiagnosticForNode(member.name!, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; case SyntaxKind.Constructor: for (const parameter of (member).parameters) { - if (!parameter.symbol.isReferenced && hasModifier(parameter, ModifierFlags.Private)) { + if (!parameter.symbol.isReferenced && hasSyntacticModifier(parameter, ModifierFlags.Private)) { addDiagnostic(parameter, UnusedKind.Local, createDiagnosticForNode(parameter.name, Diagnostics.Property_0_is_declared_but_its_value_is_never_read, symbolName(parameter.symbol))); } } @@ -31969,7 +32135,7 @@ namespace ts { ModifierFlags.Readonly | ModifierFlags.Static; - return getSelectedModifierFlags(left, interestingFlags) === getSelectedModifierFlags(right, interestingFlags); + return getSelectedEffectiveModifierFlags(left, interestingFlags) === getSelectedEffectiveModifierFlags(right, interestingFlags); } function checkVariableDeclaration(node: VariableDeclaration) { @@ -33158,7 +33324,7 @@ namespace ts { // Only process instance properties with computed names here. // Static properties cannot be in conflict with indexers, // and properties with literal names were already checked. - if (!hasModifier(member, ModifierFlags.Static) && hasNonBindableDynamicName(member)) { + if (!hasSyntacticModifier(member, ModifierFlags.Static) && hasNonBindableDynamicName(member)) { const symbol = getSymbolOfNode(member); const propType = getTypeOfSymbol(symbol); checkIndexConstraintForProperty(symbol, propType, type, declaredStringIndexer, stringIndexType, IndexKind.String); @@ -33394,7 +33560,7 @@ namespace ts { } function checkClassDeclaration(node: ClassDeclaration) { - if (!node.name && !hasModifier(node, ModifierFlags.Default)) { + if (!node.name && !hasSyntacticModifier(node, ModifierFlags.Default)) { grammarErrorOnFirstToken(node, Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -33549,7 +33715,7 @@ namespace ts { const signatures = getSignaturesOfType(type, SignatureKind.Construct); if (signatures.length) { const declaration = signatures[0].declaration; - if (declaration && hasModifier(declaration, ModifierFlags.Private)) { + if (declaration && hasEffectiveModifier(declaration, ModifierFlags.Private)) { const typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol)!; if (!isNodeWithinClass(node, typeClassDeclaration)) { error(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol)); @@ -33611,7 +33777,7 @@ namespace ts { // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & ModifierFlags.Abstract && (!derivedClassDecl || !hasModifier(derivedClassDecl, ModifierFlags.Abstract))) { + if (baseDeclarationFlags & ModifierFlags.Abstract && (!derivedClassDecl || !hasSyntacticModifier(derivedClassDecl, ModifierFlags.Abstract))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -33772,7 +33938,7 @@ namespace ts { } const constructor = findConstructorDeclaration(node); for (const member of node.members) { - if (getModifierFlags(member) & ModifierFlags.Ambient) { + if (getEffectiveModifierFlags(member) & ModifierFlags.Ambient) { continue; } if (isInstancePropertyWithoutInitializer(member)) { @@ -33791,7 +33957,7 @@ namespace ts { function isInstancePropertyWithoutInitializer(node: Node) { return node.kind === SyntaxKind.PropertyDeclaration && - !hasModifier(node, ModifierFlags.Static | ModifierFlags.Abstract) && + !hasSyntacticModifier(node, ModifierFlags.Static | ModifierFlags.Abstract) && !(node).exclamationToken && !(node).initializer; } @@ -34371,7 +34537,7 @@ namespace ts { // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecoratorsAndModifiers(node) && hasModifiers(node)) { + if (!checkGrammarDecoratorsAndModifiers(node) && hasEffectiveModifiers(node)) { grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -34404,7 +34570,7 @@ namespace ts { checkGrammarDecoratorsAndModifiers(node); if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (hasModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { markExportAsReferenced(node); } if (node.moduleReference.kind !== SyntaxKind.ExternalModuleReference) { @@ -34437,7 +34603,7 @@ namespace ts { return; } - if (!checkGrammarDecoratorsAndModifiers(node) && hasModifiers(node)) { + if (!checkGrammarDecoratorsAndModifiers(node) && hasEffectiveModifiers(node)) { grammarErrorOnFirstToken(node, Diagnostics.An_export_declaration_cannot_have_modifiers); } @@ -34560,7 +34726,7 @@ namespace ts { return; } // Grammar checking - if (!checkGrammarDecoratorsAndModifiers(node) && hasModifiers(node)) { + if (!checkGrammarDecoratorsAndModifiers(node) && hasEffectiveModifiers(node)) { grammarErrorOnFirstToken(node, Diagnostics.An_export_assignment_cannot_have_modifiers); } if (node.expression.kind === SyntaxKind.Identifier) { @@ -34732,6 +34898,8 @@ namespace ts { return checkInferType(node); case SyntaxKind.ImportType: return checkImportType(node); + case SyntaxKind.NamedTupleMember: + return checkNamedTupleMember(node); case SyntaxKind.JSDocAugmentsTag: return checkJSDocAugmentsTag(node as JSDocAugmentsTag); case SyntaxKind.JSDocImplementsTag: @@ -35177,7 +35345,7 @@ namespace ts { copySymbol(argumentsSymbol, meaning); } - isStatic = hasModifier(location, ModifierFlags.Static); + isStatic = hasSyntacticModifier(location, ModifierFlags.Static); location = location.parent; } @@ -35702,7 +35870,7 @@ namespace ts { */ function getParentTypeOfClassElement(node: ClassElement) { const classSymbol = getSymbolOfNode(node.parent)!; - return hasModifier(node, ModifierFlags.Static) + return hasSyntacticModifier(node, ModifierFlags.Static) ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } @@ -36005,7 +36173,7 @@ namespace ts { return true; } const target = getSymbolLinks(symbol!).target; // TODO: GH#18217 - if (target && getModifierFlags(node) & ModifierFlags.Export && + if (target && getEffectiveModifierFlags(node) & ModifierFlags.Export && target.flags & SymbolFlags.Value && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) { // An `export import ... =` of a value symbol is always considered referenced @@ -36046,14 +36214,14 @@ namespace ts { !isOptionalParameter(parameter) && !isJSDocParameterTag(parameter) && !!parameter.initializer && - !hasModifier(parameter, ModifierFlags.ParameterPropertyModifier); + !hasSyntacticModifier(parameter, ModifierFlags.ParameterPropertyModifier); } function isOptionalUninitializedParameterProperty(parameter: ParameterDeclaration) { return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && - hasModifier(parameter, ModifierFlags.ParameterPropertyModifier); + hasSyntacticModifier(parameter, ModifierFlags.ParameterPropertyModifier); } function isExpandoFunctionDeclaration(node: Declaration): boolean { @@ -36889,7 +37057,7 @@ namespace ts { node.kind !== SyntaxKind.SetAccessor) { return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === SyntaxKind.ClassDeclaration && hasModifier(node.parent, ModifierFlags.Abstract))) { + if (!(node.parent.kind === SyntaxKind.ClassDeclaration && hasSyntacticModifier(node.parent, ModifierFlags.Abstract))) { return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & ModifierFlags.Static) { @@ -37135,7 +37303,7 @@ namespace ts { if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (hasModifiers(parameter)) { + if (hasEffectiveModifiers(parameter)) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -37529,11 +37697,11 @@ namespace ts { if (languageVersion < ScriptTarget.ES5) { return grammarErrorOnNode(accessor.name, Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } - if (accessor.body === undefined && !hasModifier(accessor, ModifierFlags.Abstract)) { + if (accessor.body === undefined && !hasSyntacticModifier(accessor, ModifierFlags.Abstract)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, Diagnostics._0_expected, "{"); } } - if (accessor.body && hasModifier(accessor, ModifierFlags.Abstract)) { + if (accessor.body && hasSyntacticModifier(accessor, ModifierFlags.Abstract)) { return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } if (accessor.typeParameters) { @@ -37583,7 +37751,14 @@ namespace ts { return grammarErrorOnNode(node.type, Diagnostics._0_expected, tokenToString(SyntaxKind.SymbolKeyword)); } - const parent = walkUpParenthesizedTypes(node.parent); + let parent = walkUpParenthesizedTypes(node.parent); + if (isInJSFile(parent) && isJSDocTypeExpression(parent)) { + parent = parent.parent; + if (isJSDocTypeTag(parent)) { + // walk up past JSDoc comment node + parent = parent.parent.parent; + } + } switch (parent.kind) { case SyntaxKind.VariableDeclaration: const decl = parent as VariableDeclaration; @@ -37599,14 +37774,14 @@ namespace ts { break; case SyntaxKind.PropertyDeclaration: - if (!hasModifier(parent, ModifierFlags.Static) || - !hasModifier(parent, ModifierFlags.Readonly)) { + if (!hasSyntacticModifier(parent, ModifierFlags.Static) || + !hasEffectiveModifier(parent, ModifierFlags.Readonly)) { return grammarErrorOnNode((parent).name, Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; case SyntaxKind.PropertySignature: - if (!hasModifier(parent, ModifierFlags.Readonly)) { + if (!hasSyntacticModifier(parent, ModifierFlags.Readonly)) { return grammarErrorOnNode((parent).name, Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } break; @@ -37813,7 +37988,7 @@ namespace ts { const moduleKind = getEmitModuleKind(compilerOptions); if (moduleKind < ModuleKind.ES2015 && moduleKind !== ModuleKind.System && !compilerOptions.noEmit && - !(node.parent.parent.flags & NodeFlags.Ambient) && hasModifier(node.parent.parent, ModifierFlags.Export)) { + !(node.parent.parent.flags & NodeFlags.Ambient) && hasSyntacticModifier(node.parent.parent, ModifierFlags.Export)) { checkESModuleMarker(node.name); } @@ -38001,7 +38176,7 @@ namespace ts { } if (isPropertyDeclaration(node) && node.exclamationToken && (!isClassLike(node.parent) || !node.type || node.initializer || - node.flags & NodeFlags.Ambient || hasModifier(node, ModifierFlags.Static | ModifierFlags.Abstract))) { + node.flags & NodeFlags.Ambient || hasSyntacticModifier(node, ModifierFlags.Static | ModifierFlags.Abstract))) { return grammarErrorOnNode(node.exclamationToken, Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); } } @@ -38026,7 +38201,7 @@ namespace ts { node.kind === SyntaxKind.ExportDeclaration || node.kind === SyntaxKind.ExportAssignment || node.kind === SyntaxKind.NamespaceExportDeclaration || - hasModifier(node, ModifierFlags.Ambient | ModifierFlags.Export | ModifierFlags.Default)) { + hasSyntacticModifier(node, ModifierFlags.Ambient | ModifierFlags.Export | ModifierFlags.Default)) { return false; } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 2841b80aedf..651f5fe82de 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -129,12 +129,28 @@ namespace ts { return map; } + /** + * Creates a new array with `element` interspersed in between each element of `input` + * if there is more than 1 value in `input`. Otherwise, returns the existing array. + */ + export function intersperse(input: T[], element: T): T[] { + if (input.length <= 1) { + return input; + } + const result: T[] = []; + for (let i = 0, n = input.length; i < n; i++) { + if (i) result.push(element); + result.push(input[i]); + } + return result; + } + /** * Iterates through `array` by index and performs the callback on each element of array until the callback * returns a falsey value, then returns false. * If no such value is found, the callback is applied to each element of array and `true` is returned. */ - export function every(array: readonly T[], callback: (element: T, index: number) => boolean): boolean { + export function every(array: readonly T[] | undefined, callback: (element: T, index: number) => boolean): boolean { if (array) { for (let i = 0; i < array.length; i++) { if (!callback(array[i], i)) { diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index 53e23b02ace..37beb5225b5 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -376,7 +376,7 @@ namespace ts { Object.defineProperties(ctor.prototype, { __debugKind: { get(this: Node) { return formatSyntaxKind(this.kind); } }, __debugNodeFlags: { get(this: Node) { return formatNodeFlags(this.flags); } }, - __debugModifierFlags: { get(this: Node) { return formatModifierFlags(getModifierFlagsNoCache(this)); } }, + __debugModifierFlags: { get(this: Node) { return formatModifierFlags(getEffectiveModifierFlagsNoCache(this)); } }, __debugTransformFlags: { get(this: Node) { return formatTransformFlags(this.transformFlags); } }, __debugIsParseTreeNode: { get(this: Node) { return isParseTreeNode(this); } }, __debugEmitFlags: { get(this: Node) { return formatEmitFlags(getEmitFlags(this)); } }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 78c047a5e4a..df3192652ac 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3517,6 +3517,22 @@ "category": "Error", "code": 5083 }, + "Tuple members must all have names or all not have names.": { + "category": "Error", + "code": 5084 + }, + "A tuple member cannot be both optional and rest.": { + "category": "Error", + "code": 5085 + }, + "A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type.": { + "category": "Error", + "code": 5086 + }, + "A labeled tuple element is declared as rest with a `...` before the name, rather than before the type.": { + "category": "Error", + "code": 5087 + }, "Generates a sourcemap for each corresponding '.d.ts' file.": { "category": "Message", @@ -4911,6 +4927,14 @@ "category": "Error", "code": 8032 }, + "A JSDoc '@typedef' comment may not contain multiple '@type' tags.": { + "category": "Error", + "code": 8033 + }, + "The tag was first specified here.": { + "category": "Error", + "code": 8034 + }, "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.": { "category": "Error", "code": 9002 @@ -5649,7 +5673,7 @@ "category": "Message", "code": 95111 }, - "Remove block body braces": { + "Remove braces from arrow function body": { "category": "Message", "code": 95112 }, @@ -5661,7 +5685,7 @@ "category": "Message", "code": 95114 }, - "Remove all incorrect body block braces": { + "Remove braces from all arrow function bodies with relevant issues": { "category": "Message", "code": 95115 }, @@ -5669,7 +5693,15 @@ "category": "Message", "code": 95116 }, - + "Move labeled tuple element modifiers to labels": { + "category": "Message", + "code": 95117 + }, + "Convert overload list to single signature": { + "category": "Message", + "code": 95118 + }, + "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": { "category": "Error", "code": 18004 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index dc4b9ad5f2f..b2325d2e3e6 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1370,6 +1370,8 @@ namespace ts { case SyntaxKind.RestType: case SyntaxKind.JSDocVariadicType: return emitRestOrJSDocVariadicType(node as RestTypeNode | JSDocVariadicType); + case SyntaxKind.NamedTupleMember: + return emitNamedTupleMember(node as NamedTupleMember); // Binding patterns case SyntaxKind.ObjectBindingPattern: @@ -2099,9 +2101,19 @@ namespace ts { } function emitTupleType(node: TupleTypeNode) { - writePunctuation("["); - emitList(node, node.elementTypes, ListFormat.TupleTypeElements); - writePunctuation("]"); + emitTokenWithComment(SyntaxKind.OpenBracketToken, node.pos, writePunctuation, node); + const flags = getEmitFlags(node) & EmitFlags.SingleLine ? ListFormat.SingleLineTupleTypeElements : ListFormat.MultiLineTupleTypeElements; + emitList(node, node.elements, flags | ListFormat.NoSpaceIfEmpty); + emitTokenWithComment(SyntaxKind.CloseBracketToken, node.elements.end, writePunctuation, node); + } + + function emitNamedTupleMember(node: NamedTupleMember) { + emit(node.dotDotDotToken); + emit(node.name); + emit(node.questionToken); + emitTokenWithComment(SyntaxKind.ColonToken, node.name.end, writePunctuation, node); + writeSpace(); + emit(node.type); } function emitOptionalType(node: OptionalTypeNode) { @@ -4968,7 +4980,7 @@ namespace ts { } function emitLeadingSynthesizedComment(comment: SynthesizedComment) { - if (comment.kind === SyntaxKind.SingleLineCommentTrivia) { + if (comment.hasLeadingNewline || comment.kind === SyntaxKind.SingleLineCommentTrivia) { writer.writeLine(); } writeSynthesizedComment(comment); diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index ed854342245..833da8c8a6a 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -751,7 +751,7 @@ namespace ts { * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. */ export function getExternalModuleOrNamespaceExportName(ns: Identifier | undefined, node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier | PropertyAccessExpression { - if (ns && hasModifier(node, ModifierFlags.Export)) { + if (ns && hasSyntacticModifier(node, ModifierFlags.Export)) { return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps); } return getExportName(node, allowComments, allowSourceMaps); diff --git a/src/compiler/factoryPublic.ts b/src/compiler/factoryPublic.ts index ac1dcbb0435..030b527b30b 100644 --- a/src/compiler/factoryPublic.ts +++ b/src/compiler/factoryPublic.ts @@ -810,15 +810,15 @@ namespace ts { : node; } - export function createTupleTypeNode(elementTypes: readonly TypeNode[]) { + export function createTupleTypeNode(elements: readonly (TypeNode | NamedTupleMember)[]) { const node = createSynthesizedNode(SyntaxKind.TupleType) as TupleTypeNode; - node.elementTypes = createNodeArray(elementTypes); + node.elements = createNodeArray(elements); return node; } - export function updateTupleTypeNode(node: TupleTypeNode, elementTypes: readonly TypeNode[]) { - return node.elementTypes !== elementTypes - ? updateNode(createTupleTypeNode(elementTypes), node) + export function updateTupleTypeNode(node: TupleTypeNode, elements: readonly (TypeNode | NamedTupleMember)[]) { + return node.elements !== elements + ? updateNode(createTupleTypeNode(elements), node) : node; } @@ -934,6 +934,24 @@ namespace ts { : node; } + export function createNamedTupleMember(dotDotDotToken: Token | undefined, name: Identifier, questionToken: Token | undefined, type: TypeNode) { + const node = createSynthesizedNode(SyntaxKind.NamedTupleMember); + node.dotDotDotToken = dotDotDotToken; + node.name = name; + node.questionToken = questionToken; + node.type = type; + return node; + } + + export function updateNamedTupleMember(node: NamedTupleMember, dotDotDotToken: Token | undefined, name: Identifier, questionToken: Token | undefined, type: TypeNode) { + return node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.questionToken !== questionToken + || node.type !== type + ? updateNode(createNamedTupleMember(dotDotDotToken, name, questionToken, type), node) + : node; + } + export function createThisTypeNode() { return createSynthesizedNode(SyntaxKind.ThisType); } @@ -2616,6 +2634,21 @@ namespace ts { return node; } + + /* @internal */ + export function createJSDocVariadicType(type: TypeNode): JSDocVariadicType { + const node = createSynthesizedNode(SyntaxKind.JSDocVariadicType) as JSDocVariadicType; + node.type = type; + return node; + } + + /* @internal */ + export function updateJSDocVariadicType(node: JSDocVariadicType, type: TypeNode): JSDocVariadicType { + return node.type !== type + ? updateNode(createJSDocVariadicType(type), node) + : node; + } + // JSX export function createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ae13b113897..9754cdf64d3 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -179,7 +179,7 @@ namespace ts { case SyntaxKind.ArrayType: return visitNode(cbNode, (node).elementType); case SyntaxKind.TupleType: - return visitNodes(cbNode, cbNodes, (node).elementTypes); + return visitNodes(cbNode, cbNodes, (node).elements); case SyntaxKind.UnionType: case SyntaxKind.IntersectionType: return visitNodes(cbNode, cbNodes, (node).types); @@ -207,6 +207,11 @@ namespace ts { visitNode(cbNode, (node).type); case SyntaxKind.LiteralType: return visitNode(cbNode, (node).literal); + case SyntaxKind.NamedTupleMember: + return visitNode(cbNode, (node).dotDotDotToken) || + visitNode(cbNode, (node).name) || + visitNode(cbNode, (node).questionToken) || + visitNode(cbNode, (node).type); case SyntaxKind.ObjectBindingPattern: case SyntaxKind.ArrayBindingPattern: return visitNodes(cbNode, cbNodes, (node).elements); @@ -3056,9 +3061,33 @@ namespace ts { return type; } + function isNextTokenColonOrQuestionColon() { + return nextToken() === SyntaxKind.ColonToken || (token() === SyntaxKind.QuestionToken && nextToken() === SyntaxKind.ColonToken); + } + + function isTupleElementName() { + if (token() === SyntaxKind.DotDotDotToken) { + return tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon(); + } + return tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon(); + } + + function parseTupleElementNameOrTupleElementType() { + if (lookAhead(isTupleElementName)) { + const node = createNode(SyntaxKind.NamedTupleMember); + node.dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken); + node.name = parseIdentifierName(); + node.questionToken = parseOptionalToken(SyntaxKind.QuestionToken); + parseExpected(SyntaxKind.ColonToken); + node.type = parseTupleElementType(); + return addJSDocComment(finishNode(node)); + } + return parseTupleElementType(); + } + function parseTupleType(): TupleTypeNode { const node = createNode(SyntaxKind.TupleType); - node.elementTypes = parseBracketedList(ParsingContext.TupleElementTypes, parseTupleElementType, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); + node.elements = parseBracketedList(ParsingContext.TupleElementTypes, parseTupleElementNameOrTupleElementType, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); return finishNode(node); } @@ -7483,6 +7512,14 @@ namespace ts { } if (child.kind === SyntaxKind.JSDocTypeTag) { if (childTypeTag) { + parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + const lastError = lastOrUndefined(parseDiagnostics); + if (lastError) { + addRelatedInfo( + lastError, + createDiagnosticForNode(sourceFile, Diagnostics.The_tag_was_first_specified_here) + ); + } break; } else { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 437ec09e8b8..c8847d04358 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2145,7 +2145,7 @@ namespace ts { } } else if (isModuleDeclaration(node)) { - if (isAmbientModule(node) && (inAmbientModule || hasModifier(node, ModifierFlags.Ambient) || file.isDeclarationFile)) { + if (isAmbientModule(node) && (inAmbientModule || hasSyntacticModifier(node, ModifierFlags.Ambient) || file.isDeclarationFile)) { const nameText = getTextOfIdentifierOrLiteral(node.name); // Ambient module declarations can be interpreted as augmentations for some existing external modules. // This will happen in two cases: diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 413ff8f8cd2..00d01ec9508 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -487,7 +487,7 @@ namespace ts { | PropertySignature; function ensureType(node: HasInferredType, type: TypeNode | undefined, ignorePrivate?: boolean): TypeNode | undefined { - if (!ignorePrivate && hasModifier(node, ModifierFlags.Private)) { + if (!ignorePrivate && hasEffectiveModifier(node, ModifierFlags.Private)) { // Private nodes emit no types (except private parameter properties, whose parameter types are actually visible) return; } @@ -571,7 +571,7 @@ namespace ts { } function updateParamsList(node: Node, params: NodeArray, modifierMask?: ModifierFlags) { - if (hasModifier(node, ModifierFlags.Private)) { + if (hasEffectiveModifier(node, ModifierFlags.Private)) { return undefined!; // TODO: GH#18217 } const newParams = map(params, p => ensureParameter(p, modifierMask)); @@ -612,7 +612,7 @@ namespace ts { } function ensureTypeParams(node: Node, params: NodeArray | undefined) { - return hasModifier(node, ModifierFlags.Private) ? undefined : visitNodes(params, visitDeclarationSubtree); + return hasEffectiveModifier(node, ModifierFlags.Private) ? undefined : visitNodes(params, visitDeclarationSubtree); } function isEnclosingDeclaration(node: Node) { @@ -825,7 +825,7 @@ namespace ts { // Emit methods which are private as properties with no type information if (isMethodDeclaration(input) || isMethodSignature(input)) { - if (hasModifier(input, ModifierFlags.Private)) { + if (hasEffectiveModifier(input, ModifierFlags.Private)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) return; // Elide all but the first overload return cleanup(createProperty(/*decorators*/undefined, ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined)); } @@ -901,7 +901,7 @@ namespace ts { /*decorators*/ undefined, ensureModifiers(input), input.name, - updateAccessorParamsList(input, hasModifier(input, ModifierFlags.Private)), + updateAccessorParamsList(input, hasEffectiveModifier(input, ModifierFlags.Private)), ensureType(input, accessorType), /*body*/ undefined)); } @@ -914,7 +914,7 @@ namespace ts { /*decorators*/ undefined, ensureModifiers(input), input.name, - updateAccessorParamsList(input, hasModifier(input, ModifierFlags.Private)), + updateAccessorParamsList(input, hasEffectiveModifier(input, ModifierFlags.Private)), /*body*/ undefined)); } case SyntaxKind.PropertyDeclaration: @@ -1018,6 +1018,10 @@ namespace ts { } } + if (isTupleTypeNode(input) && (getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) { + setEmitFlags(input, EmitFlags.SingleLine); + } + return cleanup(visitEachChild(input, visitDeclarationSubtree, context)); function cleanup(returnValue: T | undefined): T | undefined { @@ -1041,7 +1045,7 @@ namespace ts { } function isPrivateMethodTypeParameter(node: TypeParameterDeclaration) { - return node.parent.kind === SyntaxKind.MethodDeclaration && hasModifier(node.parent, ModifierFlags.Private); + return node.parent.kind === SyntaxKind.MethodDeclaration && hasEffectiveModifier(node.parent, ModifierFlags.Private); } function visitDeclarationStatements(input: Node): VisitResult { @@ -1096,13 +1100,13 @@ namespace ts { } function stripExportModifiers(statement: Statement): Statement { - if (isImportEqualsDeclaration(statement) || hasModifier(statement, ModifierFlags.Default)) { + if (isImportEqualsDeclaration(statement) || hasEffectiveModifier(statement, ModifierFlags.Default)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } const clone = getMutableClone(statement); - const modifiers = createModifiersFromModifierFlags(getModifierFlags(statement) & (ModifierFlags.All ^ ModifierFlags.Export)); + const modifiers = createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (ModifierFlags.All ^ ModifierFlags.Export)); clone.modifiers = modifiers.length ? createNodeArray(modifiers) : undefined; return clone; } @@ -1188,11 +1192,11 @@ namespace ts { }); const namespaceDecl = createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input), input.name!, createModuleBlock(declarations), NodeFlags.Namespace); - if (!hasModifier(clean, ModifierFlags.Default)) { + if (!hasEffectiveModifier(clean, ModifierFlags.Default)) { return [clean, namespaceDecl]; } - const modifiers = createModifiersFromModifierFlags((getModifierFlags(clean) & ~ModifierFlags.ExportDefault) | ModifierFlags.Ambient); + const modifiers = createModifiersFromModifierFlags((getEffectiveModifierFlags(clean) & ~ModifierFlags.ExportDefault) | ModifierFlags.Ambient); const cleanDeclaration = updateFunctionDeclaration( clean, /*decorators*/ undefined, @@ -1295,7 +1299,7 @@ namespace ts { if (ctor) { const oldDiag = getSymbolAccessibilityDiagnostic; parameterProperties = compact(flatMap(ctor.parameters, (param) => { - if (!hasModifier(param, ModifierFlags.ParameterPropertyModifier) || shouldStripInternal(param)) return; + if (!hasSyntacticModifier(param, ModifierFlags.ParameterPropertyModifier) || shouldStripInternal(param)) return; getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(param); if (param.name.kind === SyntaxKind.Identifier) { return preserveJsDoc(createProperty( @@ -1482,7 +1486,7 @@ namespace ts { } function ensureModifiers(node: Node): readonly Modifier[] | undefined { - const currentFlags = getModifierFlags(node); + const currentFlags = getEffectiveModifierFlags(node); const newFlags = ensureModifierFlags(node); if (currentFlags === newFlags) { return node.modifiers; @@ -1536,7 +1540,7 @@ namespace ts { } function maskModifierFlags(node: Node, modifierMask: ModifierFlags = ModifierFlags.All ^ ModifierFlags.Public, modifierAdditions: ModifierFlags = ModifierFlags.None): ModifierFlags { - let flags = (getModifierFlags(node) & modifierMask) | modifierAdditions; + let flags = (getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; if (flags & ModifierFlags.Default && !(flags & ModifierFlags.Export)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid @@ -1563,7 +1567,7 @@ namespace ts { switch (node.kind) { case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: - return !hasModifier(node, ModifierFlags.Private); + return !hasEffectiveModifier(node, ModifierFlags.Private); case SyntaxKind.Parameter: case SyntaxKind.VariableDeclaration: return true; diff --git a/src/compiler/transformers/declarations/diagnostics.ts b/src/compiler/transformers/declarations/diagnostics.ts index ac44f7efd15..1294739ef96 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -71,7 +71,7 @@ namespace ts { } function getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) { - if (hasModifier(node, ModifierFlags.Static)) { + if (hasSyntacticModifier(node, ModifierFlags.Static)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -102,7 +102,7 @@ namespace ts { } function getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) { - if (hasModifier(node, ModifierFlags.Static)) { + if (hasSyntacticModifier(node, ModifierFlags.Static)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -135,7 +135,7 @@ namespace ts { return getReturnTypeVisibilityError; } else if (isParameter(node)) { - if (isParameterPropertyDeclaration(node, node.parent) && hasModifier(node.parent, ModifierFlags.Private)) { + if (isParameterPropertyDeclaration(node, node.parent) && hasSyntacticModifier(node.parent, ModifierFlags.Private)) { return getVariableDeclarationTypeVisibilityError; } return getParameterDeclarationTypeVisibilityError; @@ -167,9 +167,9 @@ namespace ts { // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.PropertySignature || - (node.kind === SyntaxKind.Parameter && hasModifier(node.parent, ModifierFlags.Private))) { + (node.kind === SyntaxKind.Parameter && hasSyntacticModifier(node.parent, ModifierFlags.Private))) { // TODO(jfreeman): Deal with computed properties in error reporting. - if (hasModifier(node, ModifierFlags.Static)) { + if (hasSyntacticModifier(node, ModifierFlags.Static)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -206,7 +206,7 @@ namespace ts { if (node.kind === SyntaxKind.SetAccessor) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. - if (hasModifier(node, ModifierFlags.Static)) { + if (hasSyntacticModifier(node, ModifierFlags.Static)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1; @@ -218,7 +218,7 @@ namespace ts { } } else { - if (hasModifier(node, ModifierFlags.Static)) { + if (hasSyntacticModifier(node, ModifierFlags.Static)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -266,7 +266,7 @@ namespace ts { case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - if (hasModifier(node, ModifierFlags.Static)) { + if (hasSyntacticModifier(node, ModifierFlags.Static)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -345,7 +345,7 @@ namespace ts { case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - if (hasModifier(node.parent, ModifierFlags.Static)) { + if (hasSyntacticModifier(node.parent, ModifierFlags.Static)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -413,7 +413,7 @@ namespace ts { case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - if (hasModifier(node.parent, ModifierFlags.Static)) { + if (hasSyntacticModifier(node.parent, ModifierFlags.Static)) { diagnosticMessage = Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) { diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 3e2e88d15c2..fb545f17d1b 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -681,8 +681,8 @@ namespace ts { statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) - if (hasModifier(node, ModifierFlags.Export)) { - const exportStatement = hasModifier(node, ModifierFlags.Default) + if (hasSyntacticModifier(node, ModifierFlags.Export)) { + const exportStatement = hasSyntacticModifier(node, ModifierFlags.Default) ? createExportDefault(getLocalName(node)) : createExternalModuleExport(getLocalName(node)); @@ -1804,7 +1804,7 @@ namespace ts { function transformFunctionLikeToExpression(node: FunctionLikeDeclaration, location: TextRange | undefined, name: Identifier | undefined, container: Node | undefined): FunctionExpression { const savedConvertedLoopState = convertedLoopState; convertedLoopState = undefined; - const ancestorFacts = container && isClassLike(container) && !hasModifier(node, ModifierFlags.Static) + const ancestorFacts = container && isClassLike(container) && !hasSyntacticModifier(node, ModifierFlags.Static) ? enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes | HierarchyFacts.NonStaticClassElement) : enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes); const parameters = visitParameterList(node.parameters, visitor, context); @@ -2011,7 +2011,7 @@ namespace ts { } function visitVariableStatement(node: VariableStatement): Statement | undefined { - const ancestorFacts = enterSubtree(HierarchyFacts.None, hasModifier(node, ModifierFlags.Export) ? HierarchyFacts.ExportedVariableStatement : HierarchyFacts.None); + const ancestorFacts = enterSubtree(HierarchyFacts.None, hasSyntacticModifier(node, ModifierFlags.Export) ? HierarchyFacts.ExportedVariableStatement : HierarchyFacts.None); let updated: Statement | undefined; if (convertedLoopState && (node.declarationList.flags & NodeFlags.BlockScoped) === 0 && !isVariableStatementOfTypeScriptClassWrapper(node)) { // we are inside a converted loop - hoist variable declarations @@ -2583,7 +2583,7 @@ namespace ts { && i < numInitialPropertiesWithoutYield) { numInitialPropertiesWithoutYield = i; } - if (property.name!.kind === SyntaxKind.ComputedPropertyName) { + if (Debug.checkDefined(property.name).kind === SyntaxKind.ComputedPropertyName) { numInitialProperties = i; break; } @@ -4257,7 +4257,7 @@ namespace ts { } function getClassMemberPrefix(node: ClassExpression | ClassDeclaration, member: ClassElement) { - return hasModifier(member, ModifierFlags.Static) + return hasSyntacticModifier(member, ModifierFlags.Static) ? getInternalName(node) : createPropertyAccess(getInternalName(node), "prototype"); } diff --git a/src/compiler/transformers/es2018.ts b/src/compiler/transformers/es2018.ts index 16d67fcef38..585ec59241e 100644 --- a/src/compiler/transformers/es2018.ts +++ b/src/compiler/transformers/es2018.ts @@ -486,7 +486,7 @@ namespace ts { } function visitVariableStatement(node: VariableStatement): VisitResult { - if (hasModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { const savedExportedVariableStatement = exportedVariableStatement; exportedVariableStatement = true; const visited = visitEachChild(node, visitor, context); diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 2bb81ff255c..5f0381c7fa5 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -895,7 +895,7 @@ namespace ts { let statements: Statement[] | undefined; if (moduleKind !== ModuleKind.AMD) { - if (hasModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { statements = append(statements, setOriginalNode( setTextRange( @@ -934,7 +934,7 @@ namespace ts { } } else { - if (hasModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { statements = append(statements, setOriginalNode( setTextRange( @@ -1095,7 +1095,7 @@ namespace ts { */ function visitFunctionDeclaration(node: FunctionDeclaration): VisitResult { let statements: Statement[] | undefined; - if (hasModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { statements = append(statements, setOriginalNode( setTextRange( @@ -1138,7 +1138,7 @@ namespace ts { */ function visitClassDeclaration(node: ClassDeclaration): VisitResult { let statements: Statement[] | undefined; - if (hasModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { statements = append(statements, setOriginalNode( setTextRange( @@ -1182,7 +1182,7 @@ namespace ts { let variables: VariableDeclaration[] | undefined; let expressions: Expression[] | undefined; - if (hasModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { let modifiers: NodeArray | undefined; // If we're exporting these variables, then these just become assignments to 'exports.x'. @@ -1442,8 +1442,8 @@ namespace ts { return statements; } - if (hasModifier(decl, ModifierFlags.Export)) { - const exportName = hasModifier(decl, ModifierFlags.Default) ? createIdentifier("default") : getDeclarationName(decl); + if (hasSyntacticModifier(decl, ModifierFlags.Export)) { + const exportName = hasSyntacticModifier(decl, ModifierFlags.Default) ? createIdentifier("default") : getDeclarationName(decl); statements = appendExportStatement(statements, exportName, getLocalName(decl), /*location*/ decl); } @@ -1887,7 +1887,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( text: ` var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); - }` + };` }; function createExportStarHelper(context: TransformationContext, module: Expression) { diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index a198164078c..6d0a7ee6b52 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -693,7 +693,7 @@ namespace ts { * @param node The node to visit. */ function visitFunctionDeclaration(node: FunctionDeclaration): VisitResult { - if (hasModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { hoistedStatements = append(hoistedStatements, updateFunctionDeclaration( node, @@ -780,7 +780,7 @@ namespace ts { } let expressions: Expression[] | undefined; - const isExportedDeclaration = hasModifier(node, ModifierFlags.Export); + const isExportedDeclaration = hasSyntacticModifier(node, ModifierFlags.Export); const isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node); for (const variable of node.declarationList.declarations) { if (variable.initializer) { @@ -911,7 +911,7 @@ namespace ts { // statement until we visit this declaration's `EndOfDeclarationMarker`. if (hasAssociatedEndOfDeclarationMarker(node) && node.original!.kind === SyntaxKind.VariableStatement) { const id = getOriginalNodeId(node); - const isExportedDeclaration = hasModifier(node.original!, ModifierFlags.Export); + const isExportedDeclaration = hasSyntacticModifier(node.original!, ModifierFlags.Export); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); } @@ -1087,8 +1087,8 @@ namespace ts { } let excludeName: string | undefined; - if (hasModifier(decl, ModifierFlags.Export)) { - const exportName = hasModifier(decl, ModifierFlags.Default) ? createLiteral("default") : decl.name!; + if (hasSyntacticModifier(decl, ModifierFlags.Export)) { + const exportName = hasSyntacticModifier(decl, ModifierFlags.Default) ? createLiteral("default") : decl.name!; statements = appendExportStatement(statements, exportName, getLocalName(decl)); excludeName = getTextOfIdentifierOrLiteral(exportName); } diff --git a/src/compiler/transformers/taggedTemplate.ts b/src/compiler/transformers/taggedTemplate.ts index ea3e529b752..db2aa0d9df6 100644 --- a/src/compiler/transformers/taggedTemplate.ts +++ b/src/compiler/transformers/taggedTemplate.ts @@ -8,7 +8,7 @@ namespace ts { export function processTaggedTemplateExpression( context: TransformationContext, node: TaggedTemplateExpression, - visitor: ((node: Node) => VisitResult) | undefined, + visitor: Visitor, currentSourceFile: SourceFile, recordTaggedTemplateString: (temp: Identifier) => void, level: ProcessLevel) { @@ -24,7 +24,9 @@ namespace ts { const rawStrings: Expression[] = []; const template = node.template; - if (level === ProcessLevel.LiftRestriction && !hasInvalidEscape(template)) return node; + if (level === ProcessLevel.LiftRestriction && !hasInvalidEscape(template)) { + return visitEachChild(node, visitor, context); + } if (isNoSubstitutionTemplateLiteral(template)) { cookedStrings.push(createTemplateCooked(template)); @@ -63,7 +65,7 @@ namespace ts { } function createTemplateCooked(template: TemplateHead | TemplateMiddle | TemplateTail | NoSubstitutionTemplateLiteral) { - return template.templateFlags ? createIdentifier("undefined") : createLiteral(template.text); + return template.templateFlags ? createVoidZero() : createLiteral(template.text); } /** @@ -71,18 +73,21 @@ namespace ts { * * @param node The ES6 template literal. */ - function getRawLiteral(node: LiteralLikeNode, currentSourceFile: SourceFile) { + function getRawLiteral(node: TemplateLiteralLikeNode, currentSourceFile: SourceFile) { // Find original source text, since we need to emit the raw strings of the tagged template. // The raw strings contain the (escaped) strings of what the user wrote. // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". - let text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + let text = node.rawText; + if (text === undefined) { + text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), - // thus we need to remove those characters. - // First template piece starts with "`", others with "}" - // Last template piece ends with "`", others with "${" - const isLast = node.kind === SyntaxKind.NoSubstitutionTemplateLiteral || node.kind === SyntaxKind.TemplateTail; - text = text.substring(1, text.length - (isLast ? 1 : 2)); + // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), + // thus we need to remove those characters. + // First template piece starts with "`", others with "}" + // Last template piece ends with "`", others with "${" + const isLast = node.kind === SyntaxKind.NoSubstitutionTemplateLiteral || node.kind === SyntaxKind.TemplateTail; + text = text.substring(1, text.length - (isLast ? 1 : 2)); + } // Newline normalization: // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 0ef7db06272..7f848685aec 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -166,7 +166,7 @@ namespace ts { case SyntaxKind.ClassDeclaration: case SyntaxKind.FunctionDeclaration: - if (hasModifier(node, ModifierFlags.Ambient)) { + if (hasSyntacticModifier(node, ModifierFlags.Ambient)) { break; } @@ -178,7 +178,7 @@ namespace ts { // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - Debug.assert(node.kind === SyntaxKind.ClassDeclaration || hasModifier(node, ModifierFlags.Default)); + Debug.assert(node.kind === SyntaxKind.ClassDeclaration || hasSyntacticModifier(node, ModifierFlags.Default)); } if (isClassDeclaration(node)) { // XXX: should probably also cover interfaces and type aliases that can have type variables? @@ -287,7 +287,7 @@ namespace ts { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } - else if (node.transformFlags & TransformFlags.ContainsTypeScript || hasModifier(node, ModifierFlags.Export)) { + else if (node.transformFlags & TransformFlags.ContainsTypeScript || hasSyntacticModifier(node, ModifierFlags.Export)) { return visitTypeScript(node); } @@ -349,7 +349,7 @@ namespace ts { * @param node The node to visit. */ function visitTypeScript(node: Node): VisitResult { - if (isStatement(node) && hasModifier(node, ModifierFlags.Ambient)) { + if (isStatement(node) && hasSyntacticModifier(node, ModifierFlags.Ambient)) { // TypeScript ambient declarations are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return createNotEmittedStatement(node); @@ -610,7 +610,7 @@ namespace ts { } function visitClassDeclaration(node: ClassDeclaration): VisitResult { - if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && !(currentNamespace && hasModifier(node, ModifierFlags.Export))) { + if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && !(currentNamespace && hasSyntacticModifier(node, ModifierFlags.Export))) { return visitEachChild(node, visitor, context); } @@ -966,7 +966,7 @@ namespace ts { */ function isDecoratedClassElement(member: ClassElement, isStatic: boolean, parent: ClassLikeDeclaration) { return nodeOrChildIsDecorated(member, parent) - && isStatic === hasModifier(member, ModifierFlags.Static); + && isStatic === hasSyntacticModifier(member, ModifierFlags.Static); } /** @@ -2045,7 +2045,7 @@ namespace ts { * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node: AccessorDeclaration) { - return !(nodeIsMissing(node.body) && hasModifier(node, ModifierFlags.Abstract)); + return !(nodeIsMissing(node.body) && hasSyntacticModifier(node, ModifierFlags.Abstract)); } function visitGetAccessor(node: GetAccessorDeclaration) { @@ -2352,7 +2352,7 @@ namespace ts { const containerName = getNamespaceContainerName(node); // `exportName` is the expression used within this node's container for any exported references. - const exportName = hasModifier(node, ModifierFlags.Export) + const exportName = hasSyntacticModifier(node, ModifierFlags.Export) ? getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true) : getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); @@ -2653,7 +2653,7 @@ namespace ts { const containerName = getNamespaceContainerName(node); // `exportName` is the expression used within this node's container for any exported references. - const exportName = hasModifier(node, ModifierFlags.Export) + const exportName = hasSyntacticModifier(node, ModifierFlags.Export) ? getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true) : getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); @@ -3039,7 +3039,7 @@ namespace ts { * @param node The node to test. */ function isExportOfNamespace(node: Node) { - return currentNamespace !== undefined && hasModifier(node, ModifierFlags.Export); + return currentNamespace !== undefined && hasSyntacticModifier(node, ModifierFlags.Export); } /** @@ -3048,7 +3048,7 @@ namespace ts { * @param node The node to test. */ function isExternalModuleExport(node: Node) { - return currentNamespace === undefined && hasModifier(node, ModifierFlags.Export); + return currentNamespace === undefined && hasSyntacticModifier(node, ModifierFlags.Export); } /** @@ -3058,7 +3058,7 @@ namespace ts { */ function isNamedExternalModuleExport(node: Node) { return isExternalModuleExport(node) - && !hasModifier(node, ModifierFlags.Default); + && !hasSyntacticModifier(node, ModifierFlags.Default); } /** @@ -3068,7 +3068,7 @@ namespace ts { */ function isDefaultExternalModuleExport(node: Node) { return isExternalModuleExport(node) - && hasModifier(node, ModifierFlags.Default); + && hasSyntacticModifier(node, ModifierFlags.Default); } /** @@ -3147,7 +3147,7 @@ namespace ts { } function getClassMemberPrefix(node: ClassExpression | ClassDeclaration, member: ClassElement) { - return hasModifier(member, ModifierFlags.Static) + return hasSyntacticModifier(member, ModifierFlags.Static) ? getDeclarationName(node) : getClassPrototype(node); } diff --git a/src/compiler/transformers/utilities.ts b/src/compiler/transformers/utilities.ts index a602d6c0486..4a4dc05de76 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -143,7 +143,7 @@ namespace ts { break; case SyntaxKind.VariableStatement: - if (hasModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { for (const decl of (node).declarationList.declarations) { exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames); } @@ -151,8 +151,8 @@ namespace ts { break; case SyntaxKind.FunctionDeclaration: - if (hasModifier(node, ModifierFlags.Export)) { - if (hasModifier(node, ModifierFlags.Default)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Default)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), getDeclarationName(node)); @@ -172,8 +172,8 @@ namespace ts { break; case SyntaxKind.ClassDeclaration: - if (hasModifier(node, ModifierFlags.Export)) { - if (hasModifier(node, ModifierFlags.Default)) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { + if (hasSyntacticModifier(node, ModifierFlags.Default)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), getDeclarationName(node)); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 72c6dcfd79f..0c45dca9529 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -328,6 +328,7 @@ namespace ts { IndexedAccessType, MappedType, LiteralType, + NamedTupleMember, ImportType, // Binding patterns ObjectBindingPattern, @@ -609,6 +610,7 @@ namespace ts { Async = 1 << 8, // Property/Method/Function Default = 1 << 9, // Function/Class (export default declaration) Const = 1 << 11, // Const enum + HasComputedJSDocModifiers = 1 << 12, // Indicates the computed modifier flags include modifiers from JSDoc. HasComputedFlags = 1 << 29, // Modifier flags have been computed AccessibilityModifier = Public | Private | Protected, @@ -699,6 +701,7 @@ namespace ts { | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration + | NamedTupleMember | EndOfFileToken; export type HasType = @@ -1273,7 +1276,15 @@ namespace ts { export interface TupleTypeNode extends TypeNode { kind: SyntaxKind.TupleType; - elementTypes: NodeArray; + elements: NodeArray; + } + + export interface NamedTupleMember extends TypeNode, JSDocContainer, Declaration { + kind: SyntaxKind.NamedTupleMember; + dotDotDotToken?: Token; + name: Identifier; + questionToken?: Token; + type: TypeNode; } export interface OptionalTypeNode extends TypeNode { @@ -1477,6 +1488,7 @@ namespace ts { kind: SyntaxKind.SyntheticExpression; isSpread: boolean; type: Type; + tupleNameSource?: ParameterDeclaration | NamedTupleMember; } // see: https://tc39.github.io/ecma262/#prod-ExponentiationExpression @@ -2589,6 +2601,7 @@ namespace ts { text: string; pos: -1; end: -1; + hasLeadingNewline?: boolean; } // represents a top level: { type } expression in a JSDoc comment. @@ -2790,34 +2803,21 @@ namespace ts { } export type FlowNode = - | AfterFinallyFlow - | PreFinallyFlow | FlowStart | FlowLabel | FlowAssignment | FlowCall | FlowCondition | FlowSwitchClause - | FlowArrayMutation; + | FlowArrayMutation + | FlowCall + | FlowReduceLabel; export interface FlowNodeBase { flags: FlowFlags; id?: number; // Node id used by flow type cache in checker } - export interface FlowLock { - locked?: boolean; - } - - export interface AfterFinallyFlow extends FlowNodeBase, FlowLock { - antecedent: FlowNode; - } - - export interface PreFinallyFlow extends FlowNodeBase { - antecedent: FlowNode; - lock: FlowLock; - } - // FlowStart represents the start of a control flow. For a function expression or arrow // function, the node property references the function (which in turn has a flowNode // property for the containing control flow). @@ -3507,7 +3507,7 @@ namespace ts { */ getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined; /* @internal */ getResolvedSignatureForSignatureHelp(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined; - /* @internal */ getExpandedParameters(sig: Signature): readonly Symbol[]; + /* @internal */ getExpandedParameters(sig: Signature): readonly (readonly Symbol[])[]; /* @internal */ hasEffectiveRestParameter(sig: Signature): boolean; getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined; isImplementationOfOverload(node: SignatureDeclaration): boolean | undefined; @@ -4160,6 +4160,7 @@ namespace ts { cjsExportMerged?: Symbol; // Version of the symbol with all non export= exports merged with the export= target typeOnlyDeclaration?: TypeOnlyCompatibleAliasDeclaration | false; // First resolved alias declaration that makes the symbol only usable in type constructs isConstructorDeclaredProperty?: boolean; // Property declared through 'this.x = ...' assignment in constructor + tupleLabelDeclaration?: NamedTupleMember | ParameterDeclaration; // Declaration associated with the tuple's label } /* @internal */ @@ -4315,8 +4316,6 @@ namespace ts { resolvedJsxElementAttributesType?: Type; // resolved element attributes type of a JSX openinglike element resolvedJsxElementAllAttributesType?: Type; // resolved all element attributes type of a JSX openinglike element resolvedJSDocType?: Type; // Resolved type of a JSDoc type reference - hasSuperCall?: boolean; // recorded result when we try to find super-call. We only try to find one if this flag is undefined, indicating that we haven't made an attempt. - superCall?: SuperCall; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing switchTypes?: Type[]; // Cached array of switch case expression types jsxNamespace?: Symbol | false; // Resolved jsx namespace symbol for this node contextFreeType?: Type; // Cached context-free type used by the first pass of inference; used when a function's return is partially contextually sensitive @@ -4632,7 +4631,7 @@ namespace ts { minLength: number; hasRestElement: boolean; readonly: boolean; - associatedNames?: __String[]; + labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]; } export interface TupleTypeReference extends TypeReference { @@ -6573,7 +6572,8 @@ namespace ts { SingleLineTypeLiteralMembers = SingleLine | SpaceBetweenBraces | SpaceBetweenSiblings, MultiLineTypeLiteralMembers = MultiLine | Indented | OptionalIfEmpty, - TupleTypeElements = CommaDelimited | SpaceBetweenSiblings | SingleLine, + SingleLineTupleTypeElements = CommaDelimited | SpaceBetweenSiblings | SingleLine, + MultiLineTupleTypeElements = CommaDelimited | Indented | SpaceBetweenSiblings | MultiLine, UnionTypeConstituents = BarDelimited | SpaceBetweenSiblings | SingleLine, IntersectionTypeConstituents = AmpersandDelimited | SpaceBetweenSiblings | SingleLine, ObjectBindingPatternElements = SingleLine | AllowTrailingComma | SpaceBetweenBraces | CommaDelimited | SpaceBetweenSiblings | NoSpaceIfEmpty, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 07613e301fa..17ce0562122 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1370,8 +1370,8 @@ namespace ts { export function isValidESSymbolDeclaration(node: Node): node is VariableDeclaration | PropertyDeclaration | SignatureDeclaration { return isVariableDeclaration(node) ? isVarConst(node) && isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) : - isPropertyDeclaration(node) ? hasReadonlyModifier(node) && hasStaticModifier(node) : - isPropertySignature(node) && hasReadonlyModifier(node); + isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) : + isPropertySignature(node) && hasEffectiveReadonlyModifier(node); } export function introducesArgumentsExoticObject(node: Node) { @@ -2471,7 +2471,7 @@ namespace ts { : undefined; } - export function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[] { + export function getJSDocCommentsAndTags(hostNode: Node, noCache?: boolean): readonly (JSDoc | JSDocTag)[] { let result: (JSDoc | JSDocTag)[] | undefined; // Pull parameter comments from declaring function as well if (isVariableLike(hostNode) && hasInitializer(hostNode) && hasJSDocNodes(hostNode.initializer!)) { @@ -2485,11 +2485,11 @@ namespace ts { } if (node.kind === SyntaxKind.Parameter) { - result = addRange(result, getJSDocParameterTags(node as ParameterDeclaration)); + result = addRange(result, (noCache ? getJSDocParameterTagsNoCache : getJSDocParameterTags)(node as ParameterDeclaration)); break; } if (node.kind === SyntaxKind.TypeParameter) { - result = addRange(result, getJSDocTypeParameterTags(node as TypeParameterDeclaration)); + result = addRange(result, (noCache ? getJSDocTypeParameterTagsNoCache : getJSDocTypeParameterTags)(node as TypeParameterDeclaration)); break; } node = getNextJSDocCommentLocation(node); @@ -3007,7 +3007,7 @@ namespace ts { // falls through case SyntaxKind.ArrowFunction: - if (hasModifier(node, ModifierFlags.Async)) { + if (hasSyntacticModifier(node, ModifierFlags.Async)) { flags |= FunctionFlags.Async; } break; @@ -3028,7 +3028,7 @@ namespace ts { case SyntaxKind.MethodDeclaration: return (node).body !== undefined && (node).asteriskToken === undefined - && hasModifier(node, ModifierFlags.Async); + && hasSyntacticModifier(node, ModifierFlags.Async); } return false; } @@ -4017,7 +4017,7 @@ namespace ts { else { forEach(declarations, member => { if (isAccessor(member) - && hasModifier(member, ModifierFlags.Static) === hasModifier(accessor, ModifierFlags.Static)) { + && hasSyntacticModifier(member, ModifierFlags.Static) === hasSyntacticModifier(accessor, ModifierFlags.Static)) { const memberName = getPropertyNameForPropertyNameNode(member.name); const accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -4312,61 +4312,112 @@ namespace ts { return currentLineIndent; } - export function hasModifiers(node: Node) { - return getModifierFlags(node) !== ModifierFlags.None; + export function hasEffectiveModifiers(node: Node) { + return getEffectiveModifierFlags(node) !== ModifierFlags.None; } - export function hasModifier(node: Node, flags: ModifierFlags): boolean { - return !!getSelectedModifierFlags(node, flags); + export function hasSyntacticModifiers(node: Node) { + return getSyntacticModifierFlags(node) !== ModifierFlags.None; + } + + export function hasEffectiveModifier(node: Node, flags: ModifierFlags): boolean { + return !!getSelectedEffectiveModifierFlags(node, flags); + } + + export function hasSyntacticModifier(node: Node, flags: ModifierFlags): boolean { + return !!getSelectedSyntacticModifierFlags(node, flags); } export function hasStaticModifier(node: Node): boolean { - return hasModifier(node, ModifierFlags.Static); + return hasSyntacticModifier(node, ModifierFlags.Static); } - export function hasReadonlyModifier(node: Node): boolean { - return hasModifier(node, ModifierFlags.Readonly); + export function hasEffectiveReadonlyModifier(node: Node): boolean { + return hasEffectiveModifier(node, ModifierFlags.Readonly); } - export function getSelectedModifierFlags(node: Node, flags: ModifierFlags): ModifierFlags { - return getModifierFlags(node) & flags; + export function getSelectedEffectiveModifierFlags(node: Node, flags: ModifierFlags): ModifierFlags { + return getEffectiveModifierFlags(node) & flags; } - export function getModifierFlags(node: Node): ModifierFlags { + export function getSelectedSyntacticModifierFlags(node: Node, flags: ModifierFlags): ModifierFlags { + return getSyntacticModifierFlags(node) & flags; + } + + function getModifierFlagsWorker(node: Node, includeJSDoc: boolean): ModifierFlags { if (node.kind >= SyntaxKind.FirstToken && node.kind <= SyntaxKind.LastToken) { return ModifierFlags.None; } - if (node.modifierFlagsCache & ModifierFlags.HasComputedFlags) { - return node.modifierFlagsCache & ~ModifierFlags.HasComputedFlags; + + if (!(node.modifierFlagsCache & ModifierFlags.HasComputedFlags)) { + node.modifierFlagsCache = getSyntacticModifierFlagsNoCache(node) | ModifierFlags.HasComputedFlags; } - const flags = getModifierFlagsNoCache(node); - node.modifierFlagsCache = flags | ModifierFlags.HasComputedFlags; + if (includeJSDoc && !(node.modifierFlagsCache & ModifierFlags.HasComputedJSDocModifiers) && isInJSFile(node) && node.parent) { + node.modifierFlagsCache |= getJSDocModifierFlagsNoCache(node) | ModifierFlags.HasComputedJSDocModifiers; + } + + return node.modifierFlagsCache & ~(ModifierFlags.HasComputedFlags | ModifierFlags.HasComputedJSDocModifiers); + } + + /** + * Gets the effective ModifierFlags for the provided node, including JSDoc modifiers. The modifiers will be cached on the node to improve performance. + * + * NOTE: This function may use `parent` pointers. + */ + export function getEffectiveModifierFlags(node: Node): ModifierFlags { + return getModifierFlagsWorker(node, /*includeJSDoc*/ true); + } + + /** + * Gets the ModifierFlags for syntactic modifiers on the provided node. The modifiers will be cached on the node to improve performance. + * + * NOTE: This function does not use `parent` pointers and will not include modifiers from JSDoc. + */ + export function getSyntacticModifierFlags(node: Node): ModifierFlags { + return getModifierFlagsWorker(node, /*includeJSDoc*/ false); + } + + function getJSDocModifierFlagsNoCache(node: Node): ModifierFlags { + let flags = ModifierFlags.None; + if (isInJSFile(node) && !!node.parent && !isParameter(node)) { + if (getJSDocPublicTagNoCache(node)) flags |= ModifierFlags.Public; + if (getJSDocPrivateTagNoCache(node)) flags |= ModifierFlags.Private; + if (getJSDocProtectedTagNoCache(node)) flags |= ModifierFlags.Protected; + if (getJSDocReadonlyTagNoCache(node)) flags |= ModifierFlags.Readonly; + } return flags; } - export function getModifierFlagsNoCache(node: Node): ModifierFlags { - let flags = ModifierFlags.None; - if (node.modifiers) { - for (const modifier of node.modifiers) { - flags |= modifierToFlag(modifier.kind); - } - } - - if (isInJSFile(node) && !!node.parent) { - // getModifierFlagsNoCache should only be called when parent pointers are set, - // or when !(node.flags & NodeFlags.Synthesized) && node.kind !== SyntaxKind.SourceFile) - const tags = (getJSDocPublicTag(node) ? ModifierFlags.Public : ModifierFlags.None) - | (getJSDocPrivateTag(node) ? ModifierFlags.Private : ModifierFlags.None) - | (getJSDocProtectedTag(node) ? ModifierFlags.Protected : ModifierFlags.None) - | (getJSDocReadonlyTag(node) ? ModifierFlags.Readonly : ModifierFlags.None); - flags |= tags; - } + /** + * Gets the effective ModifierFlags for the provided node, including JSDoc modifiers. The modifier flags cache on the node is ignored. + * + * NOTE: This function may use `parent` pointers. + */ + export function getEffectiveModifierFlagsNoCache(node: Node): ModifierFlags { + return getSyntacticModifierFlagsNoCache(node) | getJSDocModifierFlagsNoCache(node); + } + /** + * Gets the ModifierFlags for syntactic modifiers on the provided node. The modifier flags cache on the node is ignored. + * + * NOTE: This function does not use `parent` pointers and will not include modifiers from JSDoc. + */ + export function getSyntacticModifierFlagsNoCache(node: Node): ModifierFlags { + let flags = modifiersToFlags(node.modifiers); if (node.flags & NodeFlags.NestedNamespace || (node.kind === SyntaxKind.Identifier && (node).isInJSDocNamespace)) { flags |= ModifierFlags.Export; } + return flags; + } + export function modifiersToFlags(modifiers: NodeArray | undefined) { + let flags = ModifierFlags.None; + if (modifiers) { + for (const modifier of modifiers) { + flags |= modifierToFlag(modifier.kind); + } + } return flags; } @@ -4507,7 +4558,7 @@ namespace ts { } function isExportDefaultSymbol(symbol: Symbol): boolean { - return symbol && length(symbol.declarations) > 0 && hasModifier(symbol.declarations[0], ModifierFlags.Default); + return symbol && length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], ModifierFlags.Default); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ @@ -5055,7 +5106,7 @@ namespace ts { export function isAbstractConstructorSymbol(symbol: Symbol): boolean { if (symbol.flags & SymbolFlags.Class) { const declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasModifier(declaration, ModifierFlags.Abstract); + return !!declaration && hasSyntacticModifier(declaration, ModifierFlags.Abstract); } return false; } @@ -6365,7 +6416,7 @@ namespace ts { if (node.kind !== SyntaxKind.ComputedPropertyName) { return false; } - if (hasModifier(node.parent, ModifierFlags.Abstract)) { + if (hasSyntacticModifier(node.parent, ModifierFlags.Abstract)) { return true; } const containerKind = node.parent.parent.kind; diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index d38187b406a..0da9f34ecec 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -255,7 +255,7 @@ namespace ts { export type ParameterPropertyDeclaration = ParameterDeclaration & { parent: ConstructorDeclaration, name: Identifier }; export function isParameterPropertyDeclaration(node: Node, parent: Node): node is ParameterPropertyDeclaration { - return hasModifier(node, ModifierFlags.ParameterPropertyModifier) && parent.kind === SyntaxKind.Constructor; + return hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier) && parent.kind === SyntaxKind.Constructor; } export function isEmptyBindingPattern(node: BindingName): node is BindingPattern { @@ -299,7 +299,7 @@ namespace ts { } export function getCombinedModifierFlags(node: Declaration): ModifierFlags { - return getCombinedFlags(node, getModifierFlags); + return getCombinedFlags(node, getEffectiveModifierFlags); } // Returns the node flags for this node and all relevant parent nodes. This is done so that @@ -609,6 +609,25 @@ namespace ts { } } + function getJSDocParameterTagsWorker(param: ParameterDeclaration, noCache?: boolean): readonly JSDocParameterTag[] { + if (param.name) { + if (isIdentifier(param.name)) { + const name = param.name.escapedText; + return getJSDocTagsWorker(param.parent, noCache).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name); + } + else { + const i = param.parent.parameters.indexOf(param); + Debug.assert(i > -1, "Parameters should always be in their parents' parameter list"); + const paramTags = getJSDocTagsWorker(param.parent, noCache).filter(isJSDocParameterTag); + if (i < paramTags.length) { + return [paramTags[i]]; + } + } + } + // return empty array for: out-of-order binding patterns and JSDoc function syntax, which has un-named parameters + return emptyArray; + } + /** * Gets the JSDoc parameter tags for the node if present. * @@ -622,22 +641,18 @@ namespace ts { * For binding patterns, parameter tags are matched by position. */ export function getJSDocParameterTags(param: ParameterDeclaration): readonly JSDocParameterTag[] { - if (param.name) { - if (isIdentifier(param.name)) { - const name = param.name.escapedText; - return getJSDocTags(param.parent).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name); - } - else { - const i = param.parent.parameters.indexOf(param); - Debug.assert(i > -1, "Parameters should always be in their parents' parameter list"); - const paramTags = getJSDocTags(param.parent).filter(isJSDocParameterTag); - if (i < paramTags.length) { - return [paramTags[i]]; - } - } - } - // return empty array for: out-of-order binding patterns and JSDoc function syntax, which has un-named parameters - return emptyArray; + return getJSDocParameterTagsWorker(param, /*noCache*/ false); + } + + /* @internal */ + export function getJSDocParameterTagsNoCache(param: ParameterDeclaration): readonly JSDocParameterTag[] { + return getJSDocParameterTagsWorker(param, /*noCache*/ true); + } + + function getJSDocTypeParameterTagsWorker(param: TypeParameterDeclaration, noCache?: boolean): readonly JSDocTemplateTag[] { + const name = param.name.escapedText; + return getJSDocTagsWorker(param.parent, noCache).filter((tag): tag is JSDocTemplateTag => + isJSDocTemplateTag(tag) && tag.typeParameters.some(tp => tp.name.escapedText === name)); } /** @@ -651,9 +666,12 @@ namespace ts { * tag on the containing function expression would be first. */ export function getJSDocTypeParameterTags(param: TypeParameterDeclaration): readonly JSDocTemplateTag[] { - const name = param.name.escapedText; - return getJSDocTags(param.parent).filter((tag): tag is JSDocTemplateTag => - isJSDocTemplateTag(tag) && tag.typeParameters.some(tp => tp.name.escapedText === name)); + return getJSDocTypeParameterTagsWorker(param, /*noCache*/ false); + } + + /* @internal */ + export function getJSDocTypeParameterTagsNoCache(param: TypeParameterDeclaration): readonly JSDocTemplateTag[] { + return getJSDocTypeParameterTagsWorker(param, /*noCache*/ true); } /** @@ -686,21 +704,41 @@ namespace ts { return getFirstJSDocTag(node, isJSDocPublicTag); } + /*@internal*/ + export function getJSDocPublicTagNoCache(node: Node): JSDocPublicTag | undefined { + return getFirstJSDocTag(node, isJSDocPublicTag, /*noCache*/ true); + } + /** Gets the JSDoc private tag for the node if present */ export function getJSDocPrivateTag(node: Node): JSDocPrivateTag | undefined { return getFirstJSDocTag(node, isJSDocPrivateTag); } + /*@internal*/ + export function getJSDocPrivateTagNoCache(node: Node): JSDocPrivateTag | undefined { + return getFirstJSDocTag(node, isJSDocPrivateTag, /*noCache*/ true); + } + /** Gets the JSDoc protected tag for the node if present */ export function getJSDocProtectedTag(node: Node): JSDocProtectedTag | undefined { return getFirstJSDocTag(node, isJSDocProtectedTag); } + /*@internal*/ + export function getJSDocProtectedTagNoCache(node: Node): JSDocProtectedTag | undefined { + return getFirstJSDocTag(node, isJSDocProtectedTag, /*noCache*/ true); + } + /** Gets the JSDoc protected tag for the node if present */ export function getJSDocReadonlyTag(node: Node): JSDocReadonlyTag | undefined { return getFirstJSDocTag(node, isJSDocReadonlyTag); } + /*@internal*/ + export function getJSDocReadonlyTagNoCache(node: Node): JSDocReadonlyTag | undefined { + return getFirstJSDocTag(node, isJSDocReadonlyTag, /*noCache*/ true); + } + /** Gets the JSDoc enum tag for the node if present */ export function getJSDocEnumTag(node: Node): JSDocEnumTag | undefined { return getFirstJSDocTag(node, isJSDocEnumTag); @@ -775,21 +813,33 @@ namespace ts { } } - /** Get all JSDoc tags related to a node, including those on parent nodes. */ - export function getJSDocTags(node: Node): readonly JSDocTag[] { + function getJSDocTagsWorker(node: Node, noCache?: boolean): readonly JSDocTag[] { let tags = (node as JSDocContainer).jsDocCache; // If cache is 'null', that means we did the work of searching for JSDoc tags and came up with nothing. - if (tags === undefined) { - const comments = getJSDocCommentsAndTags(node); + if (tags === undefined || noCache) { + const comments = getJSDocCommentsAndTags(node, noCache); Debug.assert(comments.length < 2 || comments[0] !== comments[1]); - (node as JSDocContainer).jsDocCache = tags = flatMap(comments, j => isJSDoc(j) ? j.tags : j); + tags = flatMap(comments, j => isJSDoc(j) ? j.tags : j); + if (!noCache) { + (node as JSDocContainer).jsDocCache = tags; + } } return tags; } + /** Get all JSDoc tags related to a node, including those on parent nodes. */ + export function getJSDocTags(node: Node): readonly JSDocTag[] { + return getJSDocTagsWorker(node, /*noCache*/ false); + } + + /* @internal */ + export function getJSDocTagsNoCache(node: Node): readonly JSDocTag[] { + return getJSDocTagsWorker(node, /*noCache*/ true); + } + /** Get the first JSDoc tag of a specified kind, or undefined if not present. */ - function getFirstJSDocTag(node: Node, predicate: (tag: JSDocTag) => tag is T): T | undefined { - return find(getJSDocTags(node), predicate); + function getFirstJSDocTag(node: Node, predicate: (tag: JSDocTag) => tag is T, noCache?: boolean): T | undefined { + return find(getJSDocTagsWorker(node, noCache), predicate); } /** Gets all JSDoc tags that match a specified predicate */ @@ -2235,13 +2285,13 @@ namespace ts { /* @internal */ export function needsScopeMarker(result: Statement) { - return !isAnyImportOrReExport(result) && !isExportAssignment(result) && !hasModifier(result, ModifierFlags.Export) && !isAmbientModule(result); + return !isAnyImportOrReExport(result) && !isExportAssignment(result) && !hasSyntacticModifier(result, ModifierFlags.Export) && !isAmbientModule(result); } /* @internal */ export function isExternalModuleIndicator(result: Statement) { // Exported top-level member indicates moduleness - return isAnyImportOrReExport(result) || isExportAssignment(result) || hasModifier(result, ModifierFlags.Export); + return isAnyImportOrReExport(result) || isExportAssignment(result) || hasSyntacticModifier(result, ModifierFlags.Export); } /* @internal */ diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index c119eff97de..f1144b3eb35 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -684,7 +684,7 @@ namespace ts { function aggregateTransformFlagsForSubtree(node: Node): TransformFlags { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (hasModifier(node, ModifierFlags.Ambient) || (isTypeNode(node) && node.kind !== SyntaxKind.ExpressionWithTypeArguments)) { + if (hasSyntacticModifier(node, ModifierFlags.Ambient) || (isTypeNode(node) && node.kind !== SyntaxKind.ExpressionWithTypeArguments)) { return TransformFlags.None; } diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index b21af6186db..544be6d6b4d 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -480,7 +480,7 @@ namespace ts { case SyntaxKind.TupleType: return updateTupleTypeNode((node), - nodesVisitor((node).elementTypes, visitor, isTypeNode)); + nodesVisitor((node).elements, visitor, isTypeNode)); case SyntaxKind.OptionalType: return updateOptionalTypeNode((node), @@ -517,6 +517,14 @@ namespace ts { (node).isTypeOf ); + case SyntaxKind.NamedTupleMember: + return updateNamedTupleMember(node, + visitNode((node).dotDotDotToken, visitor, isToken), + visitNode((node).name, visitor, isIdentifier), + visitNode((node).questionToken, visitor, isToken), + visitNode((node).type, visitor, isTypeNode), + ); + case SyntaxKind.ParenthesizedType: return updateParenthesizedType(node, visitNode((node).type, visitor, isTypeNode)); diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 5436413701d..dd4135ca40c 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -515,6 +515,12 @@ namespace FourSlash { } } + public verifyOrganizeImports(newContent: string) { + const changes = this.languageService.organizeImports({ fileName: this.activeFile.fileName, type: "file" }, this.formatCodeSettings, ts.emptyOptions); + this.applyChanges(changes); + this.verifyFileContent(this.activeFile.fileName, newContent); + } + private raiseError(message: string): never { throw new Error(this.messageAtLastKnownMarker(message)); } diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index ca7ac8f58ff..f4905c00b84 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -560,6 +560,10 @@ namespace FourSlashInterface { public noMoveToNewFile(): void { this.state.noMoveToNewFile(); } + + public organizeImports(newContent: string) { + this.state.verifyOrganizeImports(newContent); + } } export class Edit { diff --git a/src/harness/vfsUtil.ts b/src/harness/vfsUtil.ts index 76475b00360..88fc73ebca9 100644 --- a/src/harness/vfsUtil.ts +++ b/src/harness/vfsUtil.ts @@ -649,14 +649,14 @@ namespace vfs { * * NOTE: do not rename this method as it is intended to align with the same named export of the "fs" module. */ - public readFileSync(path: string, encoding: string): string; + public readFileSync(path: string, encoding: BufferEncoding): string; /** * Read from a file. * * NOTE: do not rename this method as it is intended to align with the same named export of the "fs" module. */ - public readFileSync(path: string, encoding?: string | null): string | Buffer; - public readFileSync(path: string, encoding: string | null = null) { // eslint-disable-line no-null/no-null + public readFileSync(path: string, encoding?: BufferEncoding | null): string | Buffer; + public readFileSync(path: string, encoding: BufferEncoding | null = null) { // eslint-disable-line no-null/no-null const { node } = this._walk(this._resolve(path)); if (!node) throw createIOError("ENOENT"); if (isDirectory(node)) throw createIOError("EISDIR"); diff --git a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl index 94715ed4a6c..1659967c85b 100644 --- a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -48,6 +48,15 @@ + + + + + + + + + @@ -3720,6 +3729,9 @@ + + + @@ -8610,15 +8622,6 @@ - - - - - - - - - @@ -8646,11 +8649,11 @@ - + - + - + @@ -8664,6 +8667,15 @@ + + + + + + + + + @@ -10389,6 +10401,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl index cce62df571c..d7a5d35ce14 100644 --- a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -48,6 +48,15 @@ + + + + + + + + + @@ -3720,6 +3729,9 @@ + + + @@ -7207,7 +7219,7 @@ - + @@ -8610,15 +8622,6 @@ - - - - - - - - - @@ -8646,11 +8649,11 @@ - + - + - + @@ -8664,6 +8667,15 @@ + + + + + + + + + @@ -10389,6 +10401,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl index d7ca345d0e2..c978880ba7a 100644 --- a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -57,6 +57,15 @@ + + + + + + + + + @@ -3726,6 +3735,15 @@ + + + + + + + + + @@ -7210,7 +7228,7 @@ - + @@ -8613,15 +8631,6 @@ - - - - - - - - - @@ -8649,11 +8658,11 @@ - + - + - + @@ -8667,6 +8676,15 @@ + + + + + + + + + @@ -10392,6 +10410,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl index cefbc586cfe..b2b9c285f77 100644 --- a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -48,6 +48,15 @@ + + + + + + + + + @@ -3717,6 +3726,9 @@ + + + @@ -7204,7 +7216,7 @@ - + @@ -8604,15 +8616,6 @@ - - - - - - - - - @@ -8640,11 +8643,11 @@ - + - + - + @@ -8658,6 +8661,15 @@ + + + + + + + + + @@ -10383,6 +10395,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl index c8e1b56f036..7f73f4d483c 100644 --- a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -57,6 +57,15 @@ + + + + + + + + + @@ -3732,6 +3741,9 @@ + + + @@ -7219,7 +7231,7 @@ - + @@ -8622,15 +8634,6 @@ - - - - - - - - - @@ -8658,11 +8661,11 @@ - + - + - + @@ -8676,6 +8679,15 @@ + + + + + + + + + @@ -10401,6 +10413,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl index 92422802668..0659ab6c495 100644 --- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -57,6 +57,15 @@ + + + + + + + + + @@ -3732,6 +3741,9 @@ + + + @@ -8622,15 +8634,6 @@ - - - - - - - - - @@ -8658,11 +8661,11 @@ - + - + - + @@ -8676,6 +8679,15 @@ + + + + + + + + + @@ -10401,6 +10413,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl index d78cb7db9af..371f9209094 100644 --- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -48,6 +48,15 @@ + + + + + + + + + @@ -3720,6 +3729,9 @@ + + + @@ -8610,15 +8622,6 @@ - - - - - - - - - @@ -8646,11 +8649,11 @@ - + - + - + @@ -8664,6 +8667,15 @@ + + + + + + + + + @@ -10389,6 +10401,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 12e2189024d..b40ad8e476a 100644 --- a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -48,6 +48,15 @@ + + + + + + + + + @@ -3720,6 +3729,9 @@ + + + @@ -7207,7 +7219,7 @@ - + @@ -8610,15 +8622,6 @@ - - - - - - - - - @@ -8646,11 +8649,11 @@ - + - + - + @@ -8664,6 +8667,15 @@ + + + + + + + + + @@ -10389,6 +10401,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl index 21232d20adc..c0e83463456 100644 --- a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -48,6 +48,15 @@ + + + + + + + + + @@ -3720,6 +3729,9 @@ + + + @@ -7207,7 +7219,7 @@ - + @@ -8610,15 +8622,6 @@ - - - - - - - - - @@ -8646,11 +8649,11 @@ - + - + - + @@ -8664,6 +8667,15 @@ + + + + + + + + + @@ -10389,6 +10401,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 1965a850988..ee2556975b7 100644 --- a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -41,6 +41,15 @@ + + + + + + + + + @@ -3710,6 +3719,9 @@ + + + @@ -8597,15 +8609,6 @@ - - - - - - - - - @@ -8633,11 +8636,11 @@ - + - + - + @@ -8651,6 +8654,15 @@ + + + + + + + + + @@ -10376,6 +10388,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl index aa1a21e275f..b4be36fdba9 100644 --- a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -41,6 +41,15 @@ + + + + + + + + + @@ -3710,6 +3719,15 @@ + + + + + + + + + @@ -7194,7 +7212,7 @@ - + @@ -8594,15 +8612,6 @@ - - - - - - - - - @@ -8630,11 +8639,11 @@ - + - + - + @@ -8648,6 +8657,15 @@ + + + + + + + + + @@ -10373,6 +10391,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl index e62a54ac190..2103003ab8b 100644 --- a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -47,6 +47,15 @@ + + + + + + + + + @@ -3719,6 +3728,9 @@ + + + @@ -7206,7 +7218,7 @@ - + @@ -8609,15 +8621,6 @@ - - - - - - - - - @@ -8645,11 +8648,11 @@ - + - + - + @@ -8663,6 +8666,15 @@ + + + + + + + + + @@ -10388,6 +10400,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 3a93930be96..f54f92252c4 100644 --- a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -41,6 +41,15 @@ + + + + + + + + + @@ -3713,6 +3722,9 @@ + + + @@ -7200,7 +7212,7 @@ - + @@ -8603,15 +8615,6 @@ - - - - - - - - - @@ -8639,11 +8642,11 @@ - + - + - + @@ -8657,6 +8660,15 @@ + + + + + + + + + @@ -10382,6 +10394,15 @@ + + + + + + + + + diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 47d0dc71f2f..f98f0dce2db 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1743,7 +1743,9 @@ namespace ts.server { return project?.isSolution() ? project.getDefaultChildProjectFromSolution(info) : - project; + project && projectContainsInfoDirectly(project, info) ? + project : + undefined; } /** diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 81e76a939d7..eee180ffe14 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -392,7 +392,7 @@ namespace ts.BreakpointResolver { // Breakpoint is possible in variableDeclaration only if there is initialization // or its declaration from 'for of' if (variableDeclaration.initializer || - hasModifier(variableDeclaration, ModifierFlags.Export) || + hasSyntacticModifier(variableDeclaration, ModifierFlags.Export) || parent.parent.kind === SyntaxKind.ForOfStatement) { return textSpanFromVariableDeclaration(variableDeclaration); } @@ -410,7 +410,7 @@ namespace ts.BreakpointResolver { function canHaveSpanInParameterDeclaration(parameter: ParameterDeclaration): boolean { // Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - hasModifier(parameter, ModifierFlags.Public | ModifierFlags.Private); + hasSyntacticModifier(parameter, ModifierFlags.Public | ModifierFlags.Private); } function spanInParameterDeclaration(parameter: ParameterDeclaration): TextSpan | undefined { @@ -437,7 +437,7 @@ namespace ts.BreakpointResolver { } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration: FunctionLikeDeclaration) { - return hasModifier(functionDeclaration, ModifierFlags.Export) || + return hasSyntacticModifier(functionDeclaration, ModifierFlags.Export) || (functionDeclaration.parent.kind === SyntaxKind.ClassDeclaration && functionDeclaration.kind !== SyntaxKind.Constructor); } diff --git a/src/services/callHierarchy.ts b/src/services/callHierarchy.ts index 3a114af16ef..bbf28ac8f11 100644 --- a/src/services/callHierarchy.ts +++ b/src/services/callHierarchy.ts @@ -410,7 +410,7 @@ namespace ts.CallHierarchy { } function collectCallSitesOfModuleDeclaration(node: ModuleDeclaration, collect: (node: Node | undefined) => void) { - if (!hasModifier(node, ModifierFlags.Ambient) && node.body && isModuleBlock(node.body)) { + if (!hasSyntacticModifier(node, ModifierFlags.Ambient) && node.body && isModuleBlock(node.body)) { forEach(node.body.statements, collect); } } diff --git a/src/services/codefixes/addMissingAsync.ts b/src/services/codefixes/addMissingAsync.ts index 59b0f2f279d..2f2ceba3570 100644 --- a/src/services/codefixes/addMissingAsync.ts +++ b/src/services/codefixes/addMissingAsync.ts @@ -53,7 +53,7 @@ namespace ts.codefix { } fixedDeclarations?.set(getNodeId(insertionSite).toString(), true); const cloneWithModifier = getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true); - cloneWithModifier.modifiers = createNodeArray(createModifiersFromModifierFlags(getModifierFlags(insertionSite) | ModifierFlags.Async)); + cloneWithModifier.modifiers = createNodeArray(createModifiersFromModifierFlags(getSyntacticModifierFlags(insertionSite) | ModifierFlags.Async)); cloneWithModifier.modifierFlagsCache = 0; changeTracker.replaceNode( sourceFile, diff --git a/src/services/codefixes/addMissingAwait.ts b/src/services/codefixes/addMissingAwait.ts index fa562d77e8d..89c6e6d267f 100644 --- a/src/services/codefixes/addMissingAwait.ts +++ b/src/services/codefixes/addMissingAwait.ts @@ -148,7 +148,7 @@ namespace ts.codefix { declaration.type || !declaration.initializer || variableStatement.getSourceFile() !== sourceFile || - hasModifier(variableStatement, ModifierFlags.Export) || + hasSyntacticModifier(variableStatement, ModifierFlags.Export) || !variableName || !isInsideAwaitableBody(declaration.initializer)) { isCompleteFix = false; diff --git a/src/services/codefixes/convertToMappedObjectType.ts b/src/services/codefixes/convertToMappedObjectType.ts index 0d79d6363c0..04de31faabf 100644 --- a/src/services/codefixes/convertToMappedObjectType.ts +++ b/src/services/codefixes/convertToMappedObjectType.ts @@ -42,7 +42,7 @@ namespace ts.codefix { const parameter = first(indexSignature.parameters); const mappedTypeParameter = createTypeParameterDeclaration(cast(parameter.name, isIdentifier), parameter.type); const mappedIntersectionType = createMappedTypeNode( - hasReadonlyModifier(indexSignature) ? createModifier(SyntaxKind.ReadonlyKeyword) : undefined, + hasEffectiveReadonlyModifier(indexSignature) ? createModifier(SyntaxKind.ReadonlyKeyword) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type); diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index a27ded9d403..eac02f0d713 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -49,7 +49,7 @@ namespace ts.codefix { function symbolPointsToNonPrivateAndAbstractMember(symbol: Symbol): boolean { // See `codeFixClassExtendAbstractProtectedProperty.ts` in https://github.com/Microsoft/TypeScript/pull/11547/files // (now named `codeFixClassExtendAbstractPrivateProperty.ts`) - const flags = getModifierFlags(first(symbol.getDeclarations()!)); + const flags = getSyntacticModifierFlags(first(symbol.getDeclarations()!)); return !(flags & ModifierFlags.Private) && !!(flags & ModifierFlags.Abstract); } } diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 4059ee03ca7..954a64ef53d 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -34,7 +34,7 @@ namespace ts.codefix { } function symbolPointsToNonPrivateMember(symbol: Symbol) { - return !symbol.valueDeclaration || !(getModifierFlags(symbol.valueDeclaration) & ModifierFlags.Private); + return !symbol.valueDeclaration || !(getEffectiveModifierFlags(symbol.valueDeclaration) & ModifierFlags.Private); } function addMissingDeclarations( diff --git a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts new file mode 100644 index 00000000000..f1c3d351606 --- /dev/null +++ b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts @@ -0,0 +1,52 @@ +/* @internal */ +namespace ts.codefix { + const fixId = "fixIncorrectNamedTupleSyntax"; + const errorCodes = [ + Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type.code, + Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code + ]; + + registerCodeFix({ + errorCodes, + getCodeActions: context => { + const { sourceFile, span } = context; + const namedTupleMember = getNamedTupleMember(sourceFile, span.start); + const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, namedTupleMember)); + return [createCodeFixAction(fixId, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)]; + }, + fixIds: [fixId] + }); + + function getNamedTupleMember(sourceFile: SourceFile, pos: number) { + const token = getTokenAtPosition(sourceFile, pos); + return findAncestor(token, t => t.kind === SyntaxKind.NamedTupleMember) as NamedTupleMember | undefined; + } + function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, namedTupleMember?: NamedTupleMember) { + if (!namedTupleMember) { + return; + } + let unwrappedType = namedTupleMember.type; + let sawOptional = false; + let sawRest = false; + while (unwrappedType.kind === SyntaxKind.OptionalType || unwrappedType.kind === SyntaxKind.RestType || unwrappedType.kind === SyntaxKind.ParenthesizedType) { + if (unwrappedType.kind === SyntaxKind.OptionalType) { + sawOptional = true; + } + else if (unwrappedType.kind === SyntaxKind.RestType) { + sawRest = true; + } + unwrappedType = (unwrappedType as OptionalTypeNode | RestTypeNode | ParenthesizedTypeNode).type; + } + const updated = updateNamedTupleMember( + namedTupleMember, + namedTupleMember.dotDotDotToken || (sawRest ? createToken(SyntaxKind.DotDotDotToken) : undefined), + namedTupleMember.name, + namedTupleMember.questionToken || (sawOptional ? createToken(SyntaxKind.QuestionToken) : undefined), + unwrappedType + ); + if (updated === namedTupleMember) { + return; + } + changes.replaceNode(sourceFile, namedTupleMember, updated); + } +} diff --git a/src/services/codefixes/fixStrictClassInitialization.ts b/src/services/codefixes/fixStrictClassInitialization.ts index f3286246e16..a4b0134853a 100644 --- a/src/services/codefixes/fixStrictClassInitialization.ts +++ b/src/services/codefixes/fixStrictClassInitialization.ts @@ -120,7 +120,7 @@ namespace ts.codefix { } else if (type.isClass()) { const classDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); - if (!classDeclaration || hasModifier(classDeclaration, ModifierFlags.Abstract)) return undefined; + if (!classDeclaration || hasSyntacticModifier(classDeclaration, ModifierFlags.Abstract)) return undefined; const constructorDeclaration = getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) return undefined; diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 4e9c3a9c5a7..7e879b96ba6 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -40,7 +40,7 @@ namespace ts.codefix { const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions()); const declaration = declarations[0]; const name = getSynthesizedDeepClone(getNameOfDeclaration(declaration), /*includeTrivia*/ false) as PropertyName; - const visibilityModifier = createVisibilityModifier(getModifierFlags(declaration)); + const visibilityModifier = createVisibilityModifier(getEffectiveModifierFlags(declaration)); const modifiers = visibilityModifier ? createNodeArray([visibilityModifier]) : undefined; const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); const optional = !!(symbol.flags & SymbolFlags.Optional); diff --git a/src/services/codefixes/returnValueCorrect.ts b/src/services/codefixes/returnValueCorrect.ts index 947b9933e30..fb80e296a97 100644 --- a/src/services/codefixes/returnValueCorrect.ts +++ b/src/services/codefixes/returnValueCorrect.ts @@ -2,7 +2,7 @@ namespace ts.codefix { const fixId = "returnValueCorrect"; const fixIdAddReturnStatement = "fixAddReturnStatement"; - const fixIdRemoveBlockBodyBrace = "fixRemoveBlockBodyBrace"; + const fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody"; const fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen"; const errorCodes = [ Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code, @@ -35,7 +35,7 @@ namespace ts.codefix { registerCodeFix({ errorCodes, - fixIds: [fixIdAddReturnStatement, fixIdRemoveBlockBodyBrace, fixIdWrapTheBlockWithParen], + fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen], getCodeActions: context => { const { program, sourceFile, span: { start }, errorCode } = context; const info = getInfo(program.getTypeChecker(), sourceFile, start, errorCode); @@ -44,7 +44,7 @@ namespace ts.codefix { if (info.kind === ProblemKind.MissingReturnStatement) { return append( [getActionForfixAddReturnStatement(context, info.expression, info.statement)], - isArrowFunction(info.declaration) ? getActionForfixRemoveBlockBodyBrace(context, info.declaration, info.expression, info.commentSource): undefined); + isArrowFunction(info.declaration) ? getActionForFixRemoveBracesFromArrowFunctionBody(context, info.declaration, info.expression, info.commentSource): undefined); } else { return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)]; @@ -58,7 +58,7 @@ namespace ts.codefix { case fixIdAddReturnStatement: addReturnStatement(changes, diag.file, info.expression, info.statement); break; - case fixIdRemoveBlockBodyBrace: + case fixRemoveBracesFromArrowFunctionBody: if (!isArrowFunction(info.declaration)) return undefined; removeBlockBodyBrace(changes, diag.file, info.declaration, info.expression, info.commentSource, /* withParen */ false); break; @@ -196,9 +196,9 @@ namespace ts.codefix { return createCodeFixAction(fixId, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement); } - function getActionForfixRemoveBlockBodyBrace(context: CodeFixContext, declaration: ArrowFunction, expression: Expression, commentSource: Node) { + function getActionForFixRemoveBracesFromArrowFunctionBody(context: CodeFixContext, declaration: ArrowFunction, expression: Expression, commentSource: Node) { const changes = textChanges.ChangeTracker.with(context, t => removeBlockBodyBrace(t, context.sourceFile, declaration, expression, commentSource, /* withParen */ false)); - return createCodeFixAction(fixId, changes, Diagnostics.Remove_block_body_braces, fixIdRemoveBlockBodyBrace, Diagnostics.Remove_all_incorrect_body_block_braces); + return createCodeFixAction(fixId, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues); } function getActionForfixWrapTheBlockWithParen(context: CodeFixContext, declaration: ArrowFunction, expression: Expression) { diff --git a/src/services/completions.ts b/src/services/completions.ts index a1e98a03d87..8b9228d3441 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -875,7 +875,7 @@ namespace ts.Completions { // * |c| // */ const lineStart = getLineStartPositionForPosition(position, sourceFile); - if (!(sourceFile.text.substring(lineStart, position).match(/[^\*|\s|(/\*\*)]/))) { + if (!/[^\*|\s(/)]/.test(sourceFile.text.substring(lineStart, position))) { return { kind: CompletionDataKind.JsDocTag }; } } @@ -1990,7 +1990,7 @@ namespace ts.Completions { if (!isClassLike(decl)) return GlobalsSearch.Success; const classElement = contextToken.kind === SyntaxKind.SemicolonToken ? contextToken.parent.parent : contextToken.parent; - let classElementModifierFlags = isClassElement(classElement) ? getModifierFlags(classElement) : ModifierFlags.None; + let classElementModifierFlags = isClassElement(classElement) ? getEffectiveModifierFlags(classElement) : ModifierFlags.None; // If this is context token is not something we are editing now, consider if this would lead to be modifier if (contextToken.kind === SyntaxKind.Identifier && !isCurrentlyEditingNode(contextToken)) { switch (contextToken.getText()) { @@ -2409,12 +2409,12 @@ namespace ts.Completions { } // Dont filter member even if the name matches if it is declared private in the list - if (hasModifier(m, ModifierFlags.Private)) { + if (hasEffectiveModifier(m, ModifierFlags.Private)) { continue; } // do not filter it out if the static presence doesnt match - if (hasModifier(m, ModifierFlags.Static) !== !!(currentClassElementModifierFlags & ModifierFlags.Static)) { + if (hasEffectiveModifier(m, ModifierFlags.Static) !== !!(currentClassElementModifierFlags & ModifierFlags.Static)) { continue; } diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index f79abf73437..74dffc3b00b 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -102,7 +102,7 @@ namespace ts.FindAllReferences { ((isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node) || // Is default export - (node.kind === SyntaxKind.DefaultKeyword && hasModifier(node.parent, ModifierFlags.ExportDefault))) { + (node.kind === SyntaxKind.DefaultKeyword && hasSyntacticModifier(node.parent, ModifierFlags.ExportDefault))) { return getContextNode(node.parent); } @@ -1146,7 +1146,7 @@ namespace ts.FindAllReferences { // If this is private property or method, the scope is the containing class if (flags & (SymbolFlags.Property | SymbolFlags.Method)) { - const privateDeclaration = find(declarations, d => hasModifier(d, ModifierFlags.Private) || isPrivateIdentifierPropertyDeclaration(d)); + const privateDeclaration = find(declarations, d => hasEffectiveModifier(d, ModifierFlags.Private) || isPrivateIdentifierPropertyDeclaration(d)); if (privateDeclaration) { return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration); } @@ -1561,7 +1561,7 @@ namespace ts.FindAllReferences { Debug.assert(classLike.name === referenceLocation); const addRef = state.referenceAdder(search.symbol); for (const member of classLike.members) { - if (!(isMethodOrAccessor(member) && hasModifier(member, ModifierFlags.Static))) { + if (!(isMethodOrAccessor(member) && hasSyntacticModifier(member, ModifierFlags.Static))) { continue; } if (member.body) { @@ -1776,7 +1776,7 @@ namespace ts.FindAllReferences { case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: - staticFlag &= getModifierFlags(searchSpaceNode); + staticFlag &= getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; default: @@ -1794,7 +1794,7 @@ namespace ts.FindAllReferences { // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space // and has the same static qualifier as the original 'super's owner. - return container && (ModifierFlags.Static & getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol ? nodeEntry(node) : undefined; + return container && (ModifierFlags.Static & getSyntacticModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol ? nodeEntry(node) : undefined; }); return [{ definition: { type: DefinitionKind.Symbol, symbol: searchSpaceNode.symbol }, references }]; @@ -1822,7 +1822,7 @@ namespace ts.FindAllReferences { case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: - staticFlag &= getModifierFlags(searchSpaceNode); + staticFlag &= getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; case SyntaxKind.SourceFile: @@ -1857,7 +1857,7 @@ namespace ts.FindAllReferences { case SyntaxKind.ClassDeclaration: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. - return container.parent && searchSpaceNode.symbol === container.parent.symbol && (getModifierFlags(container) & ModifierFlags.Static) === staticFlag; + return container.parent && searchSpaceNode.symbol === container.parent.symbol && (getSyntacticModifierFlags(container) & ModifierFlags.Static) === staticFlag; case SyntaxKind.SourceFile: return container.kind === SyntaxKind.SourceFile && !isExternalModule(container) && !isParameterName(node); } diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 31aff6b210a..951ad5e5bba 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -3,6 +3,7 @@ namespace ts.formatting { export interface FormatContext { readonly options: FormatCodeSettings; readonly getRules: RulesMap; + readonly host: FormattingHost; } export interface TextRangeWithKind extends TextRange { @@ -394,7 +395,7 @@ namespace ts.formatting { initialIndentation: number, delta: number, formattingScanner: FormattingScanner, - { options, getRules }: FormatContext, + { options, getRules, host }: FormatContext, requestKind: FormattingRequestKind, rangeContainsError: (r: TextRange) => boolean, sourceFile: SourceFileLike): TextChange[] { @@ -1193,7 +1194,7 @@ namespace ts.formatting { previousRange: TextRangeWithKind, previousStartLine: number, currentRange: TextRangeWithKind, - currentStartLine: number, + currentStartLine: number ): LineAction { const onLaterLine = currentStartLine !== previousStartLine; switch (rule.action) { @@ -1221,7 +1222,7 @@ namespace ts.formatting { // edit should not be applied if we have one line feed between elements const lineDelta = currentStartLine - previousStartLine; if (lineDelta !== 1) { - recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter!); + recordReplace(previousRange.end, currentRange.pos - previousRange.end, getNewLineOrDefaultFromHost(host, options)); return onLaterLine ? LineAction.None : LineAction.LineAdded; } break; diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts index f466b397d20..ccee491040f 100644 --- a/src/services/formatting/rulesMap.ts +++ b/src/services/formatting/rulesMap.ts @@ -1,7 +1,7 @@ /* @internal */ namespace ts.formatting { - export function getFormatContext(options: FormatCodeSettings): FormatContext { - return { options, getRules: getRulesMap() }; + export function getFormatContext(options: FormatCodeSettings, host: FormattingHost): FormatContext { + return { options, getRules: getRulesMap(), host }; } let rulesMapCache: RulesMap | undefined; diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 5539a8e30cb..23011643811 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -574,7 +574,7 @@ namespace ts.formatting { return childKind !== SyntaxKind.JsxClosingFragment; case SyntaxKind.IntersectionType: case SyntaxKind.UnionType: - if (childKind === SyntaxKind.TypeLiteral) { + if (childKind === SyntaxKind.TypeLiteral || childKind === SyntaxKind.TupleType) { return false; } // falls through diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index daafc490573..4b39a90c880 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -100,10 +100,13 @@ namespace ts.GoToDefinition { /** * True if we should not add definitions for both the signature symbol and the definition symbol. * True for `const |f = |() => 0`, false for `function |f() {} const |g = f;`. + * Also true for any assignment RHS. */ function symbolMatchesSignature(s: Symbol, calledDeclaration: SignatureDeclaration) { - return s === calledDeclaration.symbol || s === calledDeclaration.symbol.parent || - !isCallLikeExpression(calledDeclaration.parent) && s === calledDeclaration.parent.symbol; + return s === calledDeclaration.symbol + || s === calledDeclaration.symbol.parent + || isAssignmentExpression(calledDeclaration.parent) + || (!isCallLikeExpression(calledDeclaration.parent) && s === calledDeclaration.parent.symbol); } export function getReferenceAtPosition(sourceFile: SourceFile, position: number, program: Program): { fileName: string, file: SourceFile } | undefined { @@ -246,7 +249,9 @@ namespace ts.GoToDefinition { // There are cases when you extend a function by adding properties to it afterwards, // we want to strip those extra properties. // For deduping purposes, we also want to exclude any declarationNodes if provided. - const filteredDeclarations = filter(symbol.declarations, d => d !== declarationNode && (!isAssignmentDeclaration(d) || d === symbol.valueDeclaration)) || undefined; + const filteredDeclarations = + filter(symbol.declarations, d => d !== declarationNode && (!isAssignmentDeclaration(d) || d === symbol.valueDeclaration)) + || undefined; return getConstructSignatureDefinition() || getCallSignatureDefinition() || map(filteredDeclarations, declaration => createDefinitionInfo(declaration, typeChecker, symbol, node)); function getConstructSignatureDefinition(): DefinitionInfo[] | undefined { @@ -330,15 +335,11 @@ namespace ts.GoToDefinition { /** Returns a CallLikeExpression where `node` is the target being invoked. */ function getAncestorCallLikeExpression(node: Node): CallLikeExpression | undefined { - const target = climbPastManyPropertyAccesses(node); - const callLike = target.parent; + const target = findAncestor(node, n => !isRightSideOfPropertyAccess(n)); + const callLike = target?.parent; return callLike && isCallLikeExpression(callLike) && getInvokedExpression(callLike) === target ? callLike : undefined; } - function climbPastManyPropertyAccesses(node: Node): Node { - return isRightSideOfPropertyAccess(node) ? climbPastManyPropertyAccesses(node.parent) : node; - } - function tryGetSignatureDeclaration(typeChecker: TypeChecker, node: Node): SignatureDeclaration | undefined { const callLike = getAncestorCallLikeExpression(node); const signature = callLike && typeChecker.getResolvedSignature(callLike); diff --git a/src/services/importTracker.ts b/src/services/importTracker.ts index 91b53ea418a..6b3da6edc89 100644 --- a/src/services/importTracker.ts +++ b/src/services/importTracker.ts @@ -103,7 +103,7 @@ namespace ts.FindAllReferences { break; // TODO: GH#23879 case SyntaxKind.ImportEqualsDeclaration: - handleNamespaceImport(direct, direct.name, hasModifier(direct, ModifierFlags.Export), /*alreadyAddedDirect*/ false); + handleNamespaceImport(direct, direct.name, hasSyntacticModifier(direct, ModifierFlags.Export), /*alreadyAddedDirect*/ false); break; case SyntaxKind.ImportDeclaration: @@ -463,7 +463,7 @@ namespace ts.FindAllReferences { } else { const exportNode = getExportNode(parent, node); - if (exportNode && hasModifier(exportNode, ModifierFlags.Export)) { + if (exportNode && hasSyntacticModifier(exportNode, ModifierFlags.Export)) { if (isImportEqualsDeclaration(exportNode) && exportNode.moduleReference === node) { // We're at `Y` in `export import X = Y`. This is not the exported symbol, the left-hand-side is. So treat this as an import statement. if (comingFromExport) { @@ -553,7 +553,7 @@ namespace ts.FindAllReferences { // Not meant for use with export specifiers or export assignment. function getExportKindForDeclaration(node: Node): ExportKind { - return hasModifier(node, ModifierFlags.Default) ? ExportKind.Default : ExportKind.Named; + return hasSyntacticModifier(node, ModifierFlags.Default) ? ExportKind.Default : ExportKind.Named; } } diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 63297c7868d..3115109572a 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -89,17 +89,14 @@ namespace ts.JsDoc { // Eg. const a: Array | Array; a.length // The property length will have two declarations of property length coming // from Array - Array and Array - const documentationComment: SymbolDisplayPart[] = []; + const documentationComment: string[] = []; forEachUnique(declarations, declaration => { for (const { comment } of getCommentHavingNodes(declaration)) { if (comment === undefined) continue; - if (documentationComment.length) { - documentationComment.push(lineBreakPart()); - } - documentationComment.push(textPart(comment)); + pushIfUnique(documentationComment, comment); } }); - return documentationComment; + return intersperse(map(documentationComment, textPart), lineBreakPart()); } function getCommentHavingNodes(declaration: Declaration): readonly (JSDoc | JSDocTag)[] { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 38faf25da7f..91bf61270de 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -307,7 +307,18 @@ namespace ts.NavigationBar { addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case SyntaxKind.ExportAssignment: + case SyntaxKind.ExportAssignment: { + const expression = (node).expression; + if (isObjectLiteralExpression(expression)) { + startNode(node); + addChildrenRecursively(expression); + endNode(); + } + else { + addLeafNode(node); + } + break; + } case SyntaxKind.ExportSpecifier: case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.IndexSignature: @@ -590,7 +601,7 @@ namespace ts.NavigationBar { case SyntaxKind.MethodDeclaration: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: - return hasModifier(a, ModifierFlags.Static) === hasModifier(b, ModifierFlags.Static); + return hasSyntacticModifier(a, ModifierFlags.Static) === hasSyntacticModifier(b, ModifierFlags.Static); case SyntaxKind.ModuleDeclaration: return areSameModule(a, b); default: @@ -690,7 +701,7 @@ namespace ts.NavigationBar { case SyntaxKind.FunctionExpression: case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: - if (getModifierFlags(node) & ModifierFlags.Default) { + if (getSyntacticModifierFlags(node) & ModifierFlags.Default) { return "default"; } // We may get a string with newlines or other whitespace in the case of an object dereference @@ -883,7 +894,7 @@ namespace ts.NavigationBar { return nodeText(parent.name); } // Default exports are named "default" - else if (getModifierFlags(node) & ModifierFlags.Default) { + else if (getSyntacticModifierFlags(node) & ModifierFlags.Default) { return "default"; } else if (isClassLike(node)) { diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 142bdbe8791..1a394bc349b 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -76,7 +76,7 @@ namespace ts.OrganizeImports { // Delete any subsequent imports. for (let i = 1; i < oldImportDecls.length; i++) { - changeTracker.delete(sourceFile, oldImportDecls[i]); + changeTracker.deleteNode(sourceFile, oldImportDecls[i]); } } } diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 568d75e542d..f818123abdc 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -42,6 +42,10 @@ namespace ts.OutliningElementsCollector { addOutliningForLeadingCommentsForNode(n.parent.parent.parent, sourceFile, cancellationToken, out); } + if (isFunctionLike(n) && isBinaryExpression(n.parent) && isPropertyAccessExpression(n.parent.left)) { + addOutliningForLeadingCommentsForNode(n.parent.left, sourceFile, cancellationToken, out); + } + const span = getOutliningSpanForNode(n, sourceFile); if (span) out.push(span); @@ -200,6 +204,7 @@ namespace ts.OutliningElementsCollector { case SyntaxKind.EnumDeclaration: case SyntaxKind.CaseBlock: case SyntaxKind.TypeLiteral: + case SyntaxKind.ObjectBindingPattern: return spanForNode(n); case SyntaxKind.TupleType: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !isTupleTypeNode(n.parent), SyntaxKind.OpenBracketToken); diff --git a/src/services/refactors/convertExport.ts b/src/services/refactors/convertExport.ts index c08ae05bce8..18de048ac6c 100644 --- a/src/services/refactors/convertExport.ts +++ b/src/services/refactors/convertExport.ts @@ -38,7 +38,7 @@ namespace ts.refactor { const exportingModuleSymbol = isSourceFile(exportNode.parent) ? exportNode.parent.symbol : exportNode.parent.parent.symbol; - const flags = getModifierFlags(exportNode); + const flags = getSyntacticModifierFlags(exportNode); const wasDefault = !!(flags & ModifierFlags.Default); // If source file already has a default export, don't offer refactor. if (!(flags & ModifierFlags.Export) || !wasDefault && exportingModuleSymbol.exports!.has(InternalSymbolName.Default)) { diff --git a/src/services/refactors/convertOverloadListToSingleSignature.ts b/src/services/refactors/convertOverloadListToSingleSignature.ts new file mode 100644 index 00000000000..3c747fb3736 --- /dev/null +++ b/src/services/refactors/convertOverloadListToSingleSignature.ts @@ -0,0 +1,219 @@ +/* @internal */ +namespace ts.refactor.addOrRemoveBracesToArrowFunction { + const refactorName = "Convert overload list to single signature"; + const refactorDescription = Diagnostics.Convert_overload_list_to_single_signature.message; + registerRefactor(refactorName, { getEditsForAction, getAvailableActions }); + + + function getAvailableActions(context: RefactorContext): readonly ApplicableRefactorInfo[] { + const { file, startPosition, program } = context; + const info = getConvertableOverloadListAtPosition(file, startPosition, program); + if (!info) return emptyArray; + + return [{ + name: refactorName, + description: refactorDescription, + actions: [{ + name: refactorName, + description: refactorDescription + }] + }]; + } + + function getEditsForAction(context: RefactorContext): RefactorEditInfo | undefined { + const { file, startPosition, program } = context; + const signatureDecls = getConvertableOverloadListAtPosition(file, startPosition, program); + if (!signatureDecls) return undefined; + + const checker = program.getTypeChecker(); + + const lastDeclaration = signatureDecls[signatureDecls.length - 1]; + let updated = lastDeclaration; + switch (lastDeclaration.kind) { + case SyntaxKind.MethodSignature: { + updated = updateMethodSignature( + lastDeclaration, + lastDeclaration.typeParameters, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.type, + lastDeclaration.name, + lastDeclaration.questionToken + ); + break; + } + case SyntaxKind.MethodDeclaration: { + updated = updateMethod( + lastDeclaration, + lastDeclaration.decorators, + lastDeclaration.modifiers, + lastDeclaration.asteriskToken, + lastDeclaration.name, + lastDeclaration.questionToken, + lastDeclaration.typeParameters, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.type, + lastDeclaration.body + ); + break; + } + case SyntaxKind.CallSignature: { + updated = updateCallSignature( + lastDeclaration, + lastDeclaration.typeParameters, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.type, + ); + break; + } + case SyntaxKind.Constructor: { + updated = updateConstructor( + lastDeclaration, + lastDeclaration.decorators, + lastDeclaration.modifiers, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.body + ); + break; + } + case SyntaxKind.ConstructSignature: { + updated = updateConstructSignature( + lastDeclaration, + lastDeclaration.typeParameters, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.type, + ); + break; + } + case SyntaxKind.FunctionDeclaration: { + updated = updateFunctionDeclaration( + lastDeclaration, + lastDeclaration.decorators, + lastDeclaration.modifiers, + lastDeclaration.asteriskToken, + lastDeclaration.name, + lastDeclaration.typeParameters, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.type, + lastDeclaration.body + ); + break; + } + default: return Debug.failBadSyntaxKind(lastDeclaration, "Unhandled signature kind in overload list conversion refactoring"); + } + + if (updated === lastDeclaration) { + return; // No edits to apply, do nothing + } + + const edits = textChanges.ChangeTracker.with(context, t => { + t.replaceNodeRange(file, signatureDecls[0], signatureDecls[signatureDecls.length - 1], updated); + }); + + return { renameFilename: undefined, renameLocation: undefined, edits }; + + function getNewParametersForCombinedSignature(signatureDeclarations: (MethodSignature | MethodDeclaration | CallSignatureDeclaration | ConstructorDeclaration | ConstructSignatureDeclaration | FunctionDeclaration)[]): NodeArray { + const lastSig = signatureDeclarations[signatureDeclarations.length - 1]; + if (isFunctionLikeDeclaration(lastSig) && lastSig.body) { + // Trim away implementation signature arguments (they should already be compatible with overloads, but are likely less precise to guarantee compatability with the overloads) + signatureDeclarations = signatureDeclarations.slice(0, signatureDeclarations.length - 1); + } + return createNodeArray([ + createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, + createToken(SyntaxKind.DotDotDotToken), + "args", + /*questionToken*/ undefined, + createUnionTypeNode(map(signatureDeclarations, convertSignatureParametersToTuple)) + ) + ]); + } + + function convertSignatureParametersToTuple(decl: MethodSignature | MethodDeclaration | CallSignatureDeclaration | ConstructorDeclaration | ConstructSignatureDeclaration | FunctionDeclaration): TupleTypeNode { + const members = map(decl.parameters, convertParameterToNamedTupleMember); + return setEmitFlags(createTupleTypeNode(members), some(members, m => !!length(getSyntheticLeadingComments(m))) ? EmitFlags.None : EmitFlags.SingleLine); + } + + function convertParameterToNamedTupleMember(p: ParameterDeclaration): NamedTupleMember { + Debug.assert(isIdentifier(p.name)); // This is checked during refactoring applicability checking + const result = setTextRange(createNamedTupleMember( + p.dotDotDotToken, + p.name, + p.questionToken, + p.type || createKeywordTypeNode(SyntaxKind.AnyKeyword) + ), p); + const parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); + if (parameterDocComment) { + const newComment = displayPartsToString(parameterDocComment); + if (newComment.length) { + setSyntheticLeadingComments(result, [{ + text: `* +${newComment.split("\n").map(c => ` * ${c}`).join("\n")} + `, + kind: SyntaxKind.MultiLineCommentTrivia, + pos: -1, + end: -1, + hasTrailingNewLine: true, + hasLeadingNewline: true, + }]); + } + } + return result; + } + + } + + function isConvertableSignatureDeclaration(d: Node): d is MethodSignature | MethodDeclaration | CallSignatureDeclaration | ConstructorDeclaration | ConstructSignatureDeclaration | FunctionDeclaration { + switch (d.kind) { + case SyntaxKind.MethodSignature: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.CallSignature: + case SyntaxKind.Constructor: + case SyntaxKind.ConstructSignature: + case SyntaxKind.FunctionDeclaration: + return true; + } + return false; + } + + function getConvertableOverloadListAtPosition(file: SourceFile, startPosition: number, program: Program) { + const node = getTokenAtPosition(file, startPosition); + const containingDecl = findAncestor(node, isConvertableSignatureDeclaration); + if (!containingDecl) { + return; + } + const checker = program.getTypeChecker(); + const signatureSymbol = containingDecl.symbol; + if (!signatureSymbol) { + return; + } + const decls = signatureSymbol.declarations; + if (length(decls) <= 1) { + return; + } + if (!every(decls, d => getSourceFileOfNode(d) === file)) { + return; + } + if (!isConvertableSignatureDeclaration(decls[0])) { + return; + } + const kindOne = decls[0].kind; + if (!every(decls, d => d.kind === kindOne)) { + return; + } + const signatureDecls = decls as (MethodSignature | MethodDeclaration | CallSignatureDeclaration | ConstructorDeclaration | ConstructSignatureDeclaration | FunctionDeclaration)[]; + if (some(signatureDecls, d => !!d.typeParameters || some(d.parameters, p => !!p.decorators || !!p.modifiers || !isIdentifier(p.name)))) { + return; + } + const signatures = mapDefined(signatureDecls, d => checker.getSignatureFromDeclaration(d)); + if (length(signatures) !== length(decls)) { + return; + } + const returnOne = checker.getReturnTypeOfSignature(signatures[0]); + if (!every(signatures, s => checker.getReturnTypeOfSignature(s) === returnOne)) { + return; + } + + return signatureDecls; + } +} diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 64e9bb6f3a2..8c6c8f6fc69 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -28,7 +28,7 @@ namespace ts.refactor.extractSymbol { const usedConstantNames: Map = createMap(); let i = 0; - for (const {functionExtraction, constantExtraction} of extractions) { + for (const { functionExtraction, constantExtraction } of extractions) { // Skip these since we don't have a way to report errors yet if (functionExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. @@ -309,7 +309,7 @@ namespace ts.refactor.extractSymbol { let current: Node = nodeToCheck; while (current !== containingClass) { if (current.kind === SyntaxKind.PropertyDeclaration) { - if (hasModifier(current, ModifierFlags.Static)) { + if (hasSyntacticModifier(current, ModifierFlags.Static)) { rangeFacts |= RangeFacts.InStaticRegion; } break; @@ -322,7 +322,7 @@ namespace ts.refactor.extractSymbol { break; } else if (current.kind === SyntaxKind.MethodDeclaration) { - if (hasModifier(current, ModifierFlags.Static)) { + if (hasSyntacticModifier(current, ModifierFlags.Static)) { rangeFacts |= RangeFacts.InStaticRegion; } } @@ -375,7 +375,7 @@ namespace ts.refactor.extractSymbol { if (isDeclaration(node)) { const declaringNode = (node.kind === SyntaxKind.VariableDeclaration) ? node.parent.parent : node; - if (hasModifier(declaringNode, ModifierFlags.Export)) { + if (hasSyntacticModifier(declaringNode, ModifierFlags.Export)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! // Also TODO: GH#19956 @@ -405,24 +405,24 @@ namespace ts.refactor.extractSymbol { rangeFacts |= RangeFacts.UsesThis; } break; + case SyntaxKind.ClassDeclaration: + case SyntaxKind.FunctionDeclaration: + if (isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { + // You cannot extract global declarations + (errors || (errors = [] as Diagnostic[])).push(createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); + } + // falls through + case SyntaxKind.ClassExpression: + case SyntaxKind.FunctionExpression: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.Constructor: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + // do not dive into functions (except arrow functions) or classes + return false; } - if (isFunctionLikeDeclaration(node) || isClassLike(node)) { - switch (node.kind) { - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.ClassDeclaration: - if (isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { - // You cannot extract global declarations - (errors || (errors = [] as Diagnostic[])).push(createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); - } - break; - } - - // do not dive into functions or classes - return false; - } const savedPermittedJumps = permittedJumps; - switch (node.kind) { case SyntaxKind.IfStatement: permittedJumps = PermittedJumps.None; @@ -1103,7 +1103,12 @@ namespace ts.refactor.extractSymbol { changeTracker.delete(context.file, node.parent); } else { - const localReference = createIdentifier(localNameText); + let localReference: Expression = createIdentifier(localNameText); + // When extract to a new variable in JSX content, need to wrap a {} out of the new variable + // or it will become a plain text + if (isInJSXContent(node)) { + localReference = createJsxExpression(/*dotDotDotToken*/ undefined, localReference); + } changeTracker.replaceNode(context.file, node, localReference); } } @@ -1115,6 +1120,12 @@ namespace ts.refactor.extractSymbol { const renameLocation = getRenameLocation(edits, renameFilename, localNameText, /*isDeclaredBeforeUse*/ true); return { renameFilename, renameLocation, edits }; + function isInJSXContent(node: Node) { + if (!isJsxElement(node)) return false; + if (isJsxElement(node.parent)) return true; + return false; + } + function transformFunctionInitializerAndType(variableType: TypeNode | undefined, initializer: Expression): { variableType: TypeNode | undefined, initializer: Expression } { // If no contextual type exists there is nothing to transfer to the function signature if (variableType === undefined) return { variableType, initializer }; @@ -1215,8 +1226,8 @@ namespace ts.refactor.extractSymbol { } function compareTypesByDeclarationOrder( - {type: type1, declaration: declaration1}: {type: Type, declaration?: Declaration}, - {type: type2, declaration: declaration2}: {type: Type, declaration?: Declaration}) { + { type: type1, declaration: declaration1 }: { type: Type, declaration?: Declaration }, + { type: type2, declaration: declaration2 }: { type: Type, declaration?: Declaration }) { return compareProperties(declaration1, declaration2, "pos", compareValues) || compareStringsCaseSensitive( @@ -1584,7 +1595,7 @@ namespace ts.refactor.extractSymbol { hasWrite = true; if (value.symbol.flags & SymbolFlags.ClassMember && value.symbol.valueDeclaration && - hasModifier(value.symbol.valueDeclaration, ModifierFlags.Readonly)) { + hasEffectiveModifier(value.symbol.valueDeclaration, ModifierFlags.Readonly)) { readonlyClassPropertyWrite = value.symbol.valueDeclaration; } } @@ -1621,7 +1632,7 @@ namespace ts.refactor.extractSymbol { // a lot of properties, each of which the walker will visit. Unfortunately, the // solution isn't as trivial as filtering to user types because of (e.g.) Array. const symbolWalker = checker.getSymbolWalker(() => (cancellationToken.throwIfCancellationRequested(), true)); - const {visitedTypes} = symbolWalker.walkType(type); + const { visitedTypes } = symbolWalker.walkType(type); for (const visitedType of visitedTypes) { if (visitedType.isTypeParameter()) { diff --git a/src/services/refactors/extractType.ts b/src/services/refactors/extractType.ts index 813ee186f0f..560fc5deb68 100644 --- a/src/services/refactors/extractType.ts +++ b/src/services/refactors/extractType.ts @@ -145,6 +145,11 @@ namespace ts.refactor { } } } + + if (file && isTupleTypeNode(node) && (getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line)) { + setEmitFlags(node, EmitFlags.SingleLine); + } + return forEachChild(node, visitor); } } diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index 038cd04cdeb..024a27f5a92 100644 --- a/src/services/refactors/generateGetAccessorAndSetAccessor.ts +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -41,7 +41,6 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { const fieldInfo = getConvertibleFieldAtPosition(context); if (!fieldInfo) return undefined; - const isJS = isSourceFileJS(file); const changeTracker = textChanges.ChangeTracker.fromContext(context); const { isStatic, isReadonly, fieldName, accessorName, originalName, type, container, declaration, renameAccessor } = fieldInfo; @@ -50,15 +49,20 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { suppressLeadingAndTrailingTrivia(declaration); suppressLeadingAndTrailingTrivia(container); - const isInClassLike = isClassLike(container); - // avoid Readonly modifier because it will convert to get accessor - const modifierFlags = getModifierFlags(declaration) & ~ModifierFlags.Readonly; - const accessorModifiers = isInClassLike - ? !modifierFlags || modifierFlags & ModifierFlags.Private - ? getModifiers(isJS, isStatic, SyntaxKind.PublicKeyword) - : createNodeArray(createModifiersFromModifierFlags(modifierFlags)) - : undefined; - const fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, SyntaxKind.PrivateKeyword) : undefined; + let accessorModifiers: ModifiersArray | undefined; + let fieldModifiers: ModifiersArray | undefined; + if (isClassLike(container)) { + const modifierFlags = getEffectiveModifierFlags(declaration); + if (isSourceFileJS(file)) { + const modifiers = createModifiers(modifierFlags); + accessorModifiers = modifiers; + fieldModifiers = modifiers; + } + else { + accessorModifiers = createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = createModifiers(prepareModifierFlagsForField(modifierFlags)); + } + } updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers); @@ -105,12 +109,26 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { return isIdentifier(fieldName) ? createPropertyAccess(leftHead, fieldName) : createElementAccess(leftHead, createLiteral(fieldName)); } - function getModifiers(isJS: boolean, isStatic: boolean, accessModifier: SyntaxKind.PublicKeyword | SyntaxKind.PrivateKeyword): NodeArray | undefined { - const modifiers = append( - !isJS ? [createToken(accessModifier) as Token | Token] : undefined, - isStatic ? createToken(SyntaxKind.StaticKeyword) : undefined - ); - return modifiers && createNodeArray(modifiers); + function createModifiers(modifierFlags: ModifierFlags): ModifiersArray | undefined { + return modifierFlags ? createNodeArray(createModifiersFromModifierFlags(modifierFlags)) : undefined; + } + + function prepareModifierFlagsForAccessor(modifierFlags: ModifierFlags): ModifierFlags { + modifierFlags &= ~ModifierFlags.Readonly; // avoid Readonly modifier because it will convert to get accessor + modifierFlags &= ~ModifierFlags.Private; + + if (!(modifierFlags & ModifierFlags.Protected)) { + modifierFlags |= ModifierFlags.Public; + } + + return modifierFlags; + } + + function prepareModifierFlagsForField(modifierFlags: ModifierFlags): ModifierFlags { + modifierFlags &= ~ModifierFlags.Public; + modifierFlags &= ~ModifierFlags.Protected; + modifierFlags |= ModifierFlags.Private; + return modifierFlags; } function getConvertibleFieldAtPosition(context: RefactorContext): Info | undefined { @@ -121,7 +139,7 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { // make sure declaration have AccessibilityModifier or Static Modifier or Readonly Modifier const meaning = ModifierFlags.AccessibilityModifier | ModifierFlags.Static | ModifierFlags.Readonly; if (!declaration || !nodeOverlapsWithStartEnd(declaration.name, file, startPosition, endPosition!) // TODO: GH#18217 - || !isConvertibleName(declaration.name) || (getModifierFlags(declaration) | meaning) !== meaning) return undefined; + || !isConvertibleName(declaration.name) || (getEffectiveModifierFlags(declaration) | meaning) !== meaning) return undefined; const name = declaration.name.text; const startWithUnderscore = startsWithUnderscore(name); @@ -129,7 +147,7 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { const accessorName = createPropertyName(startWithUnderscore ? getUniqueName(name.substring(1), file) : name, declaration.name); return { isStatic: hasStaticModifier(declaration), - isReadonly: hasReadonlyModifier(declaration), + isReadonly: hasEffectiveReadonlyModifier(declaration), type: getTypeAnnotationNode(declaration), container: declaration.kind === SyntaxKind.Parameter ? declaration.parent.parent : declaration.parent, originalName: (declaration.name).text, diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index e714315f313..7737a5cc8df 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -84,7 +84,7 @@ namespace ts.refactor { case SyntaxKind.ImportDeclaration: return true; case SyntaxKind.ImportEqualsDeclaration: - return !hasModifier(node, ModifierFlags.Export); + return !hasSyntacticModifier(node, ModifierFlags.Export); case SyntaxKind.VariableStatement: return (node as VariableStatement).declarationList.declarations.every(d => !!d.initializer && isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true)); default: @@ -420,7 +420,7 @@ namespace ts.refactor { if (markSeenTop(top)) { addExportToChanges(oldFile, top, changes, useEs6ModuleSyntax); } - if (hasModifier(decl, ModifierFlags.Default)) { + if (hasSyntacticModifier(decl, ModifierFlags.Default)) { oldFileDefault = name; } else { @@ -737,7 +737,7 @@ namespace ts.refactor { function isExported(sourceFile: SourceFile, decl: TopLevelDeclarationStatement, useEs6Exports: boolean): boolean { if (useEs6Exports) { - return !isExpressionStatement(decl) && hasModifier(decl, ModifierFlags.Export); + return !isExpressionStatement(decl) && hasSyntacticModifier(decl, ModifierFlags.Export); } else { return getNamesToExportInCommonJS(decl).some(name => sourceFile.symbol.exports!.has(escapeLeadingUnderscores(name))); diff --git a/src/services/services.ts b/src/services/services.ts index 0ad6ea996e7..28cf22ec473 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -328,7 +328,14 @@ namespace ts { getDocumentationComment(checker: TypeChecker | undefined): SymbolDisplayPart[] { if (!this.documentationComment) { this.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs - this.documentationComment = getDocumentationComment(this.declarations, checker); + + if (!this.declarations && (this as Symbol as TransientSymbol).target && ((this as Symbol as TransientSymbol).target as TransientSymbol).tupleLabelDeclaration) { + const labelDecl = ((this as Symbol as TransientSymbol).target as TransientSymbol).tupleLabelDeclaration!; + this.documentationComment = getDocumentationComment([labelDecl], checker); + } + else { + this.documentationComment = getDocumentationComment(this.declarations, checker); + } } return this.documentationComment; } @@ -763,7 +770,7 @@ namespace ts { case SyntaxKind.Parameter: // Only consider parameter properties - if (!hasModifier(node, ModifierFlags.ParameterPropertyModifier)) { + if (!hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier)) { break; } // falls through @@ -1502,7 +1509,7 @@ namespace ts { position, { name, source }, host, - (formattingOptions && formatting.getFormatContext(formattingOptions))!, // TODO: GH#18217 + (formattingOptions && formatting.getFormatContext(formattingOptions, host))!, // TODO: GH#18217 preferences, cancellationToken, ); @@ -1840,16 +1847,16 @@ namespace ts { function getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[] { const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return formatting.formatSelection(start, end, sourceFile, formatting.getFormatContext(toEditorSettings(options))); + return formatting.formatSelection(start, end, sourceFile, formatting.getFormatContext(toEditorSettings(options), host)); } function getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[] { - return formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), formatting.getFormatContext(toEditorSettings(options))); + return formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), formatting.getFormatContext(toEditorSettings(options), host)); } function getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[] { const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - const formatContext = formatting.getFormatContext(toEditorSettings(options)); + const formatContext = formatting.getFormatContext(toEditorSettings(options), host); if (!isInComment(sourceFile, position)) { switch (key) { @@ -1871,7 +1878,7 @@ namespace ts { synchronizeHostData(); const sourceFile = getValidSourceFile(fileName); const span = createTextSpanFromBounds(start, end); - const formatContext = formatting.getFormatContext(formatOptions); + const formatContext = formatting.getFormatContext(formatOptions, host); return flatMap(deduplicate(errorCodes, equateValues, compareValues), errorCode => { cancellationToken.throwIfCancellationRequested(); @@ -1883,7 +1890,7 @@ namespace ts { synchronizeHostData(); Debug.assert(scope.type === "file"); const sourceFile = getValidSourceFile(scope.fileName); - const formatContext = formatting.getFormatContext(formatOptions); + const formatContext = formatting.getFormatContext(formatOptions, host); return codefix.getAllFixes({ fixId, sourceFile, program, host, cancellationToken, formatContext, preferences }); } @@ -1892,13 +1899,13 @@ namespace ts { synchronizeHostData(); Debug.assert(scope.type === "file"); const sourceFile = getValidSourceFile(scope.fileName); - const formatContext = formatting.getFormatContext(formatOptions); + const formatContext = formatting.getFormatContext(formatOptions, host); return OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences); } function getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences = emptyOptions): readonly FileTextChanges[] { - return ts.getEditsForFileRename(getProgram()!, oldFilePath, newFilePath, host, formatting.getFormatContext(formatOptions), preferences, sourceMapper); + return ts.getEditsForFileRename(getProgram()!, oldFilePath, newFilePath, host, formatting.getFormatContext(formatOptions, host), preferences, sourceMapper); } function applyCodeActionCommand(action: CodeActionCommand, formatSettings?: FormatCodeSettings): Promise; @@ -2141,7 +2148,7 @@ namespace ts { endPosition, program: getProgram()!, host, - formatContext: formatting.getFormatContext(formatOptions!), // TODO: GH#18217 + formatContext: formatting.getFormatContext(formatOptions!, host), // TODO: GH#18217 cancellationToken, preferences, }; diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 0f168d65e7b..d2244e3f894 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -500,16 +500,37 @@ namespace ts.SignatureHelp { const enclosingDeclaration = getEnclosingDeclarationFromInvocation(invocation); const callTargetSymbol = invocation.kind === InvocationKind.Contextual ? invocation.symbol : typeChecker.getSymbolAtLocation(getExpressionFromInvocation(invocation)); const callTargetDisplayParts = callTargetSymbol ? symbolToDisplayParts(typeChecker, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined) : emptyArray; - const items = candidates.map(candidateSignature => getSignatureHelpItem(candidateSignature, callTargetDisplayParts, isTypeParameterList, typeChecker, enclosingDeclaration, sourceFile)); + const items = map(candidates, candidateSignature => getSignatureHelpItem(candidateSignature, callTargetDisplayParts, isTypeParameterList, typeChecker, enclosingDeclaration, sourceFile)); if (argumentIndex !== 0) { Debug.assertLessThan(argumentIndex, argumentCount); } - const selectedItemIndex = candidates.indexOf(resolvedSignature); + let selectedItemIndex = 0; + let itemsSeen = 0; + for (let i = 0; i < items.length; i++) { + const item = items[i]; + if (candidates[i] === resolvedSignature) { + selectedItemIndex = itemsSeen; + if (item.length > 1) { + // check to see if any items in the list better match than the first one, as the checker isn't filtering the nested lists + // (those come from tuple parameter expansion) + let count = 0; + for (const i of item) { + if (i.isVariadic || i.parameters.length >= argumentCount) { + selectedItemIndex = itemsSeen + count; + break; + } + count++; + } + } + } + itemsSeen += item.length; + } + Debug.assert(selectedItemIndex !== -1); // If candidates is non-empty it should always include bestSignature. We check for an empty candidates before calling this function. - return { items, applicableSpan, selectedItemIndex, argumentIndex, argumentCount }; + return { items: flatMapToMutable(items, identity), applicableSpan, selectedItemIndex, argumentIndex, argumentCount }; } function createTypeHelpItems( @@ -538,13 +559,15 @@ namespace ts.SignatureHelp { const separatorDisplayParts: SymbolDisplayPart[] = [punctuationPart(SyntaxKind.CommaToken), spacePart()]; - function getSignatureHelpItem(candidateSignature: Signature, callTargetDisplayParts: readonly SymbolDisplayPart[], isTypeParameterList: boolean, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile): SignatureHelpItem { - const { isVariadic, parameters, prefix, suffix } = (isTypeParameterList ? itemInfoForTypeParameters : itemInfoForParameters)(candidateSignature, checker, enclosingDeclaration, sourceFile); - const prefixDisplayParts = [...callTargetDisplayParts, ...prefix]; - const suffixDisplayParts = [...suffix, ...returnTypeToDisplayParts(candidateSignature, enclosingDeclaration, checker)]; - const documentation = candidateSignature.getDocumentationComment(checker); - const tags = candidateSignature.getJsDocTags(); - return { isVariadic, prefixDisplayParts, suffixDisplayParts, separatorDisplayParts, parameters, documentation, tags }; + function getSignatureHelpItem(candidateSignature: Signature, callTargetDisplayParts: readonly SymbolDisplayPart[], isTypeParameterList: boolean, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile): SignatureHelpItem[] { + const infos = (isTypeParameterList ? itemInfoForTypeParameters : itemInfoForParameters)(candidateSignature, checker, enclosingDeclaration, sourceFile); + return map(infos, ({ isVariadic, parameters, prefix, suffix }) => { + const prefixDisplayParts = [...callTargetDisplayParts, ...prefix]; + const suffixDisplayParts = [...suffix, ...returnTypeToDisplayParts(candidateSignature, enclosingDeclaration, checker)]; + const documentation = candidateSignature.getDocumentationComment(checker); + const tags = candidateSignature.getJsDocTags(); + return { isVariadic, prefixDisplayParts, suffixDisplayParts, separatorDisplayParts, parameters, documentation, tags }; + }); } function returnTypeToDisplayParts(candidateSignature: Signature, enclosingDeclaration: Node, checker: TypeChecker): readonly SymbolDisplayPart[] { @@ -563,19 +586,22 @@ namespace ts.SignatureHelp { interface SignatureHelpItemInfo { readonly isVariadic: boolean; readonly parameters: SignatureHelpParameter[]; readonly prefix: readonly SymbolDisplayPart[]; readonly suffix: readonly SymbolDisplayPart[]; } - function itemInfoForTypeParameters(candidateSignature: Signature, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile): SignatureHelpItemInfo { + function itemInfoForTypeParameters(candidateSignature: Signature, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile): SignatureHelpItemInfo[] { const typeParameters = (candidateSignature.target || candidateSignature).typeParameters; const printer = createPrinter({ removeComments: true }); const parameters = (typeParameters || emptyArray).map(t => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer)); - const parameterParts = mapToDisplayParts(writer => { - const thisParameter = candidateSignature.thisParameter ? [checker.symbolToParameterDeclaration(candidateSignature.thisParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags)!] : []; - const params = createNodeArray([...thisParameter, ...checker.getExpandedParameters(candidateSignature).map(param => checker.symbolToParameterDeclaration(param, enclosingDeclaration, signatureHelpNodeBuilderFlags)!)]); - printer.writeList(ListFormat.CallExpressionArguments, params, sourceFile, writer); + const thisParameter = candidateSignature.thisParameter ? [checker.symbolToParameterDeclaration(candidateSignature.thisParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags)!] : []; + + return checker.getExpandedParameters(candidateSignature).map(paramList => { + const params = createNodeArray([...thisParameter, ...map(paramList, param => checker.symbolToParameterDeclaration(param, enclosingDeclaration, signatureHelpNodeBuilderFlags)!)]); + const parameterParts = mapToDisplayParts(writer => { + printer.writeList(ListFormat.CallExpressionArguments, params, sourceFile, writer); + }); + return { isVariadic: false, parameters, prefix: [punctuationPart(SyntaxKind.LessThanToken)], suffix: [punctuationPart(SyntaxKind.GreaterThanToken), ...parameterParts] }; }); - return { isVariadic: false, parameters, prefix: [punctuationPart(SyntaxKind.LessThanToken)], suffix: [punctuationPart(SyntaxKind.GreaterThanToken), ...parameterParts] }; } - function itemInfoForParameters(candidateSignature: Signature, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile): SignatureHelpItemInfo { + function itemInfoForParameters(candidateSignature: Signature, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile): SignatureHelpItemInfo[] { const isVariadic = checker.hasEffectiveRestParameter(candidateSignature); const printer = createPrinter({ removeComments: true }); const typeParameterParts = mapToDisplayParts(writer => { @@ -584,8 +610,15 @@ namespace ts.SignatureHelp { printer.writeList(ListFormat.TypeParameters, args, sourceFile, writer); } }); - const parameters = checker.getExpandedParameters(candidateSignature).map(p => createSignatureHelpParameterForParameter(p, checker, enclosingDeclaration, sourceFile, printer)); - return { isVariadic, parameters, prefix: [...typeParameterParts, punctuationPart(SyntaxKind.OpenParenToken)], suffix: [punctuationPart(SyntaxKind.CloseParenToken)] }; + const lists = checker.getExpandedParameters(candidateSignature); + return lists.map(parameterList => { + return { + isVariadic: isVariadic && (lists.length === 1 || !!((parameterList[parameterList.length - 1] as TransientSymbol).checkFlags & CheckFlags.RestParameter)), + parameters: parameterList.map(p => createSignatureHelpParameterForParameter(p, checker, enclosingDeclaration, sourceFile, printer)), + prefix: [...typeParameterParts, punctuationPart(SyntaxKind.OpenParenToken)], + suffix: [punctuationPart(SyntaxKind.CloseParenToken)] + }; + }); } function createSignatureHelpParameterForParameter(parameter: Symbol, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile, printer: Printer): SignatureHelpParameter { diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index c9af01faef8..11f20195131 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -389,7 +389,7 @@ namespace ts.SymbolDisplay { if (declarationName) { const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && - hasModifier(resolvedNode, ModifierFlags.Ambient); + hasSyntacticModifier(resolvedNode, ModifierFlags.Ambient); const shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration; const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKind( typeChecker, @@ -481,6 +481,14 @@ namespace ts.SymbolDisplay { else { addRange(displayParts, typeToDisplayParts(typeChecker, type, enclosingDeclaration)); } + if ((symbol as TransientSymbol).target && ((symbol as TransientSymbol).target as TransientSymbol).tupleLabelDeclaration) { + const labelDecl = ((symbol as TransientSymbol).target as TransientSymbol).tupleLabelDeclaration!; + Debug.assertNode(labelDecl.name, isIdentifier); + displayParts.push(spacePart()); + displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + displayParts.push(textPart(idText(labelDecl.name))); + displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + } } else if (symbolFlags & SymbolFlags.Function || symbolFlags & SymbolFlags.Method || diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 245306ac109..216301fc011 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -286,6 +286,10 @@ namespace ts.textChanges { this.deletedNodes.push({ sourceFile, node }); } + public deleteNode(sourceFile: SourceFile, node: Node, options: ConfigurableStartEnd = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }): void { + this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options)); + } + public deleteModifier(sourceFile: SourceFile, modifier: Modifier): void { this.deleteRange(sourceFile, { pos: modifier.getStart(sourceFile), end: skipTrivia(sourceFile.text, modifier.end, /*stopAfterLineBreak*/ true) }); } diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index bbe3956e173..f3e6e5ce456 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -64,6 +64,7 @@ "codefixes/fixClassIncorrectlyImplementsInterface.ts", "codefixes/importFixes.ts", "codefixes/fixImplicitThis.ts", + "codefixes/fixIncorrectNamedTupleSyntax.ts", "codefixes/fixSpelling.ts", "codefixes/returnValueCorrect.ts", "codefixes/fixAddMissingMember.ts", @@ -101,6 +102,7 @@ "codefixes/fixExpectedComma.ts", "refactors/convertExport.ts", "refactors/convertImport.ts", + "refactors/convertOverloadListToSingleSignature.ts", "refactors/extractSymbol.ts", "refactors/extractType.ts", "refactors/generateGetAccessorAndSetAccessor.ts", diff --git a/src/services/types.ts b/src/services/types.ts index 13c68364664..fd8ade8f8e6 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -203,6 +203,11 @@ namespace ts { has(dependencyName: string, inGroups?: PackageJsonDependencyGroup): boolean; } + /** @internal */ + export interface FormattingHost { + getNewLine?(): string; + } + // // Public interface of the host of a language service instance. // diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 58f53198f79..b1799167c43 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -407,7 +407,7 @@ namespace ts { case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; case SyntaxKind.EnumMember: return ScriptElementKind.enumMemberElement; - case SyntaxKind.Parameter: return hasModifier(node, ModifierFlags.ParameterPropertyModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case SyntaxKind.Parameter: return hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.ImportSpecifier: case SyntaxKind.ExportSpecifier: @@ -2085,9 +2085,9 @@ namespace ts { /** * The default is CRLF. */ - export function getNewLineOrDefaultFromHost(host: LanguageServiceHost | LanguageServiceShimHost, formatSettings?: FormatCodeSettings) { - return (formatSettings && formatSettings.newLineCharacter) || - (host.getNewLine && host.getNewLine()) || + export function getNewLineOrDefaultFromHost(host: FormattingHost, formatSettings?: FormatCodeSettings) { + return formatSettings?.newLineCharacter || + host.getNewLine?.() || carriageReturnLineFeed; } diff --git a/src/testRunner/unittests/printer.ts b/src/testRunner/unittests/printer.ts index d04bf65603c..e96aba36749 100644 --- a/src/testRunner/unittests/printer.ts +++ b/src/testRunner/unittests/printer.ts @@ -229,7 +229,7 @@ namespace ts { // https://github.com/Microsoft/TypeScript/issues/15651 printsCorrectly("functionTypes", {}, printer => printer.printNode( EmitHint.Unspecified, - createTupleTypeNode([ + setEmitFlags(createTupleTypeNode([ createFunctionTypeNode( /*typeArguments*/ undefined, [createParameter( @@ -293,7 +293,7 @@ namespace ts { )], createKeywordTypeNode(SyntaxKind.AnyKeyword) ), - ]), + ]), EmitFlags.SingleLine), createSourceFile("source.ts", "", ScriptTarget.ES2015) )); }); diff --git a/src/testRunner/unittests/services/convertToAsyncFunction.ts b/src/testRunner/unittests/services/convertToAsyncFunction.ts index 999e1580a98..78a2f43f6c3 100644 --- a/src/testRunner/unittests/services/convertToAsyncFunction.ts +++ b/src/testRunner/unittests/services/convertToAsyncFunction.ts @@ -306,7 +306,7 @@ interface Array {}` cancellationToken: { throwIfCancellationRequested: noop, isCancellationRequested: returnFalse }, preferences: emptyOptions, host: notImplementedHost, - formatContext: formatting.getFormatContext(testFormatSettings) + formatContext: formatting.getFormatContext(testFormatSettings, notImplementedHost) }; const diagnostics = languageService.getSuggestionDiagnostics(f.path); diff --git a/src/testRunner/unittests/services/extract/helpers.ts b/src/testRunner/unittests/services/extract/helpers.ts index a998bf6f510..a4787529994 100644 --- a/src/testRunner/unittests/services/extract/helpers.ts +++ b/src/testRunner/unittests/services/extract/helpers.ts @@ -102,7 +102,7 @@ namespace ts { startPosition: selectionRange.pos, endPosition: selectionRange.end, host: notImplementedHost, - formatContext: formatting.getFormatContext(testFormatSettings), + formatContext: formatting.getFormatContext(testFormatSettings, notImplementedHost), preferences: emptyOptions, }; const rangeToExtract = refactor.extractSymbol.getRangeToExtract(sourceFile, createTextSpanFromRange(selectionRange)); @@ -164,7 +164,7 @@ namespace ts { startPosition: selectionRange.pos, endPosition: selectionRange.end, host: notImplementedHost, - formatContext: formatting.getFormatContext(testFormatSettings), + formatContext: formatting.getFormatContext(testFormatSettings, notImplementedHost), preferences: emptyOptions, }; const rangeToExtract = refactor.extractSymbol.getRangeToExtract(sourceFile, createTextSpanFromRange(selectionRange)); diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 627928c03e8..3e2b1108931 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -592,6 +592,22 @@ import "lib1"; { path: "/lib1.ts", content: "" }, { path: "/lib2.ts", content: "" }); + testOrganizeImports("SortComments", + { + path: "/test.ts", + content: ` +// Header +import "lib3"; +// Comment2 +import "lib2"; +// Comment1 +import "lib1"; +`, + }, + { path: "/lib1.ts", content: "" }, + { path: "/lib2.ts", content: "" }, + { path: "/lib3.ts", content: "" }); + testOrganizeImports("AmbientModule", { path: "/test.ts", diff --git a/src/testRunner/unittests/services/textChanges.ts b/src/testRunner/unittests/services/textChanges.ts index 2d76b64696d..5c3a103c238 100644 --- a/src/testRunner/unittests/services/textChanges.ts +++ b/src/testRunner/unittests/services/textChanges.ts @@ -19,7 +19,7 @@ namespace ts { const newLineCharacter = getNewLineCharacter(printerOptions); function getRuleProvider(placeOpenBraceOnNewLineForFunctions: boolean): formatting.FormatContext { - return formatting.getFormatContext(placeOpenBraceOnNewLineForFunctions ? { ...testFormatSettings, placeOpenBraceOnNewLineForFunctions: true } : testFormatSettings); + return formatting.getFormatContext(placeOpenBraceOnNewLineForFunctions ? { ...testFormatSettings, placeOpenBraceOnNewLineForFunctions: true } : testFormatSettings, notImplementedHost); } // validate that positions that were recovered from the printed text actually match positions that will be created if the same text is parsed. diff --git a/src/testRunner/unittests/transform.ts b/src/testRunner/unittests/transform.ts index cce8c92ad41..54d511233fa 100644 --- a/src/testRunner/unittests/transform.ts +++ b/src/testRunner/unittests/transform.ts @@ -50,6 +50,15 @@ namespace ts { return (node: SourceFile) => visitNode(node, visitor); } + function createTaggedTemplateLiteral(): Transformer { + return sourceFile => updateSourceFileNode(sourceFile, [ + createStatement( + createTaggedTemplate( + createIdentifier("$tpl"), + createNoSubstitutionTemplateLiteral("foo", "foo"))) + ]); + } + function transformSourceFile(sourceText: string, transformers: TransformerFactory[]) { const transformed = transform(createSourceFile("source.ts", sourceText, ScriptTarget.ES2015), transformers); const printer = createPrinter({ newLine: NewLineKind.CarriageReturnLineFeed }, { @@ -120,6 +129,17 @@ namespace ts { }).outputText; }); + testBaseline("transformTaggedTemplateLiteral", () => { + return transpileModule("", { + transformers: { + before: [createTaggedTemplateLiteral], + }, + compilerOptions: { + target: ScriptTarget.ES5 + } + }).outputText; + }); + testBaseline("issue27854", () => { return transpileModule(`oldName<{ a: string; }>\` ... \`;`, { transformers: { diff --git a/src/testRunner/unittests/tsbuild/watchMode.ts b/src/testRunner/unittests/tsbuild/watchMode.ts index 308c229776d..69faba35c31 100644 --- a/src/testRunner/unittests/tsbuild/watchMode.ts +++ b/src/testRunner/unittests/tsbuild/watchMode.ts @@ -15,6 +15,13 @@ namespace ts.tscWatch { return ts.createSolutionBuilder(host, rootNames, defaultOptions || {}); } + export function ensureErrorFreeBuild(host: WatchedSystem, rootNames: readonly string[]) { + // ts build should succeed + const solutionBuilder = createSolutionBuilder(host, rootNames, {}); + solutionBuilder.build(); + assert.equal(host.getOutput().length, 0, JSON.stringify(host.getOutput(), /*replacer*/ undefined, " ")); + } + type OutputFileStamp = [string, Date | undefined, boolean]; function transformOutputToOutputFileStamp(f: string, host: TsBuildWatchSystem): OutputFileStamp { return [f, host.getModifiedTime(f), host.writtenFiles.has(host.toFullPath(f))] as OutputFileStamp; diff --git a/src/testRunner/unittests/tsserver/configuredProjects.ts b/src/testRunner/unittests/tsserver/configuredProjects.ts index 4c61106a1d6..b8ec47946a3 100644 --- a/src/testRunner/unittests/tsserver/configuredProjects.ts +++ b/src/testRunner/unittests/tsserver/configuredProjects.ts @@ -1050,6 +1050,64 @@ declare var console: { }); }); }); + + it("when default configured project does not contain the file", () => { + const barConfig: File = { + path: `${tscWatch.projectRoot}/bar/tsconfig.json`, + content: "{}" + }; + const barIndex: File = { + path: `${tscWatch.projectRoot}/bar/index.ts`, + content: `import {foo} from "../foo/lib"; +foo();` + }; + const fooBarConfig: File = { + path: `${tscWatch.projectRoot}/foobar/tsconfig.json`, + content: barConfig.path + }; + const fooBarIndex: File = { + path: `${tscWatch.projectRoot}/foobar/index.ts`, + content: barIndex.content + }; + const fooConfig: File = { + path: `${tscWatch.projectRoot}/foo/tsconfig.json`, + content: JSON.stringify({ + include: ["index.ts"], + compilerOptions: { + declaration: true, + outDir: "lib" + } + }) + }; + const fooIndex: File = { + path: `${tscWatch.projectRoot}/foo/index.ts`, + content: `export function foo() {}` + }; + const host = createServerHost([barConfig, barIndex, fooBarConfig, fooBarIndex, fooConfig, fooIndex, libFile]); + tscWatch.ensureErrorFreeBuild(host, [fooConfig.path]); + const fooDts = `${tscWatch.projectRoot}/foo/lib/index.d.ts`; + assert.isTrue(host.fileExists(fooDts)); + const session = createSession(host); + const service = session.getProjectService(); + service.openClientFile(barIndex.path); + checkProjectActualFiles(service.configuredProjects.get(barConfig.path)!, [barIndex.path, fooDts, libFile.path, barConfig.path]); + service.openClientFile(fooBarIndex.path); + checkProjectActualFiles(service.configuredProjects.get(fooBarConfig.path)!, [fooBarIndex.path, fooDts, libFile.path, fooBarConfig.path]); + service.openClientFile(fooIndex.path); + checkProjectActualFiles(service.configuredProjects.get(fooConfig.path)!, [fooIndex.path, libFile.path, fooConfig.path]); + service.openClientFile(fooDts); + session.executeCommandSeq({ + command: protocol.CommandTypes.GetApplicableRefactors, + arguments: { + file: fooDts, + startLine: 1, + startOffset: 1, + endLine: 1, + endOffset: 1 + } + }); + assert.equal(service.tryGetDefaultProjectForFile(server.toNormalizedPath(fooDts)), service.configuredProjects.get(barConfig.path)); + }); }); describe("unittests:: tsserver:: ConfiguredProjects:: non-existing directories listed in config file input array", () => { diff --git a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts index e8442e07e69..e4301b3c271 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts @@ -469,9 +469,7 @@ ${appendDts}` const host = createServerHost([libFile, tsbaseJson, buttonConfig, buttonSource, siblingConfig, siblingSource], { useCaseSensitiveFileNames: true }); // ts build should succeed - const solutionBuilder = tscWatch.createSolutionBuilder(host, [siblingConfig.path], {}); - solutionBuilder.build(); - assert.equal(host.getOutput().length, 0, JSON.stringify(host.getOutput(), /*replacer*/ undefined, " ")); + tscWatch.ensureErrorFreeBuild(host, [siblingConfig.path]); const sourceJs = changeExtension(siblingSource.path, ".js"); const expectedSiblingJs = host.readFile(sourceJs); diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index 2eb7d7710ce..8da081d82c1 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -2,12 +2,8 @@ namespace ts.projectSystem { describe("unittests:: tsserver:: with project references and tsbuild", () => { function createHost(files: readonly TestFSWithWatch.FileOrFolderOrSymLink[], rootNames: readonly string[]) { const host = createServerHost(files); - // ts build should succeed - const solutionBuilder = tscWatch.createSolutionBuilder(host, rootNames, {}); - solutionBuilder.build(); - assert.equal(host.getOutput().length, 0, JSON.stringify(host.getOutput(), /*replacer*/ undefined, " ")); - + tscWatch.ensureErrorFreeBuild(host, rootNames); return host; } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json index 61631cabce4..8bce1081376 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json @@ -5,7 +5,7 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 0, - "elementTypes": { + "elements": { "length": 0, "pos": 2, "end": 2 diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json index c8373fe5e87..dc98f9164e7 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json @@ -5,7 +5,7 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 0, - "elementTypes": { + "elements": { "0": { "kind": "NumberKeyword", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json index 78875855840..f6da4118779 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json @@ -5,7 +5,7 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 0, - "elementTypes": { + "elements": { "0": { "kind": "NumberKeyword", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json index c1b537d2945..08c3a7dbede 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json @@ -5,7 +5,7 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 0, - "elementTypes": { + "elements": { "0": { "kind": "NumberKeyword", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json index b859519b8da..da597813899 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json @@ -5,7 +5,7 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 0, - "elementTypes": { + "elements": { "0": { "kind": "NumberKeyword", "pos": 2, diff --git a/tests/baselines/reference/ambientShorthand_reExport.js b/tests/baselines/reference/ambientShorthand_reExport.js index 56a8cbaa427..5d8b1ff9dfd 100644 --- a/tests/baselines/reference/ambientShorthand_reExport.js +++ b/tests/baselines/reference/ambientShorthand_reExport.js @@ -39,7 +39,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("jquery"), exports); //// [reExportUser.js] diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index cd164686ae2..e89d9461ff3 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -263,150 +263,151 @@ declare namespace ts { IndexedAccessType = 185, MappedType = 186, LiteralType = 187, - ImportType = 188, - ObjectBindingPattern = 189, - ArrayBindingPattern = 190, - BindingElement = 191, - ArrayLiteralExpression = 192, - ObjectLiteralExpression = 193, - PropertyAccessExpression = 194, - ElementAccessExpression = 195, - CallExpression = 196, - NewExpression = 197, - TaggedTemplateExpression = 198, - TypeAssertionExpression = 199, - ParenthesizedExpression = 200, - FunctionExpression = 201, - ArrowFunction = 202, - DeleteExpression = 203, - TypeOfExpression = 204, - VoidExpression = 205, - AwaitExpression = 206, - PrefixUnaryExpression = 207, - PostfixUnaryExpression = 208, - BinaryExpression = 209, - ConditionalExpression = 210, - TemplateExpression = 211, - YieldExpression = 212, - SpreadElement = 213, - ClassExpression = 214, - OmittedExpression = 215, - ExpressionWithTypeArguments = 216, - AsExpression = 217, - NonNullExpression = 218, - MetaProperty = 219, - SyntheticExpression = 220, - TemplateSpan = 221, - SemicolonClassElement = 222, - Block = 223, - EmptyStatement = 224, - VariableStatement = 225, - ExpressionStatement = 226, - IfStatement = 227, - DoStatement = 228, - WhileStatement = 229, - ForStatement = 230, - ForInStatement = 231, - ForOfStatement = 232, - ContinueStatement = 233, - BreakStatement = 234, - ReturnStatement = 235, - WithStatement = 236, - SwitchStatement = 237, - LabeledStatement = 238, - ThrowStatement = 239, - TryStatement = 240, - DebuggerStatement = 241, - VariableDeclaration = 242, - VariableDeclarationList = 243, - FunctionDeclaration = 244, - ClassDeclaration = 245, - InterfaceDeclaration = 246, - TypeAliasDeclaration = 247, - EnumDeclaration = 248, - ModuleDeclaration = 249, - ModuleBlock = 250, - CaseBlock = 251, - NamespaceExportDeclaration = 252, - ImportEqualsDeclaration = 253, - ImportDeclaration = 254, - ImportClause = 255, - NamespaceImport = 256, - NamedImports = 257, - ImportSpecifier = 258, - ExportAssignment = 259, - ExportDeclaration = 260, - NamedExports = 261, - NamespaceExport = 262, - ExportSpecifier = 263, - MissingDeclaration = 264, - ExternalModuleReference = 265, - JsxElement = 266, - JsxSelfClosingElement = 267, - JsxOpeningElement = 268, - JsxClosingElement = 269, - JsxFragment = 270, - JsxOpeningFragment = 271, - JsxClosingFragment = 272, - JsxAttribute = 273, - JsxAttributes = 274, - JsxSpreadAttribute = 275, - JsxExpression = 276, - CaseClause = 277, - DefaultClause = 278, - HeritageClause = 279, - CatchClause = 280, - PropertyAssignment = 281, - ShorthandPropertyAssignment = 282, - SpreadAssignment = 283, - EnumMember = 284, - UnparsedPrologue = 285, - UnparsedPrepend = 286, - UnparsedText = 287, - UnparsedInternalText = 288, - UnparsedSyntheticReference = 289, - SourceFile = 290, - Bundle = 291, - UnparsedSource = 292, - InputFiles = 293, - JSDocTypeExpression = 294, - JSDocAllType = 295, - JSDocUnknownType = 296, - JSDocNullableType = 297, - JSDocNonNullableType = 298, - JSDocOptionalType = 299, - JSDocFunctionType = 300, - JSDocVariadicType = 301, - JSDocNamepathType = 302, - JSDocComment = 303, - JSDocTypeLiteral = 304, - JSDocSignature = 305, - JSDocTag = 306, - JSDocAugmentsTag = 307, - JSDocImplementsTag = 308, - JSDocAuthorTag = 309, - JSDocClassTag = 310, - JSDocPublicTag = 311, - JSDocPrivateTag = 312, - JSDocProtectedTag = 313, - JSDocReadonlyTag = 314, - JSDocCallbackTag = 315, - JSDocEnumTag = 316, - JSDocParameterTag = 317, - JSDocReturnTag = 318, - JSDocThisTag = 319, - JSDocTypeTag = 320, - JSDocTemplateTag = 321, - JSDocTypedefTag = 322, - JSDocPropertyTag = 323, - SyntaxList = 324, - NotEmittedStatement = 325, - PartiallyEmittedExpression = 326, - CommaListExpression = 327, - MergeDeclarationMarker = 328, - EndOfDeclarationMarker = 329, - SyntheticReferenceExpression = 330, - Count = 331, + NamedTupleMember = 188, + ImportType = 189, + ObjectBindingPattern = 190, + ArrayBindingPattern = 191, + BindingElement = 192, + ArrayLiteralExpression = 193, + ObjectLiteralExpression = 194, + PropertyAccessExpression = 195, + ElementAccessExpression = 196, + CallExpression = 197, + NewExpression = 198, + TaggedTemplateExpression = 199, + TypeAssertionExpression = 200, + ParenthesizedExpression = 201, + FunctionExpression = 202, + ArrowFunction = 203, + DeleteExpression = 204, + TypeOfExpression = 205, + VoidExpression = 206, + AwaitExpression = 207, + PrefixUnaryExpression = 208, + PostfixUnaryExpression = 209, + BinaryExpression = 210, + ConditionalExpression = 211, + TemplateExpression = 212, + YieldExpression = 213, + SpreadElement = 214, + ClassExpression = 215, + OmittedExpression = 216, + ExpressionWithTypeArguments = 217, + AsExpression = 218, + NonNullExpression = 219, + MetaProperty = 220, + SyntheticExpression = 221, + TemplateSpan = 222, + SemicolonClassElement = 223, + Block = 224, + EmptyStatement = 225, + VariableStatement = 226, + ExpressionStatement = 227, + IfStatement = 228, + DoStatement = 229, + WhileStatement = 230, + ForStatement = 231, + ForInStatement = 232, + ForOfStatement = 233, + ContinueStatement = 234, + BreakStatement = 235, + ReturnStatement = 236, + WithStatement = 237, + SwitchStatement = 238, + LabeledStatement = 239, + ThrowStatement = 240, + TryStatement = 241, + DebuggerStatement = 242, + VariableDeclaration = 243, + VariableDeclarationList = 244, + FunctionDeclaration = 245, + ClassDeclaration = 246, + InterfaceDeclaration = 247, + TypeAliasDeclaration = 248, + EnumDeclaration = 249, + ModuleDeclaration = 250, + ModuleBlock = 251, + CaseBlock = 252, + NamespaceExportDeclaration = 253, + ImportEqualsDeclaration = 254, + ImportDeclaration = 255, + ImportClause = 256, + NamespaceImport = 257, + NamedImports = 258, + ImportSpecifier = 259, + ExportAssignment = 260, + ExportDeclaration = 261, + NamedExports = 262, + NamespaceExport = 263, + ExportSpecifier = 264, + MissingDeclaration = 265, + ExternalModuleReference = 266, + JsxElement = 267, + JsxSelfClosingElement = 268, + JsxOpeningElement = 269, + JsxClosingElement = 270, + JsxFragment = 271, + JsxOpeningFragment = 272, + JsxClosingFragment = 273, + JsxAttribute = 274, + JsxAttributes = 275, + JsxSpreadAttribute = 276, + JsxExpression = 277, + CaseClause = 278, + DefaultClause = 279, + HeritageClause = 280, + CatchClause = 281, + PropertyAssignment = 282, + ShorthandPropertyAssignment = 283, + SpreadAssignment = 284, + EnumMember = 285, + UnparsedPrologue = 286, + UnparsedPrepend = 287, + UnparsedText = 288, + UnparsedInternalText = 289, + UnparsedSyntheticReference = 290, + SourceFile = 291, + Bundle = 292, + UnparsedSource = 293, + InputFiles = 294, + JSDocTypeExpression = 295, + JSDocAllType = 296, + JSDocUnknownType = 297, + JSDocNullableType = 298, + JSDocNonNullableType = 299, + JSDocOptionalType = 300, + JSDocFunctionType = 301, + JSDocVariadicType = 302, + JSDocNamepathType = 303, + JSDocComment = 304, + JSDocTypeLiteral = 305, + JSDocSignature = 306, + JSDocTag = 307, + JSDocAugmentsTag = 308, + JSDocImplementsTag = 309, + JSDocAuthorTag = 310, + JSDocClassTag = 311, + JSDocPublicTag = 312, + JSDocPrivateTag = 313, + JSDocProtectedTag = 314, + JSDocReadonlyTag = 315, + JSDocCallbackTag = 316, + JSDocEnumTag = 317, + JSDocParameterTag = 318, + JSDocReturnTag = 319, + JSDocThisTag = 320, + JSDocTypeTag = 321, + JSDocTemplateTag = 322, + JSDocTypedefTag = 323, + JSDocPropertyTag = 324, + SyntaxList = 325, + NotEmittedStatement = 326, + PartiallyEmittedExpression = 327, + CommaListExpression = 328, + MergeDeclarationMarker = 329, + EndOfDeclarationMarker = 330, + SyntheticReferenceExpression = 331, + Count = 332, FirstAssignment = 62, LastAssignment = 74, FirstCompoundAssignment = 63, @@ -418,7 +419,7 @@ declare namespace ts { FirstFutureReservedWord = 113, LastFutureReservedWord = 121, FirstTypeNode = 168, - LastTypeNode = 188, + LastTypeNode = 189, FirstPunctuation = 18, LastPunctuation = 74, FirstToken = 0, @@ -431,13 +432,13 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 74, - FirstStatement = 225, - LastStatement = 241, + FirstStatement = 226, + LastStatement = 242, FirstNode = 153, - FirstJSDocNode = 294, - LastJSDocNode = 323, - FirstJSDocTagNode = 306, - LastJSDocTagNode = 323, + FirstJSDocNode = 295, + LastJSDocNode = 324, + FirstJSDocTagNode = 307, + LastJSDocTagNode = 324, } export enum NodeFlags { None = 0, @@ -482,6 +483,7 @@ declare namespace ts { Async = 256, Default = 512, Const = 2048, + HasComputedJSDocModifiers = 4096, HasComputedFlags = 536870912, AccessibilityModifier = 28, ParameterPropertyModifier = 92, @@ -507,7 +509,7 @@ declare namespace ts { } export interface JSDocContainer { } - export type HasJSDoc = ParameterDeclaration | CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | PropertySignature | ArrowFunction | ParenthesizedExpression | SpreadAssignment | ShorthandPropertyAssignment | PropertyAssignment | FunctionExpression | LabeledStatement | ExpressionStatement | VariableStatement | FunctionDeclaration | ConstructorDeclaration | MethodDeclaration | PropertyDeclaration | AccessorDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumMember | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration | EndOfFileToken; + export type HasJSDoc = ParameterDeclaration | CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | PropertySignature | ArrowFunction | ParenthesizedExpression | SpreadAssignment | ShorthandPropertyAssignment | PropertyAssignment | FunctionExpression | LabeledStatement | ExpressionStatement | VariableStatement | FunctionDeclaration | ConstructorDeclaration | MethodDeclaration | PropertyDeclaration | AccessorDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumMember | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration | NamedTupleMember | EndOfFileToken; export type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType; export type HasTypeArguments = CallExpression | NewExpression | TaggedTemplateExpression | JsxOpeningElement | JsxSelfClosingElement; export type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute; @@ -808,7 +810,14 @@ declare namespace ts { } export interface TupleTypeNode extends TypeNode { kind: SyntaxKind.TupleType; - elementTypes: NodeArray; + elements: NodeArray; + } + export interface NamedTupleMember extends TypeNode, JSDocContainer, Declaration { + kind: SyntaxKind.NamedTupleMember; + dotDotDotToken?: Token; + name: Identifier; + questionToken?: Token; + type: TypeNode; } export interface OptionalTypeNode extends TypeNode { kind: SyntaxKind.OptionalType; @@ -946,6 +955,7 @@ declare namespace ts { kind: SyntaxKind.SyntheticExpression; isSpread: boolean; type: Type; + tupleNameSource?: ParameterDeclaration | NamedTupleMember; } export type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken; export type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken; @@ -1577,6 +1587,7 @@ declare namespace ts { text: string; pos: -1; end: -1; + hasLeadingNewline?: boolean; } export interface JSDocTypeExpression extends TypeNode { kind: SyntaxKind.JSDocTypeExpression; @@ -1742,21 +1753,11 @@ declare namespace ts { Label = 12, Condition = 96 } - export type FlowNode = AfterFinallyFlow | PreFinallyFlow | FlowStart | FlowLabel | FlowAssignment | FlowCall | FlowCondition | FlowSwitchClause | FlowArrayMutation; + export type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCall | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel; export interface FlowNodeBase { flags: FlowFlags; id?: number; } - export interface FlowLock { - locked?: boolean; - } - export interface AfterFinallyFlow extends FlowNodeBase, FlowLock { - antecedent: FlowNode; - } - export interface PreFinallyFlow extends FlowNodeBase { - antecedent: FlowNode; - lock: FlowLock; - } export interface FlowStart extends FlowNodeBase { node?: FunctionExpression | ArrowFunction | MethodDeclaration; } @@ -2475,7 +2476,7 @@ declare namespace ts { minLength: number; hasRestElement: boolean; readonly: boolean; - associatedNames?: __String[]; + labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]; } export interface TupleTypeReference extends TypeReference { target: TupleType; @@ -3232,7 +3233,8 @@ declare namespace ts { HeritageClauses = 512, SingleLineTypeLiteralMembers = 768, MultiLineTypeLiteralMembers = 32897, - TupleTypeElements = 528, + SingleLineTupleTypeElements = 528, + MultiLineTupleTypeElements = 657, UnionTypeConstituents = 516, IntersectionTypeConstituents = 520, ObjectBindingPatternElements = 525136, @@ -4052,8 +4054,8 @@ declare namespace ts { function updateTypeLiteralNode(node: TypeLiteralNode, members: NodeArray): TypeLiteralNode; function createArrayTypeNode(elementType: TypeNode): ArrayTypeNode; function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; - function createTupleTypeNode(elementTypes: readonly TypeNode[]): TupleTypeNode; - function updateTupleTypeNode(node: TupleTypeNode, elementTypes: readonly TypeNode[]): TupleTypeNode; + function createTupleTypeNode(elements: readonly (TypeNode | NamedTupleMember)[]): TupleTypeNode; + function updateTupleTypeNode(node: TupleTypeNode, elements: readonly (TypeNode | NamedTupleMember)[]): TupleTypeNode; function createOptionalTypeNode(type: TypeNode): OptionalTypeNode; function updateOptionalTypeNode(node: OptionalTypeNode, type: TypeNode): OptionalTypeNode; function createRestTypeNode(type: TypeNode): RestTypeNode; @@ -4071,6 +4073,8 @@ declare namespace ts { function updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; function createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; + function createNamedTupleMember(dotDotDotToken: Token | undefined, name: Identifier, questionToken: Token | undefined, type: TypeNode): NamedTupleMember; + function updateNamedTupleMember(node: NamedTupleMember, dotDotDotToken: Token | undefined, name: Identifier, questionToken: Token | undefined, type: TypeNode): NamedTupleMember; function createThisTypeNode(): ThisTypeNode; function createTypeOperatorNode(type: TypeNode): TypeOperatorNode; function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword, type: TypeNode): TypeOperatorNode; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index f1a808da728..2213fd4be6a 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -263,150 +263,151 @@ declare namespace ts { IndexedAccessType = 185, MappedType = 186, LiteralType = 187, - ImportType = 188, - ObjectBindingPattern = 189, - ArrayBindingPattern = 190, - BindingElement = 191, - ArrayLiteralExpression = 192, - ObjectLiteralExpression = 193, - PropertyAccessExpression = 194, - ElementAccessExpression = 195, - CallExpression = 196, - NewExpression = 197, - TaggedTemplateExpression = 198, - TypeAssertionExpression = 199, - ParenthesizedExpression = 200, - FunctionExpression = 201, - ArrowFunction = 202, - DeleteExpression = 203, - TypeOfExpression = 204, - VoidExpression = 205, - AwaitExpression = 206, - PrefixUnaryExpression = 207, - PostfixUnaryExpression = 208, - BinaryExpression = 209, - ConditionalExpression = 210, - TemplateExpression = 211, - YieldExpression = 212, - SpreadElement = 213, - ClassExpression = 214, - OmittedExpression = 215, - ExpressionWithTypeArguments = 216, - AsExpression = 217, - NonNullExpression = 218, - MetaProperty = 219, - SyntheticExpression = 220, - TemplateSpan = 221, - SemicolonClassElement = 222, - Block = 223, - EmptyStatement = 224, - VariableStatement = 225, - ExpressionStatement = 226, - IfStatement = 227, - DoStatement = 228, - WhileStatement = 229, - ForStatement = 230, - ForInStatement = 231, - ForOfStatement = 232, - ContinueStatement = 233, - BreakStatement = 234, - ReturnStatement = 235, - WithStatement = 236, - SwitchStatement = 237, - LabeledStatement = 238, - ThrowStatement = 239, - TryStatement = 240, - DebuggerStatement = 241, - VariableDeclaration = 242, - VariableDeclarationList = 243, - FunctionDeclaration = 244, - ClassDeclaration = 245, - InterfaceDeclaration = 246, - TypeAliasDeclaration = 247, - EnumDeclaration = 248, - ModuleDeclaration = 249, - ModuleBlock = 250, - CaseBlock = 251, - NamespaceExportDeclaration = 252, - ImportEqualsDeclaration = 253, - ImportDeclaration = 254, - ImportClause = 255, - NamespaceImport = 256, - NamedImports = 257, - ImportSpecifier = 258, - ExportAssignment = 259, - ExportDeclaration = 260, - NamedExports = 261, - NamespaceExport = 262, - ExportSpecifier = 263, - MissingDeclaration = 264, - ExternalModuleReference = 265, - JsxElement = 266, - JsxSelfClosingElement = 267, - JsxOpeningElement = 268, - JsxClosingElement = 269, - JsxFragment = 270, - JsxOpeningFragment = 271, - JsxClosingFragment = 272, - JsxAttribute = 273, - JsxAttributes = 274, - JsxSpreadAttribute = 275, - JsxExpression = 276, - CaseClause = 277, - DefaultClause = 278, - HeritageClause = 279, - CatchClause = 280, - PropertyAssignment = 281, - ShorthandPropertyAssignment = 282, - SpreadAssignment = 283, - EnumMember = 284, - UnparsedPrologue = 285, - UnparsedPrepend = 286, - UnparsedText = 287, - UnparsedInternalText = 288, - UnparsedSyntheticReference = 289, - SourceFile = 290, - Bundle = 291, - UnparsedSource = 292, - InputFiles = 293, - JSDocTypeExpression = 294, - JSDocAllType = 295, - JSDocUnknownType = 296, - JSDocNullableType = 297, - JSDocNonNullableType = 298, - JSDocOptionalType = 299, - JSDocFunctionType = 300, - JSDocVariadicType = 301, - JSDocNamepathType = 302, - JSDocComment = 303, - JSDocTypeLiteral = 304, - JSDocSignature = 305, - JSDocTag = 306, - JSDocAugmentsTag = 307, - JSDocImplementsTag = 308, - JSDocAuthorTag = 309, - JSDocClassTag = 310, - JSDocPublicTag = 311, - JSDocPrivateTag = 312, - JSDocProtectedTag = 313, - JSDocReadonlyTag = 314, - JSDocCallbackTag = 315, - JSDocEnumTag = 316, - JSDocParameterTag = 317, - JSDocReturnTag = 318, - JSDocThisTag = 319, - JSDocTypeTag = 320, - JSDocTemplateTag = 321, - JSDocTypedefTag = 322, - JSDocPropertyTag = 323, - SyntaxList = 324, - NotEmittedStatement = 325, - PartiallyEmittedExpression = 326, - CommaListExpression = 327, - MergeDeclarationMarker = 328, - EndOfDeclarationMarker = 329, - SyntheticReferenceExpression = 330, - Count = 331, + NamedTupleMember = 188, + ImportType = 189, + ObjectBindingPattern = 190, + ArrayBindingPattern = 191, + BindingElement = 192, + ArrayLiteralExpression = 193, + ObjectLiteralExpression = 194, + PropertyAccessExpression = 195, + ElementAccessExpression = 196, + CallExpression = 197, + NewExpression = 198, + TaggedTemplateExpression = 199, + TypeAssertionExpression = 200, + ParenthesizedExpression = 201, + FunctionExpression = 202, + ArrowFunction = 203, + DeleteExpression = 204, + TypeOfExpression = 205, + VoidExpression = 206, + AwaitExpression = 207, + PrefixUnaryExpression = 208, + PostfixUnaryExpression = 209, + BinaryExpression = 210, + ConditionalExpression = 211, + TemplateExpression = 212, + YieldExpression = 213, + SpreadElement = 214, + ClassExpression = 215, + OmittedExpression = 216, + ExpressionWithTypeArguments = 217, + AsExpression = 218, + NonNullExpression = 219, + MetaProperty = 220, + SyntheticExpression = 221, + TemplateSpan = 222, + SemicolonClassElement = 223, + Block = 224, + EmptyStatement = 225, + VariableStatement = 226, + ExpressionStatement = 227, + IfStatement = 228, + DoStatement = 229, + WhileStatement = 230, + ForStatement = 231, + ForInStatement = 232, + ForOfStatement = 233, + ContinueStatement = 234, + BreakStatement = 235, + ReturnStatement = 236, + WithStatement = 237, + SwitchStatement = 238, + LabeledStatement = 239, + ThrowStatement = 240, + TryStatement = 241, + DebuggerStatement = 242, + VariableDeclaration = 243, + VariableDeclarationList = 244, + FunctionDeclaration = 245, + ClassDeclaration = 246, + InterfaceDeclaration = 247, + TypeAliasDeclaration = 248, + EnumDeclaration = 249, + ModuleDeclaration = 250, + ModuleBlock = 251, + CaseBlock = 252, + NamespaceExportDeclaration = 253, + ImportEqualsDeclaration = 254, + ImportDeclaration = 255, + ImportClause = 256, + NamespaceImport = 257, + NamedImports = 258, + ImportSpecifier = 259, + ExportAssignment = 260, + ExportDeclaration = 261, + NamedExports = 262, + NamespaceExport = 263, + ExportSpecifier = 264, + MissingDeclaration = 265, + ExternalModuleReference = 266, + JsxElement = 267, + JsxSelfClosingElement = 268, + JsxOpeningElement = 269, + JsxClosingElement = 270, + JsxFragment = 271, + JsxOpeningFragment = 272, + JsxClosingFragment = 273, + JsxAttribute = 274, + JsxAttributes = 275, + JsxSpreadAttribute = 276, + JsxExpression = 277, + CaseClause = 278, + DefaultClause = 279, + HeritageClause = 280, + CatchClause = 281, + PropertyAssignment = 282, + ShorthandPropertyAssignment = 283, + SpreadAssignment = 284, + EnumMember = 285, + UnparsedPrologue = 286, + UnparsedPrepend = 287, + UnparsedText = 288, + UnparsedInternalText = 289, + UnparsedSyntheticReference = 290, + SourceFile = 291, + Bundle = 292, + UnparsedSource = 293, + InputFiles = 294, + JSDocTypeExpression = 295, + JSDocAllType = 296, + JSDocUnknownType = 297, + JSDocNullableType = 298, + JSDocNonNullableType = 299, + JSDocOptionalType = 300, + JSDocFunctionType = 301, + JSDocVariadicType = 302, + JSDocNamepathType = 303, + JSDocComment = 304, + JSDocTypeLiteral = 305, + JSDocSignature = 306, + JSDocTag = 307, + JSDocAugmentsTag = 308, + JSDocImplementsTag = 309, + JSDocAuthorTag = 310, + JSDocClassTag = 311, + JSDocPublicTag = 312, + JSDocPrivateTag = 313, + JSDocProtectedTag = 314, + JSDocReadonlyTag = 315, + JSDocCallbackTag = 316, + JSDocEnumTag = 317, + JSDocParameterTag = 318, + JSDocReturnTag = 319, + JSDocThisTag = 320, + JSDocTypeTag = 321, + JSDocTemplateTag = 322, + JSDocTypedefTag = 323, + JSDocPropertyTag = 324, + SyntaxList = 325, + NotEmittedStatement = 326, + PartiallyEmittedExpression = 327, + CommaListExpression = 328, + MergeDeclarationMarker = 329, + EndOfDeclarationMarker = 330, + SyntheticReferenceExpression = 331, + Count = 332, FirstAssignment = 62, LastAssignment = 74, FirstCompoundAssignment = 63, @@ -418,7 +419,7 @@ declare namespace ts { FirstFutureReservedWord = 113, LastFutureReservedWord = 121, FirstTypeNode = 168, - LastTypeNode = 188, + LastTypeNode = 189, FirstPunctuation = 18, LastPunctuation = 74, FirstToken = 0, @@ -431,13 +432,13 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 74, - FirstStatement = 225, - LastStatement = 241, + FirstStatement = 226, + LastStatement = 242, FirstNode = 153, - FirstJSDocNode = 294, - LastJSDocNode = 323, - FirstJSDocTagNode = 306, - LastJSDocTagNode = 323, + FirstJSDocNode = 295, + LastJSDocNode = 324, + FirstJSDocTagNode = 307, + LastJSDocTagNode = 324, } export enum NodeFlags { None = 0, @@ -482,6 +483,7 @@ declare namespace ts { Async = 256, Default = 512, Const = 2048, + HasComputedJSDocModifiers = 4096, HasComputedFlags = 536870912, AccessibilityModifier = 28, ParameterPropertyModifier = 92, @@ -507,7 +509,7 @@ declare namespace ts { } export interface JSDocContainer { } - export type HasJSDoc = ParameterDeclaration | CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | PropertySignature | ArrowFunction | ParenthesizedExpression | SpreadAssignment | ShorthandPropertyAssignment | PropertyAssignment | FunctionExpression | LabeledStatement | ExpressionStatement | VariableStatement | FunctionDeclaration | ConstructorDeclaration | MethodDeclaration | PropertyDeclaration | AccessorDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumMember | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration | EndOfFileToken; + export type HasJSDoc = ParameterDeclaration | CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | PropertySignature | ArrowFunction | ParenthesizedExpression | SpreadAssignment | ShorthandPropertyAssignment | PropertyAssignment | FunctionExpression | LabeledStatement | ExpressionStatement | VariableStatement | FunctionDeclaration | ConstructorDeclaration | MethodDeclaration | PropertyDeclaration | AccessorDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumMember | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration | NamedTupleMember | EndOfFileToken; export type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType; export type HasTypeArguments = CallExpression | NewExpression | TaggedTemplateExpression | JsxOpeningElement | JsxSelfClosingElement; export type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute; @@ -808,7 +810,14 @@ declare namespace ts { } export interface TupleTypeNode extends TypeNode { kind: SyntaxKind.TupleType; - elementTypes: NodeArray; + elements: NodeArray; + } + export interface NamedTupleMember extends TypeNode, JSDocContainer, Declaration { + kind: SyntaxKind.NamedTupleMember; + dotDotDotToken?: Token; + name: Identifier; + questionToken?: Token; + type: TypeNode; } export interface OptionalTypeNode extends TypeNode { kind: SyntaxKind.OptionalType; @@ -946,6 +955,7 @@ declare namespace ts { kind: SyntaxKind.SyntheticExpression; isSpread: boolean; type: Type; + tupleNameSource?: ParameterDeclaration | NamedTupleMember; } export type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken; export type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken; @@ -1577,6 +1587,7 @@ declare namespace ts { text: string; pos: -1; end: -1; + hasLeadingNewline?: boolean; } export interface JSDocTypeExpression extends TypeNode { kind: SyntaxKind.JSDocTypeExpression; @@ -1742,21 +1753,11 @@ declare namespace ts { Label = 12, Condition = 96 } - export type FlowNode = AfterFinallyFlow | PreFinallyFlow | FlowStart | FlowLabel | FlowAssignment | FlowCall | FlowCondition | FlowSwitchClause | FlowArrayMutation; + export type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCall | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel; export interface FlowNodeBase { flags: FlowFlags; id?: number; } - export interface FlowLock { - locked?: boolean; - } - export interface AfterFinallyFlow extends FlowNodeBase, FlowLock { - antecedent: FlowNode; - } - export interface PreFinallyFlow extends FlowNodeBase { - antecedent: FlowNode; - lock: FlowLock; - } export interface FlowStart extends FlowNodeBase { node?: FunctionExpression | ArrowFunction | MethodDeclaration; } @@ -2475,7 +2476,7 @@ declare namespace ts { minLength: number; hasRestElement: boolean; readonly: boolean; - associatedNames?: __String[]; + labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]; } export interface TupleTypeReference extends TypeReference { target: TupleType; @@ -3232,7 +3233,8 @@ declare namespace ts { HeritageClauses = 512, SingleLineTypeLiteralMembers = 768, MultiLineTypeLiteralMembers = 32897, - TupleTypeElements = 528, + SingleLineTupleTypeElements = 528, + MultiLineTupleTypeElements = 657, UnionTypeConstituents = 516, IntersectionTypeConstituents = 520, ObjectBindingPatternElements = 525136, @@ -4052,8 +4054,8 @@ declare namespace ts { function updateTypeLiteralNode(node: TypeLiteralNode, members: NodeArray): TypeLiteralNode; function createArrayTypeNode(elementType: TypeNode): ArrayTypeNode; function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; - function createTupleTypeNode(elementTypes: readonly TypeNode[]): TupleTypeNode; - function updateTupleTypeNode(node: TupleTypeNode, elementTypes: readonly TypeNode[]): TupleTypeNode; + function createTupleTypeNode(elements: readonly (TypeNode | NamedTupleMember)[]): TupleTypeNode; + function updateTupleTypeNode(node: TupleTypeNode, elements: readonly (TypeNode | NamedTupleMember)[]): TupleTypeNode; function createOptionalTypeNode(type: TypeNode): OptionalTypeNode; function updateOptionalTypeNode(node: OptionalTypeNode, type: TypeNode): OptionalTypeNode; function createRestTypeNode(type: TypeNode): RestTypeNode; @@ -4071,6 +4073,8 @@ declare namespace ts { function updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; function createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; + function createNamedTupleMember(dotDotDotToken: Token | undefined, name: Identifier, questionToken: Token | undefined, type: TypeNode): NamedTupleMember; + function updateNamedTupleMember(node: NamedTupleMember, dotDotDotToken: Token | undefined, name: Identifier, questionToken: Token | undefined, type: TypeNode): NamedTupleMember; function createThisTypeNode(): ThisTypeNode; function createTypeOperatorNode(type: TypeNode): TypeOperatorNode; function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword, type: TypeNode): TypeOperatorNode; diff --git a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.errors.txt b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.errors.txt deleted file mode 100644 index 6e2b7ef5787..00000000000 --- a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -tests/cases/compiler/captureSuperPropertyAccessInSuperCall01.ts(9,24): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. - - -==== tests/cases/compiler/captureSuperPropertyAccessInSuperCall01.ts (1 errors) ==== - class A { - constructor(f: () => string) { - } - public blah(): string { return ""; } - } - - class B extends A { - constructor() { - super(() => { return super.blah(); }) - ~~~~~ -!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. - } - } \ No newline at end of file diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccess.errors.txt b/tests/baselines/reference/checkSuperCallBeforeThisAccess.errors.txt new file mode 100644 index 00000000000..4b38d7146f4 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccess.errors.txt @@ -0,0 +1,123 @@ +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(7,18): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(8,18): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(9,18): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(20,22): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(21,22): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(22,22): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(30,30): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(39,22): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(43,18): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(44,18): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(45,18): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(59,27): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(75,27): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + + +==== tests/cases/compiler/checkSuperCallBeforeThisAccess.ts (13 errors) ==== + class A { + x = 1; + } + + class C1 extends A { + constructor(n: number) { + let a1 = this; // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + let a2 = this.x; // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + let a3 = super.x; // Error + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + let a4 = () => this; + let a5 = () => this.x; + let a6 = () => super.x; + if (!!true) { + super(); + let b1 = this; + let b2 = this.x; + let b3 = super.x; + } + else { + let c1 = this; // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + let c2 = this.x; // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + let c3 = super.x; // Error + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + } + if (!!true) { + switch (n) { + case 1: + super(); + let d1 = this.x; + case 2: + let d2 = this.x; // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + default: + super(); + let d3 = this.x; + } + let d4 = this.x; + } + if (!!true) { + let e1 = { w: !!true ? super() : 0 }; + let e2 = this.x; // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + let e3 = { w: !!true ? super() : super() }; + let e4 = this.x; + } + let f1 = this; // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + let f2 = this.x; // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + let f3 = super.x; // Error + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + } + } + + // Repro from #38512 + + export class Foo { + constructor(value: number) { + } + } + + export class BarCorrectlyFails extends Foo { + constructor(something: boolean) { + if (!something) { + const value = this.bar(); // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + super(value); + } + else { + super(1337); + } + } + bar(): number { return 4; } + } + + export class BarIncorrectlyWorks extends Foo { + constructor(something: boolean) { + if (something) { + super(1337); + } + else { + const value = this.bar(); // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + super(value); + } + } + bar(): number { return 4; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccess.js b/tests/baselines/reference/checkSuperCallBeforeThisAccess.js new file mode 100644 index 00000000000..0bd17ed4fa3 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccess.js @@ -0,0 +1,161 @@ +//// [checkSuperCallBeforeThisAccess.ts] +class A { + x = 1; +} + +class C1 extends A { + constructor(n: number) { + let a1 = this; // Error + let a2 = this.x; // Error + let a3 = super.x; // Error + let a4 = () => this; + let a5 = () => this.x; + let a6 = () => super.x; + if (!!true) { + super(); + let b1 = this; + let b2 = this.x; + let b3 = super.x; + } + else { + let c1 = this; // Error + let c2 = this.x; // Error + let c3 = super.x; // Error + } + if (!!true) { + switch (n) { + case 1: + super(); + let d1 = this.x; + case 2: + let d2 = this.x; // Error + default: + super(); + let d3 = this.x; + } + let d4 = this.x; + } + if (!!true) { + let e1 = { w: !!true ? super() : 0 }; + let e2 = this.x; // Error + let e3 = { w: !!true ? super() : super() }; + let e4 = this.x; + } + let f1 = this; // Error + let f2 = this.x; // Error + let f3 = super.x; // Error + } +} + +// Repro from #38512 + +export class Foo { + constructor(value: number) { + } +} + +export class BarCorrectlyFails extends Foo { + constructor(something: boolean) { + if (!something) { + const value = this.bar(); // Error + super(value); + } + else { + super(1337); + } + } + bar(): number { return 4; } +} + +export class BarIncorrectlyWorks extends Foo { + constructor(something: boolean) { + if (something) { + super(1337); + } + else { + const value = this.bar(); // Error + super(value); + } + } + bar(): number { return 4; } +} + + +//// [checkSuperCallBeforeThisAccess.js] +class A { + constructor() { + this.x = 1; + } +} +class C1 extends A { + constructor(n) { + let a1 = this; // Error + let a2 = this.x; // Error + let a3 = super.x; // Error + let a4 = () => this; + let a5 = () => this.x; + let a6 = () => super.x; + if (!!true) { + super(); + let b1 = this; + let b2 = this.x; + let b3 = super.x; + } + else { + let c1 = this; // Error + let c2 = this.x; // Error + let c3 = super.x; // Error + } + if (!!true) { + switch (n) { + case 1: + super(); + let d1 = this.x; + case 2: + let d2 = this.x; // Error + default: + super(); + let d3 = this.x; + } + let d4 = this.x; + } + if (!!true) { + let e1 = { w: !!true ? super() : 0 }; + let e2 = this.x; // Error + let e3 = { w: !!true ? super() : super() }; + let e4 = this.x; + } + let f1 = this; // Error + let f2 = this.x; // Error + let f3 = super.x; // Error + } +} +// Repro from #38512 +export class Foo { + constructor(value) { + } +} +export class BarCorrectlyFails extends Foo { + constructor(something) { + if (!something) { + const value = this.bar(); // Error + super(value); + } + else { + super(1337); + } + } + bar() { return 4; } +} +export class BarIncorrectlyWorks extends Foo { + constructor(something) { + if (something) { + super(1337); + } + else { + const value = this.bar(); // Error + super(value); + } + } + bar() { return 4; } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccess.symbols b/tests/baselines/reference/checkSuperCallBeforeThisAccess.symbols new file mode 100644 index 00000000000..fbf9bb9d1a5 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccess.symbols @@ -0,0 +1,231 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccess.ts === +class A { +>A : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) + + x = 1; +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +} + +class C1 extends A { +>C1 : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>A : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) + + constructor(n: number) { +>n : Symbol(n, Decl(checkSuperCallBeforeThisAccess.ts, 5, 16)) + + let a1 = this; // Error +>a1 : Symbol(a1, Decl(checkSuperCallBeforeThisAccess.ts, 6, 11)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) + + let a2 = this.x; // Error +>a2 : Symbol(a2, Decl(checkSuperCallBeforeThisAccess.ts, 7, 11)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + + let a3 = super.x; // Error +>a3 : Symbol(a3, Decl(checkSuperCallBeforeThisAccess.ts, 8, 11)) +>super.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + + let a4 = () => this; +>a4 : Symbol(a4, Decl(checkSuperCallBeforeThisAccess.ts, 9, 11)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) + + let a5 = () => this.x; +>a5 : Symbol(a5, Decl(checkSuperCallBeforeThisAccess.ts, 10, 11)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + + let a6 = () => super.x; +>a6 : Symbol(a6, Decl(checkSuperCallBeforeThisAccess.ts, 11, 11)) +>super.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + + if (!!true) { + super(); +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) + + let b1 = this; +>b1 : Symbol(b1, Decl(checkSuperCallBeforeThisAccess.ts, 14, 15)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) + + let b2 = this.x; +>b2 : Symbol(b2, Decl(checkSuperCallBeforeThisAccess.ts, 15, 15)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + + let b3 = super.x; +>b3 : Symbol(b3, Decl(checkSuperCallBeforeThisAccess.ts, 16, 15)) +>super.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + } + else { + let c1 = this; // Error +>c1 : Symbol(c1, Decl(checkSuperCallBeforeThisAccess.ts, 19, 15)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) + + let c2 = this.x; // Error +>c2 : Symbol(c2, Decl(checkSuperCallBeforeThisAccess.ts, 20, 15)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + + let c3 = super.x; // Error +>c3 : Symbol(c3, Decl(checkSuperCallBeforeThisAccess.ts, 21, 15)) +>super.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + } + if (!!true) { + switch (n) { +>n : Symbol(n, Decl(checkSuperCallBeforeThisAccess.ts, 5, 16)) + + case 1: + super(); +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) + + let d1 = this.x; +>d1 : Symbol(d1, Decl(checkSuperCallBeforeThisAccess.ts, 27, 23)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + + case 2: + let d2 = this.x; // Error +>d2 : Symbol(d2, Decl(checkSuperCallBeforeThisAccess.ts, 29, 23)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + + default: + super(); +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) + + let d3 = this.x; +>d3 : Symbol(d3, Decl(checkSuperCallBeforeThisAccess.ts, 32, 23)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + } + let d4 = this.x; +>d4 : Symbol(d4, Decl(checkSuperCallBeforeThisAccess.ts, 34, 15)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + } + if (!!true) { + let e1 = { w: !!true ? super() : 0 }; +>e1 : Symbol(e1, Decl(checkSuperCallBeforeThisAccess.ts, 37, 15)) +>w : Symbol(w, Decl(checkSuperCallBeforeThisAccess.ts, 37, 22)) +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) + + let e2 = this.x; // Error +>e2 : Symbol(e2, Decl(checkSuperCallBeforeThisAccess.ts, 38, 15)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + + let e3 = { w: !!true ? super() : super() }; +>e3 : Symbol(e3, Decl(checkSuperCallBeforeThisAccess.ts, 39, 15)) +>w : Symbol(w, Decl(checkSuperCallBeforeThisAccess.ts, 39, 22)) +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) + + let e4 = this.x; +>e4 : Symbol(e4, Decl(checkSuperCallBeforeThisAccess.ts, 40, 15)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + } + let f1 = this; // Error +>f1 : Symbol(f1, Decl(checkSuperCallBeforeThisAccess.ts, 42, 11)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) + + let f2 = this.x; // Error +>f2 : Symbol(f2, Decl(checkSuperCallBeforeThisAccess.ts, 43, 11)) +>this.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>this : Symbol(C1, Decl(checkSuperCallBeforeThisAccess.ts, 2, 1)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + + let f3 = super.x; // Error +>f3 : Symbol(f3, Decl(checkSuperCallBeforeThisAccess.ts, 44, 11)) +>super.x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) +>super : Symbol(A, Decl(checkSuperCallBeforeThisAccess.ts, 0, 0)) +>x : Symbol(A.x, Decl(checkSuperCallBeforeThisAccess.ts, 0, 9)) + } +} + +// Repro from #38512 + +export class Foo { +>Foo : Symbol(Foo, Decl(checkSuperCallBeforeThisAccess.ts, 46, 1)) + + constructor(value: number) { +>value : Symbol(value, Decl(checkSuperCallBeforeThisAccess.ts, 51, 16)) + } +} + +export class BarCorrectlyFails extends Foo { +>BarCorrectlyFails : Symbol(BarCorrectlyFails, Decl(checkSuperCallBeforeThisAccess.ts, 53, 1)) +>Foo : Symbol(Foo, Decl(checkSuperCallBeforeThisAccess.ts, 46, 1)) + + constructor(something: boolean) { +>something : Symbol(something, Decl(checkSuperCallBeforeThisAccess.ts, 56, 16)) + + if (!something) { +>something : Symbol(something, Decl(checkSuperCallBeforeThisAccess.ts, 56, 16)) + + const value = this.bar(); // Error +>value : Symbol(value, Decl(checkSuperCallBeforeThisAccess.ts, 58, 17)) +>this.bar : Symbol(BarCorrectlyFails.bar, Decl(checkSuperCallBeforeThisAccess.ts, 64, 5)) +>this : Symbol(BarCorrectlyFails, Decl(checkSuperCallBeforeThisAccess.ts, 53, 1)) +>bar : Symbol(BarCorrectlyFails.bar, Decl(checkSuperCallBeforeThisAccess.ts, 64, 5)) + + super(value); +>super : Symbol(Foo, Decl(checkSuperCallBeforeThisAccess.ts, 46, 1)) +>value : Symbol(value, Decl(checkSuperCallBeforeThisAccess.ts, 58, 17)) + } + else { + super(1337); +>super : Symbol(Foo, Decl(checkSuperCallBeforeThisAccess.ts, 46, 1)) + } + } + bar(): number { return 4; } +>bar : Symbol(BarCorrectlyFails.bar, Decl(checkSuperCallBeforeThisAccess.ts, 64, 5)) +} + +export class BarIncorrectlyWorks extends Foo { +>BarIncorrectlyWorks : Symbol(BarIncorrectlyWorks, Decl(checkSuperCallBeforeThisAccess.ts, 66, 1)) +>Foo : Symbol(Foo, Decl(checkSuperCallBeforeThisAccess.ts, 46, 1)) + + constructor(something: boolean) { +>something : Symbol(something, Decl(checkSuperCallBeforeThisAccess.ts, 69, 16)) + + if (something) { +>something : Symbol(something, Decl(checkSuperCallBeforeThisAccess.ts, 69, 16)) + + super(1337); +>super : Symbol(Foo, Decl(checkSuperCallBeforeThisAccess.ts, 46, 1)) + } + else { + const value = this.bar(); // Error +>value : Symbol(value, Decl(checkSuperCallBeforeThisAccess.ts, 74, 17)) +>this.bar : Symbol(BarIncorrectlyWorks.bar, Decl(checkSuperCallBeforeThisAccess.ts, 77, 5)) +>this : Symbol(BarIncorrectlyWorks, Decl(checkSuperCallBeforeThisAccess.ts, 66, 1)) +>bar : Symbol(BarIncorrectlyWorks.bar, Decl(checkSuperCallBeforeThisAccess.ts, 77, 5)) + + super(value); +>super : Symbol(Foo, Decl(checkSuperCallBeforeThisAccess.ts, 46, 1)) +>value : Symbol(value, Decl(checkSuperCallBeforeThisAccess.ts, 74, 17)) + } + } + bar(): number { return 4; } +>bar : Symbol(BarIncorrectlyWorks.bar, Decl(checkSuperCallBeforeThisAccess.ts, 77, 5)) +} + diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccess.types b/tests/baselines/reference/checkSuperCallBeforeThisAccess.types new file mode 100644 index 00000000000..7a6914107f2 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccess.types @@ -0,0 +1,279 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccess.ts === +class A { +>A : A + + x = 1; +>x : number +>1 : 1 +} + +class C1 extends A { +>C1 : C1 +>A : A + + constructor(n: number) { +>n : number + + let a1 = this; // Error +>a1 : this +>this : this + + let a2 = this.x; // Error +>a2 : number +>this.x : number +>this : this +>x : number + + let a3 = super.x; // Error +>a3 : number +>super.x : number +>super : A +>x : number + + let a4 = () => this; +>a4 : () => this +>() => this : () => this +>this : this + + let a5 = () => this.x; +>a5 : () => number +>() => this.x : () => number +>this.x : number +>this : this +>x : number + + let a6 = () => super.x; +>a6 : () => number +>() => super.x : () => number +>super.x : number +>super : A +>x : number + + if (!!true) { +>!!true : true +>!true : false +>true : true + + super(); +>super() : void +>super : typeof A + + let b1 = this; +>b1 : this +>this : this + + let b2 = this.x; +>b2 : number +>this.x : number +>this : this +>x : number + + let b3 = super.x; +>b3 : number +>super.x : number +>super : A +>x : number + } + else { + let c1 = this; // Error +>c1 : this +>this : this + + let c2 = this.x; // Error +>c2 : number +>this.x : number +>this : this +>x : number + + let c3 = super.x; // Error +>c3 : number +>super.x : number +>super : A +>x : number + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + switch (n) { +>n : number + + case 1: +>1 : 1 + + super(); +>super() : void +>super : typeof A + + let d1 = this.x; +>d1 : number +>this.x : number +>this : this +>x : number + + case 2: +>2 : 2 + + let d2 = this.x; // Error +>d2 : number +>this.x : number +>this : this +>x : number + + default: + super(); +>super() : void +>super : typeof A + + let d3 = this.x; +>d3 : number +>this.x : number +>this : this +>x : number + } + let d4 = this.x; +>d4 : number +>this.x : number +>this : this +>x : number + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + let e1 = { w: !!true ? super() : 0 }; +>e1 : { w: number | void; } +>{ w: !!true ? super() : 0 } : { w: number | void; } +>w : number | void +>!!true ? super() : 0 : void | 0 +>!!true : true +>!true : false +>true : true +>super() : void +>super : typeof A +>0 : 0 + + let e2 = this.x; // Error +>e2 : number +>this.x : number +>this : this +>x : number + + let e3 = { w: !!true ? super() : super() }; +>e3 : { w: void; } +>{ w: !!true ? super() : super() } : { w: void; } +>w : void +>!!true ? super() : super() : void +>!!true : true +>!true : false +>true : true +>super() : void +>super : typeof A +>super() : void +>super : typeof A + + let e4 = this.x; +>e4 : number +>this.x : number +>this : this +>x : number + } + let f1 = this; // Error +>f1 : this +>this : this + + let f2 = this.x; // Error +>f2 : number +>this.x : number +>this : this +>x : number + + let f3 = super.x; // Error +>f3 : number +>super.x : number +>super : A +>x : number + } +} + +// Repro from #38512 + +export class Foo { +>Foo : Foo + + constructor(value: number) { +>value : number + } +} + +export class BarCorrectlyFails extends Foo { +>BarCorrectlyFails : BarCorrectlyFails +>Foo : Foo + + constructor(something: boolean) { +>something : boolean + + if (!something) { +>!something : boolean +>something : boolean + + const value = this.bar(); // Error +>value : number +>this.bar() : number +>this.bar : () => number +>this : this +>bar : () => number + + super(value); +>super(value) : void +>super : typeof Foo +>value : number + } + else { + super(1337); +>super(1337) : void +>super : typeof Foo +>1337 : 1337 + } + } + bar(): number { return 4; } +>bar : () => number +>4 : 4 +} + +export class BarIncorrectlyWorks extends Foo { +>BarIncorrectlyWorks : BarIncorrectlyWorks +>Foo : Foo + + constructor(something: boolean) { +>something : boolean + + if (something) { +>something : boolean + + super(1337); +>super(1337) : void +>super : typeof Foo +>1337 : 1337 + } + else { + const value = this.bar(); // Error +>value : number +>this.bar() : number +>this.bar : () => number +>this : this +>bar : () => number + + super(value); +>super(value) : void +>super : typeof Foo +>value : number + } + } + bar(): number { return 4; } +>bar : () => number +>4 : 4 +} + diff --git a/tests/baselines/reference/circularContextualMappedType.js b/tests/baselines/reference/circularContextualMappedType.js new file mode 100644 index 00000000000..7bd989c843a --- /dev/null +++ b/tests/baselines/reference/circularContextualMappedType.js @@ -0,0 +1,32 @@ +//// [circularContextualMappedType.ts] +type Func = () => T; + +type Mapped = { [K in keyof T]: Func }; + +declare function reproduce(options: number): void; +declare function reproduce(options: Mapped): T + +reproduce({ + name: () => { return 123 } +}); + +reproduce({ + name() { return 123 } +}); + +reproduce({ + name: function () { return 123 } +}); + + +//// [circularContextualMappedType.js] +"use strict"; +reproduce({ + name: function () { return 123; } +}); +reproduce({ + name: function () { return 123; } +}); +reproduce({ + name: function () { return 123; } +}); diff --git a/tests/baselines/reference/circularContextualMappedType.symbols b/tests/baselines/reference/circularContextualMappedType.symbols new file mode 100644 index 00000000000..445906d48c1 --- /dev/null +++ b/tests/baselines/reference/circularContextualMappedType.symbols @@ -0,0 +1,51 @@ +=== tests/cases/compiler/circularContextualMappedType.ts === +type Func = () => T; +>Func : Symbol(Func, Decl(circularContextualMappedType.ts, 0, 0)) +>T : Symbol(T, Decl(circularContextualMappedType.ts, 0, 10)) +>T : Symbol(T, Decl(circularContextualMappedType.ts, 0, 10)) + +type Mapped = { [K in keyof T]: Func }; +>Mapped : Symbol(Mapped, Decl(circularContextualMappedType.ts, 0, 23)) +>T : Symbol(T, Decl(circularContextualMappedType.ts, 2, 12)) +>K : Symbol(K, Decl(circularContextualMappedType.ts, 2, 20)) +>T : Symbol(T, Decl(circularContextualMappedType.ts, 2, 12)) +>Func : Symbol(Func, Decl(circularContextualMappedType.ts, 0, 0)) +>T : Symbol(T, Decl(circularContextualMappedType.ts, 2, 12)) +>K : Symbol(K, Decl(circularContextualMappedType.ts, 2, 20)) + +declare function reproduce(options: number): void; +>reproduce : Symbol(reproduce, Decl(circularContextualMappedType.ts, 2, 48), Decl(circularContextualMappedType.ts, 4, 50)) +>options : Symbol(options, Decl(circularContextualMappedType.ts, 4, 27)) + +declare function reproduce(options: Mapped): T +>reproduce : Symbol(reproduce, Decl(circularContextualMappedType.ts, 2, 48), Decl(circularContextualMappedType.ts, 4, 50)) +>T : Symbol(T, Decl(circularContextualMappedType.ts, 5, 27)) +>options : Symbol(options, Decl(circularContextualMappedType.ts, 5, 30)) +>Mapped : Symbol(Mapped, Decl(circularContextualMappedType.ts, 0, 23)) +>T : Symbol(T, Decl(circularContextualMappedType.ts, 5, 27)) +>T : Symbol(T, Decl(circularContextualMappedType.ts, 5, 27)) + +reproduce({ +>reproduce : Symbol(reproduce, Decl(circularContextualMappedType.ts, 2, 48), Decl(circularContextualMappedType.ts, 4, 50)) + + name: () => { return 123 } +>name : Symbol(name, Decl(circularContextualMappedType.ts, 7, 11)) + +}); + +reproduce({ +>reproduce : Symbol(reproduce, Decl(circularContextualMappedType.ts, 2, 48), Decl(circularContextualMappedType.ts, 4, 50)) + + name() { return 123 } +>name : Symbol(name, Decl(circularContextualMappedType.ts, 11, 11)) + +}); + +reproduce({ +>reproduce : Symbol(reproduce, Decl(circularContextualMappedType.ts, 2, 48), Decl(circularContextualMappedType.ts, 4, 50)) + + name: function () { return 123 } +>name : Symbol(name, Decl(circularContextualMappedType.ts, 15, 11)) + +}); + diff --git a/tests/baselines/reference/circularContextualMappedType.types b/tests/baselines/reference/circularContextualMappedType.types new file mode 100644 index 00000000000..d9439215d28 --- /dev/null +++ b/tests/baselines/reference/circularContextualMappedType.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/circularContextualMappedType.ts === +type Func = () => T; +>Func : Func + +type Mapped = { [K in keyof T]: Func }; +>Mapped : Mapped + +declare function reproduce(options: number): void; +>reproduce : { (options: number): void; (options: Mapped): T; } +>options : number + +declare function reproduce(options: Mapped): T +>reproduce : { (options: number): void; (options: Mapped): T; } +>options : Mapped + +reproduce({ +>reproduce({ name: () => { return 123 }}) : { name: number; } +>reproduce : { (options: number): void; (options: Mapped): T; } +>{ name: () => { return 123 }} : { name: () => number; } + + name: () => { return 123 } +>name : () => number +>() => { return 123 } : () => number +>123 : 123 + +}); + +reproduce({ +>reproduce({ name() { return 123 }}) : { name: number; } +>reproduce : { (options: number): void; (options: Mapped): T; } +>{ name() { return 123 }} : { name(): number; } + + name() { return 123 } +>name : () => number +>123 : 123 + +}); + +reproduce({ +>reproduce({ name: function () { return 123 }}) : { name: number; } +>reproduce : { (options: number): void; (options: Mapped): T; } +>{ name: function () { return 123 }} : { name: () => number; } + + name: function () { return 123 } +>name : () => number +>function () { return 123 } : () => number +>123 : 123 + +}); + diff --git a/tests/baselines/reference/declarationEmitAliasExportStar.js b/tests/baselines/reference/declarationEmitAliasExportStar.js index e4dc99a7074..8cd03b75e7c 100644 --- a/tests/baselines/reference/declarationEmitAliasExportStar.js +++ b/tests/baselines/reference/declarationEmitAliasExportStar.js @@ -23,7 +23,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./thingB"), exports); //// [index.js] diff --git a/tests/baselines/reference/declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.js b/tests/baselines/reference/declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.js index 8f147063de0..1e6e0c58f64 100644 --- a/tests/baselines/reference/declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.js +++ b/tests/baselines/reference/declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.js @@ -66,7 +66,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("@emotion/core"), exports); diff --git a/tests/baselines/reference/declarationEmitReexportedSymlinkReference.js b/tests/baselines/reference/declarationEmitReexportedSymlinkReference.js index 930ab97bfec..99ad86960e2 100644 --- a/tests/baselines/reference/declarationEmitReexportedSymlinkReference.js +++ b/tests/baselines/reference/declarationEmitReexportedSymlinkReference.js @@ -60,7 +60,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./keys"), exports); diff --git a/tests/baselines/reference/declarationEmitReexportedSymlinkReference2.js b/tests/baselines/reference/declarationEmitReexportedSymlinkReference2.js index ccda718f60c..50c0ddb6f96 100644 --- a/tests/baselines/reference/declarationEmitReexportedSymlinkReference2.js +++ b/tests/baselines/reference/declarationEmitReexportedSymlinkReference2.js @@ -63,7 +63,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./keys"), exports); diff --git a/tests/baselines/reference/declarationEmitReexportedSymlinkReference3.js b/tests/baselines/reference/declarationEmitReexportedSymlinkReference3.js index 3f27689c985..f83c0e0daf3 100644 --- a/tests/baselines/reference/declarationEmitReexportedSymlinkReference3.js +++ b/tests/baselines/reference/declarationEmitReexportedSymlinkReference3.js @@ -60,7 +60,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./keys"), exports); diff --git a/tests/baselines/reference/docker/vue-next.log b/tests/baselines/reference/docker/vue-next.log index 96c3e8730f4..9187c7c5d17 100644 --- a/tests/baselines/reference/docker/vue-next.log +++ b/tests/baselines/reference/docker/vue-next.log @@ -1,7 +1,7 @@ Exit Code: 0 Standard output: -> @X.X.X-beta.10 build /vue-next +> @X.X.X-beta.12 build /vue-next > node scripts/build.js "--types" Rolling up type definitions for compiler-core... Writing: /vue-next/temp/compiler-core.api.json @@ -106,16 +106,16 @@ created packages/reactivity/dist/reactivity.global.prod.js in ?s packages/runtime-core/src/apiInject.ts Error: /vue-next/packages/runtime-core/src/apiInject.ts(40,9): semantic error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. at error (/vue-next/node_modules/rollup/dist/shared/rollup.js:161:30) - at throwPluginError (/vue-next/node_modules/rollup/dist/shared/rollup.js:16925:12) - at Object.error (/vue-next/node_modules/rollup/dist/shared/rollup.js:17944:24) - at Object.error (/vue-next/node_modules/rollup/dist/shared/rollup.js:17098:38) + at throwPluginError (/vue-next/node_modules/rollup/dist/shared/rollup.js:16989:12) + at Object.error (/vue-next/node_modules/rollup/dist/shared/rollup.js:18021:24) + at Object.error (/vue-next/node_modules/rollup/dist/shared/rollup.js:17162:38) at RollupContext.error (/vue-next/node_modules/rollup-plugin-typescript2/src/rollupcontext.ts:37:18) at /vue-next/node_modules/rollup-plugin-typescript2/src/print-diagnostics.ts:41:11 at arrayEach (/vue-next/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:516:11) at forEach (/vue-next/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:9342:14) at _.each (/vue-next/node_modules/rollup-plugin-typescript2/src/print-diagnostics.ts:9:2) at Object.transform (/vue-next/node_modules/rollup-plugin-typescript2/src/index.ts:242:5) -(node:17) UnhandledPromiseRejectionWarning: Error: Command failed with exit code 1 (EPERM): rollup -c --environment COMMIT:b725b63,NODE_ENV:production,TARGET:runtime-core,TYPES:true +(node:18) UnhandledPromiseRejectionWarning: Error: Command failed with exit code 1 (EPERM): rollup -c --environment COMMIT:74ed7d1,NODE_ENV:production,TARGET:runtime-core,TYPES:true at makeError (/vue-next/node_modules/execa/lib/error.js:59:11) at handlePromise (/vue-next/node_modules/execa/index.js:112:26) at processTicksAndRejections (internal/process/task_queues.js:97:5) @@ -123,5 +123,5 @@ Error: /vue-next/packages/runtime-core/src/apiInject.ts(40,9): semantic error TS at async buildAll (/vue-next/scripts/build.js:50:5) at async run (/vue-next/scripts/build.js:40:5) (Use `node --trace-warnings ...` to show where the warning was created) -(node:17) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) -(node:17) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. +(node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) +(node:18) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. diff --git a/tests/baselines/reference/doubleUnderscoreExportStarConflict.js b/tests/baselines/reference/doubleUnderscoreExportStarConflict.js index a5d60f02159..3497051eb15 100644 --- a/tests/baselines/reference/doubleUnderscoreExportStarConflict.js +++ b/tests/baselines/reference/doubleUnderscoreExportStarConflict.js @@ -34,7 +34,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./b"), exports); __exportStar(require("./c"), exports); diff --git a/tests/baselines/reference/es6ExportAllInEs5.js b/tests/baselines/reference/es6ExportAllInEs5.js index 72ec47714d8..aaf14965eca 100644 --- a/tests/baselines/reference/es6ExportAllInEs5.js +++ b/tests/baselines/reference/es6ExportAllInEs5.js @@ -41,7 +41,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./server"), exports); diff --git a/tests/baselines/reference/es6ExportEqualsInterop.js b/tests/baselines/reference/es6ExportEqualsInterop.js index 6f24e91d8fd..9e0caded280 100644 --- a/tests/baselines/reference/es6ExportEqualsInterop.js +++ b/tests/baselines/reference/es6ExportEqualsInterop.js @@ -218,7 +218,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; var z2 = require("variable"); var z3 = require("interface-variable"); diff --git a/tests/baselines/reference/esModuleInteropWithExportStar(target=es3).js b/tests/baselines/reference/esModuleInteropWithExportStar(target=es3).js index 3db289c7f1a..de77e148cdf 100644 --- a/tests/baselines/reference/esModuleInteropWithExportStar(target=es3).js +++ b/tests/baselines/reference/esModuleInteropWithExportStar(target=es3).js @@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; var fs = __importStar(require("./fs")); fs; diff --git a/tests/baselines/reference/esModuleInteropWithExportStar(target=es5).js b/tests/baselines/reference/esModuleInteropWithExportStar(target=es5).js index 1ebde18e428..133a175e1ad 100644 --- a/tests/baselines/reference/esModuleInteropWithExportStar(target=es5).js +++ b/tests/baselines/reference/esModuleInteropWithExportStar(target=es5).js @@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); var fs = __importStar(require("./fs")); fs; diff --git a/tests/baselines/reference/exportNamespace1.js b/tests/baselines/reference/exportNamespace1.js index ff02a98707e..5631e6d8194 100644 --- a/tests/baselines/reference/exportNamespace1.js +++ b/tests/baselines/reference/exportNamespace1.js @@ -38,7 +38,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./b"), exports); //// [d.js] diff --git a/tests/baselines/reference/exportStar-amd.js b/tests/baselines/reference/exportStar-amd.js index a2a062a7501..3292a18294d 100644 --- a/tests/baselines/reference/exportStar-amd.js +++ b/tests/baselines/reference/exportStar-amd.js @@ -67,7 +67,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "./t1", "./t2", "./t3"], function (require, exports, t1_1, t2_1, t3_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/exportStar.js b/tests/baselines/reference/exportStar.js index bf65527a104..7d2cb9e1fe8 100644 --- a/tests/baselines/reference/exportStar.js +++ b/tests/baselines/reference/exportStar.js @@ -62,7 +62,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./t1"), exports); __exportStar(require("./t2"), exports); diff --git a/tests/baselines/reference/exportStarForValues.js b/tests/baselines/reference/exportStarForValues.js index 277b953d353..fad8c19a1c7 100644 --- a/tests/baselines/reference/exportStarForValues.js +++ b/tests/baselines/reference/exportStarForValues.js @@ -22,7 +22,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file1"], function (require, exports, file1_1) { "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/exportStarForValues2.js b/tests/baselines/reference/exportStarForValues2.js index 01ded620485..19c55f2ff84 100644 --- a/tests/baselines/reference/exportStarForValues2.js +++ b/tests/baselines/reference/exportStarForValues2.js @@ -26,7 +26,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file1"], function (require, exports, file1_1) { "use strict"; exports.__esModule = true; @@ -43,7 +43,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file2"], function (require, exports, file2_1) { "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/exportStarForValues3.js b/tests/baselines/reference/exportStarForValues3.js index e31102f3f7f..a0ea7d524ee 100644 --- a/tests/baselines/reference/exportStarForValues3.js +++ b/tests/baselines/reference/exportStarForValues3.js @@ -38,7 +38,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file1"], function (require, exports, file1_1) { "use strict"; exports.__esModule = true; @@ -55,7 +55,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file1"], function (require, exports, file1_1) { "use strict"; exports.__esModule = true; @@ -72,7 +72,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file2", "file3"], function (require, exports, file2_1, file3_1) { "use strict"; exports.__esModule = true; @@ -90,7 +90,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file4"], function (require, exports, file4_1) { "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/exportStarForValues4.js b/tests/baselines/reference/exportStarForValues4.js index 527df22d292..13a6dfae6cc 100644 --- a/tests/baselines/reference/exportStarForValues4.js +++ b/tests/baselines/reference/exportStarForValues4.js @@ -30,7 +30,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file2"], function (require, exports, file2_1) { "use strict"; exports.__esModule = true; @@ -47,7 +47,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file1", "file3"], function (require, exports, file1_1, file3_1) { "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/exportStarForValues5.js b/tests/baselines/reference/exportStarForValues5.js index 6a5c2e6755f..d3ecb850f86 100644 --- a/tests/baselines/reference/exportStarForValues5.js +++ b/tests/baselines/reference/exportStarForValues5.js @@ -22,7 +22,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file1"], function (require, exports, file1_1) { "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/exportStarForValues7.js b/tests/baselines/reference/exportStarForValues7.js index 3fe3020756c..5d9e534333e 100644 --- a/tests/baselines/reference/exportStarForValues7.js +++ b/tests/baselines/reference/exportStarForValues7.js @@ -26,7 +26,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file1"], function (require, exports, file1_1) { "use strict"; exports.__esModule = true; @@ -44,7 +44,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file2"], function (require, exports, file2_1) { "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/exportStarForValues8.js b/tests/baselines/reference/exportStarForValues8.js index 3458e5f6a38..66111015e70 100644 --- a/tests/baselines/reference/exportStarForValues8.js +++ b/tests/baselines/reference/exportStarForValues8.js @@ -38,7 +38,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file1"], function (require, exports, file1_1) { "use strict"; exports.__esModule = true; @@ -56,7 +56,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file1"], function (require, exports, file1_1) { "use strict"; exports.__esModule = true; @@ -74,7 +74,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file2", "file3"], function (require, exports, file2_1, file3_1) { "use strict"; exports.__esModule = true; @@ -93,7 +93,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file4"], function (require, exports, file4_1) { "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/exportStarForValues9.js b/tests/baselines/reference/exportStarForValues9.js index 70ab46eafeb..c328f25910b 100644 --- a/tests/baselines/reference/exportStarForValues9.js +++ b/tests/baselines/reference/exportStarForValues9.js @@ -30,7 +30,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file2"], function (require, exports, file2_1) { "use strict"; exports.__esModule = true; @@ -48,7 +48,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; define(["require", "exports", "file1", "file3"], function (require, exports, file1_1, file3_1) { "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/exportStarFromEmptyModule.js b/tests/baselines/reference/exportStarFromEmptyModule.js index 450bbafe424..9864a341f7e 100644 --- a/tests/baselines/reference/exportStarFromEmptyModule.js +++ b/tests/baselines/reference/exportStarFromEmptyModule.js @@ -45,7 +45,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.A = void 0; __exportStar(require("./exportStarFromEmptyModule_module2"), exports); diff --git a/tests/baselines/reference/exportStarNotElided.js b/tests/baselines/reference/exportStarNotElided.js index 41d2b55483b..27a8616b32f 100644 --- a/tests/baselines/reference/exportStarNotElided.js +++ b/tests/baselines/reference/exportStarNotElided.js @@ -33,7 +33,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./register"), exports); __exportStar(require("./data1"), exports); diff --git a/tests/baselines/reference/genericRestParameters1.types b/tests/baselines/reference/genericRestParameters1.types index c9067b38c97..1503f118459 100644 --- a/tests/baselines/reference/genericRestParameters1.types +++ b/tests/baselines/reference/genericRestParameters1.types @@ -665,7 +665,7 @@ const c30 = f30(42, x => "" + x, x => x + 1); // [(x: number) => string, (x: nu >1 : 1 type T01 = Parameters<(x: number, y: string, z: boolean) => void>; ->T01 : [number, string, boolean] +>T01 : [x: number, y: string, z: boolean] >x : number >y : string >z : boolean @@ -675,7 +675,7 @@ type T02 = Parameters<(...args: [number, string, boolean]) => void>; >args : [number, string, boolean] type T03 = ConstructorParameters void>; ->T03 : [number, string, boolean] +>T03 : [x: number, y: string, z: boolean] >x : number >y : string >z : boolean diff --git a/tests/baselines/reference/genericRestParameters2.types b/tests/baselines/reference/genericRestParameters2.types index 16798357a92..ec17e786252 100644 --- a/tests/baselines/reference/genericRestParameters2.types +++ b/tests/baselines/reference/genericRestParameters2.types @@ -417,7 +417,7 @@ f20(42, "hello", ...t2, true); >true : true type T01 = Parameters<(x: number, y: string, ...z: boolean[]) => void>; ->T01 : [number, string, ...boolean[]] +>T01 : [x: number, y: string, ...z: boolean[]] >x : number >y : string >z : boolean[] @@ -427,7 +427,7 @@ type T02 = Parameters<(...args: [number, string, ...boolean[]]) => void>; >args : [number, string, ...boolean[]] type T03 = ConstructorParameters void>; ->T03 : [number, string, ...boolean[]] +>T03 : [x: number, y: string, ...z: boolean[]] >x : number >y : string >z : boolean[] @@ -452,7 +452,7 @@ type P1 = T extends (head: infer A, ...tail: infer B) => any >tail : B type T10 = P1<(x: number, y: string, ...z: boolean[]) => void>; ->T10 : { head: number; tail: [string, ...boolean[]]; } +>T10 : { head: number; tail: [y: string, ...z: boolean[]]; } >x : number >y : string >z : boolean[] @@ -462,7 +462,7 @@ type T11 = P1<(...z: number[]) => void>; >z : number[] type T12 = P1<(x: number, y: number) => void>; ->T12 : { head: number; tail: [number]; } +>T12 : { head: number; tail: [y: number]; } >x : number >y : number diff --git a/tests/baselines/reference/genericRestParameters3.errors.txt b/tests/baselines/reference/genericRestParameters3.errors.txt index 9e3e9d97de4..4b7032bb13b 100644 --- a/tests/baselines/reference/genericRestParameters3.errors.txt +++ b/tests/baselines/reference/genericRestParameters3.errors.txt @@ -6,20 +6,20 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(18,1): error TS2345 tests/cases/conformance/types/rest/genericRestParameters3.ts(22,1): error TS2322: Type '(x: string, ...args: [string] | [number, boolean]) => void' is not assignable to type '(...args: [string, string] | [string, number, boolean]) => void'. tests/cases/conformance/types/rest/genericRestParameters3.ts(23,1): error TS2322: Type '(x: string, y: string) => void' is not assignable to type '(x: string, ...args: [string] | [number, boolean]) => void'. Types of parameters 'y' and 'args' are incompatible. - Type '[string] | [number, boolean]' is not assignable to type '[string]'. - Type '[number, boolean]' is not assignable to type '[string]'. + Type '[string] | [number, boolean]' is not assignable to type '[y: string]'. + Type '[number, boolean]' is not assignable to type '[y: string]'. Types of property '0' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/rest/genericRestParameters3.ts(24,1): error TS2322: Type '(x: string, y: number, z: boolean) => void' is not assignable to type '(x: string, ...args: [string] | [number, boolean]) => void'. Types of parameters 'y' and 'args' are incompatible. - Type '[string] | [number, boolean]' is not assignable to type '[number, boolean]'. - Property '1' is missing in type '[string]' but required in type '[number, boolean]'. + Type '[string] | [number, boolean]' is not assignable to type '[y: number, z: boolean]'. + Property '1' is missing in type '[string]' but required in type '[y: number, z: boolean]'. tests/cases/conformance/types/rest/genericRestParameters3.ts(25,1): error TS2322: Type '(...args: [string, string] | [string, number, boolean]) => void' is not assignable to type '(x: string, ...args: [string] | [number, boolean]) => void'. tests/cases/conformance/types/rest/genericRestParameters3.ts(35,1): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/types/rest/genericRestParameters3.ts(36,21): error TS2345: Argument of type '100' is not assignable to parameter of type '(...args: CoolArray) => void'. tests/cases/conformance/types/rest/genericRestParameters3.ts(37,21): error TS2345: Argument of type '(cb: (...args: T) => void) => void' is not assignable to parameter of type '(...args: CoolArray) => void'. Types of parameters 'cb' and 'args' are incompatible. - Property '0' is missing in type 'CoolArray' but required in type '[(...args: any[]) => void]'. + Property '0' is missing in type 'CoolArray' but required in type '[cb: (...args: any[]) => void]'. tests/cases/conformance/types/rest/genericRestParameters3.ts(44,32): error TS2345: Argument of type '[10, 20]' is not assignable to parameter of type 'CoolArray'. Property 'hello' is missing in type '[10, 20]' but required in type 'CoolArray'. tests/cases/conformance/types/rest/genericRestParameters3.ts(49,1): error TS2345: Argument of type '[]' is not assignable to parameter of type 'CoolArray'. @@ -70,16 +70,16 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(59,5): error TS2345 ~~ !!! error TS2322: Type '(x: string, y: string) => void' is not assignable to type '(x: string, ...args: [string] | [number, boolean]) => void'. !!! error TS2322: Types of parameters 'y' and 'args' are incompatible. -!!! error TS2322: Type '[string] | [number, boolean]' is not assignable to type '[string]'. -!!! error TS2322: Type '[number, boolean]' is not assignable to type '[string]'. +!!! error TS2322: Type '[string] | [number, boolean]' is not assignable to type '[y: string]'. +!!! error TS2322: Type '[number, boolean]' is not assignable to type '[y: string]'. !!! error TS2322: Types of property '0' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'string'. f1 = f3; // Error ~~ !!! error TS2322: Type '(x: string, y: number, z: boolean) => void' is not assignable to type '(x: string, ...args: [string] | [number, boolean]) => void'. !!! error TS2322: Types of parameters 'y' and 'args' are incompatible. -!!! error TS2322: Type '[string] | [number, boolean]' is not assignable to type '[number, boolean]'. -!!! error TS2322: Property '1' is missing in type '[string]' but required in type '[number, boolean]'. +!!! error TS2322: Type '[string] | [number, boolean]' is not assignable to type '[y: number, z: boolean]'. +!!! error TS2322: Property '1' is missing in type '[string]' but required in type '[y: number, z: boolean]'. f1 = f4; // Error, misaligned complex rest types ~~ !!! error TS2322: Type '(...args: [string, string] | [string, number, boolean]) => void' is not assignable to type '(x: string, ...args: [string] | [number, boolean]) => void'. @@ -103,7 +103,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(59,5): error TS2345 ~~~ !!! error TS2345: Argument of type '(cb: (...args: T) => void) => void' is not assignable to parameter of type '(...args: CoolArray) => void'. !!! error TS2345: Types of parameters 'cb' and 'args' are incompatible. -!!! error TS2345: Property '0' is missing in type 'CoolArray' but required in type '[(...args: any[]) => void]'. +!!! error TS2345: Property '0' is missing in type 'CoolArray' but required in type '[cb: (...args: any[]) => void]'. function bar(...args: T): T { return args; diff --git a/tests/baselines/reference/genericRestTypes.errors.txt b/tests/baselines/reference/genericRestTypes.errors.txt index c0fcb85e492..0df6490b6a2 100644 --- a/tests/baselines/reference/genericRestTypes.errors.txt +++ b/tests/baselines/reference/genericRestTypes.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/genericRestTypes.ts(21,11): error TS2322: Type '(cb: (x: string, ...rest: T) => void) => void' is not assignable to type '(cb: (...args: never) => void) => void'. Types of parameters 'cb' and 'cb' are incompatible. Types of parameters 'args' and 'x' are incompatible. - Type '[string, ...T[number][]]' is not assignable to type 'never'. + Type '[x: string, ...rest: T[number][]]' is not assignable to type 'never'. ==== tests/cases/compiler/genericRestTypes.ts (1 errors) ==== @@ -30,7 +30,7 @@ tests/cases/compiler/genericRestTypes.ts(21,11): error TS2322: Type '(cb: (x: st !!! error TS2322: Type '(cb: (x: string, ...rest: T) => void) => void' is not assignable to type '(cb: (...args: never) => void) => void'. !!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible. !!! error TS2322: Types of parameters 'args' and 'x' are incompatible. -!!! error TS2322: Type '[string, ...T[number][]]' is not assignable to type 'never'. +!!! error TS2322: Type '[x: string, ...rest: T[number][]]' is not assignable to type 'never'. } function assignmentWithComplexRest3() { diff --git a/tests/baselines/reference/genericRestTypes.types b/tests/baselines/reference/genericRestTypes.types index 8d06f4a0773..d46f3035481 100644 --- a/tests/baselines/reference/genericRestTypes.types +++ b/tests/baselines/reference/genericRestTypes.types @@ -16,7 +16,7 @@ type MyFunctionType = (foo: number, bar: string) => boolean; type Explicit = (...args: Tail>) => ReturnType; // (bar: string) => boolean >Explicit : Explicit ->args : [string] +>args : [bar: string] type Bind1 any> = (...args: Tail>) => ReturnType; >Bind1 : Bind1 diff --git a/tests/baselines/reference/getParameterNameAtPosition.types b/tests/baselines/reference/getParameterNameAtPosition.types index f722d7e5f95..1e0c9212901 100644 --- a/tests/baselines/reference/getParameterNameAtPosition.types +++ b/tests/baselines/reference/getParameterNameAtPosition.types @@ -23,7 +23,7 @@ declare function fn(implementation?: (...args: Y) => any): Mock cases(fn(opts => { })); >cases(fn(opts => { })) : void >cases : (tester: Tester) => void ->fn(opts => { }) : Mock<[any]> +>fn(opts => { }) : Mock<[opts: any]> >fn : (implementation?: ((...args: Y) => any) | undefined) => Mock >opts => { } : (opts: any) => void >opts : any diff --git a/tests/baselines/reference/inlineJsxFactoryDeclarations.js b/tests/baselines/reference/inlineJsxFactoryDeclarations.js index c4909439e54..e799b950b6a 100644 --- a/tests/baselines/reference/inlineJsxFactoryDeclarations.js +++ b/tests/baselines/reference/inlineJsxFactoryDeclarations.js @@ -74,7 +74,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; /** @jsx dom */ var renderer_1 = require("./renderer"); diff --git a/tests/baselines/reference/instantiateContextualTypes.types b/tests/baselines/reference/instantiateContextualTypes.types index b5317b6f756..d6c380cb7ac 100644 --- a/tests/baselines/reference/instantiateContextualTypes.types +++ b/tests/baselines/reference/instantiateContextualTypes.types @@ -444,5 +444,5 @@ assignPartial(obj, { foo(...args) {} }); // args has type [string] >obj : { foo(bar: string): void; } >{ foo(...args) {} } : { foo(bar: string): void; } >foo : (bar: string) => void ->args : [string] +>args : [bar: string] diff --git a/tests/baselines/reference/intersectionReduction.errors.txt b/tests/baselines/reference/intersectionReduction.errors.txt index 7026fcda0a9..82911aca009 100644 --- a/tests/baselines/reference/intersectionReduction.errors.txt +++ b/tests/baselines/reference/intersectionReduction.errors.txt @@ -120,4 +120,36 @@ tests/cases/conformance/types/intersection/intersectionReduction.ts(81,1): error const f2 = (t: Container<"a"> | (Container<"b"> & Container<"c">)): Container<"a"> => t; const f3 = (t: Container<"a"> | (Container<"b"> & { dataB: boolean } & Container<"a">)): Container<"a"> => t; const f4 = (t: number | (Container<"b"> & { dataB: boolean } & Container<"a">)): number => t; + + // Repro from #38549 + + interface A2 { + kind: "A"; + a: number; + } + + interface B2 { + kind: "B"; + b: number; + } + + declare const shouldBeB: (A2 | B2) & B2; + const b: B2 = shouldBeB; // works + + function inGeneric(alsoShouldBeB: T & B2) { + const b: B2 = alsoShouldBeB; + } + + // Repro from #38542 + + interface ABI { + kind: 'a' | 'b'; + } + + declare class CA { kind: 'a'; a: string; x: number }; + declare class CB { kind: 'b'; b: string; y: number }; + + function bar(x: T & CA) { + let ab: ABI = x; + } \ No newline at end of file diff --git a/tests/baselines/reference/intersectionReduction.js b/tests/baselines/reference/intersectionReduction.js index c04ce9973bc..64b1757b09d 100644 --- a/tests/baselines/reference/intersectionReduction.js +++ b/tests/baselines/reference/intersectionReduction.js @@ -107,6 +107,38 @@ type Container = { const f2 = (t: Container<"a"> | (Container<"b"> & Container<"c">)): Container<"a"> => t; const f3 = (t: Container<"a"> | (Container<"b"> & { dataB: boolean } & Container<"a">)): Container<"a"> => t; const f4 = (t: number | (Container<"b"> & { dataB: boolean } & Container<"a">)): number => t; + +// Repro from #38549 + +interface A2 { + kind: "A"; + a: number; +} + +interface B2 { + kind: "B"; + b: number; +} + +declare const shouldBeB: (A2 | B2) & B2; +const b: B2 = shouldBeB; // works + +function inGeneric(alsoShouldBeB: T & B2) { + const b: B2 = alsoShouldBeB; +} + +// Repro from #38542 + +interface ABI { + kind: 'a' | 'b'; +} + +declare class CA { kind: 'a'; a: string; x: number }; +declare class CB { kind: 'b'; b: string; y: number }; + +function bar(x: T & CA) { + let ab: ABI = x; +} //// [intersectionReduction.js] @@ -128,3 +160,12 @@ var f1 = function (t) { return t; }; var f2 = function (t) { return t; }; var f3 = function (t) { return t; }; var f4 = function (t) { return t; }; +var b = shouldBeB; // works +function inGeneric(alsoShouldBeB) { + var b = alsoShouldBeB; +} +; +; +function bar(x) { + var ab = x; +} diff --git a/tests/baselines/reference/intersectionReduction.symbols b/tests/baselines/reference/intersectionReduction.symbols index 2949e87b2c7..02cc8c9ff2f 100644 --- a/tests/baselines/reference/intersectionReduction.symbols +++ b/tests/baselines/reference/intersectionReduction.symbols @@ -373,3 +373,87 @@ const f4 = (t: number | (Container<"b"> & { dataB: boolean } & Container<"a">)): >Container : Symbol(Container, Decl(intersectionReduction.ts, 99, 44)) >t : Symbol(t, Decl(intersectionReduction.ts, 107, 12)) +// Repro from #38549 + +interface A2 { +>A2 : Symbol(A2, Decl(intersectionReduction.ts, 107, 93)) + + kind: "A"; +>kind : Symbol(A2.kind, Decl(intersectionReduction.ts, 111, 14)) + + a: number; +>a : Symbol(A2.a, Decl(intersectionReduction.ts, 112, 14)) +} + +interface B2 { +>B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1)) + + kind: "B"; +>kind : Symbol(B2.kind, Decl(intersectionReduction.ts, 116, 14)) + + b: number; +>b : Symbol(B2.b, Decl(intersectionReduction.ts, 117, 14)) +} + +declare const shouldBeB: (A2 | B2) & B2; +>shouldBeB : Symbol(shouldBeB, Decl(intersectionReduction.ts, 121, 13)) +>A2 : Symbol(A2, Decl(intersectionReduction.ts, 107, 93)) +>B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1)) +>B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1)) + +const b: B2 = shouldBeB; // works +>b : Symbol(b, Decl(intersectionReduction.ts, 122, 5)) +>B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1)) +>shouldBeB : Symbol(shouldBeB, Decl(intersectionReduction.ts, 121, 13)) + +function inGeneric(alsoShouldBeB: T & B2) { +>inGeneric : Symbol(inGeneric, Decl(intersectionReduction.ts, 122, 24)) +>T : Symbol(T, Decl(intersectionReduction.ts, 124, 19)) +>A2 : Symbol(A2, Decl(intersectionReduction.ts, 107, 93)) +>B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1)) +>alsoShouldBeB : Symbol(alsoShouldBeB, Decl(intersectionReduction.ts, 124, 38)) +>T : Symbol(T, Decl(intersectionReduction.ts, 124, 19)) +>B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1)) + + const b: B2 = alsoShouldBeB; +>b : Symbol(b, Decl(intersectionReduction.ts, 125, 9)) +>B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1)) +>alsoShouldBeB : Symbol(alsoShouldBeB, Decl(intersectionReduction.ts, 124, 38)) +} + +// Repro from #38542 + +interface ABI { +>ABI : Symbol(ABI, Decl(intersectionReduction.ts, 126, 1)) + + kind: 'a' | 'b'; +>kind : Symbol(ABI.kind, Decl(intersectionReduction.ts, 130, 15)) +} + +declare class CA { kind: 'a'; a: string; x: number }; +>CA : Symbol(CA, Decl(intersectionReduction.ts, 132, 1)) +>kind : Symbol(CA.kind, Decl(intersectionReduction.ts, 134, 18)) +>a : Symbol(CA.a, Decl(intersectionReduction.ts, 134, 29)) +>x : Symbol(CA.x, Decl(intersectionReduction.ts, 134, 40)) + +declare class CB { kind: 'b'; b: string; y: number }; +>CB : Symbol(CB, Decl(intersectionReduction.ts, 134, 53)) +>kind : Symbol(CB.kind, Decl(intersectionReduction.ts, 135, 18)) +>b : Symbol(CB.b, Decl(intersectionReduction.ts, 135, 29)) +>y : Symbol(CB.y, Decl(intersectionReduction.ts, 135, 40)) + +function bar(x: T & CA) { +>bar : Symbol(bar, Decl(intersectionReduction.ts, 135, 53)) +>T : Symbol(T, Decl(intersectionReduction.ts, 137, 13)) +>CA : Symbol(CA, Decl(intersectionReduction.ts, 132, 1)) +>CB : Symbol(CB, Decl(intersectionReduction.ts, 134, 53)) +>x : Symbol(x, Decl(intersectionReduction.ts, 137, 32)) +>T : Symbol(T, Decl(intersectionReduction.ts, 137, 13)) +>CA : Symbol(CA, Decl(intersectionReduction.ts, 132, 1)) + + let ab: ABI = x; +>ab : Symbol(ab, Decl(intersectionReduction.ts, 138, 7)) +>ABI : Symbol(ABI, Decl(intersectionReduction.ts, 126, 1)) +>x : Symbol(x, Decl(intersectionReduction.ts, 137, 32)) +} + diff --git a/tests/baselines/reference/intersectionReduction.types b/tests/baselines/reference/intersectionReduction.types index 8c4ee05051b..c1ae0685836 100644 --- a/tests/baselines/reference/intersectionReduction.types +++ b/tests/baselines/reference/intersectionReduction.types @@ -315,3 +315,65 @@ const f4 = (t: number | (Container<"b"> & { dataB: boolean } & Container<"a">)): >dataB : boolean >t : number +// Repro from #38549 + +interface A2 { + kind: "A"; +>kind : "A" + + a: number; +>a : number +} + +interface B2 { + kind: "B"; +>kind : "B" + + b: number; +>b : number +} + +declare const shouldBeB: (A2 | B2) & B2; +>shouldBeB : B2 + +const b: B2 = shouldBeB; // works +>b : B2 +>shouldBeB : B2 + +function inGeneric(alsoShouldBeB: T & B2) { +>inGeneric : (alsoShouldBeB: T & B2) => void +>alsoShouldBeB : T & B2 + + const b: B2 = alsoShouldBeB; +>b : B2 +>alsoShouldBeB : T & B2 +} + +// Repro from #38542 + +interface ABI { + kind: 'a' | 'b'; +>kind : "a" | "b" +} + +declare class CA { kind: 'a'; a: string; x: number }; +>CA : CA +>kind : "a" +>a : string +>x : number + +declare class CB { kind: 'b'; b: string; y: number }; +>CB : CB +>kind : "b" +>b : string +>y : number + +function bar(x: T & CA) { +>bar : (x: T & CA) => void +>x : T & CA + + let ab: ABI = x; +>ab : ABI +>x : T & CA +} + diff --git a/tests/baselines/reference/invalidTaggedTemplateEscapeSequences(target=es2015).js b/tests/baselines/reference/invalidTaggedTemplateEscapeSequences(target=es2015).js index 1ad643d360d..bed4ca912d8 100644 --- a/tests/baselines/reference/invalidTaggedTemplateEscapeSequences(target=es2015).js +++ b/tests/baselines/reference/invalidTaggedTemplateEscapeSequences(target=es2015).js @@ -35,20 +35,20 @@ function tag(str, ...args) { } const a = tag `123`; const b = tag `123 ${100}`; -const x = tag(__makeTemplateObject([undefined, undefined, " wonderful ", undefined], ["\\u{hello} ", " \\xtraordinary ", " wonderful ", " \\uworld"]), 100, 200, 300); +const x = tag(__makeTemplateObject([void 0, void 0, " wonderful ", void 0], ["\\u{hello} ", " \\xtraordinary ", " wonderful ", " \\uworld"]), 100, 200, 300); const y = `\u{hello} ${100} \xtraordinary ${200} wonderful ${300} \uworld`; // should error with NoSubstitutionTemplate -const z = tag(__makeTemplateObject([undefined], ["\\u{hello} \\xtraordinary wonderful \\uworld"])); // should work with Tagged NoSubstitutionTemplate +const z = tag(__makeTemplateObject([void 0], ["\\u{hello} \\xtraordinary wonderful \\uworld"])); // should work with Tagged NoSubstitutionTemplate const a1 = tag `${100}\0`; // \0 -const a2 = tag(__makeTemplateObject(["", undefined], ["", "\\00"]), 100); // \\00 -const a3 = tag(__makeTemplateObject(["", undefined], ["", "\\u"]), 100); // \\u -const a4 = tag(__makeTemplateObject(["", undefined], ["", "\\u0"]), 100); // \\u0 -const a5 = tag(__makeTemplateObject(["", undefined], ["", "\\u00"]), 100); // \\u00 -const a6 = tag(__makeTemplateObject(["", undefined], ["", "\\u000"]), 100); // \\u000 +const a2 = tag(__makeTemplateObject(["", void 0], ["", "\\00"]), 100); // \\00 +const a3 = tag(__makeTemplateObject(["", void 0], ["", "\\u"]), 100); // \\u +const a4 = tag(__makeTemplateObject(["", void 0], ["", "\\u0"]), 100); // \\u0 +const a5 = tag(__makeTemplateObject(["", void 0], ["", "\\u00"]), 100); // \\u00 +const a6 = tag(__makeTemplateObject(["", void 0], ["", "\\u000"]), 100); // \\u000 const a7 = tag `${100}\u0000`; // \u0000 -const a8 = tag(__makeTemplateObject(["", undefined], ["", "\\u{"]), 100); // \\u{ +const a8 = tag(__makeTemplateObject(["", void 0], ["", "\\u{"]), 100); // \\u{ const a9 = tag `${100}\u{10FFFF}`; // \\u{10FFFF -const a10 = tag(__makeTemplateObject(["", undefined], ["", "\\u{1f622"]), 100); // \\u{1f622 +const a10 = tag(__makeTemplateObject(["", void 0], ["", "\\u{1f622"]), 100); // \\u{1f622 const a11 = tag `${100}\u{1f622}`; // \u{1f622} -const a12 = tag(__makeTemplateObject(["", undefined], ["", "\\x"]), 100); // \\x -const a13 = tag(__makeTemplateObject(["", undefined], ["", "\\x0"]), 100); // \\x0 +const a12 = tag(__makeTemplateObject(["", void 0], ["", "\\x"]), 100); // \\x +const a13 = tag(__makeTemplateObject(["", void 0], ["", "\\x0"]), 100); // \\x0 const a14 = tag `${100}\x00`; // \x00 diff --git a/tests/baselines/reference/invalidTaggedTemplateEscapeSequences(target=es5).js b/tests/baselines/reference/invalidTaggedTemplateEscapeSequences(target=es5).js index 362e2cf175c..6e0c375edb2 100644 --- a/tests/baselines/reference/invalidTaggedTemplateEscapeSequences(target=es5).js +++ b/tests/baselines/reference/invalidTaggedTemplateEscapeSequences(target=es5).js @@ -39,20 +39,20 @@ function tag(str) { } var a = tag(__makeTemplateObject(["123"], ["123"])); var b = tag(__makeTemplateObject(["123 ", ""], ["123 ", ""]), 100); -var x = tag(__makeTemplateObject([undefined, undefined, " wonderful ", undefined], ["\\u{hello} ", " \\xtraordinary ", " wonderful ", " \\uworld"]), 100, 200, 300); +var x = tag(__makeTemplateObject([void 0, void 0, " wonderful ", void 0], ["\\u{hello} ", " \\xtraordinary ", " wonderful ", " \\uworld"]), 100, 200, 300); var y = "hello} " + 100 + " traordinary " + 200 + " wonderful " + 300 + " world"; // should error with NoSubstitutionTemplate -var z = tag(__makeTemplateObject([undefined], ["\\u{hello} \\xtraordinary wonderful \\uworld"])); // should work with Tagged NoSubstitutionTemplate +var z = tag(__makeTemplateObject([void 0], ["\\u{hello} \\xtraordinary wonderful \\uworld"])); // should work with Tagged NoSubstitutionTemplate var a1 = tag(__makeTemplateObject(["", "\0"], ["", "\\0"]), 100); // \0 -var a2 = tag(__makeTemplateObject(["", undefined], ["", "\\00"]), 100); // \\00 -var a3 = tag(__makeTemplateObject(["", undefined], ["", "\\u"]), 100); // \\u -var a4 = tag(__makeTemplateObject(["", undefined], ["", "\\u0"]), 100); // \\u0 -var a5 = tag(__makeTemplateObject(["", undefined], ["", "\\u00"]), 100); // \\u00 -var a6 = tag(__makeTemplateObject(["", undefined], ["", "\\u000"]), 100); // \\u000 +var a2 = tag(__makeTemplateObject(["", void 0], ["", "\\00"]), 100); // \\00 +var a3 = tag(__makeTemplateObject(["", void 0], ["", "\\u"]), 100); // \\u +var a4 = tag(__makeTemplateObject(["", void 0], ["", "\\u0"]), 100); // \\u0 +var a5 = tag(__makeTemplateObject(["", void 0], ["", "\\u00"]), 100); // \\u00 +var a6 = tag(__makeTemplateObject(["", void 0], ["", "\\u000"]), 100); // \\u000 var a7 = tag(__makeTemplateObject(["", "\0"], ["", "\\u0000"]), 100); // \u0000 -var a8 = tag(__makeTemplateObject(["", undefined], ["", "\\u{"]), 100); // \\u{ +var a8 = tag(__makeTemplateObject(["", void 0], ["", "\\u{"]), 100); // \\u{ var a9 = tag(__makeTemplateObject(["", "\uDBFF\uDFFF"], ["", "\\u{10FFFF}"]), 100); // \\u{10FFFF -var a10 = tag(__makeTemplateObject(["", undefined], ["", "\\u{1f622"]), 100); // \\u{1f622 +var a10 = tag(__makeTemplateObject(["", void 0], ["", "\\u{1f622"]), 100); // \\u{1f622 var a11 = tag(__makeTemplateObject(["", "\uD83D\uDE22"], ["", "\\u{1f622}"]), 100); // \u{1f622} -var a12 = tag(__makeTemplateObject(["", undefined], ["", "\\x"]), 100); // \\x -var a13 = tag(__makeTemplateObject(["", undefined], ["", "\\x0"]), 100); // \\x0 +var a12 = tag(__makeTemplateObject(["", void 0], ["", "\\x"]), 100); // \\x +var a13 = tag(__makeTemplateObject(["", void 0], ["", "\\x0"]), 100); // \\x0 var a14 = tag(__makeTemplateObject(["", "\0"], ["", "\\x00"]), 100); // \x00 diff --git a/tests/baselines/reference/invalidTaggedTemplateEscapeSequences.js b/tests/baselines/reference/invalidTaggedTemplateEscapeSequences.js index 362e2cf175c..58984b3018c 100644 --- a/tests/baselines/reference/invalidTaggedTemplateEscapeSequences.js +++ b/tests/baselines/reference/invalidTaggedTemplateEscapeSequences.js @@ -1,28 +1,28 @@ //// [invalidTaggedTemplateEscapeSequences.ts] -function tag (str: any, ...args: any[]): any { - return str -} - -const a = tag`123` -const b = tag`123 ${100}` -const x = tag`\u{hello} ${ 100 } \xtraordinary ${ 200 } wonderful ${ 300 } \uworld`; -const y = `\u{hello} ${ 100 } \xtraordinary ${ 200 } wonderful ${ 300 } \uworld`; // should error with NoSubstitutionTemplate -const z = tag`\u{hello} \xtraordinary wonderful \uworld` // should work with Tagged NoSubstitutionTemplate - -const a1 = tag`${ 100 }\0` // \0 -const a2 = tag`${ 100 }\00` // \\00 -const a3 = tag`${ 100 }\u` // \\u -const a4 = tag`${ 100 }\u0` // \\u0 -const a5 = tag`${ 100 }\u00` // \\u00 -const a6 = tag`${ 100 }\u000` // \\u000 -const a7 = tag`${ 100 }\u0000` // \u0000 -const a8 = tag`${ 100 }\u{` // \\u{ -const a9 = tag`${ 100 }\u{10FFFF}` // \\u{10FFFF -const a10 = tag`${ 100 }\u{1f622` // \\u{1f622 -const a11 = tag`${ 100 }\u{1f622}` // \u{1f622} -const a12 = tag`${ 100 }\x` // \\x -const a13 = tag`${ 100 }\x0` // \\x0 -const a14 = tag`${ 100 }\x00` // \x00 +function tag (str: any, ...args: any[]): any { + return str +} + +const a = tag`123` +const b = tag`123 ${100}` +const x = tag`\u{hello} ${ 100 } \xtraordinary ${ 200 } wonderful ${ 300 } \uworld`; +const y = `\u{hello} ${ 100 } \xtraordinary ${ 200 } wonderful ${ 300 } \uworld`; // should error with NoSubstitutionTemplate +const z = tag`\u{hello} \xtraordinary wonderful \uworld` // should work with Tagged NoSubstitutionTemplate + +const a1 = tag`${ 100 }\0` // \0 +const a2 = tag`${ 100 }\00` // \\00 +const a3 = tag`${ 100 }\u` // \\u +const a4 = tag`${ 100 }\u0` // \\u0 +const a5 = tag`${ 100 }\u00` // \\u00 +const a6 = tag`${ 100 }\u000` // \\u000 +const a7 = tag`${ 100 }\u0000` // \u0000 +const a8 = tag`${ 100 }\u{` // \\u{ +const a9 = tag`${ 100 }\u{10FFFF}` // \\u{10FFFF +const a10 = tag`${ 100 }\u{1f622` // \\u{1f622 +const a11 = tag`${ 100 }\u{1f622}` // \u{1f622} +const a12 = tag`${ 100 }\x` // \\x +const a13 = tag`${ 100 }\x0` // \\x0 +const a14 = tag`${ 100 }\x00` // \x00 //// [invalidTaggedTemplateEscapeSequences.js] @@ -39,20 +39,20 @@ function tag(str) { } var a = tag(__makeTemplateObject(["123"], ["123"])); var b = tag(__makeTemplateObject(["123 ", ""], ["123 ", ""]), 100); -var x = tag(__makeTemplateObject([undefined, undefined, " wonderful ", undefined], ["\\u{hello} ", " \\xtraordinary ", " wonderful ", " \\uworld"]), 100, 200, 300); +var x = tag(__makeTemplateObject([void 0, void 0, " wonderful ", void 0], ["\\u{hello} ", " \\xtraordinary ", " wonderful ", " \\uworld"]), 100, 200, 300); var y = "hello} " + 100 + " traordinary " + 200 + " wonderful " + 300 + " world"; // should error with NoSubstitutionTemplate -var z = tag(__makeTemplateObject([undefined], ["\\u{hello} \\xtraordinary wonderful \\uworld"])); // should work with Tagged NoSubstitutionTemplate +var z = tag(__makeTemplateObject([void 0], ["\\u{hello} \\xtraordinary wonderful \\uworld"])); // should work with Tagged NoSubstitutionTemplate var a1 = tag(__makeTemplateObject(["", "\0"], ["", "\\0"]), 100); // \0 -var a2 = tag(__makeTemplateObject(["", undefined], ["", "\\00"]), 100); // \\00 -var a3 = tag(__makeTemplateObject(["", undefined], ["", "\\u"]), 100); // \\u -var a4 = tag(__makeTemplateObject(["", undefined], ["", "\\u0"]), 100); // \\u0 -var a5 = tag(__makeTemplateObject(["", undefined], ["", "\\u00"]), 100); // \\u00 -var a6 = tag(__makeTemplateObject(["", undefined], ["", "\\u000"]), 100); // \\u000 +var a2 = tag(__makeTemplateObject(["", void 0], ["", "\\00"]), 100); // \\00 +var a3 = tag(__makeTemplateObject(["", void 0], ["", "\\u"]), 100); // \\u +var a4 = tag(__makeTemplateObject(["", void 0], ["", "\\u0"]), 100); // \\u0 +var a5 = tag(__makeTemplateObject(["", void 0], ["", "\\u00"]), 100); // \\u00 +var a6 = tag(__makeTemplateObject(["", void 0], ["", "\\u000"]), 100); // \\u000 var a7 = tag(__makeTemplateObject(["", "\0"], ["", "\\u0000"]), 100); // \u0000 -var a8 = tag(__makeTemplateObject(["", undefined], ["", "\\u{"]), 100); // \\u{ +var a8 = tag(__makeTemplateObject(["", void 0], ["", "\\u{"]), 100); // \\u{ var a9 = tag(__makeTemplateObject(["", "\uDBFF\uDFFF"], ["", "\\u{10FFFF}"]), 100); // \\u{10FFFF -var a10 = tag(__makeTemplateObject(["", undefined], ["", "\\u{1f622"]), 100); // \\u{1f622 +var a10 = tag(__makeTemplateObject(["", void 0], ["", "\\u{1f622"]), 100); // \\u{1f622 var a11 = tag(__makeTemplateObject(["", "\uD83D\uDE22"], ["", "\\u{1f622}"]), 100); // \u{1f622} -var a12 = tag(__makeTemplateObject(["", undefined], ["", "\\x"]), 100); // \\x -var a13 = tag(__makeTemplateObject(["", undefined], ["", "\\x0"]), 100); // \\x0 +var a12 = tag(__makeTemplateObject(["", void 0], ["", "\\x"]), 100); // \\x +var a13 = tag(__makeTemplateObject(["", void 0], ["", "\\x0"]), 100); // \\x0 var a14 = tag(__makeTemplateObject(["", "\0"], ["", "\\x00"]), 100); // \x00 diff --git a/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.errors.txt b/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.errors.txt new file mode 100644 index 00000000000..d57fb401814 --- /dev/null +++ b/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/jsdoc/declarations/index.js(4,3): error TS2339: Property 'prototype' does not exist on type '{}'. + + +==== tests/cases/conformance/jsdoc/declarations/index.js (1 errors) ==== + // https://github.com/microsoft/TypeScript/issues/35801 + let A; + A = {}; + A.prototype.b = {}; + ~~~~~~~~~ +!!! error TS2339: Property 'prototype' does not exist on type '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.js b/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.js new file mode 100644 index 00000000000..084e6f18b91 --- /dev/null +++ b/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.js @@ -0,0 +1,18 @@ +//// [index.js] +// https://github.com/microsoft/TypeScript/issues/35801 +let A; +A = {}; +A.prototype.b = {}; + +//// [index.js] +// https://github.com/microsoft/TypeScript/issues/35801 +var A; +A = {}; +A.prototype.b = {}; + + +//// [index.d.ts] +declare class A { + private constructor(); + b: {}; +} diff --git a/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.symbols b/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.symbols new file mode 100644 index 00000000000..6b1aa5b1fda --- /dev/null +++ b/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.symbols @@ -0,0 +1,13 @@ +=== tests/cases/conformance/jsdoc/declarations/index.js === +// https://github.com/microsoft/TypeScript/issues/35801 +let A; +>A : Symbol(A, Decl(index.js, 1, 3)) + +A = {}; +>A : Symbol(A, Decl(index.js, 1, 3)) + +A.prototype.b = {}; +>A.prototype : Symbol(A.b, Decl(index.js, 2, 7)) +>A : Symbol(A, Decl(index.js, 1, 3)) +>b : Symbol(A.b, Decl(index.js, 2, 7)) + diff --git a/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.types b/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.types new file mode 100644 index 00000000000..ecd9ac99954 --- /dev/null +++ b/tests/baselines/reference/jsDeclarationsClassLikeHeuristic.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/jsdoc/declarations/index.js === +// https://github.com/microsoft/TypeScript/issues/35801 +let A; +>A : any + +A = {}; +>A = {} : {} +>A : any +>{} : {} + +A.prototype.b = {}; +>A.prototype.b = {} : {} +>A.prototype.b : any +>A.prototype : any +>A : {} +>prototype : any +>b : any +>{} : {} + diff --git a/tests/baselines/reference/jsDeclarationsExportForms.js b/tests/baselines/reference/jsDeclarationsExportForms.js index 2ff100c4eda..8134e557a11 100644 --- a/tests/baselines/reference/jsDeclarationsExportForms.js +++ b/tests/baselines/reference/jsDeclarationsExportForms.js @@ -85,7 +85,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./cls"), exports); //// [bar2.js] @@ -99,7 +99,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./func"), exports); __exportStar(require("./cls"), exports); diff --git a/tests/baselines/reference/jsDeclarationsExportFormsErr.js b/tests/baselines/reference/jsDeclarationsExportFormsErr.js index f30b0a90ab0..6f777832804 100644 --- a/tests/baselines/reference/jsDeclarationsExportFormsErr.js +++ b/tests/baselines/reference/jsDeclarationsExportFormsErr.js @@ -51,7 +51,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./cls"), exports); //// [includeAll.js] diff --git a/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.js b/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.js index 18031abf9ca..b7e4cd93941 100644 --- a/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.js +++ b/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.js @@ -30,7 +30,12 @@ class Private { /** @private */ set p(value) { this.c = value } } - + +// https://github.com/microsoft/TypeScript/issues/38401 +class C { + constructor(/** @public */ x, /** @protected */ y, /** @private */ z) { + } +} //// [foo.js] class Protected { @@ -63,6 +68,11 @@ class Private { /** @private */ set p(value) { this.c = value; } } +// https://github.com/microsoft/TypeScript/issues/38401 +class C { + constructor(/** @public */ x, /** @protected */ y, /** @private */ z) { + } +} //// [foo.d.ts] @@ -90,3 +100,6 @@ declare class Private { /** @private */ private get p(); } +declare class C { + constructor(x: any, y: any, z: any); +} diff --git a/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.symbols b/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.symbols index 0316e157d31..d9961837e7a 100644 --- a/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.symbols +++ b/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.symbols @@ -79,3 +79,13 @@ class Private { >value : Symbol(value, Decl(jsdocAccessibilityTagDeclarations.js, 29, 10)) } +// https://github.com/microsoft/TypeScript/issues/38401 +class C { +>C : Symbol(C, Decl(jsdocAccessibilityTagDeclarations.js, 30, 1)) + + constructor(/** @public */ x, /** @protected */ y, /** @private */ z) { +>x : Symbol(x, Decl(jsdocAccessibilityTagDeclarations.js, 34, 16)) +>y : Symbol(y, Decl(jsdocAccessibilityTagDeclarations.js, 34, 33)) +>z : Symbol(z, Decl(jsdocAccessibilityTagDeclarations.js, 34, 54)) + } +} diff --git a/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.types b/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.types index 88c6acd855d..3db28ea64d9 100644 --- a/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.types +++ b/tests/baselines/reference/jsdocAccessibilityTagsDeclarations.types @@ -83,3 +83,13 @@ class Private { >value : any } +// https://github.com/microsoft/TypeScript/issues/38401 +class C { +>C : C + + constructor(/** @public */ x, /** @protected */ y, /** @private */ z) { +>x : any +>y : any +>z : any + } +} diff --git a/tests/baselines/reference/jsdocReadonlyDeclarations.js b/tests/baselines/reference/jsdocReadonlyDeclarations.js index 09568ef6b19..e4ed7a7df4e 100644 --- a/tests/baselines/reference/jsdocReadonlyDeclarations.js +++ b/tests/baselines/reference/jsdocReadonlyDeclarations.js @@ -18,7 +18,11 @@ function F() { /** @readonly */ this.z = 1 } - + +// https://github.com/microsoft/TypeScript/issues/38401 +class D { + constructor(/** @readonly */ x) {} +} //// [foo.js] class C { @@ -39,6 +43,10 @@ function F() { /** @readonly */ this.z = 1; } +// https://github.com/microsoft/TypeScript/issues/38401 +class D { + constructor(/** @readonly */ x) { } +} //// [foo.d.ts] @@ -58,3 +66,6 @@ declare class C { */ readonly y: number; } +declare class D { + constructor(x: any); +} diff --git a/tests/baselines/reference/jsdocReadonlyDeclarations.symbols b/tests/baselines/reference/jsdocReadonlyDeclarations.symbols index 29ac14063dc..97c9d3d3ef3 100644 --- a/tests/baselines/reference/jsdocReadonlyDeclarations.symbols +++ b/tests/baselines/reference/jsdocReadonlyDeclarations.symbols @@ -40,3 +40,10 @@ function F() { >z : Symbol(F.z, Decl(jsdocReadonlyDeclarations.js, 15, 14)) } +// https://github.com/microsoft/TypeScript/issues/38401 +class D { +>D : Symbol(D, Decl(jsdocReadonlyDeclarations.js, 18, 1)) + + constructor(/** @readonly */ x) {} +>x : Symbol(x, Decl(jsdocReadonlyDeclarations.js, 22, 16)) +} diff --git a/tests/baselines/reference/jsdocReadonlyDeclarations.types b/tests/baselines/reference/jsdocReadonlyDeclarations.types index ebb5fd00ff1..10e0a99c05e 100644 --- a/tests/baselines/reference/jsdocReadonlyDeclarations.types +++ b/tests/baselines/reference/jsdocReadonlyDeclarations.types @@ -48,3 +48,10 @@ function F() { >1 : 1 } +// https://github.com/microsoft/TypeScript/issues/38401 +class D { +>D : D + + constructor(/** @readonly */ x) {} +>x : any +} diff --git a/tests/baselines/reference/jsxPartialSpread.js b/tests/baselines/reference/jsxPartialSpread.js new file mode 100644 index 00000000000..e37b12f7d7a --- /dev/null +++ b/tests/baselines/reference/jsxPartialSpread.js @@ -0,0 +1,26 @@ +//// [jsxPartialSpread.tsx] +/// +const Select = (p: {value?: unknown}) =>

; +import React from 'react'; + +export function Repro({ SelectProps = {} }: { SelectProps?: Partial[0]> }) { + return ( + ); +} +exports.Repro = Repro; diff --git a/tests/baselines/reference/jsxPartialSpread.symbols b/tests/baselines/reference/jsxPartialSpread.symbols new file mode 100644 index 00000000000..7b0a1710649 --- /dev/null +++ b/tests/baselines/reference/jsxPartialSpread.symbols @@ -0,0 +1,28 @@ +=== tests/cases/compiler/jsxPartialSpread.tsx === +/// +const Select = (p: {value?: unknown}) =>

; +>Select : Symbol(Select, Decl(jsxPartialSpread.tsx, 1, 5)) +>p : Symbol(p, Decl(jsxPartialSpread.tsx, 1, 16)) +>value : Symbol(value, Decl(jsxPartialSpread.tsx, 1, 20)) +>p : Symbol(JSX.IntrinsicElements.p, Decl(react16.d.ts, 2467, 102)) +>p : Symbol(JSX.IntrinsicElements.p, Decl(react16.d.ts, 2467, 102)) + +import React from 'react'; +>React : Symbol(React, Decl(jsxPartialSpread.tsx, 2, 6)) + +export function Repro({ SelectProps = {} }: { SelectProps?: Partial[0]> }) { +>Repro : Symbol(Repro, Decl(jsxPartialSpread.tsx, 2, 26)) +>SelectProps : Symbol(SelectProps, Decl(jsxPartialSpread.tsx, 4, 23)) +>SelectProps : Symbol(SelectProps, Decl(jsxPartialSpread.tsx, 4, 45)) +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) +>Parameters : Symbol(Parameters, Decl(lib.es5.d.ts, --, --)) +>Select : Symbol(Select, Decl(jsxPartialSpread.tsx, 1, 5)) + + return ( + ) : JSX.Element + + : JSX.Element +>Select : (p: { value?: unknown; }) => JSX.Element +>value : string +>'test' : "test" +>SelectProps : Partial<{ value?: unknown; }> + + ); +} diff --git a/tests/baselines/reference/lambdaParameterWithTupleArgsHasCorrectAssignability.types b/tests/baselines/reference/lambdaParameterWithTupleArgsHasCorrectAssignability.types index 27d8e5a4cb4..435bdc4c4cf 100644 --- a/tests/baselines/reference/lambdaParameterWithTupleArgsHasCorrectAssignability.types +++ b/tests/baselines/reference/lambdaParameterWithTupleArgsHasCorrectAssignability.types @@ -33,7 +33,7 @@ function consumeClass(c: GenericClass<[string, boolean]>) { } consumeClass(createClass(str => console.log(str.length))); >consumeClass(createClass(str => console.log(str.length))) : void >consumeClass : (c: GenericClass<[string, boolean]>) => void ->createClass(str => console.log(str.length)) : GenericClass<[string]> +>createClass(str => console.log(str.length)) : GenericClass<[str: string]> >createClass : (f: GenericFunction) => GenericClass >str => console.log(str.length) : (str: string) => void >str : string @@ -49,7 +49,7 @@ consumeClass(createClass(str => console.log(str.length))); consumeClass(createClass((str, _unused_num) => console.log(str.length))); >consumeClass(createClass((str, _unused_num) => console.log(str.length))) : void >consumeClass : (c: GenericClass<[string, boolean]>) => void ->createClass((str, _unused_num) => console.log(str.length)) : GenericClass<[string, boolean]> +>createClass((str, _unused_num) => console.log(str.length)) : GenericClass<[str: string, _unused_num: boolean]> >createClass : (f: GenericFunction) => GenericClass >(str, _unused_num) => console.log(str.length) : (str: string, _unused_num: boolean) => void >str : string diff --git a/tests/baselines/reference/moduleAugmentationDoesInterfaceMergeOfReexport.js b/tests/baselines/reference/moduleAugmentationDoesInterfaceMergeOfReexport.js index 1366f9cb258..2d3b3b7a1b4 100644 --- a/tests/baselines/reference/moduleAugmentationDoesInterfaceMergeOfReexport.js +++ b/tests/baselines/reference/moduleAugmentationDoesInterfaceMergeOfReexport.js @@ -36,7 +36,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./file"), exports); //// [augment.js] diff --git a/tests/baselines/reference/moduleAugmentationDoesNamespaceEnumMergeOfReexport.js b/tests/baselines/reference/moduleAugmentationDoesNamespaceEnumMergeOfReexport.js index 0cf02bb0c60..38bfb39d776 100644 --- a/tests/baselines/reference/moduleAugmentationDoesNamespaceEnumMergeOfReexport.js +++ b/tests/baselines/reference/moduleAugmentationDoesNamespaceEnumMergeOfReexport.js @@ -41,7 +41,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./file"), exports); //// [augment.js] diff --git a/tests/baselines/reference/moduleAugmentationDoesNamespaceMergeOfReexport.js b/tests/baselines/reference/moduleAugmentationDoesNamespaceMergeOfReexport.js index 9ddd49666a8..8a606153bd1 100644 --- a/tests/baselines/reference/moduleAugmentationDoesNamespaceMergeOfReexport.js +++ b/tests/baselines/reference/moduleAugmentationDoesNamespaceMergeOfReexport.js @@ -40,7 +40,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./file"), exports); //// [augment.js] diff --git a/tests/baselines/reference/moduleAugmentationEnumClassMergeOfReexportIsError.js b/tests/baselines/reference/moduleAugmentationEnumClassMergeOfReexportIsError.js index 1bd7540e23f..0cb50179bfd 100644 --- a/tests/baselines/reference/moduleAugmentationEnumClassMergeOfReexportIsError.js +++ b/tests/baselines/reference/moduleAugmentationEnumClassMergeOfReexportIsError.js @@ -39,7 +39,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./file"), exports); //// [augment.js] diff --git a/tests/baselines/reference/moduleDeclarationExportStarShadowingGlobalIsNameable.js b/tests/baselines/reference/moduleDeclarationExportStarShadowingGlobalIsNameable.js index 9e49c965bfa..f243093f5be 100644 --- a/tests/baselines/reference/moduleDeclarationExportStarShadowingGlobalIsNameable.js +++ b/tests/baselines/reference/moduleDeclarationExportStarShadowingGlobalIsNameable.js @@ -39,7 +39,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./account"), exports); //// [index.js] diff --git a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.js b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.js index ab43c82628d..4051b88b059 100644 --- a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.js +++ b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.js @@ -26,7 +26,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./c"), exports); //// [a.js] @@ -40,7 +40,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./b"), exports); __exportStar(require("./c"), exports); diff --git a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.js b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.js index 456cc75fe8b..1a0b21438e2 100644 --- a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.js +++ b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.js @@ -46,7 +46,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./b"), exports); __exportStar(require("./c"), exports); diff --git a/tests/baselines/reference/namedTupleMembers.js b/tests/baselines/reference/namedTupleMembers.js new file mode 100644 index 00000000000..9095259eec9 --- /dev/null +++ b/tests/baselines/reference/namedTupleMembers.js @@ -0,0 +1,140 @@ +//// [namedTupleMembers.ts] +export type Segment = [length: number, count: number]; + +export type SegmentAnnotated = [ + /** + * Size of message buffer segment handles + */ + length: number, + /** + * Number of segments handled at once + */ + count: number +]; + +declare var a: Segment; +declare var b: SegmentAnnotated; +declare var c: [number, number]; +declare var d: [a: number, b: number]; + +a = b; +a = c; +a = d; + +b = a; +b = c; +b = d; + +c = a; +c = b; +c = d; + +d = a; +d = b; +d = c; + +export type WithOptAndRest = [first: number, second?: number, ...rest: string[]]; + +export type Func = (...x: T) => void; + +export const func = null as any as Func; + +export function useState(initial: T): [value: T, setter: (T) => void] { + return null as any; +} + + +export type Iter = Func<[step: number, iterations: number]>; + +export function readSegment([length, count]: [number, number]) {} + +// documenting binding pattern behavior (currently does _not_ generate tuple names) +export const val = null as any as Parameters[0]; + +export type RecursiveTupleA = [initial: string, next: RecursiveTupleA]; + +export type RecursiveTupleB = [first: string, ptr: RecursiveTupleB]; + +declare var q: RecursiveTupleA; +declare var r: RecursiveTupleB; + +q = r; +r = q; + +export type RecusiveRest = [first: string, ...rest: RecusiveRest[]]; +export type RecusiveRest2 = [string, ...RecusiveRest2[]]; + +declare var x: RecusiveRest; +declare var y: RecusiveRest2; + +x = y; +y = x; + +declare function f(...x: T): T; +declare function g(elem: object, index: number): object; +declare function getArgsForInjection any>(x: T): Parameters; + +export const argumentsOfGAsFirstArgument = f(getArgsForInjection(g)); // one tuple with captures arguments as first member +export const argumentsOfG = f(...getArgsForInjection(g)); // captured arguments list re-spread + + +//// [namedTupleMembers.js] +"use strict"; +exports.__esModule = true; +exports.argumentsOfG = exports.argumentsOfGAsFirstArgument = exports.val = exports.readSegment = exports.useState = exports.func = void 0; +a = b; +a = c; +a = d; +b = a; +b = c; +b = d; +c = a; +c = b; +c = d; +d = a; +d = b; +d = c; +exports.func = null; +function useState(initial) { + return null; +} +exports.useState = useState; +function readSegment(_a) { + var length = _a[0], count = _a[1]; +} +exports.readSegment = readSegment; +// documenting binding pattern behavior (currently does _not_ generate tuple names) +exports.val = null; +q = r; +r = q; +x = y; +y = x; +exports.argumentsOfGAsFirstArgument = f(getArgsForInjection(g)); // one tuple with captures arguments as first member +exports.argumentsOfG = f.apply(void 0, getArgsForInjection(g)); // captured arguments list re-spread + + +//// [namedTupleMembers.d.ts] +export declare type Segment = [length: number, count: number]; +export declare type SegmentAnnotated = [ + /** + * Size of message buffer segment handles + */ + length: number, + /** + * Number of segments handled at once + */ + count: number +]; +export declare type WithOptAndRest = [first: number, second?: number, ...rest: string[]]; +export declare type Func = (...x: T) => void; +export declare const func: Func; +export declare function useState(initial: T): [value: T, setter: (T: any) => void]; +export declare type Iter = Func<[step: number, iterations: number]>; +export declare function readSegment([length, count]: [number, number]): void; +export declare const val: [number, number]; +export declare type RecursiveTupleA = [initial: string, next: RecursiveTupleA]; +export declare type RecursiveTupleB = [first: string, ptr: RecursiveTupleB]; +export declare type RecusiveRest = [first: string, ...rest: RecusiveRest[]]; +export declare type RecusiveRest2 = [string, ...RecusiveRest2[]]; +export declare const argumentsOfGAsFirstArgument: [[elem: object, index: number]]; +export declare const argumentsOfG: [elem: object, index: number]; diff --git a/tests/baselines/reference/namedTupleMembers.symbols b/tests/baselines/reference/namedTupleMembers.symbols new file mode 100644 index 00000000000..a7d40391c8f --- /dev/null +++ b/tests/baselines/reference/namedTupleMembers.symbols @@ -0,0 +1,201 @@ +=== tests/cases/conformance/types/tuple/named/namedTupleMembers.ts === +export type Segment = [length: number, count: number]; +>Segment : Symbol(Segment, Decl(namedTupleMembers.ts, 0, 0)) + +export type SegmentAnnotated = [ +>SegmentAnnotated : Symbol(SegmentAnnotated, Decl(namedTupleMembers.ts, 0, 54)) + + /** + * Size of message buffer segment handles + */ + length: number, + /** + * Number of segments handled at once + */ + count: number +]; + +declare var a: Segment; +>a : Symbol(a, Decl(namedTupleMembers.ts, 13, 11)) +>Segment : Symbol(Segment, Decl(namedTupleMembers.ts, 0, 0)) + +declare var b: SegmentAnnotated; +>b : Symbol(b, Decl(namedTupleMembers.ts, 14, 11)) +>SegmentAnnotated : Symbol(SegmentAnnotated, Decl(namedTupleMembers.ts, 0, 54)) + +declare var c: [number, number]; +>c : Symbol(c, Decl(namedTupleMembers.ts, 15, 11)) + +declare var d: [a: number, b: number]; +>d : Symbol(d, Decl(namedTupleMembers.ts, 16, 11)) + +a = b; +>a : Symbol(a, Decl(namedTupleMembers.ts, 13, 11)) +>b : Symbol(b, Decl(namedTupleMembers.ts, 14, 11)) + +a = c; +>a : Symbol(a, Decl(namedTupleMembers.ts, 13, 11)) +>c : Symbol(c, Decl(namedTupleMembers.ts, 15, 11)) + +a = d; +>a : Symbol(a, Decl(namedTupleMembers.ts, 13, 11)) +>d : Symbol(d, Decl(namedTupleMembers.ts, 16, 11)) + +b = a; +>b : Symbol(b, Decl(namedTupleMembers.ts, 14, 11)) +>a : Symbol(a, Decl(namedTupleMembers.ts, 13, 11)) + +b = c; +>b : Symbol(b, Decl(namedTupleMembers.ts, 14, 11)) +>c : Symbol(c, Decl(namedTupleMembers.ts, 15, 11)) + +b = d; +>b : Symbol(b, Decl(namedTupleMembers.ts, 14, 11)) +>d : Symbol(d, Decl(namedTupleMembers.ts, 16, 11)) + +c = a; +>c : Symbol(c, Decl(namedTupleMembers.ts, 15, 11)) +>a : Symbol(a, Decl(namedTupleMembers.ts, 13, 11)) + +c = b; +>c : Symbol(c, Decl(namedTupleMembers.ts, 15, 11)) +>b : Symbol(b, Decl(namedTupleMembers.ts, 14, 11)) + +c = d; +>c : Symbol(c, Decl(namedTupleMembers.ts, 15, 11)) +>d : Symbol(d, Decl(namedTupleMembers.ts, 16, 11)) + +d = a; +>d : Symbol(d, Decl(namedTupleMembers.ts, 16, 11)) +>a : Symbol(a, Decl(namedTupleMembers.ts, 13, 11)) + +d = b; +>d : Symbol(d, Decl(namedTupleMembers.ts, 16, 11)) +>b : Symbol(b, Decl(namedTupleMembers.ts, 14, 11)) + +d = c; +>d : Symbol(d, Decl(namedTupleMembers.ts, 16, 11)) +>c : Symbol(c, Decl(namedTupleMembers.ts, 15, 11)) + +export type WithOptAndRest = [first: number, second?: number, ...rest: string[]]; +>WithOptAndRest : Symbol(WithOptAndRest, Decl(namedTupleMembers.ts, 32, 6)) + +export type Func = (...x: T) => void; +>Func : Symbol(Func, Decl(namedTupleMembers.ts, 34, 81)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 36, 17)) +>x : Symbol(x, Decl(namedTupleMembers.ts, 36, 37)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 36, 17)) + +export const func = null as any as Func; +>func : Symbol(func, Decl(namedTupleMembers.ts, 38, 12)) +>Func : Symbol(Func, Decl(namedTupleMembers.ts, 34, 81)) +>SegmentAnnotated : Symbol(SegmentAnnotated, Decl(namedTupleMembers.ts, 0, 54)) + +export function useState(initial: T): [value: T, setter: (T) => void] { +>useState : Symbol(useState, Decl(namedTupleMembers.ts, 38, 58)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 40, 25)) +>initial : Symbol(initial, Decl(namedTupleMembers.ts, 40, 28)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 40, 25)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 40, 25)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 40, 61)) + + return null as any; +} + + +export type Iter = Func<[step: number, iterations: number]>; +>Iter : Symbol(Iter, Decl(namedTupleMembers.ts, 42, 1)) +>Func : Symbol(Func, Decl(namedTupleMembers.ts, 34, 81)) + +export function readSegment([length, count]: [number, number]) {} +>readSegment : Symbol(readSegment, Decl(namedTupleMembers.ts, 45, 60)) +>length : Symbol(length, Decl(namedTupleMembers.ts, 47, 29)) +>count : Symbol(count, Decl(namedTupleMembers.ts, 47, 36)) + +// documenting binding pattern behavior (currently does _not_ generate tuple names) +export const val = null as any as Parameters[0]; +>val : Symbol(val, Decl(namedTupleMembers.ts, 50, 12)) +>Parameters : Symbol(Parameters, Decl(lib.es5.d.ts, --, --)) +>readSegment : Symbol(readSegment, Decl(namedTupleMembers.ts, 45, 60)) + +export type RecursiveTupleA = [initial: string, next: RecursiveTupleA]; +>RecursiveTupleA : Symbol(RecursiveTupleA, Decl(namedTupleMembers.ts, 50, 68)) +>RecursiveTupleA : Symbol(RecursiveTupleA, Decl(namedTupleMembers.ts, 50, 68)) + +export type RecursiveTupleB = [first: string, ptr: RecursiveTupleB]; +>RecursiveTupleB : Symbol(RecursiveTupleB, Decl(namedTupleMembers.ts, 52, 71)) +>RecursiveTupleB : Symbol(RecursiveTupleB, Decl(namedTupleMembers.ts, 52, 71)) + +declare var q: RecursiveTupleA; +>q : Symbol(q, Decl(namedTupleMembers.ts, 56, 11)) +>RecursiveTupleA : Symbol(RecursiveTupleA, Decl(namedTupleMembers.ts, 50, 68)) + +declare var r: RecursiveTupleB; +>r : Symbol(r, Decl(namedTupleMembers.ts, 57, 11)) +>RecursiveTupleB : Symbol(RecursiveTupleB, Decl(namedTupleMembers.ts, 52, 71)) + +q = r; +>q : Symbol(q, Decl(namedTupleMembers.ts, 56, 11)) +>r : Symbol(r, Decl(namedTupleMembers.ts, 57, 11)) + +r = q; +>r : Symbol(r, Decl(namedTupleMembers.ts, 57, 11)) +>q : Symbol(q, Decl(namedTupleMembers.ts, 56, 11)) + +export type RecusiveRest = [first: string, ...rest: RecusiveRest[]]; +>RecusiveRest : Symbol(RecusiveRest, Decl(namedTupleMembers.ts, 60, 6)) +>RecusiveRest : Symbol(RecusiveRest, Decl(namedTupleMembers.ts, 60, 6)) + +export type RecusiveRest2 = [string, ...RecusiveRest2[]]; +>RecusiveRest2 : Symbol(RecusiveRest2, Decl(namedTupleMembers.ts, 62, 68)) +>RecusiveRest2 : Symbol(RecusiveRest2, Decl(namedTupleMembers.ts, 62, 68)) + +declare var x: RecusiveRest; +>x : Symbol(x, Decl(namedTupleMembers.ts, 65, 11)) +>RecusiveRest : Symbol(RecusiveRest, Decl(namedTupleMembers.ts, 60, 6)) + +declare var y: RecusiveRest2; +>y : Symbol(y, Decl(namedTupleMembers.ts, 66, 11)) +>RecusiveRest2 : Symbol(RecusiveRest2, Decl(namedTupleMembers.ts, 62, 68)) + +x = y; +>x : Symbol(x, Decl(namedTupleMembers.ts, 65, 11)) +>y : Symbol(y, Decl(namedTupleMembers.ts, 66, 11)) + +y = x; +>y : Symbol(y, Decl(namedTupleMembers.ts, 66, 11)) +>x : Symbol(x, Decl(namedTupleMembers.ts, 65, 11)) + +declare function f(...x: T): T; +>f : Symbol(f, Decl(namedTupleMembers.ts, 69, 6)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 71, 19)) +>x : Symbol(x, Decl(namedTupleMembers.ts, 71, 36)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 71, 19)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 71, 19)) + +declare function g(elem: object, index: number): object; +>g : Symbol(g, Decl(namedTupleMembers.ts, 71, 48)) +>elem : Symbol(elem, Decl(namedTupleMembers.ts, 72, 19)) +>index : Symbol(index, Decl(namedTupleMembers.ts, 72, 32)) + +declare function getArgsForInjection any>(x: T): Parameters; +>getArgsForInjection : Symbol(getArgsForInjection, Decl(namedTupleMembers.ts, 72, 56)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 73, 37)) +>args : Symbol(args, Decl(namedTupleMembers.ts, 73, 48)) +>x : Symbol(x, Decl(namedTupleMembers.ts, 73, 72)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 73, 37)) +>Parameters : Symbol(Parameters, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(namedTupleMembers.ts, 73, 37)) + +export const argumentsOfGAsFirstArgument = f(getArgsForInjection(g)); // one tuple with captures arguments as first member +>argumentsOfGAsFirstArgument : Symbol(argumentsOfGAsFirstArgument, Decl(namedTupleMembers.ts, 75, 12)) +>f : Symbol(f, Decl(namedTupleMembers.ts, 69, 6)) +>getArgsForInjection : Symbol(getArgsForInjection, Decl(namedTupleMembers.ts, 72, 56)) +>g : Symbol(g, Decl(namedTupleMembers.ts, 71, 48)) + +export const argumentsOfG = f(...getArgsForInjection(g)); // captured arguments list re-spread +>argumentsOfG : Symbol(argumentsOfG, Decl(namedTupleMembers.ts, 76, 12)) +>f : Symbol(f, Decl(namedTupleMembers.ts, 69, 6)) +>getArgsForInjection : Symbol(getArgsForInjection, Decl(namedTupleMembers.ts, 72, 56)) +>g : Symbol(g, Decl(namedTupleMembers.ts, 71, 48)) + diff --git a/tests/baselines/reference/namedTupleMembers.types b/tests/baselines/reference/namedTupleMembers.types new file mode 100644 index 00000000000..14badf44552 --- /dev/null +++ b/tests/baselines/reference/namedTupleMembers.types @@ -0,0 +1,204 @@ +=== tests/cases/conformance/types/tuple/named/namedTupleMembers.ts === +export type Segment = [length: number, count: number]; +>Segment : Segment + +export type SegmentAnnotated = [ +>SegmentAnnotated : SegmentAnnotated + + /** + * Size of message buffer segment handles + */ + length: number, + /** + * Number of segments handled at once + */ + count: number +]; + +declare var a: Segment; +>a : Segment + +declare var b: SegmentAnnotated; +>b : SegmentAnnotated + +declare var c: [number, number]; +>c : [number, number] + +declare var d: [a: number, b: number]; +>d : [a: number, b: number] + +a = b; +>a = b : SegmentAnnotated +>a : Segment +>b : SegmentAnnotated + +a = c; +>a = c : [number, number] +>a : Segment +>c : [number, number] + +a = d; +>a = d : [a: number, b: number] +>a : Segment +>d : [a: number, b: number] + +b = a; +>b = a : Segment +>b : SegmentAnnotated +>a : Segment + +b = c; +>b = c : [number, number] +>b : SegmentAnnotated +>c : [number, number] + +b = d; +>b = d : [a: number, b: number] +>b : SegmentAnnotated +>d : [a: number, b: number] + +c = a; +>c = a : Segment +>c : [number, number] +>a : Segment + +c = b; +>c = b : SegmentAnnotated +>c : [number, number] +>b : SegmentAnnotated + +c = d; +>c = d : [a: number, b: number] +>c : [number, number] +>d : [a: number, b: number] + +d = a; +>d = a : Segment +>d : [a: number, b: number] +>a : Segment + +d = b; +>d = b : SegmentAnnotated +>d : [a: number, b: number] +>b : SegmentAnnotated + +d = c; +>d = c : [number, number] +>d : [a: number, b: number] +>c : [number, number] + +export type WithOptAndRest = [first: number, second?: number, ...rest: string[]]; +>WithOptAndRest : WithOptAndRest + +export type Func = (...x: T) => void; +>Func : Func +>x : T + +export const func = null as any as Func; +>func : Func +>null as any as Func : Func +>null as any : any +>null : null + +export function useState(initial: T): [value: T, setter: (T) => void] { +>useState : (initial: T) => [value: T, setter: (T: any) => void] +>initial : T +>T : any + + return null as any; +>null as any : any +>null : null +} + + +export type Iter = Func<[step: number, iterations: number]>; +>Iter : Func<[step: number, iterations: number]> + +export function readSegment([length, count]: [number, number]) {} +>readSegment : ([length, count]: [number, number]) => void +>length : number +>count : number + +// documenting binding pattern behavior (currently does _not_ generate tuple names) +export const val = null as any as Parameters[0]; +>val : [number, number] +>null as any as Parameters[0] : [number, number] +>null as any : any +>null : null +>readSegment : ([length, count]: [number, number]) => void + +export type RecursiveTupleA = [initial: string, next: RecursiveTupleA]; +>RecursiveTupleA : RecursiveTupleA + +export type RecursiveTupleB = [first: string, ptr: RecursiveTupleB]; +>RecursiveTupleB : RecursiveTupleB + +declare var q: RecursiveTupleA; +>q : RecursiveTupleA + +declare var r: RecursiveTupleB; +>r : RecursiveTupleB + +q = r; +>q = r : RecursiveTupleB +>q : RecursiveTupleA +>r : RecursiveTupleB + +r = q; +>r = q : RecursiveTupleA +>r : RecursiveTupleB +>q : RecursiveTupleA + +export type RecusiveRest = [first: string, ...rest: RecusiveRest[]]; +>RecusiveRest : RecusiveRest + +export type RecusiveRest2 = [string, ...RecusiveRest2[]]; +>RecusiveRest2 : RecusiveRest2 + +declare var x: RecusiveRest; +>x : RecusiveRest + +declare var y: RecusiveRest2; +>y : RecusiveRest2 + +x = y; +>x = y : RecusiveRest2 +>x : RecusiveRest +>y : RecusiveRest2 + +y = x; +>y = x : RecusiveRest +>y : RecusiveRest2 +>x : RecusiveRest + +declare function f(...x: T): T; +>f : (...x: T) => T +>x : T + +declare function g(elem: object, index: number): object; +>g : (elem: object, index: number) => object +>elem : object +>index : number + +declare function getArgsForInjection any>(x: T): Parameters; +>getArgsForInjection : any>(x: T) => Parameters +>args : any[] +>x : T + +export const argumentsOfGAsFirstArgument = f(getArgsForInjection(g)); // one tuple with captures arguments as first member +>argumentsOfGAsFirstArgument : [[elem: object, index: number]] +>f(getArgsForInjection(g)) : [[elem: object, index: number]] +>f : (...x: T) => T +>getArgsForInjection(g) : [elem: object, index: number] +>getArgsForInjection : any>(x: T) => Parameters +>g : (elem: object, index: number) => object + +export const argumentsOfG = f(...getArgsForInjection(g)); // captured arguments list re-spread +>argumentsOfG : [elem: object, index: number] +>f(...getArgsForInjection(g)) : [elem: object, index: number] +>f : (...x: T) => T +>...getArgsForInjection(g) : number | object +>getArgsForInjection(g) : [elem: object, index: number] +>getArgsForInjection : any>(x: T) => Parameters +>g : (elem: object, index: number) => object + diff --git a/tests/baselines/reference/namedTupleMembersErrors.errors.txt b/tests/baselines/reference/namedTupleMembersErrors.errors.txt new file mode 100644 index 00000000000..19e40ba9371 --- /dev/null +++ b/tests/baselines/reference/namedTupleMembersErrors.errors.txt @@ -0,0 +1,55 @@ +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(1,41): error TS5084: Tuple members must all have names or all not have names. +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(3,32): error TS5084: Tuple members must all have names or all not have names. +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(5,32): error TS5084: Tuple members must all have names or all not have names. +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(7,29): error TS5086: A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type. +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(9,46): error TS5087: A labeled tuple element is declared as rest with a `...` before the name, rather than before the type. +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(11,49): error TS5087: A labeled tuple element is declared as rest with a `...` before the name, rather than before the type. +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(11,52): error TS8020: JSDoc types can only be used inside documentation comments. +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(13,39): error TS5085: A tuple member cannot be both optional and rest. +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(15,44): error TS2574: A rest element type must be an array type. +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(17,46): error TS2574: A rest element type must be an array type. +tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts(18,44): error TS2574: A rest element type must be an array type. + + +==== tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts (11 errors) ==== + export type Segment1 = [length: number, number]; // partially named, disallowed + ~~~~~~ +!!! error TS5084: Tuple members must all have names or all not have names. + + export type List = [item: any, ...any]; // partially named, disallowed + ~~~~~~ +!!! error TS5084: Tuple members must all have names or all not have names. + + export type Pair = [item: any, any?]; // partially named, disallowed + ~~~~ +!!! error TS5084: Tuple members must all have names or all not have names. + + export type Opt = [element: string?]; // question mark on element disallowed + ~~~~~~~ +!!! error TS5086: A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type. + + export type Trailing = [first: string, rest: ...string[]]; // dots on element disallowed + ~~~~~~~~~~~ +!!! error TS5087: A labeled tuple element is declared as rest with a `...` before the name, rather than before the type. + + export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed + ~~~~~~~~~~~~ +!!! error TS5087: A labeled tuple element is declared as rest with a `...` before the name, rather than before the type. + ~~~~~~~~~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + + export type OptRest = [first: string, ...rest?: string[]]; // rest+optional disallowed + ~~~~~~~~~~~~~~~~~~ +!!! error TS5085: A tuple member cannot be both optional and rest. + + export type NonArrayRest = [first: string, ...rest: number]; // non-arraylike rest, disallowed + ~~~~~~~~~~~~~~~ +!!! error TS2574: A rest element type must be an array type. + + export type RecusiveRestUnlabeled = [string, ...RecusiveRestUnlabeled]; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2574: A rest element type must be an array type. + export type RecusiveRest = [first: string, ...rest: RecusiveRest]; // marked as incorrect, same as above + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2574: A rest element type must be an array type. + \ No newline at end of file diff --git a/tests/baselines/reference/namedTupleMembersErrors.js b/tests/baselines/reference/namedTupleMembersErrors.js new file mode 100644 index 00000000000..5b277b3efe0 --- /dev/null +++ b/tests/baselines/reference/namedTupleMembersErrors.js @@ -0,0 +1,37 @@ +//// [namedTupleMembersErrors.ts] +export type Segment1 = [length: number, number]; // partially named, disallowed + +export type List = [item: any, ...any]; // partially named, disallowed + +export type Pair = [item: any, any?]; // partially named, disallowed + +export type Opt = [element: string?]; // question mark on element disallowed + +export type Trailing = [first: string, rest: ...string[]]; // dots on element disallowed + +export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed + +export type OptRest = [first: string, ...rest?: string[]]; // rest+optional disallowed + +export type NonArrayRest = [first: string, ...rest: number]; // non-arraylike rest, disallowed + +export type RecusiveRestUnlabeled = [string, ...RecusiveRestUnlabeled]; +export type RecusiveRest = [first: string, ...rest: RecusiveRest]; // marked as incorrect, same as above + + +//// [namedTupleMembersErrors.js] +"use strict"; +exports.__esModule = true; + + +//// [namedTupleMembersErrors.d.ts] +export declare type Segment1 = [length: number, number]; +export declare type List = [item: any, ...any]; +export declare type Pair = [item: any, any?]; +export declare type Opt = [element: string?]; +export declare type Trailing = [first: string, rest: ...string[]]; +export declare type OptTrailing = [first: string, rest: ...?string[]]; +export declare type OptRest = [first: string, ...rest?: string[]]; +export declare type NonArrayRest = [first: string, ...rest: number]; +export declare type RecusiveRestUnlabeled = [string, ...RecusiveRestUnlabeled]; +export declare type RecusiveRest = [first: string, ...rest: RecusiveRest]; diff --git a/tests/baselines/reference/namedTupleMembersErrors.symbols b/tests/baselines/reference/namedTupleMembersErrors.symbols new file mode 100644 index 00000000000..613bf86cddd --- /dev/null +++ b/tests/baselines/reference/namedTupleMembersErrors.symbols @@ -0,0 +1,33 @@ +=== tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts === +export type Segment1 = [length: number, number]; // partially named, disallowed +>Segment1 : Symbol(Segment1, Decl(namedTupleMembersErrors.ts, 0, 0)) + +export type List = [item: any, ...any]; // partially named, disallowed +>List : Symbol(List, Decl(namedTupleMembersErrors.ts, 0, 48)) + +export type Pair = [item: any, any?]; // partially named, disallowed +>Pair : Symbol(Pair, Decl(namedTupleMembersErrors.ts, 2, 39)) + +export type Opt = [element: string?]; // question mark on element disallowed +>Opt : Symbol(Opt, Decl(namedTupleMembersErrors.ts, 4, 37)) + +export type Trailing = [first: string, rest: ...string[]]; // dots on element disallowed +>Trailing : Symbol(Trailing, Decl(namedTupleMembersErrors.ts, 6, 37)) + +export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed +>OptTrailing : Symbol(OptTrailing, Decl(namedTupleMembersErrors.ts, 8, 58)) + +export type OptRest = [first: string, ...rest?: string[]]; // rest+optional disallowed +>OptRest : Symbol(OptRest, Decl(namedTupleMembersErrors.ts, 10, 62)) + +export type NonArrayRest = [first: string, ...rest: number]; // non-arraylike rest, disallowed +>NonArrayRest : Symbol(NonArrayRest, Decl(namedTupleMembersErrors.ts, 12, 58)) + +export type RecusiveRestUnlabeled = [string, ...RecusiveRestUnlabeled]; +>RecusiveRestUnlabeled : Symbol(RecusiveRestUnlabeled, Decl(namedTupleMembersErrors.ts, 14, 60)) +>RecusiveRestUnlabeled : Symbol(RecusiveRestUnlabeled, Decl(namedTupleMembersErrors.ts, 14, 60)) + +export type RecusiveRest = [first: string, ...rest: RecusiveRest]; // marked as incorrect, same as above +>RecusiveRest : Symbol(RecusiveRest, Decl(namedTupleMembersErrors.ts, 16, 71)) +>RecusiveRest : Symbol(RecusiveRest, Decl(namedTupleMembersErrors.ts, 16, 71)) + diff --git a/tests/baselines/reference/namedTupleMembersErrors.types b/tests/baselines/reference/namedTupleMembersErrors.types new file mode 100644 index 00000000000..3285a453592 --- /dev/null +++ b/tests/baselines/reference/namedTupleMembersErrors.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts === +export type Segment1 = [length: number, number]; // partially named, disallowed +>Segment1 : Segment1 + +export type List = [item: any, ...any]; // partially named, disallowed +>List : List + +export type Pair = [item: any, any?]; // partially named, disallowed +>Pair : Pair + +export type Opt = [element: string?]; // question mark on element disallowed +>Opt : Opt + +export type Trailing = [first: string, rest: ...string[]]; // dots on element disallowed +>Trailing : Trailing + +export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed +>OptTrailing : OptTrailing + +export type OptRest = [first: string, ...rest?: string[]]; // rest+optional disallowed +>OptRest : OptRest + +export type NonArrayRest = [first: string, ...rest: number]; // non-arraylike rest, disallowed +>NonArrayRest : NonArrayRest + +export type RecusiveRestUnlabeled = [string, ...RecusiveRestUnlabeled]; +>RecusiveRestUnlabeled : RecusiveRestUnlabeled + +export type RecusiveRest = [first: string, ...rest: RecusiveRest]; // marked as incorrect, same as above +>RecusiveRest : RecusiveRest + diff --git a/tests/baselines/reference/organizeImports/SortComments.ts b/tests/baselines/reference/organizeImports/SortComments.ts new file mode 100644 index 00000000000..761bca1a212 --- /dev/null +++ b/tests/baselines/reference/organizeImports/SortComments.ts @@ -0,0 +1,17 @@ +// ==ORIGINAL== + +// Header +import "lib3"; +// Comment2 +import "lib2"; +// Comment1 +import "lib1"; + +// ==ORGANIZED== + +// Header +// Comment1 +import "lib1"; +// Comment2 +import "lib2"; +import "lib3"; diff --git a/tests/baselines/reference/parameterListAsTupleType.types b/tests/baselines/reference/parameterListAsTupleType.types index 3bb861f5a1d..0412ab7f75f 100644 --- a/tests/baselines/reference/parameterListAsTupleType.types +++ b/tests/baselines/reference/parameterListAsTupleType.types @@ -8,7 +8,7 @@ function foo(a: number, b: string) { >true : true } type Foops = Parameters; ->Foops : [number, string] +>Foops : [a: number, b: string] >foo : (a: number, b: string) => boolean const x = (a: number) => 5; @@ -18,17 +18,17 @@ const x = (a: number) => 5; >5 : 5 type Xps = Parameters; ->Xps : [number] +>Xps : [a: number] >x : (a: number) => number const a: Xps = ['should-not-work']; // works, but shouldn't ->a : [number] +>a : [a: number] >['should-not-work'] : [string] >'should-not-work' : "should-not-work" function t(...args: Xps) {} // should work >t : (a: number) => void ->args : [number] +>args : [a: number] class C { >C : C @@ -44,7 +44,7 @@ type Cps = Parameters; // should not work >C : typeof C type Ccps = ConstructorParameters; // should be [number, string] ->Ccps : [number, string] +>Ccps : [a: number, b: string] >C : typeof C class D { @@ -56,6 +56,6 @@ class D { } } type Dcps = ConstructorParameters; // should be [number, ...string[]] ->Dcps : [number, ...string[]] +>Dcps : [a: number, ...rest: string[]] >D : typeof D diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.types b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.types index 94eabc48b8f..3f49d1ac95a 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.types +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.types @@ -105,7 +105,7 @@ testRest((t2: D, ...t3) => {}) >testRest : (a: (t: T, t1: T, ...ts: T[]) => void) => T >(t2: D, ...t3) => {} : (t2: D, t1: D, ...ts: D[]) => void >t2 : D ->t3 : [D, ...D[]] +>t3 : [t1: D, ...ts: D[]] testRest((t2, ...t3: D[]) => {}) >testRest((t2, ...t3: D[]) => {}) : C diff --git a/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline b/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline new file mode 100644 index 00000000000..b03ca277801 --- /dev/null +++ b/tests/baselines/reference/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.baseline @@ -0,0 +1,60 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01.ts", + "position": 746 + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "optional", + "textSpan": { + "start": 746, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "language", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "A language id, like `typescript`.", + "kind": "text" + } + ] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/ramdaToolsNoInfinite.types b/tests/baselines/reference/ramdaToolsNoInfinite.types index 229bdfe4c40..d6ac7f2da1e 100644 --- a/tests/baselines/reference/ramdaToolsNoInfinite.types +++ b/tests/baselines/reference/ramdaToolsNoInfinite.types @@ -128,12 +128,12 @@ declare namespace Tools { ]; type Concat = ->Concat : { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends (any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[9], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[8], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[7], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[6], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[5], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>>>>>>; }[10 extends ({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[8], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[7], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[6], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[5], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>>>>>; }[9 extends ({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[7], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[6], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[5], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>>>>; }[8 extends ({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[6], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[5], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>>>; }[7 extends ({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[5], Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>>; }[6 extends ({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>; }[5 extends ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>; }[4 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>; }[3 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T1["length"] ? 1 : 0]; 1: [T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T1["length"] ? 1 : 0]; 1: [T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T1["length"] ? 1 : 0]; 1: [T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>; }[2 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T1["length"] ? 1 : 0]; 1: [T1[7], T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[8 extends T1["length"] ? 1 : 0]; 1: [T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T1["length"] ? 1 : 0]; 1: [T1[7], T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[8 extends T1["length"] ? 1 : 0]; 1: [T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>; }[1 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[10 extends T1["length"] ? 1 : 0]; 1: [T1[8], T1[7], T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[9 extends T1["length"] ? 1 : 0]; 1: [T1[7], T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[8 extends T1["length"] ? 1 : 0]; 1: [T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: T2; }[0 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends T1["length"] ? 1 : 0]; 1: [T1[9], T1[8], T1[7], T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[10 extends T1["length"] ? 1 : 0]; 1: [T1[8], T1[7], T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[9 extends T1["length"] ? 1 : 0]; 1: [T1[7], T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[8 extends T1["length"] ? 1 : 0]; 1: [T1[6], T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [T1[5], T1[4], T1[3], T1[2], T1[1], T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [T1[4], T1[3], T1[2], T1[1], T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [T1[3], T1[2], T1[1], T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [T1[2], T1[1], T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [T1[1], T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0] +>Concat : { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends (any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[9], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[8], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[7], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[6], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[5], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<(any[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>>>>>>; }[10 extends ({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[8], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[7], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[6], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[5], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: any[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>>>>>; }[9 extends ({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[7], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[6], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[5], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: any[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>>>>; }[8 extends ({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[6], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[5], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: any[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>>>; }[7 extends ({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[5], Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: { 0: any[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>>; }[6 extends ({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[4], Prepend<({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: { 0: { 0: any[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>>; }[5 extends ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[3], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>>; }[4 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[2], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>>; }[3 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T1["length"] ? 1 : 0]; 1: [head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T1["length"] ? 1 : 0]; 1: [head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[1], Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T1["length"] ? 1 : 0]; 1: [head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>>; }[2 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T1["length"] ? 1 : 0]; 1: [head: T1[7], head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[8 extends T1["length"] ? 1 : 0]; 1: [head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: Prepend<({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T1["length"] ? 1 : 0]; 1: [head: T1[7], head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[8 extends T1["length"] ? 1 : 0]; 1: [head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)[0], T2>; }[1 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[10 extends T1["length"] ? 1 : 0]; 1: [head: T1[8], head: T1[7], head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[9 extends T1["length"] ? 1 : 0]; 1: [head: T1[7], head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[8 extends T1["length"] ? 1 : 0]; 1: [head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: T2; }[0 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends T1["length"] ? 1 : 0]; 1: [head: T1[9], head: T1[8], head: T1[7], head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[10 extends T1["length"] ? 1 : 0]; 1: [head: T1[8], head: T1[7], head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[9 extends T1["length"] ? 1 : 0]; 1: [head: T1[7], head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[8 extends T1["length"] ? 1 : 0]; 1: [head: T1[6], head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[7 extends T1["length"] ? 1 : 0]; 1: [head: T1[5], head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[6 extends T1["length"] ? 1 : 0]; 1: [head: T1[4], head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[5 extends T1["length"] ? 1 : 0]; 1: [head: T1[3], head: T1[2], head: T1[1], head: T1[0]]; }[4 extends T1["length"] ? 1 : 0]; 1: [head: T1[2], head: T1[1], head: T1[0]]; }[3 extends T1["length"] ? 1 : 0]; 1: [head: T1[1], head: T1[0]]; }[2 extends T1["length"] ? 1 : 0]; 1: [head: T1[0]]; }[1 extends T1["length"] ? 1 : 0]; 1: []; }[0 extends T1["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0] Reverse extends infer R ? Cast : never, T2>; type Append = ->Append : { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [(any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[9], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[8], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[10 extends ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[8], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[9 extends ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[8 extends ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[7 extends ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[6 extends ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[5 extends ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[4 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[3 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[2 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T["length"] ? 1 : 0]; 1: [T[7], T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T["length"] ? 1 : 0]; 1: [T[7], T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[1 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[10 extends T["length"] ? 1 : 0]; 1: [T[8], T[7], T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[9 extends T["length"] ? 1 : 0]; 1: [T[7], T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [E]; }[0 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends T["length"] ? 1 : 0]; 1: [T[9], T[8], T[7], T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[10 extends T["length"] ? 1 : 0]; 1: [T[8], T[7], T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[9 extends T["length"] ? 1 : 0]; 1: [T[7], T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [T[6], T[5], T[4], T[3], T[2], T[1], T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [T[5], T[4], T[3], T[2], T[1], T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [T[4], T[3], T[2], T[1], T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [T[3], T[2], T[1], T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [T[2], T[1], T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [T[1], T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0] +>Append : { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [(any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[9], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[8], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[10 extends ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[8], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[9 extends ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[8 extends ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[7 extends ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[6 extends ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[5 extends ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[4 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[3 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[2 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[1 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[10 extends T["length"] ? 1 : 0]; 1: [head: T[8], head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [E]; }[0 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends T["length"] ? 1 : 0]; 1: [head: T[9], head: T[8], head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[10 extends T["length"] ? 1 : 0]; 1: [head: T[8], head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0] Concat; @@ -168,7 +168,7 @@ declare namespace Curry { >Tools : any 1: Tools.Concat, T2> extends infer D ? Tools.Cast : never>; ->1 : { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [(any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[9], (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[8], (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[7], (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[6], (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[5], (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[10 extends ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[8], ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[7], ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[6], ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[5], ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[9 extends ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[7], ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[6], ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[5], ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[8 extends ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[6], ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[5], ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[7 extends ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[5], ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[6 extends ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[5 extends ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[4 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[3 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends TN["length"] ? 1 : 0]; 1: [TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends TN["length"] ? 1 : 0]; 1: [TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends TN["length"] ? 1 : 0]; 1: [TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[2 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends TN["length"] ? 1 : 0]; 1: [TN[7], TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[8 extends TN["length"] ? 1 : 0]; 1: [TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends TN["length"] ? 1 : 0]; 1: [TN[7], TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[8 extends TN["length"] ? 1 : 0]; 1: [TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[1 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[10 extends TN["length"] ? 1 : 0]; 1: [TN[8], TN[7], TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[9 extends TN["length"] ? 1 : 0]; 1: [TN[7], TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[8 extends TN["length"] ? 1 : 0]; 1: [TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never; }[0 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends TN["length"] ? 1 : 0]; 1: [TN[9], TN[8], TN[7], TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[10 extends TN["length"] ? 1 : 0]; 1: [TN[8], TN[7], TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[9 extends TN["length"] ? 1 : 0]; 1: [TN[7], TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[8 extends TN["length"] ? 1 : 0]; 1: [TN[6], TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [TN[5], TN[4], TN[3], TN[2], TN[1], TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [TN[4], TN[3], TN[2], TN[1], TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [TN[3], TN[2], TN[1], TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [TN[2], TN[1], TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [TN[1], TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0] +>1 : { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [head: (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[9], head: (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[8], head: (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[7], head: (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[6], head: (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[5], head: (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], head: (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], head: (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], head: (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], head: (any[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...args: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[10 extends ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[8], head: ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[7], head: ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[6], head: ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[5], head: ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], head: ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], head: ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], head: ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], head: ({ 0: any[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...args: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[9 extends ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[7], head: ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[6], head: ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[5], head: ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], head: ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], head: ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], head: ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], head: ({ 0: { 0: any[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...args: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[8 extends ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[6], head: ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[5], head: ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], head: ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], head: ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], head: ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], head: ({ 0: { 0: { 0: any[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...args: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[7 extends ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[5], head: ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], head: ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], head: ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], head: ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], head: ({ 0: { 0: { 0: { 0: any[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...args: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[6 extends ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[4], head: ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], head: ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], head: ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], head: ({ 0: { 0: { 0: { 0: { 0: any[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...args: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[5 extends ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[3], head: ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], head: ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], head: ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...args: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[4 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[2], head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...args: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[3 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends TN["length"] ? 1 : 0]; 1: [head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends TN["length"] ? 1 : 0]; 1: [head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[1], head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends TN["length"] ? 1 : 0]; 1: [head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...args: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[2 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends TN["length"] ? 1 : 0]; 1: [head: TN[7], head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[8 extends TN["length"] ? 1 : 0]; 1: [head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends TN["length"] ? 1 : 0]; 1: [head: TN[7], head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[8 extends TN["length"] ? 1 : 0]; 1: [head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)[0], ...args: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never)[number][]]; }[1 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[10 extends TN["length"] ? 1 : 0]; 1: [head: TN[8], head: TN[7], head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[9 extends TN["length"] ? 1 : 0]; 1: [head: TN[7], head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[8 extends TN["length"] ? 1 : 0]; 1: [head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0]; 1: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>>; }[10 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>>; }[9 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>>; }[8 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>>; }[7 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>>; }[6 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>>; }[5 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>>; }[4 extends I["length"] ? 1 : 0]; 1: Tools.Tail>>; }[3 extends I["length"] ? 1 : 0]; 1: Tools.Tail>; }[2 extends I["length"] ? 1 : 0]; 1: Tools.Tail; }[1 extends I["length"] ? 1 : 0]; 1: T2; }[0 extends I["length"] ? 1 : 0] extends infer D ? Tools.Cast : never; }[0 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends TN["length"] ? 1 : 0]; 1: [head: TN[9], head: TN[8], head: TN[7], head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[10 extends TN["length"] ? 1 : 0]; 1: [head: TN[8], head: TN[7], head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[9 extends TN["length"] ? 1 : 0]; 1: [head: TN[7], head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[8 extends TN["length"] ? 1 : 0]; 1: [head: TN[6], head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[7 extends TN["length"] ? 1 : 0]; 1: [head: TN[5], head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[6 extends TN["length"] ? 1 : 0]; 1: [head: TN[4], head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[5 extends TN["length"] ? 1 : 0]; 1: [head: TN[3], head: TN[2], head: TN[1], head: TN[0]]; }[4 extends TN["length"] ? 1 : 0]; 1: [head: TN[2], head: TN[1], head: TN[0]]; }[3 extends TN["length"] ? 1 : 0]; 1: [head: TN[1], head: TN[0]]; }[2 extends TN["length"] ? 1 : 0]; 1: [head: TN[0]]; }[1 extends TN["length"] ? 1 : 0]; 1: []; }[0 extends TN["length"] ? 1 : 0] extends infer R ? Tools.Cast : never)["length"] ? 1 : 0] >Tools : any >Tools : any >Tools : any diff --git a/tests/baselines/reference/restTuplesFromContextualTypes.errors.txt b/tests/baselines/reference/restTuplesFromContextualTypes.errors.txt index 5f2c299735b..5c3d13b87e4 100644 --- a/tests/baselines/reference/restTuplesFromContextualTypes.errors.txt +++ b/tests/baselines/reference/restTuplesFromContextualTypes.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts(56,7): error TS2345: Argument of type '(a: number, b: T[0], ...x: T[number][]) => void' is not assignable to parameter of type '(x: number, ...args: T) => void'. Types of parameters 'b' and 'args' are incompatible. - Type 'T' is not assignable to type '[T[0], ...T[number][]]'. - Property '0' is missing in type 'any[]' but required in type '[T[0], ...T[number][]]'. + Type 'T' is not assignable to type '[b: T[0], ...x: T[number][]]'. + Property '0' is missing in type 'any[]' but required in type '[b: T[0], ...x: T[number][]]'. ==== tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts (1 errors) ==== @@ -64,8 +64,8 @@ tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts(56,7): error ~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(a: number, b: T[0], ...x: T[number][]) => void' is not assignable to parameter of type '(x: number, ...args: T) => void'. !!! error TS2345: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2345: Type 'T' is not assignable to type '[T[0], ...T[number][]]'. -!!! error TS2345: Property '0' is missing in type 'any[]' but required in type '[T[0], ...T[number][]]'. +!!! error TS2345: Type 'T' is not assignable to type '[b: T[0], ...x: T[number][]]'. +!!! error TS2345: Property '0' is missing in type 'any[]' but required in type '[b: T[0], ...x: T[number][]]'. } declare function f5(f: (...args: T) => U): (...args: T) => U; diff --git a/tests/baselines/reference/restTuplesFromContextualTypes.types b/tests/baselines/reference/restTuplesFromContextualTypes.types index 6dd2a6d90cb..b43299fc6dd 100644 --- a/tests/baselines/reference/restTuplesFromContextualTypes.types +++ b/tests/baselines/reference/restTuplesFromContextualTypes.types @@ -67,20 +67,20 @@ f1((a, b, c) => {}) f1((...x) => {}) >f1((...x) => {}) : void >f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->(...x) => {} : (args_0: number, args_1: boolean, args_2: string) => void +>(...x) => {} : (x_0: number, x_1: boolean, x_2: string) => void >x : [number, boolean, string] f1((a, ...x) => {}) >f1((a, ...x) => {}) : void >f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->(a, ...x) => {} : (a: number, args_1: boolean, args_2: string) => void +>(a, ...x) => {} : (a: number, x_0: boolean, x_1: string) => void >a : number >x : [boolean, string] f1((a, b, ...x) => {}) >f1((a, b, ...x) => {}) : void >f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->(a, b, ...x) => {} : (a: number, b: boolean, args_2: string) => void +>(a, b, ...x) => {} : (a: number, b: boolean, x_0: string) => void >a : number >b : boolean >x : [string] @@ -162,13 +162,13 @@ f2((a, b, c) => {}) f2((...x) => {}) >f2((...x) => {}) : void >f2 : (cb: (args_0: number, args_1: boolean, ...args_2: string[]) => void) => void ->(...x) => {} : (args_0: number, args_1: boolean, ...args_2: string[]) => void +>(...x) => {} : (x_0: number, x_1: boolean, ...x_2: string[]) => void >x : [number, boolean, ...string[]] f2((a, ...x) => {}) >f2((a, ...x) => {}) : void >f2 : (cb: (args_0: number, args_1: boolean, ...args_2: string[]) => void) => void ->(a, ...x) => {} : (a: number, args_1: boolean, ...args_2: string[]) => void +>(a, ...x) => {} : (a: number, x_0: boolean, ...x_1: string[]) => void >a : number >x : [boolean, ...string[]] @@ -263,13 +263,13 @@ f3((a, b, c) => {}) f3((...x) => {}) >f3((...x) => {}) : void >f3 : (cb: (x: number, args_0: boolean, ...args_1: string[]) => void) => void ->(...x) => {} : (x: number, args_0: boolean, ...args_1: string[]) => void +>(...x) => {} : (x_0: number, x_1: boolean, ...x_2: string[]) => void >x : [number, boolean, ...string[]] f3((a, ...x) => {}) >f3((a, ...x) => {}) : void >f3 : (cb: (x: number, args_0: boolean, ...args_1: string[]) => void) => void ->(a, ...x) => {} : (a: number, args_0: boolean, ...args_1: string[]) => void +>(a, ...x) => {} : (a: number, x_0: boolean, ...x_1: string[]) => void >a : number >x : [boolean, ...string[]] @@ -333,7 +333,7 @@ function f4(t: T) { >f((...x) => {}) : void >f : (cb: (x: number, ...args: T) => void) => void >(...x) => {} : (x: number, ...args: T[number][]) => void ->x : [number, ...T[number][]] +>x : [x: number, ...args: T[number][]] f((a, ...x) => {}); >f((a, ...x) => {}) : void @@ -496,7 +496,7 @@ take(function(...rest){}); >take(function(...rest){}) : void >take : (cb: (a: number, b: string) => void) => void >function(...rest){} : (a: number, b: string) => void ->rest : [number, string] +>rest : [a: number, b: string] // Repro from #29833 diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index cd30931bcfe..ee1718db34c 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -9,10 +9,10 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(11,11): error TS2769: tests/cases/conformance/functions/strictBindCallApply1.ts(17,15): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(18,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(19,44): error TS2554: Expected 3 arguments, but got 4. -tests/cases/conformance/functions/strictBindCallApply1.ts(22,32): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. - Property '1' is missing in type '[number]' but required in type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(22,32): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[a: number, b: string]'. + Property '1' is missing in type '[number]' but required in type '[a: number, b: string]'. tests/cases/conformance/functions/strictBindCallApply1.ts(23,37): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(24,32): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(24,32): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[a: number, b: string]'. Types of property 'length' are incompatible. Type '3' is not assignable to type '2'. tests/cases/conformance/functions/strictBindCallApply1.ts(41,11): error TS2769: No overload matches this call. @@ -35,9 +35,12 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(48,17): error TS2554: tests/cases/conformance/functions/strictBindCallApply1.ts(49,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(50,38): error TS2554: Expected 3 arguments, but got 4. tests/cases/conformance/functions/strictBindCallApply1.ts(51,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. -tests/cases/conformance/functions/strictBindCallApply1.ts(54,26): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(54,26): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[a: number, b: string]'. + Property '1' is missing in type '[number]' but required in type '[a: number, b: string]'. tests/cases/conformance/functions/strictBindCallApply1.ts(55,31): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(56,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(56,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[a: number, b: string]'. + Types of property 'length' are incompatible. + Type '3' is not assignable to type '2'. tests/cases/conformance/functions/strictBindCallApply1.ts(57,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. tests/cases/conformance/functions/strictBindCallApply1.ts(62,11): error TS2769: No overload matches this call. Overload 1 of 6, '(this: new (arg0: 10, arg1: string) => C, thisArg: any, arg0: 10, arg1: string): new () => C', gave the following error. @@ -50,9 +53,12 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(62,11): error TS2769: tests/cases/conformance/functions/strictBindCallApply1.ts(65,3): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(67,24): error TS2554: Expected 3 arguments, but got 4. -tests/cases/conformance/functions/strictBindCallApply1.ts(70,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(70,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[a: number, b: string]'. + Property '1' is missing in type '[number]' but required in type '[a: number, b: string]'. tests/cases/conformance/functions/strictBindCallApply1.ts(71,17): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[a: number, b: string]'. + Types of property 'length' are incompatible. + Type '3' is not assignable to type '2'. ==== tests/cases/conformance/functions/strictBindCallApply1.ts (24 errors) ==== @@ -94,14 +100,14 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: let a00 = foo.apply(undefined, [10, "hello"]); let a01 = foo.apply(undefined, [10]); // Error ~~~~ -!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. -!!! error TS2345: Property '1' is missing in type '[number]' but required in type '[number, string]'. +!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[a: number, b: string]'. +!!! error TS2345: Property '1' is missing in type '[number]' but required in type '[a: number, b: string]'. let a02 = foo.apply(undefined, [10, 20]); // Error ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. let a03 = foo.apply(undefined, [10, "hello", 30]); // Error ~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[a: number, b: string]'. !!! error TS2345: Types of property 'length' are incompatible. !!! error TS2345: Type '3' is not assignable to type '2'. @@ -161,13 +167,16 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: let a10 = c.foo.apply(c, [10, "hello"]); let a11 = c.foo.apply(c, [10]); // Error ~~~~ -!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[a: number, b: string]'. +!!! error TS2345: Property '1' is missing in type '[number]' but required in type '[a: number, b: string]'. let a12 = c.foo.apply(c, [10, 20]); // Error ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. let a13 = c.foo.apply(c, [10, "hello", 30]); // Error ~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[a: number, b: string]'. +!!! error TS2345: Types of property 'length' are incompatible. +!!! error TS2345: Type '3' is not assignable to type '2'. let a14 = c.foo.apply(undefined, [10, "hello"]); // Error ~~~~~~~~~ !!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. @@ -200,11 +209,14 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: C.apply(c, [10, "hello"]); C.apply(c, [10]); // Error ~~~~ -!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[a: number, b: string]'. +!!! error TS2345: Property '1' is missing in type '[number]' but required in type '[a: number, b: string]'. C.apply(c, [10, 20]); // Error ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. C.apply(c, [10, "hello", 30]); // Error ~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[a: number, b: string]'. +!!! error TS2345: Types of property 'length' are incompatible. +!!! error TS2345: Type '3' is not assignable to type '2'. \ No newline at end of file diff --git a/tests/baselines/reference/superAccess2.errors.txt b/tests/baselines/reference/superAccess2.errors.txt index 65d4c10794d..e5475595472 100644 --- a/tests/baselines/reference/superAccess2.errors.txt +++ b/tests/baselines/reference/superAccess2.errors.txt @@ -7,7 +7,6 @@ tests/cases/compiler/superAccess2.ts(11,33): error TS1034: 'super' must be follo tests/cases/compiler/superAccess2.ts(11,40): error TS2336: 'super' cannot be referenced in constructor arguments. tests/cases/compiler/superAccess2.ts(11,40): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superAccess2.ts(11,45): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/compiler/superAccess2.ts(11,59): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superAccess2.ts(11,64): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(15,19): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(17,15): error TS2576: Property 'y' is a static member of type 'P' @@ -15,7 +14,7 @@ tests/cases/compiler/superAccess2.ts(20,26): error TS1034: 'super' must be follo tests/cases/compiler/superAccess2.ts(21,15): error TS2339: Property 'x' does not exist on type 'typeof P'. -==== tests/cases/compiler/superAccess2.ts (15 errors) ==== +==== tests/cases/compiler/superAccess2.ts (14 errors) ==== class P { x() { } static y() { } @@ -45,8 +44,6 @@ tests/cases/compiler/superAccess2.ts(21,15): error TS2339: Property 'x' does not !!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. - ~~~~~ -!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. super(); diff --git a/tests/baselines/reference/symbolLinkDeclarationEmitModuleNames.js b/tests/baselines/reference/symbolLinkDeclarationEmitModuleNames.js index a4f5f4e177c..7474849c1a8 100644 --- a/tests/baselines/reference/symbolLinkDeclarationEmitModuleNames.js +++ b/tests/baselines/reference/symbolLinkDeclarationEmitModuleNames.js @@ -51,7 +51,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./src/value-promise"), exports); __exportStar(require("./src/bindingkey"), exports); diff --git a/tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.js b/tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.js new file mode 100644 index 00000000000..daba9c27670 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.js @@ -0,0 +1,41 @@ +//// [taggedTemplateStringsWithCurriedFunction.ts] +// Originated from #38558 + +const f = _ => (..._) => ""; + +f({ ...{ x: 0 } })``; +f({ ...{ x: 0 } })`x`; +f({ ...{ x: 0 } })`x${f}x`; +f({ ...{ x: 0 }, y: (() => 1)() })``; +f({ x: (() => 1)(), ...{ y: 1 } })``; + + +//// [taggedTemplateStringsWithCurriedFunction.js] +// Originated from #38558 +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var f = function (_) { return function () { + var _ = []; + for (var _i = 0; _i < arguments.length; _i++) { + _[_i] = arguments[_i]; + } + return ""; +}; }; +f(__assign({ x: 0 }))(__makeTemplateObject([""], [""])); +f(__assign({ x: 0 }))(__makeTemplateObject(["x"], ["x"])); +f(__assign({ x: 0 }))(__makeTemplateObject(["x", "x"], ["x", "x"]), f); +f(__assign({ x: 0 }, { y: (function () { return 1; })() }))(__makeTemplateObject([""], [""])); +f(__assign({ x: (function () { return 1; })() }, { y: 1 }))(__makeTemplateObject([""], [""])); diff --git a/tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.symbols b/tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.symbols new file mode 100644 index 00000000000..dc56471338b --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.symbols @@ -0,0 +1,31 @@ +=== tests/cases/compiler/taggedTemplateStringsWithCurriedFunction.ts === +// Originated from #38558 + +const f = _ => (..._) => ""; +>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) +>_ : Symbol(_, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 9)) +>_ : Symbol(_, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 16)) + +f({ ...{ x: 0 } })``; +>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) +>x : Symbol(x, Decl(taggedTemplateStringsWithCurriedFunction.ts, 4, 8)) + +f({ ...{ x: 0 } })`x`; +>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) +>x : Symbol(x, Decl(taggedTemplateStringsWithCurriedFunction.ts, 5, 8)) + +f({ ...{ x: 0 } })`x${f}x`; +>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) +>x : Symbol(x, Decl(taggedTemplateStringsWithCurriedFunction.ts, 6, 8)) +>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) + +f({ ...{ x: 0 }, y: (() => 1)() })``; +>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) +>x : Symbol(x, Decl(taggedTemplateStringsWithCurriedFunction.ts, 7, 8)) +>y : Symbol(y, Decl(taggedTemplateStringsWithCurriedFunction.ts, 7, 16)) + +f({ x: (() => 1)(), ...{ y: 1 } })``; +>f : Symbol(f, Decl(taggedTemplateStringsWithCurriedFunction.ts, 2, 5)) +>x : Symbol(x, Decl(taggedTemplateStringsWithCurriedFunction.ts, 8, 3)) +>y : Symbol(y, Decl(taggedTemplateStringsWithCurriedFunction.ts, 8, 24)) + diff --git a/tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.types b/tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.types new file mode 100644 index 00000000000..9f5543bd030 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithCurriedFunction.types @@ -0,0 +1,72 @@ +=== tests/cases/compiler/taggedTemplateStringsWithCurriedFunction.ts === +// Originated from #38558 + +const f = _ => (..._) => ""; +>f : (_: any) => (..._: any[]) => string +>_ => (..._) => "" : (_: any) => (..._: any[]) => string +>_ : any +>(..._) => "" : (..._: any[]) => string +>_ : any[] +>"" : "" + +f({ ...{ x: 0 } })``; +>f({ ...{ x: 0 } })`` : string +>f({ ...{ x: 0 } }) : (..._: any[]) => string +>f : (_: any) => (..._: any[]) => string +>{ ...{ x: 0 } } : { x: number; } +>{ x: 0 } : { x: number; } +>x : number +>0 : 0 +>`` : "" + +f({ ...{ x: 0 } })`x`; +>f({ ...{ x: 0 } })`x` : string +>f({ ...{ x: 0 } }) : (..._: any[]) => string +>f : (_: any) => (..._: any[]) => string +>{ ...{ x: 0 } } : { x: number; } +>{ x: 0 } : { x: number; } +>x : number +>0 : 0 +>`x` : "x" + +f({ ...{ x: 0 } })`x${f}x`; +>f({ ...{ x: 0 } })`x${f}x` : string +>f({ ...{ x: 0 } }) : (..._: any[]) => string +>f : (_: any) => (..._: any[]) => string +>{ ...{ x: 0 } } : { x: number; } +>{ x: 0 } : { x: number; } +>x : number +>0 : 0 +>`x${f}x` : string +>f : (_: any) => (..._: any[]) => string + +f({ ...{ x: 0 }, y: (() => 1)() })``; +>f({ ...{ x: 0 }, y: (() => 1)() })`` : string +>f({ ...{ x: 0 }, y: (() => 1)() }) : (..._: any[]) => string +>f : (_: any) => (..._: any[]) => string +>{ ...{ x: 0 }, y: (() => 1)() } : { y: number; x: number; } +>{ x: 0 } : { x: number; } +>x : number +>0 : 0 +>y : number +>(() => 1)() : number +>(() => 1) : () => number +>() => 1 : () => number +>1 : 1 +>`` : "" + +f({ x: (() => 1)(), ...{ y: 1 } })``; +>f({ x: (() => 1)(), ...{ y: 1 } })`` : string +>f({ x: (() => 1)(), ...{ y: 1 } }) : (..._: any[]) => string +>f : (_: any) => (..._: any[]) => string +>{ x: (() => 1)(), ...{ y: 1 } } : { y: number; x: number; } +>x : number +>(() => 1)() : number +>(() => 1) : () => number +>() => 1 : () => number +>1 : 1 +>{ y: 1 } : { y: number; } +>y : number +>1 : 1 +>`` : "" + diff --git a/tests/baselines/reference/transformApi/transformsCorrectly.transformAddCommentToImport.js b/tests/baselines/reference/transformApi/transformsCorrectly.transformAddCommentToImport.js index 2cadc1e1ec5..7f04a9b7201 100644 --- a/tests/baselines/reference/transformApi/transformsCorrectly.transformAddCommentToImport.js +++ b/tests/baselines/reference/transformApi/transformsCorrectly.transformAddCommentToImport.js @@ -8,7 +8,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.Value = void 0; /*comment*/ diff --git a/tests/baselines/reference/transformApi/transformsCorrectly.transformTaggedTemplateLiteral.js b/tests/baselines/reference/transformApi/transformsCorrectly.transformTaggedTemplateLiteral.js new file mode 100644 index 00000000000..e693443d134 --- /dev/null +++ b/tests/baselines/reference/transformApi/transformsCorrectly.transformTaggedTemplateLiteral.js @@ -0,0 +1,5 @@ +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; +$tpl(__makeTemplateObject(["foo"], ["foo"])); diff --git a/tests/baselines/reference/tsbuild/watchMode/reexport/Reports-errors-correctly.js b/tests/baselines/reference/tsbuild/watchMode/reexport/Reports-errors-correctly.js index deeefd1ad04..6001eeaf1f7 100644 --- a/tests/baselines/reference/tsbuild/watchMode/reexport/Reports-errors-correctly.js +++ b/tests/baselines/reference/tsbuild/watchMode/reexport/Reports-errors-correctly.js @@ -85,7 +85,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./session"), exports); diff --git a/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink-moduleCaseChange.js b/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink-moduleCaseChange.js index 649de585df5..29eefb2d8e1 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink-moduleCaseChange.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink-moduleCaseChange.js @@ -73,7 +73,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./keys"), exports); diff --git a/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js b/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js index 4a223fe9c6d..40045b6d167 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js @@ -73,7 +73,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./keys"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js index 9c1f665cca0..03e43850ee9 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -70,7 +70,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -86,7 +86,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -132,7 +132,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js index 20027ce38f1..d9199bcceef 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -64,7 +64,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -80,7 +80,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -114,7 +114,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js index e51fe281ec1..8fd7efd3250 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -76,7 +76,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -96,7 +96,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -162,7 +162,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js index 6c1de9a4deb..76c72db2a76 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -70,7 +70,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -90,7 +90,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -135,7 +135,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js index f72345ccc56..e927c312aca 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -70,7 +70,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -86,7 +86,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -132,7 +132,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js index 8de8338f4bb..96f39107d7d 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -64,7 +64,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -80,7 +80,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -114,7 +114,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js index 071013c5e81..18c3f4e5ea1 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -76,7 +76,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -96,7 +96,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -162,7 +162,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js index 547418b8fce..9f9528102ad 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -70,7 +70,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -90,7 +90,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -135,7 +135,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js index b1eead4925a..1c96e77804b 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -70,7 +70,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -86,7 +86,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -132,7 +132,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js index bda31bf5c1f..950359dda9e 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -64,7 +64,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -80,7 +80,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -114,7 +114,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js index cfe43df46a1..e793fd4f72b 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -76,7 +76,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -96,7 +96,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -162,7 +162,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js index c0a64ac97a5..8eed0ceda00 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -70,7 +70,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools.interface"), exports); @@ -90,7 +90,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./tools/public"), exports); @@ -135,7 +135,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./data"), exports); diff --git a/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js b/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js index 2345c69fd19..b5479b07279 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js +++ b/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js @@ -39,7 +39,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./f2"), exports); @@ -96,7 +96,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("../c/f3"), exports); diff --git a/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure-2.js b/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure-2.js index 6db5d9bcb60..0d56470f85e 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure-2.js +++ b/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure-2.js @@ -39,7 +39,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("../c/f3"), exports); @@ -55,7 +55,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./f2"), exports); diff --git a/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure.js b/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure.js index 75dd1b1443f..6973c5ff627 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure.js +++ b/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure.js @@ -39,7 +39,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("../c/f3"), exports); @@ -55,7 +55,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -} +}; exports.__esModule = true; __exportStar(require("./f2"), exports); diff --git a/tests/baselines/reference/typedefDuplicateTypeDeclaration.errors.txt b/tests/baselines/reference/typedefDuplicateTypeDeclaration.errors.txt new file mode 100644 index 00000000000..70e0f941b97 --- /dev/null +++ b/tests/baselines/reference/typedefDuplicateTypeDeclaration.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/jsdoc/typedefDuplicateTypeDeclaration.js(4,16): error TS8033: A JSDoc '@typedef' comment may not contain multiple '@type' tags. + + +==== tests/cases/conformance/jsdoc/typedefDuplicateTypeDeclaration.js (1 errors) ==== + /** + * @typedef Name + * @type {string} + * @type {Oops} + + */ + +!!! error TS8033: A JSDoc '@typedef' comment may not contain multiple '@type' tags. +!!! related TS8034 tests/cases/conformance/jsdoc/typedefDuplicateTypeDeclaration.js:1:1: The tag was first specified here. \ No newline at end of file diff --git a/tests/baselines/reference/typedefDuplicateTypeDeclaration.symbols b/tests/baselines/reference/typedefDuplicateTypeDeclaration.symbols new file mode 100644 index 00000000000..eeafce6655c --- /dev/null +++ b/tests/baselines/reference/typedefDuplicateTypeDeclaration.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/jsdoc/typedefDuplicateTypeDeclaration.js === +/** +No type information for this code. * @typedef Name +No type information for this code. * @type {string} +No type information for this code. * @type {Oops} +No type information for this code. */ +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/typedefDuplicateTypeDeclaration.types b/tests/baselines/reference/typedefDuplicateTypeDeclaration.types new file mode 100644 index 00000000000..eeafce6655c --- /dev/null +++ b/tests/baselines/reference/typedefDuplicateTypeDeclaration.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/jsdoc/typedefDuplicateTypeDeclaration.js === +/** +No type information for this code. * @typedef Name +No type information for this code. * @type {string} +No type information for this code. * @type {Oops} +No type information for this code. */ +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.js b/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.js new file mode 100644 index 00000000000..2ff4da1f22a --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.js @@ -0,0 +1,76 @@ +//// [uniqueSymbolsDeclarationsInJs.js] +// classes +class C { + /** + * @readonly + */ + static readonlyStaticCall = Symbol(); + /** + * @type {unique symbol} + * @readonly + */ + static readonlyStaticType; + /** + * @type {unique symbol} + * @readonly + */ + static readonlyStaticTypeAndCall = Symbol(); + static readwriteStaticCall = Symbol(); + + /** + * @readonly + */ + readonlyCall = Symbol(); + readwriteCall = Symbol(); +} + + +//// [uniqueSymbolsDeclarationsInJs-out.js] +// classes +let C = /** @class */ (() => { + class C { + constructor() { + /** + * @readonly + */ + this.readonlyCall = Symbol(); + this.readwriteCall = Symbol(); + } + } + /** + * @readonly + */ + C.readonlyStaticCall = Symbol(); + /** + * @type {unique symbol} + * @readonly + */ + C.readonlyStaticTypeAndCall = Symbol(); + C.readwriteStaticCall = Symbol(); + return C; +})(); + + +//// [uniqueSymbolsDeclarationsInJs-out.d.ts] +declare class C { + /** + * @readonly + */ + static readonly readonlyStaticCall: unique symbol; + /** + * @type {unique symbol} + * @readonly + */ + static readonly readonlyStaticType: unique symbol; + /** + * @type {unique symbol} + * @readonly + */ + static readonly readonlyStaticTypeAndCall: unique symbol; + static readwriteStaticCall: symbol; + /** + * @readonly + */ + readonly readonlyCall: symbol; + readwriteCall: symbol; +} diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.symbols b/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.symbols new file mode 100644 index 00000000000..b48c5cc6c58 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.symbols @@ -0,0 +1,43 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJs.js === +// classes +class C { +>C : Symbol(C, Decl(uniqueSymbolsDeclarationsInJs.js, 0, 0)) + + /** + * @readonly + */ + static readonlyStaticCall = Symbol(); +>readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbolsDeclarationsInJs.js, 1, 9)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) + + /** + * @type {unique symbol} + * @readonly + */ + static readonlyStaticType; +>readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbolsDeclarationsInJs.js, 5, 41)) + + /** + * @type {unique symbol} + * @readonly + */ + static readonlyStaticTypeAndCall = Symbol(); +>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarationsInJs.js, 10, 30)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) + + static readwriteStaticCall = Symbol(); +>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbolsDeclarationsInJs.js, 15, 48)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) + + /** + * @readonly + */ + readonlyCall = Symbol(); +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarationsInJs.js, 16, 42)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) + + readwriteCall = Symbol(); +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarationsInJs.js, 21, 28)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) +} + diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.types b/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.types new file mode 100644 index 00000000000..a51ba3c324d --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJs.js === +// classes +class C { +>C : C + + /** + * @readonly + */ + static readonlyStaticCall = Symbol(); +>readonlyStaticCall : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + + /** + * @type {unique symbol} + * @readonly + */ + static readonlyStaticType; +>readonlyStaticType : symbol + + /** + * @type {unique symbol} + * @readonly + */ + static readonlyStaticTypeAndCall = Symbol(); +>readonlyStaticTypeAndCall : symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + + static readwriteStaticCall = Symbol(); +>readwriteStaticCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + + /** + * @readonly + */ + readonlyCall = Symbol(); +>readonlyCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + + readwriteCall = Symbol(); +>readwriteCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor +} + diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.errors.txt b/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.errors.txt new file mode 100644 index 00000000000..16120be782b --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJsErrors.js(5,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJsErrors.js(14,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + + +==== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJsErrors.js (2 errors) ==== + class C { + /** + * @type {unique symbol} + */ + static readwriteStaticType; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + /** + * @type {unique symbol} + * @readonly + */ + static readonlyType; + /** + * @type {unique symbol} + */ + static readwriteType; + ~~~~~~~~~~~~~ +!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + } \ No newline at end of file diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.js b/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.js new file mode 100644 index 00000000000..65019a88efd --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.js @@ -0,0 +1,38 @@ +//// [uniqueSymbolsDeclarationsInJsErrors.js] +class C { + /** + * @type {unique symbol} + */ + static readwriteStaticType; + /** + * @type {unique symbol} + * @readonly + */ + static readonlyType; + /** + * @type {unique symbol} + */ + static readwriteType; +} + +//// [uniqueSymbolsDeclarationsInJsErrors-out.js] +class C { +} + + +//// [uniqueSymbolsDeclarationsInJsErrors-out.d.ts] +declare class C { + /** + * @type {unique symbol} + */ + static readwriteStaticType: unique symbol; + /** + * @type {unique symbol} + * @readonly + */ + static readonly readonlyType: unique symbol; + /** + * @type {unique symbol} + */ + static readwriteType: unique symbol; +} diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.symbols b/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.symbols new file mode 100644 index 00000000000..6ac6e495d77 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJsErrors.js === +class C { +>C : Symbol(C, Decl(uniqueSymbolsDeclarationsInJsErrors.js, 0, 0)) + + /** + * @type {unique symbol} + */ + static readwriteStaticType; +>readwriteStaticType : Symbol(C.readwriteStaticType, Decl(uniqueSymbolsDeclarationsInJsErrors.js, 0, 9)) + + /** + * @type {unique symbol} + * @readonly + */ + static readonlyType; +>readonlyType : Symbol(C.readonlyType, Decl(uniqueSymbolsDeclarationsInJsErrors.js, 4, 31)) + + /** + * @type {unique symbol} + */ + static readwriteType; +>readwriteType : Symbol(C.readwriteType, Decl(uniqueSymbolsDeclarationsInJsErrors.js, 9, 24)) +} diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.types b/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.types new file mode 100644 index 00000000000..4571b2c3825 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJsErrors.js === +class C { +>C : C + + /** + * @type {unique symbol} + */ + static readwriteStaticType; +>readwriteStaticType : symbol + + /** + * @type {unique symbol} + * @readonly + */ + static readonlyType; +>readonlyType : symbol + + /** + * @type {unique symbol} + */ + static readwriteType; +>readwriteType : symbol +} diff --git a/tests/baselines/reference/user/eventemitter3.log b/tests/baselines/reference/user/eventemitter3.log deleted file mode 100644 index 5bd4bedd9f6..00000000000 --- a/tests/baselines/reference/user/eventemitter3.log +++ /dev/null @@ -1,18 +0,0 @@ -Exit Code: 1 -Standard output: -node_modules/eventemitter3/index.d.ts(22,13): error TS2344: Type 'T[K]' does not satisfy the constraint 'any[] | ((...args: any[]) => void)'. - Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'any[] | ((...args: any[]) => void)'. - Type 'T[string]' is not assignable to type 'any[] | ((...args: any[]) => void)'. - Type 'T[string]' is not assignable to type 'any[]'. - Type 'T[K]' is not assignable to type 'any[]'. - Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'any[]'. - Type 'T[string]' is not assignable to type 'any[]'. -node_modules/eventemitter3/index.d.ts(122,62): error TS2344: Type 'EventTypes' does not satisfy the constraint 'string | symbol | {} | { [K in keyof EventTypes]: any[] | ((...args: any[]) => void); }'. - Type 'unknown' is not assignable to type 'string | symbol | {} | { [K in keyof EventTypes]: any[] | ((...args: any[]) => void); }'. - Type 'unknown' is not assignable to type '{ [K in keyof EventTypes]: any[] | ((...args: any[]) => void); }'. - Type 'EventTypes' is not assignable to type '{ [K in keyof EventTypes]: any[] | ((...args: any[]) => void); }'. - Type 'unknown' is not assignable to type '{ [K in keyof EventTypes]: any[] | ((...args: any[]) => void); }'. - - - -Standard error: diff --git a/tests/cases/compiler/checkSuperCallBeforeThisAccess.ts b/tests/cases/compiler/checkSuperCallBeforeThisAccess.ts new file mode 100644 index 00000000000..1b97d7bea7a --- /dev/null +++ b/tests/cases/compiler/checkSuperCallBeforeThisAccess.ts @@ -0,0 +1,83 @@ +// @strict: true +// @target: esnext + +class A { + x = 1; +} + +class C1 extends A { + constructor(n: number) { + let a1 = this; // Error + let a2 = this.x; // Error + let a3 = super.x; // Error + let a4 = () => this; + let a5 = () => this.x; + let a6 = () => super.x; + if (!!true) { + super(); + let b1 = this; + let b2 = this.x; + let b3 = super.x; + } + else { + let c1 = this; // Error + let c2 = this.x; // Error + let c3 = super.x; // Error + } + if (!!true) { + switch (n) { + case 1: + super(); + let d1 = this.x; + case 2: + let d2 = this.x; // Error + default: + super(); + let d3 = this.x; + } + let d4 = this.x; + } + if (!!true) { + let e1 = { w: !!true ? super() : 0 }; + let e2 = this.x; // Error + let e3 = { w: !!true ? super() : super() }; + let e4 = this.x; + } + let f1 = this; // Error + let f2 = this.x; // Error + let f3 = super.x; // Error + } +} + +// Repro from #38512 + +export class Foo { + constructor(value: number) { + } +} + +export class BarCorrectlyFails extends Foo { + constructor(something: boolean) { + if (!something) { + const value = this.bar(); // Error + super(value); + } + else { + super(1337); + } + } + bar(): number { return 4; } +} + +export class BarIncorrectlyWorks extends Foo { + constructor(something: boolean) { + if (something) { + super(1337); + } + else { + const value = this.bar(); // Error + super(value); + } + } + bar(): number { return 4; } +} diff --git a/tests/cases/compiler/circularContextualMappedType.ts b/tests/cases/compiler/circularContextualMappedType.ts new file mode 100644 index 00000000000..4c982cd6fca --- /dev/null +++ b/tests/cases/compiler/circularContextualMappedType.ts @@ -0,0 +1,20 @@ +// @strict: true + +type Func = () => T; + +type Mapped = { [K in keyof T]: Func }; + +declare function reproduce(options: number): void; +declare function reproduce(options: Mapped): T + +reproduce({ + name: () => { return 123 } +}); + +reproduce({ + name() { return 123 } +}); + +reproduce({ + name: function () { return 123 } +}); diff --git a/tests/cases/compiler/jsxPartialSpread.tsx b/tests/cases/compiler/jsxPartialSpread.tsx new file mode 100644 index 00000000000..b71ee00e5d9 --- /dev/null +++ b/tests/cases/compiler/jsxPartialSpread.tsx @@ -0,0 +1,12 @@ +// @jsx: preserve +// @esModuleInterop: true +// @strict: true +/// +const Select = (p: {value?: unknown}) =>

; +import React from 'react'; + +export function Repro({ SelectProps = {} }: { SelectProps?: Partial[0]> }) { + return ( +