diff --git a/package.json b/package.json index db01c0bf521..301ec05cfdf 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ }, "devDependencies": { "@babel/code-frame": "7.0.0", - "@babel/parser": "7.3.0", + "@babel/parser": "7.3.2", "@commitlint/cli": "^7.1.2", "@commitlint/config-conventional": "^7.1.2", "@commitlint/travis-cli": "^7.1.2", diff --git a/packages/eslint-plugin-tslint/src/index.ts b/packages/eslint-plugin-tslint/src/index.ts index 78e946af629..f2ae0e55efd 100644 --- a/packages/eslint-plugin-tslint/src/index.ts +++ b/packages/eslint-plugin-tslint/src/index.ts @@ -3,20 +3,12 @@ import memoize from 'lodash.memoize'; import { Configuration, RuleSeverity } from 'tslint'; import { Program } from 'typescript'; import { CustomLinter } from './custom-linter'; +import { ParserServices } from '@typescript-eslint/typescript-estree'; //------------------------------------------------------------------------------ // Plugin Definition //------------------------------------------------------------------------------ -/** - * @todo share types between packages - */ -interface ParserServices { - program: Program | undefined; - esTreeNodeToTSNodeMap: WeakMap | undefined; - tsNodeToESTreeNodeMap: WeakMap | undefined; -} - type RawRuleConfig = | null | undefined diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index cb5880a4e10..6fa23ff0038 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -128,6 +128,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces (`no-empty-interface` from TSLint) | :heavy_check_mark: | | | [`@typescript-eslint/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type (`no-any` from TSLint) | :heavy_check_mark: | | | [`@typescript-eslint/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces (`no-unnecessary-class` from TSLint) | | | +| [`@typescript-eslint/no-for-in-array`](./docs/rules/no-for-in-array.md) | Disallow iterating over an array with a for-in loop (`no-for-in-array` from TSLint) | | | | [`@typescript-eslint/no-inferrable-types`](./docs/rules/no-inferrable-types.md) | Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean. (`no-inferrable-types` from TSLint) | :heavy_check_mark: | :wrench: | | [`@typescript-eslint/no-misused-new`](./docs/rules/no-misused-new.md) | Enforce valid definition of `new` and `constructor`. (`no-misused-new` from TSLint) | :heavy_check_mark: | | | [`@typescript-eslint/no-namespace`](./docs/rules/no-namespace.md) | Disallow the use of custom TypeScript modules and namespaces (`no-namespace` from TSLint) | :heavy_check_mark: | | diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index a249eefeb8e..054ff42d139 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -1,10 +1,10 @@ # Roadmap -✅ (30) = done
-🌟 (79) = in ESLint core
-🔌 (33) = in another plugin
-🌓 (16) = implementations differ or ESLint version is missing functionality
-🛑 (67) = unimplemented +✅ = done
+🌟 = in ESLint core
+🔌 = in another plugin
+🌓 = implementations differ or ESLint version is missing functionality
+🛑 = unimplemented
## TSLint rules @@ -59,7 +59,7 @@ | [`no-empty`] | 🌟 | [`no-empty`][no-empty] | | [`no-eval`] | 🌟 | [`no-eval`][no-eval] | | [`no-floating-promises`] | 🛑 | N/A ([relevant plugin][plugin:promise]) | -| [`no-for-in-array`] | 🛑 | N/A | +| [`no-for-in-array`] | ✅ | [`@typescript-eslint/no-for-in-array`] | | [`no-implicit-dependencies`] | 🔌 | [`import/no-extraneous-dependencies`] | | [`no-inferred-empty-object-type`] | 🛑 | N/A | | [`no-invalid-template-strings`] | 🌟 | [`no-template-curly-in-string`][no-template-curly-in-string] | @@ -587,6 +587,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- [`@typescript-eslint/member-delimiter-style`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-delimiter-style.md [`@typescript-eslint/prefer-interface`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-interface.md [`@typescript-eslint/no-array-constructor`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md +[`@typescript-eslint/no-for-in-array`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-for-in-array.md diff --git a/packages/eslint-plugin/docs/rules/no-for-in-array.md b/packages/eslint-plugin/docs/rules/no-for-in-array.md new file mode 100644 index 00000000000..3a1cf2bdd37 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-for-in-array.md @@ -0,0 +1,44 @@ +# Disallow iterating over an array with a for-in loop (no-for-in-array) + +This rule prohibits iterating over an array with a for-in loop. + +## Rule Details + +Rationale from TSLint: + +A for-in loop (`for (var k in o)`) iterates over the properties of an Object. +While it is legal to use for-in loops with array types, it is not common. +for-in will iterate over the indices of the array as strings, omitting any "holes" in +the array. +More common is to use for-of, which iterates over the values of an array. +If you want to iterate over the indices, alternatives include: + +```js +array.forEach((value, index) => { ... }); +for (const [index, value] of array.entries()) { ... } +for (let i = 0; i < array.length; i++) { ... } +``` + +Examples of **incorrect** code for this rule: + +```js +for (const x in [3, 4, 5]) { + console.log(x); +} +``` + +Examples of **correct** code for this rule: + +```js +for (const x in { a: 3, b: 4, c: 5 }) { + console.log(x); +} +``` + +## When Not To Use It + +If you want to iterate through a loop using the indices in an array as strings, you can turn off this rule. + +## Related to + +- TSLint: ['no-for-in-array'](https://palantir.github.io/tslint/rules/no-for-in-array/) diff --git a/packages/eslint-plugin/lib/rules/adjacent-overload-signatures.js b/packages/eslint-plugin/lib/rules/adjacent-overload-signatures.js index d8eb7950955..0c53769c0e8 100644 --- a/packages/eslint-plugin/lib/rules/adjacent-overload-signatures.js +++ b/packages/eslint-plugin/lib/rules/adjacent-overload-signatures.js @@ -73,6 +73,17 @@ module.exports = { } } + /** + * Determine whether two methods are the same or not + * @param {{ name: string; static: boolean }} method1 a method to compare + * @param {{ name: string; static: boolean }} method2 another method to compare with + * @returns {boolean} true if two methods are the same + * @private + */ + function isSameMethod(method1, method2) { + return method1.name === method2.name && method1.static === method2.static; + } + /** * Check the body for overload methods. * @param {ASTNode} node the body to be inspected. @@ -83,28 +94,32 @@ module.exports = { const members = node.body || node.members; if (members) { - let name; - let index; - let lastName; - const seen = []; + let lastMethod; + const seenMethods = []; members.forEach(member => { - name = getMemberName(member); + const name = getMemberName(member); + const method = { + name, + static: member.static + }; - index = seen.indexOf(name); - if (index > -1 && lastName !== name) { + const index = seenMethods.findIndex(seenMethod => + isSameMethod(method, seenMethod) + ); + if (index > -1 && !isSameMethod(method, lastMethod)) { context.report({ node: member, messageId: 'adjacentSignature', data: { - name + name: (method.static ? 'static ' : '') + method.name } }); } else if (name && index === -1) { - seen.push(name); + seenMethods.push(method); } - lastName = name; + lastMethod = method; }); } } diff --git a/packages/eslint-plugin/lib/rules/no-for-in-array.js b/packages/eslint-plugin/lib/rules/no-for-in-array.js new file mode 100644 index 00000000000..23a19732ac4 --- /dev/null +++ b/packages/eslint-plugin/lib/rules/no-for-in-array.js @@ -0,0 +1,56 @@ +/** + * @fileoverview Disallow iterating over an array with a for-in loop + * @author Benjamin Lichtman + */ +'use strict'; +const ts = require('typescript'); +const util = require('../util'); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** + * @type {import("eslint").Rule.RuleModule} + */ +module.exports = { + meta: { + docs: { + description: 'Disallow iterating over an array with a for-in loop', + category: 'Functionality', + recommended: false, + extraDescription: [util.tslintRule('no-for-in-array')], + url: util.metaDocsUrl('no-for-in-array') + }, + fixable: null, + messages: { + forInViolation: + 'For-in loops over arrays are forbidden. Use for-of or array.forEach instead.' + }, + schema: [], + type: 'problem' + }, + + create(context) { + return { + ForInStatement(node) { + const parserServices = util.getParserServices(context); + const checker = parserServices.program.getTypeChecker(); + const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); + + const type = checker.getTypeAtLocation(originalNode.expression); + + if ( + (typeof type.symbol !== 'undefined' && + type.symbol.name === 'Array') || + (type.flags & ts.TypeFlags.StringLike) !== 0 + ) { + context.report({ + node, + messageId: 'forInViolation' + }); + } + } + }; + } +}; diff --git a/packages/eslint-plugin/lib/util.js b/packages/eslint-plugin/lib/util.js index dac41fe21bb..6714e600ee6 100644 --- a/packages/eslint-plugin/lib/util.js +++ b/packages/eslint-plugin/lib/util.js @@ -109,7 +109,7 @@ exports.upperCaseFirst = str => str[0].toUpperCase() + str.slice(1); /** * Try to retrieve typescript parser service from context * @param {RuleContext} context Rule context - * @returns {{esTreeNodeToTSNodeMap}|{program}|Object|*} parserServices + * @returns {{program: Program, esTreeNodeToTSNodeMap: NodeMap}} parserServices */ exports.getParserServices = context => { if ( diff --git a/packages/eslint-plugin/tests/lib/rules/adjacent-overload-signatures.js b/packages/eslint-plugin/tests/lib/rules/adjacent-overload-signatures.js index 161ffd4035e..fe42efd1015 100644 --- a/packages/eslint-plugin/tests/lib/rules/adjacent-overload-signatures.js +++ b/packages/eslint-plugin/tests/lib/rules/adjacent-overload-signatures.js @@ -211,6 +211,23 @@ class Foo { foo(sn: string | number): void {} bar(): void {} baz(): void {} +} + `, + ` +class Foo { + name: string; + static foo(s: string): void; + static foo(n: number): void; + static foo(sn: string | number): void {} + bar(): void {} + baz(): void {} +} + `, + ` +class Test { + static test() {} + untest() {} + test() {} } `, // examples from https://github.com/nzakas/eslint-plugin-typescript/issues/138 @@ -789,6 +806,26 @@ class Foo { column: 5 } ] + }, + { + code: ` +class Foo { + static foo(s: string): void; + name: string; + static foo(n: number): void; + static foo(sn: string | number): void {} + bar(): void {} + baz(): void {} +} + `, + errors: [ + { + messageId: 'adjacentSignature', + data: { name: 'static foo' }, + line: 5, + column: 5 + } + ] } ] }); diff --git a/packages/eslint-plugin/tests/lib/rules/no-for-in-array.js b/packages/eslint-plugin/tests/lib/rules/no-for-in-array.js new file mode 100644 index 00000000000..91984453000 --- /dev/null +++ b/packages/eslint-plugin/tests/lib/rules/no-for-in-array.js @@ -0,0 +1,69 @@ +/** + * @fileoverview Disallow iterating over an array with a for-in loop + * @author Benjamin Lichtman + */ +'use strict'; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const rule = require('../../../lib/rules/no-for-in-array'), + RuleTester = require('eslint').RuleTester, + path = require('path'); + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +const rootDir = path.join(process.cwd(), 'tests/fixtures/'); +const parserOptions = { + ecmaVersion: 2015, + tsconfigRootDir: rootDir, + project: './tsconfig.json' +}; +const ruleTester = new RuleTester({ + parserOptions, + parser: '@typescript-eslint/parser' +}); + +ruleTester.run('no-for-in-array', rule, { + valid: [ + ` +for (const x of [3, 4, 5]) { + console.log(x); +}`, + ` +for (const x in { a: 1, b: 2, c: 3 }) { + console.log(x); +}` + ], + + invalid: [ + { + code: ` +for (const x in [3, 4, 5]) { + console.log(x); +}`, + errors: [ + { + messageId: 'forInViolation', + type: 'ForInStatement' + } + ] + }, + { + code: ` +const z = [3, 4, 5]; +for (const x in z) { + console.log(x); +}`, + errors: [ + { + messageId: 'forInViolation', + type: 'ForInStatement' + } + ] + } + ] +}); diff --git a/packages/parser/package.json b/packages/parser/package.json index 26de602491a..8cadc1c7415 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -43,7 +43,6 @@ "devDependencies": { "@types/eslint": "^4.16.5", "@types/eslint-visitor-keys": "^1.0.0", - "@types/estree": "^0.0.39", "@typescript-eslint/shared-fixtures": "1.2.0" } } diff --git a/packages/parser/src/analyze-scope.ts b/packages/parser/src/analyze-scope.ts index 2e8ae2e0a3c..f3a6b5f78ac 100644 --- a/packages/parser/src/analyze-scope.ts +++ b/packages/parser/src/analyze-scope.ts @@ -11,7 +11,7 @@ import { PatternVisitorCallback, PatternVisitorOptions } from 'eslint-scope/lib/options'; -import { Node } from 'estree'; +import { TSESTree } from '@typescript-eslint/typescript-estree'; /** * Define the override function of `Scope#__define` for global augmentation. @@ -35,7 +35,7 @@ class EnumScope extends Scope { constructor( scopeManager: ScopeManager, upperScope: Scope, - block: Node | null + block: TSESTree.Node | null ) { // @ts-ignore super(scopeManager, 'enum', upperScope, block, false); @@ -51,7 +51,7 @@ class PatternVisitor extends OriginalPatternVisitor { super(options, rootPattern, callback); } - Identifier(node: any) { + Identifier(node: TSESTree.Identifier): void { super.Identifier(node); if (node.decorators) { this.rightHandNodes.push(...node.decorators); @@ -61,7 +61,7 @@ class PatternVisitor extends OriginalPatternVisitor { } } - ArrayPattern(node: any) { + ArrayPattern(node: TSESTree.ArrayPattern): void { node.elements.forEach(this.visit, this); if (node.decorators) { this.rightHandNodes.push(...node.decorators); @@ -71,7 +71,7 @@ class PatternVisitor extends OriginalPatternVisitor { } } - ObjectPattern(node: any) { + ObjectPattern(node: TSESTree.ObjectPattern): void { node.properties.forEach(this.visit, this); if (node.decorators) { this.rightHandNodes.push(...node.decorators); @@ -81,8 +81,11 @@ class PatternVisitor extends OriginalPatternVisitor { } } - RestElement(node: any) { + RestElement(node: TSESTree.RestElement): void { super.RestElement(node); + if (node.decorators) { + this.rightHandNodes.push(...node.decorators); + } if (node.typeAnnotation) { this.rightHandNodes.push(node.typeAnnotation); } @@ -99,16 +102,15 @@ class Referencer extends OriginalReferencer { /** * Override to use PatternVisitor we overrode. - * @param {Identifier} node The Identifier node to visit. - * @param {Object} [options] The flag to visit right-hand side nodes. - * @param {Function} callback The callback function for left-hand side nodes. - * @returns {void} + * @param node The Identifier node to visit. + * @param [options] The flag to visit right-hand side nodes. + * @param callback The callback function for left-hand side nodes. */ - visitPattern( - node: any, + visitPattern( + node: T, options: PatternVisitorOptions, callback: PatternVisitorCallback - ) { + ): void { if (!node) { return; } @@ -130,10 +132,14 @@ class Referencer extends OriginalReferencer { /** * Override. * Visit `node.typeParameters` and `node.returnType` additionally to find `typeof` expressions. - * @param {FunctionDeclaration|FunctionExpression|ArrowFunctionExpression} node The function node to visit. - * @returns {void} - */ - visitFunction(node: any) { + * @param node The function node to visit. + */ + visitFunction( + node: + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression + | TSESTree.ArrowFunctionExpression + ): void { const { type, id, typeParameters, params, returnType, body } = node; const scopeManager = this.scopeManager; const upperScope = this.currentScope(); @@ -189,7 +195,7 @@ class Referencer extends OriginalReferencer { this.visit(returnType); // Process the body. - if (body.type === 'BlockStatement') { + if (body && body.type === 'BlockStatement') { this.visitChildren(body); } else { this.visit(body); @@ -202,10 +208,9 @@ class Referencer extends OriginalReferencer { /** * Override. * Visit decorators. - * @param {ClassDeclaration|ClassExpression} node The class node to visit. - * @returns {void} + * @param node The class node to visit. */ - visitClass(node: any) { + visitClass(node: TSESTree.ClassDeclaration | TSESTree.ClassExpression): void { this.visitDecorators(node.decorators); const upperTypeMode = this.typeMode; @@ -214,7 +219,7 @@ class Referencer extends OriginalReferencer { this.visit(node.superTypeParameters); } if (node.implements) { - this.visit(node.implements); + node.implements.forEach(this.visit, this); } this.typeMode = upperTypeMode; @@ -223,10 +228,13 @@ class Referencer extends OriginalReferencer { /** * Visit typeParameters. - * @param {*} node The node to visit. - * @returns {void} + * @param node The node to visit. */ - visitTypeParameters(node: any) { + visitTypeParameters(node: { + typeParameters?: + | TSESTree.TSTypeParameterDeclaration + | TSESTree.TSTypeParameterInstantiation; + }): void { if (node.typeParameters) { const upperTypeMode = this.typeMode; this.typeMode = true; @@ -238,7 +246,7 @@ class Referencer extends OriginalReferencer { /** * Override. */ - JSXOpeningElement(node: any) { + JSXOpeningElement(node: TSESTree.JSXOpeningElement): void { this.visit(node.name); this.visitTypeParameters(node); node.attributes.forEach(this.visit, this); @@ -247,10 +255,9 @@ class Referencer extends OriginalReferencer { /** * Override. * Don't create the reference object in the type mode. - * @param {Identifier} node The Identifier node to visit. - * @returns {void} + * @param node The Identifier node to visit. */ - Identifier(node: any) { + Identifier(node: TSESTree.Identifier): void { this.visitDecorators(node.decorators); if (!this.typeMode) { @@ -263,20 +270,22 @@ class Referencer extends OriginalReferencer { /** * Override. * Visit decorators. - * @param {MethodDefinition} node The MethodDefinition node to visit. - * @returns {void} + * @param node The MethodDefinition node to visit. */ - MethodDefinition(node: any) { + MethodDefinition( + node: TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition + ): void { this.visitDecorators(node.decorators); super.MethodDefinition(node); } /** * Don't create the reference object for the key if not computed. - * @param {ClassProperty} node The ClassProperty node to visit. - * @returns {void} + * @param node The ClassProperty node to visit. */ - ClassProperty(node: any) { + ClassProperty( + node: TSESTree.ClassProperty | TSESTree.TSAbstractClassProperty + ): void { const upperTypeMode = this.typeMode; const { computed, decorators, key, typeAnnotation, value } = node; @@ -295,39 +304,34 @@ class Referencer extends OriginalReferencer { /** * Visit new expression. - * @param {NewExpression} node The NewExpression node to visit. - * @returns {void} + * @param node The NewExpression node to visit. */ - NewExpression(node: any) { + NewExpression(node: TSESTree.NewExpression): void { this.visitTypeParameters(node); this.visit(node.callee); - if (node.arguments) { - node.arguments.forEach(this.visit, this); - } + + node.arguments.forEach(this.visit, this); } /** * Override. * Visit call expression. - * @param {CallExpression} node The CallExpression node to visit. - * @returns {void} + * @param node The CallExpression node to visit. */ - CallExpression(node: any) { + CallExpression(node: TSESTree.CallExpression): void { this.visitTypeParameters(node); this.visit(node.callee); - if (node.arguments) { - node.arguments.forEach(this.visit, this); - } + + node.arguments.forEach(this.visit, this); } /** * Define the variable of this function declaration only once. * Because to avoid confusion of `no-redeclare` rule by overloading. - * @param {TSDeclareFunction} node The TSDeclareFunction node to visit. - * @returns {void} + * @param node The TSDeclareFunction node to visit. */ - TSDeclareFunction(node: any) { + TSDeclareFunction(node: TSESTree.TSDeclareFunction): void { const upperTypeMode = this.typeMode; const scope = this.currentScope(); const { id, typeParameters, params, returnType } = node; @@ -355,10 +359,9 @@ class Referencer extends OriginalReferencer { /** * Create reference objects for the references in parameters and return type. - * @param {TSEmptyBodyFunctionExpression} node The TSEmptyBodyFunctionExpression node to visit. - * @returns {void} + * @param node The TSEmptyBodyFunctionExpression node to visit. */ - TSEmptyBodyFunctionExpression(node: any) { + TSEmptyBodyFunctionExpression(node: TSESTree.FunctionExpression): void { const upperTypeMode = this.typeMode; const { typeParameters, params, returnType } = node; @@ -372,39 +375,35 @@ class Referencer extends OriginalReferencer { /** * Don't make variable because it declares only types. * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. - * @param {TSInterfaceDeclaration} node The TSInterfaceDeclaration node to visit. - * @returns {void} + * @param node The TSInterfaceDeclaration node to visit. */ - TSInterfaceDeclaration(node: any) { + TSInterfaceDeclaration(node: TSESTree.TSInterfaceDeclaration): void { this.visitTypeNodes(node); } /** * Don't make variable because it declares only types. * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. - * @param {TSClassImplements} node The TSClassImplements node to visit. - * @returns {void} + * @param node The TSClassImplements node to visit. */ - TSClassImplements(node: any) { + TSClassImplements(node: TSESTree.TSClassImplements): void { this.visitTypeNodes(node); } /** * Don't make variable because it declares only types. * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. - * @param {TSIndexSignature} node The TSIndexSignature node to visit. - * @returns {void} + * @param node The TSIndexSignature node to visit. */ - TSIndexSignature(node: any) { + TSIndexSignature(node: TSESTree.TSIndexSignature): void { this.visitTypeNodes(node); } /** * Visit type assertion. - * @param {TSTypeAssertion} node The TSTypeAssertion node to visit. - * @returns {void} + * @param node The TSTypeAssertion node to visit. */ - TSTypeAssertion(node: any) { + TSTypeAssertion(node: TSESTree.TSTypeAssertion): void { if (this.typeMode) { this.visit(node.typeAnnotation); } else { @@ -418,10 +417,9 @@ class Referencer extends OriginalReferencer { /** * Visit as expression. - * @param {TSAsExpression} node The TSAsExpression node to visit. - * @returns {void} + * @param node The TSAsExpression node to visit. */ - TSAsExpression(node: any) { + TSAsExpression(node: TSESTree.TSAsExpression): void { this.visit(node.expression); if (this.typeMode) { @@ -435,28 +433,25 @@ class Referencer extends OriginalReferencer { /** * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. - * @param {TSTypeAnnotation} node The TSTypeAnnotation node to visit. - * @returns {void} + * @param node The TSTypeAnnotation node to visit. */ - TSTypeAnnotation(node: any) { + TSTypeAnnotation(node: TSESTree.TSTypeAnnotation): void { this.visitTypeNodes(node); } /** * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. - * @param {TSTypeParameterDeclaration} node The TSTypeParameterDeclaration node to visit. - * @returns {void} + * @param node The TSTypeParameterDeclaration node to visit. */ - TSTypeParameterDeclaration(node: any) { + TSTypeParameterDeclaration(node: TSESTree.TSTypeParameterDeclaration): void { this.visitTypeNodes(node); } /** * Create reference objects for the references in `typeof` expression. - * @param {TSTypeQuery} node The TSTypeQuery node to visit. - * @returns {void} + * @param node The TSTypeQuery node to visit. */ - TSTypeQuery(node: any) { + TSTypeQuery(node: TSESTree.TSTypeQuery): void { if (this.typeMode) { this.typeMode = false; this.visitChildren(node); @@ -467,124 +462,109 @@ class Referencer extends OriginalReferencer { } /** - * @param {TSTypeParameter} node The TSTypeParameter node to visit. - * @returns {void} + * @param node The TSTypeParameter node to visit. */ - TSTypeParameter(node: any) { + TSTypeParameter(node: TSESTree.TSTypeParameter): void { this.visitTypeNodes(node); } /** - * @param {TSInferType} node The TSInferType node to visit. - * @returns {void} + * @param node The TSInferType node to visit. */ - TSInferType(node: any) { + TSInferType(node: TSESTree.TSInferType): void { this.visitTypeNodes(node); } /** - * @param {TSTypeReference} node The TSTypeReference node to visit. - * @returns {void} + * @param node The TSTypeReference node to visit. */ - TSTypeReference(node: any) { + TSTypeReference(node: TSESTree.TSTypeReference): void { this.visitTypeNodes(node); } /** - * @param {TSTypeLiteral} node The TSTypeLiteral node to visit. - * @returns {void} + * @param node The TSTypeLiteral node to visit. */ - TSTypeLiteral(node: any) { + TSTypeLiteral(node: TSESTree.TSTypeLiteral): void { this.visitTypeNodes(node); } /** - * @param {TSLiteralType} node The TSLiteralType node to visit. - * @returns {void} + * @param node The TSLiteralType node to visit. */ - TSLiteralType(node: any) { + TSLiteralType(node: TSESTree.TSLiteralType): void { this.visitTypeNodes(node); } /** - * @param {TSIntersectionType} node The TSIntersectionType node to visit. - * @returns {void} + * @param node The TSIntersectionType node to visit. */ - TSIntersectionType(node: any) { + TSIntersectionType(node: TSESTree.TSIntersectionType): void { this.visitTypeNodes(node); } /** - * @param {TSConditionalType} node The TSConditionalType node to visit. - * @returns {void} + * @param node The TSConditionalType node to visit. */ - TSConditionalType(node: any) { + TSConditionalType(node: TSESTree.TSConditionalType): void { this.visitTypeNodes(node); } /** - * @param {TSIndexedAccessType} node The TSIndexedAccessType node to visit. - * @returns {void} + * @param node The TSIndexedAccessType node to visit. */ - TSIndexedAccessType(node: any) { + TSIndexedAccessType(node: TSESTree.TSIndexedAccessType): void { this.visitTypeNodes(node); } /** - * @param {TSMappedType} node The TSMappedType node to visit. - * @returns {void} + * @param node The TSMappedType node to visit. */ - TSMappedType(node: any) { + TSMappedType(node: TSESTree.TSMappedType): void { this.visitTypeNodes(node); } /** - * @param {TSOptionalType} node The TSOptionalType node to visit. - * @returns {void} + * @param node The TSOptionalType node to visit. */ - TSOptionalType(node: any) { + TSOptionalType(node: TSESTree.TSOptionalType): void { this.visitTypeNodes(node); } /** - * @param {TSParenthesizedType} node The TSParenthesizedType node to visit. - * @returns {void} + * @param node The TSParenthesizedType node to visit. */ - TSParenthesizedType(node: any) { + TSParenthesizedType(node: TSESTree.TSParenthesizedType): void { this.visitTypeNodes(node); } /** - * @param {TSRestType} node The TSRestType node to visit. - * @returns {void} + * @param node The TSRestType node to visit. */ - TSRestType(node: any) { + TSRestType(node: TSESTree.TSRestType): void { this.visitTypeNodes(node); } /** - * @param {TSTupleType} node The TSTupleType node to visit. - * @returns {void} + * @param node The TSTupleType node to visit. */ - TSTupleType(node: any) { + TSTupleType(node: TSESTree.TSTupleType): void { this.visitTypeNodes(node); } /** * Create reference objects for the object part. (This is `obj.prop`) - * @param {TSQualifiedName} node The TSQualifiedName node to visit. - * @returns {void} + * @param node The TSQualifiedName node to visit. */ - TSQualifiedName(node: any) { + TSQualifiedName(node: TSESTree.TSQualifiedName): void { this.visit(node.left); } /** * Create reference objects for the references in computed keys. - * @param {TSPropertySignature} node The TSPropertySignature node to visit. - * @returns {void} + * @param node The TSPropertySignature node to visit. */ - TSPropertySignature(node: any) { + TSPropertySignature(node: TSESTree.TSPropertySignature): void { const upperTypeMode = this.typeMode; const { computed, key, typeAnnotation, initializer } = node; @@ -604,10 +584,9 @@ class Referencer extends OriginalReferencer { /** * Create reference objects for the references in computed keys. - * @param {TSMethodSignature} node The TSMethodSignature node to visit. - * @returns {void} + * @param node The TSMethodSignature node to visit. */ - TSMethodSignature(node: any) { + TSMethodSignature(node: TSESTree.TSMethodSignature): void { const upperTypeMode = this.typeMode; const { computed, key, typeParameters, params, returnType } = node; @@ -641,10 +620,9 @@ class Referencer extends OriginalReferencer { * A = a // a is above constant. * } * - * @param {TSEnumDeclaration} node The TSEnumDeclaration node to visit. - * @returns {void} + * @param node The TSEnumDeclaration node to visit. */ - TSEnumDeclaration(node: any) { + TSEnumDeclaration(node: TSESTree.TSEnumDeclaration): void { const { id, members } = node; const scopeManager = this.scopeManager; const scope = this.currentScope(); @@ -664,10 +642,9 @@ class Referencer extends OriginalReferencer { * Create variable object for the enum member and create reference object for the initializer. * And visit the initializer. * - * @param {TSEnumMember} node The TSEnumMember node to visit. - * @returns {void} + * @param node The TSEnumMember node to visit. */ - TSEnumMember(node: any) { + TSEnumMember(node: TSESTree.TSEnumMember): void { const { id, initializer } = node; const scope = this.currentScope(); @@ -680,10 +657,9 @@ class Referencer extends OriginalReferencer { /** * Create the variable object for the module name, and visit children. - * @param {TSModuleDeclaration} node The TSModuleDeclaration node to visit. - * @returns {void} + * @param node The TSModuleDeclaration node to visit. */ - TSModuleDeclaration(node: any) { + TSModuleDeclaration(node: TSESTree.TSModuleDeclaration): void { const scope = this.currentScope(); const { id, body } = node; @@ -701,7 +677,7 @@ class Referencer extends OriginalReferencer { this.visit(body); } - TSTypeAliasDeclaration(node: any) { + TSTypeAliasDeclaration(node: TSESTree.TSTypeAliasDeclaration): void { this.typeMode = true; this.visitChildren(node); this.typeMode = false; @@ -709,28 +685,26 @@ class Referencer extends OriginalReferencer { /** * Process the module block. - * @param {TSModuleBlock} node The TSModuleBlock node to visit. - * @returns {void} + * @param node The TSModuleBlock node to visit. */ - TSModuleBlock(node: any) { + TSModuleBlock(node: TSESTree.TSModuleBlock): void { this.scopeManager.__nestBlockScope(node); this.visitChildren(node); this.close(node); } - TSAbstractClassProperty(node: any) { + TSAbstractClassProperty(node: TSESTree.TSAbstractClassProperty): void { this.ClassProperty(node); } - TSAbstractMethodDefinition(node: any) { + TSAbstractMethodDefinition(node: TSESTree.TSAbstractMethodDefinition): void { this.MethodDefinition(node); } /** * Process import equal declaration - * @param {TSImportEqualsDeclaration} node The TSImportEqualsDeclaration node to visit. - * @returns {void} + * @param node The TSImportEqualsDeclaration node to visit. */ - TSImportEqualsDeclaration(node: any) { + TSImportEqualsDeclaration(node: TSESTree.TSImportEqualsDeclaration): void { const { id, moduleReference } = node; if (id && id.type === 'Identifier') { this.currentScope().__define( @@ -745,10 +719,9 @@ class Referencer extends OriginalReferencer { * Process the global augmentation. * 1. Set the global scope as the current scope. * 2. Configure the global scope to set `variable.eslintUsed = true` for all defined variables. This means `no-unused-vars` doesn't warn those. - * @param {TSModuleDeclaration} node The TSModuleDeclaration node to visit. - * @returns {void} + * @param node The TSModuleDeclaration node to visit. */ - visitGlobalAugmentation(node: any) { + visitGlobalAugmentation(node: TSESTree.TSModuleDeclaration): void { const scopeManager = this.scopeManager; const currentScope = this.currentScope(); const globalScope = scopeManager.globalScope; @@ -758,8 +731,8 @@ class Referencer extends OriginalReferencer { scopeManager.__currentScope = globalScope; // Skip TSModuleBlock to avoid to create that block scope. - for (const moduleItem of node.body.body) { - this.visit(moduleItem); + if (node.body && node.body.type === 'TSModuleBlock') { + node.body.body.forEach(this.visit, this); } scopeManager.__currentScope = currentScope; @@ -768,10 +741,9 @@ class Referencer extends OriginalReferencer { /** * Process decorators. - * @param {Decorator[]|undefined} decorators The decorator nodes to visit. - * @returns {void} + * @param decorators The decorator nodes to visit. */ - visitDecorators(decorators?: any[]) { + visitDecorators(decorators?: TSESTree.Decorator[]): void { if (decorators) { decorators.forEach(this.visit, this); } @@ -779,10 +751,9 @@ class Referencer extends OriginalReferencer { /** * Process all child of type nodes - * @param {any} node node to be processed - * @returns {void} + * @param node node to be processed */ - visitTypeNodes(node: any) { + visitTypeNodes(node: TSESTree.Node): void { if (this.typeMode) { this.visitChildren(node); } else { diff --git a/packages/parser/src/typings.d.ts b/packages/parser/src/eslint-scope.d.ts similarity index 57% rename from packages/parser/src/typings.d.ts rename to packages/parser/src/eslint-scope.d.ts index 08f92526c82..28de7f8c759 100644 --- a/packages/parser/src/typings.d.ts +++ b/packages/parser/src/eslint-scope.d.ts @@ -2,6 +2,7 @@ // Project: http://github.com/eslint/eslint-scope // Definitions by: Armano declare module 'eslint-scope/lib/options' { + import { TSESTree } from '@typescript-eslint/typescript-estree'; export type PatternVisitorCallback = (pattern: any, info: any) => void; export interface PatternVisitorOptions { @@ -9,76 +10,75 @@ declare module 'eslint-scope/lib/options' { } export abstract class Visitor { - visitChildren(node: Node): void; - visit(node: Node): void; + visitChildren( + node?: T + ): void; + visit(node?: T): void; } } declare module 'eslint-scope/lib/variable' { - import * as eslint from 'eslint'; - import { Identifier } from 'estree'; + import { TSESTree } from '@typescript-eslint/typescript-estree'; import Reference from 'eslint-scope/lib/reference'; + import { Definition } from 'eslint-scope/lib/definition'; - class Variable implements eslint.Scope.Variable { + export default class Variable { name: string; - identifiers: Identifier[]; + identifiers: TSESTree.Identifier[]; references: Reference[]; - defs: eslint.Scope.Definition[]; + defs: Definition[]; } - export default Variable; } declare module 'eslint-scope/lib/definition' { - import { Identifier, Node } from 'estree'; + import { TSESTree } from '@typescript-eslint/typescript-estree'; - class Definition { + export class Definition { type: string; - name: Identifier; - node: Node; - parent?: Node | null; + name: TSESTree.BindingName; + node: TSESTree.Node; + parent?: TSESTree.Node | null; index?: number | null; kind?: string | null; constructor( type: string, - name: Identifier, - node: Node, - parent?: Node | null, + name: TSESTree.BindingName | TSESTree.PropertyName, + node: TSESTree.Node, + parent?: TSESTree.Node | null, index?: number | null, kind?: string | null ); } - class ParameterDefinition extends Definition { + export class ParameterDefinition extends Definition { rest?: boolean; constructor( - name: Identifier, - node: Node, + name: TSESTree.BindingName | TSESTree.PropertyName, + node: TSESTree.Node, index?: number | null, rest?: boolean ); } - - export { ParameterDefinition, Definition }; } declare module 'eslint-scope/lib/pattern-visitor' { import ScopeManager from 'eslint-scope/lib/scope-manager'; - import { Node } from 'estree'; + import { TSESTree } from '@typescript-eslint/typescript-estree'; import { PatternVisitorCallback, PatternVisitorOptions, Visitor } from 'eslint-scope/lib/options'; - class PatternVisitor extends Visitor { + export default class PatternVisitor extends Visitor { protected options: any; protected scopeManager: ScopeManager; - protected parent?: Node; - public rightHandNodes: Node[]; + protected parent?: TSESTree.Node; + public rightHandNodes: TSESTree.Node[]; - static isPattern(node: Node): boolean; + static isPattern(node: TSESTree.Node): boolean; constructor( options: PatternVisitorOptions, @@ -86,41 +86,39 @@ declare module 'eslint-scope/lib/pattern-visitor' { callback: PatternVisitorCallback ); - Identifier(pattern: Node): void; - Property(property: Node): void; - ArrayPattern(pattern: Node): void; - AssignmentPattern(pattern: Node): void; - RestElement(pattern: Node): void; - MemberExpression(node: Node): void; - SpreadElement(node: Node): void; - ArrayExpression(node: Node): void; - AssignmentExpression(node: Node): void; - CallExpression(node: Node): void; + Identifier(pattern: TSESTree.Node): void; + Property(property: TSESTree.Node): void; + ArrayPattern(pattern: TSESTree.Node): void; + AssignmentPattern(pattern: TSESTree.Node): void; + RestElement(pattern: TSESTree.Node): void; + MemberExpression(node: TSESTree.Node): void; + SpreadElement(node: TSESTree.Node): void; + ArrayExpression(node: TSESTree.Node): void; + AssignmentExpression(node: TSESTree.Node): void; + CallExpression(node: TSESTree.Node): void; } - - export default PatternVisitor; } declare module 'eslint-scope/lib/referencer' { import { Scope } from 'eslint-scope/lib/scope'; import ScopeManager from 'eslint-scope/lib/scope-manager'; - import { Node } from 'estree'; + import { TSESTree } from '@typescript-eslint/typescript-estree'; import { PatternVisitorCallback, PatternVisitorOptions, Visitor } from 'eslint-scope/lib/options'; - class Referencer extends Visitor { + export default class Referencer extends Visitor { protected isInnerMethodDefinition: boolean; protected options: any; protected scopeManager: ScopeManager; - protected parent?: Node; + protected parent?: TSESTree.Node; constructor(options: any, scopeManager: ScopeManager); currentScope(): Scope; - close(node: Node): void; + close(node: TSESTree.Node): void; pushInnerMethodDefinition(isInnerMethodDefinition: boolean): boolean; popInnerMethodDefinition(isInnerMethodDefinition: boolean): void; @@ -131,66 +129,63 @@ declare module 'eslint-scope/lib/referencer' { init: boolean ): void; visitPattern( - node: Node, + node: TSESTree.Node, options: PatternVisitorOptions, callback: PatternVisitorCallback ): void; - visitFunction(node: Node): void; - visitClass(node: Node): void; - visitProperty(node: Node): void; - visitForIn(node: Node): void; + visitFunction(node: TSESTree.Node): void; + visitClass(node: TSESTree.Node): void; + visitProperty(node: TSESTree.Node): void; + visitForIn(node: TSESTree.Node): void; visitVariableDeclaration( variableTargetScope: any, type: any, - node: Node, + node: TSESTree.Node, index: any ): void; - AssignmentExpression(node: Node): void; - CatchClause(node: Node): void; - Program(node: Node): void; - Identifier(node: Node): void; - UpdateExpression(node: Node): void; - MemberExpression(node: Node): void; - Property(node: Node): void; - MethodDefinition(node: Node): void; + AssignmentExpression(node: TSESTree.Node): void; + CatchClause(node: TSESTree.Node): void; + Program(node: TSESTree.Node): void; + Identifier(node: TSESTree.Node): void; + UpdateExpression(node: TSESTree.Node): void; + MemberExpression(node: TSESTree.Node): void; + Property(node: TSESTree.Node): void; + MethodDefinition(node: TSESTree.Node): void; BreakStatement(): void; ContinueStatement(): void; - LabeledStatement(node: Node): void; - ForStatement(node: Node): void; - ClassExpression(node: Node): void; - ClassDeclaration(node: Node): void; - CallExpression(node: Node): void; - BlockStatement(node: Node): void; + LabeledStatement(node: TSESTree.Node): void; + ForStatement(node: TSESTree.Node): void; + ClassExpression(node: TSESTree.Node): void; + ClassDeclaration(node: TSESTree.Node): void; + CallExpression(node: TSESTree.Node): void; + BlockStatement(node: TSESTree.Node): void; ThisExpression(): void; - WithStatement(node: Node): void; - VariableDeclaration(node: Node): void; - SwitchStatement(node: Node): void; - FunctionDeclaration(node: Node): void; - FunctionExpression(node: Node): void; - ForOfStatement(node: Node): void; - ForInStatement(node: Node): void; - ArrowFunctionExpression(node: Node): void; - ImportDeclaration(node: Node): void; - visitExportDeclaration(node: Node): void; - ExportDeclaration(node: Node): void; - ExportNamedDeclaration(node: Node): void; - ExportSpecifier(node: Node): void; + WithStatement(node: TSESTree.Node): void; + VariableDeclaration(node: TSESTree.Node): void; + SwitchStatement(node: TSESTree.Node): void; + FunctionDeclaration(node: TSESTree.Node): void; + FunctionExpression(node: TSESTree.Node): void; + ForOfStatement(node: TSESTree.Node): void; + ForInStatement(node: TSESTree.Node): void; + ArrowFunctionExpression(node: TSESTree.Node): void; + ImportDeclaration(node: TSESTree.Node): void; + visitExportDeclaration(node: TSESTree.Node): void; + ExportDeclaration(node: TSESTree.Node): void; + ExportNamedDeclaration(node: TSESTree.Node): void; + ExportSpecifier(node: TSESTree.Node): void; MetaProperty(): void; } - - export default Referencer; } declare module 'eslint-scope/lib/scope' { - import * as eslint from 'eslint'; - import { Node } from 'estree'; + import { TSESTree } from '@typescript-eslint/typescript-estree'; import Reference from 'eslint-scope/lib/reference'; import Variable from 'eslint-scope/lib/variable'; import ScopeManager from 'eslint-scope/lib/scope-manager'; import { Definition } from 'eslint-scope/lib/definition'; - type ScopeType = + export type ScopeType = | 'block' | 'catch' | 'class' @@ -203,13 +198,13 @@ declare module 'eslint-scope/lib/scope' { | 'with' | 'TDZ'; - class Scope implements eslint.Scope.Scope { + export class Scope { type: ScopeType; isStrict: boolean; upper: Scope | null; childScopes: Scope[]; variableScope: Scope; - block: Node; + block: TSESTree.Node; variables: Variable[]; set: Map; references: Reference[]; @@ -221,7 +216,7 @@ declare module 'eslint-scope/lib/scope' { scopeManager: ScopeManager, type: ScopeType, upperScope: Scope | null, - block: Node | null, + block: TSESTree.Node | null, isMethodDefinition: boolean ); @@ -234,7 +229,7 @@ declare module 'eslint-scope/lib/scope' { __isValidResolution(ref: any, variable: any): boolean; __resolve(ref: any): boolean; __delegateToUpperScope(ref: any): void; - __addDeclaredVariablesOfNode(variable: any, node: Node): void; + __addDeclaredVariablesOfNode(variable: any, node: TSESTree.Node): void; __defineGeneric( name: any, set: any, @@ -243,12 +238,12 @@ declare module 'eslint-scope/lib/scope' { def: Definition ): void; - __define(node: Node, def: Definition): void; + __define(node: TSESTree.Node, def: Definition): void; __referencing( - node: Node, + node: TSESTree.Node, assign: number, - writeExpr: Node, + writeExpr: TSESTree.Node, maybeImplicitGlobal: any, partial: any, init: any @@ -263,7 +258,7 @@ declare module 'eslint-scope/lib/scope' { * @param {Espree.Identifier} ident - identifier to be resolved. * @returns {Reference} reference */ - resolve(ident: Node): Reference; + resolve(ident: TSESTree.Node): Reference; /** * returns this scope is static @@ -289,109 +284,94 @@ declare module 'eslint-scope/lib/scope' { isUsedName(name: any): boolean; } - class GlobalScope extends Scope { - constructor(scopeManager: ScopeManager, block: Node | null); + export class GlobalScope extends Scope { + constructor(scopeManager: ScopeManager, block: TSESTree.Node | null); } - class ModuleScope extends Scope { + export class ModuleScope extends Scope { constructor( scopeManager: ScopeManager, upperScope: Scope, - block: Node | null + block: TSESTree.Node | null ); } - class FunctionExpressionNameScope extends Scope { + export class FunctionExpressionNameScope extends Scope { constructor( scopeManager: ScopeManager, upperScope: Scope, - block: Node | null + block: TSESTree.Node | null ); } - class CatchScope extends Scope { + export class CatchScope extends Scope { constructor( scopeManager: ScopeManager, upperScope: Scope, - block: Node | null + block: TSESTree.Node | null ); } - class WithScope extends Scope { + export class WithScope extends Scope { constructor( scopeManager: ScopeManager, upperScope: Scope, - block: Node | null + block: TSESTree.Node | null ); } - class BlockScope extends Scope { + export class BlockScope extends Scope { constructor( scopeManager: ScopeManager, upperScope: Scope, - block: Node | null + block: TSESTree.Node | null ); } - class SwitchScope extends Scope { + export class SwitchScope extends Scope { constructor( scopeManager: ScopeManager, upperScope: Scope, - block: Node | null + block: TSESTree.Node | null ); } - class FunctionScope extends Scope { + export class FunctionScope extends Scope { constructor( scopeManager: ScopeManager, upperScope: Scope, - block: Node | null, + block: TSESTree.Node | null, isMethodDefinition: boolean ); } - class ForScope extends Scope { + export class ForScope extends Scope { constructor( scopeManager: ScopeManager, upperScope: Scope, - block: Node | null + block: TSESTree.Node | null ); } - class ClassScope extends Scope { + export class ClassScope extends Scope { constructor( scopeManager: ScopeManager, upperScope: Scope, - block: Node | null + block: TSESTree.Node | null ); } - - export { - Scope, - GlobalScope, - ModuleScope, - FunctionExpressionNameScope, - CatchScope, - WithScope, - BlockScope, - SwitchScope, - FunctionScope, - ForScope, - ClassScope - }; } declare module 'eslint-scope/lib/reference' { - import * as eslint from 'eslint'; - import { Identifier, Node } from 'estree'; + import { TSESTree } from '@typescript-eslint/typescript-estree'; import { Scope } from 'eslint-scope/lib/scope'; import Variable from 'eslint-scope/lib/variable'; - class Reference implements eslint.Scope.Reference { - identifier: Identifier; + export default class Reference { + identifier: TSESTree.Identifier; from: Scope; resolved: Variable | null; - writeExpr: Node | null; + writeExpr: TSESTree.Node | null; init: boolean; isWrite(): boolean; @@ -404,15 +384,14 @@ declare module 'eslint-scope/lib/reference' { static WRITE: 0x2; static RW: 0x3; } - export default Reference; } declare module 'eslint-scope/lib/scope-manager' { - import * as eslint from 'eslint'; + import { TSESTree } from '@typescript-eslint/typescript-estree'; import { Scope } from 'eslint-scope/lib/scope'; import Variable from 'eslint-scope/lib/variable'; - interface ScopeManagerOptions { + export interface ScopeManagerOptions { directive?: boolean; optimistic?: boolean; ignoreEval?: boolean; @@ -422,7 +401,7 @@ declare module 'eslint-scope/lib/scope-manager' { ecmaVersion?: number; } - class ScopeManager implements eslint.Scope.ScopeManager { + export default class ScopeManager { __options: ScopeManagerOptions; __currentScope: Scope; scopes: Scope[]; @@ -439,29 +418,31 @@ declare module 'eslint-scope/lib/scope-manager' { isStrictModeSupported(): boolean; // Returns appropriate scope for this node. - __get(node: Node): Scope; - getDeclaredVariables(node: {}): Variable[]; - acquire(node: {}, inner?: boolean): Scope | null; - acquireAll(node: Node): Scope | null; - release(node: Node, inner?: boolean): Scope | null; + __get(node: TSESTree.Node): Scope; + getDeclaredVariables(node: TSESTree.Node): Variable[]; + acquire(node: TSESTree.Node, inner?: boolean): Scope | null; + acquireAll(node: TSESTree.Node): Scope | null; + release(node: TSESTree.Node, inner?: boolean): Scope | null; attach(): void; detach(): void; __nestScope(scope: Scope): Scope; - __nestGlobalScope(node: Node): Scope; - __nestBlockScope(node: Node): Scope; - __nestFunctionScope(node: Node, isMethodDefinition: boolean): Scope; - __nestForScope(node: Node): Scope; - __nestCatchScope(node: Node): Scope; - __nestWithScope(node: Node): Scope; - __nestClassScope(node: Node): Scope; - __nestSwitchScope(node: Node): Scope; - __nestModuleScope(node: Node): Scope; - __nestFunctionExpressionNameScope(node: Node): Scope; + __nestGlobalScope(node: TSESTree.Node): Scope; + __nestBlockScope(node: TSESTree.Node): Scope; + __nestFunctionScope( + node: TSESTree.Node, + isMethodDefinition: boolean + ): Scope; + __nestForScope(node: TSESTree.Node): Scope; + __nestCatchScope(node: TSESTree.Node): Scope; + __nestWithScope(node: TSESTree.Node): Scope; + __nestClassScope(node: TSESTree.Node): Scope; + __nestSwitchScope(node: TSESTree.Node): Scope; + __nestModuleScope(node: TSESTree.Node): Scope; + __nestFunctionExpressionNameScope(node: TSESTree.Node): Scope; __isES6(): boolean; } - export default ScopeManager; } declare module 'eslint-scope' { diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index be3c3e7506e..78d71197e9f 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -2,21 +2,15 @@ import traverser from 'eslint/lib/util/traverser'; import { AST_NODE_TYPES, parseAndGenerateServices, - ParserOptions as ParserOptionsTsESTree + ParserOptions as ParserOptionsTsESTree, + ParserServices } from '@typescript-eslint/typescript-estree'; import { analyzeScope } from './analyze-scope'; import { ParserOptions } from './parser-options'; import { visitorKeys } from './visitor-keys'; -import { Program } from 'typescript'; const packageJSON = require('../package.json'); -interface ParserServices { - program: Program | undefined; - esTreeNodeToTSNodeMap: WeakMap | undefined; - tsNodeToESTreeNodeMap: WeakMap | undefined; -} - interface ParseForESLintResult { ast: any; services: ParserServices; diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index 6f4ae3ff203..876c8b3b43b 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -39253,139 +39253,269 @@ Object { } `; -exports[`typescript fixtures/basics/function-overloads.src 1`] = ` +exports[`typescript fixtures/basics/function-anonymus-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "async": false, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "f", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 27, + "column": 7, "line": 1, }, "start": Object { - "column": 18, + "column": 4, "line": 1, }, }, - "name": "x", + "name": "obj", "range": Array [ - 18, - 27, + 4, + 7, ], "type": "Identifier", - "typeAnnotation": Object { + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 38, + 47, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 19, + "column": 34, "line": 1, }, }, "range": Array [ - 19, - 27, + 34, + 49, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 27, + "column": 32, "line": 1, }, "start": Object { - "column": 21, + "column": 23, "line": 1, }, }, + "name": "a", "range": Array [ - 21, - 27, + 23, + 32, ], - "type": "TSNumberKeyword", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 10, + 49, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 19, + 22, + ], + "type": "TSTypeParameterDeclaration", }, }, - ], - "range": Array [ - 7, - 37, - ], - "returnType": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 28, + "column": 4, "line": 1, }, }, "range": Array [ - 28, - 36, + 4, + 49, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "TSNumberKeyword", - }, + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, - "type": "TSDeclareFunction", }, + "range": Array [ + 0, + 50, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "module", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 37, + "column": 3, "line": 1, }, "start": Object { @@ -39395,514 +39525,133 @@ Object { }, "range": Array [ 0, - 37, + 3, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "Keyword", + "value": "var", }, Object { - "declaration": Object { - "async": false, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "f", - "range": Array [ - 54, - 55, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, + "start": Object { + "column": 4, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 56, - 65, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 57, - 65, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 59, - 65, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 45, - 75, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 66, - 74, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 68, - 74, - ], - "type": "TSStringKeyword", - }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, }, - "type": "TSDeclareFunction", }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 38, - 75, + 10, + 18, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "Keyword", + "value": "function", }, - Object { - "declaration": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "name": "x", - "range": Array [ - 142, - 143, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 135, - 144, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 55, - "line": 3, - }, - }, - "range": Array [ - 131, - 146, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "name": "f", - "range": Array [ - 92, - 93, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "name": "x", - "range": Array [ - 94, - 112, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 3, - }, - }, - "range": Array [ - 95, - 112, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 112, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 103, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 106, - 112, - ], - "type": "TSNumberKeyword", - }, - ], - }, - }, - }, - ], - "range": Array [ - 83, - 146, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 37, - "line": 3, - }, - }, - "range": Array [ - 113, - 130, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 115, - 130, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 115, - 121, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 48, - "line": 3, - }, - }, - "range": Array [ - 124, - 130, - ], - "type": "TSNumberKeyword", - }, - ], - }, - }, - "type": "FunctionDeclaration", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 76, - 146, - ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 147, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 20, "line": 1, }, "start": Object { - "column": 0, + "column": 19, "line": 1, }, }, "range": Array [ - 0, - 6, + 19, + 20, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { - "column": 7, + "column": 20, "line": 1, }, }, "range": Array [ - 7, - 15, + 20, + 21, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 22, "line": 1, }, "start": Object { - "column": 16, + "column": 21, "line": 1, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], - "type": "Identifier", - "value": "f", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 1, }, "start": Object { - "column": 17, + "column": 22, "line": 1, }, }, "range": Array [ - 17, - 18, + 22, + 23, ], "type": "Punctuator", "value": "(", @@ -39910,35 +39659,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 24, "line": 1, }, "start": Object { - "column": 18, + "column": 23, "line": 1, }, }, "range": Array [ - 18, - 19, + 23, + 24, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 1, }, "start": Object { - "column": 19, + "column": 24, "line": 1, }, }, "range": Array [ - 19, - 20, + 24, + 25, ], "type": "Punctuator", "value": ":", @@ -39946,35 +39695,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 32, "line": 1, }, "start": Object { - "column": 21, + "column": 26, "line": 1, }, }, "range": Array [ - 21, - 27, + 26, + 32, ], "type": "Identifier", - "value": "number", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 33, "line": 1, }, "start": Object { - "column": 27, + "column": 32, "line": 1, }, }, "range": Array [ - 27, - 28, + 32, + 33, ], "type": "Punctuator", "value": ")", @@ -39982,65 +39731,29 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, + "column": 35, "line": 1, }, "start": Object { - "column": 36, + "column": 34, "line": 1, }, }, "range": Array [ - 36, - 37, + 34, + 35, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 2, }, "start": Object { - "column": 0, + "column": 2, "line": 2, }, }, @@ -40049,364 +39762,339 @@ Object { 44, ], "type": "Keyword", - "value": "export", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 2, }, "start": Object { - "column": 7, + "column": 9, "line": 2, }, }, "range": Array [ 45, - 53, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 54, - 55, - ], - "type": "Identifier", - "value": "f", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 56, - 57, + 46, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 11, "line": 2, }, "start": Object { - "column": 19, + "column": 10, "line": 2, }, }, "range": Array [ - 57, - 58, + 46, + 47, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 59, - 65, - ], - "type": "Identifier", - "value": "string", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 27, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 65, - 66, + 48, + 49, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 2, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 1, + "line": 3, }, }, "range": Array [ - 66, - 67, + 49, + 50, ], "type": "Punctuator", - "value": ":", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-anynomus-with-return-type.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 31, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 68, - 74, ], - "type": "Identifier", - "value": "string", - }, - Object { + "kind": "var", "loc": Object { "end": Object { - "column": 37, + "column": 2, "line": 2, }, "start": Object { - "column": 36, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 74, - 75, + 0, + 32, ], - "type": "Punctuator", - "value": ";", + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 3, + "line": 1, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 76, - 82, + 0, + 3, ], "type": "Keyword", - "value": "export", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { "column": 7, - "line": 3, - }, - }, - "range": Array [ - 83, - 91, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 4, + "line": 1, }, }, "range": Array [ - 92, - 93, + 4, + 7, ], "type": "Identifier", - "value": "f", + "value": "obj", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 9, + "line": 1, }, "start": Object { - "column": 17, - "line": 3, + "column": 8, + "line": 1, }, }, "range": Array [ - 93, - 94, + 8, + 9, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 94, - 95, + 10, + 18, ], - "type": "Identifier", - "value": "x", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { "column": 20, - "line": 3, + "line": 1, }, "start": Object { "column": 19, - "line": 3, + "line": 1, }, }, "range": Array [ - 95, - 96, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 103, - ], - "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, - }, - }, - "range": Array [ - 104, - 105, - ], - "type": "Punctuator", - "value": "|", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 106, - 112, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 3, + "line": 1, }, "start": Object { - "column": 36, - "line": 3, + "column": 20, + "line": 1, }, }, "range": Array [ - 112, - 113, + 20, + 21, ], "type": "Punctuator", "value": ")", @@ -40414,17 +40102,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 37, - "line": 3, + "column": 21, + "line": 1, }, }, "range": Array [ - 113, - 114, + 21, + 22, ], "type": "Punctuator", "value": ":", @@ -40432,306 +40120,213 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 3, + "column": 27, + "line": 1, }, "start": Object { - "column": 39, - "line": 3, + "column": 23, + "line": 1, }, }, "range": Array [ - 115, - 121, + 23, + 27, ], - "type": "Identifier", - "value": "string", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 3, + "column": 29, + "line": 1, }, "start": Object { - "column": 46, - "line": 3, + "column": 28, + "line": 1, }, }, "range": Array [ - 122, - 123, + 28, + 29, ], "type": "Punctuator", - "value": "|", - }, - Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 48, - "line": 3, - }, - }, - "range": Array [ - 124, - 130, - ], - "type": "Identifier", - "value": "number", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 56, - "line": 3, + "column": 1, + "line": 2, }, "start": Object { - "column": 55, - "line": 3, + "column": 0, + "line": 2, }, }, "range": Array [ - 131, - 132, + 30, + 31, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { "column": 2, - "line": 4, - }, - }, - "range": Array [ - 135, - 141, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "range": Array [ - 142, - 143, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 4, + "line": 2, }, "start": Object { - "column": 10, - "line": 4, - }, - }, - "range": Array [ - 143, - 144, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, + "line": 2, }, }, "range": Array [ - 145, - 146, + 31, + 32, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/function-with-await.src 1`] = ` +exports[`typescript fixtures/basics/function-overloads.src 1`] = ` Object { "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [ + "declaration": Object { + "async": false, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "name": "future", - "range": Array [ - 40, - 46, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, }, + }, + "name": "x", + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ - 34, - 46, + 19, + 27, ], - "type": "AwaitExpression", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSNumberKeyword", }, }, - "range": Array [ - 34, - 47, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 1, }, - }, - "range": Array [ - 28, - 49, ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "hope", "range": Array [ - 15, - 19, + 7, + 37, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { - "column": 20, + "column": 28, "line": 1, }, }, - "name": "future", "range": Array [ - 20, - 26, + 28, + 36, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSNumberKeyword", + }, }, - ], - "range": Array [ - 0, - 49, - ], - "type": "FunctionDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 50, - ], - "sourceType": "module", - "tokens": Array [ - Object { + "type": "TSDeclareFunction", + }, "loc": Object { "end": Object { - "column": 5, + "column": 37, "line": 1, }, "start": Object { @@ -40741,540 +40336,434 @@ Object { }, "range": Array [ 0, - 5, - ], - "type": "Identifier", - "value": "async", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 14, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 19, - ], - "type": "Identifier", - "value": "hope", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 26, - ], - "type": "Identifier", - "value": "future", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 34, - 39, - ], - "type": "Identifier", - "value": "await", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 40, - 46, - ], - "type": "Identifier", - "value": "future", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 46, - 47, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 48, - 49, + 37, ], - "type": "Punctuator", - "value": "}", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 47, - "line": 1, + "declaration": Object { + "async": false, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, }, + "name": "f", + "range": Array [ + 54, + 55, + ], + "type": "Identifier", }, - "range": Array [ - 47, - 51, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 37, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 7, + "line": 2, }, }, - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, }, - "kind": "init", + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 56, + 65, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 19, + "line": 2, }, }, - "method": false, "range": Array [ - 14, - 17, + 57, + 65, ], - "shorthand": true, - "type": "Property", - "value": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 21, + "line": 2, }, }, - "name": "bar", "range": Array [ - 14, - 17, + 59, + 65, ], - "type": "Identifier", + "type": "TSStringKeyword", }, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, + }, + ], + "range": Array [ + 45, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 66, + 74, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, }, - "method": false, - "range": Array [ - 19, - 22, - ], - "shorthand": true, - "type": "Property", - "value": Object { + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSDeclareFunction", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 75, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 10, + "line": 4, }, "start": Object { - "column": 19, - "line": 1, + "column": 9, + "line": 4, }, }, - "name": "baz", + "name": "x", "range": Array [ - 19, - 22, + 142, + 143, ], "type": "Identifier", }, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 144, + ], + "type": "ReturnStatement", }, ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, "range": Array [ - 13, - 45, + 131, + 146, ], - "type": "ObjectPattern", - "typeAnnotation": Object { + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "f", + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 36, + "line": 3, }, "start": Object { - "column": 23, - "line": 1, + "column": 18, + "line": 3, }, }, + "name": "x", "range": Array [ - 23, - 45, + 94, + 112, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 36, + "line": 3, }, "start": Object { - "column": 25, - "line": 1, + "column": 19, + "line": 3, }, }, - "members": Array [ - Object { - "computed": false, - "key": Object { + "range": Array [ + 95, + 112, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 112, + ], + "type": "TSUnionType", + "types": Array [ + Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 27, + "line": 3, }, "start": Object { - "column": 26, - "line": 1, + "column": 21, + "line": 3, }, }, - "name": "bar", "range": Array [ - 26, - 29, + 97, + 103, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, + "type": "TSStringKeyword", }, - "optional": true, - "range": Array [ - 26, - 39, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { + Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 36, + "line": 3, }, "start": Object { "column": 30, - "line": 1, + "line": 3, }, }, "range": Array [ - 30, - 38, + 106, + 112, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSStringKeyword", - }, + "type": "TSNumberKeyword", + }, + ], + }, + }, + }, + ], + "range": Array [ + 83, + 146, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 113, + 130, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 130, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, }, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 40, - 43, - ], - "type": "Identifier", + "range": Array [ + 115, + 121, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, }, - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, - }, + "start": Object { + "column": 48, + "line": 3, }, - "optional": true, - "range": Array [ - 40, - 44, - ], - "type": "TSPropertySignature", }, - ], - "range": Array [ - 25, - 45, - ], - "type": "TSTypeLiteral", - }, + "range": Array [ + 124, + 130, + ], + "type": "TSNumberKeyword", + }, + ], }, }, - ], + "type": "FunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, "range": Array [ - 0, - 51, + 76, + 146, ], - "type": "FunctionDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -41283,14 +40772,14 @@ Object { }, "range": Array [ 0, - 52, + 147, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -41300,151 +40789,151 @@ Object { }, "range": Array [ 0, - 8, + 6, ], "type": "Keyword", - "value": "function", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 15, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ - 9, - 12, + 7, + 15, ], - "type": "Identifier", - "value": "foo", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 1, }, "start": Object { - "column": 12, + "column": 16, "line": 1, }, }, "range": Array [ - 12, - 13, + 16, + 17, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 1, }, "start": Object { - "column": 13, + "column": 17, "line": 1, }, }, "range": Array [ - 13, - 14, + 17, + 18, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 19, "line": 1, }, "start": Object { - "column": 14, + "column": 18, "line": 1, }, }, "range": Array [ - 14, - 17, + 18, + 19, ], "type": "Identifier", - "value": "bar", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 20, "line": 1, }, "start": Object { - "column": 17, + "column": 19, "line": 1, }, }, "range": Array [ - 17, - 18, + 19, + 20, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 27, "line": 1, }, "start": Object { - "column": 19, + "column": 21, "line": 1, }, }, "range": Array [ - 19, - 22, + 21, + 27, ], "type": "Identifier", - "value": "baz", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 28, "line": 1, }, "start": Object { - "column": 22, + "column": 27, "line": 1, }, }, "range": Array [ - 22, - 23, + 27, + 28, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 29, "line": 1, }, "start": Object { - "column": 23, + "column": 28, "line": 1, }, }, "range": Array [ - 23, - 24, + 28, + 29, ], "type": "Punctuator", "value": ":", @@ -41452,71 +40941,341 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { - "column": 25, + "column": 30, "line": 1, }, }, "range": Array [ - 25, - 26, + 30, + 36, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 37, "line": 1, }, "start": Object { - "column": 26, + "column": 36, "line": 1, }, }, "range": Array [ - 26, - 29, + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 53, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, ], "type": "Identifier", - "value": "bar", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, }, "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { "column": 29, - "line": 1, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, }, }, "range": Array [ - 29, - 30, + 66, + 67, ], "type": "Punctuator", - "value": "?", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 36, + "line": 2, }, "start": Object { "column": 30, - "line": 1, + "line": 2, }, }, "range": Array [ - 30, - 31, + 68, + 74, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 83, + 91, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 95, + 96, ], "type": "Punctuator", "value": ":", @@ -41524,17 +41283,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 27, + "line": 3, }, "start": Object { - "column": 32, - "line": 1, + "column": 21, + "line": 3, }, }, "range": Array [ - 32, - 38, + 97, + 103, ], "type": "Identifier", "value": "string", @@ -41542,125 +41301,215 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 29, + "line": 3, }, "start": Object { - "column": 38, - "line": 1, + "column": 28, + "line": 3, }, }, "range": Array [ - 38, - 39, + 104, + 105, ], "type": "Punctuator", - "value": ",", + "value": "|", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 36, + "line": 3, }, "start": Object { - "column": 40, - "line": 1, + "column": 30, + "line": 3, }, }, "range": Array [ - 40, - 43, + 106, + 112, ], "type": "Identifier", - "value": "baz", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 37, + "line": 3, }, "start": Object { - "column": 43, - "line": 1, + "column": 36, + "line": 3, }, }, "range": Array [ - 43, - 44, + 112, + 113, ], "type": "Punctuator", - "value": "?", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 38, + "line": 3, }, "start": Object { - "column": 44, - "line": 1, + "column": 37, + "line": 3, }, }, "range": Array [ - 44, - 45, + 113, + 114, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 45, + "line": 3, }, "start": Object { - "column": 45, - "line": 1, + "column": 39, + "line": 3, }, }, "range": Array [ - 45, - 46, + 115, + 121, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 122, + 123, ], "type": "Punctuator", - "value": ")", + "value": "|", }, Object { "loc": Object { "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { "column": 48, - "line": 1, + "line": 3, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 3, }, "start": Object { - "column": 47, - "line": 1, + "column": 55, + "line": 3, }, }, "range": Array [ - 47, - 48, + 131, + 132, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ";", + }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 50, - 51, + 145, + 146, ], "type": "Punctuator", "value": "}", @@ -41670,28 +41519,381 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` +exports[`typescript fixtures/basics/function-with-await.src 1`] = ` Object { "body": Array [ Object { - "async": false, + "async": true, "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 45, - "line": 1, - }, - }, - "range": Array [ - 45, - 49, - ], - "type": "BlockStatement", + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "future", + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 46, + ], + "type": "AwaitExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "hope", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "future", + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 49, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "hope", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "value": "future", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "future", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "BlockStatement", }, "expression": false, "generator": false, @@ -41727,7 +41929,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, + "column": 45, "line": 1, }, "start": Object { @@ -41853,13 +42055,13 @@ Object { ], "range": Array [ 13, - 43, + 45, ], "type": "ObjectPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 43, + "column": 45, "line": 1, }, "start": Object { @@ -41869,13 +42071,13 @@ Object { }, "range": Array [ 23, - 43, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 43, + "column": 45, "line": 1, }, "start": Object { @@ -41906,7 +42108,7 @@ Object { }, "loc": Object { "end": Object { - "column": 38, + "column": 39, "line": 1, }, "start": Object { @@ -41914,41 +42116,42 @@ Object { "line": 1, }, }, + "optional": true, "range": Array [ 26, - 38, + 39, ], "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 38, "line": 1, }, "start": Object { - "column": 29, + "column": 30, "line": 1, }, }, "range": Array [ - 29, - 37, + 30, + 38, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 38, "line": 1, }, "start": Object { - "column": 31, + "column": 32, "line": 1, }, }, "range": Array [ - 31, - 37, + 32, + 38, ], "type": "TSStringKeyword", }, @@ -41959,41 +42162,42 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 42, + "column": 43, "line": 1, }, "start": Object { - "column": 39, + "column": 40, "line": 1, }, }, "name": "baz", "range": Array [ - 39, - 42, + 40, + 43, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 42, + "column": 44, "line": 1, }, "start": Object { - "column": 39, + "column": 40, "line": 1, }, }, + "optional": true, "range": Array [ - 39, - 42, + 40, + 44, ], "type": "TSPropertySignature", }, ], "range": Array [ 25, - 43, + 45, ], "type": "TSTypeLiteral", }, @@ -42002,7 +42206,7 @@ Object { ], "range": Array [ 0, - 49, + 51, ], "type": "FunctionDeclaration", }, @@ -42020,7 +42224,7 @@ Object { }, "range": Array [ 0, - 50, + 52, ], "sourceType": "module", "tokens": Array [ @@ -42238,22 +42442,40 @@ Object { 30, ], "type": "Punctuator", - "value": ":", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 31, "line": 1, }, "start": Object { - "column": 31, + "column": 30, "line": 1, }, }, "range": Array [ + 30, 31, - 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, ], "type": "Identifier", "value": "string", @@ -42261,17 +42483,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 39, "line": 1, }, "start": Object { - "column": 37, + "column": 38, "line": 1, }, }, "range": Array [ - 37, 38, + 39, ], "type": "Punctuator", "value": ",", @@ -42279,17 +42501,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 43, "line": 1, }, "start": Object { - "column": 39, + "column": 40, "line": 1, }, }, "range": Array [ - 39, - 42, + 40, + 43, ], "type": "Identifier", "value": "baz", @@ -42297,38 +42519,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, + "column": 44, "line": 1, }, "start": Object { - "column": 42, + "column": 43, "line": 1, }, }, "range": Array [ - 42, 43, + 44, ], "type": "Punctuator", - "value": "}", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 45, "line": 1, }, "start": Object { - "column": 43, + "column": 44, "line": 1, }, }, "range": Array [ - 43, 44, + 45, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { @@ -42346,6 +42568,24 @@ Object { 46, ], "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", "value": "{", }, Object { @@ -42360,8 +42600,8 @@ Object { }, }, "range": Array [ - 48, - 49, + 50, + 51, ], "type": "Punctuator", "value": "}", @@ -42371,62 +42611,26 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` +exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` Object { "body": Array [ Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "b", - "range": Array [ - 36, - 37, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 29, - 38, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { "column": 1, "line": 3, }, "start": Object { - "column": 23, + "column": 45, "line": 1, }, }, "range": Array [ - 23, - 40, + 45, + 49, ], "type": "BlockStatement", }, @@ -42435,7 +42639,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -42443,10 +42647,10 @@ Object { "line": 1, }, }, - "name": "a", + "name": "foo", "range": Array [ 9, - 10, + 12, ], "type": "Identifier", }, @@ -42464,185 +42668,284 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 43, "line": 1, }, "start": Object { - "column": 14, + "column": 13, "line": 1, }, }, - "name": "b", - "range": Array [ - 14, - 18, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", }, - }, - "range": Array [ - 15, - 18, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { - "column": 17, + "column": 14, "line": 1, }, }, + "method": false, "range": Array [ + 14, 17, - 18, ], - "type": "TSTypeReference", - "typeName": Object { + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { - "column": 17, + "column": 14, "line": 1, }, }, - "name": "X", + "name": "bar", "range": Array [ + 14, 17, - 18, ], "type": "Identifier", }, }, - }, - }, - ], - "range": Array [ - 0, - 40, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 22, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, }, - }, + ], "range": Array [ - 21, - 22, + 13, + 43, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "ObjectPattern", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, + "column": 43, "line": 1, }, "start": Object { - "column": 21, + "column": 23, "line": 1, }, }, - "name": "X", "range": Array [ - 21, - 22, + 23, + 43, ], - "type": "Identifier", - }, - }, - }, - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 12, + "column": 43, "line": 1, }, "start": Object { - "column": 11, + "column": 25, "line": 1, }, }, - "name": "X", + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 38, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "TSPropertySignature", + }, + ], "range": Array [ - 11, - 12, + 25, + 43, ], - "type": "Identifier", + "type": "TSTypeLiteral", }, - "range": Array [ - 11, - 12, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 10, - 13, - ], - "type": "TSTypeParameterDeclaration", - }, + }, + ], + "range": Array [ + 0, + 49, + ], + "type": "FunctionDeclaration", }, ], "comments": Array [], @@ -42658,7 +42961,7 @@ Object { }, "range": Array [ 0, - 41, + 50, ], "sourceType": "module", "tokens": Array [ @@ -42683,7 +42986,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -42693,46 +42996,10 @@ Object { }, "range": Array [ 9, - 10, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, 12, ], "type": "Identifier", - "value": "X", + "value": "foo", }, Object { "loc": Object { @@ -42750,7 +43017,7 @@ Object { 13, ], "type": "Punctuator", - "value": ">", + "value": "(", }, Object { "loc": Object { @@ -42768,12 +43035,12 @@ Object { 14, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { @@ -42783,79 +43050,79 @@ Object { }, "range": Array [ 14, - 15, + 17, ], "type": "Identifier", - "value": "b", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 18, "line": 1, }, "start": Object { - "column": 15, + "column": 17, "line": 1, }, }, "range": Array [ - 15, - 16, + 17, + 18, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 22, "line": 1, }, "start": Object { - "column": 17, + "column": 19, "line": 1, }, }, "range": Array [ - 17, - 18, + 19, + 22, ], "type": "Identifier", - "value": "X", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 23, "line": 1, }, "start": Object { - "column": 18, + "column": 22, "line": 1, }, }, "range": Array [ - 18, - 19, + 22, + 23, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 1, }, "start": Object { - "column": 19, + "column": 23, "line": 1, }, }, "range": Array [ - 19, - 20, + 23, + 24, ], "type": "Punctuator", "value": ":", @@ -42863,389 +43130,143 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 1, }, "start": Object { - "column": 21, + "column": 25, "line": 1, }, }, "range": Array [ - 21, - 22, + 25, + 26, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 29, "line": 1, }, "start": Object { - "column": 23, + "column": 26, "line": 1, }, }, "range": Array [ - 23, - 24, + 26, + 29, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 29, + "line": 1, }, }, "range": Array [ 29, - 35, + 30, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 36, - 37, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 37, - 38, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = ` -Object { - "body": Array [ - Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 35, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "compare", - "range": Array [ - 9, - 16, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 0, - 35, - ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 28, - 29, - ], - "type": "Identifier", - }, - "range": Array [ - 28, - 29, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 16, - 30, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - ], - "comments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 28, - ], - "type": "Block", - "value": "comment", - }, - ], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 35, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 8, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, + "column": 37, "line": 1, }, "start": Object { - "column": 9, + "column": 31, "line": 1, }, }, "range": Array [ - 9, - 16, + 31, + 37, ], "type": "Identifier", - "value": "compare", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 38, "line": 1, }, "start": Object { - "column": 16, + "column": 37, "line": 1, }, }, "range": Array [ - 16, - 17, + 37, + 38, ], "type": "Punctuator", - "value": "<", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 42, "line": 1, }, "start": Object { - "column": 28, + "column": 39, "line": 1, }, }, "range": Array [ - 28, - 29, + 39, + 42, ], "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": ">", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 43, "line": 1, }, "start": Object { - "column": 30, + "column": 42, "line": 1, }, }, "range": Array [ - 30, - 31, + 42, + 43, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 44, "line": 1, }, "start": Object { - "column": 31, + "column": 43, "line": 1, }, }, "range": Array [ - 31, - 32, + 43, + 44, ], "type": "Punctuator", "value": ")", @@ -43253,17 +43274,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 46, "line": 1, }, "start": Object { - "column": 33, + "column": 45, "line": 1, }, }, "range": Array [ - 33, - 34, + 45, + 46, ], "type": "Punctuator", "value": "{", @@ -43271,17 +43292,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 34, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 34, - 35, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -43291,7 +43312,7 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { @@ -43312,8 +43333,8 @@ Object { }, "name": "b", "range": Array [ - 47, - 48, + 36, + 37, ], "type": "Identifier", }, @@ -43328,8 +43349,8 @@ Object { }, }, "range": Array [ - 40, - 49, + 29, + 38, ], "type": "ReturnStatement", }, @@ -43340,13 +43361,13 @@ Object { "line": 3, }, "start": Object { - "column": 34, + "column": 23, "line": 1, }, }, "range": Array [ - 34, - 51, + 23, + 40, ], "type": "BlockStatement", }, @@ -43384,67 +43405,67 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 18, "line": 1, }, "start": Object { - "column": 25, + "column": 14, "line": 1, }, }, "name": "b", "range": Array [ - 25, - 29, + 14, + 18, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 29, + "column": 18, "line": 1, }, "start": Object { - "column": 26, + "column": 15, "line": 1, }, }, "range": Array [ - 26, - 29, + 15, + 18, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 29, + "column": 18, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 29, + 17, + 18, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 29, + "column": 18, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "name": "X", "range": Array [ - 28, - 29, + 17, + 18, ], "type": "Identifier", }, @@ -43454,55 +43475,55 @@ Object { ], "range": Array [ 0, - 51, + 40, ], "returnType": Object { "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 1, }, "start": Object { - "column": 30, + "column": 19, "line": 1, }, }, "range": Array [ - 30, - 33, + 19, + 22, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 1, }, "start": Object { - "column": 32, + "column": 21, "line": 1, }, }, "range": Array [ - 32, - 33, + 21, + 22, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 1, }, "start": Object { - "column": 32, + "column": 21, "line": 1, }, }, "name": "X", "range": Array [ - 32, - 33, + 21, + 22, ], "type": "Identifier", }, @@ -43512,7 +43533,7 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 24, + "column": 13, "line": 1, }, "start": Object { @@ -43522,27 +43543,9 @@ Object { }, "params": Array [ Object { - "constraint": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 21, - 23, - ], - "type": "TSTypeLiteral", - }, "loc": Object { "end": Object { - "column": 23, + "column": 12, "line": 1, }, "start": Object { @@ -43570,14 +43573,14 @@ Object { }, "range": Array [ 11, - 23, + 12, ], "type": "TSTypeParameter", }, ], "range": Array [ 10, - 24, + 13, ], "type": "TSTypeParameterDeclaration", }, @@ -43596,7 +43599,7 @@ Object { }, "range": Array [ 0, - 52, + 41, ], "sourceType": "module", "tokens": Array [ @@ -43675,125 +43678,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 13, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 13, - 20, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 14, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, "range": Array [ - 21, - 22, + 13, + 14, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 15, "line": 1, }, "start": Object { - "column": 22, + "column": 14, "line": 1, }, }, "range": Array [ - 22, - 23, + 14, + 15, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 16, "line": 1, }, "start": Object { - "column": 23, + "column": 15, "line": 1, }, }, "range": Array [ - 23, - 24, + 15, + 16, ], "type": "Punctuator", - "value": ">", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 18, "line": 1, }, "start": Object { - "column": 24, + "column": 17, "line": 1, }, }, "range": Array [ - 24, - 25, + 17, + 18, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 19, "line": 1, }, "start": Object { - "column": 25, + "column": 18, "line": 1, }, }, "range": Array [ - 25, - 26, + 18, + 19, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 20, "line": 1, }, "start": Object { - "column": 26, + "column": 19, "line": 1, }, }, "range": Array [ - 26, - 27, + 19, + 20, ], "type": "Punctuator", "value": ":", @@ -43801,17 +43804,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 1, }, "start": Object { - "column": 28, + "column": 21, "line": 1, }, }, "range": Array [ - 28, - 29, + 21, + 22, ], "type": "Identifier", "value": "X", @@ -43819,80 +43822,26 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { - "column": 29, + "column": 23, "line": 1, }, }, "range": Array [ - 29, - 30, + 23, + 24, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 33, - ], - "type": "Identifier", - "value": "X", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, + "column": 10, + "line": 2, }, "start": Object { "column": 4, @@ -43900,8 +43849,8 @@ Object { }, }, "range": Array [ - 40, - 46, + 29, + 35, ], "type": "Keyword", "value": "return", @@ -43918,8 +43867,8 @@ Object { }, }, "range": Array [ - 47, - 48, + 36, + 37, ], "type": "Identifier", "value": "b", @@ -43936,8 +43885,8 @@ Object { }, }, "range": Array [ - 48, - 49, + 37, + 38, ], "type": "Punctuator", "value": ";", @@ -43954,8 +43903,8 @@ Object { }, }, "range": Array [ - 50, - 51, + 39, + 40, ], "type": "Punctuator", "value": "}", @@ -43965,62 +43914,26 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-types.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = ` Object { "body": Array [ Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "name", - "range": Array [ - 50, - 54, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 43, - 55, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { - "column": 37, + "column": 33, "line": 1, }, }, "range": Array [ - 37, - 57, + 33, + 35, ], "type": "BlockStatement", }, @@ -44037,7 +43950,7 @@ Object { "line": 1, }, }, - "name": "message", + "name": "compare", "range": Array [ 9, 16, @@ -44046,114 +43959,100 @@ Object { }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "params": Array [], + "range": Array [ + 0, + 35, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, }, - "name": "name", - "range": Array [ - 17, - 28, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 21, + "column": 28, "line": 1, }, }, - "range": Array [ - 21, - 28, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "name": Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 22, + "column": 28, "line": 1, }, }, + "name": "T", "range": Array [ - 22, 28, + 29, ], - "type": "TSStringKeyword", + "type": "Identifier", }, + "range": Array [ + 28, + 29, + ], + "type": "TSTypeParameter", }, - }, - ], - "range": Array [ - 0, - 57, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, + ], "range": Array [ - 29, - 36, + 16, + 30, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "TSStringKeyword", + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, }, - "type": "FunctionDeclaration", + "range": Array [ + 17, + 28, + ], + "type": "Block", + "value": "comment", }, ], - "comments": Array [], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 35, + "line": 1, }, "start": Object { "column": 0, @@ -44162,7 +44061,7 @@ Object { }, "range": Array [ 0, - 58, + 35, ], "sourceType": "module", "tokens": Array [ @@ -44200,7 +44099,7 @@ Object { 16, ], "type": "Identifier", - "value": "message", + "value": "compare", }, Object { "loc": Object { @@ -44218,61 +44117,7 @@ Object { 17, ], "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 21, - ], - "type": "Identifier", - "value": "name", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "Identifier", - "value": "string", + "value": "<", }, Object { "loc": Object { @@ -44289,8 +44134,8 @@ Object { 28, 29, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { @@ -44308,12 +44153,12 @@ Object { 30, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 31, "line": 1, }, "start": Object { @@ -44323,97 +44168,61 @@ Object { }, "range": Array [ 30, - 36, + 31, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 32, "line": 1, }, "start": Object { - "column": 37, + "column": 31, "line": 1, }, }, "range": Array [ - 37, - 38, + 31, + 32, ], "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 43, - 49, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 50, - 54, - ], - "type": "Identifier", - "value": "name", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 34, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 33, + "line": 1, }, }, "range": Array [ - 54, - 55, + 33, + 34, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 34, + "line": 1, }, }, "range": Array [ - 56, - 57, + 34, + 35, ], "type": "Punctuator", "value": "}", @@ -44423,7 +44232,7 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-types-assignation.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = ` Object { "body": Array [ Object { @@ -44434,34 +44243,34 @@ Object { "argument": Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, - "name": "name", + "name": "b", "range": Array [ - 89, - 93, + 47, + 48, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 82, - 94, + 40, + 49, ], "type": "ReturnStatement", }, @@ -44472,13 +44281,13 @@ Object { "line": 3, }, "start": Object { - "column": 78, + "column": 34, "line": 1, }, }, "range": Array [ - 78, - 96, + 34, + 51, ], "type": "BlockStatement", }, @@ -44487,7 +44296,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { @@ -44495,10 +44304,10 @@ Object { "line": 1, }, }, - "name": "message", + "name": "a", "range": Array [ 9, - 16, + 10, ], "type": "Identifier", }, @@ -44516,306 +44325,203 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 17, + "column": 25, "line": 1, }, }, - "name": "name", + "name": "b", "range": Array [ - 17, - 28, + 25, + 29, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 21, + "column": 26, "line": 1, }, }, "range": Array [ - 21, - 28, + 26, + 29, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 22, + "column": 28, "line": 1, }, }, "range": Array [ - 22, 28, + 29, ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "name": "age", - "range": Array [ - 30, - 40, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 40, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 40, + "column": 29, "line": 1, }, "start": Object { - "column": 34, + "column": 28, "line": 1, }, }, + "name": "X", "range": Array [ - 34, - 40, + 28, + 29, ], - "type": "TSNumberKeyword", + "type": "Identifier", }, }, }, - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 30, + }, + ], + "range": Array [ + 0, + 51, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, "line": 1, }, }, "range": Array [ - 30, - 46, + 32, + 33, ], - "right": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 46, + "column": 33, "line": 1, }, "start": Object { - "column": 43, + "column": 32, "line": 1, }, }, + "name": "X", "range": Array [ - 43, - 46, + 32, + 33, ], - "raw": "100", - "type": "Literal", - "value": 100, + "type": "Identifier", }, - "type": "AssignmentPattern", }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 1, - }, - "start": Object { - "column": 51, - "line": 1, - }, - }, - "name": "args", - "range": Array [ - 51, - 55, - ], - "type": "Identifier", + }, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 69, - "line": 1, - }, - "start": Object { - "column": 48, - "line": 1, - }, + "start": Object { + "column": 10, + "line": 1, }, - "range": Array [ - 48, - 69, - ], - "type": "RestElement", - "typeAnnotation": Object { + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 21, + 23, + ], + "type": "TSTypeLiteral", + }, "loc": Object { "end": Object { - "column": 69, + "column": 23, "line": 1, }, "start": Object { - "column": 55, + "column": 11, "line": 1, }, }, - "range": Array [ - 55, - 69, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "name": Object { "loc": Object { "end": Object { - "column": 69, + "column": 12, "line": 1, }, "start": Object { - "column": 56, + "column": 11, "line": 1, }, }, + "name": "X", "range": Array [ - 56, - 69, + 11, + 12, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 61, - "line": 1, - }, - "start": Object { - "column": 56, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 56, - 61, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 69, - "line": 1, - }, - "start": Object { - "column": 61, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 68, - "line": 1, - }, - "start": Object { - "column": 62, - "line": 1, - }, - }, - "range": Array [ - 62, - 68, - ], - "type": "TSStringKeyword", - }, - ], - "range": Array [ - 61, - 69, - ], - "type": "TSTypeParameterInstantiation", - }, + "type": "Identifier", }, + "range": Array [ + 11, + 23, + ], + "type": "TSTypeParameter", }, - }, - ], - "range": Array [ - 0, - 96, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 70, - "line": 1, - }, - }, + ], "range": Array [ - 70, - 77, + 10, + 24, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 71, - "line": 1, - }, - }, - "range": Array [ - 71, - 77, - ], - "type": "TSStringKeyword", - }, + "type": "TSTypeParameterDeclaration", }, - "type": "FunctionDeclaration", }, ], "comments": Array [], @@ -44831,7 +44537,7 @@ Object { }, "range": Array [ 0, - 97, + 52, ], "sourceType": "module", "tokens": Array [ @@ -44856,7 +44562,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { @@ -44866,259 +44572,223 @@ Object { }, "range": Array [ 9, - 16, + 10, ], "type": "Identifier", - "value": "message", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 11, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 12, "line": 1, }, "start": Object { - "column": 17, + "column": 11, "line": 1, }, }, "range": Array [ - 17, - 21, + 11, + 12, ], "type": "Identifier", - "value": "name", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 20, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, "range": Array [ - 21, - 22, + 13, + 20, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 22, "line": 1, }, "start": Object { - "column": 22, + "column": 21, "line": 1, }, }, "range": Array [ + 21, 22, - 28, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 28, + "column": 22, "line": 1, }, }, "range": Array [ - 28, - 29, + 22, + 23, ], "type": "Punctuator", - "value": ",", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 24, "line": 1, }, "start": Object { - "column": 30, + "column": 23, "line": 1, }, }, "range": Array [ - 30, - 33, + 23, + 24, ], - "type": "Identifier", - "value": "age", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 25, "line": 1, }, "start": Object { - "column": 33, + "column": 24, "line": 1, }, }, "range": Array [ - 33, - 34, + 24, + 25, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 26, "line": 1, }, "start": Object { - "column": 34, + "column": 25, "line": 1, }, }, "range": Array [ - 34, - 40, + 25, + 26, ], "type": "Identifier", - "value": "number", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 27, "line": 1, }, "start": Object { - "column": 41, + "column": 26, "line": 1, }, }, "range": Array [ - 41, - 42, + 26, + 27, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 43, - "line": 1, - }, - }, - "range": Array [ - 43, - 46, - ], - "type": "Numeric", - "value": "100", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 47, + "column": 29, "line": 1, }, "start": Object { - "column": 46, + "column": 28, "line": 1, }, }, "range": Array [ - 46, - 47, + 28, + 29, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 51, + "column": 30, "line": 1, }, "start": Object { - "column": 48, + "column": 29, "line": 1, }, }, "range": Array [ - 48, - 51, + 29, + 30, ], "type": "Punctuator", - "value": "...", - }, - Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 1, - }, - "start": Object { - "column": 51, - "line": 1, - }, - }, - "range": Array [ - 51, - 55, - ], - "type": "Identifier", - "value": "args", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 31, "line": 1, }, "start": Object { - "column": 55, + "column": 30, "line": 1, }, }, "range": Array [ - 55, - 56, + 30, + 31, ], "type": "Punctuator", "value": ":", @@ -45126,305 +44796,305 @@ Object { Object { "loc": Object { "end": Object { - "column": 61, + "column": 33, "line": 1, }, "start": Object { - "column": 56, + "column": 32, "line": 1, }, }, "range": Array [ - 56, - 61, + 32, + 33, ], "type": "Identifier", - "value": "Array", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 62, + "column": 35, "line": 1, }, "start": Object { - "column": 61, + "column": 34, "line": 1, }, }, "range": Array [ - 61, - 62, + 34, + 35, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 68, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 62, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 62, - 68, + 40, + 46, ], - "type": "Identifier", - "value": "string", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 69, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 68, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 68, - 69, + 47, + 48, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 70, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 69, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 69, - 70, + 48, + 49, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 71, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 70, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 70, - 71, + 50, + 51, ], "type": "Punctuator", - "value": ":", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-types.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 71, - "line": 1, - }, - }, - "range": Array [ - 71, - 77, - ], - "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 79, - "line": 1, - }, - "start": Object { - "column": 78, - "line": 1, - }, - }, - "range": Array [ - 78, - 79, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 82, - 88, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 89, - 93, - ], - "type": "Identifier", - "value": "name", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 93, - 94, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "name", + "range": Array [ + 50, + 54, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 55, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, }, + "range": Array [ + 37, + 57, + ], + "type": "BlockStatement", }, - "range": Array [ - 95, - 96, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/import-equal-declaration.src 1`] = ` -Object { - "body": Array [ - Object { + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { - "column": 7, + "column": 9, "line": 1, }, }, - "name": "foo", + "name": "message", "range": Array [ - 7, - 10, + 9, + 16, ], "type": "Identifier", }, - "isExport": false, "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, - "moduleReference": Object { - "expression": Object { + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 26, + "column": 28, "line": 1, }, "start": Object { - "column": 21, + "column": 17, "line": 1, }, }, + "name": "name", "range": Array [ - 21, - 26, + 17, + 28, ], - "raw": "'bar'", - "type": "Literal", - "value": "bar", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, }, + ], + "range": Array [ + 0, + 57, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 27, + "column": 36, "line": 1, }, "start": Object { - "column": 13, + "column": 29, "line": 1, }, }, "range": Array [ - 13, - 27, + 29, + 36, ], - "type": "TSExternalModuleReference", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, }, - "range": Array [ - 0, - 28, - ], - "type": "TSImportEqualsDeclaration", + "type": "FunctionDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -45433,14 +45103,14 @@ Object { }, "range": Array [ 0, - 29, + 58, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -45450,115 +45120,115 @@ Object { }, "range": Array [ 0, - 6, + 8, ], "type": "Keyword", - "value": "import", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { - "column": 7, + "column": 9, "line": 1, }, }, "range": Array [ - 7, - 10, + 9, + 16, ], "type": "Identifier", - "value": "foo", + "value": "message", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 12, + 16, + 17, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 21, "line": 1, }, "start": Object { - "column": 13, + "column": 17, "line": 1, }, }, "range": Array [ - 13, - 20, + 17, + 21, ], "type": "Identifier", - "value": "require", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 22, "line": 1, }, "start": Object { - "column": 20, + "column": 21, "line": 1, }, }, "range": Array [ - 20, 21, + 22, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 28, "line": 1, }, "start": Object { - "column": 21, + "column": 22, "line": 1, }, }, "range": Array [ - 21, - 26, + 22, + 28, ], - "type": "String", - "value": "'bar'", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 29, "line": 1, }, "start": Object { - "column": 26, + "column": 28, "line": 1, }, }, "range": Array [ - 26, - 27, + 28, + 29, ], "type": "Punctuator", "value": ")", @@ -45566,563 +45236,550 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 30, "line": 1, }, "start": Object { - "column": 27, + "column": 29, "line": 1, }, }, "range": Array [ - 27, - 28, + 29, + 30, ], "type": "Punctuator", - "value": ";", + "value": ":", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/import-export-equal-declaration.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "isExport": true, "loc": Object { "end": Object { - "column": 35, + "column": 36, "line": 1, }, "start": Object { - "column": 0, + "column": 30, "line": 1, }, }, - "moduleReference": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 33, - ], - "raw": "'bar'", - "type": "Literal", - "value": "bar", - }, - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 34, - ], - "type": "TSExternalModuleReference", - }, "range": Array [ - 0, - 35, + 30, + 36, ], - "type": "TSImportEqualsDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "string", }, - }, - "range": Array [ - 0, - 36, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 38, "line": 1, }, "start": Object { - "column": 0, + "column": 37, "line": 1, }, }, "range": Array [ - 0, - 6, + 37, + 38, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 7, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 7, - 13, + 43, + 49, ], "type": "Keyword", - "value": "import", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 14, - 17, + 50, + 54, ], "type": "Identifier", - "value": "foo", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 18, - 19, + 54, + 55, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 20, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 20, - 27, + 56, + 57, ], - "type": "Identifier", - "value": "require", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-types-assignation.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 33, - ], - "type": "String", - "value": "'bar'", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "name", + "range": Array [ + 89, + 93, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 82, + 94, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 78, + "line": 1, + }, }, + "range": Array [ + 78, + 96, + ], + "type": "BlockStatement", }, - "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/import-type.src 1`] = ` -Object { - "body": Array [ - Object { + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 6, + "column": 16, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, - "name": "A", + "name": "message", "range": Array [ - 5, - 6, + 9, + 16, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, - "range": Array [ - 0, - 28, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "isTypeOf": true, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, }, - "start": Object { - "column": 9, - "line": 1, + "name": "name", + "range": Array [ + 17, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, }, }, - "parameter": Object { - "literal": Object { + Object { + "left": Object { "loc": Object { "end": Object { - "column": 26, + "column": 40, "line": 1, }, "start": Object { - "column": 23, + "column": 30, "line": 1, }, }, + "name": "age", "range": Array [ - 23, - 26, + 30, + 40, ], - "raw": "'A'", - "type": "Literal", - "value": "A", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "TSNumberKeyword", + }, + }, }, "loc": Object { "end": Object { - "column": 26, + "column": 46, "line": 1, }, "start": Object { - "column": 23, + "column": 30, "line": 1, }, }, "range": Array [ - 23, - 26, + 30, + 46, ], - "type": "TSLiteralType", - }, - "qualifier": null, - "range": Array [ - 9, - 27, - ], - "type": "TSImportType", - "typeParameters": null, - }, - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "B", - "range": Array [ - 34, - 35, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 29, - 55, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "isTypeOf": false, - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "parameter": Object { - "literal": Object { + "right": Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 46, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 43, + "line": 1, }, }, "range": Array [ - 45, - 48, + 43, + 46, ], - "raw": "\\"B\\"", + "raw": "100", "type": "Literal", - "value": "B", + "value": 100, }, - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, + "type": "AssignmentPattern", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, }, + "name": "args", + "range": Array [ + 51, + 55, + ], + "type": "Identifier", }, - "range": Array [ - 45, - 48, - ], - "type": "TSLiteralType", - }, - "qualifier": Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 69, + "line": 1, }, "start": Object { - "column": 21, - "line": 2, + "column": 48, + "line": 1, }, }, - "name": "X", "range": Array [ - 50, - 51, + 48, + 69, ], - "type": "Identifier", - }, - "range": Array [ - 38, - 54, - ], - "type": "TSImportType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, + "type": "RestElement", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "range": Array [ + 55, + 69, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 69, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 56, + "line": 1, }, }, "range": Array [ - 52, - 53, + 56, + 69, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 61, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 56, + "line": 1, }, }, - "name": "Y", + "name": "Array", "range": Array [ - 52, - 53, + 56, + 61, ], "type": "Identifier", }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 61, + 69, + ], + "type": "TSTypeParameterInstantiation", + }, }, - ], - "range": Array [ - 51, - 54, - ], - "type": "TSTypeParameterInstantiation", + }, }, - }, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 56, - ], - "sourceType": "module", - "tokens": Array [ - Object { + ], + "range": Array [ + 0, + 96, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, + }, + }, + "range": Array [ + 70, + 77, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "range": Array [ + 71, + 77, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "sourceType": "module", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 4, + "column": 8, "line": 1, }, "start": Object { @@ -46132,64 +45789,64 @@ Object { }, "range": Array [ 0, - 4, + 8, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 16, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 6, + 9, + 16, ], "type": "Identifier", - "value": "A", + "value": "message", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 1, }, "start": Object { - "column": 7, + "column": 16, "line": 1, }, }, "range": Array [ - 7, - 8, + 16, + 17, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { - "column": 9, + "column": 17, "line": 1, }, }, "range": Array [ - 9, - 15, + 17, + 21, ], - "type": "Keyword", - "value": "typeof", + "type": "Identifier", + "value": "name", }, Object { "loc": Object { @@ -46198,21 +45855,21 @@ Object { "line": 1, }, "start": Object { - "column": 16, + "column": 21, "line": 1, }, }, "range": Array [ - 16, + 21, 22, ], - "type": "Keyword", - "value": "import", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 28, "line": 1, }, "start": Object { @@ -46222,187 +45879,277 @@ Object { }, "range": Array [ 22, - 23, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 33, "line": 1, }, "start": Object { - "column": 23, + "column": 30, "line": 1, }, }, "range": Array [ - 23, - 26, + 30, + 33, ], - "type": "String", - "value": "'A'", + "type": "Identifier", + "value": "age", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 34, "line": 1, }, "start": Object { - "column": 26, + "column": 33, "line": 1, }, }, "range": Array [ - 26, - 27, + 33, + 34, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 40, "line": 1, }, "start": Object { - "column": 27, + "column": 34, "line": 1, }, }, "range": Array [ - 27, - 28, + 34, + 40, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, ], "type": "Punctuator", - "value": ";", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 2, + "column": 46, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 43, + "line": 1, }, }, "range": Array [ - 29, - 33, + 43, + 46, ], - "type": "Identifier", - "value": "type", + "type": "Numeric", + "value": "100", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 47, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 46, + "line": 1, }, }, "range": Array [ - 34, - 35, + 46, + 47, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 55, ], "type": "Identifier", - "value": "B", + "value": "args", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 56, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 55, + "line": 1, }, }, "range": Array [ - 36, - 37, + 55, + 56, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 61, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 56, + "line": 1, }, }, "range": Array [ - 38, - 44, + 56, + 61, ], - "type": "Keyword", - "value": "import", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 62, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 61, + "line": 1, }, }, "range": Array [ - 44, - 45, + 61, + 62, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 68, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 62, + "line": 1, }, }, "range": Array [ - 45, - 48, + 62, + 68, ], - "type": "String", - "value": "\\"B\\"", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 69, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 68, + "line": 1, }, }, "range": Array [ - 48, - 49, + 68, + 69, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 1, + }, + "start": Object { + "column": 69, + "line": 1, + }, + }, + "range": Array [ + 69, + 70, ], "type": "Punctuator", "value": ")", @@ -46410,141 +46157,160 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 71, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 70, + "line": 1, }, }, "range": Array [ - 49, - 50, + 70, + 71, ], "type": "Punctuator", - "value": ".", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 77, + "line": 1, }, "start": Object { - "column": 21, - "line": 2, + "column": 71, + "line": 1, }, }, "range": Array [ - 50, - 51, + 71, + 77, ], "type": "Identifier", - "value": "X", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 79, + "line": 1, }, "start": Object { - "column": 22, - "line": 2, + "column": 78, + "line": 1, }, }, "range": Array [ - 51, - 52, + 78, + 79, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 8, "line": 2, }, "start": Object { - "column": 23, + "column": 2, "line": 2, }, }, "range": Array [ - 52, - 53, + 82, + 88, ], - "type": "Identifier", - "value": "Y", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 13, "line": 2, }, "start": Object { - "column": 24, + "column": 9, "line": 2, }, }, "range": Array [ - 53, - 54, + 89, + 93, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 14, "line": 2, }, "start": Object { - "column": 25, + "column": 13, "line": 2, }, }, "range": Array [ - 54, - 55, + 93, + 94, ], "type": "Punctuator", "value": ";", }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": "}", + }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/import-type-with-type-parameters-in-type-reference.src 1`] = ` +exports[`typescript fixtures/basics/import-equal-declaration.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 7, "line": 1, }, }, - "name": "X", + "name": "foo", "range": Array [ - 5, - 6, + 7, + 10, ], "type": "Identifier", }, + "isExport": false, "loc": Object { "end": Object { - "column": 30, + "column": 28, "line": 1, }, "start": Object { @@ -46552,173 +46318,47 @@ Object { "line": 1, }, }, - "range": Array [ - 0, - 30, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 29, - ], - "type": "TSTypeReference", - "typeName": Object { + "moduleReference": Object { + "expression": Object { "loc": Object { "end": Object { - "column": 10, + "column": 26, "line": 1, }, "start": Object { - "column": 9, + "column": 21, "line": 1, }, }, - "name": "A", "range": Array [ - 9, - 10, + 21, + 26, ], - "type": "Identifier", + "raw": "'bar'", + "type": "Literal", + "value": "bar", }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, - "params": Array [ - Object { - "isTypeOf": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "parameter": Object { - "literal": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 20, - ], - "raw": "\\"\\"", - "type": "Literal", - "value": "", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 20, - ], - "type": "TSLiteralType", - }, - "qualifier": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "B", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, - "range": Array [ - 11, - 28, - ], - "type": "TSImportType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 27, - ], - "type": "TSAnyKeyword", - }, - ], - "range": Array [ - 23, - 28, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - ], - "range": Array [ - 10, - 29, - ], - "type": "TSTypeParameterInstantiation", }, + "range": Array [ + 13, + 27, + ], + "type": "TSExternalModuleReference", }, + "range": Array [ + 0, + 28, + ], + "type": "TSImportEqualsDeclaration", }, ], "comments": Array [], @@ -46734,14 +46374,14 @@ Object { }, "range": Array [ 0, - 31, + 29, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 6, "line": 1, }, "start": Object { @@ -46751,33 +46391,15 @@ Object { }, "range": Array [ 0, - 4, - ], - "type": "Identifier", - "value": "type", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, 6, ], - "type": "Identifier", - "value": "X", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 1, }, "start": Object { @@ -46787,51 +46409,15 @@ Object { }, "range": Array [ 7, - 8, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, 10, ], "type": "Identifier", - "value": "A", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": "<", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 12, "line": 1, }, "start": Object { @@ -46841,28 +46427,10 @@ Object { }, "range": Array [ 11, - 17, - ], - "type": "Keyword", - "value": "import", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, + 12, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { @@ -46871,16 +46439,16 @@ Object { "line": 1, }, "start": Object { - "column": 18, + "column": 13, "line": 1, }, }, "range": Array [ - 18, + 13, 20, ], - "type": "String", - "value": "\\"\\"", + "type": "Identifier", + "value": "require", }, Object { "loc": Object { @@ -46898,12 +46466,12 @@ Object { 21, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 1, }, "start": Object { @@ -46913,46 +46481,10 @@ Object { }, "range": Array [ 21, - 22, - ], - "type": "Punctuator", - "value": ".", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - "value": "B", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, + 26, ], - "type": "Punctuator", - "value": "<", + "type": "String", + "value": "'bar'", }, Object { "loc": Object { @@ -46961,16 +46493,16 @@ Object { "line": 1, }, "start": Object { - "column": 24, + "column": 26, "line": 1, }, }, "range": Array [ - 24, + 26, 27, ], - "type": "Identifier", - "value": "any", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -46988,42 +46520,6 @@ Object { 28, ], "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", "value": ";", }, ], @@ -47031,105 +46527,87 @@ Object { } `; -exports[`typescript fixtures/basics/interface-extends.src 1`] = ` +exports[`typescript fixtures/basics/import-export-equal-declaration.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], + "id": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 26, + "column": 14, "line": 1, }, }, + "name": "foo", "range": Array [ - 26, - 30, + 14, + 17, ], - "type": "TSInterfaceBody", + "type": "Identifier", }, - "extends": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 22, - 25, - ], - "type": "Identifier", - }, + "isExport": true, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "moduleReference": Object { + "expression": Object { "loc": Object { "end": Object { - "column": 25, + "column": 33, "line": 1, }, "start": Object { - "column": 22, + "column": 28, "line": 1, }, }, "range": Array [ - 22, - 25, + 28, + 33, ], - "type": "TSInterfaceHeritage", + "raw": "'bar'", + "type": "Literal", + "value": "bar", }, - ], - "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 34, "line": 1, }, "start": Object { - "column": 10, + "column": 20, "line": 1, }, }, - "name": "Foo", "range": Array [ - 10, - 13, + 20, + 34, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "TSExternalModuleReference", }, "range": Array [ 0, - 30, + 35, ], - "type": "TSInterfaceDeclaration", + "type": "TSImportEqualsDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -47138,14 +46616,14 @@ Object { }, "range": Array [ 0, - 31, + 36, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { @@ -47155,10 +46633,10 @@ Object { }, "range": Array [ 0, - 9, + 6, ], "type": "Keyword", - "value": "interface", + "value": "export", }, Object { "loc": Object { @@ -47167,21 +46645,21 @@ Object { "line": 1, }, "start": Object { - "column": 10, + "column": 7, "line": 1, }, }, "range": Array [ - 10, + 7, 13, ], - "type": "Identifier", - "value": "Foo", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 1, }, "start": Object { @@ -47191,28 +46669,28 @@ Object { }, "range": Array [ 14, - 21, + 17, ], - "type": "Keyword", - "value": "extends", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 19, "line": 1, }, "start": Object { - "column": 22, + "column": 18, "line": 1, }, }, "range": Array [ - 22, - 25, + 18, + 19, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { @@ -47221,174 +46699,355 @@ Object { "line": 1, }, "start": Object { - "column": 26, + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 27, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, "line": 1, }, }, "range": Array [ - 26, 27, + 28, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 33, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 28, + "line": 1, }, }, "range": Array [ - 29, - 30, + 28, + 33, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, ], "type": "Punctuator", - "value": "}", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/interface-extends-multiple.src 1`] = ` +exports[`typescript fixtures/basics/import-type.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], + "id": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 6, + "line": 1, }, "start": Object { - "column": 30, + "column": 5, "line": 1, }, }, + "name": "A", "range": Array [ - 30, - 34, + 5, + 6, ], - "type": "TSInterfaceBody", + "type": "Identifier", }, - "extends": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 22, - 25, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "isTypeOf": true, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, + "start": Object { + "column": 9, + "line": 1, }, - "range": Array [ - 22, - 25, - ], - "type": "TSInterfaceHeritage", }, - Object { - "expression": Object { + "parameter": Object { + "literal": Object { "loc": Object { "end": Object { - "column": 29, + "column": 26, "line": 1, }, "start": Object { - "column": 26, + "column": 23, "line": 1, }, }, - "name": "Baz", "range": Array [ + 23, 26, - 29, ], - "type": "Identifier", + "raw": "'A'", + "type": "Literal", + "value": "A", }, "loc": Object { "end": Object { - "column": 29, + "column": 26, "line": 1, }, "start": Object { - "column": 26, + "column": 23, "line": 1, }, }, "range": Array [ + 23, 26, - 29, ], - "type": "TSInterfaceHeritage", + "type": "TSLiteralType", }, - ], + "qualifier": null, + "range": Array [ + 9, + 27, + ], + "type": "TSImportType", + "typeParameters": null, + }, + }, + Object { "id": Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 5, + "line": 2, }, }, - "name": "Foo", + "name": "B", "range": Array [ - 10, - 13, + 34, + 35, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 26, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 34, + 29, + 55, ], - "type": "TSInterfaceDeclaration", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "isTypeOf": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "parameter": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "raw": "\\"B\\"", + "type": "Literal", + "value": "B", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "TSLiteralType", + }, + "qualifier": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "X", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "range": Array [ + 38, + 54, + ], + "type": "TSImportType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "Y", + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 51, + 54, + ], + "type": "TSTypeParameterInstantiation", + }, + }, }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -47397,14 +47056,14 @@ Object { }, "range": Array [ 0, - 35, + 56, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 4, "line": 1, }, "start": Object { @@ -47414,635 +47073,1917 @@ Object { }, "range": Array [ 0, - 9, + 4, ], - "type": "Keyword", - "value": "interface", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 6, "line": 1, }, "start": Object { - "column": 10, + "column": 5, "line": 1, }, }, "range": Array [ - 10, - 13, + 5, + 6, ], "type": "Identifier", - "value": "Foo", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 8, "line": 1, }, "start": Object { - "column": 14, + "column": 7, "line": 1, }, }, "range": Array [ - 14, - 21, + 7, + 8, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 1, }, "start": Object { - "column": 22, + "column": 9, "line": 1, }, }, "range": Array [ - 22, - 25, + 9, + 15, ], - "type": "Identifier", - "value": "Bar", + "type": "Keyword", + "value": "typeof", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 22, "line": 1, }, "start": Object { - "column": 25, + "column": 16, "line": 1, }, }, "range": Array [ - 25, - 26, + 16, + 22, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 26, + "column": 22, "line": 1, }, }, "range": Array [ - 26, - 29, + 22, + 23, ], - "type": "Identifier", - "value": "Baz", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 26, "line": 1, }, "start": Object { - "column": 30, + "column": 23, "line": 1, }, }, "range": Array [ - 30, - 31, + 23, + 26, ], - "type": "Punctuator", - "value": "{", + "type": "String", + "value": "'A'", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 27, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 26, + "line": 1, }, }, "range": Array [ - 33, - 34, + 26, + 27, ], "type": "Punctuator", - "value": "}", + "value": ")", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-type-parameters.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 21, - ], - "type": "TSInterfaceBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 28, + "line": 1, }, "start": Object { - "column": 0, + "column": 27, "line": 1, }, }, "range": Array [ - 0, - 21, + 27, + 28, ], - "type": "TSInterfaceDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 13, - 16, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ";", }, - }, - "range": Array [ - 0, - 22, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 9, + 29, + 33, ], - "type": "Keyword", - "value": "interface", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 10, - 13, + 34, + 35, ], "type": "Identifier", - "value": "Foo", + "value": "B", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, - }, + "column": 7, + "line": 2, + }, }, "range": Array [ - 13, - 14, + 36, + 37, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { "column": 15, - "line": 1, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 14, - 15, + 38, + 44, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 1, + "line": 2, }, "start": Object { "column": 15, - "line": 1, + "line": 2, }, }, "range": Array [ - 15, - 16, + 44, + 45, ], "type": "Punctuator", - "value": ">", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 17, - 18, + 45, + 48, + ], + "type": "String", + "value": "\\"B\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 21, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 20, + "line": 2, }, }, "range": Array [ - 20, - 21, + 49, + 50, ], "type": "Punctuator", - "value": "}", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "value": "Y", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/interface-with-all-property-types.src 1`] = ` +exports[`typescript fixtures/basics/import-type-with-type-parameters-in-type-reference.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "baa", - "range": Array [ - 20, - 23, - ], - "type": "Identifier", + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 29, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "start": Object { + "column": 9, + "line": 1, }, - "range": Array [ - 20, - 32, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { + }, + "name": "A", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "isTypeOf": false, "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 11, + "line": 1, }, }, - "range": Array [ - 23, - 31, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "parameter": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 18, + "line": 1, }, }, "range": Array [ - 25, - 31, + 18, + 20, ], - "type": "TSNumberKeyword", - }, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 37, - 40, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "optional": true, - "range": Array [ - 37, - 50, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, + "type": "TSLiteralType", }, - "range": Array [ - 41, - 49, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "qualifier": Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 22, + "line": 1, }, }, + "name": "B", "range": Array [ - 43, - 49, + 22, + 23, ], - "type": "TSNumberKeyword", - }, - }, - }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "name": "bax", - "range": Array [ - 56, - 59, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 55, - 69, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, + "type": "Identifier", }, "range": Array [ - 60, - 68, + 11, + 28, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "TSImportType", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 28, + "line": 1, }, "start": Object { - "column": 11, - "line": 4, + "column": 23, + "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "TSAnyKeyword", + }, + ], "range": Array [ - 62, - 68, + 23, + 28, ], - "type": "TSStringKeyword", + "type": "TSTypeParameterInstantiation", }, }, - }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 5, - "line": 5, - }, - }, - "name": "baz", - "range": Array [ - 75, - 78, + ], + "range": Array [ + 10, + 29, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "TSInterfaceBody", + }, + "extends": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSInterfaceHeritage", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-extends-multiple.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 34, + ], + "type": "TSInterfaceBody", + }, + "extends": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSInterfaceHeritage", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "Baz", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "TSInterfaceHeritage", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "Baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-all-property-types.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "baa", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 32, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 31, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": true, + "range": Array [ + 37, + 50, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 41, + 49, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "bax", + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 55, + 69, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 60, + 68, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "name": "baz", + "range": Array [ + 75, + 78, ], "type": "Identifier", }, @@ -61476,16 +62417,490 @@ Object { "line": 1, }, "start": Object { - "column": 5, + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "value": "Result", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 35, + ], + "type": "Identifier", + "value": "Success", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + "value": "Failure", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 24, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSPropertySignature", + }, + ], + "range": Array [ + 11, + 29, + ], + "type": "TSTypeLiteral", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 11, + 9, + 10, ], - "type": "Identifier", - "value": "Result", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { @@ -61503,12 +62918,12 @@ Object { 12, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { @@ -61518,28 +62933,28 @@ Object { }, "range": Array [ 12, - 13, + 15, ], "type": "Identifier", - "value": "T", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 16, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, - 21, + 15, + 16, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { @@ -61548,16 +62963,16 @@ Object { "line": 1, }, "start": Object { - "column": 22, + "column": 17, "line": 1, }, }, "range": Array [ - 22, + 17, 23, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { @@ -61575,319 +62990,531 @@ Object { 24, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 28, "line": 1, }, "start": Object { - "column": 24, + "column": 25, "line": 1, }, }, "range": Array [ - 24, 25, + 28, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 29, "line": 1, }, "start": Object { - "column": 26, + "column": 28, "line": 1, }, }, "range": Array [ - 26, - 27, + 28, + 29, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 30, "line": 1, }, "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-assertion.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 27, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { "column": 28, "line": 1, }, + "start": Object { + "column": 0, + "line": 1, + }, }, "range": Array [ + 0, 28, - 35, ], - "type": "Identifier", - "value": "Success", + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 36, + "column": 5, "line": 1, }, "start": Object { - "column": 35, + "column": 0, "line": 1, }, }, "range": Array [ - 35, - 36, + 0, + 5, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 9, "line": 1, }, "start": Object { - "column": 36, + "column": 6, "line": 1, }, }, "range": Array [ - 36, - 37, + 6, + 9, ], "type": "Identifier", - "value": "T", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 11, "line": 1, }, "start": Object { - "column": 37, + "column": 10, "line": 1, }, }, "range": Array [ - 37, - 38, + 10, + 11, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 13, "line": 1, }, "start": Object { - "column": 39, + "column": 12, "line": 1, }, }, "range": Array [ - 39, - 40, + 12, + 13, ], "type": "Punctuator", - "value": "|", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 16, "line": 1, }, "start": Object { - "column": 41, + "column": 13, "line": 1, }, }, "range": Array [ - 41, - 48, + 13, + 16, ], "type": "Identifier", - "value": "Failure", + "value": "any", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, }, - "name": "foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { "loc": Object { "end": Object { - "column": 30, + "column": 27, "line": 1, }, "start": Object { - "column": 0, + "column": 26, "line": 1, }, }, "range": Array [ - 0, - 30, + 26, + 27, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 12, - 15, - ], - "type": "Identifier", - }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-assertion-arrow-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 24, + "column": 13, "line": 1, }, "start": Object { - "column": 12, + "column": 4, "line": 1, }, }, + "name": "asserted2", "range": Array [ - 12, - 24, + 4, + 13, ], - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 23, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 40, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 23, + "column": 42, "line": 1, }, "start": Object { - "column": 17, + "column": 29, "line": 1, }, }, "range": Array [ - 17, - 23, + 29, + 42, ], - "type": "TSStringKeyword", + "type": "BlockStatement", }, - }, - }, - Object { - "computed": false, - "key": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 28, + "column": 42, "line": 1, }, "start": Object { - "column": 25, + "column": 22, "line": 1, }, }, - "name": "baz", + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + ], "range": Array [ - 25, - 28, + 22, + 42, ], - "type": "Identifier", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 28, + "column": 43, "line": 1, }, "start": Object { - "column": 25, + "column": 16, "line": 1, }, }, - "range": Array [ - 25, - 28, - ], - "type": "TSPropertySignature", + "range": Array [ + 16, + 43, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, - ], - "range": Array [ - 11, - 29, - ], - "type": "TSTypeLiteral", + "range": Array [ + 4, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", }, ], "comments": Array [], @@ -61903,14 +63530,14 @@ Object { }, "range": Array [ 0, - 31, + 45, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 3, "line": 1, }, "start": Object { @@ -61920,43 +63547,43 @@ Object { }, "range": Array [ 0, - 4, + 3, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 13, "line": 1, }, "start": Object { - "column": 5, + "column": 4, "line": 1, }, }, "range": Array [ - 5, - 8, + 4, + 13, ], "type": "Identifier", - "value": "foo", + "value": "asserted2", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { - "column": 9, + "column": 14, "line": 1, }, }, "range": Array [ - 9, - 10, + 14, + 15, ], "type": "Punctuator", "value": "=", @@ -61964,421 +63591,269 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 12, + 16, + 17, ], "type": "Punctuator", - "value": "{", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 20, "line": 1, }, "start": Object { - "column": 12, + "column": 17, "line": 1, }, }, "range": Array [ - 12, - 15, + 17, + 20, ], "type": "Identifier", - "value": "bar", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 15, + "column": 20, "line": 1, }, }, "range": Array [ - 15, - 16, + 20, + 21, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 22, "line": 1, }, "start": Object { - "column": 17, + "column": 21, "line": 1, }, }, "range": Array [ - 17, - 23, + 21, + 22, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 23, "line": 1, }, "start": Object { - "column": 23, + "column": 22, "line": 1, }, }, "range": Array [ + 22, 23, - 24, ], "type": "Punctuator", - "value": ",", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 24, "line": 1, }, "start": Object { - "column": 25, + "column": 23, "line": 1, }, }, "range": Array [ - 25, - 28, + 23, + 24, ], "type": "Identifier", - "value": "baz", + "value": "n", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 25, "line": 1, }, "start": Object { - "column": 28, + "column": 24, "line": 1, }, }, "range": Array [ - 28, - 29, + 24, + 25, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 28, "line": 1, }, "start": Object { - "column": 29, + "column": 26, "line": 1, }, }, "range": Array [ - 29, - 30, + 26, + 28, ], "type": "Punctuator", - "value": ";", + "value": "=>", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-assertion.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 27, - ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "TSAnyKeyword", - }, - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 27, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", "loc": Object { "end": Object { - "column": 28, + "column": 30, "line": 1, }, "start": Object { - "column": 0, + "column": 29, "line": 1, }, }, "range": Array [ - 0, - 28, + 29, + 30, ], - "type": "VariableDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 29, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 37, "line": 1, }, "start": Object { - "column": 0, + "column": 31, "line": 1, }, }, "range": Array [ - 0, - 5, + 31, + 37, ], "type": "Keyword", - "value": "const", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 39, "line": 1, }, "start": Object { - "column": 6, + "column": 38, "line": 1, }, }, "range": Array [ - 6, - 9, + 38, + 39, ], "type": "Identifier", - "value": "foo", + "value": "n", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 40, "line": 1, }, "start": Object { - "column": 10, + "column": 39, "line": 1, }, }, "range": Array [ - 10, - 11, + 39, + 40, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 42, "line": 1, }, "start": Object { - "column": 12, + "column": 41, "line": 1, }, }, "range": Array [ - 12, - 13, + 41, + 42, ], "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - "value": "any", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 43, "line": 1, }, "start": Object { - "column": 16, + "column": 42, "line": 1, }, }, "range": Array [ - 16, - 17, + 42, + 43, ], "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Numeric", - "value": "2", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 44, "line": 1, }, "start": Object { - "column": 27, + "column": 43, "line": 1, }, }, "range": Array [ - 27, - 28, + 43, + 44, ], "type": "Punctuator", "value": ";", @@ -62388,7 +63863,7 @@ Object { } `; -exports[`typescript fixtures/basics/type-assertion-arrow-function.src 1`] = ` +exports[`typescript fixtures/basics/type-guard-in-arrow-function.src 1`] = ` Object { "body": Array [ Object { @@ -62397,172 +63872,314 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, - "name": "asserted2", + "name": "isString", "range": Array [ - 4, - 13, + 6, + 14, ], "type": "Identifier", }, "init": Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 11, + "line": 2, }, }, - "name": "n", + "operator": "typeof", + "prefix": true, "range": Array [ - 38, - 39, + 55, + 63, ], - "type": "Identifier", + "type": "UnaryExpression", }, "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 32, + "line": 2, }, "start": Object { - "column": 31, - "line": 1, + "column": 11, + "line": 2, }, }, + "operator": "===", "range": Array [ - 31, - 40, + 55, + 76, ], - "type": "ReturnStatement", + "right": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 68, + 76, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", + }, + "type": "BinaryExpression", }, - ], + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 76, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 78, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 42, + "column": 24, "line": 1, }, "start": Object { - "column": 29, + "column": 18, "line": 1, }, }, + "name": "x", "range": Array [ - 29, - 42, + 18, + 24, ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "params": Array [ - Object { + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 24, "line": 1, }, "start": Object { - "column": 23, + "column": 19, "line": 1, }, }, - "name": "n", "range": Array [ - 23, + 19, 24, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "TSAnyKeyword", + }, }, - ], - "range": Array [ - 22, - 42, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, }, - }, + ], "range": Array [ - 16, - 43, + 17, + 78, ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 20, + "column": 38, "line": 1, }, "start": Object { - "column": 17, + "column": 25, "line": 1, }, }, "range": Array [ - 17, - 20, + 25, + 38, ], - "type": "TSAnyKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + }, + "range": Array [ + 27, + 38, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + }, }, + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, - 43, + 6, + 78, ], "type": "VariableDeclarator", }, ], - "kind": "var", + "kind": "const", "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -62571,7 +64188,7 @@ Object { }, "range": Array [ 0, - 44, + 78, ], "type": "VariableDeclaration", }, @@ -62580,7 +64197,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -62589,14 +64206,14 @@ Object { }, "range": Array [ 0, - 45, + 79, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -62606,43 +64223,43 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "var", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, - 13, + 6, + 14, ], "type": "Identifier", - "value": "asserted2", + "value": "isString", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, 15, + 16, ], "type": "Punctuator", "value": "=", @@ -62650,61 +64267,61 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 16, + "column": 17, "line": 1, }, }, "range": Array [ - 16, 17, + 18, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 19, "line": 1, }, "start": Object { - "column": 17, + "column": 18, "line": 1, }, }, "range": Array [ - 17, - 20, + 18, + 19, ], "type": "Identifier", - "value": "any", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 20, + "column": 19, "line": 1, }, }, "range": Array [ + 19, 20, - 21, ], "type": "Punctuator", - "value": ">", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 24, "line": 1, }, "start": Object { @@ -62714,79 +64331,115 @@ Object { }, "range": Array [ 21, - 22, + 24, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 26, "line": 1, }, "start": Object { - "column": 22, + "column": 25, "line": 1, }, }, "range": Array [ - 22, - 23, + 25, + 26, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 28, "line": 1, }, "start": Object { - "column": 23, + "column": 27, "line": 1, }, }, "range": Array [ - 23, - 24, + 27, + 28, ], "type": "Identifier", - "value": "n", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 31, "line": 1, }, "start": Object { - "column": 24, + "column": 29, "line": 1, }, }, "range": Array [ - 24, - 25, + 29, + 31, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "is", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 38, "line": 1, }, "start": Object { - "column": 26, + "column": 32, "line": 1, }, }, "range": Array [ - 26, - 28, + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 41, ], "type": "Punctuator", "value": "=>", @@ -62794,17 +64447,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 43, "line": 1, }, "start": Object { - "column": 29, + "column": 42, "line": 1, }, }, "range": Array [ - 29, - 30, + 42, + 43, ], "type": "Punctuator", "value": "{", @@ -62812,17 +64465,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 31, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 31, - 37, + 48, + 54, ], "type": "Keyword", "value": "return", @@ -62830,433 +64483,395 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 38, - 39, + 55, + 61, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 62, + 63, ], "type": "Identifier", - "value": "n", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 39, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 39, - 40, + 64, + 67, ], "type": "Punctuator", - "value": ";", + "value": "===", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 32, + "line": 2, }, "start": Object { - "column": 41, - "line": 1, + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 68, + 76, + ], + "type": "String", + "value": "'string'", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-guard-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "operator": "typeof", + "prefix": true, + "range": Array [ + 52, + 60, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "operator": "===", + "range": Array [ + 52, + 73, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 65, + 73, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 45, + 73, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 1, + }, }, + "range": Array [ + 39, + 75, + ], + "type": "BlockStatement", }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 42, - "line": 1, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, + "name": "isString", + "range": Array [ + 9, + 17, + ], + "type": "Identifier", }, - "range": Array [ - 42, - 43, - ], - "type": "Punctuator", - "value": ")", - }, - Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 43, + "column": 0, "line": 1, }, }, - "range": Array [ - 43, - 44, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-guard-in-arrow-function.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ + "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 18, + 24, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 14, + "column": 24, "line": 1, }, "start": Object { - "column": 6, + "column": 19, "line": 1, }, }, - "name": "isString", "range": Array [ - 6, - 14, + 19, + 24, ], - "type": "Identifier", - }, - "init": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 62, - 63, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "operator": "typeof", - "prefix": true, - "range": Array [ - 55, - 63, - ], - "type": "UnaryExpression", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "operator": "===", - "range": Array [ - 55, - 76, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "range": Array [ - 68, - 76, - ], - "raw": "'string'", - "type": "Literal", - "value": "string", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 48, - 76, - ], - "type": "ReturnStatement", - }, - ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 24, + "line": 1, }, "start": Object { - "column": 42, + "column": 21, "line": 1, }, }, "range": Array [ - 42, - 78, + 21, + 24, ], - "type": "BlockStatement", + "type": "TSAnyKeyword", }, - "expression": false, - "generator": false, - "id": null, + }, + }, + ], + "range": Array [ + 0, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "parameterName": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 28, + "line": 1, }, "start": Object { - "column": 17, + "column": 27, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 18, - 24, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 24, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 24, - ], - "type": "TSAnyKeyword", - }, - }, - }, + "name": "x", + "range": Array [ + 27, + 28, ], + "type": "Identifier", + }, + "range": Array [ + 27, + 38, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, "range": Array [ - 17, - 78, + 32, + 38, ], - "returnType": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 38, "line": 1, }, "start": Object { - "column": 25, + "column": 32, "line": 1, }, }, "range": Array [ - 25, + 32, 38, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "parameterName": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 27, - 28, - ], - "type": "Identifier", - }, - "range": Array [ - 27, - 38, - ], - "type": "TSTypePredicate", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSStringKeyword", - }, - }, - }, - }, - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 1, + "type": "TSStringKeyword", }, }, - "range": Array [ - 6, - 78, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, }, }, - "range": Array [ - 0, - 78, - ], - "type": "VariableDeclaration", + "type": "FunctionDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -63265,14 +64880,14 @@ Object { }, "range": Array [ 0, - 79, + 75, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -63282,47 +64897,29 @@ Object { }, "range": Array [ 0, - 5, + 8, ], "type": "Keyword", - "value": "const", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 17, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, "range": Array [ - 6, - 14, + 9, + 17, ], "type": "Identifier", "value": "isString", }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Punctuator", - "value": "=", - }, Object { "loc": Object { "end": Object { @@ -63479,44 +65076,26 @@ Object { }, }, "range": Array [ - 32, - 38, - ], - "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 41, + 32, + 38, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 40, "line": 1, }, "start": Object { - "column": 42, + "column": 39, "line": 1, }, }, "range": Array [ - 42, - 43, + 39, + 40, ], "type": "Punctuator", "value": "{", @@ -63533,8 +65112,8 @@ Object { }, }, "range": Array [ - 48, - 54, + 45, + 51, ], "type": "Keyword", "value": "return", @@ -63551,8 +65130,8 @@ Object { }, }, "range": Array [ - 55, - 61, + 52, + 58, ], "type": "Keyword", "value": "typeof", @@ -63569,8 +65148,8 @@ Object { }, }, "range": Array [ - 62, - 63, + 59, + 60, ], "type": "Identifier", "value": "x", @@ -63587,8 +65166,8 @@ Object { }, }, "range": Array [ + 61, 64, - 67, ], "type": "Punctuator", "value": "===", @@ -63605,8 +65184,8 @@ Object { }, }, "range": Array [ - 68, - 76, + 65, + 73, ], "type": "String", "value": "'string'", @@ -63623,8 +65202,8 @@ Object { }, }, "range": Array [ - 77, - 78, + 74, + 75, ], "type": "Punctuator", "value": "}", @@ -63634,37 +65213,47 @@ Object { } `; -exports[`typescript fixtures/basics/type-guard-in-function.src 1`] = ` +exports[`typescript fixtures/basics/type-guard-in-interface.src 1`] = ` Object { "body": Array [ Object { - "async": false, "body": Object { "body": Array [ Object { - "argument": Object { - "left": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 59, - 60, - ], - "type": "Identifier", + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, }, + }, + "name": "isString", + "range": Array [ + 18, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 2, }, "start": Object { @@ -63672,65 +65261,139 @@ Object { "line": 2, }, }, - "operator": "typeof", - "prefix": true, + "name": "node", "range": Array [ - 52, - 60, + 27, + 36, ], - "type": "UnaryExpression", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 36, + ], + "type": "TSAnyKeyword", + }, + }, }, + ], + "range": Array [ + 18, + 54, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 32, + "column": 37, "line": 2, }, "start": Object { - "column": 11, + "column": 21, "line": 2, }, }, - "operator": "===", "range": Array [ - 52, - 73, + 37, + 53, ], - "right": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, + "column": 37, "line": 2, }, "start": Object { - "column": 24, + "column": 23, "line": 2, }, }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "node", + "range": Array [ + 39, + 43, + ], + "type": "Identifier", + }, "range": Array [ - 65, - 73, + 39, + 53, ], - "raw": "'string'", - "type": "Literal", - "value": "string", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "TSStringKeyword", + }, + }, }, }, - "range": Array [ - 45, - 73, - ], - "type": "ReturnStatement", + "type": "TSMethodSignature", }, ], "loc": Object { @@ -63739,33 +65402,31 @@ Object { "line": 3, }, "start": Object { - "column": 39, + "column": 14, "line": 1, }, }, "range": Array [ - 39, - 75, + 14, + 56, ], - "type": "BlockStatement", + "type": "TSInterfaceBody", }, - "expression": false, - "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 17, + "column": 13, "line": 1, }, "start": Object { - "column": 9, + "column": 10, "line": 1, }, }, - "name": "isString", + "name": "Foo", "range": Array [ - 9, - 17, + 10, + 13, ], "type": "Identifier", }, @@ -63779,158 +65440,18 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 18, - 24, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 24, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 24, - ], - "type": "TSAnyKeyword", - }, - }, - }, - ], "range": Array [ 0, - 75, + 56, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "parameterName": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 27, - 28, - ], - "type": "Identifier", - }, - "range": Array [ - 27, - 38, - ], - "type": "TSTypePredicate", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSStringKeyword", - }, - }, - }, - }, - "type": "FunctionDeclaration", + "type": "TSInterfaceDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -63939,14 +65460,14 @@ Object { }, "range": Array [ 0, - 75, + 57, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 1, }, "start": Object { @@ -63956,298 +65477,244 @@ Object { }, "range": Array [ 0, - 8, + 9, ], "type": "Keyword", - "value": "function", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 13, "line": 1, }, "start": Object { - "column": 9, + "column": 10, "line": 1, }, }, "range": Array [ - 9, - 17, + 10, + 13, ], "type": "Identifier", - "value": "isString", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 15, "line": 1, }, "start": Object { - "column": 17, + "column": 14, "line": 1, }, }, "range": Array [ - 17, - 18, + 14, + 15, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ 18, - 19, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 24, + 26, ], "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": ")", + "value": "isString", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 25, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 25, 26, + 27, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 27, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ 27, - 28, + 31, ], "type": "Identifier", - "value": "x", + "value": "node", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 29, 31, + 32, ], - "type": "Identifier", - "value": "is", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 32, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 32, - 38, + 33, + 36, ], "type": "Identifier", - "value": "string", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 39, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 39, - 40, + 36, + 37, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 22, "line": 2, }, "start": Object { - "column": 4, + "column": 21, "line": 2, }, }, "range": Array [ - 45, - 51, + 37, + 38, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 27, "line": 2, }, "start": Object { - "column": 11, + "column": 23, "line": 2, }, }, "range": Array [ - 52, - 58, + 39, + 43, ], - "type": "Keyword", - "value": "typeof", + "type": "Identifier", + "value": "node", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 30, "line": 2, }, "start": Object { - "column": 18, + "column": 28, "line": 2, }, }, "range": Array [ - 59, - 60, + 44, + 46, ], "type": "Identifier", - "value": "x", + "value": "is", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 37, "line": 2, }, "start": Object { - "column": 20, + "column": 31, "line": 2, }, }, "range": Array [ - 61, - 64, + 47, + 53, ], - "type": "Punctuator", - "value": "===", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 38, "line": 2, }, "start": Object { - "column": 24, + "column": 37, "line": 2, }, }, "range": Array [ - 65, - 73, + 53, + 54, ], - "type": "String", - "value": "'string'", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { @@ -64261,8 +65728,8 @@ Object { }, }, "range": Array [ - 74, - 75, + 55, + 56, ], "type": "Punctuator", "value": "}", @@ -64272,7 +65739,7 @@ Object { } `; -exports[`typescript fixtures/basics/type-guard-in-interface.src 1`] = ` +exports[`typescript fixtures/basics/type-guard-in-method.src 1`] = ` Object { "body": Array [ Object { @@ -64283,7 +65750,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 2, }, "start": Object { @@ -64291,208 +65758,499 @@ Object { "line": 2, }, }, - "name": "isString", + "name": "isBar", "range": Array [ - 18, - 26, + 14, + 19, ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 3, + "line": 4, }, "start": Object { "column": 2, "line": 2, }, }, - "params": Array [ - Object { + "range": Array [ + 14, + 75, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 51, + 55, + ], + "type": "ThisExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "operator": "instanceof", + "range": Array [ + 51, + 70, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 67, + 70, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 44, + 71, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 20, + "column": 3, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 75, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 19, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 25, "line": 2, }, "start": Object { - "column": 11, + "column": 9, "line": 2, }, }, - "name": "node", "range": Array [ - 27, - 36, + 21, + 37, ], - "type": "Identifier", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 2, }, "start": Object { - "column": 15, + "column": 11, "line": 2, }, }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "TSThisType", + }, "range": Array [ - 31, - 36, + 23, + 37, ], - "type": "TSTypeAnnotation", + "type": "TSTypePredicate", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 2, }, "start": Object { - "column": 17, + "column": 19, "line": 2, }, }, "range": Array [ - 33, - 36, + 31, + 37, ], - "type": "TSAnyKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, }, }, }, - ], - "range": Array [ - 18, - 54, - ], - "returnType": Object { + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 7, + "line": 5, }, "start": Object { - "column": 21, - "line": 2, + "column": 2, + "line": 5, }, }, + "name": "isBaz", "range": Array [ - 37, - 53, + 78, + 83, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 78, + 145, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 121, + 125, + ], + "type": "ThisExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "operator": "instanceof", + "range": Array [ + 121, + 140, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "name": "Foo", + "range": Array [ + 137, + 140, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 114, + 141, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 3, + "line": 7, }, "start": Object { - "column": 23, - "line": 2, + "column": 32, + "line": 5, }, }, - "parameterName": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, + "range": Array [ + 108, + 145, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 86, + 145, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, }, - "name": "node", - "range": Array [ - 39, - 43, - ], - "type": "Identifier", }, "range": Array [ - 39, - 53, + 88, + 104, ], - "type": "TSTypePredicate", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 28, + "line": 5, }, "start": Object { - "column": 31, - "line": 2, + "column": 14, + "line": 5, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, }, + "range": Array [ + 90, + 94, + ], + "type": "TSThisType", }, "range": Array [ - 47, - 53, + 90, + 104, ], - "type": "TSTypeAnnotation", + "type": "TSTypePredicate", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 28, + "line": 5, }, "start": Object { - "column": 31, - "line": 2, + "column": 22, + "line": 5, }, }, "range": Array [ - 47, - 53, + 98, + 104, ], - "type": "TSStringKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "TSStringKeyword", + }, }, }, }, + "type": "ArrowFunctionExpression", }, - "type": "TSMethodSignature", }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 8, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 56, + 10, + 147, ], - "type": "TSInterfaceBody", + "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 6, "line": 1, }, }, "name": "Foo", "range": Array [ - 10, - 13, + 6, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 8, }, "start": Object { "column": 0, @@ -64501,16 +66259,17 @@ Object { }, "range": Array [ 0, - 56, + 147, ], - "type": "TSInterfaceDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 9, }, "start": Object { "column": 0, @@ -64519,14 +66278,14 @@ Object { }, "range": Array [ 0, - 57, + 148, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 1, }, "start": Object { @@ -64536,25 +66295,25 @@ Object { }, "range": Array [ 0, - 9, + 5, ], "type": "Keyword", - "value": "interface", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 6, "line": 1, }, }, "range": Array [ - 10, - 13, + 6, + 9, ], "type": "Identifier", "value": "Foo", @@ -64562,17 +66321,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -64580,7 +66339,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 2, }, "start": Object { @@ -64589,26 +66348,26 @@ Object { }, }, "range": Array [ - 18, - 26, + 14, + 19, ], "type": "Identifier", - "value": "isString", + "value": "isBar", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 8, "line": 2, }, "start": Object { - "column": 10, + "column": 7, "line": 2, }, }, "range": Array [ - 26, - 27, + 19, + 20, ], "type": "Punctuator", "value": "(", @@ -64616,35 +66375,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 2, }, "start": Object { - "column": 11, + "column": 8, "line": 2, }, }, "range": Array [ - 27, - 31, + 20, + 21, ], - "type": "Identifier", - "value": "node", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 2, }, "start": Object { - "column": 15, + "column": 9, "line": 2, }, }, "range": Array [ - 31, - 32, + 21, + 22, ], "type": "Punctuator", "value": ":", @@ -64652,56 +66411,56 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 15, "line": 2, }, "start": Object { - "column": 17, + "column": 11, "line": 2, }, }, "range": Array [ - 33, - 36, + 23, + 27, ], - "type": "Identifier", - "value": "any", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 18, "line": 2, }, "start": Object { - "column": 20, + "column": 16, "line": 2, }, }, "range": Array [ - 36, - 37, + 28, + 30, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "is", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 25, "line": 2, }, "start": Object { - "column": 21, + "column": 19, "line": 2, }, }, "range": Array [ + 31, 37, - 38, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { @@ -64710,85 +66469,427 @@ Object { "line": 2, }, "start": Object { - "column": 23, + "column": 26, "line": 2, }, }, "range": Array [ + 38, 39, - 43, ], - "type": "Identifier", - "value": "node", + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 51, + 55, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 56, + 66, + ], + "type": "Keyword", + "value": "instanceof", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 67, + 70, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 78, + 83, + ], + "type": "Identifier", + "value": "isBaz", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 90, + 94, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 95, + 97, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 29, + "line": 5, + }, + }, + "range": Array [ + 105, + 107, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 32, + "line": 5, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 114, + 120, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 121, + 125, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 126, + 136, + ], + "type": "Keyword", + "value": "instanceof", }, Object { "loc": Object { "end": Object { "column": 30, - "line": 2, + "line": 6, }, "start": Object { - "column": 28, - "line": 2, + "column": 27, + "line": 6, }, }, "range": Array [ - 44, - 46, + 137, + 140, ], "type": "Identifier", - "value": "is", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 31, + "line": 6, }, "start": Object { - "column": 31, - "line": 2, + "column": 30, + "line": 6, }, }, "range": Array [ - 47, - 53, + 140, + 141, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 3, + "line": 7, }, "start": Object { - "column": 37, - "line": 2, + "column": 2, + "line": 7, }, }, "range": Array [ - 53, - 54, + 144, + 145, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 8, }, "start": Object { "column": 0, - "line": 3, + "line": 8, }, }, "range": Array [ - 55, - 56, + 146, + 147, ], "type": "Punctuator", "value": "}", @@ -64798,635 +66899,730 @@ Object { } `; -exports[`typescript fixtures/basics/type-guard-in-method.src 1`] = ` +exports[`typescript fixtures/basics/type-parameters-comments.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 21, + "line": 1, }, }, - "name": "isBar", "range": Array [ - 14, - 19, + 21, + 22, ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 75, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 51, - 55, - ], - "type": "ThisExpression", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "operator": "instanceof", - "range": Array [ - 51, - 70, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 27, - "line": 3, - }, - }, - "name": "Foo", - "range": Array [ - 67, - 70, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 31, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 44, - 71, - ], - "type": "ReturnStatement", - }, - ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 22, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 21, + "line": 1, }, }, + "name": "A", "range": Array [ - 38, - 75, + 21, + 22, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, + }, + ], + "range": Array [ + 3, + 40, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "ExpressionStatement", + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 84, + 87, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 44, + 87, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 25, + "line": 2, }, "start": Object { - "column": 7, + "column": 24, "line": 2, }, }, - "params": Array [], + "name": "A", "range": Array [ - 19, - 75, + 68, + 69, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 21, - 37, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "parameterName": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 23, - 27, - ], - "type": "TSThisType", - }, - "range": Array [ - 23, - 37, - ], - "type": "TSTypePredicate", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 31, - 37, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 31, - 37, - ], - "type": "TSStringKeyword", - }, - }, - }, - }, - "type": "FunctionExpression", + "type": "Identifier", }, + "range": Array [ + 68, + 69, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 56, + 81, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 134, + 137, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "baz", + "range": Array [ + 97, + 100, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 88, + 137, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, }, + }, + "params": Array [ Object { - "computed": false, - "key": Object { + "default": Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 41, + "line": 3, }, "start": Object { - "column": 2, - "line": 5, + "column": 38, + "line": 3, }, }, - "name": "isBaz", "range": Array [ - 78, - 83, + 126, + 129, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 3, - "line": 7, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "range": Array [ - 78, - 145, - ], - "static": false, - "type": "ClassProperty", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 6, - }, - "start": Object { - "column": 11, - "line": 6, - }, - }, - "range": Array [ - 121, - 125, - ], - "type": "ThisExpression", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 6, - }, - "start": Object { - "column": 11, - "line": 6, - }, - }, - "operator": "instanceof", - "range": Array [ - 121, - 140, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 6, - }, - "start": Object { - "column": 27, - "line": 6, - }, - }, - "name": "Foo", - "range": Array [ - 137, - 140, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 31, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "range": Array [ - 114, - 141, - ], - "type": "ReturnStatement", - }, - ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 3, - "line": 7, + "column": 41, + "line": 3, }, "start": Object { - "column": 32, - "line": 5, + "column": 38, + "line": 3, }, }, + "name": "Foo", "range": Array [ - 108, - 145, + 126, + 129, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": Object { "loc": Object { "end": Object { - "column": 3, - "line": 7, + "column": 25, + "line": 3, }, "start": Object { - "column": 10, - "line": 5, + "column": 24, + "line": 3, }, }, - "params": Array [], + "name": "A", "range": Array [ - 86, - 145, + 112, + 113, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 5, - }, - "start": Object { - "column": 12, - "line": 5, - }, - }, - "range": Array [ - 88, - 104, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "parameterName": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "range": Array [ - 90, - 94, - ], - "type": "TSThisType", - }, - "range": Array [ - 90, - 104, - ], - "type": "TSTypePredicate", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, - }, - }, - "range": Array [ - 98, - 104, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, - }, - }, - "range": Array [ - 98, - 104, - ], - "type": "TSStringKeyword", - }, - }, - }, - }, - "type": "ArrowFunctionExpression", + "type": "Identifier", }, + "range": Array [ + 112, + 129, + ], + "type": "TSTypeParameter", }, ], - "loc": Object { - "end": Object { - "column": 1, - "line": 8, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, "range": Array [ - 10, - 147, + 100, + 131, ], - "type": "ClassBody", + "type": "TSTypeParameterDeclaration", }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "type": "Block", + "value": " comment 1 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 38, + ], + "type": "Block", + "value": " comment 2 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 58, + 67, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 70, + 79, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 102, + 111, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 114, + 123, + ], + "type": "Block", + "value": " bbb ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 138, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 8, + "column": 43, + "line": 1, }, "start": Object { - "column": 0, + "column": 42, "line": 1, }, }, "range": Array [ - 0, - 147, + 42, + 43, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 9, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ";", }, - }, - "range": Array [ - 0, - 148, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 5, + 44, + 52, ], "type": "Keyword", - "value": "class", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 6, - 9, + 53, + 56, ], "type": "Identifier", - "value": "Foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 10, - 11, + 56, + 57, ], "type": "Punctuator", - "value": "{", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 25, "line": 2, }, "start": Object { - "column": 2, + "column": 24, "line": 2, }, }, "range": Array [ - 14, - 19, + 68, + 69, ], "type": "Identifier", - "value": "isBar", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 37, "line": 2, }, "start": Object { - "column": 7, + "column": 36, "line": 2, }, }, "range": Array [ - 19, - 20, + 80, + 81, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 81, + 82, ], "type": "Punctuator", "value": "(", @@ -65434,17 +67630,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 39, "line": 2, }, "start": Object { - "column": 8, + "column": 38, "line": 2, }, }, "range": Array [ - 20, - 21, + 82, + 83, ], "type": "Punctuator", "value": ")", @@ -65452,949 +67648,1357 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 41, "line": 2, }, "start": Object { - "column": 9, + "column": 40, "line": 2, }, }, "range": Array [ - 21, - 22, + 84, + 85, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 43, "line": 2, }, "start": Object { - "column": 11, + "column": 42, "line": 2, }, }, "range": Array [ - 23, - 27, + 86, + 87, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 96, ], "type": "Keyword", - "value": "this", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 12, + "line": 3, }, "start": Object { - "column": 16, - "line": 2, + "column": 9, + "line": 3, }, }, "range": Array [ - 28, - 30, + 97, + 100, ], "type": "Identifier", - "value": "is", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { "column": 25, - "line": 2, + "line": 3, }, "start": Object { - "column": 19, - "line": 2, + "column": 24, + "line": 3, }, }, "range": Array [ - 31, - 37, + 112, + 113, ], "type": "Identifier", - "value": "string", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 37, + "line": 3, }, "start": Object { - "column": 26, - "line": 2, + "column": 36, + "line": 3, }, }, "range": Array [ - 38, - 39, + 124, + 125, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 41, "line": 3, }, "start": Object { - "column": 4, + "column": 38, "line": 3, }, }, "range": Array [ - 44, - 50, + 126, + 129, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 43, "line": 3, }, "start": Object { - "column": 11, + "column": 42, "line": 3, }, }, "range": Array [ - 51, - 55, + 130, + 131, ], - "type": "Keyword", - "value": "this", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 44, "line": 3, }, "start": Object { - "column": 16, + "column": 43, "line": 3, }, }, "range": Array [ - 56, - 66, + 131, + 132, ], - "type": "Keyword", - "value": "instanceof", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 45, "line": 3, }, "start": Object { - "column": 27, + "column": 44, "line": 3, }, }, "range": Array [ - 67, - 70, + 132, + 133, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 47, "line": 3, }, "start": Object { - "column": 30, + "column": 46, "line": 3, }, }, "range": Array [ - 70, - 71, + 134, + 135, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 49, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 48, + "line": 3, }, }, "range": Array [ - 74, - 75, + 136, + 137, ], "type": "Punctuator", "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-parameters-comments-heritage.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 74, + "line": 1, }, "start": Object { - "column": 2, - "line": 5, + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 74, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 43, + 46, + ], + "type": "Identifier", + }, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 47, + 71, + ], + "type": "TSTypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "range": Array [ + 22, + 23, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 10, + 34, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "range": Array [ + 162, + 164, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, }, + "name": "foo2", + "range": Array [ + 81, + 85, + ], + "type": "Identifier", }, - "range": Array [ - 78, - 83, - ], - "type": "Identifier", - "value": "isBaz", - }, - Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 89, + "line": 2, }, "start": Object { - "column": 8, - "line": 5, + "column": 0, + "line": 2, }, }, "range": Array [ - 84, - 85, + 75, + 164, ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 5, + "superClass": Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, }, + "name": "bar", + "range": Array [ + 133, + 136, + ], + "type": "Identifier", }, - "range": Array [ - 86, - 87, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 5, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 86, + "line": 2, + }, + "start": Object { + "column": 62, + "line": 2, + }, }, - "start": Object { - "column": 11, - "line": 5, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "name": "A", + "range": Array [ + 149, + 150, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 137, + 161, + ], + "type": "TSTypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, }, + "params": Array [ + Object { + "default": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 112, + 113, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "TSLiteralType", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "A", + "range": Array [ + 98, + 99, + ], + "type": "Identifier", + }, + "range": Array [ + 98, + 113, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 86, + 124, + ], + "type": "TSTypeParameterDeclaration", }, - "range": Array [ - 87, - 88, - ], - "type": "Punctuator", - "value": ")", }, Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 5, - }, - "start": Object { - "column": 12, - "line": 5, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 79, + "line": 3, + }, + "start": Object { + "column": 77, + "line": 3, + }, }, + "range": Array [ + 242, + 244, + ], + "type": "TSInterfaceBody", }, - "range": Array [ - 88, - 89, + "extends": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 3, + }, + }, + "name": "bar2", + "range": Array [ + 212, + 216, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 76, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 3, + }, + }, + "range": Array [ + 212, + 241, + ], + "type": "TSInterfaceHeritage", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 3, + }, + "start": Object { + "column": 52, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 3, + }, + "start": Object { + "column": 64, + "line": 3, + }, + }, + "range": Array [ + 229, + 230, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 3, + }, + "start": Object { + "column": 64, + "line": 3, + }, + }, + "name": "A", + "range": Array [ + 229, + 230, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 217, + 241, + ], + "type": "TSTypeParameterInstantiation", + }, + }, ], - "type": "Punctuator", - "value": ":", - }, - Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 175, + 178, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 79, + "line": 3, }, "start": Object { - "column": 14, - "line": 5, + "column": 0, + "line": 3, }, }, "range": Array [ - 90, - 94, + 165, + 244, ], - "type": "Keyword", - "value": "this", + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "A", + "range": Array [ + 191, + 192, + ], + "type": "Identifier", + }, + "range": Array [ + 191, + 192, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 179, + 203, + ], + "type": "TSTypeParameterDeclaration", + }, }, Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 5, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 93, + "line": 4, + }, + "start": Object { + "column": 91, + "line": 4, + }, }, - "start": Object { - "column": 19, - "line": 5, + "range": Array [ + 336, + 338, + ], + "type": "TSInterfaceBody", + }, + "extends": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 4, + }, + "start": Object { + "column": 62, + "line": 4, + }, + }, + "name": "bar", + "range": Array [ + 307, + 310, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 90, + "line": 4, + }, + "start": Object { + "column": 62, + "line": 4, + }, + }, + "range": Array [ + 307, + 335, + ], + "type": "TSInterfaceHeritage", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 90, + "line": 4, + }, + "start": Object { + "column": 66, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 4, + }, + "start": Object { + "column": 78, + "line": 4, + }, + }, + "range": Array [ + 323, + 324, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 4, + }, + "start": Object { + "column": 78, + "line": 4, + }, + }, + "name": "A", + "range": Array [ + 323, + 324, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 311, + 335, + ], + "type": "TSTypeParameterInstantiation", + }, }, - }, - "range": Array [ - 95, - 97, ], - "type": "Identifier", - "value": "is", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, }, + "name": "bar2", + "range": Array [ + 255, + 259, + ], + "type": "Identifier", }, - "range": Array [ - 98, - 104, - ], - "type": "Identifier", - "value": "string", - }, - Object { "loc": Object { "end": Object { - "column": 31, - "line": 5, + "column": 93, + "line": 4, }, "start": Object { - "column": 29, - "line": 5, + "column": 0, + "line": 4, }, }, "range": Array [ - 105, - 107, + 245, + 338, ], - "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 5, - }, - "start": Object { - "column": 32, - "line": 5, + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, }, + "params": Array [ + Object { + "default": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 286, + 287, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 286, + 287, + ], + "type": "TSLiteralType", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "name": "A", + "range": Array [ + 272, + 273, + ], + "type": "Identifier", + }, + "range": Array [ + 272, + 287, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 260, + 298, + ], + "type": "TSTypeParameterDeclaration", }, - "range": Array [ - 108, - 109, - ], - "type": "Punctuator", - "value": "{", }, + ], + "comments": Array [ Object { "loc": Object { "end": Object { - "column": 10, - "line": 6, + "column": 21, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 12, + "line": 1, }, }, "range": Array [ - 114, - 120, + 12, + 21, ], - "type": "Keyword", - "value": "return", + "type": "Block", + "value": " aaa ", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 6, + "column": 33, + "line": 1, }, "start": Object { - "column": 11, - "line": 6, + "column": 24, + "line": 1, }, }, "range": Array [ - 121, - 125, + 24, + 33, ], - "type": "Keyword", - "value": "this", + "type": "Block", + "value": " bbb ", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 6, + "column": 58, + "line": 1, }, "start": Object { - "column": 16, - "line": 6, + "column": 49, + "line": 1, }, }, "range": Array [ - 126, - 136, + 49, + 58, ], - "type": "Keyword", - "value": "instanceof", + "type": "Block", + "value": " aaa ", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 6, + "column": 70, + "line": 1, }, "start": Object { - "column": 27, - "line": 6, + "column": 61, + "line": 1, }, }, "range": Array [ - 137, - 140, + 61, + 70, ], - "type": "Identifier", - "value": "Foo", + "type": "Block", + "value": " bbb ", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 6, + "column": 22, + "line": 2, }, "start": Object { - "column": 30, - "line": 6, + "column": 13, + "line": 2, }, }, "range": Array [ - 140, - 141, + 88, + 97, ], - "type": "Punctuator", - "value": ";", + "type": "Block", + "value": " aaa ", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 7, + "column": 34, + "line": 2, }, "start": Object { - "column": 2, - "line": 7, + "column": 25, + "line": 2, }, }, "range": Array [ - 144, - 145, + 100, + 109, ], - "type": "Punctuator", - "value": "}", + "type": "Block", + "value": " bbb ", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 8, + "column": 48, + "line": 2, }, "start": Object { - "column": 0, - "line": 8, + "column": 39, + "line": 2, }, }, "range": Array [ - 146, - 147, + 114, + 123, ], - "type": "Punctuator", - "value": "}", + "type": "Block", + "value": " bbb ", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-parameters-comments.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 0, - 3, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 42, - ], - "type": "CallExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 3, - 40, - ], - "type": "TSTypeParameterInstantiation", - }, - }, "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 73, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 64, + "line": 2, }, }, "range": Array [ - 0, - 43, + 139, + 148, ], - "type": "ExpressionStatement", + "type": "Block", + "value": " aaa ", }, Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 43, - "line": 2, - }, - "start": Object { - "column": 40, - "line": 2, - }, - }, - "range": Array [ - 84, - 87, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 53, - 56, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 43, + "column": 85, "line": 2, }, "start": Object { - "column": 0, + "column": 76, "line": 2, }, }, - "params": Array [], "range": Array [ - 44, - 87, - ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": "A", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - }, - "range": Array [ - 68, - 69, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 56, - 81, - ], - "type": "TSTypeParameterDeclaration", - }, + 151, + 160, + ], + "type": "Block", + "value": " bbb ", }, Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 46, - "line": 3, - }, + "loc": Object { + "end": Object { + "column": 25, + "line": 3, }, - "range": Array [ - 134, - 137, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, + "start": Object { + "column": 16, + "line": 3, }, - "name": "baz", - "range": Array [ - 97, - 100, - ], - "type": "Identifier", }, + "range": Array [ + 181, + 190, + ], + "type": "Block", + "value": " aaa ", + }, + Object { "loc": Object { "end": Object { - "column": 49, + "column": 37, "line": 3, }, "start": Object { - "column": 0, + "column": 28, "line": 3, }, }, - "params": Array [], "range": Array [ - 88, - 137, + 193, + 202, ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 3, + }, + "start": Object { + "column": 54, + "line": 3, }, - "params": Array [ - Object { - "default": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 3, - }, - "start": Object { - "column": 38, - "line": 3, - }, - }, - "range": Array [ - 126, - 129, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 3, - }, - "start": Object { - "column": 38, - "line": 3, - }, - }, - "name": "Foo", - "range": Array [ - 126, - 129, - ], - "type": "Identifier", - }, - }, - "loc": Object { - "end": Object { - "column": 41, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "name": "A", - "range": Array [ - 112, - 113, - ], - "type": "Identifier", - }, - "range": Array [ - 112, - 129, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 100, - 131, - ], - "type": "TSTypeParameterDeclaration", }, + "range": Array [ + 219, + 228, + ], + "type": "Block", + "value": " aaa ", }, - ], - "comments": Array [ Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 75, + "line": 3, }, "start": Object { - "column": 5, - "line": 1, + "column": 66, + "line": 3, }, }, "range": Array [ - 5, - 20, + 231, + 240, ], "type": "Block", - "value": " comment 1 ", + "value": " bbb ", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 26, + "line": 4, }, "start": Object { - "column": 23, - "line": 1, + "column": 17, + "line": 4, }, }, "range": Array [ - 23, - 38, + 262, + 271, ], "type": "Block", - "value": " comment 2 ", + "value": " aaa ", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 38, + "line": 4, }, "start": Object { - "column": 14, - "line": 2, + "column": 29, + "line": 4, }, }, "range": Array [ - 58, - 67, + 274, + 283, ], "type": "Block", - "value": " aaa ", + "value": " bbb ", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 2, + "column": 52, + "line": 4, }, "start": Object { - "column": 26, - "line": 2, + "column": 43, + "line": 4, }, }, "range": Array [ - 70, - 79, + 288, + 297, ], "type": "Block", "value": " bbb ", @@ -66402,17 +69006,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 77, + "line": 4, }, "start": Object { - "column": 14, - "line": 3, + "column": 68, + "line": 4, }, }, "range": Array [ - 102, - 111, + 313, + 322, ], "type": "Block", "value": " aaa ", @@ -66420,17 +69024,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, - "line": 3, + "column": 89, + "line": 4, }, "start": Object { - "column": 26, - "line": 3, + "column": 80, + "line": 4, }, }, "range": Array [ - 114, - 123, + 325, + 334, ], "type": "Block", "value": " bbb ", @@ -66439,7 +69043,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 5, }, "start": Object { "column": 0, @@ -66448,14 +69052,14 @@ Object { }, "range": Array [ 0, - 138, + 339, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -66465,7 +69069,25 @@ Object { }, "range": Array [ 0, - 3, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, ], "type": "Identifier", "value": "foo", @@ -66473,17 +69095,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, + "column": 11, "line": 1, }, "start": Object { - "column": 3, + "column": 10, "line": 1, }, }, "range": Array [ - 3, - 4, + 10, + 11, ], "type": "Punctuator", "value": "<", @@ -66491,17 +69113,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 23, "line": 1, }, "start": Object { - "column": 21, + "column": 22, "line": 1, }, }, "range": Array [ - 21, 22, + 23, ], "type": "Identifier", "value": "A", @@ -66509,17 +69131,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 40, + "column": 34, "line": 1, }, "start": Object { - "column": 39, + "column": 33, "line": 1, }, }, "range": Array [ - 39, - 40, + 33, + 34, ], "type": "Punctuator", "value": ">", @@ -66527,61 +69149,133 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 42, "line": 1, }, "start": Object { - "column": 40, + "column": 35, "line": 1, }, }, "range": Array [ - 40, - 41, + 35, + 42, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 60, "line": 1, }, "start": Object { - "column": 41, + "column": 59, "line": 1, }, }, "range": Array [ - 41, - 42, + 59, + 60, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, + }, + }, + "range": Array [ + 70, + 71, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 73, "line": 1, }, "start": Object { - "column": 42, + "column": 72, "line": 1, }, }, "range": Array [ - 42, - 43, + 72, + 73, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 74, + "line": 1, + }, + "start": Object { + "column": 73, + "line": 1, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, "line": 2, }, "start": Object { @@ -66590,44 +69284,44 @@ Object { }, }, "range": Array [ - 44, - 52, + 75, + 80, ], "type": "Keyword", - "value": "function", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 10, "line": 2, }, "start": Object { - "column": 9, + "column": 6, "line": 2, }, }, "range": Array [ - 53, - 56, + 81, + 85, ], "type": "Identifier", - "value": "bar", + "value": "foo2", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 2, }, "start": Object { - "column": 12, + "column": 11, "line": 2, }, }, "range": Array [ - 56, - 57, + 86, + 87, ], "type": "Punctuator", "value": "<", @@ -66635,89 +69329,179 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "range": Array [ + 125, + 132, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, "line": 2, }, "start": Object { - "column": 24, + "column": 58, "line": 2, }, }, "range": Array [ - 68, - 69, + 133, + 136, ], "type": "Identifier", - "value": "A", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 63, "line": 2, }, "start": Object { - "column": 36, + "column": 62, "line": 2, }, }, "range": Array [ - 80, - 81, + 137, + 138, ], "type": "Punctuator", - "value": ">", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 75, "line": 2, }, "start": Object { - "column": 37, + "column": 74, "line": 2, }, }, "range": Array [ - 81, - 82, + 149, + 150, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 86, "line": 2, }, "start": Object { - "column": 38, + "column": 85, "line": 2, }, }, "range": Array [ - 82, - 83, + 160, + 161, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 88, "line": 2, }, "start": Object { - "column": 40, + "column": 87, "line": 2, }, }, "range": Array [ - 84, - 85, + 162, + 163, ], "type": "Punctuator", "value": "{", @@ -66725,17 +69509,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, + "column": 89, "line": 2, }, "start": Object { - "column": 42, + "column": 88, "line": 2, }, }, "range": Array [ - 86, - 87, + 163, + 164, ], "type": "Punctuator", "value": "}", @@ -66743,7 +69527,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 3, }, "start": Object { @@ -66752,44 +69536,44 @@ Object { }, }, "range": Array [ - 88, - 96, + 165, + 174, ], "type": "Keyword", - "value": "function", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 3, }, "start": Object { - "column": 9, + "column": 10, "line": 3, }, }, "range": Array [ - 97, - 100, + 175, + 178, ], "type": "Identifier", - "value": "baz", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 3, }, "start": Object { - "column": 12, + "column": 14, "line": 3, }, }, "range": Array [ - 100, - 101, + 179, + 180, ], "type": "Punctuator", "value": "<", @@ -66797,17 +69581,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 27, "line": 3, }, "start": Object { - "column": 24, + "column": 26, "line": 3, }, }, "range": Array [ - 112, - 113, + 191, + 192, ], "type": "Identifier", "value": "A", @@ -66815,107 +69599,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, + "column": 38, "line": 3, }, "start": Object { - "column": 36, + "column": 37, "line": 3, }, }, "range": Array [ - 124, - 125, + 202, + 203, ], "type": "Punctuator", - "value": "=", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 46, "line": 3, }, "start": Object { - "column": 38, + "column": 39, "line": 3, }, }, "range": Array [ - 126, - 129, + 204, + 211, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 3, + }, + }, + "range": Array [ + 212, + 216, ], "type": "Identifier", - "value": "Foo", + "value": "bar2", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 53, "line": 3, }, "start": Object { - "column": 42, + "column": 52, "line": 3, }, }, "range": Array [ - 130, - 131, + 217, + 218, ], "type": "Punctuator", - "value": ">", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 65, "line": 3, }, "start": Object { - "column": 43, + "column": 64, "line": 3, }, }, "range": Array [ - 131, - 132, + 229, + 230, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 76, "line": 3, }, "start": Object { - "column": 44, + "column": 75, "line": 3, }, }, "range": Array [ - 132, - 133, + 240, + 241, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 47, + "column": 78, "line": 3, }, "start": Object { - "column": 46, + "column": 77, "line": 3, }, }, "range": Array [ - 134, - 135, + 242, + 243, ], "type": "Punctuator", "value": "{", @@ -66923,1186 +69725,834 @@ Object { Object { "loc": Object { "end": Object { - "column": 49, + "column": 79, "line": 3, }, "start": Object { - "column": 48, + "column": 78, "line": 3, }, }, "range": Array [ - 136, - 137, + 243, + 244, ], "type": "Punctuator", "value": "}", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-parameters-comments-heritage.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 74, - "line": 1, - }, - "start": Object { - "column": 72, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, }, - "range": Array [ - 72, - 74, - ], - "type": "ClassBody", }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 245, + 254, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, }, - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, + "range": Array [ + 255, + 259, + ], + "type": "Identifier", + "value": "bar2", + }, + Object { "loc": Object { "end": Object { - "column": 74, - "line": 1, + "column": 16, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 15, + "line": 4, }, }, "range": Array [ - 0, - 74, + 260, + 261, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 43, - "line": 1, - }, + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, }, - "name": "bar", - "range": Array [ - 43, - 46, - ], - "type": "Identifier", }, - "superTypeParameters": Object { - "loc": Object { - "end": Object { - "column": 71, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, + "range": Array [ + 272, + 273, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 60, - "line": 1, - }, - "start": Object { - "column": 59, - "line": 1, - }, - }, - "range": Array [ - 59, - 60, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 60, - "line": 1, - }, - "start": Object { - "column": 59, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 59, - 60, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 47, - 71, - ], - "type": "TSTypeParameterInstantiation", }, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "range": Array [ + 284, + 285, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, - "range": Array [ - 22, - 23, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 10, - 34, - ], - "type": "TSTypeParameterDeclaration", }, + "range": Array [ + 286, + 287, + ], + "type": "Numeric", + "value": "2", }, Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 89, - "line": 2, - }, - "start": Object { - "column": 87, - "line": 2, - }, + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 52, + "line": 4, }, - "range": Array [ - 162, - 164, - ], - "type": "ClassBody", }, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, + "range": Array [ + 297, + 298, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 4, + }, + "start": Object { + "column": 54, + "line": 4, + }, + }, + "range": Array [ + 299, + 306, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 4, + }, + "start": Object { + "column": 62, + "line": 4, }, - "name": "foo2", - "range": Array [ - 81, - 85, - ], - "type": "Identifier", }, + "range": Array [ + 307, + 310, + ], + "type": "Identifier", + "value": "bar", + }, + Object { "loc": Object { "end": Object { - "column": 89, - "line": 2, + "column": 67, + "line": 4, }, "start": Object { - "column": 0, - "line": 2, + "column": 66, + "line": 4, }, }, "range": Array [ - 75, - 164, + 311, + 312, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 61, - "line": 2, - }, - "start": Object { - "column": 58, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 133, - 136, - ], - "type": "Identifier", - }, - "superTypeParameters": Object { - "loc": Object { - "end": Object { - "column": 86, - "line": 2, - }, - "start": Object { - "column": 62, - "line": 2, - }, + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 4, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 75, - "line": 2, - }, - "start": Object { - "column": 74, - "line": 2, - }, - }, - "range": Array [ - 149, - 150, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 75, - "line": 2, - }, - "start": Object { - "column": 74, - "line": 2, - }, - }, - "name": "A", - "range": Array [ - 149, - 150, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 137, - 161, - ], - "type": "TSTypeParameterInstantiation", - }, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, + "start": Object { + "column": 78, + "line": 4, }, - "params": Array [ - Object { - "default": Object { - "literal": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 37, - "line": 2, - }, - }, - "range": Array [ - 112, - 113, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 37, - "line": 2, - }, - }, - "range": Array [ - 112, - 113, - ], - "type": "TSLiteralType", - }, - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "A", - "range": Array [ - 98, - 99, - ], - "type": "Identifier", - }, - "range": Array [ - 98, - 113, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 86, - 124, - ], - "type": "TSTypeParameterDeclaration", }, + "range": Array [ + 323, + 324, + ], + "type": "Identifier", + "value": "A", }, Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 79, - "line": 3, - }, - "start": Object { - "column": 77, - "line": 3, - }, + "loc": Object { + "end": Object { + "column": 90, + "line": 4, }, - "range": Array [ - 242, - 244, - ], - "type": "TSInterfaceBody", - }, - "extends": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 51, - "line": 3, - }, - "start": Object { - "column": 47, - "line": 3, - }, - }, - "name": "bar2", - "range": Array [ - 212, - 216, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 76, - "line": 3, - }, - "start": Object { - "column": 47, - "line": 3, - }, - }, - "range": Array [ - 212, - 241, - ], - "type": "TSInterfaceHeritage", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 76, - "line": 3, - }, - "start": Object { - "column": 52, - "line": 3, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 65, - "line": 3, - }, - "start": Object { - "column": 64, - "line": 3, - }, - }, - "range": Array [ - 229, - 230, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 65, - "line": 3, - }, - "start": Object { - "column": 64, - "line": 3, - }, - }, - "name": "A", - "range": Array [ - 229, - 230, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 217, - 241, - ], - "type": "TSTypeParameterInstantiation", - }, + "start": Object { + "column": 89, + "line": 4, }, + }, + "range": Array [ + 334, + 335, ], - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 92, + "line": 4, + }, + "start": Object { + "column": 91, + "line": 4, }, - "name": "bar", - "range": Array [ - 175, - 178, - ], - "type": "Identifier", }, + "range": Array [ + 336, + 337, + ], + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { - "column": 79, - "line": 3, + "column": 93, + "line": 4, }, "start": Object { - "column": 0, - "line": 3, + "column": 92, + "line": 4, }, }, "range": Array [ - 165, - 244, + 337, + 338, ], - "type": "TSInterfaceDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "params": Array [ + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-reference-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 10, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 2, + "line": 2, }, }, - "name": "A", + "name": "mBuffers", "range": Array [ - 191, - 192, + 26, + 34, ], "type": "Identifier", }, - "range": Array [ - 191, - 192, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 179, - 203, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 93, - "line": 4, - }, - "start": Object { - "column": 91, - "line": 4, - }, - }, - "range": Array [ - 336, - 338, - ], - "type": "TSInterfaceBody", - }, - "extends": Array [ - Object { - "expression": Object { "loc": Object { "end": Object { - "column": 65, - "line": 4, + "column": 51, + "line": 2, }, "start": Object { - "column": 62, - "line": 4, + "column": 2, + "line": 2, }, }, - "name": "bar", "range": Array [ - 307, - 310, + 26, + 75, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 90, - "line": 4, - }, - "start": Object { - "column": 62, - "line": 4, - }, - }, - "range": Array [ - 307, - 335, - ], - "type": "TSInterfaceHeritage", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 90, - "line": 4, - }, - "start": Object { - "column": 66, - "line": 4, + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, }, - }, - "params": Array [ - Object { + "range": Array [ + 34, + 74, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 79, - "line": 4, + "column": 50, + "line": 2, }, "start": Object { - "column": 78, - "line": 4, + "column": 12, + "line": 2, }, }, "range": Array [ - 323, - 324, + 36, + 74, ], "type": "TSTypeReference", "typeName": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "interop", + "range": Array [ + 36, + 43, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 79, - "line": 4, + "column": 29, + "line": 2, }, "start": Object { - "column": 78, - "line": 4, + "column": 12, + "line": 2, }, }, - "name": "A", "range": Array [ - 323, - 324, + 36, + 53, ], - "type": "Identifier", + "right": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "Reference", + "range": Array [ + 44, + 53, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "TSAnyKeyword", + }, + ], + "range": Array [ + 53, + 74, + ], + "type": "TSTypeParameterInstantiation", }, }, - ], - "range": Array [ - 311, - 335, - ], - "type": "TSTypeParameterInstantiation", + }, + "value": null, }, - }, - ], - "id": Object { + ], "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 1, + "line": 3, }, "start": Object { - "column": 10, - "line": 4, + "column": 22, + "line": 1, }, }, - "name": "bar2", "range": Array [ - 255, - 259, + 22, + 77, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 93, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, + "type": "ClassBody", }, - "range": Array [ - 245, - 338, - ], - "type": "TSInterfaceDeclaration", - "typeParameters": Object { + "id": Object { "loc": Object { "end": Object { - "column": 53, - "line": 4, + "column": 21, + "line": 1, }, "start": Object { - "column": 15, - "line": 4, + "column": 6, + "line": 1, }, }, - "params": Array [ - Object { - "default": Object { - "literal": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 4, - }, - "start": Object { - "column": 41, - "line": 4, - }, - }, - "range": Array [ - 286, - 287, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "loc": Object { - "end": Object { - "column": 42, - "line": 4, - }, - "start": Object { - "column": 41, - "line": 4, - }, - }, - "range": Array [ - 286, - 287, - ], - "type": "TSLiteralType", - }, - "loc": Object { - "end": Object { - "column": 42, - "line": 4, - }, - "start": Object { - "column": 27, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 4, - }, - "start": Object { - "column": 27, - "line": 4, - }, - }, - "name": "A", - "range": Array [ - 272, - 273, - ], - "type": "Identifier", - }, - "range": Array [ - 272, - 287, - ], - "type": "TSTypeParameter", - }, - ], + "name": "AudioBufferList", "range": Array [ - 260, - 298, + 6, + 21, ], - "type": "TSTypeParameterDeclaration", + "type": "Identifier", }, - }, - ], - "comments": Array [ - Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, + "column": 0, "line": 1, }, }, "range": Array [ - 12, - 21, + 0, + 77, ], - "type": "Block", - "value": " aaa ", + "superClass": null, + "type": "ClassDeclaration", }, + ], + "comments": Array [ Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 49, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 34, + "line": 2, }, }, "range": Array [ - 24, - 33, + 58, + 73, ], "type": "Block", - "value": " bbb ", + "value": "AudioBuffer", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 78, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 58, + "column": 5, "line": 1, }, "start": Object { - "column": 49, + "column": 0, "line": 1, }, }, "range": Array [ - 49, - 58, + 0, + 5, ], - "type": "Block", - "value": " aaa ", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 70, + "column": 21, "line": 1, }, "start": Object { - "column": 61, + "column": 6, "line": 1, }, }, "range": Array [ - 61, - 70, + 6, + 21, ], - "type": "Block", - "value": " bbb ", + "type": "Identifier", + "value": "AudioBufferList", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 88, - 97, + 22, + 23, ], - "type": "Block", - "value": " aaa ", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 10, "line": 2, }, "start": Object { - "column": 25, + "column": 2, "line": 2, }, }, "range": Array [ - 100, - 109, + 26, + 34, ], - "type": "Block", - "value": " bbb ", + "type": "Identifier", + "value": "mBuffers", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 11, "line": 2, }, "start": Object { - "column": 39, + "column": 10, "line": 2, }, }, "range": Array [ - 114, - 123, + 34, + 35, ], - "type": "Block", - "value": " bbb ", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 73, + "column": 19, "line": 2, }, "start": Object { - "column": 64, + "column": 12, "line": 2, }, }, "range": Array [ - 139, - 148, + 36, + 43, ], - "type": "Block", - "value": " aaa ", + "type": "Identifier", + "value": "interop", }, Object { "loc": Object { "end": Object { - "column": 85, + "column": 20, "line": 2, }, "start": Object { - "column": 76, + "column": 19, "line": 2, }, }, "range": Array [ - 151, - 160, - ], - "type": "Block", - "value": " bbb ", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "range": Array [ - 181, - 190, + 43, + 44, ], - "type": "Block", - "value": " aaa ", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 29, + "line": 2, }, "start": Object { - "column": 28, - "line": 3, + "column": 20, + "line": 2, }, }, "range": Array [ - 193, - 202, + 44, + 53, ], - "type": "Block", - "value": " bbb ", + "type": "Identifier", + "value": "Reference", }, Object { "loc": Object { "end": Object { - "column": 63, - "line": 3, + "column": 30, + "line": 2, }, "start": Object { - "column": 54, - "line": 3, + "column": 29, + "line": 2, }, }, "range": Array [ - 219, - 228, + 53, + 54, ], - "type": "Block", - "value": " aaa ", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 75, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 66, - "line": 3, + "column": 30, + "line": 2, }, }, "range": Array [ - 231, - 240, + 54, + 57, ], - "type": "Block", - "value": " bbb ", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 50, + "line": 2, }, "start": Object { - "column": 17, - "line": 4, + "column": 49, + "line": 2, }, }, "range": Array [ - 262, - 271, + 73, + 74, ], - "type": "Block", - "value": " aaa ", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 4, + "column": 51, + "line": 2, }, "start": Object { - "column": 29, - "line": 4, + "column": 50, + "line": 2, }, }, "range": Array [ - 274, - 283, + 74, + 75, ], - "type": "Block", - "value": " bbb ", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 52, - "line": 4, + "column": 1, + "line": 3, }, "start": Object { - "column": 43, - "line": 4, + "column": 0, + "line": 3, }, }, "range": Array [ - 288, - 297, + 76, + 77, ], - "type": "Block", - "value": " bbb ", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-bigint.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 4, - }, - "start": Object { - "column": 68, - "line": 4, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", }, - "range": Array [ - 313, - 322, - ], - "type": "Block", - "value": " aaa ", - }, - Object { "loc": Object { "end": Object { - "column": 89, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 80, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 325, - 334, + 0, + 17, ], - "type": "Block", - "value": " bbb ", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSBigIntKeyword", + }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 2, }, "start": Object { "column": 0, @@ -68111,14 +70561,14 @@ Object { }, "range": Array [ 0, - 339, + 18, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 4, "line": 1, }, "start": Object { @@ -68128,1140 +70578,1484 @@ Object { }, "range": Array [ 0, - 5, + 4, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, "range": Array [ - 6, - 9, + 5, + 8, ], "type": "Identifier", - "value": "foo", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ + 9, 10, - 11, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 17, "line": 1, }, "start": Object { - "column": 22, + "column": 11, "line": 1, }, }, "range": Array [ - 22, - 23, + 11, + 17, ], "type": "Identifier", - "value": "A", + "value": "bigint", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-boolean.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 34, + "column": 18, "line": 1, }, "start": Object { - "column": 33, + "column": 0, "line": 1, }, }, "range": Array [ - 33, - 34, + 0, + 18, ], - "type": "Punctuator", - "value": ">", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "TSBooleanKeyword", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 42, + "column": 4, "line": 1, }, "start": Object { - "column": 35, + "column": 0, "line": 1, }, }, "range": Array [ - 35, - 42, + 0, + 4, ], - "type": "Keyword", - "value": "extends", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 8, "line": 1, }, "start": Object { - "column": 43, + "column": 5, "line": 1, }, }, "range": Array [ - 43, - 46, + 5, + 8, ], "type": "Identifier", - "value": "bar", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 10, "line": 1, }, "start": Object { - "column": 47, + "column": 9, "line": 1, }, }, "range": Array [ - 47, - 48, + 9, + 10, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 60, + "column": 18, "line": 1, }, "start": Object { - "column": 59, + "column": 11, "line": 1, }, }, "range": Array [ - 59, - 60, + 11, + 18, ], "type": "Identifier", - "value": "A", + "value": "boolean", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-false.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 71, + "column": 16, "line": 1, }, "start": Object { - "column": 70, + "column": 0, "line": 1, }, }, "range": Array [ - 70, - 71, + 0, + 16, ], - "type": "Punctuator", - "value": ">", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSLiteralType", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 73, + "column": 4, "line": 1, }, "start": Object { - "column": 72, + "column": 0, "line": 1, }, }, "range": Array [ - 72, - 73, + 0, + 4, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 74, + "column": 8, "line": 1, }, "start": Object { - "column": 73, + "column": 5, "line": 1, }, }, "range": Array [ - 73, - 74, + 5, + 8, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 75, - 80, + 9, + 10, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 6, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 81, - 85, + 11, + 16, ], - "type": "Identifier", - "value": "foo2", + "type": "Boolean", + "value": "false", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-never.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 86, - 87, + 0, + 16, ], - "type": "Punctuator", - "value": "<", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSNeverKeyword", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 4, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 98, - 99, + 0, + 4, ], "type": "Identifier", - "value": "A", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 35, - "line": 2, + "column": 5, + "line": 1, }, }, "range": Array [ - 110, - 111, + 5, + 8, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 37, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 112, - 113, + 9, + 10, ], - "type": "Numeric", - "value": "2", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 49, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 48, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 123, - 124, + 11, + 16, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "never", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-null.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 50, - "line": 2, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", }, - "range": Array [ - 125, - 132, - ], - "type": "Keyword", - "value": "extends", - }, - Object { "loc": Object { "end": Object { - "column": 61, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 58, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 133, - 136, + 0, + 15, ], - "type": "Identifier", - "value": "bar", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "TSNullKeyword", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 63, - "line": 2, + "column": 4, + "line": 1, }, "start": Object { - "column": 62, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 137, - 138, + 0, + 4, ], - "type": "Punctuator", - "value": "<", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 75, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 74, - "line": 2, + "column": 5, + "line": 1, }, }, "range": Array [ - 149, - 150, + 5, + 8, ], "type": "Identifier", - "value": "A", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 86, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 85, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 160, - 161, + 9, + 10, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 88, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 87, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 162, - 163, + 11, + 15, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "null", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-number.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 89, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 88, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 163, - 164, + 0, + 17, ], - "type": "Punctuator", - "value": "}", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 4, + "line": 1, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 165, - 174, + 0, + 4, ], - "type": "Keyword", - "value": "interface", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 5, + "line": 1, }, }, "range": Array [ - 175, - 178, + 5, + 8, ], "type": "Identifier", - "value": "bar", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 10, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 9, + "line": 1, }, }, "range": Array [ - 179, - 180, + 9, + 10, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 26, - "line": 3, + "column": 11, + "line": 1, }, }, "range": Array [ - 191, - 192, + 11, + 17, ], "type": "Identifier", - "value": "A", + "value": "number", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-object.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 37, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 202, - 203, + 0, + 17, ], - "type": "Punctuator", - "value": ">", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSObjectKeyword", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 46, - "line": 3, + "column": 4, + "line": 1, }, "start": Object { - "column": 39, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 204, - 211, + 0, + 4, ], - "type": "Keyword", - "value": "extends", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 51, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 47, - "line": 3, + "column": 5, + "line": 1, }, }, "range": Array [ - 212, - 216, + 5, + 8, ], "type": "Identifier", - "value": "bar2", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 53, - "line": 3, + "column": 10, + "line": 1, }, "start": Object { - "column": 52, - "line": 3, + "column": 9, + "line": 1, }, }, "range": Array [ - 217, - 218, + 9, + 10, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 65, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 64, - "line": 3, + "column": 11, + "line": 1, }, }, "range": Array [ - 229, - 230, + 11, + 17, ], "type": "Identifier", - "value": "A", + "value": "object", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-string.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 76, - "line": 3, - }, - "start": Object { - "column": 75, - "line": 3, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", }, - "range": Array [ - 240, - 241, - ], - "type": "Punctuator", - "value": ">", - }, - Object { "loc": Object { "end": Object { - "column": 78, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 77, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 242, - 243, + 0, + 17, ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 79, - "line": 3, - }, - "start": Object { - "column": 78, - "line": 3, + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 243, - 244, - ], - "type": "Punctuator", - "value": "}", }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 4, + "line": 1, }, "start": Object { "column": 0, - "line": 4, + "line": 1, }, }, "range": Array [ - 245, - 254, + 0, + 4, ], - "type": "Keyword", - "value": "interface", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 8, + "line": 1, }, "start": Object { - "column": 10, - "line": 4, + "column": 5, + "line": 1, }, }, "range": Array [ - 255, - 259, + 5, + 8, ], "type": "Identifier", - "value": "bar2", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 10, + "line": 1, }, "start": Object { - "column": 15, - "line": 4, + "column": 9, + "line": 1, }, }, "range": Array [ - 260, - 261, + 9, + 10, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 27, - "line": 4, + "column": 11, + "line": 1, }, }, "range": Array [ - 272, - 273, + 11, + 17, ], "type": "Identifier", - "value": "A", + "value": "string", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-symbol.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 40, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 39, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 284, - 285, + 0, + 17, ], - "type": "Punctuator", - "value": "=", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSSymbolKeyword", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 42, - "line": 4, + "column": 4, + "line": 1, }, "start": Object { - "column": 41, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 286, - 287, + 0, + 4, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 53, - "line": 4, + "column": 8, + "line": 1, }, "start": Object { - "column": 52, - "line": 4, + "column": 5, + "line": 1, }, }, "range": Array [ - 297, - 298, + 5, + 8, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 61, - "line": 4, + "column": 10, + "line": 1, }, "start": Object { - "column": 54, - "line": 4, + "column": 9, + "line": 1, }, }, "range": Array [ - 299, - 306, + 9, + 10, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 65, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 62, - "line": 4, + "column": 11, + "line": 1, }, }, "range": Array [ - 307, - 310, + 11, + 17, ], "type": "Identifier", - "value": "bar", + "value": "symbol", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-true.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 67, - "line": 4, + "column": 15, + "line": 1, }, "start": Object { - "column": 66, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 311, - 312, + 0, + 15, ], - "type": "Punctuator", - "value": "<", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "TSLiteralType", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 79, - "line": 4, + "column": 4, + "line": 1, }, "start": Object { - "column": 78, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 323, - 324, + 0, + 4, ], "type": "Identifier", - "value": "A", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 90, - "line": 4, + "column": 8, + "line": 1, }, "start": Object { - "column": 89, - "line": 4, + "column": 5, + "line": 1, }, }, "range": Array [ - 334, - 335, + 5, + 8, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 92, - "line": 4, + "column": 10, + "line": 1, }, "start": Object { - "column": 91, - "line": 4, + "column": 9, + "line": 1, }, }, "range": Array [ - 336, - 337, + 9, + 10, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 93, - "line": 4, + "column": 15, + "line": 1, }, "start": Object { - "column": 92, - "line": 4, + "column": 11, + "line": 1, }, }, "range": Array [ - 337, - 338, + 11, + 15, ], - "type": "Punctuator", - "value": "}", + "type": "Boolean", + "value": "true", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-reference-comments.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "mBuffers", - "range": Array [ - 26, - 34, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 51, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 26, - 75, - ], - "static": false, - "type": "ClassProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 34, - 74, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 36, - 74, - ], - "type": "TSTypeReference", - "typeName": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "name": "interop", - "range": Array [ - 36, - 43, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 36, - 53, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "name": "Reference", - "range": Array [ - 44, - 53, - ], - "type": "Identifier", - }, - "type": "TSQualifiedName", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 54, - 57, - ], - "type": "TSAnyKeyword", - }, - ], - "range": Array [ - 53, - 74, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - }, - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 77, - ], - "type": "ClassBody", - }, +exports[`typescript fixtures/basics/typed-keyword-undefined.src 1`] = ` +Object { + "body": Array [ + Object { "id": Object { "loc": Object { "end": Object { - "column": 21, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, - "name": "AudioBufferList", + "name": "Foo", "range": Array [ - 6, - 21, + 5, + 8, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 20, + "line": 1, }, "start": Object { "column": 0, @@ -69270,36 +72064,33 @@ Object { }, "range": Array [ 0, - 77, + 20, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "comments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, }, + "range": Array [ + 11, + 20, + ], + "type": "TSUndefinedKeyword", }, - "range": Array [ - 58, - 73, - ], - "type": "Block", - "value": "AudioBuffer", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -69308,14 +72099,14 @@ Object { }, "range": Array [ 0, - 78, + 21, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 4, "line": 1, }, "start": Object { @@ -69325,233 +72116,371 @@ Object { }, "range": Array [ 0, - 5, + 4, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, "range": Array [ - 6, - 21, + 5, + 8, ], "type": "Identifier", - "value": "AudioBufferList", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 10, "line": 1, }, "start": Object { - "column": 22, + "column": 9, "line": 1, }, }, "range": Array [ - 22, - 23, + 9, + 10, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 26, - 34, + 11, + 20, ], "type": "Identifier", - "value": "mBuffers", + "value": "undefined", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-unknown.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "TSUnknownKeyword", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 4, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 34, - 35, + 0, + 4, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 5, + "line": 1, }, }, "range": Array [ - 36, - 43, + 5, + 8, ], "type": "Identifier", - "value": "interop", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 43, - 44, + 9, + 10, ], "type": "Punctuator", - "value": ".", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 44, - 53, + 11, + 18, ], "type": "Identifier", - "value": "Reference", + "value": "unknown", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-void.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 30, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 29, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 53, - 54, + 0, + 15, ], - "type": "Punctuator", - "value": "<", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "TSVoidKeyword", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 4, + "line": 1, }, "start": Object { - "column": 30, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 54, - 57, + 0, + 4, ], "type": "Identifier", - "value": "any", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 50, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 49, - "line": 2, + "column": 5, + "line": 1, }, }, "range": Array [ - 73, - 74, + 5, + 8, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 51, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 50, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 74, - 75, + 9, + 10, ], "type": "Punctuator", - "value": ";", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 11, + "line": 1, }, }, "range": Array [ - 76, - 77, + 11, + 15, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "void", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-bigint.src 1`] = ` +exports[`typescript fixtures/basics/typed-method-signature.src 1`] = ` Object { "body": Array [ Object { @@ -69575,8 +72504,8 @@ Object { }, "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -69585,25 +72514,365 @@ Object { }, "range": Array [ 0, - 17, + 57, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, + "column": 1, + "line": 4, + }, + "start": Object { + "column": 11, "line": 1, }, - "start": Object { - "column": 11, - "line": 1, + }, + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "h", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 17, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 15, + 36, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSMethodSignature", + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "g", + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 39, + 55, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + }, + }, + "type": "TSMethodSignature", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + }, + "range": Array [ + 41, + 42, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 40, + 43, + ], + "type": "TSTypeParameterDeclaration", + }, }, - }, + ], "range": Array [ 11, - 17, + 57, ], - "type": "TSBigIntKeyword", + "type": "TSTypeLiteral", }, }, ], @@ -69611,7 +72880,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 5, }, "start": Object { "column": 0, @@ -69620,7 +72889,7 @@ Object { }, "range": Array [ 0, - 18, + 58, ], "sourceType": "module", "tokens": Array [ @@ -69681,7 +72950,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 12, "line": 1, }, "start": Object { @@ -69691,811 +72960,739 @@ Object { }, "range": Array [ 11, - 17, + 12, ], - "type": "Identifier", - "value": "bigint", + "type": "Punctuator", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-boolean.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 0, - 18, + 15, + 16, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 18, - ], - "type": "TSBooleanKeyword", - }, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "h", }, - }, - "range": Array [ - 0, - 19, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { "column": 4, - "line": 1, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 3, + "line": 2, }, }, "range": Array [ - 0, - 4, + 16, + 17, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 5, - 8, + 17, + 20, ], "type": "Identifier", - "value": "Foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 9, - 10, + 20, + 21, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 11, - 18, + 22, + 28, ], "type": "Identifier", - "value": "boolean", + "value": "string", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-false.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { "column": 16, - "line": 1, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 0, - 16, + 28, + 29, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "literal": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 16, - ], - "raw": "false", - "type": "Literal", - "value": false, + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, + "start": Object { + "column": 16, + "line": 2, }, - "range": Array [ - 11, - 16, - ], - "type": "TSLiteralType", }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 17, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 0, - 4, + 31, + 35, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, }, }, "range": Array [ - 5, - 8, + 39, + 40, ], "type": "Identifier", - "value": "Foo", + "value": "g", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 4, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 3, + "line": 3, }, }, "range": Array [ - 9, - 10, + 40, + 41, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 11, - 16, + 41, + 42, ], - "type": "Boolean", - "value": "false", + "type": "Identifier", + "value": "T", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-never.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 6, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 5, + "line": 3, }, }, "range": Array [ - 0, - 16, + 42, + 43, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 16, - ], - "type": "TSNeverKeyword", - }, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ">", }, - }, - "range": Array [ - 0, - 17, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 6, + "line": 3, }, }, "range": Array [ - 0, - 4, + 43, + 44, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 5, - "line": 1, + "column": 7, + "line": 3, }, }, "range": Array [ - 5, - 8, + 44, + 47, ], "type": "Identifier", - "value": "Foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 9, - 10, + 47, + 48, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 12, + "line": 3, }, }, "range": Array [ - 11, - 16, + 49, + 50, ], "type": "Identifier", - "value": "never", + "value": "T", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-null.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ - 0, - 15, + 50, + 51, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "type": "TSNullKeyword", - }, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 16, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ - 0, - 4, + 51, + 52, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 17, + "line": 3, }, "start": Object { - "column": 5, - "line": 1, + "column": 16, + "line": 3, }, }, "range": Array [ - 5, - 8, + 53, + 54, ], "type": "Identifier", - "value": "Foo", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 17, + "line": 3, }, }, "range": Array [ - 9, - 10, + 54, + 55, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 11, - 15, + 56, + 57, ], - "type": "Keyword", - "value": "null", + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-number.src 1`] = ` +exports[`typescript fixtures/basics/typed-this.src 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "addClickListener", + "range": Array [ + 23, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 65, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "onclick", + "range": Array [ + 40, + 79, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 47, + 79, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "name": "this", + "range": Array [ + 50, + 60, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 56, + 60, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "name": "e", + "range": Array [ + 62, + 70, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 63, + 70, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "name": "Event", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 49, + 79, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "range": Array [ + 72, + 79, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + }, + }, + }, + ], + "range": Array [ + 23, + 87, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "range": Array [ + 80, + 86, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 60, + "line": 2, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSMethodSignature", }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 17, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 11, + "column": 20, "line": 1, }, }, "range": Array [ - 11, - 17, + 20, + 89, ], - "type": "TSNumberKeyword", - }, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 4, - ], - "type": "Identifier", - "value": "type", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, + "type": "TSInterfaceBody", }, - "range": Array [ - 11, - 17, - ], - "type": "Identifier", - "value": "number", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-object.src 1`] = ` -Object { - "body": Array [ - Object { "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 19, "line": 1, }, "start": Object { - "column": 5, + "column": 10, "line": 1, }, }, - "name": "Foo", + "name": "UIElement", "range": Array [ - 5, - 8, + 10, + 19, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -70504,33 +73701,16 @@ Object { }, "range": Array [ 0, - 17, + 89, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 17, - ], - "type": "TSObjectKeyword", - }, + "type": "TSInterfaceDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -70539,14 +73719,14 @@ Object { }, "range": Array [ 0, - 18, + 90, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 9, "line": 1, }, "start": Object { @@ -70556,697 +73736,420 @@ Object { }, "range": Array [ 0, - 4, + 9, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 19, "line": 1, }, "start": Object { - "column": 5, + "column": 10, "line": 1, }, }, "range": Array [ - 5, - 8, + 10, + 19, ], "type": "Identifier", - "value": "Foo", + "value": "UIElement", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 21, "line": 1, }, "start": Object { - "column": 9, + "column": 20, "line": 1, }, }, "range": Array [ - 9, - 10, + 20, + 21, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 17, - "line": 1, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 1, + "line": 2, }, }, "range": Array [ - 11, - 17, + 23, + 39, ], "type": "Identifier", - "value": "object", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-string.src 1`] = ` -Object { - "body": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 17, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 17, - ], - "type": "TSStringKeyword", - }, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "value": "addClickListener", }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 0, - 4, + 39, + 40, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 5, - 8, + 40, + 47, ], "type": "Identifier", - "value": "Foo", + "value": "onclick", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 26, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 25, + "line": 2, }, }, "range": Array [ - 9, - 10, + 47, + 48, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 28, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 27, + "line": 2, }, }, "range": Array [ - 11, - 17, + 49, + 50, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "(", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-symbol.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 32, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 0, - 17, + 50, + 54, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 17, - ], - "type": "TSSymbolKeyword", - }, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "this", }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 32, + "line": 2, }, }, "range": Array [ - 0, - 4, + 54, + 55, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 38, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 34, + "line": 2, }, }, "range": Array [ - 5, - 8, + 56, + 60, ], - "type": "Identifier", - "value": "Foo", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 39, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 38, + "line": 2, }, }, "range": Array [ - 9, - 10, + 60, + 61, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 41, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 40, + "line": 2, }, }, "range": Array [ - 11, - 17, + 62, + 63, ], "type": "Identifier", - "value": "symbol", + "value": "e", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-true.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 42, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 41, + "line": 2, }, }, "range": Array [ - 0, - 15, + 63, + 64, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "literal": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "type": "TSLiteralType", - }, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ":", }, - }, - "range": Array [ - 0, - 16, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 48, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 43, + "line": 2, }, }, "range": Array [ - 0, - 4, + 65, + 70, ], "type": "Identifier", - "value": "type", + "value": "Event", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 49, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 48, + "line": 2, }, }, "range": Array [ - 5, - 8, + 70, + 71, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 52, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 50, + "line": 2, }, }, "range": Array [ - 9, - 10, + 72, + 74, ], "type": "Punctuator", - "value": "=", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 57, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 53, + "line": 2, }, }, "range": Array [ - 11, - 15, + 75, + 79, ], - "type": "Boolean", - "value": "true", + "type": "Keyword", + "value": "void", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-undefined.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 58, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 57, + "line": 2, }, }, "range": Array [ - 0, - 20, + 79, + 80, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 20, - ], - "type": "TSUndefinedKeyword", - }, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 21, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 59, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 58, + "line": 2, }, }, "range": Array [ - 0, - 4, + 80, + 81, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 64, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 60, + "line": 2, }, }, "range": Array [ - 5, - 8, + 82, + 86, ], - "type": "Identifier", - "value": "Foo", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 65, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 64, + "line": 2, }, }, "range": Array [ - 9, - 10, + 86, + 87, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 11, - 20, + 88, + 89, ], - "type": "Identifier", - "value": "undefined", + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-unknown.src 1`] = ` +exports[`typescript fixtures/basics/unique-symbol.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -71254,16 +74157,16 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "A", "range": Array [ 5, - 8, + 6, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 1, }, "start": Object { @@ -71273,25 +74176,43 @@ Object { }, "range": Array [ 0, - 18, + 23, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 18, + "column": 22, "line": 1, }, "start": Object { - "column": 11, + "column": 9, "line": 1, }, }, + "operator": "unique", "range": Array [ - 11, - 18, + 9, + 22, ], - "type": "TSUnknownKeyword", + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSSymbolKeyword", + }, }, }, ], @@ -71308,7 +74229,7 @@ Object { }, "range": Array [ 0, - 19, + 24, ], "sourceType": "module", "tokens": Array [ @@ -71333,7 +74254,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -71343,25 +74264,25 @@ Object { }, "range": Array [ 5, - 8, + 6, ], "type": "Identifier", - "value": "Foo", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ - 9, - 10, + 7, + 8, ], "type": "Punctuator", "value": "=", @@ -71369,51 +74290,142 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 9, "line": 1, }, }, "range": Array [ - 11, - 18, + 9, + 15, ], "type": "Identifier", - "value": "unknown", + "value": "unique", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-void.src 1`] = ` +exports[`typescript fixtures/basics/unknown-type-annotation.src 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 16, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "TSUnknownKeyword", + }, + }, }, - "start": Object { - "column": 5, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { @@ -71423,26 +74435,9 @@ Object { }, "range": Array [ 0, - 15, + 17, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "type": "TSVoidKeyword", - }, + "type": "VariableDeclaration", }, ], "comments": Array [], @@ -71458,14 +74453,14 @@ Object { }, "range": Array [ 0, - 16, + 18, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 3, "line": 1, }, "start": Object { @@ -71475,10 +74470,28 @@ Object { }, "range": Array [ 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ 4, + 7, ], "type": "Identifier", - "value": "type", + "value": "foo", }, Object { "loc": Object { @@ -71487,21 +74500,21 @@ Object { "line": 1, }, "start": Object { - "column": 5, + "column": 7, "line": 1, }, }, "range": Array [ - 5, + 7, 8, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { @@ -71511,435 +74524,316 @@ Object { }, "range": Array [ 9, - 10, + 16, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "unknown", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 15, + 16, + 17, ], - "type": "Keyword", - "value": "void", + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-method-signature.src 1`] = ` +exports[`typescript fixtures/basics/var-with-definite-assignment.src 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 57, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "h", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, + "declarations": Array [ + Object { + "definite": true, + "id": Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 6, + "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 17, - 28, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 20, - 28, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], + "name": "x", "range": Array [ - 15, - 36, + 6, + 16, ], - "returnType": Object { + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 29, - 35, + 8, + 16, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 31, - 35, + 10, + 16, ], - "type": "TSVoidKeyword", + "type": "TSStringKeyword", }, }, - "type": "TSMethodSignature", }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "g", - "range": Array [ - 39, - 40, - ], - "type": "Identifier", + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 2, - "line": 3, + "column": 4, + "line": 2, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 44, - 50, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 47, - 50, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 49, - 50, - ], - "type": "Identifier", - }, - }, - }, - }, - ], + "name": "y", "range": Array [ - 39, - 55, + 22, + 32, ], - "returnType": Object { + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 14, - "line": 3, + "column": 6, + "line": 2, }, }, "range": Array [ - 51, - 54, + 24, + 32, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 16, - "line": 3, + "column": 8, + "line": 2, }, }, "range": Array [ - 53, - 54, + 26, + 32, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, + "type": "TSNumberKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 32, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 18, + 33, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, }, }, - "type": "TSMethodSignature", - "typeParameters": Object { + "name": "z", + "range": Array [ + 38, + 48, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 6, + "column": 14, "line": 3, }, "start": Object { - "column": 3, + "column": 6, "line": 3, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 41, - 42, - ], - "type": "Identifier", - }, - "range": Array [ - 41, - 42, - ], - "type": "TSTypeParameter", - }, - ], "range": Array [ 40, - 43, + 48, ], - "type": "TSTypeParameterDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSObjectKeyword", + }, }, }, - ], - "range": Array [ - 11, - 57, - ], - "type": "TSTypeLiteral", + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 48, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, }, + "range": Array [ + 34, + 49, + ], + "type": "VariableDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -71948,14 +74842,14 @@ Object { }, "range": Array [ 0, - 58, + 50, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 5, "line": 1, }, "start": Object { @@ -71965,92 +74859,92 @@ Object { }, "range": Array [ 0, - 4, + 5, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 1, }, "start": Object { - "column": 5, + "column": 6, "line": 1, }, }, "range": Array [ - 5, - 8, + 6, + 7, ], "type": "Identifier", - "value": "Foo", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ - 9, - 10, + 7, + 8, ], "type": "Punctuator", - "value": "=", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 9, "line": 1, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ - 11, - 12, + 8, + 9, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 15, + 10, 16, ], "type": "Identifier", - "value": "h", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 3, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ @@ -72058,12 +74952,30 @@ Object { 17, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, "line": 2, }, "start": Object { @@ -72072,26 +74984,44 @@ Object { }, }, "range": Array [ - 17, - 20, + 22, + 23, ], "type": "Identifier", - "value": "bar", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 2, }, "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { "column": 7, "line": 2, }, + "start": Object { + "column": 6, + "line": 2, + }, }, "range": Array [ - 20, - 21, + 24, + 25, ], "type": "Punctuator", "value": ":", @@ -72099,53 +75029,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 2, }, "start": Object { - "column": 9, + "column": 8, "line": 2, }, }, "range": Array [ - 22, - 28, + 26, + 32, ], "type": "Identifier", - "value": "string", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 2, }, "start": Object { - "column": 15, + "column": 14, "line": 2, }, }, "range": Array [ - 28, - 29, + 32, + 33, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 3, + "line": 3, }, "start": Object { - "column": 16, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 29, - 30, + 34, + 37, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, ], "type": "Punctuator", "value": ":", @@ -72153,623 +75137,635 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 18, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 31, - 35, + 42, + 48, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "object", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 15, + "line": 3, }, "start": Object { - "column": 22, - "line": 2, + "column": 14, + "line": 3, }, }, "range": Array [ - 35, - 36, + 48, + 49, ], "type": "Punctuator", "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = ` +Object { + "body": Array [ Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "TSTypeReference", + "typeName": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 3, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 39, - 40, + 0, + 15, ], - "type": "Identifier", - "value": "g", + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 3, + "column": 3, + "line": 1, }, "start": Object { - "column": 3, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 40, - 41, + 0, + 3, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 7, + "line": 1, }, "start": Object { "column": 4, - "line": 3, + "line": 1, }, }, "range": Array [ - 41, - 42, + 4, + 7, ], "type": "Identifier", - "value": "T", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 42, - 43, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { "column": 7, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, + "line": 1, }, }, "range": Array [ - 43, - 44, + 7, + 8, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { "column": 10, - "line": 3, + "line": 1, }, "start": Object { - "column": 7, - "line": 3, + "column": 9, + "line": 1, }, }, "range": Array [ - 44, - 47, + 9, + 10, ], "type": "Identifier", - "value": "bar", + "value": "A", }, Object { "loc": Object { "end": Object { "column": 11, - "line": 3, + "line": 1, }, "start": Object { "column": 10, - "line": 3, + "line": 1, }, }, "range": Array [ - 47, - 48, + 10, + 11, ], "type": "Punctuator", - "value": ":", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 12, + "line": 1, }, "start": Object { - "column": 12, - "line": 3, + "column": 11, + "line": 1, }, }, "range": Array [ - 49, - 50, + 11, + 12, ], "type": "Identifier", - "value": "T", + "value": "B", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { "column": 13, - "line": 3, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 12, + "line": 1, }, }, "range": Array [ - 51, - 52, + 12, + 13, ], "type": "Punctuator", - "value": ":", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 13, + "line": 1, }, }, "range": Array [ - 53, - 54, + 13, + 14, ], "type": "Identifier", - "value": "T", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { - "column": 17, - "line": 3, + "column": 14, + "line": 1, }, }, "range": Array [ - 54, - 55, + 14, + 15, ], "type": "Punctuator", "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 56, - 57, - ], - "type": "Punctuator", - "value": "}", - }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-this.src 1`] = ` +exports[`typescript fixtures/basics/var-with-type.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "name", + "range": Array [ + 4, + 15, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 1, - "line": 2, + "column": 8, + "line": 1, }, }, - "name": "addClickListener", "range": Array [ - 23, - 39, + 8, + 15, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 65, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, - }, - }, - "params": Array [ - Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 57, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 9, + "line": 1, }, }, - "name": "onclick", "range": Array [ - 40, - 79, + 9, + 15, ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 25, - "line": 2, - }, - }, - "range": Array [ - 47, - 79, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "name": "this", - "range": Array [ - 50, - 60, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 32, - "line": 2, - }, - }, - "range": Array [ - 54, - 60, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 56, - 60, - ], - "type": "TSVoidKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 40, - "line": 2, - }, - }, - "name": "e", - "range": Array [ - 62, - 70, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 41, - "line": 2, - }, - }, - "range": Array [ - 63, - 70, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 43, - "line": 2, - }, - }, - "range": Array [ - 65, - 70, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 43, - "line": 2, - }, - }, - "name": "Event", - "range": Array [ - 65, - 70, - ], - "type": "Identifier", - }, - }, - }, - }, - ], - "range": Array [ - 49, - 79, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 50, - "line": 2, - }, - }, - "range": Array [ - 72, - 79, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 53, - "line": 2, - }, - }, - "range": Array [ - 75, - 79, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSFunctionType", - }, - }, + "type": "TSStringKeyword", + }, + }, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "raw": "\\"Nicholas\\"", + "type": "Literal", + "value": "Nicholas", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, }, - ], + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", "range": Array [ - 23, - 87, + 34, + 45, ], - "returnType": Object { + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 64, + "column": 15, "line": 2, }, "start": Object { - "column": 58, + "column": 7, "line": 2, }, }, "range": Array [ - 80, - 86, + 37, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 64, + "column": 15, "line": 2, }, "start": Object { - "column": 60, + "column": 9, "line": 2, }, }, "range": Array [ - 82, - 86, + 39, + 45, ], - "type": "TSVoidKeyword", + "type": "TSStringKeyword", }, }, - "type": "TSMethodSignature", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 1, }, - }, - "range": Array [ - 20, - 89, - ], - "type": "TSInterfaceBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 48, + 53, + ], + "raw": "\\"Bar\\"", + "type": "Literal", + "value": "Bar", }, - "start": Object { - "column": 10, - "line": 1, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, }, + "range": Array [ + 34, + 53, + ], + "type": "VariableDeclarator", }, - "name": "UIElement", - "range": Array [ - 10, - 19, - ], - "type": "Identifier", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 24, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 89, + 30, + 54, ], - "type": "TSInterfaceDeclaration", + "type": "VariableDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -72778,14 +75774,14 @@ Object { }, "range": Array [ 0, - 90, + 55, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 3, "line": 1, }, "start": Object { @@ -72795,169 +75791,169 @@ Object { }, "range": Array [ 0, - 9, + 3, ], "type": "Keyword", - "value": "interface", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 8, "line": 1, }, "start": Object { - "column": 10, + "column": 4, "line": 1, }, }, "range": Array [ - 10, - 19, + 4, + 8, ], "type": "Identifier", - "value": "UIElement", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 9, "line": 1, }, "start": Object { - "column": 20, + "column": 8, "line": 1, }, }, "range": Array [ - 20, - 21, + 8, + 9, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 1, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 23, - 39, + 9, + 15, ], "type": "Identifier", - "value": "addClickListener", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 39, - 40, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { "column": 18, - "line": 2, + "line": 1, }, }, "range": Array [ - 40, - 47, + 18, + 28, ], - "type": "Identifier", - "value": "onclick", + "type": "String", + "value": "\\"Nicholas\\"", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 25, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 47, - 48, + 28, + 29, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 3, "line": 2, }, "start": Object { - "column": 27, + "column": 0, "line": 2, }, }, "range": Array [ - 49, - 50, + 30, + 33, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 7, "line": 2, }, "start": Object { - "column": 28, + "column": 4, "line": 2, }, }, "range": Array [ - 50, - 54, + 34, + 37, ], - "type": "Keyword", - "value": "this", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 8, "line": 2, }, "start": Object { - "column": 32, + "column": 7, "line": 2, }, }, "range": Array [ - 54, - 55, + 37, + 38, ], "type": "Punctuator", "value": ":", @@ -72965,179 +75961,241 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 15, "line": 2, }, "start": Object { - "column": 34, + "column": 9, "line": 2, }, }, "range": Array [ - 56, - 60, + 39, + 45, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 17, "line": 2, }, "start": Object { - "column": 38, + "column": 16, "line": 2, }, }, "range": Array [ - 60, - 61, + 46, + 47, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 23, "line": 2, }, "start": Object { - "column": 40, + "column": 18, "line": 2, }, }, "range": Array [ - 62, - 63, + 48, + 53, ], - "type": "Identifier", - "value": "e", + "type": "String", + "value": "\\"Bar\\"", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 24, "line": 2, }, "start": Object { - "column": 41, + "column": 23, "line": 2, }, }, "range": Array [ - 63, - 64, + 53, + 54, ], "type": "Punctuator", - "value": ":", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/variable-declaration-type-annotation-spacing.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 43, - "line": 2, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSStringKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 21, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 65, - 70, ], - "type": "Identifier", - "value": "Event", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 49, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 48, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 70, - 71, + 0, + 22, ], - "type": "Punctuator", - "value": ")", + "type": "VariableDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 52, - "line": 2, - }, - "start": Object { - "column": 50, - "line": 2, - }, - }, - "range": Array [ - 72, - 74, - ], - "type": "Punctuator", - "value": "=>", + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 57, - "line": 2, + "column": 3, + "line": 1, }, "start": Object { - "column": 53, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 75, - 79, + 0, + 3, ], "type": "Keyword", - "value": "void", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 58, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { - "column": 57, - "line": 2, + "column": 4, + "line": 1, }, }, "range": Array [ - 79, - 80, + 4, + 5, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 59, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 58, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 80, - 81, + 8, + 9, ], "type": "Punctuator", "value": ":", @@ -73145,88 +76203,90 @@ Object { Object { "loc": Object { "end": Object { - "column": 64, - "line": 2, - }, - "start": Object { - "column": 60, - "line": 2, - }, - }, - "range": Array [ - 82, - 86, - ], - "type": "Keyword", - "value": "void", - }, - Object { - "loc": Object { - "end": Object { - "column": 65, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 64, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ - 86, - 87, + 15, + 21, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 21, + "line": 1, }, }, "range": Array [ - 88, - 89, + 21, + 22, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/unique-symbol.src 1`] = ` +exports[`typescript fixtures/declare/abstract-class.src 1`] = ` Object { "body": Array [ Object { + "abstract": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "ClassBody", + }, + "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 6, + "column": 26, "line": 1, }, "start": Object { - "column": 5, + "column": 23, "line": 1, }, }, - "name": "A", + "name": "Foo", "range": Array [ - 5, - 6, + 23, + 26, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -73235,51 +76295,17 @@ Object { }, "range": Array [ 0, - 23, + 31, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "operator": "unique", - "range": Array [ - 9, - 22, - ], - "type": "TSTypeOperator", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 22, - ], - "type": "TSSymbolKeyword", - }, - }, + "superClass": null, + "type": "ClassDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -73288,14 +76314,14 @@ Object { }, "range": Array [ 0, - 24, + 32, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -73305,187 +76331,151 @@ Object { }, "range": Array [ 0, - 4, + 7, ], "type": "Identifier", - "value": "type", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 16, "line": 1, }, "start": Object { - "column": 5, + "column": 8, "line": 1, }, }, "range": Array [ - 5, - 6, + 8, + 16, ], "type": "Identifier", - "value": "A", + "value": "abstract", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 22, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, "range": Array [ - 7, - 8, + 17, + 22, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 26, "line": 1, }, "start": Object { - "column": 9, + "column": 23, "line": 1, }, }, "range": Array [ - 9, - 15, + 23, + 26, ], "type": "Identifier", - "value": "unique", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 28, "line": 1, }, "start": Object { - "column": 16, + "column": 27, "line": 1, }, }, "range": Array [ - 16, - 22, + 27, + 28, ], - "type": "Identifier", - "value": "symbol", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 22, - 23, + 30, + 31, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/unknown-type-annotation.src 1`] = ` +exports[`typescript fixtures/declare/class.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 16, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 16, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 16, - ], - "type": "TSUnknownKeyword", - }, - }, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "init": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "start": Object { + "column": 18, + "line": 1, }, - "range": Array [ - 4, - 16, - ], - "type": "VariableDeclarator", }, - ], - "kind": "let", + "range": Array [ + 18, + 22, + ], + "type": "ClassBody", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -73494,16 +76484,17 @@ Object { }, "range": Array [ 0, - 17, + 22, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -73512,14 +76503,14 @@ Object { }, "range": Array [ 0, - 18, + 23, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { @@ -73529,190 +76520,127 @@ Object { }, "range": Array [ 0, - 3, + 7, ], - "type": "Keyword", - "value": "let", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 1, }, "start": Object { - "column": 4, + "column": 8, "line": 1, }, }, "range": Array [ - 4, - 7, + 8, + 13, ], - "type": "Identifier", - "value": "foo", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 1, }, "start": Object { - "column": 7, + "column": 14, "line": 1, }, }, "range": Array [ - 7, - 8, + 14, + 17, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 19, "line": 1, }, "start": Object { - "column": 9, + "column": 18, "line": 1, }, }, "range": Array [ - 9, - 16, + 18, + 19, ], - "type": "Identifier", - "value": "unknown", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/var-with-definite-assignment.src 1`] = ` +exports[`typescript fixtures/declare/enum.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "definite": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 6, - 16, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 16, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 16, - ], - "type": "TSStringKeyword", - }, - }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, }, - "init": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 13, + "line": 1, }, - "range": Array [ - 6, - 16, - ], - "type": "VariableDeclarator", }, - ], - "kind": "const", + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, "line": 1, }, }, - "range": Array [ - 0, - 17, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ + "members": Array [ Object { - "definite": true, "id": Object { "loc": Object { "end": Object { - "column": 14, + "column": 7, "line": 2, }, "start": Object { @@ -73720,90 +76648,34 @@ Object { "line": 2, }, }, - "name": "y", + "name": "Bar", "range": Array [ - 22, - 32, + 23, + 26, ], "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 24, - 32, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 26, - 32, - ], - "type": "TSNumberKeyword", - }, - }, }, - "init": null, "loc": Object { "end": Object { - "column": 14, + "column": 7, "line": 2, }, "start": Object { "column": 4, "line": 2, - }, - }, - "range": Array [ - 22, - 32, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 18, - 33, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "TSEnumMember", + }, Object { - "definite": true, "id": Object { "loc": Object { "end": Object { - "column": 14, + "column": 7, "line": 3, }, "start": Object { @@ -73811,51 +76683,16 @@ Object { "line": 3, }, }, - "name": "z", + "name": "Baz", "range": Array [ - 38, - 48, + 32, + 35, ], "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 40, - 48, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "TSObjectKeyword", - }, - }, }, - "init": null, "loc": Object { "end": Object { - "column": 14, + "column": 7, "line": 3, }, "start": Object { @@ -73864,35 +76701,24 @@ Object { }, }, "range": Array [ - 38, - 48, + 32, + 35, ], - "type": "VariableDeclarator", + "type": "TSEnumMember", }, ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, "range": Array [ - 34, - 49, + 0, + 37, ], - "type": "VariableDeclaration", + "type": "TSEnumDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 5, }, "start": Object { "column": 0, @@ -73901,14 +76727,14 @@ Object { }, "range": Array [ 0, - 50, + 38, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { @@ -73918,51 +76744,15 @@ Object { }, "range": Array [ 0, - 5, - ], - "type": "Keyword", - "value": "const", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, 7, ], "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "!", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { @@ -73972,10 +76762,10 @@ Object { }, "range": Array [ 8, - 9, + 12, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "enum", }, Object { "loc": Object { @@ -73984,57 +76774,39 @@ Object { "line": 1, }, "start": Object { - "column": 10, + "column": 13, "line": 1, }, }, "range": Array [ - 10, + 13, 16, ], "type": "Identifier", - "value": "string", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 16, + "column": 17, "line": 1, }, }, "range": Array [ - 16, 17, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ 18, - 21, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 2, }, "start": Object { @@ -74043,106 +76815,34 @@ Object { }, }, "range": Array [ - 22, 23, + 26, ], "type": "Identifier", - "value": "y", + "value": "Bar", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 2, }, "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": "!", - }, - Object { - "loc": Object { - "end": Object { "column": 7, "line": 2, }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, }, "range": Array [ 26, - 32, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 32, - 33, + 27, ], "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 34, - 37, - ], - "type": "Keyword", - "value": "let", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 3, }, "start": Object { @@ -74151,269 +76851,111 @@ Object { }, }, "range": Array [ - 38, - 39, + 32, + 35, ], "type": "Identifier", - "value": "z", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": "!", + "value": "Baz", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 1, + "line": 4, }, "start": Object { - "column": 6, - "line": 3, + "column": 0, + "line": 4, }, }, "range": Array [ - 40, - 41, + 36, + 37, ], "type": "Punctuator", - "value": ":", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/function.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, + "async": false, + "declare": true, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", }, - "range": Array [ - 42, - 48, - ], - "type": "Identifier", - "value": "object", - }, - Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 28, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 0, + "line": 1, }, }, + "params": Array [], "range": Array [ - 48, - 49, + 0, + 28, ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 14, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 14, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 14, - ], - "type": "TSTypeReference", - "typeName": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 12, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "B", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - }, - "type": "TSQualifiedName", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 14, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "C", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, - "type": "TSQualifiedName", - }, - }, - }, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, }, - "init": null, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 14, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 24, "line": 1, }, }, "range": Array [ - 4, - 14, + 24, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "TSVoidKeyword", }, }, - "range": Array [ - 0, - 15, - ], - "type": "VariableDeclaration", + "type": "TSDeclareFunction", }, ], "comments": Array [], @@ -74429,14 +76971,14 @@ Object { }, "range": Array [ 0, - 16, + 29, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { @@ -74446,25 +76988,43 @@ Object { }, "range": Array [ 0, - 3, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, ], "type": "Keyword", - "value": "var", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 17, "line": 1, }, }, "range": Array [ - 4, - 7, + 17, + 20, ], "type": "Identifier", "value": "foo", @@ -74472,376 +77032,295 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 1, }, "start": Object { - "column": 7, + "column": 20, "line": 1, }, }, "range": Array [ - 7, - 8, + 20, + 21, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 22, "line": 1, }, "start": Object { - "column": 9, + "column": 21, "line": 1, }, }, "range": Array [ - 9, - 10, + 21, + 22, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 23, "line": 1, }, "start": Object { - "column": 10, + "column": 22, "line": 1, }, }, "range": Array [ - 10, - 11, + 22, + 23, ], "type": "Punctuator", - "value": ".", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 28, "line": 1, }, "start": Object { - "column": 11, + "column": 24, "line": 1, }, }, "range": Array [ - 11, - 12, + 24, + 28, ], - "type": "Identifier", - "value": "B", + "type": "Keyword", + "value": "void", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/interface.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "TSInterfaceBody", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, + "column": 0, "line": 1, }, }, "range": Array [ - 12, - 13, + 0, + 26, ], - "type": "Punctuator", - "value": ".", + "type": "TSInterfaceDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 14, + "column": 7, "line": 1, }, "start": Object { - "column": 13, + "column": 0, "line": 1, }, }, "range": Array [ - 13, - 14, + 0, + 7, ], "type": "Identifier", - "value": "C", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 14, + "column": 8, "line": 1, }, }, "range": Array [ - 14, - 15, + 8, + 17, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "interface", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/var-with-type.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "name", - "range": Array [ - 4, - 15, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 15, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 15, - ], - "type": "TSStringKeyword", - }, - }, - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 28, - ], - "raw": "\\"Nicholas\\"", - "type": "Literal", - "value": "Nicholas", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 28, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", "loc": Object { "end": Object { - "column": 29, + "column": 21, "line": 1, }, "start": Object { - "column": 0, + "column": 18, "line": 1, }, }, "range": Array [ - 0, - 29, + 18, + 21, ], - "type": "VariableDeclaration", + "type": "Identifier", + "value": "Foo", }, Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 34, - 45, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 37, - 45, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 39, - 45, - ], - "type": "TSStringKeyword", - }, - }, - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 48, - 53, - ], - "raw": "\\"Bar\\"", - "type": "Literal", - "value": "Bar", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 34, - 53, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, }, + }, + "range": Array [ + 22, + 23, ], - "kind": "var", + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 2, + "line": 3, }, }, "range": Array [ - 30, - 54, + 25, + 26, ], - "type": "VariableDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 55, ], - "sourceType": "module", - "tokens": Array [ + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/module.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -74850,33 +77329,50 @@ Object { }, "range": Array [ 0, - 3, + 23, ], - "type": "Keyword", - "value": "var", + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 1, }, "start": Object { - "column": 4, + "column": 0, "line": 1, }, }, "range": Array [ - 4, - 8, + 0, + 7, ], "type": "Identifier", - "value": "name", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 14, "line": 1, }, "start": Object { @@ -74886,294 +77382,266 @@ Object { }, "range": Array [ 8, - 9, + 14, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "module", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 9, + "column": 15, "line": 1, }, }, "range": Array [ - 9, 15, + 18, ], "type": "Identifier", - "value": "string", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 20, "line": 1, }, "start": Object { - "column": 16, + "column": 19, "line": 1, }, }, "range": Array [ - 16, - 17, + 19, + 20, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 18, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 18, - 28, + 22, + 23, ], - "type": "String", - "value": "\\"Nicholas\\"", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/namespace.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, }, - "start": Object { - "column": 28, - "line": 1, + "range": Array [ + 22, + 26, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 18, + 21, + ], + "type": "Identifier", }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ";", - }, - Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 30, - 33, + 0, + 26, ], - "type": "Keyword", - "value": "var", + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { "column": 7, - "line": 2, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 34, - 37, + 0, + 7, ], "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 37, - 38, - ], - "type": "Punctuator", - "value": ":", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 39, - 45, + 8, + 17, ], "type": "Identifier", - "value": "string", + "value": "namespace", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 18, + "line": 1, }, }, "range": Array [ - 46, - 47, + 18, + 21, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { "column": 23, - "line": 2, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 48, - 53, + 22, + 23, ], - "type": "String", - "value": "\\"Bar\\"", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 23, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 53, - 54, + 25, + 26, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/variable-declaration-type-annotation-spacing.src 1`] = ` +exports[`typescript fixtures/declare/type-alias.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 21, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 21, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 21, - ], - "type": "TSStringKeyword", - }, - }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, }, - "init": null, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "start": Object { + "column": 13, + "line": 1, }, - "range": Array [ - 4, - 21, - ], - "type": "VariableDeclarator", }, - ], - "kind": "let", + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 22, + "column": 25, "line": 1, }, "start": Object { @@ -75183,16 +77651,33 @@ Object { }, "range": Array [ 0, - 22, + 25, ], - "type": "VariableDeclaration", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSStringKeyword", + }, }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -75201,14 +77686,14 @@ Object { }, "range": Array [ 0, - 22, + 26, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { @@ -75218,134 +77703,170 @@ Object { }, "range": Array [ 0, - 3, + 7, ], - "type": "Keyword", - "value": "let", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 12, "line": 1, }, "start": Object { - "column": 4, + "column": 8, "line": 1, }, }, "range": Array [ - 4, - 5, + 8, + 12, ], "type": "Identifier", - "value": "x", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 1, }, "start": Object { - "column": 8, + "column": 13, "line": 1, }, }, "range": Array [ - 8, - 9, + 13, + 16, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 18, "line": 1, }, "start": Object { - "column": 15, + "column": 17, "line": 1, }, }, "range": Array [ - 15, - 21, + 17, + 18, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 25, "line": 1, }, "start": Object { - "column": 21, + "column": 19, "line": 1, }, }, "range": Array [ - 21, - 22, + 19, + 25, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "string", }, ], "type": "Program", } `; -exports[`typescript fixtures/declare/abstract-class.src 1`] = ` +exports[`typescript fixtures/declare/variable.src 1`] = ` Object { "body": Array [ Object { - "abstract": true, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 31, - ], - "type": "ClassBody", - }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 12, + 20, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", + }, + }, }, - "start": Object { - "column": 23, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, }, - }, - "name": "Foo", - "range": Array [ - 23, - 26, - ], - "type": "Identifier", - }, + "range": Array [ + 12, + 20, + ], + "type": "VariableDeclarator", + }, + ], + "declare": true, + "kind": "var", "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 21, + "line": 1, }, "start": Object { "column": 0, @@ -75354,17 +77875,16 @@ Object { }, "range": Array [ 0, - 31, + 21, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "VariableDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -75373,7 +77893,7 @@ Object { }, "range": Array [ 0, - 32, + 22, ], "sourceType": "module", "tokens": Array [ @@ -75398,7 +77918,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { @@ -75408,133 +77928,357 @@ Object { }, "range": Array [ 8, - 16, + 11, ], - "type": "Identifier", - "value": "abstract", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 15, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 22, + 12, + 15, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 16, "line": 1, }, "start": Object { - "column": 23, + "column": 15, "line": 1, }, }, "range": Array [ - 23, - 26, + 15, + 16, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 20, "line": 1, }, "start": Object { - "column": 27, + "column": 17, "line": 1, }, }, "range": Array [ - 27, - 28, + 17, + 20, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 21, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 20, + "line": 1, }, }, "range": Array [ - 30, - 31, + 20, + 21, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/declare/class.src 1`] = ` +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [], + "body": Array [ + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 32, + 37, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "configurable", + "range": Array [ + 19, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 38, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 38, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 70, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 60, + 64, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "_x", + "range": Array [ + 65, + 67, + ], + "type": "Identifier", + }, + "range": Array [ + 60, + 67, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 68, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 70, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 48, + 70, + ], + "type": "FunctionExpression", + }, + }, + ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { - "column": 18, + "column": 12, "line": 1, }, }, "range": Array [ - 18, - 22, + 12, + 72, ], "type": "ClassBody", }, - "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 14, + "column": 6, "line": 1, }, }, - "name": "Foo", + "name": "Point", "range": Array [ - 14, - 17, + 6, + 11, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -75543,7 +78287,7 @@ Object { }, "range": Array [ 0, - 22, + 72, ], "superClass": null, "type": "ClassDeclaration", @@ -75552,7 +78296,7 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 0, + "column": 1, "line": 4, }, "start": Object { @@ -75562,14 +78306,14 @@ Object { }, "range": Array [ 0, - 23, + 72, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -75579,56 +78323,56 @@ Object { }, "range": Array [ 0, - 7, + 5, ], - "type": "Identifier", - "value": "declare", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 6, "line": 1, }, }, "range": Array [ - 8, - 13, + 6, + 11, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "Point", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 13, "line": 1, }, "start": Object { - "column": 14, + "column": 12, "line": 1, }, }, "range": Array [ - 14, - 17, + 12, + 13, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ @@ -75636,228 +78380,166 @@ Object { 19, ], "type": "Punctuator", - "value": "{", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 17, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 5, + "line": 2, }, }, "range": Array [ - 21, - 22, + 19, + 31, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "configurable", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/enum.src 1`] = ` -Object { - "body": Array [ Object { - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 18, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 2, }, }, - "members": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "Bar", - "range": Array [ - 23, - 26, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 23, - 26, - ], - "type": "TSEnumMember", + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "Baz", - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 32, - 35, - ], - "type": "TSEnumMember", + "start": Object { + "column": 18, + "line": 2, }, + }, + "range": Array [ + 32, + 37, ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, "range": Array [ - 0, 37, + 38, ], - "type": "TSEnumDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 38, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { "column": 7, - "line": 1, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 0, - 7, + 43, + 46, ], "type": "Identifier", - "value": "declare", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { "column": 8, - "line": 1, + "line": 3, }, }, "range": Array [ - 8, - 12, + 47, + 48, ], - "type": "Keyword", - "value": "enum", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 13, - "line": 1, + "column": 9, + "line": 3, }, }, "range": Array [ - 13, - 16, + 48, + 49, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 17, - 18, + 49, + 50, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, ], "type": "Punctuator", "value": "{", @@ -75865,56 +78547,110 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 20, + "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 14, + "line": 3, }, }, "range": Array [ - 23, - 26, + 53, + 59, ], - "type": "Identifier", - "value": "Bar", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 25, + "line": 3, }, "start": Object { - "column": 7, - "line": 2, + "column": 21, + "line": 3, }, }, "range": Array [ - 26, - 27, + 60, + 64, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, ], "type": "Punctuator", - "value": ",", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 28, "line": 3, }, "start": Object { - "column": 4, + "column": 26, "line": 3, }, }, "range": Array [ - 32, - 35, + 65, + 67, ], "type": "Identifier", - "value": "Baz", + "value": "_x", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { @@ -75927,101 +78663,364 @@ Object { "line": 4, }, }, - "range": Array [ - 36, - 37, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/function.src 1`] = ` -Object { - "body": Array [ - Object { - "async": false, - "declare": true, - "expression": false, - "generator": false, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 25, + 34, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 30, + 34, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + }, + ], + "range": Array [ + 23, + 36, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 37, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 37, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 80, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "name": "_bar", + "range": Array [ + 73, + 77, + ], + "type": "Identifier", + }, + "range": Array [ + 68, + 77, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 78, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 80, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 56, + 80, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 82, + ], + "type": "ClassBody", + }, "id": Object { "loc": Object { "end": Object { - "column": 20, + "column": 11, "line": 1, }, "start": Object { - "column": 17, + "column": 6, "line": 1, }, }, - "name": "foo", + "name": "Other", "range": Array [ - 17, - 20, + 6, + 11, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [], "range": Array [ 0, - 28, + 82, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 28, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSDeclareFunction", + "superClass": null, + "type": "ClassDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -76030,14 +79029,14 @@ Object { }, "range": Array [ 0, - 29, + 82, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -76047,92 +79046,92 @@ Object { }, "range": Array [ 0, - 7, + 5, ], - "type": "Identifier", - "value": "declare", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 6, "line": 1, }, }, "range": Array [ - 8, - 16, + 6, + 11, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "Other", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 20, + 12, + 13, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 20, - 21, + 18, + 19, ], "type": "Punctuator", - "value": "(", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 21, + 19, 22, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ @@ -76140,344 +79139,220 @@ Object { 23, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ + 23, 24, - 28, ], - "type": "Keyword", - "value": "void", + "type": "Punctuator", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/interface.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 26, - ], - "type": "TSInterfaceBody", - }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 18, - 21, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 0, - 26, + 25, + 28, ], - "type": "TSInterfaceDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "baz", }, - }, - "range": Array [ - 0, - 27, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 0, - 7, + 28, + 29, ], - "type": "Identifier", - "value": "declare", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 8, - 17, + 30, + 34, ], - "type": "Keyword", - "value": "interface", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 18, - 21, + 35, + 36, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { "column": 23, - "line": 1, + "line": 2, }, "start": Object { "column": 22, - "line": 1, + "line": 2, }, }, "range": Array [ - 22, - 23, + 36, + 37, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 10, "line": 3, }, "start": Object { - "column": 0, + "column": 4, "line": 3, }, }, "range": Array [ - 25, - 26, + 42, + 48, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "static", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/module.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 23, - ], - "type": "TSModuleBlock", - }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, + "column": 14, "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 3, }, }, "range": Array [ - 0, - 23, + 49, + 52, ], - "type": "TSModuleDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "get", }, - }, - "range": Array [ - 0, - 24, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ - 0, - 7, + 53, + 56, ], "type": "Identifier", - "value": "declare", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 18, + "line": 3, }, }, "range": Array [ - 8, - 14, + 56, + 57, ], - "type": "Identifier", - "value": "module", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 20, + "line": 3, }, "start": Object { - "column": 15, - "line": 1, + "column": 19, + "line": 3, }, }, "range": Array [ - 15, - 18, + 57, + 58, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 22, + "line": 3, }, "start": Object { - "column": 19, - "line": 1, + "column": 21, + "line": 3, }, }, "range": Array [ - 19, - 20, + 59, + 60, ], "type": "Punctuator", "value": "{", @@ -76485,187 +79360,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, + "column": 29, "line": 3, }, "start": Object { - "column": 0, + "column": 23, "line": 3, }, }, "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/namespace.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 26, - ], - "type": "TSModuleBlock", - }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 18, - 21, - ], - "type": "Identifier", - }, + 61, + 67, + ], + "type": "Keyword", + "value": "return", + }, + Object { "loc": Object { "end": Object { - "column": 1, + "column": 34, "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 30, + "line": 3, }, }, "range": Array [ - 0, - 26, + 68, + 72, ], - "type": "TSModuleDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "this", }, - }, - "range": Array [ - 0, - 27, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 35, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 34, + "line": 3, }, }, "range": Array [ - 0, - 7, + 72, + 73, ], - "type": "Identifier", - "value": "declare", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 39, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 35, + "line": 3, }, }, "range": Array [ - 8, - 17, + 73, + 77, ], "type": "Identifier", - "value": "namespace", + "value": "_bar", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 40, + "line": 3, }, "start": Object { - "column": 18, - "line": 1, + "column": 39, + "line": 3, }, }, "range": Array [ - 18, - 21, + 77, + 78, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 42, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 41, + "line": 3, }, }, "range": Array [ - 22, - 23, + 79, + 80, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, - "line": 3, + "line": 4, }, }, "range": Array [ - 25, - 26, + 81, + 82, ], "type": "Punctuator", "value": "}", @@ -76675,33 +79488,237 @@ Object { } `; -exports[`typescript fixtures/declare/type-alias.src 1`] = ` +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { - "declare": true, + "body": Object { + "body": Array [ + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "hidden", + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "z", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 53, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "_z", + "range": Array [ + 48, + 50, + ], + "type": "Identifier", + }, + "range": Array [ + 43, + 50, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 36, + 51, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 34, + 53, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 31, + 53, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 55, + ], + "type": "ClassBody", + }, "id": Object { "loc": Object { "end": Object { - "column": 16, + "column": 7, "line": 1, }, "start": Object { - "column": 13, + "column": 6, "line": 1, }, }, - "name": "Foo", + "name": "P", "range": Array [ - 13, - 16, + 6, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -76710,33 +79727,17 @@ Object { }, "range": Array [ 0, - 25, + 55, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 25, - ], - "type": "TSStringKeyword", - }, + "superClass": null, + "type": "ClassDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -76745,14 +79746,14 @@ Object { }, "range": Array [ 0, - 26, + 55, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -76762,314 +79763,305 @@ Object { }, "range": Array [ 0, - 7, + 5, ], - "type": "Identifier", - "value": "declare", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 7, "line": 1, }, "start": Object { - "column": 8, + "column": 6, "line": 1, }, }, "range": Array [ - 8, - 12, + 6, + 7, ], "type": "Identifier", - "value": "type", + "value": "P", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, "range": Array [ - 13, - 16, + 8, + 9, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 17, - 18, + 14, + 15, ], "type": "Punctuator", - "value": "=", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 19, - 25, + 15, + 21, ], "type": "Identifier", - "value": "string", + "value": "hidden", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/variable.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 12, - 20, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 20, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 20, - ], - "type": "TSAnyKeyword", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 20, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, ], - "declare": true, - "kind": "var", + "type": "Identifier", + "value": "z", + }, + Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 9, + "line": 3, }, }, "range": Array [ - 0, - 21, + 31, + 32, ], - "type": "VariableDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, + "type": "Punctuator", + "value": "(", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 22, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 12, + "line": 3, }, }, "range": Array [ - 0, - 7, + 34, + 35, ], - "type": "Identifier", - "value": "declare", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 20, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ - 8, - 11, + 36, + 42, ], "type": "Keyword", - "value": "var", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 25, + "line": 3, }, "start": Object { - "column": 12, - "line": 1, + "column": 21, + "line": 3, }, }, "range": Array [ - 12, - 15, + 43, + 47, ], - "type": "Identifier", - "value": "foo", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 26, + "line": 3, }, "start": Object { - "column": 15, - "line": 1, + "column": 25, + "line": 3, }, }, "range": Array [ - 15, - 16, + 47, + 48, ], "type": "Punctuator", - "value": ":", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 28, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 26, + "line": 3, }, }, "range": Array [ - 17, - 20, + 48, + 50, ], "type": "Identifier", - "value": "any", + "value": "_z", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 29, + "line": 3, }, "start": Object { - "column": 20, - "line": 1, + "column": 28, + "line": 3, }, }, "range": Array [ - 20, - 21, + 50, + 51, ], "type": "Punctuator", "value": ";", }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "}", + }, ], "type": "Program", } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -77080,48 +80072,9 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 32, - 37, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "configurable", - "range": Array [ - 19, - 31, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 2, }, "start": Object { @@ -77129,15 +80082,16 @@ Object { "line": 2, }, }, + "name": "adminonly", "range": Array [ - 19, - 38, + 18, + 27, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 2, }, "start": Object { @@ -77146,8 +80100,8 @@ Object { }, }, "range": Array [ - 18, - 38, + 17, + 27, ], "type": "Decorator", }, @@ -77155,26 +80109,26 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 3, }, "start": Object { - "column": 8, + "column": 15, "line": 3, }, }, - "name": "x", + "name": "y", "range": Array [ - 47, - 48, + 43, + 44, ], "type": "Identifier", }, - "kind": "get", + "kind": "set", "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 5, + "line": 5, }, "start": Object { "column": 4, @@ -77182,99 +80136,135 @@ Object { }, }, "range": Array [ - 18, - 70, + 17, + 76, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { "body": Array [ Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "object": Object { + "expression": Object { + "left": Object { + "computed": false, "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 15, + "line": 4, }, "start": Object { - "column": 21, - "line": 3, + "column": 8, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 58, + 62, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, }, + "name": "_y", + "range": Array [ + 63, + 65, + ], + "type": "Identifier", }, "range": Array [ - 60, - 64, + 58, + 65, ], - "type": "ThisExpression", + "type": "MemberExpression", }, - "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "operator": "=", + "range": Array [ + 58, + 69, + ], + "right": Object { "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 19, + "line": 4, }, "start": Object { - "column": 26, - "line": 3, + "column": 18, + "line": 4, }, }, - "name": "_x", + "name": "a", "range": Array [ - 65, - 67, + 68, + 69, ], "type": "Identifier", }, - "range": Array [ - 60, - 67, - ], - "type": "MemberExpression", + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 29, - "line": 3, + "column": 20, + "line": 4, }, "start": Object { - "column": 14, - "line": 3, + "column": 8, + "line": 4, }, }, "range": Array [ - 53, - 68, + 58, + 70, ], - "type": "ReturnStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 5, + "line": 5, }, "start": Object { - "column": 12, + "column": 20, "line": 3, }, }, "range": Array [ - 51, - 70, + 48, + 76, ], "type": "BlockStatement", }, @@ -77283,18 +80273,37 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 5, + "line": 5, }, "start": Object { - "column": 9, + "column": 16, "line": 3, }, }, - "params": Array [], + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + }, + ], "range": Array [ - 48, - 70, + 44, + 76, ], "type": "FunctionExpression", }, @@ -77303,23 +80312,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 6, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, "range": Array [ - 12, - 72, + 11, + 78, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { @@ -77327,17 +80336,17 @@ Object { "line": 1, }, }, - "name": "Point", + "name": "User", "range": Array [ 6, - 11, + 10, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -77346,7 +80355,7 @@ Object { }, "range": Array [ 0, - 72, + 78, ], "superClass": null, "type": "ClassDeclaration", @@ -77356,7 +80365,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -77365,7 +80374,7 @@ Object { }, "range": Array [ 0, - 72, + 78, ], "sourceType": "module", "tokens": Array [ @@ -77390,7 +80399,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { @@ -77400,25 +80409,25 @@ Object { }, "range": Array [ 6, - 11, + 10, ], "type": "Identifier", - "value": "Point", + "value": "User", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, "range": Array [ + 11, 12, - 13, ], "type": "Punctuator", "value": "{", @@ -77435,8 +80444,8 @@ Object { }, }, "range": Array [ + 17, 18, - 19, ], "type": "Punctuator", "value": "@", @@ -77444,7 +80453,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 14, "line": 2, }, "start": Object { @@ -77453,116 +80462,80 @@ Object { }, }, "range": Array [ - 19, - 31, + 18, + 27, ], "type": "Identifier", - "value": "configurable", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "(", + "value": "adminonly", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 10, + "line": 3, }, "start": Object { - "column": 18, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ 32, - 37, - ], - "type": "Boolean", - "value": "false", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "range": Array [ - 37, 38, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 14, "line": 3, }, "start": Object { - "column": 4, + "column": 11, "line": 3, }, }, "range": Array [ - 43, - 46, + 39, + 42, ], "type": "Identifier", - "value": "get", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 3, }, "start": Object { - "column": 8, + "column": 15, "line": 3, }, }, "range": Array [ - 47, - 48, + 43, + 44, ], "type": "Identifier", - "value": "x", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 17, "line": 3, }, "start": Object { - "column": 9, + "column": 16, "line": 3, }, }, "range": Array [ - 48, - 49, + 44, + 45, ], "type": "Punctuator", "value": "(", @@ -77570,71 +80543,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 18, "line": 3, }, "start": Object { - "column": 10, + "column": 17, "line": 3, }, }, "range": Array [ - 49, - 50, + 45, + 46, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 19, "line": 3, }, "start": Object { - "column": 12, + "column": 18, "line": 3, }, }, "range": Array [ - 51, - 52, + 46, + 47, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 21, "line": 3, }, "start": Object { - "column": 14, + "column": 20, "line": 3, }, }, "range": Array [ - 53, - 59, + 48, + 49, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 12, + "line": 4, }, "start": Object { - "column": 21, - "line": 3, + "column": 8, + "line": 4, }, }, "range": Array [ - 60, - 64, + 58, + 62, ], "type": "Keyword", "value": "this", @@ -77642,17 +80615,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 3, + "column": 13, + "line": 4, }, "start": Object { - "column": 25, - "line": 3, + "column": 12, + "line": 4, }, }, "range": Array [ - 64, - 65, + 62, + 63, ], "type": "Punctuator", "value": ".", @@ -77660,48 +80633,66 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 15, + "line": 4, }, "start": Object { - "column": 26, - "line": 3, + "column": 13, + "line": 4, }, }, "range": Array [ + 63, 65, - 67, ], "type": "Identifier", - "value": "_x", + "value": "_y", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 3, + "column": 17, + "line": 4, }, "start": Object { - "column": 28, - "line": 3, + "column": 16, + "line": 4, }, }, "range": Array [ + 66, 67, - 68, ], "type": "Punctuator", - "value": ";", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 19, + "line": 4, }, "start": Object { - "column": 30, - "line": 3, + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, }, }, "range": Array [ @@ -77709,22 +80700,40 @@ Object { 70, ], "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", "value": "}", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 6, }, "start": Object { "column": 0, - "line": 4, + "line": 6, }, }, "range": Array [ - 71, - 72, + 77, + 78, ], "type": "Punctuator", "value": "}", @@ -77734,333 +80743,87 @@ Object { } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 25, - 34, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 30, - 34, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - }, - ], - "range": Array [ - 23, - 36, - ], - "type": "ObjectExpression", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 19, - 37, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 18, - 37, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 53, - 56, - ], - "type": "Identifier", - }, - "kind": "get", + "body": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "ClassBody", + }, + "decorators": Array [ + Object { + "expression": Object { "loc": Object { "end": Object { - "column": 42, - "line": 3, + "column": 7, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 1, + "line": 1, }, }, + "name": "sealed", "range": Array [ - 18, - 80, + 1, + 7, ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 39, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 68, - 72, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 3, - }, - "start": Object { - "column": 35, - "line": 3, - }, - }, - "name": "_bar", - "range": Array [ - 73, - 77, - ], - "type": "Identifier", - }, - "range": Array [ - 68, - 77, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 40, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 3, - }, - }, - "range": Array [ - 61, - 78, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 59, - 80, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 42, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 56, - 80, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, + "type": "Identifier", }, - "start": Object { - "column": 12, - "line": 1, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", }, - "range": Array [ - 12, - 82, - ], - "type": "ClassBody", - }, + ], "id": Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { "column": 6, - "line": 1, + "line": 2, }, }, - "name": "Other", + "name": "Qux", "range": Array [ - 6, - 11, + 14, + 17, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 12, + "line": 2, }, "start": Object { "column": 0, @@ -78069,7 +80832,7 @@ Object { }, "range": Array [ 0, - 82, + 20, ], "superClass": null, "type": "ClassDeclaration", @@ -78078,8 +80841,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 12, + "line": 2, }, "start": Object { "column": 0, @@ -78088,14 +80851,14 @@ Object { }, "range": Array [ 0, - 82, + 20, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -78105,46 +80868,28 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 11, + 1, + 7, ], "type": "Identifier", - "value": "Other", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": "{", + "value": "sealed", }, Object { "loc": Object { @@ -78153,391 +80898,532 @@ Object { "line": 2, }, "start": Object { - "column": 4, + "column": 0, "line": 2, }, }, "range": Array [ - 18, - 19, + 8, + 13, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 2, }, "start": Object { - "column": 5, + "column": 6, "line": 2, }, }, "range": Array [ - 19, - 22, + 14, + 17, ], "type": "Identifier", - "value": "foo", + "value": "Qux", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 2, }, "start": Object { - "column": 8, + "column": 10, "line": 2, }, }, "range": Array [ - 22, - 23, + 18, + 19, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, "range": Array [ - 23, - 24, + 19, + 20, ], "type": "Punctuator", - "value": "{", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, }, + "range": Array [ + 56, + 58, + ], + "type": "ClassBody", }, - "range": Array [ - 25, - 28, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "selector", + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 17, + 32, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + }, + ], + "range": Array [ + 11, + 35, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "Component", + "range": Array [ + 1, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 36, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "Decorator", + }, ], - "type": "Identifier", - "value": "baz", - }, - Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "FooComponent", + "range": Array [ + 43, + 55, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 21, + "line": 4, }, "start": Object { - "column": 14, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 28, - 29, + 0, + 58, ], - "type": "Punctuator", - "value": ":", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 1, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 30, - 34, + 0, + 1, ], - "type": "Boolean", - "value": "true", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 21, - "line": 2, + "column": 1, + "line": 1, }, }, "range": Array [ - 35, - 36, + 1, + 10, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "Component", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 22, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 36, - 37, + 10, + 11, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 12, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 11, + "line": 1, }, }, "range": Array [ - 42, - 48, + 11, + 12, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 12, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 4, + "line": 2, }, }, "range": Array [ - 49, - 52, + 17, + 25, ], "type": "Identifier", - "value": "get", + "value": "selector", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 13, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 12, + "line": 2, }, }, "range": Array [ - 53, - 56, + 25, + 26, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { "column": 19, - "line": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 3, + "column": 14, + "line": 2, }, }, "range": Array [ - 56, - 57, + 27, + 32, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "'foo'", }, Object { "loc": Object { "end": Object { "column": 20, - "line": 3, + "line": 2, }, "start": Object { "column": 19, - "line": 3, + "line": 2, }, }, "range": Array [ - 57, - 58, + 32, + 33, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 1, "line": 3, }, "start": Object { - "column": 21, + "column": 0, "line": 3, }, }, "range": Array [ - 59, - 60, + 34, + 35, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 2, "line": 3, }, "start": Object { - "column": 23, + "column": 1, "line": 3, }, }, "range": Array [ - 61, - 67, + 35, + 36, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { - "column": 30, - "line": 3, + "column": 0, + "line": 4, }, }, "range": Array [ - 68, - 72, + 37, + 42, ], "type": "Keyword", - "value": "this", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 3, - }, - "start": Object { - "column": 34, - "line": 3, - }, - }, - "range": Array [ - 72, - 73, - ], - "type": "Punctuator", - "value": ".", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 3, + "column": 18, + "line": 4, }, "start": Object { - "column": 35, - "line": 3, + "column": 6, + "line": 4, }, }, "range": Array [ - 73, - 77, + 43, + 55, ], "type": "Identifier", - "value": "_bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 77, - 78, - ], - "type": "Punctuator", - "value": ";", + "value": "FooComponent", }, Object { "loc": Object { - "end": Object { - "column": 42, - "line": 3, + "end": Object { + "column": 20, + "line": 4, }, "start": Object { - "column": 41, - "line": 3, + "column": 19, + "line": 4, }, }, "range": Array [ - 79, - 80, + 56, + 57, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 21, "line": 4, }, "start": Object { - "column": 0, + "column": 20, "line": 4, }, }, "range": Array [ - 81, - 82, + 57, + 58, ], "type": "Punctuator", "value": "}", @@ -78547,7 +81433,7 @@ Object { } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -78558,9 +81444,48 @@ Object { "decorators": Array [ Object { "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 29, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 11, + "column": 20, "line": 2, }, "start": Object { @@ -78568,16 +81493,15 @@ Object { "line": 2, }, }, - "name": "hidden", "range": Array [ 15, - 21, + 30, ], - "type": "Identifier", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 11, + "column": 20, "line": 2, }, "start": Object { @@ -78587,7 +81511,7 @@ Object { }, "range": Array [ 14, - 21, + 30, ], "type": "Decorator", }, @@ -78595,25 +81519,25 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 18, "line": 3, }, "start": Object { - "column": 8, + "column": 4, "line": 3, }, }, - "name": "z", + "name": "instanceMethod", "range": Array [ - 30, - 31, + 35, + 49, ], "type": "Identifier", }, - "kind": "get", + "kind": "method", "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 3, }, "start": Object { @@ -78623,98 +81547,27 @@ Object { }, "range": Array [ 14, - 53, + 54, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 43, - 47, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "_z", - "range": Array [ - 48, - 50, - ], - "type": "Identifier", - }, - "range": Array [ - 43, - 50, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 36, - 51, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 3, }, "start": Object { - "column": 12, + "column": 21, "line": 3, }, }, "range": Array [ - 34, - 53, + 52, + 54, ], "type": "BlockStatement", }, @@ -78723,18 +81576,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 3, }, "start": Object { - "column": 9, + "column": 18, "line": 3, }, }, "params": Array [], "range": Array [ - 31, - 53, + 49, + 54, ], "type": "FunctionExpression", }, @@ -78752,7 +81605,7 @@ Object { }, "range": Array [ 8, - 55, + 56, ], "type": "ClassBody", }, @@ -78767,7 +81620,7 @@ Object { "line": 1, }, }, - "name": "P", + "name": "B", "range": Array [ 6, 7, @@ -78786,7 +81639,7 @@ Object { }, "range": Array [ 0, - 55, + 56, ], "superClass": null, "type": "ClassDeclaration", @@ -78795,8 +81648,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -78805,7 +81658,7 @@ Object { }, "range": Array [ 0, - 55, + 57, ], "sourceType": "module", "tokens": Array [ @@ -78843,7 +81696,7 @@ Object { 7, ], "type": "Identifier", - "value": "P", + "value": "B", }, Object { "loc": Object { @@ -78884,7 +81737,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 2, }, "start": Object { @@ -78894,61 +81747,25 @@ Object { }, "range": Array [ 15, - 21, - ], - "type": "Identifier", - "value": "hidden", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 26, - 29, - ], - "type": "Identifier", - "value": "get", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 30, - 31, + 23, ], "type": "Identifier", - "value": "z", + "value": "onlyRead", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 9, - "line": 3, + "column": 13, + "line": 2, }, }, "range": Array [ - 31, - 32, + 23, + 24, ], "type": "Punctuator", "value": "(", @@ -78956,143 +81773,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 32, - 33, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, + "column": 19, + "line": 2, }, "start": Object { - "column": 12, - "line": 3, + "column": 14, + "line": 2, }, }, "range": Array [ - 34, - 35, + 24, + 29, ], - "type": "Punctuator", - "value": "{", + "type": "Boolean", + "value": "false", }, Object { "loc": Object { "end": Object { "column": 20, - "line": 3, + "line": 2, }, "start": Object { - "column": 14, - "line": 3, + "column": 19, + "line": 2, }, }, "range": Array [ - 36, - 42, + 29, + 30, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 18, "line": 3, }, "start": Object { - "column": 21, + "column": 4, "line": 3, }, }, "range": Array [ - 43, - 47, + 35, + 49, ], - "type": "Keyword", - "value": "this", + "type": "Identifier", + "value": "instanceMethod", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 19, "line": 3, }, "start": Object { - "column": 25, + "column": 18, "line": 3, }, }, "range": Array [ - 47, - 48, + 49, + 50, ], "type": "Punctuator", - "value": ".", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 20, "line": 3, }, "start": Object { - "column": 26, + "column": 19, "line": 3, }, }, "range": Array [ - 48, 50, + 51, ], - "type": "Identifier", - "value": "_z", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 3, }, "start": Object { - "column": 28, + "column": 21, "line": 3, }, }, "range": Array [ - 50, - 51, + 52, + 53, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 3, }, "start": Object { - "column": 30, + "column": 22, "line": 3, }, }, "range": Array [ - 52, 53, + 54, ], "type": "Punctuator", "value": "}", @@ -79109,8 +81908,8 @@ Object { }, }, "range": Array [ - 54, 55, + 56, ], "type": "Punctuator", "value": "}", @@ -79120,7 +81919,7 @@ Object { } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -79131,199 +81930,130 @@ Object { "decorators": Array [ Object { "expression": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "adminonly", - "range": Array [ - 18, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 17, - 27, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "name": "y", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - }, - "kind": "set", - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 17, - 76, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 58, - 62, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, - }, - }, - "name": "_y", - "range": Array [ - 63, - 65, - ], - "type": "Identifier", - }, - "range": Array [ - 58, - 65, - ], - "type": "MemberExpression", - }, + "arguments": Array [ + Object { "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 14, + "line": 2, }, "start": Object { - "column": 8, - "line": 4, + "column": 9, + "line": 2, }, }, - "operator": "=", "range": Array [ - 58, - 69, + 19, + 24, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "name": "a", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - }, - "type": "AssignmentExpression", + "raw": "false", + "type": "Literal", + "value": false, }, + ], + "callee": Object { "loc": Object { "end": Object { - "column": 20, - "line": 4, + "column": 8, + "line": 2, }, "start": Object { - "column": 8, - "line": 4, + "column": 5, + "line": 2, }, }, + "name": "Foo", "range": Array [ - 58, - 70, + 15, + 18, ], - "type": "ExpressionStatement", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 25, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, }, + }, + "range": Array [ + 14, + 25, ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "staticMethod", + "range": Array [ + 37, + 49, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 54, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 28, + "line": 3, }, "start": Object { - "column": 20, + "column": 26, "line": 3, }, }, "range": Array [ - 48, - 76, + 52, + 54, ], "type": "BlockStatement", }, @@ -79332,37 +82062,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 28, + "line": 3, }, "start": Object { - "column": 16, + "column": 23, "line": 3, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 45, - 46, - ], - "type": "Identifier", - }, - ], + "params": Array [], "range": Array [ - 44, - 76, + 49, + 54, ], "type": "FunctionExpression", }, @@ -79371,23 +82082,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 4, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ - 11, - 78, + 8, + 56, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 1, }, "start": Object { @@ -79395,17 +82106,17 @@ Object { "line": 1, }, }, - "name": "User", + "name": "C", "range": Array [ 6, - 10, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -79414,7 +82125,7 @@ Object { }, "range": Array [ 0, - 78, + 56, ], "superClass": null, "type": "ClassDeclaration", @@ -79423,8 +82134,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -79433,7 +82144,7 @@ Object { }, "range": Array [ 0, - 78, + 57, ], "sourceType": "module", "tokens": Array [ @@ -79458,7 +82169,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 1, }, "start": Object { @@ -79468,25 +82179,25 @@ Object { }, "range": Array [ 6, - 10, + 7, ], "type": "Identifier", - "value": "User", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 9, "line": 1, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ - 11, - 12, + 8, + 9, ], "type": "Punctuator", "value": "{", @@ -79503,8 +82214,8 @@ Object { }, }, "range": Array [ - 17, - 18, + 14, + 15, ], "type": "Punctuator", "value": "@", @@ -79512,7 +82223,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 2, }, "start": Object { @@ -79521,260 +82232,170 @@ Object { }, }, "range": Array [ + 15, 18, - 27, ], "type": "Identifier", - "value": "adminonly", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 9, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 8, + "line": 2, }, }, "range": Array [ - 32, - 38, + 18, + 19, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 14, - "line": 3, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 9, + "line": 2, }, }, "range": Array [ - 39, - 42, + 19, + 24, ], - "type": "Identifier", - "value": "set", + "type": "Boolean", + "value": "false", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { "column": 15, - "line": 3, - }, - }, - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - "value": "y", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, + "line": 2, }, "start": Object { - "column": 16, - "line": 3, + "column": 14, + "line": 2, }, }, "range": Array [ - 44, - 45, + 24, + 25, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 10, "line": 3, }, "start": Object { - "column": 17, + "column": 4, "line": 3, }, }, "range": Array [ - 45, - 46, + 30, + 36, ], - "type": "Identifier", - "value": "a", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 23, "line": 3, }, "start": Object { - "column": 18, + "column": 11, "line": 3, }, }, "range": Array [ - 46, - 47, + 37, + 49, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "staticMethod", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 24, "line": 3, }, "start": Object { - "column": 20, + "column": 23, "line": 3, }, }, "range": Array [ - 48, 49, + 50, ], "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 58, - 62, - ], - "type": "Keyword", - "value": "this", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 62, - 63, - ], - "type": "Punctuator", - "value": ".", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, - }, - }, - "range": Array [ - 63, - 65, - ], - "type": "Identifier", - "value": "_y", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 25, + "line": 3, }, "start": Object { - "column": 16, - "line": 4, + "column": 24, + "line": 3, }, }, "range": Array [ - 66, - 67, + 50, + 51, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - "value": "a", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 4, + "column": 27, + "line": 3, }, "start": Object { - "column": 19, - "line": 4, + "column": 26, + "line": 3, }, }, "range": Array [ - 69, - 70, + 52, + 53, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 28, + "line": 3, }, "start": Object { - "column": 4, - "line": 5, + "column": 27, + "line": 3, }, }, "range": Array [ - 75, - 76, + 53, + 54, ], "type": "Punctuator", "value": "}", @@ -79783,16 +82404,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 4, }, "start": Object { "column": 0, - "line": 6, + "line": 4, }, }, "range": Array [ - 77, - 78, + 55, + 56, ], "type": "Punctuator", "value": "}", @@ -79802,87 +82423,166 @@ Object { } `; -exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = ` +exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [], + "body": Array [ + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "instanceMethod", + "range": Array [ + 28, + 42, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 47, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "type": "FunctionExpression", + }, + }, + ], "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 1, + "line": 4, }, "start": Object { - "column": 10, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 18, - 20, + 8, + 49, ], "type": "ClassBody", }, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "sealed", - "range": Array [ - 1, - 7, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 7, - ], - "type": "Decorator", - }, - ], "id": Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 7, + "line": 1, }, "start": Object { "column": 6, - "line": 2, + "line": 1, }, }, - "name": "Qux", + "name": "A", "range": Array [ - 14, - 17, + 6, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -79891,7 +82591,7 @@ Object { }, "range": Array [ 0, - 20, + 49, ], "superClass": null, "type": "ClassDeclaration", @@ -79900,8 +82600,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -79910,14 +82610,14 @@ Object { }, "range": Array [ 0, - 20, + 50, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -79927,10 +82627,10 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { @@ -79939,67 +82639,139 @@ Object { "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, + 6, 7, ], "type": "Identifier", - "value": "sealed", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ 8, - 13, + 9, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 2, }, "start": Object { - "column": 6, + "column": 4, "line": 2, }, }, "range": Array [ 14, - 17, + 15, ], - "type": "Identifier", - "value": "Qux", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 2, }, "start": Object { - "column": 10, + "column": 5, "line": 2, }, }, "range": Array [ - 18, - 19, + 15, + 23, + ], + "type": "Identifier", + "value": "onlyRead", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 28, + 42, + ], + "type": "Identifier", + "value": "instanceMethod", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, ], "type": "Punctuator", "value": "{", @@ -80007,17 +82779,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 23, + "line": 3, }, "start": Object { - "column": 11, - "line": 2, + "column": 22, + "line": 3, }, }, "range": Array [ - 19, - 20, + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -80027,182 +82817,165 @@ Object { } `; -exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = ` +exports[`typescript fixtures/decorators/method-decorators/method-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, - }, - "range": Array [ - 56, - 58, - ], - "type": "ClassBody", - }, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ + "body": Array [ + Object { + "computed": false, + "decorators": Array [ Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 8, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 4, + "line": 2, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "selector", - "range": Array [ - 17, - 25, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 17, - 32, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 27, - 32, - ], - "raw": "'foo'", - "type": "Literal", - "value": "foo", - }, - }, - ], "range": Array [ - 11, - 35, + 14, + 18, ], - "type": "ObjectExpression", + "type": "Decorator", }, ], - "callee": Object { + "key": Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 23, + "line": 3, }, "start": Object { - "column": 1, - "line": 1, + "column": 11, + "line": 3, }, }, - "name": "Component", + "name": "staticMethod", "range": Array [ - 1, - 10, + 30, + 42, ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { - "column": 2, + "column": 28, "line": 3, }, "start": Object { - "column": 1, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 1, - 36, + 14, + 47, ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "type": "FunctionExpression", }, }, - "range": Array [ - 0, - 36, - ], - "type": "Decorator", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - ], + "range": Array [ + 8, + 49, + ], + "type": "ClassBody", + }, "id": Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { "column": 6, - "line": 4, + "line": 1, }, }, - "name": "FooComponent", + "name": "D", "range": Array [ - 43, - 55, + 6, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 21, + "column": 1, "line": 4, }, "start": Object { @@ -80212,7 +82985,7 @@ Object { }, "range": Array [ 0, - 58, + 49, ], "superClass": null, "type": "ClassDeclaration", @@ -80221,8 +82994,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 21, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -80231,14 +83004,14 @@ Object { }, "range": Array [ 0, - 58, + 50, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -80248,241 +83021,205 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 10, + 6, + 7, ], "type": "Identifier", - "value": "Component", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, - ], - "type": "Punctuator", - "value": "{", + "value": "D", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 17, - 25, + 8, + 9, ], - "type": "Identifier", - "value": "selector", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 5, "line": 2, }, "start": Object { - "column": 12, + "column": 4, "line": 2, }, }, "range": Array [ - 25, - 26, + 14, + 15, ], "type": "Punctuator", - "value": ":", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 8, "line": 2, }, "start": Object { - "column": 14, + "column": 5, "line": 2, }, }, "range": Array [ - 27, - 32, + 15, + 18, ], - "type": "String", - "value": "'foo'", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 10, + "line": 3, }, "start": Object { - "column": 19, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 32, - 33, + 23, + 29, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 23, "line": 3, }, "start": Object { - "column": 0, + "column": 11, "line": 3, }, }, "range": Array [ - 34, - 35, + 30, + 42, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "staticMethod", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 24, "line": 3, }, "start": Object { - "column": 1, + "column": 23, "line": 3, }, }, "range": Array [ - 35, - 36, + 42, + 43, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 25, + "line": 3, }, "start": Object { - "column": 0, - "line": 4, + "column": 24, + "line": 3, }, }, "range": Array [ - 37, - 42, + 43, + 44, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 27, + "line": 3, }, "start": Object { - "column": 6, - "line": 4, + "column": 26, + "line": 3, }, }, "range": Array [ - 43, - 55, + 45, + 46, ], - "type": "Identifier", - "value": "FooComponent", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 4, + "column": 28, + "line": 3, }, "start": Object { - "column": 19, - "line": 4, + "column": 27, + "line": 3, }, }, "range": Array [ - 56, - 57, + 46, + 47, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 1, "line": 4, }, "start": Object { - "column": 20, + "column": 0, "line": 4, }, }, "range": Array [ - 57, - 58, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -80492,7 +83229,7 @@ Object { } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -80500,113 +83237,38 @@ Object { "body": Array [ Object { "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 24, - 29, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "onlyRead", - "range": Array [ - 15, - 23, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 15, - 30, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 30, - ], - "type": "Decorator", - }, - ], "key": Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 5, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 2, + "line": 2, }, }, - "name": "instanceMethod", + "name": "bar", "range": Array [ - 35, - 49, + 14, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ 14, - 54, + 49, ], "static": false, "type": "MethodDefinition", @@ -80616,17 +83278,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 21, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 52, - 54, + 47, + 49, ], "type": "BlockStatement", }, @@ -80635,18 +83297,165 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 18, - "line": 3, + "column": 5, + "line": 2, }, }, - "params": Array [], + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 32, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 32, + ], + "type": "Decorator", + }, + ], + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 45, + ], + "type": "ArrayPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], "range": Array [ + 17, 49, - 54, ], "type": "FunctionExpression", }, @@ -80655,23 +83464,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 56, + 10, + 51, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -80679,17 +83488,17 @@ Object { "line": 1, }, }, - "name": "B", + "name": "Foo", "range": Array [ 6, - 7, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -80698,7 +83507,7 @@ Object { }, "range": Array [ 0, - 56, + 51, ], "superClass": null, "type": "ClassDeclaration", @@ -80708,213 +83517,303 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 4, }, "start": Object { "column": 0, "line": 1, }, - }, - "range": Array [ - 0, - 57, - ], - "sourceType": "module", - "tokens": Array [ + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 6, + "line": 2, }, }, "range": Array [ - 0, - 5, + 18, + 19, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 6, - 7, + 19, + 26, ], "type": "Identifier", - "value": "B", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 8, - 9, + 26, + 27, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 19, "line": 2, }, "start": Object { - "column": 4, + "column": 15, "line": 2, }, }, "range": Array [ - 14, - 15, + 27, + 31, ], - "type": "Punctuator", - "value": "@", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 20, "line": 2, }, "start": Object { - "column": 5, + "column": 19, "line": 2, }, }, "range": Array [ - 15, - 23, + 31, + 32, ], - "type": "Identifier", - "value": "onlyRead", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 2, }, "start": Object { - "column": 13, + "column": 21, "line": 2, }, }, "range": Array [ - 23, - 24, + 33, + 34, ], "type": "Punctuator", - "value": "(", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 26, "line": 2, }, "start": Object { - "column": 14, + "column": 23, "line": 2, }, }, "range": Array [ - 24, - 29, + 35, + 38, ], - "type": "Boolean", - "value": "false", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 28, "line": 2, }, "start": Object { - "column": 19, + "column": 27, "line": 2, }, }, "range": Array [ - 29, - 30, + 39, + 40, ], "type": "Punctuator", - "value": ")", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 29, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 28, + "line": 2, }, }, "range": Array [ - 35, - 49, + 40, + 41, ], - "type": "Identifier", - "value": "instanceMethod", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 18, - "line": 3, + "column": 30, + "line": 2, }, }, "range": Array [ - 49, - 50, + 42, + 45, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 3, + "column": 34, + "line": 2, }, "start": Object { - "column": 19, - "line": 3, + "column": 33, + "line": 2, }, }, "range": Array [ - 50, - 51, + 45, + 46, ], "type": "Punctuator", "value": ")", @@ -80922,17 +83821,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 3, + "column": 36, + "line": 2, }, "start": Object { - "column": 21, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 52, - 53, + 47, + 48, ], "type": "Punctuator", "value": "{", @@ -80940,17 +83839,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 22, - "line": 3, + "column": 36, + "line": 2, }, }, "range": Array [ - 53, - 54, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -80959,16 +83858,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, - "line": 4, + "line": 3, }, }, "range": Array [ - 55, - 56, + 50, + 51, ], "type": "Punctuator", "value": "}", @@ -80978,7 +83877,7 @@ Object { } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` Object { "body": Array [ Object { @@ -80986,153 +83885,366 @@ Object { "body": Array [ Object { "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 113, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + }, + "range": Array [ + 81, + 91, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "operator": "=", + "range": Array [ + 81, + 106, + ], + "right": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "name": "config", + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + }, + "range": Array [ + 94, + 106, + ], + "type": "MemberExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 107, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 113, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "APP_CONFIG", + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "Inject", + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 51, + ], + "type": "CallExpression", + }, "loc": Object { "end": Object { - "column": 14, + "column": 35, "line": 2, }, "start": Object { - "column": 9, + "column": 16, "line": 2, }, }, "range": Array [ - 19, - 24, + 32, + 51, ], - "raw": "false", - "type": "Literal", - "value": false, + "type": "Decorator", }, ], - "callee": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "name": "config", + "range": Array [ + 52, + 69, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 8, + "column": 53, + "line": 2, + }, + "start": Object { + "column": 42, "line": 2, }, - "start": Object { - "column": 5, - "line": 2, + }, + "range": Array [ + 58, + 69, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "name": "AppConfig", + "range": Array [ + 60, + 69, + ], + "type": "Identifier", }, }, - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 15, - 25, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 25, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, }, - }, - "name": "staticMethod", - "range": Array [ - 37, - 49, ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 54, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "range": Array [ - 52, - 54, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 3, - }, - }, - "params": Array [], "range": Array [ - 49, - 54, + 31, + 113, ], "type": "FunctionExpression", }, @@ -81141,23 +84253,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, "range": Array [ - 8, - 56, + 14, + 115, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 1, }, "start": Object { @@ -81165,17 +84277,17 @@ Object { "line": 1, }, }, - "name": "C", + "name": "Service", "range": Array [ 6, - 7, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { "column": 0, @@ -81184,7 +84296,7 @@ Object { }, "range": Array [ 0, - 56, + 115, ], "superClass": null, "type": "ClassDeclaration", @@ -81194,7 +84306,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 6, }, "start": Object { "column": 0, @@ -81203,7 +84315,7 @@ Object { }, "range": Array [ 0, - 57, + 116, ], "sourceType": "module", "tokens": Array [ @@ -81228,7 +84340,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 1, }, "start": Object { @@ -81238,79 +84350,61 @@ Object { }, "range": Array [ 6, - 7, + 13, ], "type": "Identifier", - "value": "C", + "value": "Service", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 15, "line": 1, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, "range": Array [ 14, 15, ], "type": "Punctuator", - "value": "@", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 15, "line": 2, }, "start": Object { - "column": 5, + "column": 4, "line": 2, }, }, "range": Array [ - 15, - 18, + 20, + 31, ], "type": "Identifier", - "value": "Foo", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 2, }, "start": Object { - "column": 8, + "column": 15, "line": 2, }, }, "range": Array [ - 18, - 19, + 31, + 32, ], "type": "Punctuator", "value": "(", @@ -81318,486 +84412,236 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 19, - 24, - ], - "type": "Boolean", - "value": "false", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, + "column": 17, "line": 2, }, "start": Object { - "column": 14, + "column": 16, "line": 2, }, }, "range": Array [ - 24, - 25, + 32, + 33, ], "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 37, - 49, - ], - "type": "Identifier", - "value": "staticMethod", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 3, - }, - "start": Object { "column": 23, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "range": Array [ - 52, - 53, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 27, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "onlyRead", - "range": Array [ - 15, - 23, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 23, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "instanceMethod", - "range": Array [ - 28, - 42, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 47, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 45, - 47, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 42, - 47, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 49, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", }, + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + "value": "Inject", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 24, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 23, + "line": 2, }, }, "range": Array [ - 0, - 49, + 39, + 40, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, + "type": "Punctuator", + "value": "(", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + "value": "APP_CONFIG", }, - }, - "range": Array [ - 0, - 50, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 35, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 34, + "line": 2, }, }, "range": Array [ - 0, - 5, + 50, + 51, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 42, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 36, + "line": 2, }, }, "range": Array [ - 6, - 7, + 52, + 58, ], "type": "Identifier", - "value": "A", + "value": "config", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 43, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 42, + "line": 2, }, }, "range": Array [ - 8, - 9, + 58, + 59, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 53, "line": 2, }, "start": Object { - "column": 4, + "column": 44, "line": 2, }, }, "range": Array [ - 14, - 15, + 60, + 69, + ], + "type": "Identifier", + "value": "AppConfig", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, ], "type": "Punctuator", - "value": "@", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 56, "line": 2, }, "start": Object { - "column": 5, + "column": 55, "line": 2, }, }, "range": Array [ - 15, - 23, + 71, + 72, ], - "type": "Identifier", - "value": "onlyRead", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 12, "line": 3, }, "start": Object { - "column": 4, + "column": 8, "line": 3, }, }, "range": Array [ - 28, - 42, + 81, + 85, ], - "type": "Identifier", - "value": "instanceMethod", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 13, "line": 3, }, "start": Object { - "column": 18, + "column": 12, "line": 3, }, }, "range": Array [ - 42, - 43, + 85, + 86, ], "type": "Punctuator", - "value": "(", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "value": "title", }, Object { "loc": Object { @@ -81811,16 +84655,16 @@ Object { }, }, "range": Array [ - 43, - 44, + 92, + 93, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 27, "line": 3, }, "start": Object { @@ -81829,26 +84673,80 @@ Object { }, }, "range": Array [ - 45, - 46, + 94, + 100, + ], + "type": "Identifier", + "value": "config", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 100, + 101, ], "type": "Punctuator", - "value": "{", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 33, "line": 3, }, "start": Object { - "column": 22, + "column": 28, "line": 3, }, }, "range": Array [ - 46, - 47, + 101, + 106, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, ], "type": "Punctuator", "value": "}", @@ -81857,16 +84755,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { "column": 0, - "line": 4, + "line": 5, }, }, "range": Array [ - 48, - 49, + 114, + 115, ], "type": "Punctuator", "value": "}", @@ -81876,7 +84774,7 @@ Object { } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -81884,66 +84782,29 @@ Object { "body": Array [ Object { "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Decorator", - }, - ], "key": Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 7, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 4, + "line": 2, }, }, - "name": "staticMethod", + "name": "bar", "range": Array [ - 30, - 42, + 16, + 19, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 38, + "line": 2, }, "start": Object { "column": 4, @@ -81951,10 +84812,10 @@ Object { }, }, "range": Array [ - 14, - 47, + 16, + 50, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, @@ -81962,17 +84823,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 38, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 36, + "line": 2, }, }, "range": Array [ - 45, - 47, + 48, + 50, ], "type": "BlockStatement", }, @@ -81981,18 +84842,146 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 38, + "line": 2, }, "start": Object { - "column": 23, - "line": 3, + "column": 7, + "line": 2, }, }, - "params": Array [], + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 34, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 35, + 46, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], "range": Array [ - 42, - 47, + 19, + 50, ], "type": "FunctionExpression", }, @@ -82001,23 +84990,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 49, + 10, + 52, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -82025,17 +85014,17 @@ Object { "line": 1, }, }, - "name": "D", + "name": "Foo", "range": Array [ 6, - 7, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -82044,7 +85033,7 @@ Object { }, "range": Array [ 0, - 49, + 52, ], "superClass": null, "type": "ClassDeclaration", @@ -82054,7 +85043,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -82063,7 +85052,7 @@ Object { }, "range": Array [ 0, - 50, + 53, ], "sourceType": "module", "tokens": Array [ @@ -82088,7 +85077,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -82098,25 +85087,25 @@ Object { }, "range": Array [ 6, - 7, + 9, ], "type": "Identifier", - "value": "D", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -82124,7 +85113,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 2, }, "start": Object { @@ -82133,11 +85122,11 @@ Object { }, }, "range": Array [ - 14, - 15, + 16, + 19, ], - "type": "Punctuator", - "value": "@", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { @@ -82146,67 +85135,67 @@ Object { "line": 2, }, "start": Object { - "column": 5, + "column": 7, "line": 2, }, }, "range": Array [ - 15, - 18, + 19, + 20, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 9, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 8, + "line": 2, }, }, "range": Array [ - 23, - 29, + 20, + 21, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 16, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 9, + "line": 2, }, }, "range": Array [ - 30, - 42, + 21, + 28, ], "type": "Identifier", - "value": "staticMethod", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 3, + "column": 17, + "line": 2, }, "start": Object { - "column": 23, - "line": 3, + "column": 16, + "line": 2, }, }, "range": Array [ - 42, - 43, + 28, + 29, ], "type": "Punctuator", "value": "(", @@ -82214,48 +85203,102 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 21, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, + "column": 17, + "line": 2, }, }, "range": Array [ - 43, - 44, + 29, + 33, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, ], "type": "Punctuator", "value": ")", }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "baz", + }, Object { "loc": Object { "end": Object { "column": 27, - "line": 3, + "line": 2, }, "start": Object { "column": 26, - "line": 3, + "line": 2, }, }, "range": Array [ - 45, - 46, + 38, + 39, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { "column": 28, - "line": 3, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, }, "start": Object { - "column": 27, - "line": 3, + "column": 34, + "line": 2, }, }, "range": Array [ @@ -82263,22 +85306,58 @@ Object { 47, ], "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", "value": "}", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, - "line": 4, + "line": 3, }, }, "range": Array [ - 48, - 49, + 51, + 52, ], "type": "Punctuator", "value": "}", @@ -82288,7 +85367,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -82299,37 +85378,37 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 5, + "column": 14, "line": 2, }, "start": Object { - "column": 2, + "column": 11, "line": 2, }, }, "name": "bar", "range": Array [ - 14, - 17, + 29, + 32, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 14, - 49, + 22, + 63, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, @@ -82337,17 +85416,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 2, }, "start": Object { - "column": 35, + "column": 43, "line": 2, }, }, "range": Array [ - 47, - 49, + 61, + 63, ], "type": "BlockStatement", }, @@ -82356,11 +85435,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 2, }, "start": Object { - "column": 5, + "column": 14, "line": 2, }, }, @@ -82373,17 +85452,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 28, "line": 2, }, "start": Object { - "column": 15, + "column": 24, "line": 2, }, }, "range": Array [ - 27, - 31, + 42, + 46, ], "raw": "true", "type": "Literal", @@ -82393,128 +85472,109 @@ Object { "callee": Object { "loc": Object { "end": Object { - "column": 14, + "column": 23, "line": 2, }, "start": Object { - "column": 7, + "column": 16, "line": 2, }, }, "name": "special", "range": Array [ - 19, - 26, + 34, + 41, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 20, + "column": 29, "line": 2, }, "start": Object { - "column": 7, + "column": 16, "line": 2, }, }, "range": Array [ - 19, - 32, + 34, + 47, ], "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 20, + "column": 29, "line": 2, }, "start": Object { - "column": 6, + "column": 15, "line": 2, }, }, "range": Array [ - 18, - 32, + 33, + 47, ], "type": "Decorator", }, ], - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 35, - 38, - ], - "type": "Identifier", - }, - ], "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { - "column": 21, + "column": 30, "line": 2, }, }, + "name": "baz", "range": Array [ - 33, - 45, + 48, + 59, ], - "type": "ArrayPattern", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { - "column": 28, + "column": 33, "line": 2, }, }, "range": Array [ - 40, - 45, + 51, + 59, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { - "column": 30, + "column": 35, "line": 2, }, }, "range": Array [ - 42, - 45, + 53, + 59, ], - "type": "TSAnyKeyword", + "type": "TSNumberKeyword", }, }, }, ], "range": Array [ - 17, - 49, + 32, + 63, ], "type": "FunctionExpression", }, @@ -82526,20 +85586,20 @@ Object { "line": 3, }, "start": Object { - "column": 10, + "column": 16, "line": 1, }, }, "range": Array [ - 10, - 51, + 16, + 65, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 15, "line": 1, }, "start": Object { @@ -82547,10 +85607,10 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "StaticFoo", "range": Array [ 6, - 9, + 15, ], "type": "Identifier", }, @@ -82566,7 +85626,7 @@ Object { }, "range": Array [ 0, - 51, + 65, ], "superClass": null, "type": "ClassDeclaration", @@ -82585,7 +85645,7 @@ Object { }, "range": Array [ 0, - 52, + 66, ], "sourceType": "module", "tokens": Array [ @@ -82610,7 +85670,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 15, "line": 1, }, "start": Object { @@ -82620,25 +85680,25 @@ Object { }, "range": Array [ 6, - 9, + 15, ], "type": "Identifier", - "value": "Foo", + "value": "StaticFoo", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 17, "line": 1, }, "start": Object { - "column": 10, + "column": 16, "line": 1, }, }, "range": Array [ - 10, - 11, + 16, + 17, ], "type": "Punctuator", "value": "{", @@ -82646,197 +85706,179 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 14, - 17, + 22, + 28, ], - "type": "Identifier", - "value": "bar", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 14, "line": 2, }, "start": Object { - "column": 5, + "column": 11, "line": 2, }, }, "range": Array [ - 17, - 18, + 29, + 32, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 2, }, "start": Object { - "column": 6, + "column": 14, "line": 2, }, }, "range": Array [ - 18, - 19, + 32, + 33, ], "type": "Punctuator", - "value": "@", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 2, }, "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 19, - 26, - ], - "type": "Identifier", - "value": "special", - }, - Object { - "loc": Object { - "end": Object { "column": 15, "line": 2, }, - "start": Object { - "column": 14, - "line": 2, - }, }, "range": Array [ - 26, - 27, + 33, + 34, ], "type": "Punctuator", - "value": "(", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 23, "line": 2, }, "start": Object { - "column": 15, + "column": 16, "line": 2, }, }, "range": Array [ - 27, - 31, + 34, + 41, ], - "type": "Boolean", - "value": "true", + "type": "Identifier", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 2, }, "start": Object { - "column": 19, + "column": 23, "line": 2, }, }, "range": Array [ - 31, - 32, + 41, + 42, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 28, "line": 2, }, "start": Object { - "column": 21, + "column": 24, "line": 2, }, }, "range": Array [ - 33, - 34, + 42, + 46, ], - "type": "Punctuator", - "value": "[", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 29, "line": 2, }, "start": Object { - "column": 23, + "column": 28, "line": 2, }, }, "range": Array [ - 35, - 38, + 46, + 47, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 33, "line": 2, }, "start": Object { - "column": 27, + "column": 30, "line": 2, }, }, "range": Array [ - 39, - 40, + 48, + 51, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 34, "line": 2, }, "start": Object { - "column": 28, + "column": 33, "line": 2, }, }, "range": Array [ - 40, - 41, + 51, + 52, ], "type": "Punctuator", "value": ":", @@ -82844,35 +85886,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { - "column": 30, + "column": 35, "line": 2, }, }, "range": Array [ - 42, - 45, + 53, + 59, ], "type": "Identifier", - "value": "any", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 42, "line": 2, }, "start": Object { - "column": 33, + "column": 41, "line": 2, }, }, "range": Array [ - 45, - 46, + 59, + 60, ], "type": "Punctuator", "value": ")", @@ -82880,17 +85922,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 44, "line": 2, }, "start": Object { - "column": 35, + "column": 43, "line": 2, }, }, "range": Array [ - 47, - 48, + 61, + 62, ], "type": "Punctuator", "value": "{", @@ -82898,17 +85940,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 2, }, "start": Object { - "column": 36, + "column": 44, "line": 2, }, }, - "range": Array [ - 48, - 49, + "range": Array [ + 62, + 63, ], "type": "Punctuator", "value": "}", @@ -82925,8 +85967,8 @@ Object { }, }, "range": Array [ - 50, - 51, + 64, + 65, ], "type": "Punctuator", "value": "}", @@ -82936,7 +85978,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -82947,7 +85989,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 2, }, "start": Object { @@ -82955,14 +85997,14 @@ Object { "line": 2, }, }, - "name": "constructor", + "name": "greet", "range": Array [ 20, - 31, + 25, ], "type": "Identifier", }, - "kind": "constructor", + "kind": "method", "loc": Object { "end": Object { "column": 5, @@ -82975,7 +86017,7 @@ Object { }, "range": Array [ 20, - 113, + 95, ], "static": false, "type": "MethodDefinition", @@ -82984,134 +86026,101 @@ Object { "body": Object { "body": Array [ Object { - "expression": Object { + "argument": Object { "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "object": Object { + "left": Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 3, }, "start": Object { - "column": 8, + "column": 15, "line": 3, }, }, "range": Array [ - 81, - 85, + 67, + 75, ], - "type": "ThisExpression", + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", }, - "property": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 82, + ], + "right": Object { "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 3, }, "start": Object { - "column": 13, + "column": 26, "line": 3, }, }, - "name": "title", + "name": "name", "range": Array [ - 86, - 91, + 78, + 82, ], "type": "Identifier", }, - "range": Array [ - 81, - 91, - ], - "type": "MemberExpression", + "type": "BinaryExpression", }, "loc": Object { "end": Object { - "column": 33, + "column": 36, "line": 3, }, "start": Object { - "column": 8, + "column": 15, "line": 3, }, }, - "operator": "=", + "operator": "+", "range": Array [ - 81, - 106, + 67, + 88, ], "right": Object { - "computed": false, "loc": Object { "end": Object { - "column": 33, + "column": 36, "line": 3, }, "start": Object { - "column": 21, + "column": 33, "line": 3, }, }, - "object": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "name": "config", - "range": Array [ - 94, - 100, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, - }, - }, - "name": "title", - "range": Array [ - 101, - 106, - ], - "type": "Identifier", - }, "range": Array [ - 94, - 106, + 85, + 88, ], - "type": "MemberExpression", + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", }, - "type": "AssignmentExpression", + "type": "BinaryExpression", }, "loc": Object { "end": Object { - "column": 34, + "column": 37, "line": 3, }, "start": Object { @@ -83120,10 +86129,10 @@ Object { }, }, "range": Array [ - 81, - 107, + 60, + 89, ], - "type": "ExpressionStatement", + "type": "ReturnStatement", }, ], "loc": Object { @@ -83132,13 +86141,13 @@ Object { "line": 4, }, "start": Object { - "column": 55, + "column": 34, "line": 2, }, }, "range": Array [ - 71, - 113, + 50, + 95, ], "type": "BlockStatement", }, @@ -83151,7 +86160,7 @@ Object { "line": 4, }, "start": Object { - "column": 15, + "column": 9, "line": 2, }, }, @@ -83160,150 +86169,95 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": "APP_CONFIG", - "range": Array [ - 40, - 50, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "name": "Inject", - "range": Array [ - 33, - 39, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 35, + "column": 19, "line": 2, }, "start": Object { - "column": 17, + "column": 11, "line": 2, }, }, + "name": "required", "range": Array [ - 33, - 51, + 27, + 35, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 35, + "column": 19, "line": 2, }, "start": Object { - "column": 16, + "column": 10, "line": 2, }, }, "range": Array [ - 32, - 51, + 26, + 35, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 53, + "column": 32, "line": 2, }, "start": Object { - "column": 36, + "column": 20, "line": 2, }, }, - "name": "config", + "name": "name", "range": Array [ - 52, - 69, + 36, + 48, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 53, + "column": 32, "line": 2, }, "start": Object { - "column": 42, + "column": 24, "line": 2, }, }, "range": Array [ - 58, - 69, + 40, + 48, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 53, + "column": 32, "line": 2, }, "start": Object { - "column": 44, + "column": 26, "line": 2, }, }, "range": Array [ - 60, - 69, + 42, + 48, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 2, - }, - "start": Object { - "column": 44, - "line": 2, - }, - }, - "name": "AppConfig", - "range": Array [ - 60, - 69, - ], - "type": "Identifier", - }, + "type": "TSStringKeyword", }, }, }, ], "range": Array [ - 31, - 113, + 25, + 95, ], "type": "FunctionExpression", }, @@ -83321,7 +86275,7 @@ Object { }, "range": Array [ 14, - 115, + 97, ], "type": "ClassBody", }, @@ -83336,7 +86290,7 @@ Object { "line": 1, }, }, - "name": "Service", + "name": "Greeter", "range": Array [ 6, 13, @@ -83355,7 +86309,7 @@ Object { }, "range": Array [ 0, - 115, + 97, ], "superClass": null, "type": "ClassDeclaration", @@ -83374,7 +86328,7 @@ Object { }, "range": Array [ 0, - 116, + 98, ], "sourceType": "module", "tokens": Array [ @@ -83412,7 +86366,7 @@ Object { 13, ], "type": "Identifier", - "value": "Service", + "value": "Greeter", }, Object { "loc": Object { @@ -83435,7 +86389,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 2, }, "start": Object { @@ -83445,25 +86399,25 @@ Object { }, "range": Array [ 20, - 31, + 25, ], "type": "Identifier", - "value": "constructor", + "value": "greet", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 2, }, "start": Object { - "column": 15, + "column": 9, "line": 2, }, }, "range": Array [ - 31, - 32, + 25, + 26, ], "type": "Punctuator", "value": "(", @@ -83471,17 +86425,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 2, }, "start": Object { - "column": 16, + "column": 10, "line": 2, }, }, "range": Array [ - 32, - 33, + 26, + 27, ], "type": "Punctuator", "value": "@", @@ -83489,20 +86443,20 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 19, "line": 2, }, "start": Object { - "column": 17, + "column": 11, "line": 2, }, }, "range": Array [ - 33, - 39, + 27, + 35, ], "type": "Identifier", - "value": "Inject", + "value": "required", }, Object { "loc": Object { @@ -83511,21 +86465,21 @@ Object { "line": 2, }, "start": Object { - "column": 23, + "column": 20, "line": 2, }, }, "range": Array [ - 39, + 36, 40, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 25, "line": 2, }, "start": Object { @@ -83535,61 +86489,7 @@ Object { }, "range": Array [ 40, - 50, - ], - "type": "Identifier", - "value": "APP_CONFIG", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 2, - }, - "start": Object { - "column": 36, - "line": 2, - }, - }, - "range": Array [ - 52, - 58, - ], - "type": "Identifier", - "value": "config", - }, - Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 2, - }, - "start": Object { - "column": 42, - "line": 2, - }, - }, - "range": Array [ - 58, - 59, + 41, ], "type": "Punctuator", "value": ":", @@ -83597,35 +86497,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 53, + "column": 32, "line": 2, }, "start": Object { - "column": 44, + "column": 26, "line": 2, }, }, "range": Array [ - 60, - 69, + 42, + 48, ], "type": "Identifier", - "value": "AppConfig", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 54, + "column": 33, "line": 2, }, "start": Object { - "column": 53, + "column": 32, "line": 2, }, }, "range": Array [ - 69, - 70, + 48, + 49, ], "type": "Punctuator", "value": ")", @@ -83633,17 +86533,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 56, + "column": 35, "line": 2, }, "start": Object { - "column": 55, + "column": 34, "line": 2, }, }, "range": Array [ - 71, - 72, + 50, + 51, ], "type": "Punctuator", "value": "{", @@ -83651,7 +86551,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 3, }, "start": Object { @@ -83660,134 +86560,116 @@ Object { }, }, "range": Array [ - 81, - 85, + 60, + 66, ], "type": "Keyword", - "value": "this", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 85, - 86, - ], - "type": "Punctuator", - "value": ".", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 3, }, "start": Object { - "column": 13, + "column": 15, "line": 3, }, }, "range": Array [ - 86, - 91, + 67, + 75, ], - "type": "Identifier", - "value": "title", + "type": "String", + "value": "\\"Hello \\"", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 3, }, "start": Object { - "column": 19, + "column": 24, "line": 3, }, }, "range": Array [ - 92, - 93, + 76, + 77, ], "type": "Punctuator", - "value": "=", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 30, "line": 3, }, "start": Object { - "column": 21, + "column": 26, "line": 3, }, }, "range": Array [ - 94, - 100, + 78, + 82, ], "type": "Identifier", - "value": "config", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 32, "line": 3, }, "start": Object { - "column": 27, + "column": 31, "line": 3, }, }, "range": Array [ - 100, - 101, + 83, + 84, ], "type": "Punctuator", - "value": ".", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 36, "line": 3, }, "start": Object { - "column": 28, + "column": 33, "line": 3, }, }, "range": Array [ - 101, - 106, + 85, + 88, ], - "type": "Identifier", - "value": "title", + "type": "String", + "value": "\\"!\\"", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 37, "line": 3, }, "start": Object { - "column": 33, + "column": 36, "line": 3, }, }, "range": Array [ - 106, - 107, + 88, + 89, ], "type": "Punctuator", "value": ";", @@ -83804,8 +86686,8 @@ Object { }, }, "range": Array [ - 112, - 113, + 94, + 95, ], "type": "Punctuator", "value": "}", @@ -83822,8 +86704,8 @@ Object { }, }, "range": Array [ - 114, - 115, + 96, + 97, ], "type": "Punctuator", "value": "}", @@ -83833,7 +86715,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -83844,26 +86726,26 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 7, + "column": 16, "line": 2, }, "start": Object { - "column": 4, + "column": 11, "line": 2, }, }, - "name": "bar", + "name": "greet", "range": Array [ - 16, - 19, + 33, + 38, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { "column": 4, @@ -83871,28 +86753,138 @@ Object { }, }, "range": Array [ - 16, - 50, + 26, + 108, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 95, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 101, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 102, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 36, + "column": 41, "line": 2, }, }, "range": Array [ - 48, - 50, + 63, + 108, ], "type": "BlockStatement", }, @@ -83901,11 +86893,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 7, + "column": 16, "line": 2, }, }, @@ -83914,133 +86906,95 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 29, - 33, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 21, - 28, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 2, }, "start": Object { - "column": 9, + "column": 18, "line": 2, }, }, + "name": "required", "range": Array [ - 21, - 34, + 40, + 48, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 2, }, "start": Object { - "column": 8, + "column": 17, "line": 2, }, }, "range": Array [ - 20, - 34, + 39, + 48, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 34, + "column": 39, "line": 2, }, "start": Object { - "column": 23, + "column": 27, "line": 2, }, }, - "name": "baz", + "name": "name", "range": Array [ - 35, - 46, + 49, + 61, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, + "column": 39, "line": 2, }, "start": Object { - "column": 26, + "column": 31, "line": 2, }, }, "range": Array [ - 38, - 46, + 53, + 61, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, + "column": 39, "line": 2, }, "start": Object { - "column": 28, + "column": 33, "line": 2, }, }, "range": Array [ - 40, - 46, + 55, + 61, ], - "type": "TSNumberKeyword", + "type": "TSStringKeyword", }, }, }, ], "range": Array [ - 19, - 50, + 38, + 108, ], "type": "FunctionExpression", }, @@ -84049,23 +87003,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { - "column": 10, + "column": 20, "line": 1, }, }, "range": Array [ - 10, - 52, + 20, + 110, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 19, "line": 1, }, "start": Object { @@ -84073,17 +87027,17 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "StaticGreeter", "range": Array [ 6, - 9, + 19, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -84092,7 +87046,7 @@ Object { }, "range": Array [ 0, - 52, + 110, ], "superClass": null, "type": "ClassDeclaration", @@ -84102,7 +87056,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -84111,7 +87065,7 @@ Object { }, "range": Array [ 0, - 53, + 111, ], "sourceType": "module", "tokens": Array [ @@ -84136,7 +87090,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 19, "line": 1, }, "start": Object { @@ -84146,25 +87100,25 @@ Object { }, "range": Array [ 6, - 9, + 19, ], "type": "Identifier", - "value": "Foo", + "value": "StaticGreeter", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 21, "line": 1, }, "start": Object { - "column": 10, + "column": 20, "line": 1, }, }, "range": Array [ - 10, - 11, + 20, + 21, ], "type": "Punctuator", "value": "{", @@ -84172,7 +87126,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 2, }, "start": Object { @@ -84181,26 +87135,44 @@ Object { }, }, "range": Array [ - 16, - 19, + 26, + 32, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 33, + 38, ], "type": "Identifier", - "value": "bar", + "value": "greet", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 2, }, "start": Object { - "column": 7, + "column": 16, "line": 2, }, }, "range": Array [ - 19, - 20, + 38, + 39, ], "type": "Punctuator", "value": "(", @@ -84208,17 +87180,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 18, "line": 2, }, "start": Object { - "column": 8, + "column": 17, "line": 2, }, }, "range": Array [ - 20, - 21, + 39, + 40, ], "type": "Punctuator", "value": "@", @@ -84226,71 +87198,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 2, }, "start": Object { - "column": 9, + "column": 18, "line": 2, }, }, "range": Array [ - 21, - 28, + 40, + 48, ], "type": "Identifier", - "value": "special", + "value": "required", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 31, "line": 2, }, "start": Object { - "column": 16, + "column": 27, "line": 2, }, }, "range": Array [ - 28, - 29, + 49, + 53, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 39, "line": 2, }, "start": Object { - "column": 17, + "column": 33, "line": 2, }, }, "range": Array [ - 29, - 33, + 55, + 61, ], - "type": "Boolean", - "value": "true", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 40, "line": 2, }, "start": Object { - "column": 21, + "column": 39, "line": 2, }, }, "range": Array [ - 33, - 34, + 61, + 62, ], "type": "Punctuator", "value": ")", @@ -84298,107 +87288,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 42, "line": 2, }, "start": Object { - "column": 23, + "column": 41, "line": 2, }, }, "range": Array [ - 35, - 38, + 63, + 64, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 26, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 38, - 39, + 73, + 79, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "String", + "value": "\\"Hello \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, ], "type": "Punctuator", - "value": ":", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 30, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 26, + "line": 3, }, }, "range": Array [ - 40, - 46, + 91, + 95, ], "type": "Identifier", - "value": "number", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 2, + "column": 32, + "line": 3, }, "start": Object { - "column": 34, - "line": 2, + "column": 31, + "line": 3, }, }, "range": Array [ - 46, - 47, + 96, + 97, ], "type": "Punctuator", - "value": ")", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "type": "String", + "value": "\\"!\\"", }, Object { "loc": Object { "end": Object { "column": 37, - "line": 2, + "line": 3, }, "start": Object { "column": 36, - "line": 2, + "line": 3, }, }, "range": Array [ - 48, - 49, + 101, + 102, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 37, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 49, - 50, + 107, + 108, ], "type": "Punctuator", "value": "}", @@ -84407,16 +87451,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 51, - 52, + 109, + 110, ], "type": "Punctuator", "value": "}", @@ -84426,7 +87470,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-object-pattern-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -84437,37 +87481,37 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 14, + "column": 5, "line": 2, }, "start": Object { - "column": 11, + "column": 2, "line": 2, }, }, "name": "bar", "range": Array [ - 29, - 32, + 14, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 45, + "column": 37, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, - "range": Array [ - 22, - 63, + "range": Array [ + 14, + 49, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, @@ -84475,17 +87519,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 45, + "column": 37, "line": 2, }, "start": Object { - "column": 43, + "column": 35, "line": 2, }, }, "range": Array [ - 61, - 63, + 47, + 49, ], "type": "BlockStatement", }, @@ -84494,11 +87538,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 45, + "column": 37, "line": 2, }, "start": Object { - "column": 14, + "column": 5, "line": 2, }, }, @@ -84511,17 +87555,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 19, "line": 2, }, "start": Object { - "column": 24, + "column": 15, "line": 2, }, }, "range": Array [ - 42, - 46, + 27, + 31, ], "raw": "true", "type": "Literal", @@ -84531,109 +87575,167 @@ Object { "callee": Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 2, }, "start": Object { - "column": 16, + "column": 7, "line": 2, }, }, "name": "special", "range": Array [ - 34, - 41, + 19, + 26, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 29, + "column": 20, "line": 2, }, "start": Object { - "column": 16, + "column": 7, "line": 2, }, }, "range": Array [ - 34, - 47, + 19, + 32, ], "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 29, + "column": 20, "line": 2, }, "start": Object { - "column": 15, + "column": 6, "line": 2, }, }, "range": Array [ - 33, - 47, + 18, + 32, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 41, + "column": 33, "line": 2, }, "start": Object { - "column": 30, + "column": 21, "line": 2, }, }, - "name": "baz", + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 35, + 38, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + }, + ], "range": Array [ - 48, - 59, + 33, + 45, ], - "type": "Identifier", + "type": "ObjectPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 33, "line": 2, }, "start": Object { - "column": 33, + "column": 28, "line": 2, }, }, "range": Array [ - 51, - 59, + 40, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 33, "line": 2, }, "start": Object { - "column": 35, + "column": 30, "line": 2, }, }, "range": Array [ - 53, - 59, + 42, + 45, ], - "type": "TSNumberKeyword", + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 32, - 63, + 17, + 49, ], "type": "FunctionExpression", }, @@ -84645,20 +87747,20 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 65, + 10, + 51, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { @@ -84666,10 +87768,10 @@ Object { "line": 1, }, }, - "name": "StaticFoo", + "name": "Foo", "range": Array [ 6, - 15, + 9, ], "type": "Identifier", }, @@ -84685,7 +87787,7 @@ Object { }, "range": Array [ 0, - 65, + 51, ], "superClass": null, "type": "ClassDeclaration", @@ -84704,7 +87806,7 @@ Object { }, "range": Array [ 0, - 66, + 52, ], "sourceType": "module", "tokens": Array [ @@ -84729,7 +87831,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { @@ -84739,25 +87841,25 @@ Object { }, "range": Array [ 6, - 15, + 9, ], "type": "Identifier", - "value": "StaticFoo", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -84765,179 +87867,197 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 22, - 28, + 14, + 17, ], - "type": "Keyword", - "value": "static", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 6, "line": 2, }, "start": Object { - "column": 11, + "column": 5, "line": 2, }, }, "range": Array [ - 29, - 32, + 17, + 18, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 2, }, "start": Object { - "column": 14, + "column": 6, "line": 2, }, }, "range": Array [ - 32, - 33, + 18, + 19, ], "type": "Punctuator", - "value": "(", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 14, "line": 2, }, "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { "column": 15, "line": 2, }, + "start": Object { + "column": 14, + "line": 2, + }, }, "range": Array [ - 33, - 34, + 26, + 27, ], "type": "Punctuator", - "value": "@", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 19, "line": 2, }, "start": Object { - "column": 16, + "column": 15, "line": 2, }, }, "range": Array [ - 34, - 41, + 27, + 31, ], - "type": "Identifier", - "value": "special", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 20, "line": 2, }, "start": Object { - "column": 23, + "column": 19, "line": 2, }, }, "range": Array [ - 41, - 42, + 31, + 32, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 22, "line": 2, }, "start": Object { - "column": 24, + "column": 21, "line": 2, }, }, "range": Array [ - 42, - 46, + 33, + 34, ], - "type": "Boolean", - "value": "true", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 26, "line": 2, }, "start": Object { - "column": 28, + "column": 23, "line": 2, }, }, "range": Array [ - 46, - 47, + 35, + 38, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 28, "line": 2, }, "start": Object { - "column": 30, + "column": 27, "line": 2, }, }, "range": Array [ - 48, - 51, + 39, + 40, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 29, "line": 2, }, "start": Object { - "column": 33, + "column": 28, "line": 2, }, }, "range": Array [ - 51, - 52, + 40, + 41, ], "type": "Punctuator", "value": ":", @@ -84945,35 +88065,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 33, "line": 2, }, "start": Object { - "column": 35, + "column": 30, "line": 2, }, }, "range": Array [ - 53, - 59, + 42, + 45, ], "type": "Identifier", - "value": "number", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 34, "line": 2, }, "start": Object { - "column": 41, + "column": 33, "line": 2, }, }, "range": Array [ - 59, - 60, + 45, + 46, ], "type": "Punctuator", "value": ")", @@ -84981,17 +88101,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, + "column": 36, "line": 2, }, "start": Object { - "column": 43, + "column": 35, "line": 2, }, }, "range": Array [ - 61, - 62, + 47, + 48, ], "type": "Punctuator", "value": "{", @@ -84999,17 +88119,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, + "column": 37, "line": 2, }, "start": Object { - "column": 44, + "column": 36, "line": 2, }, }, "range": Array [ - 62, - 63, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -85026,8 +88146,8 @@ Object { }, }, "range": Array [ - 64, - 65, + 50, + 51, ], "type": "Punctuator", "value": "}", @@ -85037,7 +88157,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -85048,156 +88168,46 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, - "name": "greet", + "name": "bar", "range": Array [ - 20, - 25, + 14, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 95, + 14, + 48, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 67, - 75, - ], - "raw": "\\"Hello \\"", - "type": "Literal", - "value": "Hello ", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 67, - 82, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 78, - 82, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 67, - 88, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 85, - 88, - ], - "raw": "\\"!\\"", - "type": "Literal", - "value": "!", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 60, - 89, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { "column": 34, @@ -85205,8 +88215,8 @@ Object { }, }, "range": Array [ - 50, - 95, + 46, + 48, ], "type": "BlockStatement", }, @@ -85215,49 +88225,105 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 9, + "column": 5, "line": 2, }, }, "params": Array [ Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + }, "decorators": Array [ Object { "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 2, }, "start": Object { - "column": 11, + "column": 7, "line": 2, }, }, - "name": "required", "range": Array [ - 27, - 35, + 19, + 32, ], - "type": "Identifier", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 2, }, "start": Object { - "column": 10, + "column": 6, "line": 2, }, }, "range": Array [ - 26, - 35, + 18, + 32, ], "type": "Decorator", }, @@ -85268,16 +88334,15 @@ Object { "line": 2, }, "start": Object { - "column": 20, + "column": 6, "line": 2, }, }, - "name": "name", "range": Array [ - 36, - 48, + 18, + 44, ], - "type": "Identifier", + "type": "RestElement", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -85285,13 +88350,13 @@ Object { "line": 2, }, "start": Object { - "column": 24, + "column": 27, "line": 2, }, }, "range": Array [ - 40, - 48, + 39, + 44, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { @@ -85301,22 +88366,22 @@ Object { "line": 2, }, "start": Object { - "column": 26, + "column": 29, "line": 2, }, }, "range": Array [ - 42, - 48, + 41, + 44, ], - "type": "TSStringKeyword", + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 25, - 95, + 17, + 48, ], "type": "FunctionExpression", }, @@ -85325,23 +88390,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 97, + 10, + 50, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -85349,17 +88414,17 @@ Object { "line": 1, }, }, - "name": "Greeter", + "name": "Foo", "range": Array [ 6, - 13, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -85368,7 +88433,7 @@ Object { }, "range": Array [ 0, - 97, + 50, ], "superClass": null, "type": "ClassDeclaration", @@ -85378,7 +88443,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -85387,7 +88452,7 @@ Object { }, "range": Array [ 0, - 98, + 51, ], "sourceType": "module", "tokens": Array [ @@ -85412,7 +88477,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -85422,25 +88487,25 @@ Object { }, "range": Array [ 6, - 13, + 9, ], "type": "Identifier", - "value": "Greeter", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -85448,35 +88513,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 25, + 14, + 17, ], "type": "Identifier", - "value": "greet", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 6, "line": 2, }, "start": Object { - "column": 9, + "column": 5, "line": 2, }, }, "range": Array [ - 25, - 26, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -85484,17 +88549,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 2, }, "start": Object { - "column": 10, + "column": 6, "line": 2, }, }, "range": Array [ - 26, - 27, + 18, + 19, ], "type": "Punctuator", "value": "@", @@ -85502,89 +88567,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 27, - 35, - ], - "type": "Identifier", - "value": "required", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, + "column": 14, "line": 2, }, "start": Object { - "column": 20, + "column": 7, "line": 2, }, }, "range": Array [ - 36, - 40, + 19, + 26, ], "type": "Identifier", - "value": "name", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 2, }, "start": Object { - "column": 24, + "column": 14, "line": 2, }, }, "range": Array [ - 40, - 41, + 26, + 27, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 19, "line": 2, }, "start": Object { - "column": 26, + "column": 15, "line": 2, }, }, "range": Array [ - 42, - 48, + 27, + 31, ], - "type": "Identifier", - "value": "string", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 20, "line": 2, }, "start": Object { - "column": 32, + "column": 19, "line": 2, }, }, "range": Array [ - 48, - 49, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -85592,161 +88639,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 24, "line": 2, }, "start": Object { - "column": 34, + "column": 21, "line": 2, }, }, "range": Array [ - 50, - 51, + 33, + 36, ], "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 60, - 66, - ], - "type": "Keyword", - "value": "return", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 27, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 24, + "line": 2, }, }, "range": Array [ - 67, - 75, + 36, + 39, ], - "type": "String", - "value": "\\"Hello \\"", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 28, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, + "column": 27, + "line": 2, }, }, "range": Array [ - 76, - 77, + 39, + 40, ], "type": "Punctuator", - "value": "+", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 32, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 29, + "line": 2, }, }, "range": Array [ - 78, - 82, + 41, + 44, ], "type": "Identifier", - "value": "name", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 31, - "line": 3, + "column": 32, + "line": 2, }, }, "range": Array [ - 83, - 84, + 44, + 45, ], "type": "Punctuator", - "value": "+", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 85, - 88, - ], - "type": "String", - "value": "\\"!\\"", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 35, + "line": 2, }, "start": Object { - "column": 36, - "line": 3, + "column": 34, + "line": 2, }, }, "range": Array [ - 88, - 89, + 46, + 47, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 4, - "line": 4, + "column": 35, + "line": 2, }, }, "range": Array [ - 94, - 95, + 47, + 48, ], "type": "Punctuator", "value": "}", @@ -85755,16 +88766,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 96, - 97, + 49, + 50, ], "type": "Punctuator", "value": "}", @@ -85774,7 +88785,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -85782,280 +88793,223 @@ Object { "body": Array [ Object { "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Input", + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "Decorator", + }, + ], "key": Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 2, }, "start": Object { - "column": 11, + "column": 13, "line": 2, }, }, - "name": "greet", + "name": "data", "range": Array [ - 33, - 38, + 35, + 39, ], "type": "Identifier", }, - "kind": "method", "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 26, - 108, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 80, - 88, - ], - "raw": "\\"Hello \\"", - "type": "Literal", - "value": "Hello ", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 80, - 95, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 91, - 95, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 80, - 101, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 98, - 101, - ], - "raw": "\\"!\\"", - "type": "Literal", - "value": "!", - }, - "type": "BinaryExpression", - }, + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 40, + ], + "static": false, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { "loc": Object { "end": Object { - "column": 37, + "column": 11, "line": 3, }, "start": Object { - "column": 8, + "column": 5, "line": 3, }, }, + "name": "Output", "range": Array [ - 73, - 102, + 46, + 52, ], - "type": "ReturnStatement", + "type": "Identifier", }, - ], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 54, + ], + "type": "CallExpression", + }, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 13, + "line": 3, }, "start": Object { - "column": 41, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 63, - 108, + 45, + 54, ], - "type": "BlockStatement", + "type": "Decorator", }, - "expression": false, - "generator": false, - "id": null, + ], + "key": Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 4, }, "start": Object { - "column": 16, - "line": 2, + "column": 4, + "line": 4, }, }, - "params": Array [ - Object { - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "required", - "range": Array [ - 40, - 48, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 39, - 48, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, + "name": "click", + "range": Array [ + 59, + 64, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 86, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, }, - "name": "name", - "range": Array [ - 49, - 61, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 31, - "line": 2, - }, - }, - "range": Array [ - 53, - 61, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 33, - "line": 2, - }, - }, - "range": Array [ - 55, - 61, - ], - "type": "TSStringKeyword", - }, + "start": Object { + "column": 16, + "line": 4, }, }, - ], + "name": "EventEmitter", + "range": Array [ + 71, + 83, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, "range": Array [ - 38, - 108, + 67, + 85, ], - "type": "FunctionExpression", + "type": "NewExpression", }, }, ], @@ -86071,7 +89025,7 @@ Object { }, "range": Array [ 20, - 110, + 88, ], "type": "ClassBody", }, @@ -86086,7 +89040,7 @@ Object { "line": 1, }, }, - "name": "StaticGreeter", + "name": "SomeComponent", "range": Array [ 6, 19, @@ -86105,7 +89059,7 @@ Object { }, "range": Array [ 0, - 110, + 88, ], "superClass": null, "type": "ClassDeclaration", @@ -86114,8 +89068,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 0, - "line": 6, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -86124,7 +89078,7 @@ Object { }, "range": Array [ 0, - 111, + 88, ], "sourceType": "module", "tokens": Array [ @@ -86162,7 +89116,7 @@ Object { 19, ], "type": "Identifier", - "value": "StaticGreeter", + "value": "SomeComponent", }, Object { "loc": Object { @@ -86185,7 +89139,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 5, "line": 2, }, "start": Object { @@ -86195,43 +89149,43 @@ Object { }, "range": Array [ 26, - 32, + 27, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 2, }, "start": Object { - "column": 11, + "column": 5, "line": 2, }, }, "range": Array [ - 33, - 38, + 27, + 32, ], "type": "Identifier", - "value": "greet", + "value": "Input", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 2, }, "start": Object { - "column": 16, + "column": 10, "line": 2, }, }, "range": Array [ - 38, - 39, + 32, + 33, ], "type": "Punctuator", "value": "(", @@ -86239,272 +89193,254 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 12, "line": 2, }, "start": Object { - "column": 17, + "column": 11, "line": 2, }, }, "range": Array [ - 39, - 40, + 33, + 34, ], "type": "Punctuator", - "value": "@", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 17, "line": 2, }, "start": Object { - "column": 18, + "column": 13, "line": 2, }, }, "range": Array [ - 40, - 48, + 35, + 39, ], "type": "Identifier", - "value": "required", + "value": "data", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 18, "line": 2, }, "start": Object { - "column": 27, + "column": 17, "line": 2, }, }, "range": Array [ - 49, - 53, + 39, + 40, ], - "type": "Identifier", - "value": "name", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 31, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 53, - 54, + 45, + 46, ], "type": "Punctuator", - "value": ":", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 33, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 55, - 61, + 46, + 52, ], "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 2, - }, - "start": Object { - "column": 39, - "line": 2, - }, - }, - "range": Array [ - 61, - 62, - ], - "type": "Punctuator", - "value": ")", + "value": "Output", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 2, + "column": 12, + "line": 3, }, "start": Object { - "column": 41, - "line": 2, + "column": 11, + "line": 3, }, }, "range": Array [ - 63, - 64, + 52, + 53, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 3, }, "start": Object { - "column": 8, + "column": 12, "line": 3, }, }, "range": Array [ - 73, - 79, + 53, + 54, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 9, + "line": 4, }, "start": Object { - "column": 15, - "line": 3, + "column": 4, + "line": 4, }, }, "range": Array [ - 80, - 88, + 59, + 64, ], - "type": "String", - "value": "\\"Hello \\"", + "type": "Identifier", + "value": "click", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 11, + "line": 4, }, "start": Object { - "column": 24, - "line": 3, + "column": 10, + "line": 4, }, }, "range": Array [ - 89, - 90, + 65, + 66, ], "type": "Punctuator", - "value": "+", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 15, + "line": 4, }, "start": Object { - "column": 26, - "line": 3, + "column": 12, + "line": 4, }, }, "range": Array [ - 91, - 95, + 67, + 70, ], - "type": "Identifier", - "value": "name", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 28, + "line": 4, }, "start": Object { - "column": 31, - "line": 3, + "column": 16, + "line": 4, }, }, "range": Array [ - 96, - 97, + 71, + 83, ], - "type": "Punctuator", - "value": "+", + "type": "Identifier", + "value": "EventEmitter", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 3, + "column": 29, + "line": 4, }, "start": Object { - "column": 33, - "line": 3, + "column": 28, + "line": 4, }, }, "range": Array [ - 98, - 101, + 83, + 84, ], - "type": "String", - "value": "\\"!\\"", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 30, + "line": 4, }, "start": Object { - "column": 36, - "line": 3, + "column": 29, + "line": 4, }, }, "range": Array [ - 101, - 102, + 84, + 85, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 31, "line": 4, }, "start": Object { - "column": 4, + "column": 30, "line": 4, }, }, "range": Array [ - 107, - 108, + 85, + 86, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { @@ -86518,8 +89454,8 @@ Object { }, }, "range": Array [ - 109, - 110, + 87, + 88, ], "type": "Punctuator", "value": "}", @@ -86529,7 +89465,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-object-pattern-decorator.src 1`] = ` +exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -86537,289 +89473,251 @@ Object { "body": Array [ Object { "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 32, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "configurable", + "range": Array [ + 15, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 33, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 33, + ], + "type": "Decorator", + }, + ], "key": Object { "loc": Object { "end": Object { - "column": 5, + "column": 36, "line": 2, }, "start": Object { - "column": 2, + "column": 31, "line": 2, }, }, - "name": "bar", + "name": "prop1", "range": Array [ - 14, - 17, + 41, + 46, ], "type": "Identifier", }, - "kind": "method", "loc": Object { "end": Object { "column": 37, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ 14, - 49, + 47, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 35, - "line": 2, - }, - }, - "range": Array [ - 47, - 49, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "params": Array [ - Object { - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 27, - 31, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 19, - 26, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 19, - 32, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 18, - 32, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "properties": Array [ + "static": true, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 35, - 38, - ], - "type": "Identifier", - }, - "kind": "init", "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 23, + "line": 4, }, "start": Object { - "column": 23, - "line": 2, + "column": 18, + "line": 4, }, }, - "method": false, "range": Array [ - 35, - 38, + 67, + 72, ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 35, - 38, - ], - "type": "Identifier", - }, + "raw": "false", + "type": "Literal", + "value": false, }, ], - "range": Array [ - 33, - 45, - ], - "type": "ObjectPattern", - "typeAnnotation": Object { + "callee": Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 17, + "line": 4, }, "start": Object { - "column": 28, - "line": 2, + "column": 5, + "line": 4, }, }, + "name": "configurable", "range": Array [ - 40, - 45, + 54, + 66, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 42, - 45, - ], - "type": "TSAnyKeyword", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, }, }, + "range": Array [ + 54, + 73, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, - ], + "range": Array [ + 53, + 73, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "name": "prop2", "range": Array [ - 17, - 49, + 85, + 90, ], - "type": "FunctionExpression", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, + "range": Array [ + 53, + 91, + ], + "static": true, + "type": "ClassProperty", + "value": null, }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 51, + 8, + 93, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { @@ -86827,17 +89725,17 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "A", "range": Array [ 6, - 9, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { "column": 0, @@ -86846,7 +89744,7 @@ Object { }, "range": Array [ 0, - 51, + 93, ], "superClass": null, "type": "ClassDeclaration", @@ -86855,8 +89753,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 1, + "line": 6, }, "start": Object { "column": 0, @@ -86865,7 +89763,7 @@ Object { }, "range": Array [ 0, - 52, + 93, ], "sourceType": "module", "tokens": Array [ @@ -86890,7 +89788,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { @@ -86900,25 +89798,25 @@ Object { }, "range": Array [ 6, - 9, + 7, ], "type": "Identifier", - "value": "Foo", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 11, + 8, + 9, ], "type": "Punctuator", "value": "{", @@ -86930,21 +89828,21 @@ Object { "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ 14, - 17, + 15, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 17, "line": 2, }, "start": Object { @@ -86953,260 +89851,278 @@ Object { }, }, "range": Array [ - 17, - 18, + 15, + 27, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "configurable", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 18, "line": 2, }, "start": Object { - "column": 6, + "column": 17, "line": 2, }, }, "range": Array [ - 18, - 19, + 27, + 28, ], "type": "Punctuator", - "value": "@", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 2, }, "start": Object { - "column": 7, + "column": 18, "line": 2, }, }, "range": Array [ - 19, - 26, + 28, + 32, ], - "type": "Identifier", - "value": "special", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 2, }, "start": Object { - "column": 14, + "column": 22, "line": 2, }, }, "range": Array [ - 26, - 27, + 32, + 33, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 30, "line": 2, }, "start": Object { - "column": 15, + "column": 24, "line": 2, }, }, "range": Array [ - 27, - 31, + 34, + 40, ], - "type": "Boolean", - "value": "true", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 36, "line": 2, }, "start": Object { - "column": 19, + "column": 31, "line": 2, }, }, "range": Array [ - 31, - 32, + 41, + 46, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "prop1", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 37, "line": 2, }, "start": Object { - "column": 21, + "column": 36, "line": 2, }, }, "range": Array [ - 33, - 34, + 46, + 47, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 23, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 35, - 38, + 53, + 54, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 54, + 66, ], "type": "Identifier", - "value": "bar", + "value": "configurable", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 18, + "line": 4, }, "start": Object { - "column": 27, - "line": 2, + "column": 17, + "line": 4, }, }, "range": Array [ - 39, - 40, + 66, + 67, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 23, + "line": 4, }, "start": Object { - "column": 28, - "line": 2, + "column": 18, + "line": 4, }, }, "range": Array [ - 40, - 41, + 67, + 72, ], - "type": "Punctuator", - "value": ":", + "type": "Boolean", + "value": "false", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 24, + "line": 4, }, "start": Object { - "column": 30, - "line": 2, + "column": 23, + "line": 4, }, }, "range": Array [ - 42, - 45, + 72, + 73, ], - "type": "Identifier", - "value": "any", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 10, + "line": 5, }, "start": Object { - "column": 33, - "line": 2, + "column": 4, + "line": 5, }, }, "range": Array [ - 45, - 46, + 78, + 84, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 16, + "line": 5, }, "start": Object { - "column": 35, - "line": 2, + "column": 11, + "line": 5, }, }, "range": Array [ - 47, - 48, + 85, + 90, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "prop2", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 17, + "line": 5, }, "start": Object { - "column": 36, - "line": 2, + "column": 16, + "line": 5, }, }, "range": Array [ - 48, - 49, + 90, + 91, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { "column": 0, - "line": 3, + "line": 6, }, }, "range": Array [ - 50, - 51, + 92, + 93, ], "type": "Punctuator", "value": "}", @@ -87216,7 +90132,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = ` +exports[`typescript fixtures/decorators/property-decorators/property-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -87224,248 +90140,175 @@ Object { "body": Array [ Object { "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], "key": Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 2, }, "start": Object { - "column": 2, + "column": 9, "line": 2, }, }, - "name": "bar", + "name": "x", "range": Array [ - 14, - 17, + 19, + 20, ], "type": "Identifier", }, - "kind": "method", "loc": Object { "end": Object { - "column": 36, + "column": 11, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ 14, - 48, + 21, ], "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 8, + "line": 3, }, "start": Object { - "column": 34, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 46, - 48, + 26, + 30, ], - "type": "BlockStatement", + "type": "Decorator", }, - "expression": false, - "generator": false, - "id": null, + ], + "key": Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 5, - "line": 2, + "column": 4, + "line": 4, }, }, - "params": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 36, - 39, - ], - "type": "Identifier", - }, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 27, - 31, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 19, - 26, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 19, - 32, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 18, - 32, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 18, - 44, - ], - "type": "RestElement", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "range": Array [ - 39, - 44, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 41, - 44, - ], - "type": "TSAnyKeyword", - }, - }, - }, - ], + "name": "y", "range": Array [ - 17, - 48, + 35, + 36, ], - "type": "FunctionExpression", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, }, + "range": Array [ + 26, + 37, + ], + "static": false, + "type": "ClassProperty", + "value": null, }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 50, + 8, + 39, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { @@ -87473,368 +90316,260 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "B", "range": Array [ 6, - 9, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 50, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 51, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, + "line": 5, }, "start": Object { - "column": 6, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 18, - 19, + 0, + 39, ], - "type": "Punctuator", - "value": "@", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 19, - 26, + 0, + 5, ], - "type": "Identifier", - "value": "special", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 7, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 26, - 27, + 6, + 7, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "B", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 27, - 31, + 8, + 9, ], - "type": "Boolean", - "value": "true", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 5, "line": 2, }, "start": Object { - "column": 19, + "column": 4, "line": 2, }, }, "range": Array [ - 31, - 32, + 14, + 15, ], "type": "Punctuator", - "value": ")", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 8, "line": 2, }, "start": Object { - "column": 21, + "column": 5, "line": 2, }, }, "range": Array [ - 33, - 36, + 15, + 18, ], - "type": "Punctuator", - "value": "...", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 10, "line": 2, }, "start": Object { - "column": 24, + "column": 9, "line": 2, }, }, "range": Array [ - 36, - 39, + 19, + 20, ], "type": "Identifier", - "value": "foo", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 11, "line": 2, }, "start": Object { - "column": 27, + "column": 10, "line": 2, }, }, "range": Array [ - 39, - 40, + 20, + 21, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 29, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 41, - 44, + 26, + 27, ], - "type": "Identifier", - "value": "any", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 8, + "line": 3, }, "start": Object { - "column": 32, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 44, - 45, + 27, + 30, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 34, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 46, - 47, + 35, + 36, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 6, + "line": 4, }, "start": Object { - "column": 35, - "line": 2, + "column": 5, + "line": 4, }, }, "range": Array [ - 47, - 48, + 36, + 37, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 49, - 50, + 38, + 39, ], "type": "Punctuator", "value": "}", @@ -87844,7 +90579,7 @@ Object { } `; -exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/property-decorators/property-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -87855,28 +90590,9 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "Input", - "range": Array [ - 27, - 32, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 2, }, "start": Object { @@ -87884,15 +90600,16 @@ Object { "line": 2, }, }, + "name": "baz", "range": Array [ - 27, - 34, + 15, + 18, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 2, }, "start": Object { @@ -87901,8 +90618,8 @@ Object { }, }, "range": Array [ - 26, - 34, + 14, + 18, ], "type": "Decorator", }, @@ -87914,14 +90631,14 @@ Object { "line": 2, }, "start": Object { - "column": 13, + "column": 16, "line": 2, }, }, - "name": "data", + "name": "a", "range": Array [ - 35, - 39, + 26, + 27, ], "type": "Identifier", }, @@ -87936,10 +90653,10 @@ Object { }, }, "range": Array [ - 26, - 40, + 14, + 28, ], - "static": false, + "static": true, "type": "ClassProperty", "value": null, }, @@ -87948,28 +90665,9 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "Output", - "range": Array [ - 46, - 52, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 3, }, "start": Object { @@ -87977,15 +90675,16 @@ Object { "line": 3, }, }, + "name": "qux", "range": Array [ - 46, - 54, + 34, + 37, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 3, }, "start": Object { @@ -87994,8 +90693,8 @@ Object { }, }, "range": Array [ - 45, - 54, + 33, + 37, ], "type": "Decorator", }, @@ -88003,24 +90702,24 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 4, }, "start": Object { - "column": 4, + "column": 11, "line": 4, }, }, - "name": "click", + "name": "b", "range": Array [ - 59, - 64, + 49, + 50, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 31, + "column": 13, "line": 4, }, "start": Object { @@ -88029,69 +90728,366 @@ Object { }, }, "range": Array [ - 45, - 86, + 33, + 51, ], - "static": false, + "static": true, "type": "ClassProperty", - "value": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 4, - }, - "start": Object { - "column": 16, - "line": 4, - }, - }, - "name": "EventEmitter", - "range": Array [ - 71, - 83, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 67, - 85, - ], - "type": "NewExpression", - }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 53, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 6, + 7, ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-empty-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 20, + "column": 18, "line": 1, }, }, "range": Array [ - 20, - 88, + 18, + 22, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { @@ -88099,17 +91095,17 @@ Object { "line": 1, }, }, - "name": "SomeComponent", + "name": "Foo", "range": Array [ 6, - 19, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -88118,7 +91114,7 @@ Object { }, "range": Array [ 0, - 88, + 22, ], "superClass": null, "type": "ClassDeclaration", @@ -88127,8 +91123,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -88137,7 +91133,7 @@ Object { }, "range": Array [ 0, - 88, + 23, ], "sourceType": "module", "tokens": Array [ @@ -88162,7 +91158,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { @@ -88172,25 +91168,43 @@ Object { }, "range": Array [ 6, - 19, + 9, ], "type": "Identifier", - "value": "SomeComponent", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 1, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, "range": Array [ - 20, - 21, + 10, + 17, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, ], "type": "Punctuator", "value": "{", @@ -88198,323 +91212,484 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 26, - 27, + 21, + 22, ], "type": "Punctuator", - "value": "@", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-empty-extends-implements.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "TSClassImplements", + }, + ], "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 5, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 27, - 32, + 0, + 37, ], - "type": "Identifier", - "value": "Input", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 32, - 33, + 0, + 5, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 33, - 34, + 6, + 9, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { "column": 17, - "line": 2, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 35, - 39, + 10, + 17, ], - "type": "Identifier", - "value": "data", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { "column": 18, - "line": 2, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 29, + "line": 1, }, }, "range": Array [ - 39, - 40, + 29, + 32, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "Bar", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 33, + "line": 1, }, }, "range": Array [ - 45, - 46, + 33, + 34, ], "type": "Punctuator", - "value": "@", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 1, "line": 3, }, "start": Object { - "column": 5, + "column": 0, "line": 3, }, }, "range": Array [ - 46, - 52, + 36, + 37, ], - "type": "Identifier", - "value": "Output", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-extends-empty-implements.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], "loc": Object { "end": Object { - "column": 12, + "column": 1, "line": 3, }, "start": Object { - "column": 11, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 52, - 53, + 0, + 37, ], - "type": "Punctuator", - "value": "(", + "superClass": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 5, + "line": 1, }, "start": Object { - "column": 12, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 53, - 54, + 0, + 5, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 4, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 6, + "line": 1, }, }, "range": Array [ - 59, - 64, + 6, + 9, ], "type": "Identifier", - "value": "click", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { "column": 10, - "line": 4, - }, - }, - "range": Array [ - 65, - 66, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, + "line": 1, }, }, "range": Array [ - 67, - 70, + 10, + 17, ], "type": "Keyword", - "value": "new", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 4, + "column": 21, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 18, + "line": 1, }, }, "range": Array [ - 71, - 83, + 18, + 21, ], "type": "Identifier", - "value": "EventEmitter", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 4, - }, - "start": Object { - "column": 28, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "Punctuator", - "value": "(", + "value": "Bar", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 4, + "column": 32, + "line": 1, }, "start": Object { - "column": 29, - "line": 4, + "column": 22, + "line": 1, }, }, "range": Array [ - 84, - 85, + 22, + 32, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 34, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, + "column": 33, + "line": 1, }, }, "range": Array [ - 85, - 86, + 33, + 34, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 87, - 88, + 36, + 37, ], "type": "Punctuator", "value": "}", @@ -88524,252 +91699,25 @@ Object { } `; -exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = ` +exports[`typescript fixtures/errorRecovery/class-multiple-implements.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 28, - 32, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "configurable", - "range": Array [ - 15, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 15, - 33, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 33, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 31, - "line": 2, - }, - }, - "name": "prop1", - "range": Array [ - 41, - 46, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 47, - ], - "static": true, - "type": "ClassProperty", - "value": null, - }, - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 67, - 72, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "name": "configurable", - "range": Array [ - 54, - 66, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "range": Array [ - 54, - 73, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 53, - 73, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 5, - }, - }, - "name": "prop2", - "range": Array [ - 85, - 90, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 53, - 91, - ], - "static": true, - "type": "ClassProperty", - "value": null, - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 36, + "line": 1, }, "start": Object { - "column": 8, + "column": 34, "line": 1, }, }, "range": Array [ - 8, - 93, + 34, + 36, ], "type": "ClassBody", }, @@ -88784,17 +91732,54 @@ Object { "line": 1, }, }, - "name": "A", + "name": "a", "range": Array [ 6, 7, ], "type": "Identifier", }, + "implements": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "TSClassImplements", + }, + ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 36, + "line": 1, }, "start": Object { "column": 0, @@ -88803,7 +91788,7 @@ Object { }, "range": Array [ 0, - 93, + 36, ], "superClass": null, "type": "ClassDeclaration", @@ -88812,8 +91797,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -88822,7 +91807,7 @@ Object { }, "range": Array [ 0, - 93, + 37, ], "sourceType": "module", "tokens": Array [ @@ -88856,332 +91841,323 @@ Object { }, }, "range": Array [ - 6, - 7, - ], - "type": "Identifier", - "value": "A", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "@", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 15, - 27, - ], - "type": "Identifier", - "value": "configurable", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 27, - 28, + 6, + 7, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 28, - 32, + 8, + 18, ], - "type": "Boolean", - "value": "true", + "type": "Keyword", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 22, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ - 32, - 33, + 19, + 20, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 2, + "column": 31, + "line": 1, }, "start": Object { - "column": 24, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 34, - 40, + 21, + 31, ], "type": "Keyword", - "value": "static", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 33, + "line": 1, }, "start": Object { - "column": 31, - "line": 2, + "column": 32, + "line": 1, }, }, "range": Array [ - 41, - 46, + 32, + 33, ], "type": "Identifier", - "value": "prop1", + "value": "c", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 35, + "line": 1, }, "start": Object { - "column": 36, - "line": 2, + "column": 34, + "line": 1, }, }, "range": Array [ - 46, - 47, + 34, + 35, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 35, + "line": 1, }, }, "range": Array [ - 53, - 54, + 35, + 36, ], "type": "Punctuator", - "value": "@", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/decorator-on-enum-declaration.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "dec", + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Decorator", }, - "start": Object { - "column": 5, - "line": 4, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, }, + "name": "E", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", }, - "range": Array [ - 54, - 66, - ], - "type": "Identifier", - "value": "configurable", - }, - Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 14, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 0, + "line": 1, }, }, + "members": Array [], "range": Array [ - 66, - 67, + 0, + 14, ], - "type": "Punctuator", - "value": "(", + "type": "TSEnumDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 1, + "line": 1, }, "start": Object { - "column": 18, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 67, - 72, + 0, + 1, ], - "type": "Boolean", - "value": "false", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 4, + "line": 1, }, "start": Object { - "column": 23, - "line": 4, + "column": 1, + "line": 1, }, }, "range": Array [ - 72, - 73, + 1, + 4, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "dec", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 9, + "line": 1, }, "start": Object { - "column": 4, - "line": 5, + "column": 5, + "line": 1, }, }, "range": Array [ - 78, - 84, + 5, + 9, ], "type": "Keyword", - "value": "static", + "value": "enum", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 11, + "line": 1, }, "start": Object { - "column": 11, - "line": 5, + "column": 10, + "line": 1, }, }, "range": Array [ - 85, - 90, + 10, + 11, ], "type": "Identifier", - "value": "prop2", + "value": "E", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 5, + "column": 13, + "line": 1, }, "start": Object { - "column": 16, - "line": 5, + "column": 12, + "line": 1, }, }, "range": Array [ - 90, - 91, + 12, + 13, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 14, + "line": 1, }, "start": Object { - "column": 0, - "line": 6, + "column": 13, + "line": 1, }, }, "range": Array [ - 92, - 93, + 13, + 14, ], "type": "Punctuator", "value": "}", @@ -89191,220 +92167,109 @@ Object { } `; -exports[`typescript fixtures/decorators/property-decorators/property-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/errorRecovery/decorator-on-function.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "decorators": Array [ + Object { + "expression": Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 4, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 1, + "line": 1, }, }, + "name": "dec", "range": Array [ - 14, - 21, + 1, + 4, ], - "static": false, - "type": "ClassProperty", - "value": null, + "type": "Identifier", }, - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 26, - 30, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "name": "y", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 6, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 26, - 37, - ], - "static": false, - "type": "ClassProperty", - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 1, }, + "range": Array [ + 0, + 4, + ], + "type": "Decorator", }, - "range": Array [ - 8, - 39, - ], - "type": "ClassBody", - }, + ], + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 9, + "line": 2, }, }, - "name": "B", + "name": "b", "range": Array [ - 6, - 7, + 14, + 15, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 14, + "line": 2, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 39, + 19, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -89413,14 +92278,14 @@ Object { }, "range": Array [ 0, - 39, + 20, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -89430,55 +92295,55 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 4, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 7, + 1, + 4, ], "type": "Identifier", - "value": "B", + "value": "dec", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 0, + "line": 2, }, }, "range": Array [ - 8, - 9, + 5, + 13, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 2, }, "start": Object { - "column": 4, + "column": 9, "line": 2, }, }, @@ -89486,149 +92351,355 @@ Object { 14, 15, ], - "type": "Punctuator", - "value": "@", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 11, "line": 2, }, "start": Object { - "column": 5, + "column": 10, "line": 2, }, }, "range": Array [ 15, - 18, + 16, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, "range": Array [ - 19, - 20, + 16, + 17, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 2, }, "start": Object { - "column": 10, + "column": 12, "line": 2, }, }, "range": Array [ - 20, - 21, + 17, + 18, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 13, + "line": 2, }, }, "range": Array [ - 26, - 27, + 18, + 19, ], "type": "Punctuator", - "value": "@", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "TSInterfaceBody", + }, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "deco", + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 7, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "M", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 1, + "line": 1, }, "start": Object { - "column": 5, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 27, - 30, + 0, + 1, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { "column": 5, - "line": 4, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 1, + "line": 1, }, }, "range": Array [ - 35, - 36, + 1, + 5, ], "type": "Identifier", - "value": "y", + "value": "deco", }, Object { "loc": Object { "end": Object { "column": 6, - "line": 4, + "line": 1, }, "start": Object { "column": 5, - "line": 4, + "line": 1, }, }, "range": Array [ - 36, - 37, + 5, + 6, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, }, "start": Object { "column": 0, - "line": 5, + "line": 2, }, }, "range": Array [ - 38, - 39, + 8, + 17, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "M", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, ], "type": "Punctuator", "value": "}", @@ -89638,201 +92709,126 @@ Object { } `; -exports[`typescript fixtures/decorators/property-decorators/property-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/errorRecovery/decorator-on-variable.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "a", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 18, + "column": 7, "line": 2, }, "start": Object { - "column": 4, + "column": 6, "line": 2, }, }, + "name": "a", "range": Array [ 14, - 28, + 15, ], - "static": true, - "type": "ClassProperty", - "value": null, + "type": "Identifier", }, - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "qux", - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 33, - 37, - ], - "type": "Decorator", + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, }, + }, + "range": Array [ + 18, + 19, ], - "key": Object { + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "VariableDeclarator", + }, + ], + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 5, + "line": 1, }, "start": Object { - "column": 11, - "line": 4, + "column": 1, + "line": 1, }, }, - "name": "b", + "name": "deco", "range": Array [ - 49, - 50, + 1, + 5, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 1, + "line": 1, }, }, "range": Array [ - 33, - 51, + 1, + 7, ], - "static": true, - "type": "ClassProperty", - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 53, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, + "type": "CallExpression", }, - "start": Object { - "column": 6, - "line": 1, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", }, - "name": "C", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 11, + "line": 2, }, "start": Object { "column": 0, @@ -89841,17 +92837,16 @@ Object { }, "range": Array [ 0, - 53, + 19, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "VariableDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 3, }, "start": Object { "column": 0, @@ -89860,14 +92855,14 @@ Object { }, "range": Array [ 0, - 54, + 20, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -89877,115 +92872,97 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 7, + 1, + 5, ], "type": "Identifier", - "value": "C", + "value": "deco", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { - "column": 8, + "column": 5, "line": 1, }, }, "range": Array [ - 8, - 9, + 5, + 6, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 7, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 14, - 15, + 6, + 7, ], "type": "Punctuator", - "value": "@", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { "column": 5, "line": 2, }, - }, - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - "value": "baz", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, "start": Object { - "column": 9, + "column": 0, "line": 2, }, }, "range": Array [ - 19, - 25, + 8, + 13, ], "type": "Keyword", - "value": "static", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 7, "line": 2, }, "start": Object { - "column": 16, + "column": 6, "line": 2, }, }, "range": Array [ - 26, - 27, + 14, + 15, ], "type": "Identifier", "value": "a", @@ -89993,178 +92970,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 9, "line": 2, }, "start": Object { - "column": 17, + "column": 8, "line": 2, }, }, "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 33, - 34, + 16, + 17, ], "type": "Punctuator", - "value": "@", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - "value": "qux", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "Keyword", - "value": "static", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { "column": 11, - "line": 4, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + "line": 2, }, "start": Object { - "column": 0, - "line": 5, + "column": 10, + "line": 2, }, }, "range": Array [ - 52, - 53, + 18, + 19, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "1", }, ], "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/class-empty-extends.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-arguments.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 22, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 14, + 16, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, }, - "start": Object { - "column": 6, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { "column": 0, @@ -90173,17 +93133,16 @@ Object { }, "range": Array [ 0, - 22, + 16, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "VariableDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 16, + "line": 1, }, "start": Object { "column": 0, @@ -90192,7 +93151,7 @@ Object { }, "range": Array [ 0, - 23, + 16, ], "sourceType": "module", "tokens": Array [ @@ -90212,7 +93171,7 @@ Object { 5, ], "type": "Keyword", - "value": "class", + "value": "const", }, Object { "loc": Object { @@ -90230,148 +93189,147 @@ Object { 9, ], "type": "Identifier", - "value": "Foo", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ + 9, 10, - 17, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 14, "line": 1, }, "start": Object { - "column": 18, + "column": 11, "line": 1, }, }, "range": Array [ - 18, - 19, + 11, + 14, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, ], "type": "Punctuator", - "value": "{", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 15, + "line": 1, }, }, "range": Array [ - 21, - 22, + 15, + 16, ], "type": "Punctuator", - "value": "}", + "value": ">", }, ], "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/class-empty-extends-implements.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 1, + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", }, - "range": Array [ - 33, - 37, - ], - "type": "ClassBody", - }, - "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { - "column": 6, + "column": 0, "line": 1, }, }, - "name": "Foo", "range": Array [ - 6, - 9, + 0, + 7, ], - "type": "Identifier", - }, - "implements": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 29, - 32, - ], - "type": "Identifier", - }, + "type": "CallExpression", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 32, + "column": 5, "line": 1, }, "start": Object { - "column": 29, + "column": 3, "line": 1, }, }, + "params": Array [], "range": Array [ - 29, - 32, + 3, + 5, ], - "type": "TSClassImplements", + "type": "TSTypeParameterInstantiation", }, - ], + }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { "column": 0, @@ -90380,17 +93338,16 @@ Object { }, "range": Array [ 0, - 37, + 8, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ExpressionStatement", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -90399,14 +93356,14 @@ Object { }, "range": Array [ 0, - 38, + 9, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -90416,169 +93373,168 @@ Object { }, "range": Array [ 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 9, + 3, ], "type": "Identifier", - "value": "Foo", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 4, "line": 1, }, "start": Object { - "column": 10, + "column": 3, "line": 1, }, }, "range": Array [ - 10, - 17, + 3, + 4, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 5, "line": 1, }, "start": Object { - "column": 18, + "column": 4, "line": 1, }, }, "range": Array [ - 18, - 28, + 4, + 5, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 6, "line": 1, }, "start": Object { - "column": 29, + "column": 5, "line": 1, }, }, "range": Array [ - 29, - 32, + 5, + 6, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 7, "line": 1, }, "start": Object { - "column": 33, + "column": 6, "line": 1, }, }, "range": Array [ - 33, - 34, + 6, + 7, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 7, + "line": 1, }, }, "range": Array [ - 36, - 37, + 7, + 8, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/class-extends-empty-implements.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-arguments-in-new-expression.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 1, + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", }, - "range": Array [ - 33, - 37, - ], - "type": "ClassBody", - }, - "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 0, "line": 1, }, }, - "name": "Foo", "range": Array [ - 6, - 9, + 0, + 11, ], - "type": "Identifier", + "type": "NewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 7, + 9, + ], + "type": "TSTypeParameterInstantiation", + }, }, - "implements": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 11, + "line": 1, }, "start": Object { "column": 0, @@ -90587,34 +93543,16 @@ Object { }, "range": Array [ 0, - 37, + 11, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 18, - 21, - ], - "type": "Identifier", - }, - "type": "ClassDeclaration", + "type": "ExpressionStatement", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -90623,14 +93561,14 @@ Object { }, "range": Array [ 0, - 38, + 12, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -90640,25 +93578,25 @@ Object { }, "range": Array [ 0, - 5, + 3, ], "type": "Keyword", - "value": "class", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 9, + 4, + 7, ], "type": "Identifier", "value": "Foo", @@ -90666,178 +93604,126 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 8, "line": 1, }, "start": Object { - "column": 10, + "column": 7, "line": 1, }, }, "range": Array [ - 10, - 17, + 7, + 8, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 9, "line": 1, }, "start": Object { - "column": 18, + "column": 8, "line": 1, }, }, "range": Array [ - 18, - 21, + 8, + 9, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 10, "line": 1, }, "start": Object { - "column": 22, + "column": 9, "line": 1, }, }, "range": Array [ - 22, - 32, + 9, + 10, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 11, "line": 1, }, "start": Object { - "column": 33, + "column": 10, "line": 1, }, }, "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 36, - 37, + 10, + 11, ], "type": "Punctuator", - "value": "}", + "value": ")", }, ], "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/class-multiple-implements.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { "body": Array [], "loc": Object { "end": Object { - "column": 36, + "column": 18, "line": 1, }, "start": Object { - "column": 34, + "column": 16, "line": 1, }, }, "range": Array [ - 34, - 36, + 16, + 18, ], - "type": "ClassBody", + "type": "BlockStatement", }, + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, - "name": "a", + "name": "f1", "range": Array [ - 6, - 7, + 9, + 11, ], "type": "Identifier", }, - "implements": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "TSClassImplements", - }, - ], "loc": Object { "end": Object { - "column": 36, + "column": 18, "line": 1, }, "start": Object { @@ -90845,12 +93731,30 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 36, + 18, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 13, + ], + "type": "TSTypeParameterDeclaration", + }, }, ], "comments": Array [], @@ -90866,14 +93770,14 @@ Object { }, "range": Array [ 0, - 37, + 19, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -90883,115 +93787,115 @@ Object { }, "range": Array [ 0, - 5, + 8, ], "type": "Keyword", - "value": "class", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, "range": Array [ - 6, - 7, + 9, + 11, ], "type": "Identifier", - "value": "a", + "value": "f1", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 11, "line": 1, }, }, "range": Array [ - 8, - 18, + 11, + 12, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 13, "line": 1, }, "start": Object { - "column": 19, + "column": 12, "line": 1, }, }, "range": Array [ - 19, - 20, + 12, + 13, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 14, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, "range": Array [ - 21, - 31, + 13, + 14, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 15, "line": 1, }, "start": Object { - "column": 32, + "column": 14, "line": 1, }, }, "range": Array [ - 32, - 33, + 14, + 15, ], - "type": "Identifier", - "value": "c", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 17, "line": 1, }, "start": Object { - "column": 34, + "column": 16, "line": 1, }, }, "range": Array [ - 34, - 35, + 16, + 17, ], "type": "Punctuator", "value": "{", @@ -90999,17 +93903,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 18, "line": 1, }, "start": Object { - "column": 35, + "column": 17, "line": 1, }, }, "range": Array [ - 35, - 36, + 17, + 18, ], "type": "Punctuator", "value": "}", @@ -91019,47 +93923,31 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/decorator-on-enum-declaration.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-arrow-function.src 1`] = ` Object { "body": Array [ - Object { - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "dec", - "range": Array [ - 1, - 4, - ], - "type": "Identifier", + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "start": Object { + "column": 16, + "line": 1, }, - "range": Array [ - 0, - 4, - ], - "type": "Decorator", }, - ], + "range": Array [ + 16, + 18, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { @@ -91067,20 +93955,20 @@ Object { "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, - "name": "E", + "name": "f1", "range": Array [ - 10, + 9, 11, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 1, }, "start": Object { @@ -91088,19 +93976,37 @@ Object { "line": 1, }, }, - "members": Array [], + "params": Array [], "range": Array [ 0, - 14, + 18, ], - "type": "TSEnumDeclaration", + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 13, + ], + "type": "TSTypeParameterDeclaration", + }, }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -91109,14 +94015,14 @@ Object { }, "range": Array [ 0, - 14, + 19, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 8, "line": 1, }, "start": Object { @@ -91126,97 +94032,133 @@ Object { }, "range": Array [ 0, - 1, + 8, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 11, "line": 1, }, "start": Object { - "column": 1, + "column": 9, "line": 1, }, }, "range": Array [ - 1, - 4, + 9, + 11, ], "type": "Identifier", - "value": "dec", + "value": "f1", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { - "column": 5, + "column": 11, "line": 1, }, }, "range": Array [ - 5, - 9, + 11, + 12, ], - "type": "Keyword", - "value": "enum", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { - "column": 10, + "column": 12, "line": 1, }, }, "range": Array [ - 10, - 11, + 12, + 13, ], - "type": "Identifier", - "value": "E", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, ], "type": "Punctuator", "value": "}", @@ -91226,72 +94168,166 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/decorator-on-function.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-constructor.src 1`] = ` Object { "body": Array [ Object { - "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 32, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 32, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 25, + 32, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 25, + 27, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + ], "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 17, - 19, + 10, + 34, ], - "type": "BlockStatement", + "type": "ClassBody", }, - "expression": false, - "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 6, + "line": 1, }, }, - "name": "b", + "name": "foo", "range": Array [ - 14, - 15, + 6, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [], "range": Array [ 0, - 19, + 34, ], - "type": "FunctionDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -91300,14 +94336,14 @@ Object { }, "range": Array [ 0, - 20, + 35, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -91317,79 +94353,115 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 9, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 4, + 6, + 9, ], "type": "Identifier", - "value": "dec", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 5, - 13, + 10, + 11, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 2, }, "start": Object { - "column": 9, + "column": 2, "line": 2, }, }, "range": Array [ 14, - 15, + 25, ], "type": "Identifier", - "value": "b", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 14, "line": 2, }, "start": Object { - "column": 10, + "column": 13, "line": 2, }, }, "range": Array [ - 15, - 16, + 25, + 26, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, ], "type": "Punctuator", "value": "(", @@ -91397,17 +94469,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 2, }, "start": Object { - "column": 11, + "column": 16, "line": 2, }, }, "range": Array [ - 16, - 17, + 28, + 29, ], "type": "Punctuator", "value": ")", @@ -91415,17 +94487,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 19, "line": 2, }, "start": Object { - "column": 12, + "column": 18, "line": 2, }, }, "range": Array [ - 17, - 18, + 30, + 31, ], "type": "Punctuator", "value": "{", @@ -91433,17 +94505,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 20, "line": 2, }, "start": Object { - "column": 13, + "column": 19, "line": 2, }, }, "range": Array [ - 18, - 19, + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, ], "type": "Punctuator", "value": "}", @@ -91453,105 +94543,110 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 20, - 22, - ], - "type": "TSInterfaceBody", - }, - "decorators": Array [ + "declarations": Array [ Object { - "expression": Object { - "arguments": Array [], - "callee": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 12, + 27, + ], + "type": "FunctionExpression", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 5, + "column": 22, "line": 1, }, "start": Object { - "column": 1, + "column": 20, "line": 1, }, }, - "name": "deco", + "params": Array [], "range": Array [ - 1, - 5, + 20, + 22, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "type": "TSTypeParameterDeclaration", }, - "range": Array [ - 1, - 7, - ], - "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 7, + "column": 27, "line": 1, }, "start": Object { - "column": 0, + "column": 6, "line": 1, }, }, "range": Array [ - 0, - 7, + 6, + 27, ], - "type": "Decorator", + "type": "VariableDeclarator", }, ], - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "name": "M", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, + "kind": "const", "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { "column": 0, @@ -91560,15 +94655,15 @@ Object { }, "range": Array [ 0, - 22, + 27, ], - "type": "TSInterfaceDeclaration", + "type": "VariableDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 14, + "column": 0, "line": 2, }, "start": Object { @@ -91578,14 +94673,14 @@ Object { }, "range": Array [ 0, - 22, + 28, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -91595,115 +94690,151 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 5, + 6, + 9, ], "type": "Identifier", - "value": "deco", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 1, }, "start": Object { - "column": 5, + "column": 10, "line": 1, }, }, "range": Array [ - 5, - 6, + 10, + 11, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 20, "line": 1, }, "start": Object { - "column": 6, + "column": 12, "line": 1, }, }, "range": Array [ - 6, - 7, + 12, + 20, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 8, - 17, + 21, + 22, ], - "type": "Keyword", - "value": "interface", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 18, - 19, + 22, + 23, ], - "type": "Identifier", - "value": "M", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 20, - 21, + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, ], "type": "Punctuator", "value": "{", @@ -91711,17 +94842,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 26, + "line": 1, }, }, "range": Array [ - 21, - 22, + 26, + 27, ], "type": "Punctuator", "value": "}", @@ -91731,71 +94862,147 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/decorator-on-variable.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-method.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "test", + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + }, + "kind": "method", "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 2, }, "start": Object { - "column": 6, + "column": 2, "line": 2, }, }, - "name": "a", "range": Array [ 14, - 15, + 25, ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", }, - "start": Object { - "column": 10, - "line": 2, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 25, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 20, + ], + "type": "TSTypeParameterDeclaration", }, }, - "range": Array [ - 18, - 19, - ], - "raw": "1", - "type": "Literal", - "value": 1, }, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, }, - "range": Array [ - 14, - 19, - ], - "type": "VariableDeclarator", }, - ], - "kind": "const", + "range": Array [ + 10, + 27, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -91804,16 +95011,17 @@ Object { }, "range": Array [ 0, - 19, + 27, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -91822,14 +95030,14 @@ Object { }, "range": Array [ 0, - 20, + 28, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -91839,259 +95047,296 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 5, + 6, + 9, ], "type": "Identifier", - "value": "deco", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 1, }, "start": Object { - "column": 5, + "column": 10, "line": 1, }, }, "range": Array [ - 5, - 6, + 10, + 11, ], "type": "Punctuator", - "value": "(", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "test", }, Object { "loc": Object { "end": Object { "column": 7, - "line": 1, + "line": 2, }, "start": Object { "column": 6, - "line": 1, + "line": 2, }, }, "range": Array [ - 6, - 7, + 18, + 19, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 2, }, "start": Object { - "column": 0, + "column": 7, "line": 2, }, }, "range": Array [ - 8, - 13, + 19, + 20, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 2, }, "start": Object { - "column": 6, + "column": 8, "line": 2, }, }, "range": Array [ - 14, - 15, + 20, + 21, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 2, }, "start": Object { - "column": 8, + "column": 9, "line": 2, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { "column": 11, "line": 2, }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, "start": Object { - "column": 10, + "column": 12, "line": 2, }, }, "range": Array [ - 18, - 19, + 24, + 25, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/empty-type-arguments.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-method-signature.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "test", + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 2, + "line": 2, }, }, - "name": "foo", + "params": Array [], "range": Array [ - 6, - 16, + 18, + 27, ], - "type": "Identifier", - "typeAnnotation": Object { + "type": "TSMethodSignature", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 6, + "line": 2, }, }, + "params": Array [], "range": Array [ - 9, - 16, + 22, + 24, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 16, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 11, - 14, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 14, - 16, - ], - "type": "TSTypeParameterInstantiation", - }, - }, + "type": "TSTypeParameterDeclaration", }, }, - "init": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, }, - "range": Array [ - 6, - 16, - ], - "type": "VariableDeclarator", }, - ], - "kind": "const", + "range": Array [ + 14, + 29, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -92100,16 +95345,16 @@ Object { }, "range": Array [ 0, - 16, + 29, ], - "type": "VariableDeclaration", + "type": "TSInterfaceDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -92118,14 +95363,14 @@ Object { }, "range": Array [ 0, - 16, + 30, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { @@ -92135,25 +95380,25 @@ Object { }, "range": Array [ 0, - 5, + 9, ], "type": "Keyword", - "value": "const", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { - "column": 6, + "column": 10, "line": 1, }, }, "range": Array [ - 6, - 9, + 10, + 13, ], "type": "Identifier", "value": "foo", @@ -92161,53 +95406,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { - "column": 9, + "column": 14, "line": 1, }, }, "range": Array [ - 9, - 10, + 14, + 15, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 11, - 14, + 18, + 22, ], "type": "Identifier", - "value": "Foo", + "value": "test", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 6, + "line": 2, }, }, "range": Array [ - 14, - 15, + 22, + 23, ], "type": "Punctuator", "value": "<", @@ -92215,21 +95460,93 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 15, - 16, + 23, + 24, ], "type": "Punctuator", "value": ">", }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, ], "type": "Program", } @@ -104850,132 +108167,564 @@ Object { "line": 1, }, }, - "range": Array [ - 9, - 231, - ], - "type": "TSModuleBlock", + "range": Array [ + 9, + 231, + ], + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 31, + 44, + ], + "type": "String", + "value": "'hello world'", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "range": Array [ + 49, + 55, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, }, - "name": "A", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", }, + "range": Array [ + 56, + 61, + ], + "type": "Keyword", + "value": "class", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 12, + "column": 22, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 4, }, }, "range": Array [ - 0, - 231, + 62, + 67, ], - "type": "TSModuleDeclaration", + "type": "Identifier", + "value": "Point", }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 12, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 89, + ], + "type": "Identifier", + "value": "constructor", }, - }, - "range": Array [ - 0, - 231, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 20, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 19, + "line": 5, }, }, "range": Array [ - 0, - 6, + 89, + 90, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, ], "type": "Identifier", - "value": "module", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 29, + "line": 5, }, "start": Object { - "column": 7, - "line": 1, + "column": 28, + "line": 5, }, }, "range": Array [ - 7, - 8, + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 100, + 106, ], "type": "Identifier", - "value": "A", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 37, + "line": 5, }, "start": Object { - "column": 9, - "line": 1, + "column": 36, + "line": 5, }, }, "range": Array [ - 9, - 10, + 106, + 107, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 108, + 114, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 46, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 126, + 127, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 58, + "line": 5, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "}", + }, Object { "loc": Object { "end": Object { "column": 10, - "line": 3, + "line": 7, }, "start": Object { "column": 4, - "line": 3, + "line": 7, }, }, "range": Array [ - 16, - 22, + 140, + 146, ], "type": "Keyword", "value": "export", @@ -104983,593 +108732,935 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 17, + "line": 7, }, "start": Object { "column": 11, - "line": 3, + "line": 7, }, }, "range": Array [ - 23, - 26, + 147, + 153, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 166, + 172, ], "type": "Keyword", - "value": "var", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 173, + 182, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "range": Array [ + 183, + 185, + ], + "type": "Identifier", + "value": "Id", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 8, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 200, + 204, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 24, + "line": 9, }, "start": Object { - "column": 15, - "line": 3, + "column": 18, + "line": 9, }, }, "range": Array [ - 27, - 28, + 206, + 212, ], "type": "Identifier", - "value": "x", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 9, }, "start": Object { - "column": 17, - "line": 3, + "column": 24, + "line": 9, }, }, "range": Array [ - 29, - 30, + 212, + 213, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 9, + "line": 10, }, "start": Object { - "column": 19, - "line": 3, + "column": 8, + "line": 10, }, }, "range": Array [ - 31, - 44, + 222, + 223, ], - "type": "String", - "value": "'hello world'", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 5, + "line": 11, }, "start": Object { "column": 4, - "line": 4, + "line": 11, }, }, "range": Array [ - 49, - 55, + 228, + 229, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 1, + "line": 12, }, "start": Object { - "column": 11, - "line": 4, + "column": 0, + "line": 12, }, }, "range": Array [ - 56, - 61, + 230, + 231, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +Object { + "body": Array [ Object { + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "raw": "\\"hot-new-module\\"", + "type": "Literal", + "value": "hot-new-module", + }, "loc": Object { "end": Object { - "column": 22, - "line": 4, + "column": 32, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 62, - 67, + 0, + 32, ], - "type": "Identifier", - "value": "Point", + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { - "column": 23, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 68, - 69, + 0, + 7, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 5, + "column": 14, + "line": 1, }, "start": Object { "column": 8, - "line": 5, + "line": 1, }, }, "range": Array [ - 78, - 89, + 8, + 14, ], "type": "Identifier", - "value": "constructor", + "value": "module", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 5, + "column": 31, + "line": 1, }, "start": Object { - "column": 19, - "line": 5, + "column": 15, + "line": 1, }, }, "range": Array [ - 89, - 90, + 15, + 31, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"hot-new-module\\"", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 5, + "column": 32, + "line": 1, }, "start": Object { - "column": 20, - "line": 5, + "column": 31, + "line": 1, }, }, "range": Array [ - 90, - 96, + 31, + 32, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/array-type.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 28, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 27, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 97, - 98, + 0, + 19, ], - "type": "Identifier", - "value": "x", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "TSArrayType", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 29, - "line": 5, + "column": 4, + "line": 1, }, "start": Object { - "column": 28, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 98, - 99, + 0, + 4, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 5, + "column": 8, + "line": 1, }, "start": Object { - "column": 30, - "line": 5, + "column": 5, + "line": 1, }, }, "range": Array [ - 100, - 106, + 5, + 8, ], "type": "Identifier", - "value": "number", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 5, + "column": 10, + "line": 1, }, "start": Object { - "column": 36, - "line": 5, + "column": 9, + "line": 1, }, }, "range": Array [ - 106, - 107, + 9, + 10, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 5, + "column": 17, + "line": 1, }, "start": Object { - "column": 38, - "line": 5, + "column": 11, + "line": 1, }, }, "range": Array [ - 108, - 114, + 11, + 17, ], - "type": "Keyword", - "value": "public", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 5, + "column": 18, + "line": 1, }, "start": Object { - "column": 45, - "line": 5, + "column": 17, + "line": 1, }, }, "range": Array [ - 115, - 116, + 17, + 18, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 46, - "line": 5, + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/conditional.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", + }, + "type": "TSConditionalType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 116, - 117, ], - "type": "Punctuator", - "value": ":", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { "column": 48, - "line": 5, - }, - }, - "range": Array [ - 118, - 124, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 5, + "line": 1, }, "start": Object { - "column": 54, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 124, - 125, + 0, + 48, ], - "type": "Punctuator", - "value": ")", + "type": "VariableDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 5, - }, - "start": Object { - "column": 56, - "line": 5, - }, - }, - "range": Array [ - 126, - 127, - ], - "type": "Punctuator", - "value": "{", + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, - Object { - "loc": Object { - "end": Object { - "column": 59, - "line": 5, - }, - "start": Object { - "column": 58, - "line": 5, - }, - }, - "range": Array [ - 128, - 129, - ], - "type": "Punctuator", - "value": "}", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 3, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 134, - 135, + 0, + 3, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 7, + "column": 5, + "line": 1, }, "start": Object { "column": 4, - "line": 7, + "line": 1, }, }, "range": Array [ - 140, - 146, + 4, + 5, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 7, + "column": 6, + "line": 1, }, "start": Object { - "column": 11, - "line": 7, + "column": 5, + "line": 1, }, }, "range": Array [ - 147, - 153, + 5, + 6, ], - "type": "Identifier", - "value": "module", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 7, + "column": 13, + "line": 1, }, "start": Object { - "column": 18, - "line": 7, + "column": 7, + "line": 1, }, }, "range": Array [ - 154, - 155, + 7, + 13, ], "type": "Identifier", - "value": "B", + "value": "number", }, Object { "loc": Object { "end": Object { "column": 21, - "line": 7, + "line": 1, }, "start": Object { - "column": 20, - "line": 7, - }, - }, - "range": Array [ - 156, - 157, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { "column": 14, - "line": 8, - }, - "start": Object { - "column": 8, - "line": 8, - }, - }, - "range": Array [ - 166, - 172, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 8, - }, - "start": Object { - "column": 15, - "line": 8, + "line": 1, }, }, "range": Array [ - 173, - 182, + 14, + 21, ], "type": "Keyword", - "value": "interface", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 8, + "column": 28, + "line": 1, }, "start": Object { - "column": 25, - "line": 8, + "column": 22, + "line": 1, }, }, "range": Array [ - 183, - 185, + 22, + 28, ], "type": "Identifier", - "value": "Id", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 8, + "column": 30, + "line": 1, }, "start": Object { - "column": 28, - "line": 8, + "column": 29, + "line": 1, }, }, "range": Array [ - 186, - 187, + 29, + 30, ], "type": "Punctuator", - "value": "{", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 9, + "column": 38, + "line": 1, }, "start": Object { - "column": 12, - "line": 9, + "column": 31, + "line": 1, }, }, "range": Array [ - 200, - 204, + 31, + 38, ], "type": "Identifier", - "value": "name", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 9, + "column": 40, + "line": 1, }, "start": Object { - "column": 16, - "line": 9, + "column": 39, + "line": 1, }, }, "range": Array [ - 204, - 205, + 39, + 40, ], "type": "Punctuator", "value": ":", @@ -105577,17 +109668,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 9, + "column": 47, + "line": 1, }, "start": Object { - "column": 18, - "line": 9, + "column": 41, + "line": 1, }, }, "range": Array [ - 206, - 212, + 41, + 47, ], "type": "Identifier", "value": "string", @@ -105595,142 +109686,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 9, + "column": 48, + "line": 1, }, "start": Object { - "column": 24, - "line": 9, + "column": 47, + "line": 1, }, }, "range": Array [ - 212, - 213, + 47, + 48, ], "type": "Punctuator", "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 10, - }, - "start": Object { - "column": 8, - "line": 10, - }, - }, - "range": Array [ - 222, - 223, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 11, - }, - "start": Object { - "column": 4, - "line": 11, - }, - }, - "range": Array [ - 228, - 229, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 12, - }, - "start": Object { - "column": 0, - "line": 12, - }, - }, - "range": Array [ - 230, - 231, - ], - "type": "Punctuator", - "value": "}", - }, ], "type": "Program", } `; -exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer.src 1`] = ` Object { "body": Array [ Object { - "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 31, + "column": 12, "line": 1, }, "start": Object { - "column": 15, + "column": 5, "line": 1, }, }, + "name": "Element", "range": Array [ - 15, - 31, + 5, + 12, ], - "raw": "\\"hot-new-module\\"", - "type": "Literal", - "value": "hot-new-module", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "Identifier", }, - "range": Array [ - 0, - 32, - ], - "type": "TSModuleDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 33, - ], - "sourceType": "module", - "tokens": Array [ - Object { "loc": Object { "end": Object { - "column": 7, + "column": 48, "line": 1, }, "start": Object { @@ -105740,140 +109740,270 @@ Object { }, "range": Array [ 0, - 7, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 14, + 48, ], - "type": "Identifier", - "value": "module", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 15, - 31, - ], - "type": "String", - "value": "\\"hot-new-module\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, + "extendsType": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 37, + ], + "type": "TSParenthesizedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 39, + ], + "type": "TSArrayType", }, - "start": Object { - "column": 31, - "line": 1, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/array-type.src 1`] = ` -Object { - "body": Array [ - Object { - "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 47, "line": 1, }, "start": Object { - "column": 5, + "column": 18, "line": 1, }, }, - "name": "Foo", "range": Array [ - 5, - 8, + 18, + 47, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 19, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "elementType": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 17, + "column": 43, "line": 1, }, "start": Object { - "column": 11, + "column": 42, "line": 1, }, }, "range": Array [ - 11, - 17, + 42, + 43, ], - "type": "TSStringKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, }, + "type": "TSConditionalType", + }, + "typeParameters": Object { "loc": Object { "end": Object { - "column": 19, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 14, + ], + "type": "TSTypeParameter", + }, + ], "range": Array [ - 11, - 19, + 12, + 15, ], - "type": "TSArrayType", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -105890,7 +110020,7 @@ Object { }, "range": Array [ 0, - 20, + 49, ], "sourceType": "module", "tokens": Array [ @@ -105915,7 +110045,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -105925,64 +110055,82 @@ Object { }, "range": Array [ 5, - 8, + 12, ], "type": "Identifier", - "value": "Foo", + "value": "Element", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 1, }, "start": Object { - "column": 9, + "column": 12, "line": 1, }, }, "range": Array [ - 9, - 10, + 12, + 13, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 14, "line": 1, }, "start": Object { - "column": 11, + "column": 13, "line": 1, }, }, "range": Array [ - 11, - 17, + 13, + 14, ], "type": "Identifier", - "value": "string", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 15, "line": 1, }, "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { "column": 17, "line": 1, }, + "start": Object { + "column": 16, + "line": 1, + }, }, "range": Array [ + 16, 17, - 18, ], "type": "Punctuator", - "value": "[", + "value": "=", }, Object { "loc": Object { @@ -105999,315 +110147,149 @@ Object { 18, 19, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "T", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/conditional.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 47, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 13, - ], - "type": "TSNumberKeyword", - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 47, - ], - "type": "TSStringKeyword", - }, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 47, - ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 38, - ], - "type": "TSBooleanKeyword", - }, - "type": "TSConditionalType", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 47, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", "loc": Object { "end": Object { - "column": 48, + "column": 27, "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, - 48, + 20, + 27, ], - "type": "VariableDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "extends", }, - }, - "range": Array [ - 0, - 49, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 29, "line": 1, }, "start": Object { - "column": 0, + "column": 28, "line": 1, }, }, "range": Array [ - 0, - 3, + 28, + 29, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 34, "line": 1, }, "start": Object { - "column": 4, + "column": 29, "line": 1, }, }, "range": Array [ - 4, - 5, + 29, + 34, ], "type": "Identifier", - "value": "x", + "value": "infer", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 36, "line": 1, }, "start": Object { - "column": 5, + "column": 35, "line": 1, }, }, "range": Array [ - 5, - 6, + 35, + 36, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 37, "line": 1, }, "start": Object { - "column": 7, + "column": 36, "line": 1, }, }, "range": Array [ - 7, - 13, + 36, + 37, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 14, + "column": 37, "line": 1, }, }, "range": Array [ - 14, - 21, + 37, + 38, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 39, "line": 1, }, "start": Object { - "column": 22, + "column": 38, "line": 1, }, }, "range": Array [ - 22, - 28, + 38, + 39, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 41, "line": 1, }, "start": Object { - "column": 29, + "column": 40, "line": 1, }, }, "range": Array [ - 29, - 30, + 40, + 41, ], "type": "Punctuator", "value": "?", @@ -106315,35 +110297,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 43, "line": 1, }, "start": Object { - "column": 31, + "column": 42, "line": 1, }, }, "range": Array [ - 31, - 38, + 42, + 43, ], "type": "Identifier", - "value": "boolean", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 45, "line": 1, }, "start": Object { - "column": 39, + "column": 44, "line": 1, }, }, "range": Array [ - 39, - 40, + 44, + 45, ], "type": "Punctuator", "value": ":", @@ -106355,16 +110337,16 @@ Object { "line": 1, }, "start": Object { - "column": 41, + "column": 46, "line": 1, }, }, "range": Array [ - 41, + 46, 47, ], "type": "Identifier", - "value": "string", + "value": "T", }, Object { "loc": Object { @@ -106389,14 +110371,14 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { @@ -106404,17 +110386,17 @@ Object { "line": 1, }, }, - "name": "Element", + "name": "Unpacked", "range": Array [ 5, - 12, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { "column": 0, @@ -106423,41 +110405,41 @@ Object { }, "range": Array [ 0, - 48, + 126, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "checkType": Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 19, + 21, + 22, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "name": "T", "range": Array [ - 18, - 19, + 21, + 22, ], "type": "Identifier", }, @@ -106466,67 +110448,67 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 37, + 31, + 40, ], "type": "TSParenthesizedType", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 29, - 36, + 32, + 39, ], "type": "TSInferType", "typeParameter": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "name": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "name": "U", "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Identifier", }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "TSTypeParameter", }, @@ -106534,100 +110516,432 @@ Object { }, "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 39, + 31, + 42, ], "type": "TSArrayType", }, "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 70, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + }, + "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "T", + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + }, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 109, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "Promise", + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 108, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + }, + "range": Array [ + 107, + 108, + ], + "type": "TSTypeParameter", + }, + }, + ], + "range": Array [ + 100, + 109, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 124, + 125, + ], + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 125, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + }, + }, + "type": "TSConditionalType", + }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 46, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 46, - 47, + 53, + 125, ], - "type": "TSTypeReference", - "typeName": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 25, + "line": 3, }, "start": Object { - "column": 46, - "line": 1, + "column": 24, + "line": 3, }, }, - "name": "T", "range": Array [ - 46, - 47, + 73, + 74, ], - "type": "Identifier", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + }, }, + "type": "TSConditionalType", }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 47, + 21, + 125, ], "trueType": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 42, - 43, + 45, + 46, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "name": "U", "range": Array [ - 42, - 43, + 45, + 46, ], "type": "Identifier", }, @@ -106637,11 +110951,11 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, @@ -106649,42 +110963,42 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "name": "T", "range": Array [ - 13, 14, + 15, ], "type": "Identifier", }, "range": Array [ - 13, 14, + 15, ], "type": "TSTypeParameter", }, ], "range": Array [ - 12, - 15, + 13, + 16, ], "type": "TSTypeParameterDeclaration", }, @@ -106694,7 +111008,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 6, }, "start": Object { "column": 0, @@ -106703,7 +111017,7 @@ Object { }, "range": Array [ 0, - 49, + 127, ], "sourceType": "module", "tokens": Array [ @@ -106728,7 +111042,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { @@ -106738,25 +111052,25 @@ Object { }, "range": Array [ 5, - 12, + 13, ], "type": "Identifier", - "value": "Element", + "value": "Unpacked", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], "type": "Punctuator", "value": "<", @@ -106764,17 +111078,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, ], "type": "Identifier", "value": "T", @@ -106782,17 +111096,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, 15, + 16, ], "type": "Punctuator", "value": ">", @@ -106800,17 +111114,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 16, + "column": 17, "line": 1, }, }, "range": Array [ - 16, 17, + 18, ], "type": "Punctuator", "value": "=", @@ -106818,17 +111132,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 19, + 21, + 22, ], "type": "Identifier", "value": "T", @@ -106836,17 +111150,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 20, - 27, + 23, + 30, ], "type": "Keyword", "value": "extends", @@ -106854,17 +111168,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 29, + 31, + 32, ], "type": "Punctuator", "value": "(", @@ -106872,17 +111186,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 29, - 34, + 32, + 37, ], "type": "Identifier", "value": "infer", @@ -106890,17 +111204,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Identifier", "value": "U", @@ -106908,17 +111222,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 36, - 37, + 39, + 40, ], "type": "Punctuator", "value": ")", @@ -106926,17 +111240,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 37, - 38, + 40, + 41, ], "type": "Punctuator", "value": "[", @@ -106944,17 +111258,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 38, - 39, + 41, + 42, ], "type": "Punctuator", "value": "]", @@ -106962,17 +111276,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 40, - "line": 1, + "column": 24, + "line": 2, }, }, "range": Array [ - 40, - 41, + 43, + 44, ], "type": "Punctuator", "value": "?", @@ -106980,17 +111294,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 42, - 43, + 45, + 46, ], "type": "Identifier", "value": "U", @@ -106998,17 +111312,323 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 44, - "line": 1, + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 55, + 62, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 85, + 92, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + "value": "Promise", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 37, + "line": 4, }, }, "range": Array [ - 44, - 45, + 114, + 115, ], "type": "Punctuator", "value": ":", @@ -107016,17 +111636,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 46, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 46, - 47, + 124, + 125, ], "type": "Identifier", "value": "T", @@ -107034,17 +111654,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, }, "range": Array [ - 47, - 48, + 125, + 126, ], "type": "Punctuator", "value": ";", @@ -107054,14 +111674,14 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -107069,17 +111689,17 @@ Object { "line": 1, }, }, - "name": "Unpacked", + "name": "Foo", "range": Array [ 5, - 13, + 8, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 63, + "line": 1, }, "start": Object { "column": 0, @@ -107088,543 +111708,336 @@ Object { }, "range": Array [ 0, - 126, + 63, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "checkType": Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "name": "T", "range": Array [ - 21, - 22, + 14, + 15, ], "type": "Identifier", }, }, "extendsType": Object { - "elementType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 40, - ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 32, - 39, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": "U", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "range": Array [ - 38, - 39, - ], - "type": "TSTypeParameter", - }, - }, - }, "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 50, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 42, - ], - "type": "TSArrayType", - }, - "falseType": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 63, - 70, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "name": "U", - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - }, - "range": Array [ - 69, - 70, - ], - "type": "TSTypeParameter", + "column": 24, + "line": 1, }, }, - "falseType": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "TSTypeReference", - "typeName": Object { + "members": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 27, + "line": 1, }, "start": Object { - "column": 6, - "line": 4, + "column": 26, + "line": 1, }, }, - "name": "T", + "name": "a", "range": Array [ - 83, - 84, + 26, + 27, ], "type": "Identifier", }, - }, - "extendsType": Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 37, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 26, + "line": 1, }, }, "range": Array [ - 93, - 109, + 26, + 37, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 27, + "line": 1, }, }, - "name": "Promise", "range": Array [ - 93, - 100, + 27, + 36, ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 4, - }, - "start": Object { - "column": 23, - "line": 4, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 4, + "column": 35, + "line": 1, }, }, - "range": Array [ - 101, - 108, - ], - "type": "TSInferType", - "typeParameter": Object { + "name": Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 4, - }, - "start": Object { - "column": 30, - "line": 4, - }, + "column": 35, + "line": 1, }, - "name": "U", - "range": Array [ - 107, - 108, - ], - "type": "Identifier", }, + "name": "U", "range": Array [ - 107, - 108, + 35, + 36, ], - "type": "TSTypeParameter", + "type": "Identifier", }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", }, - ], - "range": Array [ - 100, - 109, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 5, }, }, - "range": Array [ - 124, - 125, - ], - "type": "TSTypeReference", - "typeName": Object { + }, + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 39, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 38, + "line": 1, }, }, - "name": "T", + "name": "b", "range": Array [ - 124, - 125, + 38, + 39, ], "type": "Identifier", }, - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 125, - ], - "trueType": Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 112, - 113, + 38, + 48, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "range": Array [ + 47, + 48, + ], + "type": "TSTypeParameter", }, }, - "name": "U", - "range": Array [ - 112, - 113, - ], - "type": "Identifier", }, }, - "type": "TSConditionalType", - }, + ], + "range": Array [ + 24, + 50, + ], + "type": "TSTypeLiteral", + }, + "falseType": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 57, + "line": 1, }, }, "range": Array [ - 53, - 125, + 57, + 62, ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "range": Array [ - 73, - 74, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "name": "U", - "range": Array [ - 73, - 74, - ], - "type": "Identifier", - }, - }, - "type": "TSConditionalType", + "type": "TSNeverKeyword", }, "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 125, + 14, + 62, ], "trueType": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 53, + "line": 1, }, }, "range": Array [ - 45, - 46, + 53, + 54, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 53, + "line": 1, }, }, "name": "U", "range": Array [ - 45, - 46, + 53, + 54, ], "type": "Identifier", }, @@ -107634,11 +112047,11 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, @@ -107646,42 +112059,42 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "name": "T", "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Identifier", }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "TSTypeParameter", }, ], "range": Array [ - 13, - 16, + 8, + 11, ], "type": "TSTypeParameterDeclaration", }, @@ -107691,7 +112104,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -107700,7 +112113,7 @@ Object { }, "range": Array [ 0, - 127, + 64, ], "sourceType": "module", "tokens": Array [ @@ -107725,7 +112138,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -107735,25 +112148,25 @@ Object { }, "range": Array [ 5, - 13, + 8, ], "type": "Identifier", - "value": "Unpacked", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, "range": Array [ - 13, - 14, + 8, + 9, ], "type": "Punctuator", "value": "<", @@ -107761,17 +112174,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Identifier", "value": "T", @@ -107779,17 +112192,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 15, + "column": 10, "line": 1, }, }, "range": Array [ - 15, - 16, + 10, + 11, ], "type": "Punctuator", "value": ">", @@ -107797,17 +112210,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", "value": "=", @@ -107815,17 +112228,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], "type": "Identifier", "value": "T", @@ -107833,179 +112246,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ + 16, 23, - 30, ], "type": "Keyword", "value": "extends", }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 32, - 37, - ], - "type": "Identifier", - "value": "infer", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 40, - 41, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": "]", - }, Object { "loc": Object { "end": Object { "column": 25, - "line": 2, + "line": 1, }, "start": Object { "column": 24, - "line": 2, + "line": 1, }, }, "range": Array [ - 43, - 44, + 24, + 25, ], "type": "Punctuator", - "value": "?", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 27, - "line": 2, + "line": 1, }, "start": Object { "column": 26, - "line": 2, + "line": 1, }, }, "range": Array [ - 45, - 46, + 26, + 27, ], "type": "Identifier", - "value": "U", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 28, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ - 47, - 48, + 27, + 28, ], "type": "Punctuator", "value": ":", @@ -108013,53 +112318,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 55, - 62, - ], - "type": "Keyword", - "value": "extends", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 29, + "line": 1, }, }, "range": Array [ - 63, - 68, + 29, + 34, ], "type": "Identifier", "value": "infer", @@ -108067,53 +112336,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 3, - }, - }, - "range": Array [ - 71, - 72, - ], - "type": "Punctuator", - "value": "?", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 3, + "column": 35, + "line": 1, }, }, "range": Array [ - 73, - 74, + 35, + 36, ], "type": "Identifier", "value": "U", @@ -108121,107 +112354,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 37, + "line": 1, }, "start": Object { - "column": 26, - "line": 3, + "column": 36, + "line": 1, }, }, "range": Array [ - 75, - 76, + 36, + 37, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 85, - 92, - ], - "type": "Keyword", - "value": "extends", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 39, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 93, - 100, + 38, + 39, ], "type": "Identifier", - "value": "Promise", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 40, + "line": 1, }, - "start": Object { - "column": 23, - "line": 4, + "start": Object { + "column": 39, + "line": 1, }, }, "range": Array [ - 100, - 101, + 39, + 40, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 4, + "column": 46, + "line": 1, }, "start": Object { - "column": 24, - "line": 4, + "column": 41, + "line": 1, }, }, "range": Array [ - 101, - 106, + 41, + 46, ], "type": "Identifier", "value": "infer", @@ -108229,17 +112426,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, + "column": 47, + "line": 1, }, }, "range": Array [ - 107, - 108, + 47, + 48, ], "type": "Identifier", "value": "U", @@ -108247,35 +112444,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 50, + "line": 1, }, "start": Object { - "column": 31, - "line": 4, + "column": 49, + "line": 1, }, }, "range": Array [ - 108, - 109, + 49, + 50, ], "type": "Punctuator", - "value": ">", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 4, + "column": 52, + "line": 1, }, "start": Object { - "column": 33, - "line": 4, + "column": 51, + "line": 1, }, }, "range": Array [ - 110, - 111, + 51, + 52, ], "type": "Punctuator", "value": "?", @@ -108283,17 +112480,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 54, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 53, + "line": 1, }, }, "range": Array [ - 112, - 113, + 53, + 54, ], "type": "Identifier", "value": "U", @@ -108301,17 +112498,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 4, + "column": 56, + "line": 1, }, "start": Object { - "column": 37, - "line": 4, + "column": 55, + "line": 1, }, }, "range": Array [ - 114, - 115, + 55, + 56, ], "type": "Punctuator", "value": ":", @@ -108319,35 +112516,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 57, + "line": 1, }, }, "range": Array [ - 124, - 125, + 57, + 62, ], "type": "Identifier", - "value": "T", + "value": "never", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 63, + "line": 1, }, "start": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, }, "range": Array [ - 125, - 126, + 62, + 63, ], "type": "Punctuator", "value": ";", @@ -108357,430 +112554,166 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = ` +exports[`typescript fixtures/types/conditional-with-null.src 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 63, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 63, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeReference", - "typeName": Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 45, "line": 1, }, "start": Object { - "column": 14, + "column": 4, "line": 1, }, }, - "name": "T", + "name": "x", "range": Array [ - 14, - 15, + 4, + 45, ], "type": "Identifier", - }, - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 1, }, "start": Object { - "column": 26, + "column": 5, "line": 1, }, }, "range": Array [ - 26, - 37, + 5, + 45, ], - "type": "TSPropertySignature", + "type": "TSTypeAnnotation", "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 36, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "checkType": Object { "loc": Object { "end": Object { - "column": 36, + "column": 13, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 36, + 7, + 13, ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", + "start": Object { + "column": 22, + "line": 1, }, - "range": Array [ - 35, - 36, - ], - "type": "TSTypeParameter", }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", }, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, }, + "range": Array [ + 41, + 45, + ], + "type": "TSNullKeyword", }, - "name": "b", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 48, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 48, + "column": 45, "line": 1, }, "start": Object { - "column": 39, + "column": 7, "line": 1, }, }, "range": Array [ - 39, - 48, + 7, + 45, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 41, + "column": 38, "line": 1, }, - }, - "range": Array [ - 41, - 48, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 47, - 48, - ], - "type": "Identifier", - }, - "range": Array [ - 47, - 48, - ], - "type": "TSTypeParameter", - }, - }, - }, - }, - ], - "range": Array [ - 24, - 50, - ], - "type": "TSTypeLiteral", - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 57, - "line": 1, - }, - }, - "range": Array [ - 57, - 62, - ], - "type": "TSNeverKeyword", - }, - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 62, - ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - }, - "type": "TSConditionalType", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", }, + "type": "TSConditionalType", }, - "name": "T", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, - "range": Array [ - 9, - 10, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 8, - 11, - ], - "type": "TSTypeParameterDeclaration", + "init": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", }, ], "comments": Array [], @@ -108796,14 +112729,14 @@ Object { }, "range": Array [ 0, - 64, + 47, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 3, "line": 1, }, "start": Object { @@ -108813,15 +112746,33 @@ Object { }, "range": Array [ 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ 4, + 5, ], "type": "Identifier", - "value": "type", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -108831,169 +112782,462 @@ Object { }, "range": Array [ 5, - 8, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, ], "type": "Identifier", - "value": "Foo", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 21, "line": 1, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, "range": Array [ - 8, - 9, + 14, + 21, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 28, "line": 1, }, "start": Object { - "column": 9, + "column": 22, "line": 1, }, }, "range": Array [ - 9, - 10, + 22, + 28, ], "type": "Identifier", - "value": "T", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 30, "line": 1, }, "start": Object { - "column": 10, + "column": 29, "line": 1, }, }, "range": Array [ - 10, - 11, + 29, + 30, ], "type": "Punctuator", - "value": ">", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 38, "line": 1, }, "start": Object { - "column": 12, + "column": 31, "line": 1, }, }, "range": Array [ - 12, - 13, + 31, + 38, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 40, "line": 1, }, "start": Object { - "column": 14, + "column": 39, "line": 1, }, }, "range": Array [ - 14, - 15, + 39, + 40, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 45, "line": 1, }, "start": Object { - "column": 16, + "column": 41, "line": 1, }, }, "range": Array [ - 16, - 23, + 41, + 45, ], "type": "Keyword", - "value": "extends", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 46, "line": 1, }, "start": Object { - "column": 24, + "column": 45, "line": 1, }, }, "range": Array [ - 24, - 25, + 45, + 46, ], "type": "Punctuator", - "value": "{", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 4, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 42, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 42, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 27, + "column": 3, "line": 1, }, "start": Object { - "column": 26, + "column": 0, "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, ], "type": "Identifier", - "value": "a", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 6, "line": 1, }, "start": Object { - "column": 27, + "column": 5, "line": 1, }, }, "range": Array [ - 27, - 28, + 5, + 6, ], "type": "Punctuator", "value": ":", @@ -109001,233 +113245,251 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 10, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 34, + 7, + 10, ], - "type": "Identifier", - "value": "infer", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 12, "line": 1, }, "start": Object { - "column": 35, + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, "line": 1, }, }, "range": Array [ - 35, - 36, + 12, + 13, ], "type": "Identifier", - "value": "U", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 14, "line": 1, }, "start": Object { - "column": 36, + "column": 13, "line": 1, }, }, "range": Array [ - 36, - 37, + 13, + 14, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 21, "line": 1, }, "start": Object { - "column": 38, + "column": 15, "line": 1, }, }, "range": Array [ - 38, - 39, + 15, + 21, ], "type": "Identifier", - "value": "b", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 22, "line": 1, }, "start": Object { - "column": 39, + "column": 21, "line": 1, }, }, "range": Array [ - 39, - 40, + 21, + 22, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 24, "line": 1, }, "start": Object { - "column": 41, + "column": 23, "line": 1, }, }, "range": Array [ - 41, - 46, + 23, + 24, ], "type": "Identifier", - "value": "infer", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 25, "line": 1, }, "start": Object { - "column": 47, + "column": 24, "line": 1, }, }, "range": Array [ - 47, - 48, + 24, + 25, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 50, + "column": 26, "line": 1, }, "start": Object { - "column": 49, + "column": 25, "line": 1, }, }, "range": Array [ - 49, - 50, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 52, + "column": 33, "line": 1, }, "start": Object { - "column": 51, + "column": 27, "line": 1, }, }, "range": Array [ - 51, - 52, + 27, + 33, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 54, + "column": 34, "line": 1, }, "start": Object { - "column": 53, + "column": 33, "line": 1, }, }, "range": Array [ - 53, - 54, + 33, + 34, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 37, "line": 1, }, "start": Object { - "column": 55, + "column": 35, "line": 1, }, }, "range": Array [ - 55, - 56, + 35, + 37, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 62, + "column": 42, "line": 1, }, "start": Object { - "column": 57, + "column": 38, "line": 1, }, }, "range": Array [ - 57, - 62, + 38, + 42, ], - "type": "Identifier", - "value": "never", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 63, + "column": 43, "line": 1, }, "start": Object { - "column": 62, + "column": 42, "line": 1, }, }, "range": Array [ - 62, - 63, + 42, + 43, ], "type": "Punctuator", "value": ";", @@ -109237,7 +113499,7 @@ Object { } `; -exports[`typescript fixtures/types/conditional-with-null.src 1`] = ` +exports[`typescript fixtures/types/constructor-generic.src 1`] = ` Object { "body": Array [ Object { @@ -109246,7 +113508,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -109254,16 +113516,16 @@ Object { "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ 4, - 45, + 25, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -109273,100 +113535,210 @@ Object { }, "range": Array [ 5, - 45, + 25, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, }, - "range": Array [ - 7, - 13, - ], - "type": "TSNumberKeyword", }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, }, - "start": Object { - "column": 22, - "line": 1, + "name": "a", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + }, }, }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - "falseType": Object { + ], + "range": Array [ + 7, + 25, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { - "column": 41, + "column": 21, "line": 1, }, }, "range": Array [ - 41, - 45, + 21, + 25, ], - "type": "TSNullKeyword", - }, - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, }, }, - "range": Array [ - 7, - 45, - ], - "trueType": Object { + "type": "TSConstructorType", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 38, + "column": 14, "line": 1, }, "start": Object { - "column": 31, + "column": 11, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "range": Array [ + 12, + 13, + ], + "type": "TSTypeParameter", + }, + ], "range": Array [ - 31, - 38, + 11, + 14, ], - "type": "TSBooleanKeyword", + "type": "TSTypeParameterDeclaration", }, - "type": "TSConditionalType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -109376,7 +113748,7 @@ Object { }, "range": Array [ 4, - 45, + 25, ], "type": "VariableDeclarator", }, @@ -109384,7 +113756,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 46, + "column": 26, "line": 1, }, "start": Object { @@ -109394,7 +113766,7 @@ Object { }, "range": Array [ 0, - 46, + 26, ], "type": "VariableDeclaration", }, @@ -109412,7 +113784,7 @@ Object { }, "range": Array [ 0, - 47, + 27, ], "sourceType": "module", "tokens": Array [ @@ -109450,7 +113822,7 @@ Object { 5, ], "type": "Identifier", - "value": "x", + "value": "f", }, Object { "loc": Object { @@ -109473,7 +113845,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { @@ -109483,15 +113855,69 @@ Object { }, "range": Array [ 7, + 10, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, 13, ], "type": "Identifier", - "value": "number", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, "line": 1, }, "start": Object { @@ -109501,115 +113927,133 @@ Object { }, "range": Array [ 14, - 21, + 15, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 16, "line": 1, }, "start": Object { - "column": 22, + "column": 15, "line": 1, }, }, "range": Array [ - 22, - 28, + 15, + 16, ], "type": "Identifier", - "value": "string", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 17, "line": 1, }, "start": Object { - "column": 29, + "column": 16, "line": 1, }, }, "range": Array [ - 29, - 30, + 16, + 17, ], "type": "Punctuator", - "value": "?", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 19, "line": 1, }, "start": Object { - "column": 31, + "column": 18, "line": 1, }, }, "range": Array [ - 31, - 38, + 18, + 19, ], "type": "Identifier", - "value": "boolean", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 20, "line": 1, }, "start": Object { - "column": 39, + "column": 19, "line": 1, }, }, "range": Array [ - 39, - 40, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 23, "line": 1, }, "start": Object { - "column": 41, + "column": 21, "line": 1, }, }, "range": Array [ - 41, - 45, + 21, + 23, ], - "type": "Keyword", - "value": "null", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 25, "line": 1, }, "start": Object { - "column": 45, + "column": 24, "line": 1, }, }, "range": Array [ - 45, - 46, + 24, + 25, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -109619,7 +114063,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor.src 1`] = ` +exports[`typescript fixtures/types/constructor-in-generic.src 1`] = ` Object { "body": Array [ Object { @@ -109628,7 +114072,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -109636,16 +114080,16 @@ Object { "line": 1, }, }, - "name": "f", + "name": "x", "range": Array [ 4, - 42, + 30, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -109655,13 +114099,13 @@ Object { }, "range": Array [ 5, - 42, + 30, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -109669,28 +114113,45 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "range": Array [ + 7, + 30, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "a", - "range": Array [ - 12, - 21, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { @@ -109698,130 +114159,61 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 13, - 21, + 29, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { - "column": 15, + "column": 20, "line": 1, }, }, "range": Array [ - 15, - 21, + 20, + 29, ], - "type": "TSNumberKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "b", - "optional": true, - "range": Array [ - 23, - 33, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 33, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, }, + "range": Array [ + 23, + 29, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 27, - 33, - ], - "type": "TSNumberKeyword", }, + "type": "TSConstructorType", }, - }, - ], - "range": Array [ - 7, - 42, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, + ], "range": Array [ - 35, - 42, + 12, + 30, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 42, - ], - "type": "TSVoidKeyword", - }, + "type": "TSTypeParameterInstantiation", }, - "type": "TSConstructorType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -109831,7 +114223,7 @@ Object { }, "range": Array [ 4, - 42, + 30, ], "type": "VariableDeclarator", }, @@ -109839,7 +114231,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 43, + "column": 31, "line": 1, }, "start": Object { @@ -109849,7 +114241,7 @@ Object { }, "range": Array [ 0, - 43, + 31, ], "type": "VariableDeclaration", }, @@ -109867,7 +114259,7 @@ Object { }, "range": Array [ 0, - 44, + 32, ], "sourceType": "module", "tokens": Array [ @@ -109905,7 +114297,7 @@ Object { 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { @@ -109928,7 +114320,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -109938,28 +114330,10 @@ Object { }, "range": Array [ 7, - 10, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { @@ -109976,13 +114350,13 @@ Object { 12, 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { @@ -109992,187 +114366,115 @@ Object { }, "range": Array [ 13, - 14, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 21, + 16, ], - "type": "Identifier", - "value": "number", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 18, "line": 1, }, "start": Object { - "column": 21, + "column": 17, "line": 1, }, }, "range": Array [ - 21, - 22, + 17, + 18, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - "value": "b", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 19, "line": 1, }, "start": Object { - "column": 24, + "column": 18, "line": 1, }, }, "range": Array [ - 24, - 25, + 18, + 19, ], "type": "Punctuator", - "value": "?", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 22, "line": 1, }, "start": Object { - "column": 25, + "column": 20, "line": 1, }, }, "range": Array [ - 25, - 26, + 20, + 22, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 29, "line": 1, }, "start": Object { - "column": 27, + "column": 23, "line": 1, }, }, "range": Array [ - 27, - 33, + 23, + 29, ], "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": ")", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 30, "line": 1, }, "start": Object { - "column": 35, + "column": 29, "line": 1, }, }, "range": Array [ - 35, - 37, + 29, + 30, ], "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 42, - ], - "type": "Keyword", - "value": "void", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 31, "line": 1, }, "start": Object { - "column": 42, + "column": 30, "line": 1, }, }, "range": Array [ - 42, - 43, + 30, + 31, ], "type": "Punctuator", "value": ";", @@ -110182,7 +114484,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-generic.src 1`] = ` +exports[`typescript fixtures/types/constructor-with-rest.src 1`] = ` Object { "body": Array [ Object { @@ -110191,7 +114493,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -110202,13 +114504,13 @@ Object { "name": "f", "range": Array [ 4, - 25, + 35, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -110218,13 +114520,13 @@ Object { }, "range": Array [ 5, - 25, + 35, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -110234,194 +114536,138 @@ Object { }, "params": Array [ Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 19, - ], - "type": "Identifier", - "typeAnnotation": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, + "name": "a", "range": Array [ + 15, 16, - 19, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - }, - }, - }, - ], - "range": Array [ - 7, - 25, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + "type": "Identifier", }, - }, - "range": Array [ - 21, - 25, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 26, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 26, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 24, - 25, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSConstructorType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "params": Array [ - Object { + "type": "RestElement", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 16, "line": 1, }, }, - "name": Object { + "range": Array [ + 16, + 26, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "TSNumberKeyword", + }, "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 18, "line": 1, }, }, - "name": "T", "range": Array [ - 12, - 13, + 18, + 26, ], - "type": "Identifier", + "type": "TSArrayType", }, - "range": Array [ - 12, - 13, - ], - "type": "TSTypeParameter", }, - ], + }, + ], + "range": Array [ + 7, + 35, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, "range": Array [ - 11, - 14, + 28, + 35, ], - "type": "TSTypeParameterDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSConstructorType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -110431,7 +114677,7 @@ Object { }, "range": Array [ 4, - 25, + 35, ], "type": "VariableDeclarator", }, @@ -110439,7 +114685,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { @@ -110449,7 +114695,7 @@ Object { }, "range": Array [ 0, - 26, + 36, ], "type": "VariableDeclaration", }, @@ -110467,7 +114713,7 @@ Object { }, "range": Array [ 0, - 27, + 37, ], "sourceType": "module", "tokens": Array [ @@ -110559,12 +114805,12 @@ Object { 12, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { @@ -110574,115 +114820,115 @@ Object { }, "range": Array [ 12, - 13, + 15, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { - "column": 13, + "column": 15, "line": 1, }, }, "range": Array [ - 13, - 14, + 15, + 16, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 14, + "column": 16, "line": 1, }, }, "range": Array [ - 14, - 15, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 1, }, "start": Object { - "column": 15, + "column": 18, "line": 1, }, }, "range": Array [ - 15, - 16, + 18, + 24, ], "type": "Identifier", - "value": "a", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 1, }, "start": Object { - "column": 16, + "column": 24, "line": 1, }, }, "range": Array [ - 16, - 17, + 24, + 25, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 26, "line": 1, }, "start": Object { - "column": 18, + "column": 25, "line": 1, }, }, "range": Array [ - 18, - 19, + 25, + 26, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 27, "line": 1, }, "start": Object { - "column": 19, + "column": 26, "line": 1, }, }, "range": Array [ - 19, - 20, + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -110690,17 +114936,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 30, "line": 1, }, "start": Object { - "column": 21, + "column": 28, "line": 1, }, }, "range": Array [ - 21, - 23, + 28, + 30, ], "type": "Punctuator", "value": "=>", @@ -110708,35 +114954,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { - "column": 24, + "column": 31, "line": 1, }, }, "range": Array [ - 24, - 25, + 31, + 35, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { - "column": 25, + "column": 35, "line": 1, }, }, "range": Array [ - 25, - 26, + 35, + 36, ], "type": "Punctuator", "value": ";", @@ -110746,7 +114992,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-in-generic.src 1`] = ` +exports[`typescript fixtures/types/function.src 1`] = ` Object { "body": Array [ Object { @@ -110755,7 +115001,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -110763,16 +115009,16 @@ Object { "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ 4, - 30, + 38, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -110782,13 +115028,13 @@ Object { }, "range": Array [ 5, - 30, + 38, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -110796,107 +115042,159 @@ Object { "line": 1, }, }, - "range": Array [ - 7, - 30, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - "start": Object { - "column": 7, - "line": 1, + "name": "a", + "range": Array [ + 8, + 17, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, }, }, - "name": "Array", - "range": Array [ - 7, - 12, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "name": "b", + "optional": true, + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 29, "line": 1, }, "start": Object { - "column": 13, + "column": 21, "line": 1, }, }, - "params": Array [], "range": Array [ - 13, + 21, 29, ], - "returnType": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 29, "line": 1, }, "start": Object { - "column": 20, + "column": 23, "line": 1, }, }, "range": Array [ - 20, + 23, 29, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 29, - ], - "type": "TSStringKeyword", - }, + "type": "TSNumberKeyword", }, - "type": "TSConstructorType", }, - ], + }, + ], + "range": Array [ + 7, + 38, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, "range": Array [ - 12, - 30, + 31, + 38, ], - "type": "TSTypeParameterInstantiation", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -110906,7 +115204,7 @@ Object { }, "range": Array [ 4, - 30, + 38, ], "type": "VariableDeclarator", }, @@ -110914,7 +115212,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { @@ -110924,7 +115222,7 @@ Object { }, "range": Array [ 0, - 31, + 39, ], "type": "VariableDeclaration", }, @@ -110942,7 +115240,7 @@ Object { }, "range": Array [ 0, - 32, + 40, ], "sourceType": "module", "tokens": Array [ @@ -110980,7 +115278,7 @@ Object { 5, ], "type": "Identifier", - "value": "x", + "value": "f", }, Object { "loc": Object { @@ -111003,7 +115301,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { @@ -111013,46 +115311,64 @@ Object { }, "range": Array [ 7, - 12, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, ], "type": "Identifier", - "value": "Array", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { - "column": 12, + "column": 9, "line": 1, }, }, "range": Array [ - 12, - 13, + 9, + 10, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { - "column": 13, + "column": 11, "line": 1, }, }, "range": Array [ - 13, - 16, + 11, + 17, ], - "type": "Keyword", - "value": "new", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { @@ -111070,30 +115386,30 @@ Object { 18, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { - "column": 18, + "column": 19, "line": 1, }, }, "range": Array [ - 18, 19, + 20, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 21, "line": 1, }, "start": Object { @@ -111103,10 +115419,28 @@ Object { }, "range": Array [ 20, + 21, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, 22, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { @@ -111124,7 +115458,7 @@ Object { 29, ], "type": "Identifier", - "value": "string", + "value": "number", }, Object { "loc": Object { @@ -111141,23 +115475,59 @@ Object { 29, 30, ], - "type": "Punctuator", - "value": ">", + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { - "column": 30, + "column": 38, "line": 1, }, }, "range": Array [ - 30, - 31, + 38, + 39, ], "type": "Punctuator", "value": ";", @@ -111167,7 +115537,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-with-rest.src 1`] = ` +exports[`typescript fixtures/types/function-generic.src 1`] = ` Object { "body": Array [ Object { @@ -111176,7 +115546,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -111187,13 +115557,13 @@ Object { "name": "f", "range": Array [ 4, - 35, + 21, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -111203,13 +115573,13 @@ Object { }, "range": Array [ 5, - 35, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -111219,138 +115589,194 @@ Object { }, "params": Array [ Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, + "name": "a", "range": Array [ - 12, - 26, + 11, + 15, ], - "type": "RestElement", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 16, + "column": 12, "line": 1, }, }, "range": Array [ - 16, - 26, + 12, + 15, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { - "elementType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 24, + "column": 15, "line": 1, }, "start": Object { - "column": 18, + "column": 14, "line": 1, }, }, + "name": "T", "range": Array [ - 18, - 24, + 14, + 15, ], - "type": "TSNumberKeyword", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "type": "Identifier", }, - "range": Array [ - 18, - 26, - ], - "type": "TSArrayType", }, }, }, ], "range": Array [ 7, - 35, + 21, ], "returnType": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 35, + 17, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 35, + 20, + 21, ], - "type": "TSVoidKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, }, }, - "type": "TSConstructorType", + "type": "TSFunctionType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, }, "init": null, "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -111360,7 +115786,7 @@ Object { }, "range": Array [ 4, - 35, + 21, ], "type": "VariableDeclarator", }, @@ -111368,7 +115794,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { @@ -111378,7 +115804,7 @@ Object { }, "range": Array [ 0, - 36, + 22, ], "type": "VariableDeclaration", }, @@ -111396,7 +115822,7 @@ Object { }, "range": Array [ 0, - 37, + 23, ], "sourceType": "module", "tokens": Array [ @@ -111457,7 +115883,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { @@ -111467,151 +115893,133 @@ Object { }, "range": Array [ 7, - 10, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, + 8, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { - "column": 12, + "column": 8, "line": 1, }, }, "range": Array [ - 12, - 15, + 8, + 9, ], - "type": "Punctuator", - "value": "...", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { - "column": 15, + "column": 9, "line": 1, }, }, "range": Array [ - 15, - 16, + 9, + 10, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 11, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 12, "line": 1, }, "start": Object { - "column": 18, + "column": 11, "line": 1, }, }, "range": Array [ - 18, - 24, + 11, + 12, ], "type": "Identifier", - "value": "number", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 13, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 13, ], "type": "Punctuator", - "value": "[", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 25, + "column": 14, "line": 1, }, }, "range": Array [ - 25, - 26, + 14, + 15, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 16, "line": 1, }, "start": Object { - "column": 26, + "column": 15, "line": 1, }, }, "range": Array [ - 26, - 27, + 15, + 16, ], "type": "Punctuator", "value": ")", @@ -111619,17 +116027,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 19, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 30, + 17, + 19, ], "type": "Punctuator", "value": "=>", @@ -111637,35 +116045,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 35, + 20, + 21, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { - "column": 35, + "column": 21, "line": 1, }, }, "range": Array [ - 35, - 36, + 21, + 22, ], "type": "Punctuator", "value": ";", @@ -111675,7 +116083,7 @@ Object { } `; -exports[`typescript fixtures/types/function.src 1`] = ` +exports[`typescript fixtures/types/function-in-generic.src 1`] = ` Object { "body": Array [ Object { @@ -111684,7 +116092,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -111692,16 +116100,16 @@ Object { "line": 1, }, }, - "name": "f", + "name": "x", "range": Array [ 4, - 38, + 24, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -111711,13 +116119,13 @@ Object { }, "range": Array [ 5, - 38, + 24, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -111725,159 +116133,107 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "range": Array [ + 7, + 24, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "a", - "range": Array [ - 8, - 17, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 17, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 17, - ], - "type": "TSNumberKeyword", - }, + "start": Object { + "column": 7, + "line": 1, }, }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, + "name": "Array", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, }, - "name": "b", - "optional": true, - "range": Array [ - 19, - 29, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, + "params": Array [], "range": Array [ - 21, - 29, + 13, + 23, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 23, + "column": 16, "line": 1, }, }, "range": Array [ + 16, 23, - 29, ], - "type": "TSNumberKeyword", - }, - }, - }, - ], - "range": Array [ - 7, - 38, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 34, - 38, - ], - "type": "TSVoidKeyword", - }, + ], + "range": Array [ + 12, + 24, + ], + "type": "TSTypeParameterInstantiation", }, - "type": "TSFunctionType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -111887,7 +116243,7 @@ Object { }, "range": Array [ 4, - 38, + 24, ], "type": "VariableDeclarator", }, @@ -111895,7 +116251,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 39, + "column": 25, "line": 1, }, "start": Object { @@ -111905,7 +116261,7 @@ Object { }, "range": Array [ 0, - 39, + 25, ], "type": "VariableDeclaration", }, @@ -111923,7 +116279,7 @@ Object { }, "range": Array [ 0, - 40, + 26, ], "sourceType": "module", "tokens": Array [ @@ -111961,7 +116317,7 @@ Object { 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { @@ -111984,7 +116340,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -111994,64 +116350,64 @@ Object { }, "range": Array [ 7, - 8, + 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { - "column": 8, + "column": 12, "line": 1, }, }, "range": Array [ - 8, - 9, + 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 13, "line": 1, }, }, "range": Array [ - 9, - 10, + 13, + 14, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 14, "line": 1, }, }, "range": Array [ - 11, - 17, + 14, + 15, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -112060,21 +116416,21 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 16, "line": 1, }, }, "range": Array [ - 17, + 16, 18, ], "type": "Punctuator", - "value": ",", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 23, "line": 1, }, "start": Object { @@ -112084,51 +116440,15 @@ Object { }, "range": Array [ 19, - 20, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": "?", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, + 23, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 24, "line": 1, }, "start": Object { @@ -112138,358 +116458,195 @@ Object { }, "range": Array [ 23, - 29, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, + 24, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 25, "line": 1, }, "start": Object { - "column": 31, + "column": 24, "line": 1, }, }, "range": Array [ - 31, - 33, + 24, + 25, ], "type": "Punctuator", - "value": "=>", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/function-with-array-destruction.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", }, - "range": Array [ - 34, - 38, - ], - "type": "Keyword", - "value": "void", - }, - Object { "loc": Object { "end": Object { - "column": 39, + "column": 28, "line": 1, }, "start": Object { - "column": 38, + "column": 0, "line": 1, }, }, "range": Array [ - 38, - 39, + 0, + 28, ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/function-generic.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "f", "range": Array [ - 4, - 21, + 12, + 20, ], - "type": "Identifier", + "type": "ArrayPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 5, + "column": 15, "line": 1, }, }, "range": Array [ - 5, - 21, + 15, + 20, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 11, - 15, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 15, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - }, - }, - }, - ], "range": Array [ - 7, - 21, + 17, + 20, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 21, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSFunctionType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - "range": Array [ - 8, - 9, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 7, - 10, - ], - "type": "TSTypeParameterDeclaration", - }, + "type": "TSAnyKeyword", }, }, }, - "init": null, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, "range": Array [ - 4, - 21, + 22, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "TSFunctionType", + }, }, ], "comments": Array [], @@ -112505,14 +116662,14 @@ Object { }, "range": Array [ 0, - 23, + 29, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -112522,33 +116679,15 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Keyword", - "value": "let", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ 4, - 5, ], "type": "Identifier", - "value": "f", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -112558,46 +116697,10 @@ Object { }, "range": Array [ 5, - 6, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ 8, - 9, ], "type": "Identifier", - "value": "T", + "value": "foo", }, Object { "loc": Object { @@ -112615,22 +116718,22 @@ Object { 10, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, 11, + 12, ], "type": "Punctuator", "value": "(", @@ -112638,38 +116741,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, "range": Array [ - 11, 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -112686,8 +116789,8 @@ Object { 14, 15, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -112705,12 +116808,12 @@ Object { 16, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { @@ -112720,10 +116823,10 @@ Object { }, "range": Array [ 17, - 19, + 20, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { @@ -112740,213 +116843,250 @@ Object { 20, 21, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 24, "line": 1, }, "start": Object { - "column": 21, + "column": 22, "line": 1, }, }, "range": Array [ - 21, 22, + 24, ], "type": "Punctuator", - "value": ";", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", }, ], "type": "Program", } `; -exports[`typescript fixtures/types/function-in-generic.src 1`] = ` +exports[`typescript fixtures/types/function-with-object-destruction.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 24, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "x", - "range": Array [ - 4, - 24, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", }, - }, - "range": Array [ - 5, - 24, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, + "method": false, "range": Array [ - 7, - 24, + 13, + 14, ], - "type": "TSTypeReference", - "typeName": Object { + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, - "name": "Array", + "name": "a", "range": Array [ - 7, - 12, + 13, + 14, ], "type": "Identifier", }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 13, - 23, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 23, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 23, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSFunctionType", - }, - ], - "range": Array [ - 12, - 24, - ], - "type": "TSTypeParameterInstantiation", }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", }, }, }, - "init": null, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 24, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, "range": Array [ - 4, - 24, + 22, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 0, - 25, - ], - "type": "VariableDeclaration", }, ], "comments": Array [], @@ -112962,14 +117102,14 @@ Object { }, "range": Array [ 0, - 26, + 29, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -112979,46 +117119,46 @@ Object { }, "range": Array [ 0, - 3, + 4, ], - "type": "Keyword", - "value": "let", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 5, "line": 1, }, }, "range": Array [ - 4, 5, + 8, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 6, + 9, + 10, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { @@ -113027,16 +117167,16 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 11, "line": 1, }, }, "range": Array [ - 7, + 11, 12, ], - "type": "Identifier", - "value": "Array", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -113054,7 +117194,7 @@ Object { 13, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { @@ -113071,8 +117211,8 @@ Object { 13, 14, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -113090,43 +117230,61 @@ Object { 15, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 18, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 20, "line": 1, }, "start": Object { - "column": 19, + "column": 17, "line": 1, }, }, "range": Array [ - 19, - 23, + 17, + 20, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -113135,34 +117293,34 @@ Object { "line": 1, }, "start": Object { - "column": 23, + "column": 22, "line": 1, }, }, "range": Array [ - 23, + 22, 24, ], "type": "Punctuator", - "value": ">", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 28, "line": 1, }, "start": Object { - "column": 24, + "column": 25, "line": 1, }, }, "range": Array [ - 24, 25, + 28, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "any", }, ], "type": "Program", diff --git a/packages/shared-fixtures/fixtures/typescript/basics/function-anonymus-with-type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-anonymus-with-type-parameters.src.ts new file mode 100644 index 00000000000..44c7468b366 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/function-anonymus-with-type-parameters.src.ts @@ -0,0 +1,3 @@ +var obj = function (a: string) { + return a; +}; diff --git a/packages/shared-fixtures/fixtures/typescript/basics/function-anynomus-with-return-type.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-anynomus-with-return-type.src.ts new file mode 100644 index 00000000000..a5d4544e0b1 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/function-anynomus-with-return-type.src.ts @@ -0,0 +1,2 @@ +var obj = function (): void { +}; diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts new file mode 100644 index 00000000000..8370eae3584 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts @@ -0,0 +1 @@ +foo<>(); diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts new file mode 100644 index 00000000000..58900f001ee --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts @@ -0,0 +1 @@ +new Foo<>() diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts new file mode 100644 index 00000000000..1dbabedb798 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts @@ -0,0 +1 @@ +function f1<>() {} diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts new file mode 100644 index 00000000000..1c24174dfb9 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts @@ -0,0 +1,3 @@ +class foo { + constructor<>() {} +} diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts new file mode 100644 index 00000000000..97b3b1bd5b9 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts @@ -0,0 +1 @@ +const foo = function<>() {} diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts new file mode 100644 index 00000000000..266c7827325 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts @@ -0,0 +1,3 @@ +interface foo { + test<>(); +} diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src.ts new file mode 100644 index 00000000000..5544096856d --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src.ts @@ -0,0 +1,3 @@ +class foo { + test<>() {} +} diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters.src.ts new file mode 100644 index 00000000000..1dbabedb798 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters.src.ts @@ -0,0 +1 @@ +function f1<>() {} diff --git a/packages/shared-fixtures/fixtures/typescript/types/function-with-array-destruction.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function-with-array-destruction.src.ts new file mode 100644 index 00000000000..2517be450da --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/function-with-array-destruction.src.ts @@ -0,0 +1 @@ +type foo = ([a]: any) => any diff --git a/packages/shared-fixtures/fixtures/typescript/types/function-with-object-destruction.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function-with-object-destruction.src.ts new file mode 100644 index 00000000000..fdb44b90178 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/function-with-object-destruction.src.ts @@ -0,0 +1 @@ +type foo = ({a}: any) => any diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index 59a2326122c..1efff92648d 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -7,7 +7,7 @@ import ts from 'typescript'; import { getLocFor, getNodeContainer } from './node-utils'; -import * as es from './typedefs'; +import { TSESTree } from './ts-estree'; /** * Converts a TypeScript comment to an Esprima comment. @@ -25,10 +25,10 @@ function convertTypeScriptCommentToEsprimaComment( text: string, start: number, end: number, - startLoc: es.LineAndColumnData, - endLoc: es.LineAndColumnData -): es.Comment { - const comment: es.OptionalRangeAndLoc = { + startLoc: TSESTree.LineAndColumnData, + endLoc: TSESTree.LineAndColumnData +): TSESTree.Comment { + const comment: TSESTree.OptionalRangeAndLoc = { type: block ? 'Block' : 'Line', value: text }; @@ -44,7 +44,7 @@ function convertTypeScriptCommentToEsprimaComment( }; } - return comment as es.Comment; + return comment as TSESTree.Comment; } /** @@ -59,7 +59,7 @@ function getCommentFromTriviaScanner( triviaScanner: ts.Scanner, ast: ts.SourceFile, code: string -): es.Comment { +): TSESTree.Comment { const kind = triviaScanner.getToken(); const isBlock = kind === ts.SyntaxKind.MultiLineCommentTrivia; const range = { @@ -94,8 +94,8 @@ function getCommentFromTriviaScanner( export function convertComments( ast: ts.SourceFile, code: string -): es.Comment[] { - const comments: es.Comment[] = []; +): TSESTree.Comment[] { + const comments: TSESTree.Comment[] = []; /** * Create a TypeScript Scanner, with skipTrivia set to false so that diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index eb2e69a60ec..bf121fa01bb 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -6,7 +6,7 @@ * MIT License */ import ts from 'typescript'; -import * as es from './typedefs'; +import { TSESTree } from './ts-estree'; import { canContainDirective, createError, @@ -78,8 +78,8 @@ export class Converter { }; } - convertProgram(): es.Program { - return this.converter(this.ast) as es.Program; + convertProgram(): TSESTree.Program { + return this.converter(this.ast) as TSESTree.Program; } /** @@ -112,7 +112,7 @@ export class Converter { this.allowPattern = allowPattern; } - let result: es.BaseNode | null = this.convertNode( + let result: TSESTree.BaseNode | null = this.convertNode( node as TSNode, parent || node.parent ); @@ -157,9 +157,9 @@ export class Converter { return this.converter(child, parent, true, false); } - private createNode( + private createNode( node: ts.Node, - data: es.OptionalRangeAndLoc + data: TSESTree.OptionalRangeAndLoc ): T { const result = data; if (!result.range) { @@ -182,7 +182,7 @@ export class Converter { private convertTypeAnnotation( child: ts.TypeNode, parent: ts.Node - ): es.TSTypeAnnotation { + ): TSESTree.TSTypeAnnotation { // in FunctionType and ConstructorType typeAnnotation has 2 characters `=>` and in other places is just colon const offset = parent.kind === SyntaxKind.FunctionType || @@ -244,7 +244,7 @@ export class Converter { */ private convertTypeArgumentsToTypeParameters( typeArguments: ts.NodeArray - ): es.TSTypeParameterInstantiation { + ): TSESTree.TSTypeParameterInstantiation { const greaterThanToken = findNextToken(typeArguments, this.ast, this.ast)!; return { @@ -262,7 +262,7 @@ export class Converter { */ private convertTSTypeParametersToTypeParametersDeclaration( typeParameters: ts.NodeArray - ): es.TSTypeParameterDeclaration { + ): TSESTree.TSTypeParameterDeclaration { const greaterThanToken = findNextToken(typeParameters, this.ast, this.ast)!; return { @@ -282,12 +282,12 @@ export class Converter { */ private convertParameters( parameters: ts.NodeArray - ): es.Parameter[] { + ): TSESTree.Parameter[] { if (!parameters || !parameters.length) { return []; } return parameters.map(param => { - const convertedParam = this.convertChild(param) as es.Parameter; + const convertedParam = this.convertChild(param) as TSESTree.Parameter; if (param.decorators && param.decorators.length) { convertedParam.decorators = param.decorators.map(el => @@ -375,28 +375,28 @@ export class Converter { private convertJSXTagName( node: ts.JsxTagNameExpression, parent: ts.Node - ): es.JSXMemberExpression | es.JSXIdentifier { - let result: es.JSXMemberExpression | es.JSXIdentifier; + ): TSESTree.JSXMemberExpression | TSESTree.JSXIdentifier { + let result: TSESTree.JSXMemberExpression | TSESTree.JSXIdentifier; switch (node.kind) { case SyntaxKind.PropertyAccessExpression: - result = this.createNode(node, { + result = this.createNode(node, { type: AST_NODE_TYPES.JSXMemberExpression, object: this.convertJSXTagName(node.expression, parent), property: this.convertJSXTagName( node.name, parent - ) as es.JSXIdentifier + ) as TSESTree.JSXIdentifier }); break; case SyntaxKind.ThisKeyword: - result = this.createNode(node, { + result = this.createNode(node, { type: AST_NODE_TYPES.JSXIdentifier, name: 'this' }); break; case SyntaxKind.Identifier: default: - result = this.createNode(node, { + result = this.createNode(node, { type: AST_NODE_TYPES.JSXIdentifier, name: node.text }); @@ -419,7 +419,7 @@ export class Converter { * @deprecated This method adds not standardized `modifiers` property in nodes */ private applyModifiersToResult( - result: es.TSEnumDeclaration | es.TSModuleDeclaration, + result: TSESTree.TSEnumDeclaration | TSESTree.TSModuleDeclaration, modifiers?: ts.ModifiersArray ): void { if (!modifiers || !modifiers.length) { @@ -474,7 +474,7 @@ export class Converter { * @param childRange The child node range used to expand location */ private fixParentLocation( - result: es.BaseNode, + result: TSESTree.BaseNode, childRange: [number, number] ): void { if (childRange[0] < result.range[0]) { @@ -495,10 +495,10 @@ export class Converter { * @param parent parentNode * @returns the converted ESTree node */ - private convertNode(node: TSNode, parent: ts.Node): es.Node | null { + private convertNode(node: TSNode, parent: ts.Node): TSESTree.Node | null { switch (node.kind) { case SyntaxKind.SourceFile: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Program, body: this.convertBodyExpressions(node.statements, node), // externalModuleIndicator is internal field in TSC @@ -510,21 +510,21 @@ export class Converter { } case SyntaxKind.Block: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.BlockStatement, body: this.convertBodyExpressions(node.statements, node) }); } case SyntaxKind.Identifier: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Identifier, name: node.text }); } case SyntaxKind.WithStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.WithStatement, object: this.convertChild(node.expression), body: this.convertChild(node.statement) @@ -533,26 +533,26 @@ export class Converter { // Control Flow case SyntaxKind.ReturnStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ReturnStatement, argument: this.convertChild(node.expression) }); case SyntaxKind.LabeledStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.LabeledStatement, label: this.convertChild(node.label), body: this.convertChild(node.statement) }); case SyntaxKind.ContinueStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ContinueStatement, label: this.convertChild(node.label) }); case SyntaxKind.BreakStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.BreakStatement, label: this.convertChild(node.label) }); @@ -560,7 +560,7 @@ export class Converter { // Choice case SyntaxKind.IfStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.IfStatement, test: this.convertChild(node.expression), consequent: this.convertChild(node.thenStatement), @@ -568,7 +568,7 @@ export class Converter { }); case SyntaxKind.SwitchStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.SwitchStatement, discriminant: this.convertChild(node.expression), cases: node.caseBlock.clauses.map(el => this.convertChild(el)) @@ -576,7 +576,7 @@ export class Converter { case SyntaxKind.CaseClause: case SyntaxKind.DefaultClause: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.SwitchCase, // expression is present in case only test: @@ -589,13 +589,13 @@ export class Converter { // Exceptions case SyntaxKind.ThrowStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ThrowStatement, argument: this.convertChild(node.expression) }); case SyntaxKind.TryStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TryStatement, block: this.convertChild(node.tryBlock), handler: this.convertChild(node.catchClause), @@ -603,7 +603,7 @@ export class Converter { }); case SyntaxKind.CatchClause: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.CatchClause, param: node.variableDeclaration ? this.convertChild(node.variableDeclaration.name) @@ -614,7 +614,7 @@ export class Converter { // Loops case SyntaxKind.WhileStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.WhileStatement, test: this.convertChild(node.expression), body: this.convertChild(node.statement) @@ -625,14 +625,14 @@ export class Converter { * a "DoStatement" */ case SyntaxKind.DoStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.DoWhileStatement, test: this.convertChild(node.expression), body: this.convertChild(node.statement) }); case SyntaxKind.ForStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ForStatement, init: this.convertChild(node.initializer), test: this.convertChild(node.condition), @@ -641,7 +641,7 @@ export class Converter { }); case SyntaxKind.ForInStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ForInStatement, left: this.convertPattern(node.initializer), right: this.convertChild(node.expression), @@ -649,7 +649,7 @@ export class Converter { }); case SyntaxKind.ForOfStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ForOfStatement, left: this.convertPattern(node.initializer), right: this.convertChild(node.expression), @@ -666,7 +666,7 @@ export class Converter { const isDeclare = hasModifier(SyntaxKind.DeclareKeyword, node); const result = this.createNode< - es.TSDeclareFunction | es.FunctionDeclaration + TSESTree.TSDeclareFunction | TSESTree.FunctionDeclaration >(node, { type: isDeclare || !node.body @@ -690,18 +690,29 @@ export class Converter { } // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { + if (node.typeParameters) { result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters ); } + /** + * Semantically, decorators are not allowed on function declarations, + * but the TypeScript compiler will parse them and produce a valid AST, + * so we handle them here too. + */ + if (node.decorators) { + (result as any).decorators = node.decorators.map(el => + this.convertChild(el) + ); + } + // check for exports return fixExports(node, result, this.ast); } case SyntaxKind.VariableDeclaration: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.VariableDeclarator, id: this.convertPattern(node.name), init: this.convertChild(node.initializer) @@ -722,7 +733,7 @@ export class Converter { } case SyntaxKind.VariableStatement: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.VariableDeclaration, declarations: node.declarationList.declarations.map(el => this.convertChild(el) @@ -730,6 +741,17 @@ export class Converter { kind: getDeclarationKind(node.declarationList) }); + /** + * Semantically, decorators are not allowed on variable declarations, + * but the TypeScript compiler will parse them and produce a valid AST, + * so we handle them here too. + */ + if (node.decorators) { + (result as any).decorators = node.decorators.map(el => + this.convertChild(el) + ); + } + if (hasModifier(SyntaxKind.DeclareKeyword, node)) { result.declare = true; } @@ -740,7 +762,7 @@ export class Converter { // mostly for for-of, for-in case SyntaxKind.VariableDeclarationList: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.VariableDeclaration, declarations: node.declarations.map(el => this.convertChild(el)), kind: getDeclarationKind(node) @@ -749,25 +771,25 @@ export class Converter { // Expressions case SyntaxKind.ExpressionStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ExpressionStatement, expression: this.convertChild(node.expression) }); case SyntaxKind.ThisKeyword: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ThisExpression }); case SyntaxKind.ArrayLiteralExpression: { // TypeScript uses ArrayLiteralExpression in destructuring assignment, too if (this.allowPattern) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ArrayPattern, elements: node.elements.map(el => this.convertPattern(el)) }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ArrayExpression, elements: node.elements.map(el => this.convertChild(el)) }); @@ -777,12 +799,12 @@ export class Converter { case SyntaxKind.ObjectLiteralExpression: { // TypeScript uses ObjectLiteralExpression in destructuring assignment, too if (this.allowPattern) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ObjectPattern, properties: node.properties.map(el => this.convertPattern(el)) }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ObjectExpression, properties: node.properties.map(el => this.convertChild(el)) }); @@ -790,7 +812,7 @@ export class Converter { } case SyntaxKind.PropertyAssignment: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Property, key: this.convertChild(node.name), value: this.converter( @@ -807,10 +829,10 @@ export class Converter { case SyntaxKind.ShorthandPropertyAssignment: { if (node.objectAssignmentInitializer) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Property, key: this.convertChild(node.name), - value: this.createNode(node, { + value: this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, left: this.convertPattern(node.name), right: this.convertChild(node.objectAssignmentInitializer) @@ -821,7 +843,7 @@ export class Converter { kind: 'init' }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Property, key: this.convertChild(node.name), value: this.convertChild(node.name), @@ -839,7 +861,7 @@ export class Converter { case SyntaxKind.PropertyDeclaration: { const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); const result = this.createNode< - es.TSAbstractClassProperty | es.ClassProperty + TSESTree.TSAbstractClassProperty | TSESTree.ClassProperty >(node, { type: isAbstract ? AST_NODE_TYPES.TSAbstractClassProperty @@ -881,7 +903,7 @@ export class Converter { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.MethodDeclaration: { - const method = this.createNode(node, { + const method = this.createNode(node, { type: AST_NODE_TYPES.FunctionExpression, id: null, generator: !!node.asteriskToken, @@ -897,7 +919,7 @@ export class Converter { } // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { + if (node.typeParameters) { method.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters ); @@ -905,14 +927,14 @@ export class Converter { } let result: - | es.Property - | es.TSAbstractMethodDefinition - | es.MethodDefinition; + | TSESTree.Property + | TSESTree.TSAbstractMethodDefinition + | TSESTree.MethodDefinition; if (parent.kind === SyntaxKind.ObjectLiteralExpression) { method.params = node.parameters.map(el => this.convertChild(el)); - result = this.createNode(node, { + result = this.createNode(node, { type: AST_NODE_TYPES.Property, key: this.convertChild(node.name), value: method, @@ -940,7 +962,7 @@ export class Converter { : AST_NODE_TYPES.MethodDefinition; result = this.createNode< - es.TSAbstractMethodDefinition | es.MethodDefinition + TSESTree.TSAbstractMethodDefinition | TSESTree.MethodDefinition >(node, { type: methodDefinitionType, key: this.convertChild(node.name), @@ -974,7 +996,7 @@ export class Converter { } else if (node.kind === SyntaxKind.SetAccessor) { result.kind = 'set'; } else if ( - !(result as es.MethodDefinition).static && + !(result as TSESTree.MethodDefinition).static && node.name.kind === SyntaxKind.StringLiteral && node.name.text === 'constructor' && result.type !== AST_NODE_TYPES.Property @@ -991,7 +1013,7 @@ export class Converter { (lastModifier && findNextToken(lastModifier, node, this.ast)) || node.getFirstToken()!; - const constructor = this.createNode(node, { + const constructor = this.createNode(node, { type: AST_NODE_TYPES.FunctionExpression, id: null, params: this.convertParameters(node.parameters), @@ -1003,7 +1025,7 @@ export class Converter { }); // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { + if (node.typeParameters) { constructor.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters ); @@ -1015,7 +1037,7 @@ export class Converter { constructor.returnType = this.convertTypeAnnotation(node.type, node); } - const constructorKey = this.createNode(node, { + const constructorKey = this.createNode(node, { type: AST_NODE_TYPES.Identifier, name: 'constructor', range: [constructorToken.getStart(this.ast), constructorToken.end] @@ -1023,7 +1045,7 @@ export class Converter { const isStatic = hasModifier(SyntaxKind.StaticKeyword, node); const result = this.createNode< - es.TSAbstractMethodDefinition | es.MethodDefinition + TSESTree.TSAbstractMethodDefinition | TSESTree.MethodDefinition >(node, { type: hasModifier(SyntaxKind.AbstractKeyword, node) ? AST_NODE_TYPES.TSAbstractMethodDefinition @@ -1044,7 +1066,7 @@ export class Converter { } case SyntaxKind.FunctionExpression: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.FunctionExpression, id: this.convertChild(node.name), generator: !!node.asteriskToken, @@ -1060,7 +1082,7 @@ export class Converter { } // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { + if (node.typeParameters) { result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters ); @@ -1069,12 +1091,12 @@ export class Converter { } case SyntaxKind.SuperKeyword: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Super }); case SyntaxKind.ArrayBindingPattern: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ArrayPattern, elements: node.elements.map(el => this.convertPattern(el)) }); @@ -1084,7 +1106,7 @@ export class Converter { return null; case SyntaxKind.ObjectBindingPattern: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ObjectPattern, properties: node.elements.map(el => this.convertPattern(el)) }); @@ -1094,13 +1116,13 @@ export class Converter { const arrayItem = this.convertChild(node.name, parent); if (node.initializer) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, left: arrayItem, right: this.convertChild(node.initializer) }); } else if (node.dotDotDotToken) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: arrayItem }); @@ -1108,14 +1130,14 @@ export class Converter { return arrayItem; } } else if (parent.kind === SyntaxKind.ObjectBindingPattern) { - let result: es.RestElement | es.Property; + let result: TSESTree.RestElement | TSESTree.Property; if (node.dotDotDotToken) { - result = this.createNode(node, { + result = this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: this.convertChild(node.propertyName || node.name) }); } else { - result = this.createNode(node, { + result = this.createNode(node, { type: AST_NODE_TYPES.Property, key: this.convertChild(node.propertyName || node.name), value: this.convertChild(node.name), @@ -1130,7 +1152,7 @@ export class Converter { } if (node.initializer) { - result.value = this.createNode(node, { + result.value = this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, left: this.convertChild(node.name), right: this.convertChild(node.initializer), @@ -1143,7 +1165,7 @@ export class Converter { } case SyntaxKind.ArrowFunction: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.ArrowFunctionExpression, generator: false, id: null, @@ -1159,7 +1181,7 @@ export class Converter { } // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { + if (node.typeParameters) { result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters ); @@ -1168,14 +1190,14 @@ export class Converter { } case SyntaxKind.YieldExpression: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.YieldExpression, delegate: !!node.asteriskToken, argument: this.convertChild(node.expression) }); case SyntaxKind.AwaitExpression: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.AwaitExpression, argument: this.convertChild(node.expression) }); @@ -1183,10 +1205,10 @@ export class Converter { // Template Literals case SyntaxKind.NoSubstitutionTemplateLiteral: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TemplateLiteral, quasis: [ - this.createNode(node, { + this.createNode(node, { type: AST_NODE_TYPES.TemplateElement, value: { raw: this.ast.text.slice( @@ -1202,7 +1224,7 @@ export class Converter { }); case SyntaxKind.TemplateExpression: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TemplateLiteral, quasis: [this.convertChild(node.head)], expressions: [] @@ -1216,7 +1238,7 @@ export class Converter { } case SyntaxKind.TaggedTemplateExpression: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TaggedTemplateExpression, typeParameters: node.typeArguments ? this.convertTypeArgumentsToTypeParameters(node.typeArguments) @@ -1229,7 +1251,7 @@ export class Converter { case SyntaxKind.TemplateMiddle: case SyntaxKind.TemplateTail: { const tail = node.kind === SyntaxKind.TemplateTail; - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TemplateElement, value: { raw: this.ast.text.slice( @@ -1247,12 +1269,12 @@ export class Converter { case SyntaxKind.SpreadAssignment: case SyntaxKind.SpreadElement: { if (this.allowPattern) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: this.convertPattern(node.expression) }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.SpreadElement, argument: this.convertChild(node.expression) }); @@ -1261,16 +1283,16 @@ export class Converter { case SyntaxKind.Parameter: { let parameter: any; - let result: es.RestElement | es.AssignmentPattern; + let result: TSESTree.RestElement | TSESTree.AssignmentPattern; if (node.dotDotDotToken) { - parameter = result = this.createNode(node, { + parameter = result = this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: this.convertChild(node.name) }); } else if (node.initializer) { parameter = this.convertChild(node.name); - result = this.createNode(node, { + result = this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, left: parameter, right: this.convertChild(node.initializer) @@ -1305,7 +1327,7 @@ export class Converter { } if (node.modifiers) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSParameterProperty, accessibility: getTSNodeAccessibility(node) || undefined, readonly: @@ -1337,11 +1359,11 @@ export class Converter { ); const result = this.createNode< - es.ClassDeclaration | es.ClassExpression + TSESTree.ClassDeclaration | TSESTree.ClassExpression >(node, { type: classNodeType, id: this.convertChild(node.name), - body: this.createNode(node, { + body: this.createNode(node, { type: AST_NODE_TYPES.ClassBody, body: [], range: [node.members.pos - 1, node.end] @@ -1368,7 +1390,7 @@ export class Converter { } } - if (node.typeParameters && node.typeParameters.length) { + if (node.typeParameters) { result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters ); @@ -1407,13 +1429,13 @@ export class Converter { // Modules case SyntaxKind.ModuleBlock: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSModuleBlock, body: this.convertBodyExpressions(node.statements, node) }); case SyntaxKind.ImportDeclaration: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.ImportDeclaration, source: this.convertChild(node.moduleSpecifier), specifiers: [] @@ -1445,20 +1467,20 @@ export class Converter { } case SyntaxKind.NamespaceImport: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ImportNamespaceSpecifier, local: this.convertChild(node.name) }); case SyntaxKind.ImportSpecifier: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ImportSpecifier, local: this.convertChild(node.name), imported: this.convertChild(node.propertyName || node.name) }); case SyntaxKind.ImportClause: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ImportDefaultSpecifier, local: this.convertChild(node.name), range: [node.getStart(this.ast), node.name!.end] @@ -1466,7 +1488,7 @@ export class Converter { case SyntaxKind.ExportDeclaration: if (node.exportClause) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ExportNamedDeclaration, source: this.convertChild(node.moduleSpecifier), specifiers: node.exportClause.elements.map(el => @@ -1475,14 +1497,14 @@ export class Converter { declaration: null }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ExportAllDeclaration, source: this.convertChild(node.moduleSpecifier) }); } case SyntaxKind.ExportSpecifier: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ExportSpecifier, local: this.convertChild(node.propertyName || node.name), exported: this.convertChild(node.name) @@ -1490,12 +1512,12 @@ export class Converter { case SyntaxKind.ExportAssignment: if (node.isExportEquals) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSExportAssignment, expression: this.convertChild(node.expression) }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ExportDefaultDeclaration, declaration: this.convertChild(node.expression) }); @@ -1510,14 +1532,14 @@ export class Converter { * ESTree uses UpdateExpression for ++/-- */ if (/^(?:\+\+|--)$/.test(operator)) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.UpdateExpression, operator, prefix: node.kind === SyntaxKind.PrefixUnaryExpression, argument: this.convertChild(node.operand) }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.UnaryExpression, operator, prefix: node.kind === SyntaxKind.PrefixUnaryExpression, @@ -1527,7 +1549,7 @@ export class Converter { } case SyntaxKind.DeleteExpression: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.UnaryExpression, operator: 'delete', prefix: true, @@ -1535,7 +1557,7 @@ export class Converter { }); case SyntaxKind.VoidExpression: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.UnaryExpression, operator: 'void', prefix: true, @@ -1543,7 +1565,7 @@ export class Converter { }); case SyntaxKind.TypeOfExpression: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.UnaryExpression, operator: 'typeof', prefix: true, @@ -1551,7 +1573,7 @@ export class Converter { }); case SyntaxKind.TypeOperator: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSTypeOperator, operator: getTextForTokenKind(node.operator) as any, typeAnnotation: this.convertChild(node.type) @@ -1562,7 +1584,7 @@ export class Converter { case SyntaxKind.BinaryExpression: { // TypeScript uses BinaryExpression for sequences as well if (isComma(node.operatorToken)) { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.SequenceExpression, expressions: [] }); @@ -1588,14 +1610,16 @@ export class Converter { this.allowPattern && type === AST_NODE_TYPES.AssignmentExpression ) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, left: this.convertPattern(node.left, node), right: this.convertChild(node.right) }); } return this.createNode< - es.AssignmentExpression | es.LogicalExpression | es.BinaryExpression + | TSESTree.AssignmentExpression + | TSESTree.LogicalExpression + | TSESTree.BinaryExpression >(node, { type: type, operator: getTextForTokenKind(node.operatorToken.kind)!, @@ -1611,7 +1635,7 @@ export class Converter { } case SyntaxKind.PropertyAccessExpression: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.MemberExpression, object: this.convertChild(node.expression), property: this.convertChild(node.name), @@ -1619,7 +1643,7 @@ export class Converter { }); case SyntaxKind.ElementAccessExpression: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.MemberExpression, object: this.convertChild(node.expression), property: this.convertChild(node.argumentExpression), @@ -1627,7 +1651,7 @@ export class Converter { }); case SyntaxKind.ConditionalExpression: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ConditionalExpression, test: this.convertChild(node.condition), consequent: this.convertChild(node.whenTrue), @@ -1635,12 +1659,12 @@ export class Converter { }); case SyntaxKind.CallExpression: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.CallExpression, callee: this.convertChild(node.expression), arguments: node.arguments.map(el => this.convertChild(el)) }); - if (node.typeArguments && node.typeArguments.length) { + if (node.typeArguments) { result.typeParameters = this.convertTypeArgumentsToTypeParameters( node.typeArguments ); @@ -1649,14 +1673,14 @@ export class Converter { } case SyntaxKind.NewExpression: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.NewExpression, callee: this.convertChild(node.expression), arguments: node.arguments ? node.arguments.map(el => this.convertChild(el)) : [] }); - if (node.typeArguments && node.typeArguments.length) { + if (node.typeArguments) { result.typeParameters = this.convertTypeArgumentsToTypeParameters( node.typeArguments ); @@ -1665,9 +1689,9 @@ export class Converter { } case SyntaxKind.MetaProperty: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.MetaProperty, - meta: this.createNode(node.getFirstToken()!, { + meta: this.createNode(node.getFirstToken()!, { type: AST_NODE_TYPES.Identifier, name: getTextForTokenKind(node.keywordToken)! }), @@ -1676,7 +1700,7 @@ export class Converter { } case SyntaxKind.Decorator: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Decorator, expression: this.convertChild(node.expression) }); @@ -1685,7 +1709,7 @@ export class Converter { // Literals case SyntaxKind.StringLiteral: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.Literal, raw: '', value: '' @@ -1700,7 +1724,7 @@ export class Converter { } case SyntaxKind.NumericLiteral: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Literal, value: Number(node.text), raw: node.getText() @@ -1708,7 +1732,7 @@ export class Converter { } case SyntaxKind.BigIntLiteral: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.BigIntLiteral, raw: '', value: '' @@ -1729,7 +1753,7 @@ export class Converter { regex = null; } - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Literal, value: regex, raw: node.text, @@ -1741,14 +1765,14 @@ export class Converter { } case SyntaxKind.TrueKeyword: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Literal, value: true, raw: 'true' }); case SyntaxKind.FalseKeyword: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Literal, value: false, raw: 'false' @@ -1756,11 +1780,11 @@ export class Converter { case SyntaxKind.NullKeyword: { if (this.inTypeMode) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSNullKeyword }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Literal, value: null, raw: 'null' @@ -1769,24 +1793,24 @@ export class Converter { } case SyntaxKind.ImportKeyword: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Import }); case SyntaxKind.EmptyStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.EmptyStatement }); case SyntaxKind.DebuggerStatement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.DebuggerStatement }); // JSX case SyntaxKind.JsxElement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXElement, openingElement: this.convertChild(node.openingElement), closingElement: this.convertChild(node.closingElement), @@ -1794,7 +1818,7 @@ export class Converter { }); case SyntaxKind.JsxFragment: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXFragment, openingFragment: this.convertChild(node.openingFragment), closingFragment: this.convertChild(node.closingFragment), @@ -1802,13 +1826,13 @@ export class Converter { }); case SyntaxKind.JsxSelfClosingElement: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXElement, /** * Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement, * TypeScript does not seem to have the idea of openingElement when tag is self-closing */ - openingElement: this.createNode(node, { + openingElement: this.createNode(node, { type: AST_NODE_TYPES.JSXOpeningElement, typeParameters: node.typeArguments ? this.convertTypeArgumentsToTypeParameters(node.typeArguments) @@ -1826,7 +1850,7 @@ export class Converter { } case SyntaxKind.JsxOpeningElement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXOpeningElement, typeParameters: node.typeArguments ? this.convertTypeArgumentsToTypeParameters(node.typeArguments) @@ -1839,36 +1863,36 @@ export class Converter { }); case SyntaxKind.JsxClosingElement: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXClosingElement, name: this.convertJSXTagName(node.tagName, node) }); case SyntaxKind.JsxOpeningFragment: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXOpeningFragment }); case SyntaxKind.JsxClosingFragment: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXClosingFragment }); case SyntaxKind.JsxExpression: { const expression = node.expression ? this.convertChild(node.expression) - : this.createNode(node, { + : this.createNode(node, { type: AST_NODE_TYPES.JSXEmptyExpression, range: [node.getStart(this.ast) + 1, node.getEnd() - 1] }); if (node.dotDotDotToken) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXSpreadChild, expression }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXExpressionContainer, expression }); @@ -1879,7 +1903,7 @@ export class Converter { const attributeName = this.convertChild(node.name); attributeName.type = AST_NODE_TYPES.JSXIdentifier; - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXAttribute, name: attributeName, value: this.convertChild(node.initializer) @@ -1897,14 +1921,14 @@ export class Converter { const end = node.getEnd(); if (this.options.useJSXTextNode) { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXText, value: this.ast.text.slice(start, end), raw: this.ast.text.slice(start, end), range: [start, end] }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Literal, value: this.ast.text.slice(start, end), raw: this.ast.text.slice(start, end), @@ -1914,13 +1938,13 @@ export class Converter { } case SyntaxKind.JsxSpreadAttribute: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.JSXSpreadAttribute, argument: this.convertChild(node.expression) }); case SyntaxKind.QualifiedName: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSQualifiedName, left: this.convertChild(node.left), right: this.convertChild(node.right) @@ -1930,7 +1954,7 @@ export class Converter { // TypeScript specific case SyntaxKind.TypeReference: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSTypeReference, typeName: this.convertType(node.typeName), typeParameters: node.typeArguments @@ -1940,7 +1964,7 @@ export class Converter { } case SyntaxKind.TypeParameter: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSTypeParameter, name: this.convertType(node.name), constraint: node.constraint @@ -1968,28 +1992,28 @@ export class Converter { } case SyntaxKind.NonNullExpression: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSNonNullExpression, expression: this.convertChild(node.expression) }); } case SyntaxKind.TypeLiteral: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSTypeLiteral, members: node.members.map(el => this.convertChild(el)) }); } case SyntaxKind.ArrayType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSArrayType, elementType: this.convertType(node.elementType) }); } case SyntaxKind.IndexedAccessType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSIndexedAccessType, objectType: this.convertType(node.objectType), indexType: this.convertType(node.indexType) @@ -1997,7 +2021,7 @@ export class Converter { } case SyntaxKind.ConditionalType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSConditionalType, checkType: this.convertType(node.checkType), extendsType: this.convertType(node.extendsType), @@ -2007,14 +2031,14 @@ export class Converter { } case SyntaxKind.TypeQuery: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSTypeQuery, exprName: this.convertType(node.exprName) }); } case SyntaxKind.MappedType: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TSMappedType, typeParameter: this.convertType(node.typeParameter) }); @@ -2049,7 +2073,7 @@ export class Converter { return this.convertChild(node.expression, parent); case SyntaxKind.TypeAliasDeclaration: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TSTypeAliasDeclaration, id: this.convertChild(node.name), typeAnnotation: this.convertType(node.type) @@ -2060,7 +2084,7 @@ export class Converter { } // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { + if (node.typeParameters) { result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters ); @@ -2071,7 +2095,7 @@ export class Converter { } case SyntaxKind.MethodSignature: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TSMethodSignature, computed: isComputedProperty(node.name), key: this.convertChild(node.name), @@ -2112,7 +2136,7 @@ export class Converter { } case SyntaxKind.PropertySignature: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TSPropertySignature, optional: isOptional(node) || undefined, computed: isComputedProperty(node.name), @@ -2135,7 +2159,7 @@ export class Converter { } case SyntaxKind.IndexSignature: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TSIndexSignature, parameters: node.parameters.map(el => this.convertChild(el)) }); @@ -2183,10 +2207,10 @@ export class Converter { break; } const result = this.createNode< - | es.TSConstructSignatureDeclaration - | es.TSCallSignatureDeclaration - | es.TSFunctionType - | es.TSConstructorType + | TSESTree.TSConstructSignatureDeclaration + | TSESTree.TSCallSignatureDeclaration + | TSESTree.TSFunctionType + | TSESTree.TSConstructorType >(node, { type: type, params: this.convertParameters(node.parameters) @@ -2207,7 +2231,7 @@ export class Converter { case SyntaxKind.ExpressionWithTypeArguments: { const result = this.createNode< - es.TSInterfaceHeritage | es.TSClassImplements + TSESTree.TSInterfaceHeritage | TSESTree.TSClassImplements >(node, { type: parent && parent.kind === SyntaxKind.InterfaceDeclaration @@ -2216,7 +2240,7 @@ export class Converter { expression: this.convertChild(node.expression) }); - if (node.typeArguments && node.typeArguments.length) { + if (node.typeArguments) { result.typeParameters = this.convertTypeArgumentsToTypeParameters( node.typeArguments ); @@ -2226,9 +2250,9 @@ export class Converter { case SyntaxKind.InterfaceDeclaration: { const interfaceHeritageClauses = node.heritageClauses || []; - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TSInterfaceDeclaration, - body: this.createNode(node, { + body: this.createNode(node, { type: AST_NODE_TYPES.TSInterfaceBody, body: node.members.map(member => this.convertChild(member)), range: [node.members.pos - 1, node.end] @@ -2236,7 +2260,7 @@ export class Converter { id: this.convertChild(node.name) }); - if (node.typeParameters && node.typeParameters.length) { + if (node.typeParameters) { result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters ); @@ -2286,7 +2310,7 @@ export class Converter { } case SyntaxKind.FirstTypeNode: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TSTypePredicate, parameterName: this.convertChild(node.parameterName), typeAnnotation: this.convertTypeAnnotation(node.type, node) @@ -2301,7 +2325,7 @@ export class Converter { } case SyntaxKind.ImportType: - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSImportType, isTypeOf: !!node.isTypeOf, parameter: this.convertChild(node.argument), @@ -2312,7 +2336,7 @@ export class Converter { }); case SyntaxKind.EnumDeclaration: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TSEnumDeclaration, id: this.convertChild(node.name), members: node.members.map(el => this.convertChild(el)) @@ -2332,7 +2356,7 @@ export class Converter { } case SyntaxKind.EnumMember: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TSEnumMember, id: this.convertChild(node.name) }); @@ -2343,7 +2367,7 @@ export class Converter { } case SyntaxKind.ModuleDeclaration: { - const result = this.createNode(node, { + const result = this.createNode(node, { type: AST_NODE_TYPES.TSModuleDeclaration, id: this.convertChild(node.name) }); @@ -2361,69 +2385,69 @@ export class Converter { // TypeScript specific types case SyntaxKind.OptionalType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSOptionalType, typeAnnotation: this.convertType(node.type) }); } case SyntaxKind.ParenthesizedType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSParenthesizedType, typeAnnotation: this.convertType(node.type) }); } case SyntaxKind.TupleType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSTupleType, elementTypes: node.elementTypes.map(el => this.convertType(el)) }); } case SyntaxKind.UnionType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSUnionType, types: node.types.map(el => this.convertType(el)) }); } case SyntaxKind.IntersectionType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSIntersectionType, types: node.types.map(el => this.convertType(el)) }); } case SyntaxKind.RestType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSRestType, typeAnnotation: this.convertType(node.type) }); } case SyntaxKind.AsExpression: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSAsExpression, expression: this.convertChild(node.expression), typeAnnotation: this.convertType(node.type) }); } case SyntaxKind.InferType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSInferType, typeParameter: this.convertType(node.typeParameter) }); } case SyntaxKind.LiteralType: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSLiteralType, literal: this.convertType(node.literal) }); } case SyntaxKind.TypeAssertionExpression: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSTypeAssertion, typeAnnotation: this.convertType(node.type), expression: this.convertChild(node.expression) }); } case SyntaxKind.ImportEqualsDeclaration: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSImportEqualsDeclaration, id: this.convertChild(node.name), moduleReference: this.convertChild(node.moduleReference), @@ -2431,13 +2455,13 @@ export class Converter { }); } case SyntaxKind.ExternalModuleReference: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSExternalModuleReference, expression: this.convertChild(node.expression) }); } case SyntaxKind.NamespaceExportDeclaration: { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSNamespaceExportDeclaration, id: this.convertChild(node.name) }); diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index aa5a10418c7..4ab71cf5e9a 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -6,7 +6,7 @@ */ import ts from 'typescript'; import unescape from 'lodash.unescape'; -import * as es from './typedefs'; +import { TSESTree } from './ts-estree'; import { AST_NODE_TYPES } from './ast-node-types'; const SyntaxKind = ts.SyntaxKind; @@ -224,7 +224,7 @@ export function getBinaryExpressionType( export function getLineAndCharacterFor( pos: number, ast: ts.SourceFile -): es.LineAndColumnData { +): TSESTree.LineAndColumnData { const loc = ast.getLineAndCharacterOfPosition(pos); return { line: loc.line + 1, @@ -244,7 +244,7 @@ export function getLocFor( start: number, end: number, ast: ts.SourceFile -): es.SourceLocation { +): TSESTree.SourceLocation { return { start: getLineAndCharacterFor(start, ast), end: getLineAndCharacterFor(end, ast) @@ -455,11 +455,11 @@ export function isOptional(node: { * @param ast the AST * @returns the ESTreeNode with fixed exports */ -export function fixExports( +export function fixExports( node: ts.Node, result: T, ast: ts.SourceFile -): es.ExportDefaultDeclaration | es.ExportNamedDeclaration | T { +): TSESTree.ExportDefaultDeclaration | TSESTree.ExportNamedDeclaration | T { // check for exports if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { const exportKeyword = node.modifiers[0]; @@ -501,7 +501,7 @@ export function fixExports( * @param token the ts.Token * @returns the token type */ -export function getTokenType(token: any): es.TokenType { +export function getTokenType(token: any): TSESTree.TokenType { // Need two checks for keywords since some are also identifiers if (token.originalKeywordKind) { switch (token.originalKeywordKind) { @@ -607,16 +607,19 @@ export function getTokenType(token: any): es.TokenType { * Extends and formats a given ts.Token, for a given AST * @param token the ts.Token * @param ast the AST object - * @returns the converted es.Token + * @returns the converted Token */ -export function convertToken(token: ts.Node, ast: ts.SourceFile): es.Token { +export function convertToken( + token: ts.Node, + ast: ts.SourceFile +): TSESTree.Token { const start = token.kind === SyntaxKind.JsxText ? token.getFullStart() : token.getStart(ast), end = token.getEnd(), value = ast.text.slice(start, end), - newToken: es.Token = { + newToken: TSESTree.Token = { type: getTokenType(token), value, range: [start, end], @@ -638,8 +641,8 @@ export function convertToken(token: ts.Node, ast: ts.SourceFile): es.Token { * @param ast the AST object * @returns the converted Tokens */ -export function convertTokens(ast: ts.SourceFile): es.Token[] { - const result: es.Token[] = []; +export function convertTokens(ast: ts.SourceFile): TSESTree.Token[] { + const result: TSESTree.Token[] = []; /** * @param node the ts.Node */ diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index a838db4af13..6ec07b902cd 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -1,4 +1,6 @@ -import { Token, Comment } from './typedefs'; +import { Program } from 'typescript'; +import { Token, Comment, Node } from './typedefs'; +import { TSNode } from './ts-nodes'; export interface Extra { errorOnUnknownASTType: boolean; @@ -33,3 +35,13 @@ export interface ParserOptions { tsconfigRootDir?: string; extraFileExtensions?: string[]; } + +export interface ParserWeakMap { + get(key: TKey): TValue; +} + +export interface ParserServices { + program: Program | undefined; + esTreeNodeToTSNodeMap: ParserWeakMap | undefined; + tsNodeToESTreeNodeMap: ParserWeakMap | undefined; +} diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index ca3d27db77e..bb77a186171 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -14,8 +14,8 @@ import ts from 'typescript'; import convert from './ast-converter'; import { convertError } from './convert'; import { firstDefined } from './node-utils'; -import * as es from './typedefs'; -import { Extra, ParserOptions } from './parser-options'; +import { TSESTree } from './ts-estree'; +import { Extra, ParserOptions, ParserServices } from './parser-options'; import { getFirstSemanticOrSyntacticError } from './semantic-errors'; /** @@ -107,7 +107,7 @@ function getASTAndDefaultProject(code: string, options: ParserOptions) { function createNewProgram(code: string) { const FILENAME = getFileName(extra); - const compilerHost = { + const compilerHost: ts.CompilerHost = { fileExists() { return true; }, @@ -271,18 +271,14 @@ function warnAboutTSVersion(): void { // Parser //------------------------------------------------------------------------------ -type AST = es.Program & +type AST = TSESTree.Program & (T['range'] extends true ? { range: [number, number] } : {}) & - (T['tokens'] extends true ? { tokens: es.Token[] } : {}) & - (T['comment'] extends true ? { comments: es.Comment[] } : {}); + (T['tokens'] extends true ? { tokens: TSESTree.Token[] } : {}) & + (T['comment'] extends true ? { comments: TSESTree.Comment[] } : {}); interface ParseAndGenerateServicesResult { ast: AST; - services: { - program: ts.Program | undefined; - esTreeNodeToTSNodeMap: WeakMap | undefined; - tsNodeToESTreeNodeMap: WeakMap | undefined; - }; + services: ParserServices; } //------------------------------------------------------------------------------ @@ -419,3 +415,5 @@ export function parseAndGenerateServices< export { AST_NODE_TYPES } from './ast-node-types'; export { ParserOptions }; +export { ParserServices }; +export { TSESTree }; diff --git a/packages/typescript-estree/src/semantic-errors.ts b/packages/typescript-estree/src/semantic-errors.ts index 169031947d3..f563e404464 100644 --- a/packages/typescript-estree/src/semantic-errors.ts +++ b/packages/typescript-estree/src/semantic-errors.ts @@ -66,6 +66,8 @@ function whitelistSupportedDiagnostics( case 1090: // ts 3.2 "'{0}' modifier cannot appear on a parameter." case 1096: // ts 3.2 "An index signature must have exactly one parameter." case 1097: // ts 3.2 "'{0}' list cannot be empty." + case 1098: // ts 3.3 "Type parameter list cannot be empty." + case 1099: // ts 3.3 "Type argument list cannot be empty." case 1117: // ts 3.2 "An object literal cannot have multiple properties with the same name in strict mode." case 1121: // ts 3.2 "Octal literals are not allowed in strict mode." case 1123: // ts 3.2: "Variable declaration list cannot be empty." diff --git a/packages/typescript-estree/src/ts-estree.ts b/packages/typescript-estree/src/ts-estree.ts new file mode 100644 index 00000000000..846392c5443 --- /dev/null +++ b/packages/typescript-estree/src/ts-estree.ts @@ -0,0 +1,2 @@ +import * as TSESTree from './typedefs'; +export { TSESTree }; diff --git a/packages/typescript-estree/src/typedefs.ts b/packages/typescript-estree/src/typedefs.ts index a9a100e6462..af8d17e0157 100644 --- a/packages/typescript-estree/src/typedefs.ts +++ b/packages/typescript-estree/src/typedefs.ts @@ -1185,7 +1185,7 @@ export interface TSModuleBlock extends BaseNode { export interface TSModuleDeclaration extends BaseNode { type: AST_NODE_TYPES.TSModuleDeclaration; id: Identifier | Literal; - body?: TSModuleBlock | Identifier; + body?: TSModuleBlock | TSModuleDeclaration; global?: boolean; declare?: boolean; modifiers?: Modifier[]; diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index e8dcf0aca78..8fc5d6acd68 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -3,6 +3,7 @@ import fs from 'fs'; import path from 'path'; import jsxKnownIssues from '../../../shared-fixtures/jsx-known-issues'; +import { isJSXFileType } from '../../tools/test-utils'; interface Fixture { filename: string; @@ -61,7 +62,7 @@ class FixturesTester { const ignore = config.ignore || []; const fileType = config.fileType || 'js'; const ignoreSourceType = config.ignoreSourceType || []; - const jsx = fileType === 'js' || fileType === 'jsx' || fileType === 'tsx'; + const jsx = isJSXFileType(fileType); /** * The TypeScript compiler gives us the "externalModuleIndicator" to allow typescript-estree do dynamically detect the "sourceType". @@ -164,7 +165,20 @@ tester.addFixturePatternConfig('javascript/arrowFunctions', { * with the same name, for example. */ 'error-dup-params', // babel parse errors - 'error-strict-dup-params' // babel parse errors + 'error-strict-dup-params', // babel parse errors + /** + * typescript reports TS1100 and babel errors on this + * TS1100: "Invalid use of '{0}' in strict mode." + * TODO: do we want TS1100 error code? + */ + 'error-strict-eval', // babel parse errors + 'error-strict-default-param-eval', + 'error-strict-eval-return', + 'error-strict-param-arguments', + 'error-strict-param-eval', + 'error-strict-param-names', + 'error-strict-param-no-paren-arguments', + 'error-strict-param-no-paren-eval' ] }); tester.addFixturePatternConfig('javascript/function', { @@ -236,7 +250,12 @@ tester.addFixturePatternConfig('javascript/modules', { */ 'invalid-export-named-default' // babel parse errors ], - ignoreSourceType: ['error-function', 'error-strict', 'error-delete'] + ignoreSourceType: [ + 'error-function', + 'error-strict', + 'error-delete', + 'invalid-await' + ] }); tester.addFixturePatternConfig('javascript/newTarget'); @@ -364,14 +383,8 @@ tester.addFixturePatternConfig('typescript/basics', { */ 'type-assertion-arrow-function', /** - * PR for range of declare keyword has been merged into Babel: https://github.com/babel/babel/pull/9406 - * TODO: remove me in next babel > 7.3.1 - */ - 'export-declare-const-named-enum', - 'export-declare-named-enum', - /** - * Babel does not include optional keyword into range parameter in arrow function - * TODO: report it to babel + * PR for optional parameters in arrow function has been merged into Babel: https://github.com/babel/babel/pull/9463 + * TODO: remove me in next babel > 7.3.2 */ 'arrow-function-with-optional-parameter' ], @@ -421,7 +434,23 @@ tester.addFixturePatternConfig('typescript/expressions', { }); tester.addFixturePatternConfig('typescript/errorRecovery', { - fileType: 'ts' + fileType: 'ts', + ignore: [ + /** + * Expected error on empty type arguments and type parameters + * TypeScript report diagnostics correctly but babel not + * https://github.com/babel/babel/issues/9462 + */ + 'empty-type-arguments', + 'empty-type-arguments-in-call-expression', + 'empty-type-arguments-in-new-expression', + 'empty-type-parameters', + 'empty-type-parameters-in-arrow-function', + 'empty-type-parameters-in-constructor', + 'empty-type-parameters-in-function-expression', + 'empty-type-parameters-in-method', + 'empty-type-parameters-in-method-signature' + ] }); tester.addFixturePatternConfig('typescript/types', { @@ -430,7 +459,11 @@ tester.addFixturePatternConfig('typescript/types', { /** * AST difference */ - 'literal-number-negative' + 'literal-number-negative', + /** + * Babel parse error: https://github.com/babel/babel/pull/9431 + */ + 'function-with-array-destruction' ] }); diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index f00b7d9ad16..3b9cdfd087c 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -262,7 +262,10 @@ export function preprocessBabylonAST(ast: any): any { /** * babel issue: ranges of typeParameters are not included in FunctionExpression range */ - if (node.typeParameters) { + if ( + node.typeParameters && + node.typeParameters.range[0] < node.range[0] + ) { node.range[0] = node.typeParameters.range[0]; node.loc.start = Object.assign({}, node.typeParameters.loc.start); } diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap index 05a20300876..3049a51ae47 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap @@ -1,5 +1,179 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`convert deeplyCopy should convert array of nodes 1`] = ` +Object { + "amdDependencies": Array [], + "bindDiagnostics": Array [], + "bindSuggestionDiagnostics": undefined, + "checkJsDirective": undefined, + "endOfFileToken": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 12, + ], + "type": "TSEndOfFileToken", + }, + "externalModuleIndicator": undefined, + "fileName": "text.ts", + "hasNoDefaultLib": false, + "identifierCount": 2, + "identifiers": Map { + "foo" => "foo", + "T" => "T", + }, + "isDeclarationFile": false, + "languageVariant": 1, + "languageVersion": 6, + "libReferenceDirectives": Array [], + "lineMap": Array [ + null, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "nodeCount": 7, + "parseDiagnostics": Array [], + "pragmas": Map {}, + "range": Array [ + 0, + 12, + ], + "referencedFiles": Array [], + "scriptKind": 4, + "statements": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "NewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "text": "new foo()", + "transformFlags": undefined, + "type": "TSSourceFile", + "typeReferenceDirectives": Array [], +} +`; + exports[`convert deeplyCopy should convert node correctly 1`] = ` Object { "body": Array [ @@ -421,6 +595,101 @@ Object { } `; +exports[`convert deeplyCopy should convert node with type arguments correctly 1`] = ` +Object { + "arguments": Array [], + "expression": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "transformFlags": undefined, + "type": "TSNewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterInstantiation", + }, +} +`; + exports[`convert deeplyCopy should convert node with type parameters correctly 1`] = ` Object { "heritageClauses": undefined, diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index dde844c7e15..bfbda114841 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -8,77 +8,21 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsdoc-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-block-comment.src 1`] = ` -Object { - "column": 10, - "index": 84, - "lineNumber": 5, - "message": "Unterminated regular expression literal.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-block-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-jsx.src 1`] = ` -Object { - "column": 14, - "index": 48, - "lineNumber": 3, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-jsx.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-self-closing-jsx.src 1`] = ` -Object { - "column": 13, - "index": 47, - "lineNumber": 3, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-self-closing-jsx.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-tag-comments.src 1`] = ` -Object { - "column": 9, - "index": 113, - "lineNumber": 7, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-tag-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-multiline-non-comment.src 1`] = ` -Object { - "column": 5, - "index": 81, - "lineNumber": 7, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-multiline-non-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-url.src 1`] = ` -Object { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-url.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-with-greather-than.src 1`] = ` -Object { - "column": 0, - "index": 69, - "lineNumber": 4, - "message": "Expression expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-with-greather-than.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-with-operators.src 1`] = ` -Object { - "column": 0, - "index": 69, - "lineNumber": 4, - "message": "Expression expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-with-operators.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/line-comment-with-block-syntax.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -1330,120 +1274,71 @@ Object { } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/attributes.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/attributes.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/element-keyword-name.src 1`] = ` -Object { - "column": 12, - "index": 18, - "lineNumber": 2, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/element-keyword-name.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-comment.src 1`] = ` -Object { - "column": 30, - "index": 30, - "lineNumber": 1, - "message": "Unterminated regular expression literal.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-conditional.src 1`] = ` -Object { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-conditional.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-invalid-js-identifier.src 1`] = ` -Object { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-invalid-js-identifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-tags.src 1`] = ` Object { - "column": 11, - "index": 11, + "column": 16, + "index": 16, "lineNumber": 1, - "message": "'>' expected.", + "message": "'{' expected.", } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/empty-placeholder.src 1`] = ` -Object { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "Unterminated regular expression literal.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/empty-placeholder.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns.src 1`] = ` -Object { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-attribute.src 1`] = ` Object { - "column": 3, - "index": 3, + "column": 5, + "index": 5, "lineNumber": 1, - "message": "'>' expected.", + "message": "'{' expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-attribute-missing-equals.src 1`] = ` Object { - "column": 5, - "index": 5, + "column": 14, + "index": 14, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-broken-tag.src 1`] = ` Object { - "column": 3, - "index": 3, + "column": 12, + "index": 12, "lineNumber": 1, - "message": "'>' expected.", + "message": "Unterminated string literal.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-computed-end-tag-name.src 1`] = ` Object { - "column": 9, - "index": 9, + "column": 2, + "index": 2, "lineNumber": 1, - "message": "Type expected.", + "message": "Identifier expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-computed-string-end-tag-name.src 1`] = ` Object { - "column": 11, - "index": 11, + "column": 2, + "index": 2, "lineNumber": 1, - "message": "Type expected.", + "message": "Identifier expected.", } `; @@ -1452,23 +1347,23 @@ Object { "column": 9, "index": 9, "lineNumber": 1, - "message": "':' expected.", + "message": "'}' expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-leading-dot-tag-name.src 1`] = ` Object { - "column": 1, - "index": 1, + "column": 0, + "index": 0, "lineNumber": 1, - "message": "Type expected.", + "message": "Expression expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src 1`] = ` Object { - "column": 5, - "index": 5, + "column": 27, + "index": 27, "lineNumber": 1, "message": "'>' expected.", } @@ -1476,28 +1371,28 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-closing-tag.src 1`] = ` Object { - "column": 4, - "index": 4, + "column": 3, + "index": 3, "lineNumber": 1, - "message": "Type expected.", + "message": "Expected corresponding JSX closing tag for 'a'.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-closing-tags.src 1`] = ` Object { - "column": 6, - "index": 6, + "column": 1, + "index": 1, "lineNumber": 1, - "message": "'>' expected.", + "message": "JSX element 'a' has no corresponding closing tag.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-dot-tag-name.src 1`] = ` Object { - "column": 8, - "index": 8, + "column": 7, + "index": 7, "lineNumber": 1, - "message": "Type expected.", + "message": "Expected corresponding JSX closing tag for 'a.b.c'.", } `; @@ -1506,34 +1401,34 @@ Object { "column": 2, "index": 2, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-closing-tag.src 1`] = ` Object { - "column": 3, - "index": 3, + "column": 1, + "index": 1, "lineNumber": 1, - "message": "Expression expected.", + "message": "JSX element 'a' has no corresponding closing tag.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src 1`] = ` Object { - "column": 3, - "index": 3, + "column": 1, + "index": 1, "lineNumber": 1, - "message": "'>' expected.", + "message": "JSX element 'a' has no corresponding closing tag.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-namespace-name.src 1`] = ` Object { - "column": 1, - "index": 1, + "column": 0, + "index": 0, "lineNumber": 1, - "message": "Type expected.", + "message": "Expression expected.", } `; @@ -1542,16 +1437,16 @@ Object { "column": 2, "index": 2, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-spread-operator.src 1`] = ` Object { - "column": 5, - "index": 5, + "column": 6, + "index": 6, "lineNumber": 1, - "message": "'>' expected.", + "message": "'...' expected.", } `; @@ -1560,7 +1455,7 @@ Object { "column": 4, "index": 4, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; @@ -1569,7 +1464,7 @@ Object { "column": 2, "index": 2, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; @@ -1578,43 +1473,43 @@ Object { "column": 36, "index": 36, "lineNumber": 1, - "message": "Expression expected.", + "message": "JSX expressions must have one parent element.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-common-parent-with-comment.src 1`] = ` Object { - "column": 38, - "index": 38, + "column": 63, + "index": 63, "lineNumber": 1, - "message": "',' expected.", + "message": "JSX expressions must have one parent element.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-tag-name.src 1`] = ` Object { - "column": 1, - "index": 1, + "column": 0, + "index": 0, "lineNumber": 1, - "message": "Type expected.", + "message": "Declaration or statement expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-placeholder-in-closing-tag.src 1`] = ` Object { - "column": 12, - "index": 12, + "column": 16, + "index": 16, "lineNumber": 1, - "message": "Unterminated regular expression literal.", + "message": "'>' expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-shorthand-fragment-no-closing.src 1`] = ` Object { - "column": 1, - "index": 1, + "column": 0, + "index": 0, "lineNumber": 1, - "message": "Type expected.", + "message": "JSX fragment has no corresponding closing tag.", } `; @@ -1629,64 +1524,29 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-unexpected-comma.src 1`] = ` Object { - "column": 6, - "index": 6, + "column": 19, + "index": 19, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/japanese-characters.src 1`] = ` -Object { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/japanese-characters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/less-than-operator.src 1`] = ` -Object { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/less-than-operator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression.src 1`] = ` -Object { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression-this.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/multiple-blank-spaces.src 1`] = ` -Object { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/multiple-blank-spaces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespaced-attribute-and-value-inserted.src 1`] = ` Object { - "column": 3, - "index": 3, + "column": 4, + "index": 4, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; @@ -1695,36 +1555,22 @@ Object { "column": 2, "index": 2, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/newslines-and-entities.src 1`] = ` Object { - "column": 4, - "index": 4, + "column": 8, + "index": 8, "lineNumber": 1, - "message": "'>' expected.", + "message": "Invalid character.", } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag.src 1`] = ` -Object { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag-inside-tag.src 1`] = ` -Object { - "column": 9, - "index": 15, - "lineNumber": 2, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag-inside-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag-with-newline.src 1`] = ` Object { @@ -1735,140 +1581,35 @@ Object { } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/shorthand-fragment.src 1`] = ` -Object { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/shorthand-fragment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/shorthand-fragment-with-child.src 1`] = ` -Object { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/shorthand-fragment-with-child.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-child.src 1`] = ` -Object { - "column": 15, - "index": 15, - "lineNumber": 1, - "message": "Unterminated regular expression literal.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-child.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-operator-attribute-and-regular-attribute.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-operator-attribute-and-regular-attribute.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-operator-attributes.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-operator-attributes.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-dots.src 1`] = ` -Object { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-dots.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-multi-dots.src 1`] = ` -Object { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-multi-dots.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-multi-dots-multi.src 1`] = ` -Object { - "column": 7, - "index": 21, - "lineNumber": 2, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-multi-dots-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/test-content.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "Expression expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/test-content.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/trailing-spread-operator-attribute.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/trailing-spread-operator-attribute.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/unknown-escape-pattern.src 1`] = ` -Object { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/unknown-escape-pattern.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src 1`] = ` -Object { - "column": 9, - "index": 15, - "lineNumber": 2, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/test-content.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "Expression expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/test-content.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-element.src 1`] = ` -Object { - "column": 21, - "index": 21, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-element.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/react-typed-props.src 1`] = ` -Object { - "column": 12, - "index": 141, - "lineNumber": 9, - "message": "',' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/react-typed-props.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2057,6 +1798,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-type-function-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-anonymus-with-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-anynomus-with-return-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-overloads.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-await.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2332,7 +2077,86 @@ Object { } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments.src 1`] = ` +Object { + "column": 14, + "index": 14, + "lineNumber": 1, + "message": "Type argument list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = ` +Object { + "column": 3, + "index": 3, + "lineNumber": 1, + "message": "Type argument list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src 1`] = ` +Object { + "column": 7, + "index": 7, + "lineNumber": 1, + "message": "Type argument list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters.src 1`] = ` +Object { + "column": 11, + "index": 11, + "lineNumber": 1, + "message": "Type parameter list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src 1`] = ` +Object { + "column": 11, + "index": 11, + "lineNumber": 1, + "message": "Type parameter list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src 1`] = ` +Object { + "column": 13, + "index": 25, + "lineNumber": 2, + "message": "Type parameter list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = ` +Object { + "column": 20, + "index": 20, + "lineNumber": 1, + "message": "Type parameter list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src 1`] = ` +Object { + "column": 6, + "index": 18, + "lineNumber": 2, + "message": "Type parameter list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src 1`] = ` +Object { + "column": 6, + "index": 22, + "lineNumber": 2, + "message": "Type parameter list cannot be empty.", +} +`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/enum-with-keywords.src 1`] = ` Object { @@ -2603,6 +2427,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-in-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-array-destruction.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-object-destruction.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index d1040b3b295..b9e876c4595 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -39177,139 +39177,268 @@ Object { } `; -exports[`typescript fixtures/basics/function-overloads.src 1`] = ` +exports[`typescript fixtures/basics/function-anonymus-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "async": false, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "f", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 27, + "column": 7, "line": 1, }, "start": Object { - "column": 18, + "column": 4, "line": 1, }, }, - "name": "x", + "name": "obj", "range": Array [ - 18, - 27, + 4, + 7, ], "type": "Identifier", - "typeAnnotation": Object { + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 38, + 47, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 19, + "column": 34, "line": 1, }, }, "range": Array [ - 19, - 27, + 34, + 49, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 27, + "column": 32, "line": 1, }, "start": Object { - "column": 21, + "column": 23, "line": 1, }, }, + "name": "a", "range": Array [ - 21, - 27, + 23, + 32, ], - "type": "TSNumberKeyword", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 10, + 49, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 19, + 22, + ], + "type": "TSTypeParameterDeclaration", }, }, - ], - "range": Array [ - 7, - 37, - ], - "returnType": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 28, + "column": 4, "line": 1, }, }, "range": Array [ - 28, - 36, + 4, + 49, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "TSNumberKeyword", - }, + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, - "type": "TSDeclareFunction", }, + "range": Array [ + 0, + 50, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 37, + "column": 3, "line": 1, }, "start": Object { @@ -39319,513 +39448,133 @@ Object { }, "range": Array [ 0, - 37, + 3, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "Keyword", + "value": "var", }, Object { - "declaration": Object { - "async": false, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "f", - "range": Array [ - 54, - 55, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, + "start": Object { + "column": 4, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 56, - 65, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 57, - 65, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 59, - 65, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 45, - 75, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 66, - 74, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 68, - 74, - ], - "type": "TSStringKeyword", - }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, }, - "type": "TSDeclareFunction", }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 38, - 75, + 10, + 18, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "Keyword", + "value": "function", }, - Object { - "declaration": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "name": "x", - "range": Array [ - 142, - 143, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 135, - 144, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 55, - "line": 3, - }, - }, - "range": Array [ - 131, - 146, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "name": "f", - "range": Array [ - 92, - 93, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "name": "x", - "range": Array [ - 94, - 112, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 3, - }, - }, - "range": Array [ - 95, - 112, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 112, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 103, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 106, - 112, - ], - "type": "TSNumberKeyword", - }, - ], - }, - }, - }, - ], - "range": Array [ - 83, - 146, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 37, - "line": 3, - }, - }, - "range": Array [ - 113, - 130, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 115, - 130, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 115, - 121, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 48, - "line": 3, - }, - }, - "range": Array [ - 124, - 130, - ], - "type": "TSNumberKeyword", - }, - ], - }, - }, - "type": "FunctionDeclaration", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 76, - 146, - ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 147, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 20, "line": 1, }, "start": Object { - "column": 0, + "column": 19, "line": 1, }, }, "range": Array [ - 0, - 6, + 19, + 20, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { - "column": 7, + "column": 20, "line": 1, }, }, "range": Array [ - 7, - 15, + 20, + 21, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 22, "line": 1, }, "start": Object { - "column": 16, + "column": 21, "line": 1, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], - "type": "Identifier", - "value": "f", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 1, }, "start": Object { - "column": 17, + "column": 22, "line": 1, }, }, "range": Array [ - 17, - 18, + 22, + 23, ], "type": "Punctuator", "value": "(", @@ -39833,35 +39582,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 24, "line": 1, }, "start": Object { - "column": 18, + "column": 23, "line": 1, }, }, "range": Array [ - 18, - 19, + 23, + 24, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 1, }, "start": Object { - "column": 19, + "column": 24, "line": 1, }, }, "range": Array [ - 19, - 20, + 24, + 25, ], "type": "Punctuator", "value": ":", @@ -39869,35 +39618,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 32, "line": 1, }, "start": Object { - "column": 21, + "column": 26, "line": 1, }, }, "range": Array [ - 21, - 27, + 26, + 32, ], "type": "Identifier", - "value": "number", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 33, "line": 1, }, "start": Object { - "column": 27, + "column": 32, "line": 1, }, }, "range": Array [ - 27, - 28, + 32, + 33, ], "type": "Punctuator", "value": ")", @@ -39905,65 +39654,29 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, + "column": 35, "line": 1, }, "start": Object { - "column": 36, + "column": 34, "line": 1, }, }, "range": Array [ - 36, - 37, + 34, + 35, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 2, }, "start": Object { - "column": 0, + "column": 2, "line": 2, }, }, @@ -39972,364 +39685,338 @@ Object { 44, ], "type": "Keyword", - "value": "export", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 2, }, "start": Object { - "column": 7, + "column": 9, "line": 2, }, }, "range": Array [ 45, - 53, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 54, - 55, - ], - "type": "Identifier", - "value": "f", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 56, - 57, + 46, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 11, "line": 2, }, "start": Object { - "column": 19, + "column": 10, "line": 2, }, }, "range": Array [ - 57, - 58, + 46, + 47, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 59, - 65, - ], - "type": "Identifier", - "value": "string", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 27, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 65, - 66, + 48, + 49, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 2, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 1, + "line": 3, }, }, "range": Array [ - 66, - 67, + 49, + 50, ], "type": "Punctuator", - "value": ":", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-anynomus-with-return-type.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 31, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 68, - 74, ], - "type": "Identifier", - "value": "string", - }, - Object { + "kind": "var", "loc": Object { "end": Object { - "column": 37, + "column": 2, "line": 2, }, "start": Object { - "column": 36, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 74, - 75, + 0, + 32, ], - "type": "Punctuator", - "value": ";", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 3, + "line": 1, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 76, - 82, + 0, + 3, ], "type": "Keyword", - "value": "export", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { "column": 7, - "line": 3, - }, - }, - "range": Array [ - 83, - 91, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 4, + "line": 1, }, }, "range": Array [ - 92, - 93, + 4, + 7, ], "type": "Identifier", - "value": "f", + "value": "obj", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 9, + "line": 1, }, "start": Object { - "column": 17, - "line": 3, + "column": 8, + "line": 1, }, }, "range": Array [ - 93, - 94, + 8, + 9, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 94, - 95, + 10, + 18, ], - "type": "Identifier", - "value": "x", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { "column": 20, - "line": 3, + "line": 1, }, "start": Object { "column": 19, - "line": 3, + "line": 1, }, }, "range": Array [ - 95, - 96, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 103, - ], - "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, - }, - }, - "range": Array [ - 104, - 105, - ], - "type": "Punctuator", - "value": "|", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 106, - 112, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 3, + "line": 1, }, "start": Object { - "column": 36, - "line": 3, + "column": 20, + "line": 1, }, }, "range": Array [ - 112, - 113, + 20, + 21, ], "type": "Punctuator", "value": ")", @@ -40337,17 +40024,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 37, - "line": 3, + "column": 21, + "line": 1, }, }, "range": Array [ - 113, - 114, + 21, + 22, ], "type": "Punctuator", "value": ":", @@ -40355,219 +40042,1471 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 3, + "column": 27, + "line": 1, }, "start": Object { - "column": 39, - "line": 3, + "column": 23, + "line": 1, }, }, "range": Array [ - 115, - 121, + 23, + 27, ], - "type": "Identifier", - "value": "string", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 3, + "column": 29, + "line": 1, }, "start": Object { - "column": 46, - "line": 3, + "column": 28, + "line": 1, }, }, "range": Array [ - 122, - 123, + 28, + 29, ], "type": "Punctuator", - "value": "|", - }, - Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 48, - "line": 3, - }, - }, - "range": Array [ - 124, - 130, - ], - "type": "Identifier", - "value": "number", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 56, - "line": 3, + "column": 1, + "line": 2, }, "start": Object { - "column": 55, - "line": 3, + "column": 0, + "line": 2, }, }, "range": Array [ - 131, - 132, + 30, + 31, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { "column": 2, - "line": 4, - }, - }, - "range": Array [ - 135, - 141, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "range": Array [ - 142, - 143, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 4, + "line": 2, }, "start": Object { - "column": 10, - "line": 4, - }, - }, - "range": Array [ - 143, - 144, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, + "line": 2, }, }, "range": Array [ - 145, - 146, + 31, + 32, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/function-with-await.src 1`] = ` +exports[`typescript fixtures/basics/function-overloads.src 1`] = ` Object { "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "name": "future", - "range": Array [ - 40, - 46, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 34, - 46, - ], - "type": "AwaitExpression", + "declaration": Object { + "async": false, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "start": Object { + "column": 16, + "line": 1, }, - "range": Array [ - 34, - 47, - ], - "type": "ExpressionStatement", }, - ], + "name": "f", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 37, + "line": 1, }, "start": Object { - "column": 28, + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 37, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "TSDeclareFunction", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "declaration": Object { + "async": false, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "f", + "range": Array [ + 54, + 55, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 56, + 65, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 57, + 65, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 45, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 66, + 74, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSDeclareFunction", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 75, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "x", + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 144, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, + "range": Array [ + 131, + 146, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "f", + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 94, + 112, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 95, + 112, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 112, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 103, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 106, + 112, + ], + "type": "TSNumberKeyword", + }, + ], + }, + }, + }, + ], + "range": Array [ + 83, + 146, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 113, + 130, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 130, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "TSNumberKeyword", + }, + ], + }, + }, + "type": "FunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 146, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 147, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 53, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 83, + 91, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 103, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 106, + 112, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 3, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-await.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "future", + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 46, + ], + "type": "AwaitExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, "line": 1, }, }, @@ -67795,13 +68734,481 @@ Object { "line": 2, }, "start": Object { - "column": 35, - "line": 2, + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "range": Array [ + 125, + 132, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "range": Array [ + 133, + 136, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 2, + }, + "start": Object { + "column": 62, + "line": 2, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 86, + "line": 2, + }, + "start": Object { + "column": 85, + "line": 2, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 88, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 88, + "line": 2, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 165, + 174, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 175, + 178, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 191, + 192, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 202, + 203, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 204, + 211, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 3, + }, + }, + "range": Array [ + 212, + 216, + ], + "type": "Identifier", + "value": "bar2", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 52, + "line": 3, + }, + }, + "range": Array [ + 217, + 218, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 3, + }, + "start": Object { + "column": 64, + "line": 3, + }, + }, + "range": Array [ + 229, + 230, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 3, + }, + "start": Object { + "column": 75, + "line": 3, + }, + }, + "range": Array [ + 240, + 241, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 78, + "line": 3, + }, + "start": Object { + "column": 77, + "line": 3, + }, + }, + "range": Array [ + 242, + 243, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 3, + }, + "start": Object { + "column": 78, + "line": 3, + }, + }, + "range": Array [ + 243, + 244, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 245, + 254, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 255, + 259, + ], + "type": "Identifier", + "value": "bar2", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 260, + 261, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 272, + 273, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, }, }, "range": Array [ - 110, - 111, + 284, + 285, ], "type": "Punctuator", "value": "=", @@ -67809,17 +69216,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 42, + "line": 4, }, "start": Object { - "column": 37, - "line": 2, + "column": 41, + "line": 4, }, }, "range": Array [ - 112, - 113, + 286, + 287, ], "type": "Numeric", "value": "2", @@ -67827,17 +69234,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 49, - "line": 2, + "column": 53, + "line": 4, }, "start": Object { - "column": 48, - "line": 2, + "column": 52, + "line": 4, }, }, "range": Array [ - 123, - 124, + 297, + 298, ], "type": "Punctuator", "value": ">", @@ -67845,17 +69252,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 57, - "line": 2, + "column": 61, + "line": 4, }, "start": Object { - "column": 50, - "line": 2, + "column": 54, + "line": 4, }, }, "range": Array [ - 125, - 132, + 299, + 306, ], "type": "Keyword", "value": "extends", @@ -67863,17 +69270,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 61, - "line": 2, + "column": 65, + "line": 4, }, "start": Object { - "column": 58, - "line": 2, + "column": 62, + "line": 4, }, }, "range": Array [ - 133, - 136, + 307, + 310, ], "type": "Identifier", "value": "bar", @@ -67881,17 +69288,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 63, - "line": 2, + "column": 67, + "line": 4, }, "start": Object { - "column": 62, - "line": 2, + "column": 66, + "line": 4, }, }, "range": Array [ - 137, - 138, + 311, + 312, ], "type": "Punctuator", "value": "<", @@ -67899,17 +69306,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 75, - "line": 2, + "column": 79, + "line": 4, }, "start": Object { - "column": 74, - "line": 2, + "column": 78, + "line": 4, }, }, "range": Array [ - 149, - 150, + 323, + 324, ], "type": "Identifier", "value": "A", @@ -67917,17 +69324,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 86, - "line": 2, + "column": 90, + "line": 4, }, "start": Object { - "column": 85, - "line": 2, + "column": 89, + "line": 4, }, }, "range": Array [ - 160, - 161, + 334, + 335, ], "type": "Punctuator", "value": ">", @@ -67935,17 +69342,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 88, - "line": 2, + "column": 92, + "line": 4, }, "start": Object { - "column": 87, - "line": 2, + "column": 91, + "line": 4, }, }, "range": Array [ - 162, - 163, + 336, + 337, ], "type": "Punctuator", "value": "{", @@ -67953,700 +69360,993 @@ Object { Object { "loc": Object { "end": Object { - "column": 89, - "line": 2, + "column": 93, + "line": 4, }, "start": Object { - "column": 88, - "line": 2, + "column": 92, + "line": 4, }, }, "range": Array [ - 163, - 164, + 337, + 338, ], "type": "Punctuator", "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-reference-comments.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "mBuffers", + "range": Array [ + 26, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 51, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 26, + 75, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 34, + 74, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 36, + 74, + ], + "type": "TSTypeReference", + "typeName": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "interop", + "range": Array [ + 36, + 43, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 36, + 53, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "Reference", + "range": Array [ + 44, + 53, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "TSAnyKeyword", + }, + ], + "range": Array [ + 53, + 74, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, }, - "start": Object { - "column": 0, - "line": 3, + "range": Array [ + 22, + 77, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "name": "AudioBufferList", + "range": Array [ + 6, + 21, + ], + "type": "Identifier", }, - "range": Array [ - 165, - 174, - ], - "type": "Keyword", - "value": "interface", - }, - Object { "loc": Object { "end": Object { - "column": 13, + "column": 1, "line": 3, }, "start": Object { - "column": 10, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 175, - 178, + 0, + 77, ], - "type": "Identifier", - "value": "bar", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 78, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 5, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 179, - 180, + 0, + 5, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 21, + "line": 1, }, "start": Object { - "column": 26, - "line": 3, + "column": 6, + "line": 1, }, }, "range": Array [ - 191, - 192, + 6, + 21, ], "type": "Identifier", - "value": "A", + "value": "AudioBufferList", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { - "column": 37, - "line": 3, + "column": 22, + "line": 1, }, }, "range": Array [ - 202, - 203, + 22, + 23, ], "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 204, - 211, - ], - "type": "Keyword", - "value": "extends", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 51, - "line": 3, + "column": 10, + "line": 2, }, "start": Object { - "column": 47, - "line": 3, + "column": 2, + "line": 2, }, }, "range": Array [ - 212, - 216, + 26, + 34, ], "type": "Identifier", - "value": "bar2", + "value": "mBuffers", }, Object { "loc": Object { "end": Object { - "column": 53, - "line": 3, + "column": 11, + "line": 2, }, "start": Object { - "column": 52, - "line": 3, + "column": 10, + "line": 2, }, }, "range": Array [ - 217, - 218, + 34, + 35, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 65, - "line": 3, + "column": 19, + "line": 2, }, "start": Object { - "column": 64, - "line": 3, + "column": 12, + "line": 2, }, }, "range": Array [ - 229, - 230, + 36, + 43, ], "type": "Identifier", - "value": "A", + "value": "interop", }, Object { "loc": Object { "end": Object { - "column": 76, - "line": 3, + "column": 20, + "line": 2, }, "start": Object { - "column": 75, - "line": 3, + "column": 19, + "line": 2, }, }, "range": Array [ - 240, - 241, + 43, + 44, ], "type": "Punctuator", - "value": ">", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 78, - "line": 3, + "column": 29, + "line": 2, }, "start": Object { - "column": 77, - "line": 3, + "column": 20, + "line": 2, }, }, "range": Array [ - 242, - 243, + 44, + 53, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "Reference", }, Object { "loc": Object { "end": Object { - "column": 79, - "line": 3, + "column": 30, + "line": 2, }, "start": Object { - "column": 78, - "line": 3, + "column": 29, + "line": 2, }, }, "range": Array [ - 243, - 244, + 53, + 54, ], "type": "Punctuator", - "value": "}", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 33, + "line": 2, }, "start": Object { - "column": 0, - "line": 4, + "column": 30, + "line": 2, }, }, "range": Array [ - 245, - 254, + 54, + 57, ], - "type": "Keyword", - "value": "interface", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 50, + "line": 2, }, "start": Object { - "column": 10, - "line": 4, + "column": 49, + "line": 2, }, }, "range": Array [ - 255, - 259, + 73, + 74, ], - "type": "Identifier", - "value": "bar2", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 51, + "line": 2, }, "start": Object { - "column": 15, - "line": 4, + "column": 50, + "line": 2, }, }, "range": Array [ - 260, - 261, + 74, + 75, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 4, + "column": 1, + "line": 3, }, "start": Object { - "column": 27, - "line": 4, + "column": 0, + "line": 3, }, }, "range": Array [ - 272, - 273, + 76, + 77, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-bigint.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 40, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 39, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 284, - 285, + 0, + 17, ], - "type": "Punctuator", - "value": "=", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSBigIntKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 42, - "line": 4, + "column": 4, + "line": 1, }, "start": Object { - "column": 41, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 286, - 287, + 0, + 4, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 53, - "line": 4, + "column": 8, + "line": 1, }, "start": Object { - "column": 52, - "line": 4, + "column": 5, + "line": 1, }, }, "range": Array [ - 297, - 298, + 5, + 8, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 61, - "line": 4, + "column": 10, + "line": 1, }, "start": Object { - "column": 54, - "line": 4, + "column": 9, + "line": 1, }, }, "range": Array [ - 299, - 306, + 9, + 10, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 65, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 62, - "line": 4, + "column": 11, + "line": 1, }, }, "range": Array [ - 307, - 310, + 11, + 17, ], "type": "Identifier", - "value": "bar", + "value": "bigint", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-boolean.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 67, - "line": 4, + "column": 18, + "line": 1, }, "start": Object { - "column": 66, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 311, - 312, + 0, + 18, ], - "type": "Punctuator", - "value": "<", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "TSBooleanKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 79, - "line": 4, + "column": 4, + "line": 1, }, "start": Object { - "column": 78, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 323, - 324, + 0, + 4, ], "type": "Identifier", - "value": "A", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 90, - "line": 4, + "column": 8, + "line": 1, }, "start": Object { - "column": 89, - "line": 4, + "column": 5, + "line": 1, }, }, "range": Array [ - 334, - 335, + 5, + 8, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 92, - "line": 4, + "column": 10, + "line": 1, }, "start": Object { - "column": 91, - "line": 4, + "column": 9, + "line": 1, }, }, "range": Array [ - 336, - 337, + 9, + 10, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 93, - "line": 4, + "column": 18, + "line": 1, }, "start": Object { - "column": 92, - "line": 4, + "column": 11, + "line": 1, }, }, "range": Array [ - 337, - 338, + 11, + 18, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "boolean", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-reference-comments.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-false.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "mBuffers", - "range": Array [ - 26, - 34, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 51, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 26, - 75, - ], - "static": false, - "type": "ClassProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 34, - 74, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 36, - 74, - ], - "type": "TSTypeReference", - "typeName": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "name": "interop", - "range": Array [ - 36, - 43, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 36, - 53, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "name": "Reference", - "range": Array [ - 44, - 53, - ], - "type": "Identifier", - }, - "type": "TSQualifiedName", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 54, - 57, - ], - "type": "TSAnyKeyword", - }, - ], - "range": Array [ - 53, - 74, - ], - "type": "TSTypeParameterInstantiation", - }, - }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, }, - "value": null, }, - ], + "range": Array [ + 11, + 16, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { - "column": 22, + "column": 11, "line": 1, }, }, "range": Array [ - 22, - 77, + 11, + 16, ], - "type": "ClassBody", + "type": "TSLiteralType", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, }, + "range": Array [ + 11, + 16, + ], + "type": "Boolean", + "value": "false", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-never.src 1`] = ` +Object { + "body": Array [ + Object { "id": Object { "loc": Object { "end": Object { - "column": 21, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, - "name": "AudioBufferList", + "name": "Foo", "range": Array [ - 6, - 21, + 5, + 8, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { "column": 0, @@ -68655,16 +70355,32 @@ Object { }, "range": Array [ 0, - 77, + 16, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSNeverKeyword", + }, }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -68673,14 +70389,14 @@ Object { }, "range": Array [ 0, - 78, + 17, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 4, "line": 1, }, "start": Object { @@ -68690,233 +70406,369 @@ Object { }, "range": Array [ 0, - 5, + 4, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, "range": Array [ - 6, - 21, + 5, + 8, ], "type": "Identifier", - "value": "AudioBufferList", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 10, "line": 1, }, "start": Object { - "column": 22, + "column": 9, "line": 1, }, }, "range": Array [ - 22, - 23, + 9, + 10, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 26, - 34, + 11, + 16, ], "type": "Identifier", - "value": "mBuffers", + "value": "never", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-null.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "TSNullKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 4, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 34, - 35, + 0, + 4, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 5, + "line": 1, }, }, "range": Array [ - 36, - 43, + 5, + 8, ], "type": "Identifier", - "value": "interop", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 43, - 44, + 9, + 10, ], "type": "Punctuator", - "value": ".", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 44, - 53, + 11, + 15, ], - "type": "Identifier", - "value": "Reference", + "type": "Keyword", + "value": "null", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-number.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 30, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 29, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 53, - 54, + 0, + 17, ], - "type": "Punctuator", - "value": "<", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 4, + "line": 1, }, "start": Object { - "column": 30, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 54, - 57, + 0, + 4, ], "type": "Identifier", - "value": "any", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 50, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 49, - "line": 2, + "column": 5, + "line": 1, }, }, "range": Array [ - 73, - 74, + 5, + 8, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 51, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 50, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 74, - 75, + 9, + 10, ], "type": "Punctuator", - "value": ";", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 11, + "line": 1, }, }, "range": Array [ - 76, - 77, + 11, + 17, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "number", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-bigint.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-object.src 1`] = ` Object { "body": Array [ Object { @@ -68968,7 +70820,7 @@ Object { 11, 17, ], - "type": "TSBigIntKeyword", + "type": "TSObjectKeyword", }, }, ], @@ -69058,14 +70910,14 @@ Object { 17, ], "type": "Identifier", - "value": "bigint", + "value": "object", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-boolean.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-string.src 1`] = ` Object { "body": Array [ Object { @@ -69089,7 +70941,7 @@ Object { }, "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { @@ -69099,13 +70951,13 @@ Object { }, "range": Array [ 0, - 18, + 17, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { @@ -69115,9 +70967,9 @@ Object { }, "range": Array [ 11, - 18, + 17, ], - "type": "TSBooleanKeyword", + "type": "TSStringKeyword", }, }, ], @@ -69133,7 +70985,7 @@ Object { }, "range": Array [ 0, - 19, + 18, ], "sourceType": "script", "tokens": Array [ @@ -69194,7 +71046,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { @@ -69204,17 +71056,17 @@ Object { }, "range": Array [ 11, - 18, + 17, ], "type": "Identifier", - "value": "boolean", + "value": "string", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-false.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-symbol.src 1`] = ` Object { "body": Array [ Object { @@ -69238,7 +71090,7 @@ Object { }, "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { @@ -69248,32 +71100,13 @@ Object { }, "range": Array [ 0, - 16, + 17, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { - "literal": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 16, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { @@ -69283,9 +71116,9 @@ Object { }, "range": Array [ 11, - 16, + 17, ], - "type": "TSLiteralType", + "type": "TSSymbolKeyword", }, }, ], @@ -69301,7 +71134,7 @@ Object { }, "range": Array [ 0, - 17, + 18, ], "sourceType": "script", "tokens": Array [ @@ -69362,7 +71195,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { @@ -69372,17 +71205,17 @@ Object { }, "range": Array [ 11, - 16, + 17, ], - "type": "Boolean", - "value": "false", + "type": "Identifier", + "value": "symbol", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-never.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-true.src 1`] = ` Object { "body": Array [ Object { @@ -69406,7 +71239,7 @@ Object { }, "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 1, }, "start": Object { @@ -69416,13 +71249,32 @@ Object { }, "range": Array [ 0, - 16, + 15, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 1, }, "start": Object { @@ -69432,9 +71284,9 @@ Object { }, "range": Array [ 11, - 16, + 15, ], - "type": "TSNeverKeyword", + "type": "TSLiteralType", }, }, ], @@ -69450,7 +71302,7 @@ Object { }, "range": Array [ 0, - 17, + 16, ], "sourceType": "script", "tokens": Array [ @@ -69511,7 +71363,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 1, }, "start": Object { @@ -69521,17 +71373,17 @@ Object { }, "range": Array [ 11, - 16, + 15, ], - "type": "Identifier", - "value": "never", + "type": "Boolean", + "value": "true", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-null.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-undefined.src 1`] = ` Object { "body": Array [ Object { @@ -69555,7 +71407,7 @@ Object { }, "loc": Object { "end": Object { - "column": 15, + "column": 20, "line": 1, }, "start": Object { @@ -69565,13 +71417,13 @@ Object { }, "range": Array [ 0, - 15, + 20, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 15, + "column": 20, "line": 1, }, "start": Object { @@ -69581,9 +71433,9 @@ Object { }, "range": Array [ 11, - 15, + 20, ], - "type": "TSNullKeyword", + "type": "TSUndefinedKeyword", }, }, ], @@ -69599,7 +71451,7 @@ Object { }, "range": Array [ 0, - 16, + 21, ], "sourceType": "script", "tokens": Array [ @@ -69660,7 +71512,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 20, "line": 1, }, "start": Object { @@ -69670,17 +71522,17 @@ Object { }, "range": Array [ 11, - 15, + 20, ], - "type": "Keyword", - "value": "null", + "type": "Identifier", + "value": "undefined", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-number.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-unknown.src 1`] = ` Object { "body": Array [ Object { @@ -69704,7 +71556,7 @@ Object { }, "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { @@ -69714,13 +71566,13 @@ Object { }, "range": Array [ 0, - 17, + 18, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { @@ -69730,9 +71582,9 @@ Object { }, "range": Array [ 11, - 17, + 18, ], - "type": "TSNumberKeyword", + "type": "TSUnknownKeyword", }, }, ], @@ -69748,7 +71600,7 @@ Object { }, "range": Array [ 0, - 18, + 19, ], "sourceType": "script", "tokens": Array [ @@ -69809,7 +71661,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { @@ -69819,17 +71671,17 @@ Object { }, "range": Array [ 11, - 17, + 18, ], "type": "Identifier", - "value": "number", + "value": "unknown", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-object.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-void.src 1`] = ` Object { "body": Array [ Object { @@ -69853,7 +71705,7 @@ Object { }, "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { @@ -69863,13 +71715,13 @@ Object { }, "range": Array [ 0, - 17, + 15, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { @@ -69879,9 +71731,9 @@ Object { }, "range": Array [ 11, - 17, + 15, ], - "type": "TSObjectKeyword", + "type": "TSVoidKeyword", }, }, ], @@ -69897,7 +71749,7 @@ Object { }, "range": Array [ 0, - 18, + 16, ], "sourceType": "script", "tokens": Array [ @@ -69958,7 +71810,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { @@ -69968,17 +71820,17 @@ Object { }, "range": Array [ 11, - 17, + 15, ], - "type": "Identifier", - "value": "object", + "type": "Keyword", + "value": "void", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-string.src 1`] = ` +exports[`typescript fixtures/basics/typed-method-signature.src 1`] = ` Object { "body": Array [ Object { @@ -69992,52 +71844,392 @@ Object { "column": 5, "line": 1, }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "h", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 17, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 15, + 36, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSMethodSignature", + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "g", + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 39, + 55, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + }, + }, + "type": "TSMethodSignature", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + }, + "range": Array [ + 41, + 42, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 40, + 43, + ], + "type": "TSTypeParameterDeclaration", + }, + }, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 17, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, "range": Array [ 11, - 17, + 57, ], - "type": "TSStringKeyword", + "type": "TSTypeLiteral", }, }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 5, }, "start": Object { "column": 0, @@ -70046,7 +72238,7 @@ Object { }, "range": Array [ 0, - 18, + 58, ], "sourceType": "script", "tokens": Array [ @@ -70107,7 +72299,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 12, "line": 1, }, "start": Object { @@ -70117,1368 +72309,1106 @@ Object { }, "range": Array [ 11, - 17, - ], - "type": "Identifier", - "value": "string", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-symbol.src 1`] = ` -Object { - "body": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 17, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 17, - ], - "type": "TSSymbolKeyword", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 4, + 12, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 5, - 8, + 15, + 16, ], "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": "=", + "value": "h", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 4, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 3, + "line": 2, }, }, "range": Array [ - 11, + 16, 17, ], - "type": "Identifier", - "value": "symbol", + "type": "Punctuator", + "value": "(", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-true.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 15, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "literal": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "type": "TSLiteralType", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 16, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { "column": 4, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 4, + 17, + 20, ], "type": "Identifier", - "value": "type", + "value": "bar", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 9, - 10, + 20, + 21, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { "column": 15, - "line": 1, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 11, - 15, + 22, + 28, ], - "type": "Boolean", - "value": "true", + "type": "Identifier", + "value": "string", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-undefined.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 0, - 20, + 28, + 29, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 20, - ], - "type": "TSUndefinedKeyword", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 21, - ], - "sourceType": "script", - "tokens": Array [ + "type": "Punctuator", + "value": ")", + }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 0, - 4, + 29, + 30, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 5, - 8, + 31, + 35, ], - "type": "Identifier", - "value": "Foo", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 9, - 10, + 35, + 36, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 3, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 2, + "line": 3, }, }, "range": Array [ - 11, - 20, + 39, + 40, ], "type": "Identifier", - "value": "undefined", + "value": "g", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-unknown.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 4, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 3, + "line": 3, }, }, "range": Array [ - 0, - 18, + 40, + 41, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 18, - ], - "type": "TSUnknownKeyword", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "<", }, - }, - "range": Array [ - 0, - 19, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 0, - 4, + 41, + 42, ], "type": "Identifier", - "value": "type", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 6, + "line": 3, }, "start": Object { "column": 5, - "line": 1, + "line": 3, }, }, "range": Array [ - 5, - 8, + 42, + 43, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 6, + "line": 3, }, }, "range": Array [ - 9, - 10, + 43, + 44, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 7, + "line": 3, }, }, "range": Array [ - 11, - 18, + 44, + 47, ], "type": "Identifier", - "value": "unknown", + "value": "bar", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-void.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 0, - 15, + 47, + 48, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "type": "TSVoidKeyword", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ":", }, - }, - "range": Array [ - 0, - 16, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 12, + "line": 3, }, }, "range": Array [ - 0, - 4, + 49, + 50, ], "type": "Identifier", - "value": "type", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { - "column": 5, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ - 5, - 8, + 50, + 51, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ - 9, - 10, + 51, + 52, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 17, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 16, + "line": 3, }, }, "range": Array [ - 11, - 15, + 53, + 54, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "T", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-method-signature.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 18, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 3, }, }, "range": Array [ - 0, - 57, + 54, + 55, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 11, - "line": 1, - }, + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "h", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 17, - 28, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 20, - 28, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 15, - 36, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 29, - 35, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 31, - 35, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSMethodSignature", - }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-this.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ Object { "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 3, - "line": 3, + "column": 17, + "line": 2, }, "start": Object { - "column": 2, - "line": 3, + "column": 1, + "line": 2, }, }, - "name": "g", + "name": "addClickListener", "range": Array [ + 23, 39, - 40, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 65, + "line": 2, }, "start": Object { - "column": 2, - "line": 3, + "column": 1, + "line": 2, }, }, "params": Array [ Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 57, + "line": 2, }, "start": Object { - "column": 7, - "line": 3, + "column": 18, + "line": 2, }, }, - "name": "bar", + "name": "onclick", "range": Array [ - 44, - 50, + 40, + 79, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 57, + "line": 2, }, "start": Object { - "column": 10, - "line": 3, + "column": 25, + "line": 2, }, }, "range": Array [ 47, - 50, + 79, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 57, + "line": 2, }, "start": Object { - "column": 12, - "line": 3, + "column": 27, + "line": 2, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "name": "this", + "range": Array [ + 50, + 60, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 56, + 60, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "name": "e", + "range": Array [ + 62, + 70, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 63, + 70, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "name": "Event", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + }, + }, + }, + ], "range": Array [ 49, - 50, + 79, ], - "type": "TSTypeReference", - "typeName": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 57, + "line": 2, }, "start": Object { - "column": 12, - "line": 3, + "column": 50, + "line": 2, }, }, - "name": "T", "range": Array [ - 49, - 50, + 72, + 79, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, }, }, ], "range": Array [ - 39, - 55, + 23, + 87, ], "returnType": Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 64, + "line": 2, }, "start": Object { - "column": 14, - "line": 3, + "column": 58, + "line": 2, }, }, "range": Array [ - 51, - 54, + 80, + 86, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 64, + "line": 2, }, "start": Object { - "column": 16, - "line": 3, + "column": 60, + "line": 2, }, }, "range": Array [ - 53, - 54, + 82, + 86, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, + "type": "TSVoidKeyword", }, }, "type": "TSMethodSignature", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 3, - "line": 3, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 41, - 42, - ], - "type": "Identifier", - }, - "range": Array [ - 41, - 42, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 40, - 43, - ], - "type": "TSTypeParameterDeclaration", - }, }, ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, "range": Array [ - 11, - 57, + 20, + 89, ], - "type": "TSTypeLiteral", + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "UIElement", + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 89, + ], + "type": "TSInterfaceDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 4, }, "start": Object { "column": 0, "line": 1, }, - }, - "range": Array [ - 0, - 58, - ], - "sourceType": "script", - "tokens": Array [ + }, + "range": Array [ + 0, + 90, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "value": "UIElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 23, + 39, + ], + "type": "Identifier", + "value": "addClickListener", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 40, + 47, + ], + "type": "Identifier", + "value": "onclick", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 28, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 27, + "line": 2, }, }, "range": Array [ - 0, - 4, + 49, + 50, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 32, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 5, - 8, + 50, + 54, ], - "type": "Identifier", - "value": "Foo", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 32, + "line": 2, }, }, "range": Array [ - 9, - 10, + 54, + 55, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 38, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 34, + "line": 2, }, }, "range": Array [ - 11, - 12, + 56, + 60, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 41, "line": 2, }, "start": Object { - "column": 2, + "column": 40, "line": 2, }, }, "range": Array [ - 15, - 16, + 62, + 63, ], "type": "Identifier", - "value": "h", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 42, "line": 2, }, "start": Object { - "column": 3, + "column": 41, "line": 2, }, }, "range": Array [ - 16, - 17, + 63, + 64, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 48, "line": 2, }, "start": Object { - "column": 4, + "column": 43, "line": 2, }, }, "range": Array [ - 17, - 20, + 65, + 70, ], "type": "Identifier", - "value": "bar", + "value": "Event", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 49, "line": 2, }, "start": Object { - "column": 7, + "column": 48, "line": 2, }, }, "range": Array [ - 20, - 21, + 70, + 71, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 52, "line": 2, }, "start": Object { - "column": 9, + "column": 50, "line": 2, }, }, "range": Array [ - 22, - 28, + 72, + 74, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 57, "line": 2, }, "start": Object { - "column": 15, + "column": 53, "line": 2, }, }, "range": Array [ - 28, - 29, + 75, + 79, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 57, + "line": 2, + }, + }, + "range": Array [ + 79, + 80, ], "type": "Punctuator", "value": ")", @@ -71486,17 +73416,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 59, "line": 2, }, "start": Object { - "column": 16, + "column": 58, "line": 2, }, }, "range": Array [ - 29, - 30, + 80, + 81, ], "type": "Punctuator", "value": ":", @@ -71504,17 +73434,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 64, "line": 2, }, "start": Object { - "column": 18, + "column": 60, "line": 2, }, }, "range": Array [ - 31, - 35, + 82, + 86, ], "type": "Keyword", "value": "void", @@ -71522,17 +73452,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 65, "line": 2, }, "start": Object { - "column": 22, + "column": 64, "line": 2, }, }, "range": Array [ - 35, - 36, + 86, + 87, ], "type": "Punctuator", "value": ";", @@ -71540,580 +73470,709 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 3, }, "start": Object { - "column": 2, + "column": 0, "line": 3, }, }, "range": Array [ - 39, - 40, + 88, + 89, ], - "type": "Identifier", - "value": "g", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/unique-symbol.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 4, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { - "column": 3, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 40, - 41, + 0, + 23, ], - "type": "Punctuator", - "value": "<", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "unique", + "range": Array [ + 9, + 22, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSSymbolKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 4, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 41, - 42, + 0, + 4, ], "type": "Identifier", - "value": "T", + "value": "type", }, Object { "loc": Object { "end": Object { "column": 6, - "line": 3, + "line": 1, }, "start": Object { "column": 5, - "line": 3, + "line": 1, }, }, "range": Array [ - 42, - 43, + 5, + 6, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 6, - "line": 3, + "column": 7, + "line": 1, }, }, "range": Array [ - 43, - 44, + 7, + 8, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { - "column": 7, - "line": 3, + "column": 9, + "line": 1, }, }, "range": Array [ - 44, - 47, + 9, + 15, ], "type": "Identifier", - "value": "bar", + "value": "unique", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 16, + "line": 1, }, }, "range": Array [ - 47, - 48, + 16, + 22, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, ], "type": "Punctuator", - "value": ":", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/unknown-type-annotation.src 1`] = ` +Object { + "body": Array [ Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 16, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "TSUnknownKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 12, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 49, - 50, + 0, + 17, ], - "type": "Identifier", - "value": "T", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 3, + "line": 1, }, "start": Object { - "column": 13, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 50, - 51, + 0, + 3, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 7, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 4, + "line": 1, }, }, "range": Array [ - 51, - 52, + 4, + 7, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 7, + "line": 1, }, }, "range": Array [ - 53, - 54, + 7, + 8, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { - "column": 17, - "line": 3, + "column": 9, + "line": 1, }, }, "range": Array [ - 54, - 55, + 9, + 16, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "unknown", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 16, + "line": 1, }, }, "range": Array [ - 56, - 57, + 16, + 17, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-this.src 1`] = ` +exports[`typescript fixtures/basics/var-with-definite-assignment.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 1, - "line": 2, + "column": 8, + "line": 1, }, }, - "name": "addClickListener", "range": Array [ - 23, - 39, + 8, + 16, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 65, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, - }, - }, - "params": Array [ - Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 57, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 10, + "line": 1, }, }, - "name": "onclick", "range": Array [ - 40, - 79, + 10, + 16, ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 25, - "line": 2, - }, - }, - "range": Array [ - 47, - 79, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "name": "this", - "range": Array [ - 50, - 60, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 32, - "line": 2, - }, - }, - "range": Array [ - 54, - 60, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 56, - 60, - ], - "type": "TSVoidKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 40, - "line": 2, - }, - }, - "name": "e", - "range": Array [ - 62, - 70, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 41, - "line": 2, - }, - }, - "range": Array [ - 63, - 70, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 43, - "line": 2, - }, - }, - "range": Array [ - 65, - 70, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 43, - "line": 2, - }, - }, - "name": "Event", - "range": Array [ - 65, - 70, - ], - "type": "Identifier", - }, - }, - }, - }, - ], - "range": Array [ - 49, - 79, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 50, - "line": 2, - }, - }, - "range": Array [ - 72, - 79, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 53, - "line": 2, - }, - }, - "range": Array [ - 75, - 79, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSFunctionType", - }, - }, + "type": "TSStringKeyword", }, - ], + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "y", "range": Array [ - 23, - 87, + 22, + 32, ], - "returnType": Object { + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 64, + "column": 14, "line": 2, }, "start": Object { - "column": 58, + "column": 6, "line": 2, }, }, "range": Array [ - 80, - 86, + 24, + 32, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 64, + "column": 14, "line": 2, }, "start": Object { - "column": 60, + "column": 8, "line": 2, }, }, "range": Array [ - 82, - 86, + 26, + 32, ], - "type": "TSVoidKeyword", + "type": "TSNumberKeyword", }, }, - "type": "TSMethodSignature", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, }, - "start": Object { - "column": 20, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, }, + "range": Array [ + 22, + 32, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, }, - "range": Array [ - 20, - 89, - ], - "type": "TSInterfaceBody", }, - "id": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, + "range": Array [ + 18, + 33, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "z", + "range": Array [ + 38, + 48, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 40, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSObjectKeyword", + }, + }, }, - "start": Object { - "column": 10, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, }, + "range": Array [ + 38, + 48, + ], + "type": "VariableDeclarator", }, - "name": "UIElement", - "range": Array [ - 10, - 19, - ], - "type": "Identifier", - }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 1, + "column": 15, "line": 3, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 89, + 34, + 49, ], - "type": "TSInterfaceDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { @@ -72128,14 +74187,14 @@ Object { }, "range": Array [ 0, - 90, + 50, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 1, }, "start": Object { @@ -72145,241 +74204,277 @@ Object { }, "range": Array [ 0, - 9, + 5, ], "type": "Keyword", - "value": "interface", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 7, "line": 1, }, "start": Object { - "column": 10, + "column": 6, "line": 1, }, }, "range": Array [ - 10, - 19, + 6, + 7, ], "type": "Identifier", - "value": "UIElement", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 8, "line": 1, }, "start": Object { - "column": 20, + "column": 7, "line": 1, }, }, "range": Array [ - 20, - 21, + 7, + 8, ], "type": "Punctuator", - "value": "{", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 1, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 23, - 39, + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, ], "type": "Identifier", - "value": "addClickListener", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, "line": 2, }, "start": Object { - "column": 17, + "column": 0, "line": 2, }, }, "range": Array [ - 39, - 40, + 18, + 21, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 5, "line": 2, }, "start": Object { - "column": 18, + "column": 4, "line": 2, }, }, "range": Array [ - 40, - 47, + 22, + 23, ], "type": "Identifier", - "value": "onclick", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 6, "line": 2, }, "start": Object { - "column": 25, + "column": 5, "line": 2, }, }, "range": Array [ - 47, - 48, + 23, + 24, ], "type": "Punctuator", - "value": ":", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 7, "line": 2, }, "start": Object { - "column": 27, + "column": 6, "line": 2, }, }, "range": Array [ - 49, - 50, + 24, + 25, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 14, "line": 2, }, "start": Object { - "column": 28, + "column": 8, "line": 2, }, }, "range": Array [ - 50, - 54, + 26, + 32, ], - "type": "Keyword", - "value": "this", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 15, "line": 2, }, "start": Object { - "column": 32, + "column": 14, "line": 2, }, }, "range": Array [ - 54, - 55, + 32, + 33, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 3, + "line": 3, }, "start": Object { - "column": 34, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 56, - 60, + 34, + 37, ], "type": "Keyword", - "value": "void", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 38, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 60, - 61, + 38, + 39, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 2, + "column": 6, + "line": 3, }, "start": Object { - "column": 40, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 62, - 63, + 39, + 40, ], - "type": "Identifier", - "value": "e", + "type": "Punctuator", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 2, + "column": 7, + "line": 3, }, "start": Object { - "column": 41, - "line": 2, + "column": 6, + "line": 3, }, }, "range": Array [ - 63, - 64, + 40, + 41, ], "type": "Punctuator", "value": ":", @@ -72387,195 +74482,507 @@ Object { Object { "loc": Object { "end": Object { - "column": 48, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 43, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 65, - 70, + 42, + 48, ], "type": "Identifier", - "value": "Event", + "value": "object", }, Object { "loc": Object { "end": Object { - "column": 49, - "line": 2, + "column": 15, + "line": 3, }, "start": Object { - "column": 48, - "line": 2, + "column": 14, + "line": 3, }, }, "range": Array [ - 70, - 71, + 48, + 49, ], "type": "Punctuator", - "value": ")", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "TSTypeReference", + "typeName": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 52, - "line": 2, + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, }, "start": Object { - "column": 50, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 72, - 74, + 7, + 8, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 57, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 53, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 75, - 79, + 9, + 10, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 58, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 57, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 79, - 80, + 10, + 11, ], "type": "Punctuator", - "value": ")", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 59, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 58, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 80, - 81, + 11, + 12, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "B", }, Object { "loc": Object { "end": Object { - "column": 64, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { - "column": 60, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 82, - 86, + 12, + 13, ], - "type": "Keyword", - "value": "void", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 65, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 64, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 86, - 87, + 13, + 14, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 14, + "line": 1, }, }, "range": Array [ - 88, - 89, + 14, + 15, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/unique-symbol.src 1`] = ` +exports[`typescript fixtures/basics/var-with-type.src 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "name", + "range": Array [ + 4, + 15, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 15, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "TSStringKeyword", + }, + }, }, - "start": Object { - "column": 5, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "raw": "\\"Nicholas\\"", + "type": "Literal", + "value": "Nicholas", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", }, - "name": "A", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 23, + "column": 29, "line": 1, }, "start": Object { @@ -72585,50 +74992,123 @@ Object { }, "range": Array [ 0, - 23, + 29, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 34, + 45, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 37, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "TSStringKeyword", + }, + }, }, - "start": Object { - "column": 9, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 48, + 53, + ], + "raw": "\\"Bar\\"", + "type": "Literal", + "value": "Bar", }, - }, - "operator": "unique", - "range": Array [ - 9, - 22, - ], - "type": "TSTypeOperator", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 16, - 22, + 34, + 53, ], - "type": "TSSymbolKeyword", + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, }, }, + "range": Array [ + 30, + 54, + ], + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 3, }, "start": Object { "column": 0, @@ -72637,14 +75117,14 @@ Object { }, "range": Array [ 0, - 24, + 55, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 3, "line": 1, }, "start": Object { @@ -72654,46 +75134,46 @@ Object { }, "range": Array [ 0, - 4, + 3, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { - "column": 5, + "column": 4, "line": 1, }, }, "range": Array [ - 5, - 6, + 4, + 8, ], "type": "Identifier", - "value": "A", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, 8, + 9, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { @@ -72711,12 +75191,12 @@ Object { 15, ], "type": "Identifier", - "value": "unique", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 17, "line": 1, }, "start": Object { @@ -72726,25 +75206,169 @@ Object { }, "range": Array [ 16, - 22, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "type": "String", + "value": "\\"Nicholas\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 48, + 53, ], - "type": "Identifier", - "value": "symbol", + "type": "String", + "value": "\\"Bar\\"", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 24, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 23, + "line": 2, }, }, "range": Array [ - 22, - 23, + 53, + 54, ], "type": "Punctuator", "value": ";", @@ -72754,7 +75378,7 @@ Object { } `; -exports[`typescript fixtures/basics/unknown-type-annotation.src 1`] = ` +exports[`typescript fixtures/basics/variable-declaration-type-annotation-spacing.src 1`] = ` Object { "body": Array [ Object { @@ -72763,7 +75387,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { @@ -72771,51 +75395,51 @@ Object { "line": 1, }, }, - "name": "foo", + "name": "x", "range": Array [ 4, - 16, + 21, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, - 16, + 8, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 9, + "column": 15, "line": 1, }, }, "range": Array [ - 9, - 16, + 15, + 21, ], - "type": "TSUnknownKeyword", + "type": "TSStringKeyword", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { @@ -72825,7 +75449,7 @@ Object { }, "range": Array [ 4, - 16, + 21, ], "type": "VariableDeclarator", }, @@ -72833,7 +75457,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 17, + "column": 22, "line": 1, }, "start": Object { @@ -72843,15 +75467,15 @@ Object { }, "range": Array [ 0, - 17, + 22, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { "column": 0, @@ -72860,7 +75484,7 @@ Object { }, "range": Array [ 0, - 18, + 22, ], "sourceType": "script", "tokens": Array [ @@ -72885,7 +75509,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -72895,25 +75519,25 @@ Object { }, "range": Array [ 4, - 7, + 5, ], "type": "Identifier", - "value": "foo", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, 8, + 9, ], "type": "Punctuator", "value": ":", @@ -72921,35 +75545,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 9, + "column": 15, "line": 1, }, }, "range": Array [ - 9, - 16, + 15, + 21, ], "type": "Identifier", - "value": "unknown", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 22, "line": 1, }, "start": Object { - "column": 16, + "column": 21, "line": 1, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], "type": "Punctuator", "value": ";", @@ -72959,87 +75583,86 @@ Object { } `; -exports[`typescript fixtures/basics/var-with-definite-assignment.src 1`] = ` +exports[`typescript fixtures/declare/abstract-class.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "definite": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 6, - 16, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 16, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 16, - ], - "type": "TSStringKeyword", - }, - }, + "abstract": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "init": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 27, + "line": 1, }, - "range": Array [ - 6, - 16, - ], - "type": "VariableDeclarator", }, + "range": Array [ + 27, + 31, + ], + "type": "ClassBody", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, ], - "kind": "const", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 17, + "column": 7, "line": 1, }, "start": Object { @@ -73049,191 +75672,163 @@ Object { }, "range": Array [ 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ 17, + 22, ], - "type": "VariableDeclaration", + "type": "Keyword", + "value": "class", }, Object { - "declarations": Array [ - Object { - "definite": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "y", - "range": Array [ - 22, - 32, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 24, - 32, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 26, - 32, - ], - "type": "TSNumberKeyword", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 22, - 32, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, }, + }, + "range": Array [ + 27, + 28, ], - "kind": "var", + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 2, + "line": 3, }, }, "range": Array [ - 18, - 33, + 30, + 31, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/class.src 1`] = ` +Object { + "body": Array [ Object { - "declarations": Array [ - Object { - "definite": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "z", - "range": Array [ - 38, - 48, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 40, - 48, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "TSObjectKeyword", - }, - }, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "init": null, - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "start": Object { + "column": 18, + "line": 1, }, - "range": Array [ - 38, - 48, - ], - "type": "VariableDeclarator", }, - ], - "kind": "let", + "range": Array [ + 18, + 22, + ], + "type": "ClassBody", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 15, + "column": 1, "line": 3, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 34, - 49, + 0, + 22, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { @@ -73248,14 +75843,14 @@ Object { }, "range": Array [ 0, - 50, + 23, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { @@ -73265,51 +75860,15 @@ Object { }, "range": Array [ 0, - 5, - ], - "type": "Keyword", - "value": "const", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, 7, ], "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "!", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { @@ -73319,436 +75878,376 @@ Object { }, "range": Array [ 8, - 9, + 13, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { - "column": 10, + "column": 14, "line": 1, }, }, "range": Array [ - 10, - 16, + 14, + 17, ], "type": "Identifier", - "value": "string", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 19, "line": 1, }, "start": Object { - "column": 16, + "column": 18, "line": 1, }, }, "range": Array [ - 16, - 17, + 18, + 19, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 2, + "line": 3, }, }, "range": Array [ - 18, 21, - ], - "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ 22, - 23, - ], - "type": "Identifier", - "value": "y", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 23, - 24, ], "type": "Punctuator", - "value": "!", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/enum.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": ":", - }, - Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 1, + "line": 4, }, "start": Object { - "column": 8, - "line": 2, + "column": 0, + "line": 1, }, }, - "range": Array [ - 26, - 32, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, + "members": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "Bar", + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "TSEnumMember", }, - "start": Object { - "column": 14, - "line": 2, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "Baz", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "TSEnumMember", }, - }, - "range": Array [ - 32, - 33, ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, "range": Array [ - 34, + 0, 37, ], - "type": "Keyword", - "value": "let", + "type": "TSEnumDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - "value": "z", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 7, + "line": 1, }, "start": Object { - "column": 5, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 39, - 40, + 0, + 7, ], - "type": "Punctuator", - "value": "!", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 12, + "line": 1, }, "start": Object { - "column": 6, - "line": 3, + "column": 8, + "line": 1, }, }, "range": Array [ - 40, - 41, + 8, + 12, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "enum", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 13, + "line": 1, }, }, "range": Array [ - 42, - 48, + 13, + 16, ], "type": "Identifier", - "value": "object", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 17, + "line": 1, }, }, "range": Array [ - 48, - 49, + 17, + 18, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 14, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 14, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 14, - ], - "type": "TSTypeReference", - "typeName": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 12, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "B", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - }, - "type": "TSQualifiedName", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 14, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "C", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, - "type": "TSQualifiedName", - }, - }, - }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "Baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "declare": true, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, }, - "init": null, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "start": Object { + "column": 17, + "line": 1, }, - "range": Array [ - 4, - 14, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 15, + "column": 28, "line": 1, }, "start": Object { @@ -73756,11 +76255,46 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 15, + 28, ], - "type": "VariableDeclaration", + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSDeclareFunction", }, ], "loc": Object { @@ -73775,14 +76309,14 @@ Object { }, "range": Array [ 0, - 16, + 29, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { @@ -73792,25 +76326,43 @@ Object { }, "range": Array [ 0, - 3, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, ], "type": "Keyword", - "value": "var", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 17, "line": 1, }, }, "range": Array [ - 4, - 7, + 17, + 20, ], "type": "Identifier", "value": "foo", @@ -73818,358 +76370,311 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 1, }, "start": Object { - "column": 7, + "column": 20, "line": 1, }, }, "range": Array [ - 7, - 8, + 20, + 21, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 22, "line": 1, }, "start": Object { - "column": 9, + "column": 21, "line": 1, }, }, "range": Array [ - 9, - 10, + 21, + 22, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 23, "line": 1, }, "start": Object { - "column": 10, + "column": 22, "line": 1, }, }, "range": Array [ - 10, - 11, + 22, + 23, ], "type": "Punctuator", - "value": ".", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 28, "line": 1, }, "start": Object { - "column": 11, + "column": 24, "line": 1, }, }, "range": Array [ - 11, - 12, + 24, + 28, ], - "type": "Identifier", - "value": "B", + "type": "Keyword", + "value": "void", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/interface.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "TSInterfaceBody", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, + "column": 0, "line": 1, }, }, "range": Array [ - 12, - 13, + 0, + 26, ], - "type": "Punctuator", - "value": ".", + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 14, + "column": 7, "line": 1, }, "start": Object { - "column": 13, + "column": 0, "line": 1, }, }, "range": Array [ - 13, - 14, + 0, + 7, ], "type": "Identifier", - "value": "C", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 14, + "column": 8, "line": 1, }, }, "range": Array [ - 14, - 15, + 8, + 17, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "interface", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/var-with-type.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "name", - "range": Array [ - 4, - 15, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 15, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 15, - ], - "type": "TSStringKeyword", - }, - }, - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 28, - ], - "raw": "\\"Nicholas\\"", - "type": "Literal", - "value": "Nicholas", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 28, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, ], - "kind": "var", + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 0, + "column": 22, "line": 1, }, }, "range": Array [ - 0, - 29, + 22, + 23, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": "{", }, Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 34, - 45, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 37, - 45, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 39, - 45, - ], - "type": "TSStringKeyword", - }, - }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/module.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "init": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 48, - 53, - ], - "raw": "\\"Bar\\"", - "type": "Literal", - "value": "Bar", + "start": Object { + "column": 19, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, }, - "range": Array [ - 34, - 53, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 30, - 54, + 0, + 23, ], - "type": "VariableDeclaration", + "type": "TSModuleDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -74178,14 +76683,14 @@ Object { }, "range": Array [ 0, - 55, + 24, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { @@ -74195,64 +76700,179 @@ Object { }, "range": Array [ 0, - 3, + 7, ], - "type": "Keyword", - "value": "var", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 14, "line": 1, }, "start": Object { - "column": 4, + "column": 8, "line": 1, }, }, "range": Array [ - 4, 8, + 14, ], "type": "Identifier", - "value": "name", + "value": "module", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 18, "line": 1, }, "start": Object { - "column": 8, + "column": 15, "line": 1, }, }, "range": Array [ - 8, - 9, + 15, + 18, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/namespace.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, "line": 1, }, "start": Object { - "column": 9, + "column": 0, "line": 1, }, }, "range": Array [ - 9, - 15, + 0, + 7, ], "type": "Identifier", - "value": "string", + "value": "declare", }, Object { "loc": Object { @@ -74261,21 +76881,21 @@ Object { "line": 1, }, "start": Object { - "column": 16, + "column": 8, "line": 1, }, }, "range": Array [ - 16, + 8, 17, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "namespace", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 21, "line": 1, }, "start": Object { @@ -74285,161 +76905,221 @@ Object { }, "range": Array [ 18, - 28, + 21, ], - "type": "String", - "value": "\\"Nicholas\\"", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 28, + "column": 22, "line": 1, }, }, "range": Array [ - 28, - 29, + 22, + 23, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 2, + "line": 3, }, }, "range": Array [ - 30, - 33, + 25, + 26, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/declare/type-alias.src 1`] = ` +Object { + "body": Array [ Object { + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 34, - 37, + 0, + 25, ], - "type": "Identifier", - "value": "foo", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSStringKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 7, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 37, - 38, + 0, + 7, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 39, - 45, + 8, + 12, ], "type": "Identifier", - "value": "string", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 46, - 47, + 13, + 16, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 48, - 53, + 17, + 18, ], - "type": "String", - "value": "\\"Bar\\"", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ - 53, - 54, + 19, + 25, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "string", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/variable-declaration-type-annotation-spacing.src 1`] = ` +exports[`typescript fixtures/declare/variable.src 1`] = ` Object { "body": Array [ Object { @@ -74448,77 +77128,78 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "x", + "name": "foo", "range": Array [ - 4, - 21, + 12, + 20, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 8, + "column": 15, "line": 1, }, }, "range": Array [ - 8, - 21, + 15, + 20, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 15, + "column": 17, "line": 1, }, }, "range": Array [ - 15, - 21, + 17, + 20, ], - "type": "TSStringKeyword", + "type": "TSAnyKeyword", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, "range": Array [ - 4, - 21, + 12, + 20, ], "type": "VariableDeclarator", }, ], - "kind": "let", + "declare": true, + "kind": "var", "loc": Object { "end": Object { - "column": 22, + "column": 21, "line": 1, }, "start": Object { @@ -74528,15 +77209,15 @@ Object { }, "range": Array [ 0, - 22, + 21, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -74552,53 +77233,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, "line": 1, }, "start": Object { - "column": 0, + "column": 8, "line": 1, }, }, "range": Array [ - 0, - 3, + 8, + 11, ], "type": "Keyword", - "value": "let", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 15, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, "range": Array [ - 4, - 5, + 12, + 15, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 1, }, "start": Object { - "column": 8, + "column": 15, "line": 1, }, }, "range": Array [ - 8, - 9, + 15, + 16, ], "type": "Punctuator", "value": ":", @@ -74606,35 +77305,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 15, + "column": 17, "line": 1, }, }, "range": Array [ - 15, - 21, + 17, + 20, ], "type": "Identifier", - "value": "string", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 21, "line": 1, }, "start": Object { - "column": 21, + "column": 20, "line": 1, }, }, "range": Array [ + 20, 21, - 22, ], "type": "Punctuator", "value": ";", @@ -74644,52 +77343,275 @@ Object { } `; -exports[`typescript fixtures/declare/abstract-class.src 1`] = ` +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src 1`] = ` Object { "body": Array [ Object { - "abstract": true, "body": Object { - "body": Array [], + "body": Array [ + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 32, + 37, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "configurable", + "range": Array [ + 19, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 38, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 38, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 70, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 60, + 64, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "_x", + "range": Array [ + 65, + 67, + ], + "type": "Identifier", + }, + "range": Array [ + 60, + 67, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 68, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 70, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 48, + 70, + ], + "type": "FunctionExpression", + }, + }, + ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { - "column": 27, + "column": 12, "line": 1, }, }, "range": Array [ - 27, - 31, + 12, + 72, ], "type": "ClassBody", }, - "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 26, + "column": 11, "line": 1, }, "start": Object { - "column": 23, + "column": 6, "line": 1, }, }, - "name": "Foo", + "name": "Point", "range": Array [ - 23, - 26, + 6, + 11, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -74698,7 +77620,7 @@ Object { }, "range": Array [ 0, - 31, + 72, ], "superClass": null, "type": "ClassDeclaration", @@ -74706,7 +77628,7 @@ Object { ], "loc": Object { "end": Object { - "column": 0, + "column": 1, "line": 4, }, "start": Object { @@ -74716,14 +77638,14 @@ Object { }, "range": Array [ 0, - 32, + 72, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -74733,299 +77655,336 @@ Object { }, "range": Array [ 0, - 7, + 5, ], - "type": "Identifier", - "value": "declare", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 6, "line": 1, }, }, "range": Array [ - 8, - 16, + 6, + 11, ], "type": "Identifier", - "value": "abstract", + "value": "Point", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 22, + 12, + 13, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 23, - 26, + 18, + 19, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, ], "type": "Identifier", - "value": "Foo", + "value": "configurable", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 27, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 27, - 28, + 31, + 32, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 32, + 37, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, "line": 3, }, "start": Object { - "column": 0, + "column": 4, "line": 3, }, }, "range": Array [ - 30, - 31, + 43, + 46, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "get", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/class.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, }, - "range": Array [ - 18, - 22, - ], - "type": "ClassBody", }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, }, - "name": "Foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ")", + }, + Object { "loc": Object { "end": Object { - "column": 1, + "column": 13, "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 12, + "line": 3, }, }, "range": Array [ - 0, - 22, + 51, + 52, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 23, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 20, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ - 0, - 7, + 53, + 59, ], - "type": "Identifier", - "value": "declare", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 25, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 21, + "line": 3, }, }, "range": Array [ - 8, - 13, + 60, + 64, ], "type": "Keyword", - "value": "class", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 26, + "line": 3, }, "start": Object { - "column": 14, - "line": 1, + "column": 25, + "line": 3, }, }, "range": Array [ - 14, - 17, + 64, + 65, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 65, + 67, ], "type": "Identifier", - "value": "Foo", + "value": "_x", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 29, + "line": 3, }, "start": Object { - "column": 18, - "line": 1, + "column": 28, + "line": 3, }, }, "range": Array [ - 18, - 19, + 67, + 68, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 31, "line": 3, }, "start": Object { - "column": 0, + "column": 30, "line": 3, }, }, "range": Array [ - 21, - 22, + 69, + 70, ], "type": "Punctuator", "value": "}", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/enum.src 1`] = ` -Object { - "body": Array [ Object { - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { "column": 1, @@ -75033,92 +77992,366 @@ Object { }, "start": Object { "column": 0, - "line": 1, + "line": 4, }, }, - "members": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 25, + 34, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 30, + 34, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + }, + ], + "range": Array [ + 23, + 36, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 37, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 37, + ], + "type": "Decorator", }, - }, - "name": "Bar", - "range": Array [ - 23, - 26, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", }, - }, - "range": Array [ - 23, - 26, - ], - "type": "TSEnumMember", - }, - Object { - "id": Object { + "kind": "get", "loc": Object { "end": Object { - "column": 7, + "column": 42, "line": 3, }, "start": Object { "column": 4, - "line": 3, + "line": 2, }, }, - "name": "Baz", "range": Array [ - 32, - 35, + 18, + 80, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "name": "_bar", + "range": Array [ + 73, + 77, + ], + "type": "Identifier", + }, + "range": Array [ + 68, + 77, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 78, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 80, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 56, + 80, + ], + "type": "FunctionExpression", }, }, - "range": Array [ - 32, - 35, - ], - "type": "TSEnumMember", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 82, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, - ], + "name": "Other", + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, - 37, + 82, ], - "type": "TSEnumDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 5, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -75127,14 +78360,14 @@ Object { }, "range": Array [ 0, - 38, + 82, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -75144,61 +78377,43 @@ Object { }, "range": Array [ 0, - 7, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 12, + 5, ], "type": "Keyword", - "value": "enum", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 13, + "column": 6, "line": 1, }, }, "range": Array [ - 13, - 16, + 6, + 11, ], "type": "Identifier", - "value": "Foo", + "value": "Other", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", "value": "{", @@ -75206,7 +78421,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 2, }, "start": Object { @@ -75215,11 +78430,11 @@ Object { }, }, "range": Array [ - 23, - 26, + 18, + 19, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { @@ -75228,612 +78443,373 @@ Object { "line": 2, }, "start": Object { - "column": 7, + "column": 5, "line": 2, }, }, "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 32, - 35, + 19, + 22, ], "type": "Identifier", - "value": "Baz", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 9, + "line": 2, }, "start": Object { - "column": 0, - "line": 4, + "column": 8, + "line": 2, }, }, "range": Array [ - 36, - 37, + 22, + 23, ], "type": "Punctuator", - "value": "}", + "value": "(", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/function.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "declare": true, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 17, - 20, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 9, + "line": 2, }, }, - "params": Array [], "range": Array [ - 0, - 28, + 23, + 24, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 28, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSDeclareFunction", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 29, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 0, - 7, + 25, + 28, ], "type": "Identifier", - "value": "declare", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 8, - 16, + 28, + 29, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 20, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 20, - 21, + 30, + 34, ], - "type": "Punctuator", - "value": "(", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { "column": 22, - "line": 1, + "line": 2, }, "start": Object { "column": 21, - "line": 1, + "line": 2, }, }, "range": Array [ - 21, - 22, + 35, + 36, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { "column": 23, - "line": 1, + "line": 2, }, "start": Object { "column": 22, - "line": 1, + "line": 2, }, }, "range": Array [ - 22, - 23, + 36, + 37, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 24, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 24, - 28, + 42, + 48, ], "type": "Keyword", - "value": "void", + "value": "static", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/interface.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 26, - ], - "type": "TSInterfaceBody", - }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 18, - 21, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, + "column": 14, "line": 3, }, "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "type": "TSInterfaceDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 27, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 3, }, }, "range": Array [ - 0, - 7, + 49, + 52, ], "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 17, - ], - "type": "Keyword", - "value": "interface", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 18, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ - 18, - 21, + 53, + 56, ], "type": "Identifier", - "value": "Foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 18, + "line": 3, }, }, "range": Array [ - 22, - 23, + 56, + 57, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, + "column": 20, "line": 3, }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/module.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 23, - ], - "type": "TSModuleBlock", - }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, + "start": Object { + "column": 19, + "line": 3, }, - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { "loc": Object { "end": Object { - "column": 1, + "column": 22, "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 21, + "line": 3, }, }, "range": Array [ - 0, - 23, + 59, + 60, ], - "type": "TSModuleDeclaration", + "type": "Punctuator", + "value": "{", }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 67, + ], + "type": "Keyword", + "value": "return", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "Keyword", + "value": "this", }, - }, - "range": Array [ - 0, - 24, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 35, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 34, + "line": 3, }, }, "range": Array [ - 0, - 7, + 72, + 73, ], - "type": "Identifier", - "value": "declare", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 39, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 35, + "line": 3, }, }, "range": Array [ - 8, - 14, + 73, + 77, ], "type": "Identifier", - "value": "module", + "value": "_bar", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 40, + "line": 3, }, "start": Object { - "column": 15, - "line": 1, + "column": 39, + "line": 3, }, }, "range": Array [ - 15, - 18, + 77, + 78, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 42, + "line": 3, }, "start": Object { - "column": 19, - "line": 1, + "column": 41, + "line": 3, }, }, "range": Array [ - 19, - 20, + 79, + 80, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, - "line": 3, + "line": 4, }, }, "range": Array [ - 22, - 23, + 81, + 82, ], "type": "Punctuator", "value": "}", @@ -75843,51 +78819,237 @@ Object { } `; -exports[`typescript fixtures/declare/namespace.src 1`] = ` +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [], + "body": Array [ + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "hidden", + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "z", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 53, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "_z", + "range": Array [ + 48, + 50, + ], + "type": "Identifier", + }, + "range": Array [ + 43, + 50, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 36, + 51, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 34, + 53, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 31, + 53, + ], + "type": "FunctionExpression", + }, + }, + ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { - "column": 22, + "column": 8, "line": 1, }, }, "range": Array [ - 22, - 26, + 8, + 55, ], - "type": "TSModuleBlock", + "type": "ClassBody", }, - "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 21, + "column": 7, "line": 1, }, "start": Object { - "column": 18, + "column": 6, "line": 1, }, }, - "name": "Foo", + "name": "P", "range": Array [ - 18, - 21, + 6, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -75896,14 +79058,15 @@ Object { }, "range": Array [ 0, - 26, + 55, ], - "type": "TSModuleDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, + "column": 1, "line": 4, }, "start": Object { @@ -75913,14 +79076,14 @@ Object { }, "range": Array [ 0, - 27, + 55, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -75930,61 +79093,43 @@ Object { }, "range": Array [ 0, - 7, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 17, + 5, ], - "type": "Identifier", - "value": "namespace", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 7, "line": 1, }, "start": Object { - "column": 18, + "column": 6, "line": 1, }, }, "range": Array [ - 18, - 21, + 6, + 7, ], "type": "Identifier", - "value": "Foo", + "value": "P", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 9, "line": 1, }, "start": Object { - "column": 22, + "column": 8, "line": 1, }, }, "range": Array [ - 22, - 23, + 8, + 9, ], "type": "Punctuator", "value": "{", @@ -75992,419 +79137,261 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 5, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 4, + "line": 2, }, }, "range": Array [ - 25, - 26, + 14, + 15, ], "type": "Punctuator", - "value": "}", + "value": "@", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/type-alias.src 1`] = ` -Object { - "body": Array [ Object { - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 0, - 25, + 15, + 21, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 25, - ], - "type": "TSStringKeyword", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "hidden", }, - }, - "range": Array [ - 0, - 26, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { "column": 7, - "line": 1, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 0, - 7, + 26, + 29, ], "type": "Identifier", - "value": "declare", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { "column": 8, - "line": 1, + "line": 3, }, }, "range": Array [ - 8, - 12, + 30, + 31, ], "type": "Identifier", - "value": "type", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 13, - "line": 1, + "column": 9, + "line": 3, }, }, "range": Array [ - 13, - 16, + 31, + 32, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 17, - 18, + 32, + 33, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 19, - "line": 1, + "column": 12, + "line": 3, }, }, "range": Array [ - 19, - 25, + 34, + 35, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/variable.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 12, - 20, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 20, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 20, - ], - "type": "TSAnyKeyword", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 20, - ], - "type": "VariableDeclarator", - }, - ], - "declare": true, - "kind": "var", "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 20, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ - 0, - 21, + 36, + 42, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "return", }, - }, - "range": Array [ - 0, - 22, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 25, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 21, + "line": 3, }, }, "range": Array [ - 0, - 7, + 43, + 47, ], - "type": "Identifier", - "value": "declare", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 26, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 25, + "line": 3, }, }, "range": Array [ - 8, - 11, + 47, + 48, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 28, + "line": 3, }, "start": Object { - "column": 12, - "line": 1, + "column": 26, + "line": 3, }, }, "range": Array [ - 12, - 15, + 48, + 50, ], "type": "Identifier", - "value": "foo", + "value": "_z", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 29, + "line": 3, }, "start": Object { - "column": 15, - "line": 1, + "column": 28, + "line": 3, }, }, "range": Array [ - 15, - 16, + 50, + 51, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 31, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 30, + "line": 3, }, }, "range": Array [ - 17, - 20, + 52, + 53, ], - "type": "Identifier", - "value": "any", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 20, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 20, - 21, + 54, + 55, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -76415,48 +79402,9 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 32, - 37, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "configurable", - "range": Array [ - 19, - 31, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 2, }, "start": Object { @@ -76464,15 +79412,16 @@ Object { "line": 2, }, }, + "name": "adminonly", "range": Array [ - 19, - 38, + 18, + 27, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 2, }, "start": Object { @@ -76481,8 +79430,8 @@ Object { }, }, "range": Array [ - 18, - 38, + 17, + 27, ], "type": "Decorator", }, @@ -76490,26 +79439,26 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 3, }, "start": Object { - "column": 8, + "column": 15, "line": 3, }, }, - "name": "x", + "name": "y", "range": Array [ - 47, - 48, + 43, + 44, ], "type": "Identifier", }, - "kind": "get", + "kind": "set", "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 5, + "line": 5, }, "start": Object { "column": 4, @@ -76517,99 +79466,135 @@ Object { }, }, "range": Array [ - 18, - 70, + 17, + 76, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { "body": Array [ Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "object": Object { + "expression": Object { + "left": Object { + "computed": false, "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 15, + "line": 4, }, "start": Object { - "column": 21, - "line": 3, + "column": 8, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 58, + 62, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, }, + "name": "_y", + "range": Array [ + 63, + 65, + ], + "type": "Identifier", }, "range": Array [ - 60, - 64, + 58, + 65, ], - "type": "ThisExpression", + "type": "MemberExpression", }, - "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "operator": "=", + "range": Array [ + 58, + 69, + ], + "right": Object { "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 19, + "line": 4, }, "start": Object { - "column": 26, - "line": 3, + "column": 18, + "line": 4, }, }, - "name": "_x", + "name": "a", "range": Array [ - 65, - 67, + 68, + 69, ], "type": "Identifier", }, - "range": Array [ - 60, - 67, - ], - "type": "MemberExpression", + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 29, - "line": 3, + "column": 20, + "line": 4, }, "start": Object { - "column": 14, - "line": 3, + "column": 8, + "line": 4, }, }, "range": Array [ - 53, - 68, + 58, + 70, ], - "type": "ReturnStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 5, + "line": 5, }, "start": Object { - "column": 12, + "column": 20, "line": 3, }, }, "range": Array [ - 51, - 70, + 48, + 76, ], "type": "BlockStatement", }, @@ -76618,18 +79603,37 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 5, + "line": 5, }, "start": Object { - "column": 9, + "column": 16, "line": 3, }, }, - "params": Array [], + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + }, + ], "range": Array [ - 48, - 70, + 44, + 76, ], "type": "FunctionExpression", }, @@ -76638,23 +79642,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 6, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, "range": Array [ - 12, - 72, + 11, + 78, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { @@ -76662,17 +79666,17 @@ Object { "line": 1, }, }, - "name": "Point", + "name": "User", "range": Array [ 6, - 11, + 10, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -76681,7 +79685,7 @@ Object { }, "range": Array [ 0, - 72, + 78, ], "superClass": null, "type": "ClassDeclaration", @@ -76690,7 +79694,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -76699,7 +79703,7 @@ Object { }, "range": Array [ 0, - 72, + 78, ], "sourceType": "script", "tokens": Array [ @@ -76724,7 +79728,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { @@ -76734,25 +79738,25 @@ Object { }, "range": Array [ 6, - 11, + 10, ], "type": "Identifier", - "value": "Point", + "value": "User", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, "range": Array [ + 11, 12, - 13, ], "type": "Punctuator", "value": "{", @@ -76769,8 +79773,8 @@ Object { }, }, "range": Array [ + 17, 18, - 19, ], "type": "Punctuator", "value": "@", @@ -76778,7 +79782,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 14, "line": 2, }, "start": Object { @@ -76787,116 +79791,80 @@ Object { }, }, "range": Array [ - 19, - 31, + 18, + 27, ], "type": "Identifier", - "value": "configurable", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "(", + "value": "adminonly", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 10, + "line": 3, }, "start": Object { - "column": 18, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ 32, - 37, - ], - "type": "Boolean", - "value": "false", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "range": Array [ - 37, 38, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 14, "line": 3, }, "start": Object { - "column": 4, + "column": 11, "line": 3, }, }, "range": Array [ - 43, - 46, + 39, + 42, ], "type": "Identifier", - "value": "get", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 3, }, "start": Object { - "column": 8, + "column": 15, "line": 3, }, }, "range": Array [ - 47, - 48, + 43, + 44, ], "type": "Identifier", - "value": "x", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 17, "line": 3, }, "start": Object { - "column": 9, + "column": 16, "line": 3, }, }, "range": Array [ - 48, - 49, + 44, + 45, ], "type": "Punctuator", "value": "(", @@ -76904,71 +79872,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 18, "line": 3, }, "start": Object { - "column": 10, + "column": 17, "line": 3, }, }, "range": Array [ - 49, - 50, + 45, + 46, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 19, "line": 3, }, "start": Object { - "column": 12, + "column": 18, "line": 3, }, }, "range": Array [ - 51, - 52, + 46, + 47, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 21, "line": 3, }, "start": Object { - "column": 14, + "column": 20, "line": 3, }, }, "range": Array [ - 53, - 59, + 48, + 49, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 12, + "line": 4, }, "start": Object { - "column": 21, - "line": 3, + "column": 8, + "line": 4, }, }, "range": Array [ - 60, - 64, + 58, + 62, ], "type": "Keyword", "value": "this", @@ -76976,17 +79944,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 3, + "column": 13, + "line": 4, }, "start": Object { - "column": 25, - "line": 3, + "column": 12, + "line": 4, }, }, "range": Array [ - 64, - 65, + 62, + 63, ], "type": "Punctuator", "value": ".", @@ -76994,407 +79962,197 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 15, + "line": 4, }, "start": Object { - "column": 26, - "line": 3, + "column": 13, + "line": 4, }, }, "range": Array [ + 63, 65, - 67, ], "type": "Identifier", - "value": "_x", + "value": "_y", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 3, + "column": 17, + "line": 4, }, "start": Object { - "column": 28, - "line": 3, + "column": 16, + "line": 4, }, }, "range": Array [ + 66, 67, - 68, ], "type": "Punctuator", - "value": ";", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 19, + "line": 4, }, "start": Object { - "column": 30, - "line": 3, + "column": 18, + "line": 4, }, }, "range": Array [ + 68, 69, - 70, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 20, "line": 4, }, "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 71, - 72, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 25, - 34, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 30, - 34, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - }, - ], - "range": Array [ - 23, - 36, - ], - "type": "ObjectExpression", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 19, - 37, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 18, - 37, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 53, - 56, - ], - "type": "Identifier", - }, - "kind": "get", - "loc": Object { - "end": Object { - "column": 42, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 18, - 80, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 39, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 68, - 72, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 3, - }, - "start": Object { - "column": 35, - "line": 3, - }, - }, - "name": "_bar", - "range": Array [ - 73, - 77, - ], - "type": "Identifier", - }, - "range": Array [ - 68, - 77, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 40, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 3, - }, - }, - "range": Array [ - 61, - 78, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 59, - 80, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 42, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 56, - 80, - ], - "type": "FunctionExpression", - }, - }, - ], + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 12, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 12, - 82, + 18, + 20, ], "type": "ClassBody", }, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "sealed", + "range": Array [ + 1, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", + }, + ], "id": Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { "column": 6, - "line": 1, + "line": 2, }, }, - "name": "Other", + "name": "Qux", "range": Array [ - 6, - 11, + 14, + 17, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 12, + "line": 2, }, "start": Object { "column": 0, @@ -77403,7 +80161,7 @@ Object { }, "range": Array [ 0, - 82, + 20, ], "superClass": null, "type": "ClassDeclaration", @@ -77411,8 +80169,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 12, + "line": 2, }, "start": Object { "column": 0, @@ -77421,14 +80179,14 @@ Object { }, "range": Array [ 0, - 82, + 20, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -77438,46 +80196,28 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 11, + 1, + 7, ], "type": "Identifier", - "value": "Other", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": "{", + "value": "sealed", }, Object { "loc": Object { @@ -77486,67 +80226,49 @@ Object { "line": 2, }, "start": Object { - "column": 4, + "column": 0, "line": 2, }, }, "range": Array [ - 18, - 19, + 8, + 13, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 2, }, "start": Object { - "column": 5, + "column": 6, "line": 2, }, }, "range": Array [ - 19, - 22, + 14, + 17, ], "type": "Identifier", - "value": "foo", + "value": "Qux", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 2, }, "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { "column": 10, "line": 2, }, - "start": Object { - "column": 9, - "line": 2, - }, }, "range": Array [ - 23, - 24, + 18, + 19, ], "type": "Punctuator", "value": "{", @@ -77554,7 +80276,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 12, "line": 2, }, "start": Object { @@ -77563,314 +80285,472 @@ Object { }, }, "range": Array [ - 25, - 28, + 19, + 20, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, }, + "range": Array [ + 56, + 58, + ], + "type": "ClassBody", }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "selector", + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 17, + 32, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + }, + ], + "range": Array [ + 11, + 35, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "Component", + "range": Array [ + 1, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 36, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "Decorator", }, - "start": Object { - "column": 16, - "line": 2, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, }, + "name": "FooComponent", + "range": Array [ + 43, + 55, + ], + "type": "Identifier", }, - "range": Array [ - 30, - 34, - ], - "type": "Boolean", - "value": "true", - }, - Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 21, + "line": 4, }, "start": Object { - "column": 21, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 35, - 36, + 0, + 58, ], - "type": "Punctuator", - "value": "}", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 1, + "line": 1, }, "start": Object { - "column": 22, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 36, - 37, + 0, + 1, ], "type": "Punctuator", - "value": ")", + "value": "@", }, Object { "loc": Object { "end": Object { "column": 10, - "line": 3, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 1, + "line": 1, }, }, "range": Array [ - 42, - 48, + 1, + 10, ], - "type": "Keyword", - "value": "static", + "type": "Identifier", + "value": "Component", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 11, + "line": 1, }, "start": Object { - "column": 11, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 49, - 52, + 10, + 11, ], - "type": "Identifier", - "value": "get", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 12, + "line": 1, }, "start": Object { - "column": 15, - "line": 3, + "column": 11, + "line": 1, }, }, - "range": Array [ - 53, - 56, + "range": Array [ + 11, + 12, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 12, + "line": 2, }, "start": Object { - "column": 18, - "line": 3, + "column": 4, + "line": 2, }, }, "range": Array [ - 56, - 57, + 17, + 25, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "selector", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 3, + "column": 13, + "line": 2, }, "start": Object { - "column": 19, - "line": 3, + "column": 12, + "line": 2, }, }, "range": Array [ - 57, - 58, + 25, + 26, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 3, + "column": 19, + "line": 2, }, "start": Object { - "column": 21, - "line": 3, + "column": 14, + "line": 2, }, }, "range": Array [ - 59, - 60, + 27, + 32, ], - "type": "Punctuator", - "value": "{", + "type": "String", + "value": "'foo'", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 3, + "column": 20, + "line": 2, }, "start": Object { - "column": 23, - "line": 3, + "column": 19, + "line": 2, }, }, "range": Array [ - 61, - 67, + 32, + 33, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 1, "line": 3, }, "start": Object { - "column": 30, + "column": 0, "line": 3, }, }, "range": Array [ - 68, - 72, + 34, + 35, ], - "type": "Keyword", - "value": "this", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 2, "line": 3, }, "start": Object { - "column": 34, + "column": 1, "line": 3, }, }, "range": Array [ - 72, - 73, + 35, + 36, ], "type": "Punctuator", - "value": ".", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { - "column": 35, - "line": 3, + "column": 0, + "line": 4, }, }, "range": Array [ - 73, - 77, + 37, + 42, ], - "type": "Identifier", - "value": "_bar", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 3, + "column": 18, + "line": 4, }, "start": Object { - "column": 39, - "line": 3, + "column": 6, + "line": 4, }, }, "range": Array [ - 77, - 78, + 43, + 55, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "FooComponent", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 3, + "column": 20, + "line": 4, }, "start": Object { - "column": 41, - "line": 3, + "column": 19, + "line": 4, }, }, "range": Array [ - 79, - 80, + 56, + 57, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 21, "line": 4, }, "start": Object { - "column": 0, + "column": 20, "line": 4, }, }, "range": Array [ - 81, - 82, + 57, + 58, ], "type": "Punctuator", "value": "}", @@ -77880,7 +80760,7 @@ Object { } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -77891,9 +80771,48 @@ Object { "decorators": Array [ Object { "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 29, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 11, + "column": 20, "line": 2, }, "start": Object { @@ -77901,16 +80820,15 @@ Object { "line": 2, }, }, - "name": "hidden", "range": Array [ 15, - 21, + 30, ], - "type": "Identifier", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 11, + "column": 20, "line": 2, }, "start": Object { @@ -77920,7 +80838,7 @@ Object { }, "range": Array [ 14, - 21, + 30, ], "type": "Decorator", }, @@ -77928,25 +80846,25 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 18, "line": 3, }, "start": Object { - "column": 8, + "column": 4, "line": 3, }, }, - "name": "z", + "name": "instanceMethod", "range": Array [ - 30, - 31, + 35, + 49, ], "type": "Identifier", }, - "kind": "get", + "kind": "method", "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 3, }, "start": Object { @@ -77956,98 +80874,27 @@ Object { }, "range": Array [ 14, - 53, + 54, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 43, - 47, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "_z", - "range": Array [ - 48, - 50, - ], - "type": "Identifier", - }, - "range": Array [ - 43, - 50, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 36, - 51, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 3, }, "start": Object { - "column": 12, + "column": 21, "line": 3, }, }, "range": Array [ - 34, - 53, + 52, + 54, ], "type": "BlockStatement", }, @@ -78056,18 +80903,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 3, }, "start": Object { - "column": 9, + "column": 18, "line": 3, }, }, "params": Array [], "range": Array [ - 31, - 53, + 49, + 54, ], "type": "FunctionExpression", }, @@ -78085,7 +80932,7 @@ Object { }, "range": Array [ 8, - 55, + 56, ], "type": "ClassBody", }, @@ -78100,7 +80947,7 @@ Object { "line": 1, }, }, - "name": "P", + "name": "B", "range": Array [ 6, 7, @@ -78119,7 +80966,7 @@ Object { }, "range": Array [ 0, - 55, + 56, ], "superClass": null, "type": "ClassDeclaration", @@ -78127,8 +80974,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -78137,7 +80984,7 @@ Object { }, "range": Array [ 0, - 55, + 57, ], "sourceType": "script", "tokens": Array [ @@ -78175,7 +81022,7 @@ Object { 7, ], "type": "Identifier", - "value": "P", + "value": "B", }, Object { "loc": Object { @@ -78216,7 +81063,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 2, }, "start": Object { @@ -78226,61 +81073,25 @@ Object { }, "range": Array [ 15, - 21, - ], - "type": "Identifier", - "value": "hidden", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 26, - 29, - ], - "type": "Identifier", - "value": "get", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 30, - 31, + 23, ], "type": "Identifier", - "value": "z", + "value": "onlyRead", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 9, - "line": 3, + "column": 13, + "line": 2, }, }, "range": Array [ - 31, - 32, + 23, + 24, ], "type": "Punctuator", "value": "(", @@ -78288,143 +81099,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 32, - 33, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, + "column": 19, + "line": 2, }, "start": Object { - "column": 12, - "line": 3, + "column": 14, + "line": 2, }, }, "range": Array [ - 34, - 35, + 24, + 29, ], - "type": "Punctuator", - "value": "{", + "type": "Boolean", + "value": "false", }, Object { "loc": Object { "end": Object { "column": 20, - "line": 3, + "line": 2, }, "start": Object { - "column": 14, - "line": 3, + "column": 19, + "line": 2, }, }, "range": Array [ - 36, - 42, + 29, + 30, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 18, "line": 3, }, "start": Object { - "column": 21, + "column": 4, "line": 3, }, }, "range": Array [ - 43, - 47, + 35, + 49, ], - "type": "Keyword", - "value": "this", + "type": "Identifier", + "value": "instanceMethod", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 19, "line": 3, }, "start": Object { - "column": 25, + "column": 18, "line": 3, }, }, "range": Array [ - 47, - 48, + 49, + 50, ], "type": "Punctuator", - "value": ".", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 20, "line": 3, }, "start": Object { - "column": 26, + "column": 19, "line": 3, }, }, "range": Array [ - 48, 50, + 51, ], - "type": "Identifier", - "value": "_z", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 3, }, "start": Object { - "column": 28, + "column": 21, "line": 3, }, }, "range": Array [ - 50, - 51, + 52, + 53, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 3, }, "start": Object { - "column": 30, + "column": 22, "line": 3, }, }, "range": Array [ - 52, 53, + 54, ], "type": "Punctuator", "value": "}", @@ -78441,8 +81234,8 @@ Object { }, }, "range": Array [ - 54, 55, + 56, ], "type": "Punctuator", "value": "}", @@ -78452,7 +81245,7 @@ Object { } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -78463,9 +81256,48 @@ Object { "decorators": Array [ Object { "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 2, }, "start": Object { @@ -78473,16 +81305,15 @@ Object { "line": 2, }, }, - "name": "adminonly", "range": Array [ - 18, - 27, + 15, + 25, ], - "type": "Identifier", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 2, }, "start": Object { @@ -78491,8 +81322,8 @@ Object { }, }, "range": Array [ - 17, - 27, + 14, + 25, ], "type": "Decorator", }, @@ -78500,26 +81331,26 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 16, + "column": 23, "line": 3, }, "start": Object { - "column": 15, + "column": 11, "line": 3, }, }, - "name": "y", + "name": "staticMethod", "range": Array [ - 43, - 44, + 37, + 49, ], "type": "Identifier", }, - "kind": "set", + "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 28, + "line": 3, }, "start": Object { "column": 4, @@ -78527,135 +81358,28 @@ Object { }, }, "range": Array [ - 17, - 76, + 14, + 54, ], "static": true, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 58, - 62, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, - }, - }, - "name": "_y", - "range": Array [ - 63, - 65, - ], - "type": "Identifier", - }, - "range": Array [ - 58, - 65, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "operator": "=", - "range": Array [ - 58, - 69, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "name": "a", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 58, - 70, - ], - "type": "ExpressionStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 28, + "line": 3, }, "start": Object { - "column": 20, + "column": 26, "line": 3, }, }, "range": Array [ - 48, - 76, + 52, + 54, ], "type": "BlockStatement", }, @@ -78664,37 +81388,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 28, + "line": 3, }, "start": Object { - "column": 16, + "column": 23, "line": 3, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 45, - 46, - ], - "type": "Identifier", - }, - ], + "params": Array [], "range": Array [ - 44, - 76, + 49, + 54, ], "type": "FunctionExpression", }, @@ -78703,23 +81408,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 4, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ - 11, - 78, + 8, + 56, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 1, }, "start": Object { @@ -78727,17 +81432,17 @@ Object { "line": 1, }, }, - "name": "User", + "name": "C", "range": Array [ 6, - 10, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -78746,7 +81451,7 @@ Object { }, "range": Array [ 0, - 78, + 56, ], "superClass": null, "type": "ClassDeclaration", @@ -78754,8 +81459,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -78764,7 +81469,7 @@ Object { }, "range": Array [ 0, - 78, + 57, ], "sourceType": "script", "tokens": Array [ @@ -78789,7 +81494,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 1, }, "start": Object { @@ -78799,25 +81504,25 @@ Object { }, "range": Array [ 6, - 10, + 7, ], "type": "Identifier", - "value": "User", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 9, "line": 1, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ - 11, - 12, + 8, + 9, ], "type": "Punctuator", "value": "{", @@ -78834,8 +81539,8 @@ Object { }, }, "range": Array [ - 17, - 18, + 14, + 15, ], "type": "Punctuator", "value": "@", @@ -78843,7 +81548,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 2, }, "start": Object { @@ -78852,116 +81557,134 @@ Object { }, }, "range": Array [ + 15, 18, - 27, ], "type": "Identifier", - "value": "adminonly", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 9, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 8, + "line": 2, }, }, "range": Array [ - 32, - 38, + 18, + 19, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 14, - "line": 3, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 9, + "line": 2, }, }, "range": Array [ - 39, - 42, + 19, + 24, ], - "type": "Identifier", - "value": "set", + "type": "Boolean", + "value": "false", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, "line": 3, }, "start": Object { - "column": 15, + "column": 4, "line": 3, }, }, "range": Array [ - 43, - 44, + 30, + 36, ], - "type": "Identifier", - "value": "y", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 23, "line": 3, }, "start": Object { - "column": 16, + "column": 11, "line": 3, }, }, "range": Array [ - 44, - 45, + 37, + 49, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "staticMethod", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 24, "line": 3, }, "start": Object { - "column": 17, + "column": 23, "line": 3, }, }, "range": Array [ - 45, - 46, + 49, + 50, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 25, "line": 3, }, "start": Object { - "column": 18, + "column": 24, "line": 3, }, }, "range": Array [ - 46, - 47, + 50, + 51, ], "type": "Punctuator", "value": ")", @@ -78969,17 +81692,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 27, "line": 3, }, "start": Object { - "column": 20, + "column": 26, "line": 3, }, }, "range": Array [ - 48, - 49, + 52, + 53, ], "type": "Punctuator", "value": "{", @@ -78987,367 +81710,428 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 28, + "line": 3, }, "start": Object { - "column": 8, - "line": 4, + "column": 27, + "line": 3, }, }, "range": Array [ - 58, - 62, + 53, + 54, ], - "type": "Keyword", - "value": "this", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 1, "line": 4, }, "start": Object { - "column": 12, + "column": 0, "line": 4, }, }, - "range": Array [ - 62, - 63, - ], - "type": "Punctuator", - "value": ".", - }, - Object { + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "instanceMethod", + "range": Array [ + 28, + 42, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 47, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 49, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 15, + "column": 1, "line": 4, }, "start": Object { - "column": 13, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 63, - 65, + 0, + 49, ], - "type": "Identifier", - "value": "_y", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 5, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 66, - 67, + 0, + 5, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { - "column": 18, - "line": 4, + "column": 6, + "line": 1, }, }, "range": Array [ - 68, - 69, + 6, + 7, ], "type": "Identifier", - "value": "a", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 4, + "column": 9, + "line": 1, }, "start": Object { - "column": 19, - "line": 4, + "column": 8, + "line": 1, }, }, "range": Array [ - 69, - 70, + 8, + 9, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 5, - "line": 5, + "line": 2, }, "start": Object { "column": 4, - "line": 5, - }, - }, - "range": Array [ - 75, - 76, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 6, + "line": 2, }, }, "range": Array [ - 77, - 78, + 14, + 15, ], "type": "Punctuator", - "value": "}", + "value": "@", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 18, - 20, - ], - "type": "ClassBody", - }, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "sealed", - "range": Array [ - 1, - 7, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 7, - ], - "type": "Decorator", - }, - ], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "name": "Qux", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 0, - 20, + 15, + 23, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "onlyRead", }, - }, - "range": Array [ - 0, - 20, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 0, - 1, + 28, + 42, ], - "type": "Punctuator", - "value": "@", + "type": "Identifier", + "value": "instanceMethod", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 1, - "line": 1, + "column": 18, + "line": 3, }, }, "range": Array [ - 1, - 7, + 42, + 43, ], - "type": "Identifier", - "value": "sealed", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 20, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 19, + "line": 3, }, }, "range": Array [ - 8, - 13, + 43, + 44, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 22, + "line": 3, }, "start": Object { - "column": 6, - "line": 2, + "column": 21, + "line": 3, }, }, "range": Array [ - 14, - 17, + 45, + 46, ], - "type": "Identifier", - "value": "Qux", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 23, + "line": 3, }, "start": Object { - "column": 10, - "line": 2, + "column": 22, + "line": 3, }, }, "range": Array [ - 18, - 19, + 46, + 47, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 1, + "line": 4, }, "start": Object { - "column": 11, - "line": 2, + "column": 0, + "line": 4, }, }, "range": Array [ - 19, - 20, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -79357,182 +82141,165 @@ Object { } `; -exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = ` +exports[`typescript fixtures/decorators/method-decorators/method-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, - }, - "range": Array [ - 56, - 58, - ], - "type": "ClassBody", - }, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ + "body": Array [ + Object { + "computed": false, + "decorators": Array [ Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 8, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 4, + "line": 2, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "selector", - "range": Array [ - 17, - 25, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 17, - 32, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 27, - 32, - ], - "raw": "'foo'", - "type": "Literal", - "value": "foo", - }, - }, - ], "range": Array [ - 11, - 35, + 14, + 18, ], - "type": "ObjectExpression", + "type": "Decorator", }, ], - "callee": Object { + "key": Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 23, + "line": 3, }, "start": Object { - "column": 1, - "line": 1, + "column": 11, + "line": 3, }, }, - "name": "Component", + "name": "staticMethod", "range": Array [ - 1, - 10, + 30, + 42, ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { - "column": 2, + "column": 28, "line": 3, }, "start": Object { - "column": 1, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 1, - 36, + 14, + 47, ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "type": "FunctionExpression", }, }, - "range": Array [ - 0, - 36, - ], - "type": "Decorator", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - ], + "range": Array [ + 8, + 49, + ], + "type": "ClassBody", + }, "id": Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { "column": 6, - "line": 4, + "line": 1, }, }, - "name": "FooComponent", + "name": "D", "range": Array [ - 43, - 55, + 6, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 21, + "column": 1, "line": 4, }, "start": Object { @@ -79542,7 +82309,7 @@ Object { }, "range": Array [ 0, - 58, + 49, ], "superClass": null, "type": "ClassDeclaration", @@ -79550,8 +82317,8 @@ Object { ], "loc": Object { "end": Object { - "column": 21, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -79560,14 +82327,14 @@ Object { }, "range": Array [ 0, - 58, + 50, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -79577,61 +82344,43 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 10, + 6, + 7, ], "type": "Identifier", - "value": "Component", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": "(", + "value": "D", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 9, "line": 1, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ - 11, - 12, + 8, + 9, ], "type": "Punctuator", "value": "{", @@ -79639,7 +82388,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 5, "line": 2, }, "start": Object { @@ -79648,98 +82397,98 @@ Object { }, }, "range": Array [ - 17, - 25, + 14, + 15, ], - "type": "Identifier", - "value": "selector", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 2, }, "start": Object { - "column": 12, + "column": 5, "line": 2, }, }, "range": Array [ - 25, - 26, + 15, + 18, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 10, + "line": 3, }, "start": Object { - "column": 14, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 27, - 32, + 23, + 29, ], - "type": "String", - "value": "'foo'", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 23, + "line": 3, }, "start": Object { - "column": 19, - "line": 2, + "column": 11, + "line": 3, }, }, "range": Array [ - 32, - 33, + 30, + 42, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "staticMethod", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 24, "line": 3, }, "start": Object { - "column": 0, + "column": 23, "line": 3, }, }, "range": Array [ - 34, - 35, + 42, + 43, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 25, "line": 3, }, "start": Object { - "column": 1, + "column": 24, "line": 3, }, }, "range": Array [ - 35, - 36, + 43, + 44, ], "type": "Punctuator", "value": ")", @@ -79747,71 +82496,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 37, - 42, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 4, + "column": 27, + "line": 3, }, "start": Object { - "column": 6, - "line": 4, + "column": 26, + "line": 3, }, }, "range": Array [ - 43, - 55, + 45, + 46, ], - "type": "Identifier", - "value": "FooComponent", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 4, + "column": 28, + "line": 3, }, "start": Object { - "column": 19, - "line": 4, + "column": 27, + "line": 3, }, }, "range": Array [ - 56, - 57, + 46, + 47, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 1, "line": 4, }, "start": Object { - "column": 20, + "column": 0, "line": 4, }, }, "range": Array [ - 57, - 58, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -79821,7 +82552,7 @@ Object { } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -79829,113 +82560,38 @@ Object { "body": Array [ Object { "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 24, - 29, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "onlyRead", - "range": Array [ - 15, - 23, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 15, - 30, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 30, - ], - "type": "Decorator", - }, - ], "key": Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 5, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 2, + "line": 2, }, }, - "name": "instanceMethod", + "name": "bar", "range": Array [ - 35, - 49, + 14, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ 14, - 54, + 49, ], "static": false, "type": "MethodDefinition", @@ -79945,17 +82601,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 21, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 52, - 54, + 47, + 49, ], "type": "BlockStatement", }, @@ -79964,18 +82620,165 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 18, - "line": 3, + "column": 5, + "line": 2, }, }, - "params": Array [], + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 32, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 32, + ], + "type": "Decorator", + }, + ], + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 45, + ], + "type": "ArrayPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], "range": Array [ + 17, 49, - 54, ], "type": "FunctionExpression", }, @@ -79984,23 +82787,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 56, + 10, + 51, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -80008,17 +82811,17 @@ Object { "line": 1, }, }, - "name": "B", + "name": "Foo", "range": Array [ 6, - 7, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -80027,7 +82830,7 @@ Object { }, "range": Array [ 0, - 56, + 51, ], "superClass": null, "type": "ClassDeclaration", @@ -80036,7 +82839,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -80045,7 +82848,7 @@ Object { }, "range": Array [ 0, - 57, + 52, ], "sourceType": "script", "tokens": Array [ @@ -80070,7 +82873,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -80080,25 +82883,25 @@ Object { }, "range": Array [ 6, - 7, + 9, ], "type": "Identifier", - "value": "B", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -80110,13 +82913,49 @@ Object { "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ 14, - 15, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, ], "type": "Punctuator", "value": "@", @@ -80124,35 +82963,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 2, }, "start": Object { - "column": 5, + "column": 7, "line": 2, }, }, "range": Array [ - 15, - 23, + 19, + 26, ], "type": "Identifier", - "value": "onlyRead", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 2, }, "start": Object { - "column": 13, + "column": 14, "line": 2, }, }, "range": Array [ - 23, - 24, + 26, + 27, ], "type": "Punctuator", "value": "(", @@ -80164,16 +83003,16 @@ Object { "line": 2, }, "start": Object { - "column": 14, + "column": 15, "line": 2, }, }, "range": Array [ - 24, - 29, + 27, + 31, ], "type": "Boolean", - "value": "false", + "value": "true", }, Object { "loc": Object { @@ -80187,8 +83026,8 @@ Object { }, }, "range": Array [ - 29, - 30, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -80196,53 +83035,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 22, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, }, }, "range": Array [ 35, - 49, + 38, ], "type": "Identifier", - "value": "instanceMethod", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 28, + "line": 2, }, "start": Object { - "column": 18, - "line": 3, + "column": 27, + "line": 2, }, }, "range": Array [ - 49, - 50, + 39, + 40, ], "type": "Punctuator", - "value": "(", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 3, + "column": 29, + "line": 2, }, "start": Object { - "column": 19, - "line": 3, + "column": 28, + "line": 2, }, }, "range": Array [ - 50, - 51, + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, ], "type": "Punctuator", "value": ")", @@ -80250,17 +83143,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 3, + "column": 36, + "line": 2, }, "start": Object { - "column": 21, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 52, - 53, + 47, + 48, ], "type": "Punctuator", "value": "{", @@ -80268,17 +83161,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 22, - "line": 3, + "column": 36, + "line": 2, }, }, "range": Array [ - 53, - 54, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -80287,16 +83180,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, - "line": 4, + "line": 3, }, }, "range": Array [ - 55, - 56, + 50, + 51, ], "type": "Punctuator", "value": "}", @@ -80306,7 +83199,7 @@ Object { } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` Object { "body": Array [ Object { @@ -80314,153 +83207,366 @@ Object { "body": Array [ Object { "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 113, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + }, + "range": Array [ + 81, + 91, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "operator": "=", + "range": Array [ + 81, + 106, + ], + "right": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "name": "config", + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + }, + "range": Array [ + 94, + 106, + ], + "type": "MemberExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 107, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 113, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "APP_CONFIG", + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "Inject", + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 51, + ], + "type": "CallExpression", + }, "loc": Object { "end": Object { - "column": 14, + "column": 35, "line": 2, }, "start": Object { - "column": 9, + "column": 16, "line": 2, }, }, "range": Array [ - 19, - 24, + 32, + 51, ], - "raw": "false", - "type": "Literal", - "value": false, + "type": "Decorator", }, ], - "callee": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "name": "config", + "range": Array [ + 52, + 69, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 8, + "column": 53, "line": 2, }, "start": Object { - "column": 5, + "column": 42, "line": 2, }, }, - "name": "Foo", "range": Array [ - 15, - 18, + 58, + 69, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "name": "AppConfig", + "range": Array [ + 60, + 69, + ], + "type": "Identifier", + }, }, }, - "range": Array [ - 15, - 25, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 25, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, }, - }, - "name": "staticMethod", - "range": Array [ - 37, - 49, ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 54, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "range": Array [ - 52, - 54, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 3, - }, - }, - "params": Array [], "range": Array [ - 49, - 54, + 31, + 113, ], "type": "FunctionExpression", }, @@ -80469,23 +83575,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, "range": Array [ - 8, - 56, + 14, + 115, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 1, }, "start": Object { @@ -80493,17 +83599,17 @@ Object { "line": 1, }, }, - "name": "C", + "name": "Service", "range": Array [ 6, - 7, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { "column": 0, @@ -80512,7 +83618,7 @@ Object { }, "range": Array [ 0, - 56, + 115, ], "superClass": null, "type": "ClassDeclaration", @@ -80521,7 +83627,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 6, }, "start": Object { "column": 0, @@ -80530,7 +83636,7 @@ Object { }, "range": Array [ 0, - 57, + 116, ], "sourceType": "script", "tokens": Array [ @@ -80555,7 +83661,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 1, }, "start": Object { @@ -80565,79 +83671,61 @@ Object { }, "range": Array [ 6, - 7, + 13, ], "type": "Identifier", - "value": "C", + "value": "Service", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 15, "line": 1, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, "range": Array [ 14, 15, ], "type": "Punctuator", - "value": "@", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 15, "line": 2, }, "start": Object { - "column": 5, + "column": 4, "line": 2, }, }, "range": Array [ - 15, - 18, + 20, + 31, ], "type": "Identifier", - "value": "Foo", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 2, }, "start": Object { - "column": 8, + "column": 15, "line": 2, }, }, "range": Array [ - 18, - 19, + 31, + 32, ], "type": "Punctuator", "value": "(", @@ -80645,485 +83733,236 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 19, - 24, - ], - "type": "Boolean", - "value": "false", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, + "column": 17, "line": 2, }, "start": Object { - "column": 14, + "column": 16, "line": 2, }, }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 37, - 49, - ], - "type": "Identifier", - "value": "staticMethod", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "range": Array [ - 52, - 53, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 27, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "onlyRead", - "range": Array [ - 15, - 23, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 23, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "instanceMethod", - "range": Array [ - 28, - 42, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 47, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 45, - 47, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 42, - 47, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 49, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", }, + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + "value": "Inject", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 24, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 23, + "line": 2, }, }, "range": Array [ - 0, - 49, + 39, + 40, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, + "type": "Punctuator", + "value": "(", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + "value": "APP_CONFIG", }, - }, - "range": Array [ - 0, - 50, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 35, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 34, + "line": 2, }, }, "range": Array [ - 0, - 5, + 50, + 51, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 42, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 36, + "line": 2, }, }, "range": Array [ - 6, - 7, + 52, + 58, ], "type": "Identifier", - "value": "A", + "value": "config", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 43, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 42, + "line": 2, }, }, "range": Array [ - 8, - 9, + 58, + 59, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 53, "line": 2, }, "start": Object { - "column": 4, + "column": 44, "line": 2, }, }, "range": Array [ - 14, - 15, + 60, + 69, + ], + "type": "Identifier", + "value": "AppConfig", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, ], "type": "Punctuator", - "value": "@", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 56, "line": 2, }, "start": Object { - "column": 5, + "column": 55, "line": 2, }, }, "range": Array [ - 15, - 23, + 71, + 72, ], - "type": "Identifier", - "value": "onlyRead", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 12, "line": 3, }, "start": Object { - "column": 4, + "column": 8, "line": 3, }, }, "range": Array [ - 28, - 42, + 81, + 85, ], - "type": "Identifier", - "value": "instanceMethod", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 13, "line": 3, }, "start": Object { - "column": 18, + "column": 12, "line": 3, }, }, "range": Array [ - 42, - 43, + 85, + 86, ], "type": "Punctuator", - "value": "(", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "value": "title", }, Object { "loc": Object { @@ -81137,16 +83976,16 @@ Object { }, }, "range": Array [ - 43, - 44, + 92, + 93, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 27, "line": 3, }, "start": Object { @@ -81155,26 +83994,80 @@ Object { }, }, "range": Array [ - 45, - 46, + 94, + 100, + ], + "type": "Identifier", + "value": "config", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 100, + 101, ], "type": "Punctuator", - "value": "{", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 33, "line": 3, }, "start": Object { - "column": 22, + "column": 28, "line": 3, }, }, "range": Array [ - 46, - 47, + 101, + 106, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, ], "type": "Punctuator", "value": "}", @@ -81183,16 +84076,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { "column": 0, - "line": 4, + "line": 5, }, }, "range": Array [ - 48, - 49, + 114, + 115, ], "type": "Punctuator", "value": "}", @@ -81202,7 +84095,7 @@ Object { } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -81210,66 +84103,29 @@ Object { "body": Array [ Object { "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Decorator", - }, - ], "key": Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 7, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 4, + "line": 2, }, }, - "name": "staticMethod", + "name": "bar", "range": Array [ - 30, - 42, + 16, + 19, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 38, + "line": 2, }, "start": Object { "column": 4, @@ -81277,10 +84133,10 @@ Object { }, }, "range": Array [ - 14, - 47, + 16, + 50, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, @@ -81288,17 +84144,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 38, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 36, + "line": 2, }, }, "range": Array [ - 45, - 47, + 48, + 50, ], "type": "BlockStatement", }, @@ -81307,18 +84163,146 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 38, + "line": 2, }, "start": Object { - "column": 23, - "line": 3, + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 34, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 35, + 46, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + }, }, - }, - "params": Array [], + ], "range": Array [ - 42, - 47, + 19, + 50, ], "type": "FunctionExpression", }, @@ -81327,23 +84311,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 49, + 10, + 52, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -81351,17 +84335,17 @@ Object { "line": 1, }, }, - "name": "D", + "name": "Foo", "range": Array [ 6, - 7, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -81370,7 +84354,7 @@ Object { }, "range": Array [ 0, - 49, + 52, ], "superClass": null, "type": "ClassDeclaration", @@ -81379,7 +84363,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -81388,7 +84372,7 @@ Object { }, "range": Array [ 0, - 50, + 53, ], "sourceType": "script", "tokens": Array [ @@ -81413,7 +84397,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -81423,25 +84407,25 @@ Object { }, "range": Array [ 6, - 7, + 9, ], "type": "Identifier", - "value": "D", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -81449,7 +84433,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 2, }, "start": Object { @@ -81458,11 +84442,11 @@ Object { }, }, "range": Array [ - 14, - 15, + 16, + 19, ], - "type": "Punctuator", - "value": "@", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { @@ -81471,67 +84455,67 @@ Object { "line": 2, }, "start": Object { - "column": 5, + "column": 7, "line": 2, }, }, "range": Array [ - 15, - 18, + 19, + 20, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 9, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 8, + "line": 2, }, }, "range": Array [ - 23, - 29, + 20, + 21, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 16, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 9, + "line": 2, }, }, "range": Array [ - 30, - 42, + 21, + 28, ], "type": "Identifier", - "value": "staticMethod", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 3, + "column": 17, + "line": 2, }, "start": Object { - "column": 23, - "line": 3, + "column": 16, + "line": 2, }, }, "range": Array [ - 42, - 43, + 28, + 29, ], "type": "Punctuator", "value": "(", @@ -81539,48 +84523,102 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 21, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, + "column": 17, + "line": 2, }, }, "range": Array [ - 43, - 44, + 29, + 33, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, ], "type": "Punctuator", "value": ")", }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "baz", + }, Object { "loc": Object { "end": Object { "column": 27, - "line": 3, + "line": 2, }, "start": Object { "column": 26, - "line": 3, + "line": 2, }, }, "range": Array [ - 45, - 46, + 38, + 39, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { "column": 28, - "line": 3, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, }, "start": Object { - "column": 27, - "line": 3, + "column": 34, + "line": 2, }, }, "range": Array [ @@ -81588,22 +84626,58 @@ Object { 47, ], "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", "value": "}", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, - "line": 4, + "line": 3, }, }, "range": Array [ - 48, - 49, + 51, + 52, ], "type": "Punctuator", "value": "}", @@ -81613,7 +84687,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -81624,37 +84698,37 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 5, + "column": 14, "line": 2, }, "start": Object { - "column": 2, + "column": 11, "line": 2, }, }, "name": "bar", "range": Array [ - 14, - 17, + 29, + 32, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 14, - 49, + 22, + 63, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, @@ -81662,17 +84736,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 2, }, "start": Object { - "column": 35, + "column": 43, "line": 2, }, }, "range": Array [ - 47, - 49, + 61, + 63, ], "type": "BlockStatement", }, @@ -81681,11 +84755,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 2, }, "start": Object { - "column": 5, + "column": 14, "line": 2, }, }, @@ -81698,17 +84772,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 28, "line": 2, }, "start": Object { - "column": 15, + "column": 24, "line": 2, }, }, "range": Array [ - 27, - 31, + 42, + 46, ], "raw": "true", "type": "Literal", @@ -81718,128 +84792,109 @@ Object { "callee": Object { "loc": Object { "end": Object { - "column": 14, + "column": 23, "line": 2, }, "start": Object { - "column": 7, + "column": 16, "line": 2, }, }, "name": "special", "range": Array [ - 19, - 26, + 34, + 41, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 20, + "column": 29, "line": 2, }, "start": Object { - "column": 7, + "column": 16, "line": 2, }, }, "range": Array [ - 19, - 32, + 34, + 47, ], "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 20, + "column": 29, "line": 2, }, "start": Object { - "column": 6, + "column": 15, "line": 2, }, }, "range": Array [ - 18, - 32, + 33, + 47, ], "type": "Decorator", }, ], - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 35, - 38, - ], - "type": "Identifier", - }, - ], "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { - "column": 21, + "column": 30, "line": 2, }, }, + "name": "baz", "range": Array [ - 33, - 45, + 48, + 59, ], - "type": "ArrayPattern", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { - "column": 28, + "column": 33, "line": 2, }, }, "range": Array [ - 40, - 45, + 51, + 59, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { - "column": 30, + "column": 35, "line": 2, }, }, "range": Array [ - 42, - 45, + 53, + 59, ], - "type": "TSAnyKeyword", + "type": "TSNumberKeyword", }, }, }, ], "range": Array [ - 17, - 49, + 32, + 63, ], "type": "FunctionExpression", }, @@ -81851,20 +84906,20 @@ Object { "line": 3, }, "start": Object { - "column": 10, + "column": 16, "line": 1, }, }, "range": Array [ - 10, - 51, + 16, + 65, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 15, "line": 1, }, "start": Object { @@ -81872,10 +84927,10 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "StaticFoo", "range": Array [ 6, - 9, + 15, ], "type": "Identifier", }, @@ -81891,7 +84946,7 @@ Object { }, "range": Array [ 0, - 51, + 65, ], "superClass": null, "type": "ClassDeclaration", @@ -81909,7 +84964,7 @@ Object { }, "range": Array [ 0, - 52, + 66, ], "sourceType": "script", "tokens": Array [ @@ -81934,7 +84989,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 15, "line": 1, }, "start": Object { @@ -81944,25 +84999,25 @@ Object { }, "range": Array [ 6, - 9, + 15, ], "type": "Identifier", - "value": "Foo", + "value": "StaticFoo", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 17, "line": 1, }, "start": Object { - "column": 10, + "column": 16, "line": 1, }, }, "range": Array [ - 10, - 11, + 16, + 17, ], "type": "Punctuator", "value": "{", @@ -81970,197 +85025,179 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 14, - 17, + 22, + 28, ], - "type": "Identifier", - "value": "bar", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 14, "line": 2, }, "start": Object { - "column": 5, + "column": 11, "line": 2, }, }, "range": Array [ - 17, - 18, + 29, + 32, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 2, }, "start": Object { - "column": 6, + "column": 14, "line": 2, }, }, "range": Array [ - 18, - 19, + 32, + 33, ], "type": "Punctuator", - "value": "@", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 2, }, "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 19, - 26, - ], - "type": "Identifier", - "value": "special", - }, - Object { - "loc": Object { - "end": Object { "column": 15, "line": 2, }, - "start": Object { - "column": 14, - "line": 2, - }, }, "range": Array [ - 26, - 27, + 33, + 34, ], "type": "Punctuator", - "value": "(", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 23, "line": 2, }, "start": Object { - "column": 15, + "column": 16, "line": 2, }, }, "range": Array [ - 27, - 31, + 34, + 41, ], - "type": "Boolean", - "value": "true", + "type": "Identifier", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 2, }, "start": Object { - "column": 19, + "column": 23, "line": 2, }, }, "range": Array [ - 31, - 32, + 41, + 42, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 28, "line": 2, }, "start": Object { - "column": 21, + "column": 24, "line": 2, }, }, "range": Array [ - 33, - 34, + 42, + 46, ], - "type": "Punctuator", - "value": "[", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 29, "line": 2, }, "start": Object { - "column": 23, + "column": 28, "line": 2, }, }, "range": Array [ - 35, - 38, + 46, + 47, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 33, "line": 2, }, "start": Object { - "column": 27, + "column": 30, "line": 2, }, }, "range": Array [ - 39, - 40, + 48, + 51, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 34, "line": 2, }, "start": Object { - "column": 28, + "column": 33, "line": 2, }, }, "range": Array [ - 40, - 41, + 51, + 52, ], "type": "Punctuator", "value": ":", @@ -82168,35 +85205,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { - "column": 30, + "column": 35, "line": 2, }, }, "range": Array [ - 42, - 45, + 53, + 59, ], "type": "Identifier", - "value": "any", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 42, "line": 2, }, "start": Object { - "column": 33, + "column": 41, "line": 2, }, }, "range": Array [ - 45, - 46, + 59, + 60, ], "type": "Punctuator", "value": ")", @@ -82204,17 +85241,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 44, "line": 2, }, "start": Object { - "column": 35, + "column": 43, "line": 2, }, }, "range": Array [ - 47, - 48, + 61, + 62, ], "type": "Punctuator", "value": "{", @@ -82222,17 +85259,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 2, }, "start": Object { - "column": 36, + "column": 44, "line": 2, }, }, "range": Array [ - 48, - 49, + 62, + 63, ], "type": "Punctuator", "value": "}", @@ -82249,8 +85286,8 @@ Object { }, }, "range": Array [ - 50, - 51, + 64, + 65, ], "type": "Punctuator", "value": "}", @@ -82260,7 +85297,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -82271,7 +85308,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 2, }, "start": Object { @@ -82279,14 +85316,14 @@ Object { "line": 2, }, }, - "name": "constructor", + "name": "greet", "range": Array [ 20, - 31, + 25, ], "type": "Identifier", }, - "kind": "constructor", + "kind": "method", "loc": Object { "end": Object { "column": 5, @@ -82299,7 +85336,7 @@ Object { }, "range": Array [ 20, - 113, + 95, ], "static": false, "type": "MethodDefinition", @@ -82308,134 +85345,101 @@ Object { "body": Object { "body": Array [ Object { - "expression": Object { + "argument": Object { "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "object": Object { + "left": Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 3, }, "start": Object { - "column": 8, + "column": 15, "line": 3, }, }, "range": Array [ - 81, - 85, + 67, + 75, ], - "type": "ThisExpression", + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", }, - "property": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 82, + ], + "right": Object { "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 3, }, "start": Object { - "column": 13, + "column": 26, "line": 3, }, }, - "name": "title", + "name": "name", "range": Array [ - 86, - 91, + 78, + 82, ], "type": "Identifier", }, - "range": Array [ - 81, - 91, - ], - "type": "MemberExpression", + "type": "BinaryExpression", }, "loc": Object { "end": Object { - "column": 33, + "column": 36, "line": 3, }, "start": Object { - "column": 8, + "column": 15, "line": 3, }, }, - "operator": "=", + "operator": "+", "range": Array [ - 81, - 106, + 67, + 88, ], "right": Object { - "computed": false, "loc": Object { "end": Object { - "column": 33, + "column": 36, "line": 3, }, "start": Object { - "column": 21, + "column": 33, "line": 3, }, }, - "object": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "name": "config", - "range": Array [ - 94, - 100, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, - }, - }, - "name": "title", - "range": Array [ - 101, - 106, - ], - "type": "Identifier", - }, "range": Array [ - 94, - 106, + 85, + 88, ], - "type": "MemberExpression", + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", }, - "type": "AssignmentExpression", + "type": "BinaryExpression", }, "loc": Object { "end": Object { - "column": 34, + "column": 37, "line": 3, }, "start": Object { @@ -82444,10 +85448,10 @@ Object { }, }, "range": Array [ - 81, - 107, + 60, + 89, ], - "type": "ExpressionStatement", + "type": "ReturnStatement", }, ], "loc": Object { @@ -82456,13 +85460,13 @@ Object { "line": 4, }, "start": Object { - "column": 55, + "column": 34, "line": 2, }, }, "range": Array [ - 71, - 113, + 50, + 95, ], "type": "BlockStatement", }, @@ -82475,7 +85479,7 @@ Object { "line": 4, }, "start": Object { - "column": 15, + "column": 9, "line": 2, }, }, @@ -82484,150 +85488,95 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": "APP_CONFIG", - "range": Array [ - 40, - 50, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "name": "Inject", - "range": Array [ - 33, - 39, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 35, + "column": 19, "line": 2, }, "start": Object { - "column": 17, + "column": 11, "line": 2, }, }, + "name": "required", "range": Array [ - 33, - 51, + 27, + 35, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 35, + "column": 19, "line": 2, }, "start": Object { - "column": 16, + "column": 10, "line": 2, }, }, "range": Array [ - 32, - 51, + 26, + 35, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 53, + "column": 32, "line": 2, }, "start": Object { - "column": 36, + "column": 20, "line": 2, }, }, - "name": "config", + "name": "name", "range": Array [ - 52, - 69, + 36, + 48, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 53, + "column": 32, "line": 2, }, "start": Object { - "column": 42, + "column": 24, "line": 2, }, }, "range": Array [ - 58, - 69, + 40, + 48, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 53, + "column": 32, "line": 2, }, "start": Object { - "column": 44, + "column": 26, "line": 2, }, }, "range": Array [ - 60, - 69, + 42, + 48, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 2, - }, - "start": Object { - "column": 44, - "line": 2, - }, - }, - "name": "AppConfig", - "range": Array [ - 60, - 69, - ], - "type": "Identifier", - }, + "type": "TSStringKeyword", }, }, }, ], "range": Array [ - 31, - 113, + 25, + 95, ], "type": "FunctionExpression", }, @@ -82645,7 +85594,7 @@ Object { }, "range": Array [ 14, - 115, + 97, ], "type": "ClassBody", }, @@ -82660,7 +85609,7 @@ Object { "line": 1, }, }, - "name": "Service", + "name": "Greeter", "range": Array [ 6, 13, @@ -82679,7 +85628,7 @@ Object { }, "range": Array [ 0, - 115, + 97, ], "superClass": null, "type": "ClassDeclaration", @@ -82697,7 +85646,7 @@ Object { }, "range": Array [ 0, - 116, + 98, ], "sourceType": "script", "tokens": Array [ @@ -82735,7 +85684,7 @@ Object { 13, ], "type": "Identifier", - "value": "Service", + "value": "Greeter", }, Object { "loc": Object { @@ -82758,7 +85707,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 2, }, "start": Object { @@ -82768,25 +85717,25 @@ Object { }, "range": Array [ 20, - 31, + 25, ], "type": "Identifier", - "value": "constructor", + "value": "greet", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 2, }, "start": Object { - "column": 15, + "column": 9, "line": 2, }, }, "range": Array [ - 31, - 32, + 25, + 26, ], "type": "Punctuator", "value": "(", @@ -82794,17 +85743,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 2, }, "start": Object { - "column": 16, + "column": 10, "line": 2, }, }, "range": Array [ - 32, - 33, + 26, + 27, ], "type": "Punctuator", "value": "@", @@ -82812,20 +85761,20 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 19, "line": 2, }, "start": Object { - "column": 17, + "column": 11, "line": 2, }, }, "range": Array [ - 33, - 39, + 27, + 35, ], "type": "Identifier", - "value": "Inject", + "value": "required", }, Object { "loc": Object { @@ -82834,21 +85783,21 @@ Object { "line": 2, }, "start": Object { - "column": 23, + "column": 20, "line": 2, }, }, "range": Array [ - 39, + 36, 40, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 25, "line": 2, }, "start": Object { @@ -82858,61 +85807,7 @@ Object { }, "range": Array [ 40, - 50, - ], - "type": "Identifier", - "value": "APP_CONFIG", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 2, - }, - "start": Object { - "column": 36, - "line": 2, - }, - }, - "range": Array [ - 52, - 58, - ], - "type": "Identifier", - "value": "config", - }, - Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 2, - }, - "start": Object { - "column": 42, - "line": 2, - }, - }, - "range": Array [ - 58, - 59, + 41, ], "type": "Punctuator", "value": ":", @@ -82920,35 +85815,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 53, + "column": 32, "line": 2, }, "start": Object { - "column": 44, + "column": 26, "line": 2, }, }, "range": Array [ - 60, - 69, + 42, + 48, ], "type": "Identifier", - "value": "AppConfig", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 54, + "column": 33, "line": 2, }, "start": Object { - "column": 53, + "column": 32, "line": 2, }, }, "range": Array [ - 69, - 70, + 48, + 49, ], "type": "Punctuator", "value": ")", @@ -82956,17 +85851,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 56, + "column": 35, "line": 2, }, "start": Object { - "column": 55, + "column": 34, "line": 2, }, }, "range": Array [ - 71, - 72, + 50, + 51, ], "type": "Punctuator", "value": "{", @@ -82974,7 +85869,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 3, }, "start": Object { @@ -82983,134 +85878,116 @@ Object { }, }, "range": Array [ - 81, - 85, + 60, + 66, ], "type": "Keyword", - "value": "this", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 85, - 86, - ], - "type": "Punctuator", - "value": ".", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 3, }, "start": Object { - "column": 13, + "column": 15, "line": 3, }, }, "range": Array [ - 86, - 91, + 67, + 75, ], - "type": "Identifier", - "value": "title", + "type": "String", + "value": "\\"Hello \\"", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 3, }, "start": Object { - "column": 19, + "column": 24, "line": 3, }, }, "range": Array [ - 92, - 93, + 76, + 77, ], "type": "Punctuator", - "value": "=", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 30, "line": 3, }, "start": Object { - "column": 21, + "column": 26, "line": 3, }, }, "range": Array [ - 94, - 100, + 78, + 82, ], "type": "Identifier", - "value": "config", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 32, "line": 3, }, "start": Object { - "column": 27, + "column": 31, "line": 3, }, }, "range": Array [ - 100, - 101, + 83, + 84, ], "type": "Punctuator", - "value": ".", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 36, "line": 3, }, "start": Object { - "column": 28, + "column": 33, "line": 3, }, }, "range": Array [ - 101, - 106, + 85, + 88, ], - "type": "Identifier", - "value": "title", + "type": "String", + "value": "\\"!\\"", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 37, "line": 3, }, "start": Object { - "column": 33, + "column": 36, "line": 3, }, }, "range": Array [ - 106, - 107, + 88, + 89, ], "type": "Punctuator", "value": ";", @@ -83127,8 +86004,8 @@ Object { }, }, "range": Array [ - 112, - 113, + 94, + 95, ], "type": "Punctuator", "value": "}", @@ -83145,8 +86022,8 @@ Object { }, }, "range": Array [ - 114, - 115, + 96, + 97, ], "type": "Punctuator", "value": "}", @@ -83156,7 +86033,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -83167,26 +86044,26 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 7, + "column": 16, "line": 2, }, "start": Object { - "column": 4, + "column": 11, "line": 2, }, }, - "name": "bar", + "name": "greet", "range": Array [ - 16, - 19, + 33, + 38, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { "column": 4, @@ -83194,28 +86071,138 @@ Object { }, }, "range": Array [ - 16, - 50, + 26, + 108, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 95, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 101, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 102, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 36, + "column": 41, "line": 2, }, }, "range": Array [ - 48, - 50, + 63, + 108, ], "type": "BlockStatement", }, @@ -83224,11 +86211,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 7, + "column": 16, "line": 2, }, }, @@ -83237,133 +86224,95 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 29, - 33, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 21, - 28, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 2, }, "start": Object { - "column": 9, + "column": 18, "line": 2, }, }, + "name": "required", "range": Array [ - 21, - 34, + 40, + 48, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 2, }, "start": Object { - "column": 8, + "column": 17, "line": 2, }, }, "range": Array [ - 20, - 34, + 39, + 48, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 34, + "column": 39, "line": 2, }, "start": Object { - "column": 23, + "column": 27, "line": 2, }, }, - "name": "baz", + "name": "name", "range": Array [ - 35, - 46, + 49, + 61, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, + "column": 39, "line": 2, }, "start": Object { - "column": 26, + "column": 31, "line": 2, }, }, "range": Array [ - 38, - 46, + 53, + 61, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, + "column": 39, "line": 2, }, "start": Object { - "column": 28, + "column": 33, "line": 2, }, }, "range": Array [ - 40, - 46, + 55, + 61, ], - "type": "TSNumberKeyword", + "type": "TSStringKeyword", }, }, }, ], "range": Array [ - 19, - 50, + 38, + 108, ], "type": "FunctionExpression", }, @@ -83372,23 +86321,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { - "column": 10, + "column": 20, "line": 1, }, }, "range": Array [ - 10, - 52, + 20, + 110, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 19, "line": 1, }, "start": Object { @@ -83396,17 +86345,17 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "StaticGreeter", "range": Array [ 6, - 9, + 19, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -83415,7 +86364,7 @@ Object { }, "range": Array [ 0, - 52, + 110, ], "superClass": null, "type": "ClassDeclaration", @@ -83424,7 +86373,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -83433,7 +86382,7 @@ Object { }, "range": Array [ 0, - 53, + 111, ], "sourceType": "script", "tokens": Array [ @@ -83458,7 +86407,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 19, "line": 1, }, "start": Object { @@ -83468,25 +86417,25 @@ Object { }, "range": Array [ 6, - 9, + 19, ], "type": "Identifier", - "value": "Foo", + "value": "StaticGreeter", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 21, "line": 1, }, "start": Object { - "column": 10, + "column": 20, "line": 1, }, }, "range": Array [ - 10, - 11, + 20, + 21, ], "type": "Punctuator", "value": "{", @@ -83494,7 +86443,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 2, }, "start": Object { @@ -83503,26 +86452,44 @@ Object { }, }, "range": Array [ - 16, - 19, + 26, + 32, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 33, + 38, ], "type": "Identifier", - "value": "bar", + "value": "greet", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 2, }, "start": Object { - "column": 7, + "column": 16, "line": 2, }, }, "range": Array [ - 19, - 20, + 38, + 39, ], "type": "Punctuator", "value": "(", @@ -83530,17 +86497,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 18, "line": 2, }, "start": Object { - "column": 8, + "column": 17, "line": 2, }, }, "range": Array [ - 20, - 21, + 39, + 40, ], "type": "Punctuator", "value": "@", @@ -83548,71 +86515,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 2, }, "start": Object { - "column": 9, + "column": 18, "line": 2, }, }, "range": Array [ - 21, - 28, + 40, + 48, ], "type": "Identifier", - "value": "special", + "value": "required", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 31, "line": 2, }, "start": Object { - "column": 16, + "column": 27, "line": 2, }, }, "range": Array [ - 28, - 29, + 49, + 53, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 39, "line": 2, }, "start": Object { - "column": 17, + "column": 33, "line": 2, }, }, "range": Array [ - 29, - 33, + 55, + 61, ], - "type": "Boolean", - "value": "true", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 40, "line": 2, }, "start": Object { - "column": 21, + "column": 39, "line": 2, }, }, "range": Array [ - 33, - 34, + 61, + 62, ], "type": "Punctuator", "value": ")", @@ -83620,107 +86605,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 42, "line": 2, }, "start": Object { - "column": 23, + "column": 41, "line": 2, }, }, "range": Array [ - 35, - 38, + 63, + 64, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 26, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 38, - 39, + 73, + 79, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "String", + "value": "\\"Hello \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, ], "type": "Punctuator", - "value": ":", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 30, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 26, + "line": 3, }, }, "range": Array [ - 40, - 46, + 91, + 95, ], "type": "Identifier", - "value": "number", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 2, + "column": 32, + "line": 3, }, "start": Object { - "column": 34, - "line": 2, + "column": 31, + "line": 3, }, }, "range": Array [ - 46, - 47, + 96, + 97, ], "type": "Punctuator", - "value": ")", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "type": "String", + "value": "\\"!\\"", }, Object { "loc": Object { "end": Object { "column": 37, - "line": 2, + "line": 3, }, "start": Object { "column": 36, - "line": 2, + "line": 3, }, }, "range": Array [ - 48, - 49, + 101, + 102, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 37, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 49, - 50, + 107, + 108, ], "type": "Punctuator", "value": "}", @@ -83729,16 +86768,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 51, - 52, + 109, + 110, ], "type": "Punctuator", "value": "}", @@ -83748,7 +86787,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-object-pattern-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -83759,37 +86798,37 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 14, + "column": 5, "line": 2, }, "start": Object { - "column": 11, + "column": 2, "line": 2, }, }, "name": "bar", "range": Array [ - 29, - 32, + 14, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 45, + "column": 37, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 22, - 63, + 14, + 49, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, @@ -83797,17 +86836,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 45, + "column": 37, "line": 2, }, "start": Object { - "column": 43, + "column": 35, "line": 2, }, }, "range": Array [ - 61, - 63, + 47, + 49, ], "type": "BlockStatement", }, @@ -83816,11 +86855,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 45, + "column": 37, "line": 2, }, "start": Object { - "column": 14, + "column": 5, "line": 2, }, }, @@ -83833,17 +86872,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 19, "line": 2, }, "start": Object { - "column": 24, + "column": 15, "line": 2, }, }, "range": Array [ - 42, - 46, + 27, + 31, ], "raw": "true", "type": "Literal", @@ -83853,109 +86892,167 @@ Object { "callee": Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 2, }, "start": Object { - "column": 16, + "column": 7, "line": 2, }, }, "name": "special", "range": Array [ - 34, - 41, + 19, + 26, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 29, + "column": 20, "line": 2, }, "start": Object { - "column": 16, + "column": 7, "line": 2, }, }, "range": Array [ - 34, - 47, + 19, + 32, ], "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 29, + "column": 20, "line": 2, }, "start": Object { - "column": 15, + "column": 6, "line": 2, }, }, "range": Array [ - 33, - 47, + 18, + 32, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 41, + "column": 33, "line": 2, }, "start": Object { - "column": 30, + "column": 21, "line": 2, }, }, - "name": "baz", + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 35, + 38, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + }, + ], "range": Array [ - 48, - 59, + 33, + 45, ], - "type": "Identifier", + "type": "ObjectPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 33, "line": 2, }, "start": Object { - "column": 33, + "column": 28, "line": 2, }, }, "range": Array [ - 51, - 59, + 40, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 33, "line": 2, }, "start": Object { - "column": 35, + "column": 30, "line": 2, }, }, "range": Array [ - 53, - 59, + 42, + 45, ], - "type": "TSNumberKeyword", + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 32, - 63, + 17, + 49, ], "type": "FunctionExpression", }, @@ -83967,20 +87064,20 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 65, + 10, + 51, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { @@ -83988,10 +87085,10 @@ Object { "line": 1, }, }, - "name": "StaticFoo", + "name": "Foo", "range": Array [ 6, - 15, + 9, ], "type": "Identifier", }, @@ -84007,7 +87104,7 @@ Object { }, "range": Array [ 0, - 65, + 51, ], "superClass": null, "type": "ClassDeclaration", @@ -84025,7 +87122,7 @@ Object { }, "range": Array [ 0, - 66, + 52, ], "sourceType": "script", "tokens": Array [ @@ -84050,7 +87147,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { @@ -84060,25 +87157,25 @@ Object { }, "range": Array [ 6, - 15, + 9, ], "type": "Identifier", - "value": "StaticFoo", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -84086,35 +87183,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, + "column": 5, "line": 2, }, "start": Object { - "column": 11, + "column": 2, "line": 2, }, }, "range": Array [ - 29, - 32, + 14, + 17, ], "type": "Identifier", "value": "bar", @@ -84122,17 +87201,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 6, "line": 2, }, "start": Object { - "column": 14, + "column": 5, "line": 2, }, }, "range": Array [ - 32, - 33, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -84140,17 +87219,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 7, "line": 2, }, "start": Object { - "column": 15, + "column": 6, "line": 2, }, }, "range": Array [ - 33, - 34, + 18, + 19, ], "type": "Punctuator", "value": "@", @@ -84158,17 +87237,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 2, }, "start": Object { - "column": 16, + "column": 7, "line": 2, }, }, "range": Array [ - 34, - 41, + 19, + 26, ], "type": "Identifier", "value": "special", @@ -84176,17 +87255,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 15, "line": 2, }, "start": Object { - "column": 23, + "column": 14, "line": 2, }, }, "range": Array [ - 41, - 42, + 26, + 27, ], "type": "Punctuator", "value": "(", @@ -84194,17 +87273,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 19, "line": 2, }, "start": Object { - "column": 24, + "column": 15, "line": 2, }, }, "range": Array [ - 42, - 46, + 27, + 31, ], "type": "Boolean", "value": "true", @@ -84212,17 +87291,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 20, "line": 2, }, "start": Object { - "column": 28, + "column": 19, "line": 2, }, }, "range": Array [ - 46, - 47, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -84230,295 +87309,221 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 2, }, "start": Object { - "column": 30, + "column": 21, "line": 2, }, }, "range": Array [ - 48, - 51, + 33, + 34, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 26, "line": 2, }, "start": Object { - "column": 33, + "column": 23, "line": 2, }, }, "range": Array [ - 51, - 52, + 35, + 38, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 28, "line": 2, }, "start": Object { - "column": 35, + "column": 27, "line": 2, }, }, "range": Array [ - 53, - 59, + 39, + 40, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 29, "line": 2, }, "start": Object { - "column": 41, + "column": 28, "line": 2, }, }, "range": Array [ - 59, - 60, + 40, + 41, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 33, "line": 2, }, "start": Object { - "column": 43, + "column": 30, "line": 2, }, }, "range": Array [ - 61, - 62, + 42, + 45, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 34, "line": 2, }, "start": Object { - "column": 44, + "column": 33, "line": 2, }, }, "range": Array [ - 62, - 63, + 45, + 46, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 36, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 64, - 65, + 47, + 48, ], "type": "Punctuator", - "value": "}", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "greet", - "range": Array [ - 20, - 25, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 20, - 95, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 67, - 75, - ], - "raw": "\\"Hello \\"", - "type": "Literal", - "value": "Hello ", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 67, - 82, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 78, - 82, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 67, - 88, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 85, - 88, - ], - "raw": "\\"!\\"", - "type": "Literal", - "value": "!", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 60, - 89, - ], - "type": "ReturnStatement", - }, - ], + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 48, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { "column": 34, @@ -84526,8 +87531,8 @@ Object { }, }, "range": Array [ - 50, - 95, + 46, + 48, ], "type": "BlockStatement", }, @@ -84536,49 +87541,105 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 9, + "column": 5, "line": 2, }, }, "params": Array [ Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + }, "decorators": Array [ Object { "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 2, }, "start": Object { - "column": 11, + "column": 7, "line": 2, }, }, - "name": "required", "range": Array [ - 27, - 35, + 19, + 32, ], - "type": "Identifier", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 2, }, "start": Object { - "column": 10, + "column": 6, "line": 2, }, }, "range": Array [ - 26, - 35, + 18, + 32, ], "type": "Decorator", }, @@ -84589,16 +87650,15 @@ Object { "line": 2, }, "start": Object { - "column": 20, + "column": 6, "line": 2, }, }, - "name": "name", "range": Array [ - 36, - 48, + 18, + 44, ], - "type": "Identifier", + "type": "RestElement", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -84606,13 +87666,13 @@ Object { "line": 2, }, "start": Object { - "column": 24, + "column": 27, "line": 2, }, }, "range": Array [ - 40, - 48, + 39, + 44, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { @@ -84622,22 +87682,22 @@ Object { "line": 2, }, "start": Object { - "column": 26, + "column": 29, "line": 2, }, }, "range": Array [ - 42, - 48, + 41, + 44, ], - "type": "TSStringKeyword", + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 25, - 95, + 17, + 48, ], "type": "FunctionExpression", }, @@ -84646,23 +87706,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 97, + 10, + 50, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -84670,17 +87730,17 @@ Object { "line": 1, }, }, - "name": "Greeter", + "name": "Foo", "range": Array [ 6, - 13, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -84689,7 +87749,7 @@ Object { }, "range": Array [ 0, - 97, + 50, ], "superClass": null, "type": "ClassDeclaration", @@ -84698,7 +87758,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -84707,7 +87767,7 @@ Object { }, "range": Array [ 0, - 98, + 51, ], "sourceType": "script", "tokens": Array [ @@ -84732,7 +87792,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -84742,25 +87802,25 @@ Object { }, "range": Array [ 6, - 13, + 9, ], "type": "Identifier", - "value": "Greeter", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -84768,35 +87828,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 25, + 14, + 17, ], "type": "Identifier", - "value": "greet", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 6, "line": 2, }, "start": Object { - "column": 9, + "column": 5, "line": 2, }, }, "range": Array [ - 25, - 26, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -84804,17 +87864,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 2, }, "start": Object { - "column": 10, + "column": 6, "line": 2, }, }, "range": Array [ - 26, - 27, + 18, + 19, ], "type": "Punctuator", "value": "@", @@ -84822,89 +87882,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 27, - 35, - ], - "type": "Identifier", - "value": "required", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, + "column": 14, "line": 2, }, "start": Object { - "column": 20, + "column": 7, "line": 2, }, }, "range": Array [ - 36, - 40, + 19, + 26, ], "type": "Identifier", - "value": "name", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 2, }, "start": Object { - "column": 24, + "column": 14, "line": 2, }, }, "range": Array [ - 40, - 41, + 26, + 27, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 19, "line": 2, }, "start": Object { - "column": 26, + "column": 15, "line": 2, }, }, "range": Array [ - 42, - 48, + 27, + 31, ], - "type": "Identifier", - "value": "string", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 20, "line": 2, }, "start": Object { - "column": 32, + "column": 19, "line": 2, }, }, "range": Array [ - 48, - 49, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -84912,161 +87954,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 24, "line": 2, }, "start": Object { - "column": 34, + "column": 21, "line": 2, }, }, "range": Array [ - 50, - 51, + 33, + 36, ], "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 60, - 66, - ], - "type": "Keyword", - "value": "return", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 27, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 24, + "line": 2, }, }, "range": Array [ - 67, - 75, + 36, + 39, ], - "type": "String", - "value": "\\"Hello \\"", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 28, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, + "column": 27, + "line": 2, }, }, "range": Array [ - 76, - 77, + 39, + 40, ], "type": "Punctuator", - "value": "+", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 32, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 29, + "line": 2, }, }, "range": Array [ - 78, - 82, + 41, + 44, ], "type": "Identifier", - "value": "name", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 31, - "line": 3, + "column": 32, + "line": 2, }, }, "range": Array [ - 83, - 84, + 44, + 45, ], "type": "Punctuator", - "value": "+", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 85, - 88, - ], - "type": "String", - "value": "\\"!\\"", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 35, + "line": 2, }, "start": Object { - "column": 36, - "line": 3, + "column": 34, + "line": 2, }, }, "range": Array [ - 88, - 89, + 46, + 47, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 4, - "line": 4, + "column": 35, + "line": 2, }, }, "range": Array [ - 94, - 95, + 47, + 48, ], "type": "Punctuator", "value": "}", @@ -85075,16 +88081,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 96, - 97, + 49, + 50, ], "type": "Punctuator", "value": "}", @@ -85094,7 +88100,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -85102,29 +88108,83 @@ Object { "body": Array [ Object { "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Input", + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "Decorator", + }, + ], "key": Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 2, }, "start": Object { - "column": 11, + "column": 13, "line": 2, }, }, - "name": "greet", + "name": "data", "range": Array [ - 33, - 38, + 35, + 39, ], "type": "Identifier", }, - "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 18, + "line": 2, }, "start": Object { "column": 4, @@ -85133,249 +88193,138 @@ Object { }, "range": Array [ 26, - 108, + 40, ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 80, - 88, - ], - "raw": "\\"Hello \\"", - "type": "Literal", - "value": "Hello ", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 80, - 95, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 91, - 95, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 80, - 101, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 98, - 101, - ], - "raw": "\\"!\\"", - "type": "Literal", - "value": "!", - }, - "type": "BinaryExpression", - }, + "static": false, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { "loc": Object { "end": Object { - "column": 37, + "column": 11, "line": 3, }, "start": Object { - "column": 8, + "column": 5, "line": 3, }, }, + "name": "Output", "range": Array [ - 73, - 102, + 46, + 52, ], - "type": "ReturnStatement", + "type": "Identifier", }, - ], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 54, + ], + "type": "CallExpression", + }, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 13, + "line": 3, }, "start": Object { - "column": 41, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 63, - 108, + 45, + 54, ], - "type": "BlockStatement", + "type": "Decorator", }, - "expression": false, - "generator": false, - "id": null, + ], + "key": Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 4, }, "start": Object { - "column": 16, - "line": 2, + "column": 4, + "line": 4, }, }, - "params": Array [ - Object { - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "required", - "range": Array [ - 40, - 48, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 39, - 48, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, + "name": "click", + "range": Array [ + 59, + 64, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 86, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, }, - "name": "name", - "range": Array [ - 49, - 61, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 31, - "line": 2, - }, - }, - "range": Array [ - 53, - 61, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 33, - "line": 2, - }, - }, - "range": Array [ - 55, - 61, - ], - "type": "TSStringKeyword", - }, + "start": Object { + "column": 16, + "line": 4, }, }, - ], + "name": "EventEmitter", + "range": Array [ + 71, + 83, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, "range": Array [ - 38, - 108, + 67, + 85, ], - "type": "FunctionExpression", + "type": "NewExpression", }, }, ], @@ -85391,7 +88340,7 @@ Object { }, "range": Array [ 20, - 110, + 88, ], "type": "ClassBody", }, @@ -85406,7 +88355,7 @@ Object { "line": 1, }, }, - "name": "StaticGreeter", + "name": "SomeComponent", "range": Array [ 6, 19, @@ -85425,7 +88374,7 @@ Object { }, "range": Array [ 0, - 110, + 88, ], "superClass": null, "type": "ClassDeclaration", @@ -85433,8 +88382,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 6, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -85443,7 +88392,7 @@ Object { }, "range": Array [ 0, - 111, + 88, ], "sourceType": "script", "tokens": Array [ @@ -85481,7 +88430,7 @@ Object { 19, ], "type": "Identifier", - "value": "StaticGreeter", + "value": "SomeComponent", }, Object { "loc": Object { @@ -85504,7 +88453,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 5, "line": 2, }, "start": Object { @@ -85514,43 +88463,43 @@ Object { }, "range": Array [ 26, - 32, + 27, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 2, }, "start": Object { - "column": 11, + "column": 5, "line": 2, }, }, "range": Array [ - 33, - 38, + 27, + 32, ], "type": "Identifier", - "value": "greet", + "value": "Input", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 2, }, "start": Object { - "column": 16, + "column": 10, "line": 2, }, }, "range": Array [ - 38, - 39, + 32, + 33, ], "type": "Punctuator", "value": "(", @@ -85558,272 +88507,254 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 12, "line": 2, }, "start": Object { - "column": 17, + "column": 11, "line": 2, }, }, "range": Array [ - 39, - 40, + 33, + 34, ], "type": "Punctuator", - "value": "@", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 17, "line": 2, }, "start": Object { - "column": 18, + "column": 13, "line": 2, }, }, "range": Array [ - 40, - 48, + 35, + 39, ], "type": "Identifier", - "value": "required", + "value": "data", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 18, "line": 2, }, "start": Object { - "column": 27, + "column": 17, "line": 2, }, }, "range": Array [ - 49, - 53, + 39, + 40, ], - "type": "Identifier", - "value": "name", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 31, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 53, - 54, + 45, + 46, ], "type": "Punctuator", - "value": ":", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 33, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 55, - 61, + 46, + 52, ], "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 2, - }, - "start": Object { - "column": 39, - "line": 2, - }, - }, - "range": Array [ - 61, - 62, - ], - "type": "Punctuator", - "value": ")", + "value": "Output", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 2, + "column": 12, + "line": 3, }, "start": Object { - "column": 41, - "line": 2, + "column": 11, + "line": 3, }, }, "range": Array [ - 63, - 64, + 52, + 53, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 3, }, "start": Object { - "column": 8, + "column": 12, "line": 3, }, }, "range": Array [ - 73, - 79, + 53, + 54, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 9, + "line": 4, }, "start": Object { - "column": 15, - "line": 3, + "column": 4, + "line": 4, }, }, "range": Array [ - 80, - 88, + 59, + 64, ], - "type": "String", - "value": "\\"Hello \\"", + "type": "Identifier", + "value": "click", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 11, + "line": 4, }, "start": Object { - "column": 24, - "line": 3, + "column": 10, + "line": 4, }, }, "range": Array [ - 89, - 90, + 65, + 66, ], "type": "Punctuator", - "value": "+", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 15, + "line": 4, }, "start": Object { - "column": 26, - "line": 3, + "column": 12, + "line": 4, }, }, "range": Array [ - 91, - 95, + 67, + 70, ], - "type": "Identifier", - "value": "name", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 28, + "line": 4, }, "start": Object { - "column": 31, - "line": 3, + "column": 16, + "line": 4, }, }, "range": Array [ - 96, - 97, + 71, + 83, ], - "type": "Punctuator", - "value": "+", + "type": "Identifier", + "value": "EventEmitter", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 3, + "column": 29, + "line": 4, }, "start": Object { - "column": 33, - "line": 3, + "column": 28, + "line": 4, }, }, "range": Array [ - 98, - 101, + 83, + 84, ], - "type": "String", - "value": "\\"!\\"", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 30, + "line": 4, }, "start": Object { - "column": 36, - "line": 3, + "column": 29, + "line": 4, }, }, "range": Array [ - 101, - 102, + 84, + 85, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 31, "line": 4, }, "start": Object { - "column": 4, + "column": 30, "line": 4, }, }, "range": Array [ - 107, - 108, + 85, + 86, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { @@ -85837,8 +88768,8 @@ Object { }, }, "range": Array [ - 109, - 110, + 87, + 88, ], "type": "Punctuator", "value": "}", @@ -85848,7 +88779,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-object-pattern-decorator.src 1`] = ` +exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -85856,289 +88787,251 @@ Object { "body": Array [ Object { "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 32, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "configurable", + "range": Array [ + 15, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 33, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 33, + ], + "type": "Decorator", + }, + ], "key": Object { "loc": Object { "end": Object { - "column": 5, + "column": 36, "line": 2, }, "start": Object { - "column": 2, + "column": 31, "line": 2, }, }, - "name": "bar", + "name": "prop1", "range": Array [ - 14, - 17, + 41, + 46, ], "type": "Identifier", }, - "kind": "method", "loc": Object { "end": Object { "column": 37, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ 14, - 49, + 47, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 35, - "line": 2, - }, - }, - "range": Array [ - 47, - 49, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "params": Array [ - Object { - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 27, - 31, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 19, - 26, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 19, - 32, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 18, - 32, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "properties": Array [ + "static": true, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 35, - 38, - ], - "type": "Identifier", - }, - "kind": "init", "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 23, + "line": 4, }, "start": Object { - "column": 23, - "line": 2, + "column": 18, + "line": 4, }, }, - "method": false, "range": Array [ - 35, - 38, + 67, + 72, ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 35, - 38, - ], - "type": "Identifier", - }, + "raw": "false", + "type": "Literal", + "value": false, }, ], - "range": Array [ - 33, - 45, - ], - "type": "ObjectPattern", - "typeAnnotation": Object { + "callee": Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 17, + "line": 4, }, "start": Object { - "column": 28, - "line": 2, + "column": 5, + "line": 4, }, }, + "name": "configurable", "range": Array [ - 40, - 45, + 54, + 66, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 42, - 45, - ], - "type": "TSAnyKeyword", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, }, }, + "range": Array [ + 54, + 73, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, - ], + "range": Array [ + 53, + 73, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "name": "prop2", "range": Array [ - 17, - 49, + 85, + 90, ], - "type": "FunctionExpression", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, + "range": Array [ + 53, + 91, + ], + "static": true, + "type": "ClassProperty", + "value": null, }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 51, + 8, + 93, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { @@ -86146,17 +89039,17 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "A", "range": Array [ 6, - 9, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { "column": 0, @@ -86165,7 +89058,7 @@ Object { }, "range": Array [ 0, - 51, + 93, ], "superClass": null, "type": "ClassDeclaration", @@ -86173,8 +89066,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 1, + "line": 6, }, "start": Object { "column": 0, @@ -86183,7 +89076,7 @@ Object { }, "range": Array [ 0, - 52, + 93, ], "sourceType": "script", "tokens": Array [ @@ -86208,7 +89101,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { @@ -86218,61 +89111,79 @@ Object { }, "range": Array [ 6, - 9, + 7, ], "type": "Identifier", - "value": "Foo", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 11, + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, ], "type": "Punctuator", - "value": "{", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 17, "line": 2, }, "start": Object { - "column": 2, + "column": 5, "line": 2, }, }, "range": Array [ - 14, - 17, + 15, + 27, ], "type": "Identifier", - "value": "bar", + "value": "configurable", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 18, "line": 2, }, "start": Object { - "column": 5, + "column": 17, "line": 2, }, }, "range": Array [ - 17, - 18, + 27, + 28, ], "type": "Punctuator", "value": "(", @@ -86280,251 +89191,251 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 22, "line": 2, }, "start": Object { - "column": 6, + "column": 18, "line": 2, }, }, "range": Array [ - 18, - 19, + 28, + 32, ], - "type": "Punctuator", - "value": "@", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 23, "line": 2, }, "start": Object { - "column": 7, + "column": 22, "line": 2, }, }, "range": Array [ - 19, - 26, + 32, + 33, ], - "type": "Identifier", - "value": "special", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 30, "line": 2, }, "start": Object { - "column": 14, + "column": 24, "line": 2, }, }, "range": Array [ - 26, - 27, + 34, + 40, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 36, "line": 2, }, "start": Object { - "column": 15, + "column": 31, "line": 2, }, }, "range": Array [ - 27, - 31, + 41, + 46, ], - "type": "Boolean", - "value": "true", + "type": "Identifier", + "value": "prop1", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 37, "line": 2, }, "start": Object { - "column": 19, + "column": 36, "line": 2, }, }, "range": Array [ - 31, - 32, + 46, + 47, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 21, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 33, - 34, + 53, + 54, ], "type": "Punctuator", - "value": "{", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 17, + "line": 4, }, "start": Object { - "column": 23, - "line": 2, + "column": 5, + "line": 4, }, }, "range": Array [ - 35, - 38, + 54, + 66, ], "type": "Identifier", - "value": "bar", + "value": "configurable", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 18, + "line": 4, }, "start": Object { - "column": 27, - "line": 2, + "column": 17, + "line": 4, }, }, "range": Array [ - 39, - 40, + 66, + 67, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 23, + "line": 4, }, "start": Object { - "column": 28, - "line": 2, + "column": 18, + "line": 4, }, }, "range": Array [ - 40, - 41, + 67, + 72, ], - "type": "Punctuator", - "value": ":", + "type": "Boolean", + "value": "false", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 24, + "line": 4, }, "start": Object { - "column": 30, - "line": 2, + "column": 23, + "line": 4, }, }, "range": Array [ - 42, - 45, + 72, + 73, ], - "type": "Identifier", - "value": "any", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 10, + "line": 5, }, "start": Object { - "column": 33, - "line": 2, + "column": 4, + "line": 5, }, }, "range": Array [ - 45, - 46, + 78, + 84, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 16, + "line": 5, }, "start": Object { - "column": 35, - "line": 2, + "column": 11, + "line": 5, }, }, "range": Array [ - 47, - 48, + 85, + 90, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "prop2", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 17, + "line": 5, }, "start": Object { - "column": 36, - "line": 2, + "column": 16, + "line": 5, }, }, "range": Array [ - 48, - 49, + 90, + 91, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { "column": 0, - "line": 3, + "line": 6, }, }, "range": Array [ - 50, - 51, + 92, + 93, ], "type": "Punctuator", "value": "}", @@ -86534,7 +89445,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = ` +exports[`typescript fixtures/decorators/property-decorators/property-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -86542,248 +89453,175 @@ Object { "body": Array [ Object { "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], "key": Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 2, }, "start": Object { - "column": 2, + "column": 9, "line": 2, }, }, - "name": "bar", + "name": "x", "range": Array [ - 14, - 17, + 19, + 20, ], "type": "Identifier", }, - "kind": "method", "loc": Object { "end": Object { - "column": 36, + "column": 11, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ 14, - 48, + 21, ], "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 8, + "line": 3, }, "start": Object { - "column": 34, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 46, - 48, + 26, + 30, ], - "type": "BlockStatement", + "type": "Decorator", }, - "expression": false, - "generator": false, - "id": null, + ], + "key": Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 5, - "line": 2, + "column": 4, + "line": 4, }, }, - "params": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 36, - 39, - ], - "type": "Identifier", - }, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 27, - 31, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 19, - 26, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 19, - 32, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 18, - 32, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 18, - 44, - ], - "type": "RestElement", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "range": Array [ - 39, - 44, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 41, - 44, - ], - "type": "TSAnyKeyword", - }, - }, - }, - ], + "name": "y", "range": Array [ - 17, - 48, + 35, + 36, ], - "type": "FunctionExpression", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, }, + "range": Array [ + 26, + 37, + ], + "static": false, + "type": "ClassProperty", + "value": null, }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 50, + 8, + 39, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { @@ -86791,17 +89629,17 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "B", "range": Array [ 6, - 9, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -86810,7 +89648,7 @@ Object { }, "range": Array [ 0, - 50, + 39, ], "superClass": null, "type": "ClassDeclaration", @@ -86818,8 +89656,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -86828,7 +89666,7 @@ Object { }, "range": Array [ 0, - 51, + 39, ], "sourceType": "script", "tokens": Array [ @@ -86853,7 +89691,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { @@ -86863,25 +89701,25 @@ Object { }, "range": Array [ 6, - 9, + 7, ], "type": "Identifier", - "value": "Foo", + "value": "B", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 11, + 8, + 9, ], "type": "Punctuator", "value": "{", @@ -86893,265 +89731,157 @@ Object { "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ 14, - 17, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 17, - 18, + 15, ], "type": "Punctuator", - "value": "(", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 2, }, "start": Object { - "column": 6, + "column": 5, "line": 2, }, }, "range": Array [ + 15, 18, - 19, ], - "type": "Punctuator", - "value": "@", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 10, "line": 2, }, "start": Object { - "column": 7, + "column": 9, "line": 2, }, }, "range": Array [ 19, - 26, + 20, ], "type": "Identifier", - "value": "special", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 2, }, "start": Object { - "column": 14, + "column": 10, "line": 2, }, }, "range": Array [ - 26, - 27, + 20, + 21, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 15, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ + 26, 27, - 31, - ], - "type": "Boolean", - "value": "true", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 33, - 36, ], "type": "Punctuator", - "value": "...", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 8, + "line": 3, }, "start": Object { - "column": 24, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 36, - 39, + 27, + 30, ], "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": ":", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 29, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 41, - 44, + 35, + 36, ], "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 32, - "line": 2, - }, - }, - "range": Array [ - 44, - 45, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 46, - 47, - ], - "type": "Punctuator", - "value": "{", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 6, + "line": 4, }, "start": Object { - "column": 35, - "line": 2, + "column": 5, + "line": 4, }, }, "range": Array [ - 47, - 48, + 36, + 37, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 49, - 50, + 38, + 39, ], "type": "Punctuator", "value": "}", @@ -87161,7 +89891,7 @@ Object { } `; -exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/property-decorators/property-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -87172,28 +89902,9 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "Input", - "range": Array [ - 27, - 32, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 2, }, "start": Object { @@ -87201,15 +89912,16 @@ Object { "line": 2, }, }, + "name": "baz", "range": Array [ - 27, - 34, + 15, + 18, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 2, }, "start": Object { @@ -87218,8 +89930,8 @@ Object { }, }, "range": Array [ - 26, - 34, + 14, + 18, ], "type": "Decorator", }, @@ -87231,14 +89943,14 @@ Object { "line": 2, }, "start": Object { - "column": 13, + "column": 16, "line": 2, }, }, - "name": "data", + "name": "a", "range": Array [ - 35, - 39, + 26, + 27, ], "type": "Identifier", }, @@ -87253,10 +89965,10 @@ Object { }, }, "range": Array [ - 26, - 40, + 14, + 28, ], - "static": false, + "static": true, "type": "ClassProperty", "value": null, }, @@ -87265,28 +89977,9 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "Output", - "range": Array [ - 46, - 52, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 3, }, "start": Object { @@ -87294,15 +89987,16 @@ Object { "line": 3, }, }, + "name": "qux", "range": Array [ - 46, - 54, + 34, + 37, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 3, }, "start": Object { @@ -87311,8 +90005,8 @@ Object { }, }, "range": Array [ - 45, - 54, + 33, + 37, ], "type": "Decorator", }, @@ -87320,24 +90014,24 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 4, }, "start": Object { - "column": 4, + "column": 11, "line": 4, }, }, - "name": "click", + "name": "b", "range": Array [ - 59, - 64, + 49, + 50, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 31, + "column": 13, "line": 4, }, "start": Object { @@ -87346,69 +90040,365 @@ Object { }, }, "range": Array [ - 45, - 86, + 33, + 51, ], - "static": false, + "static": true, "type": "ClassProperty", - "value": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 4, - }, - "start": Object { - "column": 16, - "line": 4, - }, - }, - "name": "EventEmitter", - "range": Array [ - 71, - 83, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 67, - 85, - ], - "type": "NewExpression", - }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 53, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, + }, + "name": "C", + "range": Array [ + 6, + 7, ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-empty-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 20, + "column": 18, "line": 1, }, }, "range": Array [ - 20, - 88, + 18, + 22, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { @@ -87416,17 +90406,17 @@ Object { "line": 1, }, }, - "name": "SomeComponent", + "name": "Foo", "range": Array [ 6, - 19, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -87435,7 +90425,7 @@ Object { }, "range": Array [ 0, - 88, + 22, ], "superClass": null, "type": "ClassDeclaration", @@ -87443,8 +90433,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -87453,7 +90443,7 @@ Object { }, "range": Array [ 0, - 88, + 23, ], "sourceType": "script", "tokens": Array [ @@ -87478,7 +90468,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { @@ -87488,349 +90478,526 @@ Object { }, "range": Array [ 6, - 19, + 9, ], "type": "Identifier", - "value": "SomeComponent", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 1, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, "range": Array [ - 20, - 21, + 10, + 17, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 18, + "line": 1, }, }, "range": Array [ - 26, - 27, + 18, + 19, ], "type": "Punctuator", - "value": "@", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 5, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 27, - 32, + 21, + 22, ], - "type": "Identifier", - "value": "Input", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-empty-extends-implements.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "TSClassImplements", + }, + ], "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 10, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 32, - 33, + 0, + 37, ], - "type": "Punctuator", - "value": "(", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 33, - 34, + 0, + 5, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 35, - 39, + 6, + 9, ], "type": "Identifier", - "value": "data", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 39, - 40, + 10, + 17, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 28, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 18, + "line": 1, }, }, "range": Array [ - 45, - 46, + 18, + 28, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 32, + "line": 1, }, "start": Object { - "column": 5, - "line": 3, + "column": 29, + "line": 1, }, }, "range": Array [ - 46, - 52, + 29, + 32, ], "type": "Identifier", - "value": "Output", + "value": "Bar", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { - "column": 11, - "line": 3, + "column": 33, + "line": 1, }, }, "range": Array [ - 52, - 53, + 33, + 34, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 1, "line": 3, }, "start": Object { - "column": 12, + "column": 0, "line": 3, }, }, "range": Array [ - 53, - 54, + 36, + 37, ], "type": "Punctuator", - "value": ")", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-extends-empty-implements.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 1, + "line": 3, }, "start": Object { - "column": 4, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 59, - 64, + 0, + 37, ], - "type": "Identifier", - "value": "click", + "superClass": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 11, - "line": 4, + "column": 5, + "line": 1, }, "start": Object { - "column": 10, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 65, - 66, + 0, + 5, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 9, + "line": 1, }, "start": Object { - "column": 12, - "line": 4, + "column": 6, + "line": 1, }, }, "range": Array [ - 67, - 70, + 6, + 9, ], - "type": "Keyword", - "value": "new", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 10, + "line": 1, }, }, "range": Array [ - 71, - 83, + 10, + 17, ], - "type": "Identifier", - "value": "EventEmitter", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 4, + "column": 21, + "line": 1, }, "start": Object { - "column": 28, - "line": 4, + "column": 18, + "line": 1, }, }, "range": Array [ - 83, - 84, + 18, + 21, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Bar", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 4, + "column": 32, + "line": 1, }, "start": Object { - "column": 29, - "line": 4, + "column": 22, + "line": 1, }, }, "range": Array [ - 84, - 85, + 22, + 32, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 34, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, + "column": 33, + "line": 1, }, }, "range": Array [ - 85, - 86, + 33, + 34, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 87, - 88, + 36, + 37, ], "type": "Punctuator", "value": "}", @@ -87840,252 +91007,25 @@ Object { } `; -exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = ` +exports[`typescript fixtures/errorRecovery/class-multiple-implements.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 28, - 32, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "configurable", - "range": Array [ - 15, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 15, - 33, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 33, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 31, - "line": 2, - }, - }, - "name": "prop1", - "range": Array [ - 41, - 46, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 47, - ], - "static": true, - "type": "ClassProperty", - "value": null, - }, - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 67, - 72, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "name": "configurable", - "range": Array [ - 54, - 66, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "range": Array [ - 54, - 73, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 53, - 73, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 5, - }, - }, - "name": "prop2", - "range": Array [ - 85, - 90, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 53, - 91, - ], - "static": true, - "type": "ClassProperty", - "value": null, - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 36, + "line": 1, }, "start": Object { - "column": 8, + "column": 34, "line": 1, }, }, "range": Array [ - 8, - 93, + 34, + 36, ], "type": "ClassBody", }, @@ -88100,17 +91040,54 @@ Object { "line": 1, }, }, - "name": "A", + "name": "a", "range": Array [ 6, 7, ], "type": "Identifier", }, + "implements": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "TSClassImplements", + }, + ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 36, + "line": 1, }, "start": Object { "column": 0, @@ -88119,7 +91096,7 @@ Object { }, "range": Array [ 0, - 93, + 36, ], "superClass": null, "type": "ClassDeclaration", @@ -88127,8 +91104,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -88137,7 +91114,7 @@ Object { }, "range": Array [ 0, - 93, + 37, ], "sourceType": "script", "tokens": Array [ @@ -88162,341 +91139,331 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - "value": "A", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "@", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 15, - 27, - ], - "type": "Identifier", - "value": "configurable", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, + "column": 7, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 27, - 28, + 6, + 7, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 28, - 32, + 8, + 18, ], - "type": "Boolean", - "value": "true", + "type": "Keyword", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 22, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ - 32, - 33, + 19, + 20, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 2, + "column": 31, + "line": 1, }, "start": Object { - "column": 24, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 34, - 40, + 21, + 31, ], "type": "Keyword", - "value": "static", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 33, + "line": 1, }, "start": Object { - "column": 31, - "line": 2, + "column": 32, + "line": 1, }, }, "range": Array [ - 41, - 46, + 32, + 33, ], "type": "Identifier", - "value": "prop1", + "value": "c", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 35, + "line": 1, }, "start": Object { - "column": 36, - "line": 2, + "column": 34, + "line": 1, }, }, "range": Array [ - 46, - 47, + 34, + 35, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 35, + "line": 1, }, }, "range": Array [ - 53, - 54, + 35, + 36, ], "type": "Punctuator", - "value": "@", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/decorator-on-enum-declaration.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "dec", + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Decorator", }, - "start": Object { - "column": 5, - "line": 4, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, }, + "name": "E", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", }, - "range": Array [ - 54, - 66, - ], - "type": "Identifier", - "value": "configurable", - }, - Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 14, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 0, + "line": 1, }, }, + "members": Array [], "range": Array [ - 66, - 67, + 0, + 14, ], - "type": "Punctuator", - "value": "(", + "type": "TSEnumDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 1, + "line": 1, }, "start": Object { - "column": 18, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 67, - 72, + 0, + 1, ], - "type": "Boolean", - "value": "false", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 4, + "line": 1, }, "start": Object { - "column": 23, - "line": 4, + "column": 1, + "line": 1, }, }, "range": Array [ - 72, - 73, + 1, + 4, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "dec", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 9, + "line": 1, }, "start": Object { - "column": 4, - "line": 5, + "column": 5, + "line": 1, }, }, "range": Array [ - 78, - 84, + 5, + 9, ], "type": "Keyword", - "value": "static", + "value": "enum", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 11, + "line": 1, }, "start": Object { - "column": 11, - "line": 5, + "column": 10, + "line": 1, }, }, "range": Array [ - 85, - 90, + 10, + 11, ], "type": "Identifier", - "value": "prop2", + "value": "E", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 5, + "column": 13, + "line": 1, }, "start": Object { - "column": 16, - "line": 5, + "column": 12, + "line": 1, }, }, "range": Array [ - 90, - 91, + 12, + 13, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 14, + "line": 1, }, "start": Object { - "column": 0, - "line": 6, + "column": 13, + "line": 1, }, }, "range": Array [ - 92, - 93, + 13, + 14, ], "type": "Punctuator", "value": "}", @@ -88506,219 +91473,108 @@ Object { } `; -exports[`typescript fixtures/decorators/property-decorators/property-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/errorRecovery/decorator-on-function.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "decorators": Array [ + Object { + "expression": Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 4, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 1, + "line": 1, }, }, + "name": "dec", "range": Array [ - 14, - 21, + 1, + 4, ], - "static": false, - "type": "ClassProperty", - "value": null, + "type": "Identifier", }, - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 26, - 30, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "name": "y", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 6, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 26, - 37, - ], - "static": false, - "type": "ClassProperty", - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 1, }, + "range": Array [ + 0, + 4, + ], + "type": "Decorator", }, - "range": Array [ - 8, - 39, - ], - "type": "ClassBody", - }, + ], + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 9, + "line": 2, }, }, - "name": "B", - "range": Array [ - 6, - 7, + "name": "b", + "range": Array [ + 14, + 15, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 14, + "line": 2, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 39, + 19, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -88727,14 +91583,14 @@ Object { }, "range": Array [ 0, - 39, + 20, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -88744,55 +91600,55 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 4, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 7, + 1, + 4, ], "type": "Identifier", - "value": "B", + "value": "dec", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 0, + "line": 2, }, }, "range": Array [ - 8, - 9, + 5, + 13, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 2, }, "start": Object { - "column": 4, + "column": 9, "line": 2, }, }, @@ -88800,149 +91656,354 @@ Object { 14, 15, ], - "type": "Punctuator", - "value": "@", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 11, "line": 2, }, "start": Object { - "column": 5, + "column": 10, "line": 2, }, }, "range": Array [ 15, - 18, + 16, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, "range": Array [ - 19, - 20, + 16, + 17, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 2, }, "start": Object { - "column": 10, + "column": 12, "line": 2, }, }, "range": Array [ - 20, - 21, + 17, + 18, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 13, + "line": 2, }, }, "range": Array [ - 26, - 27, + 18, + 19, ], "type": "Punctuator", - "value": "@", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "TSInterfaceBody", + }, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "deco", + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 7, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "M", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 1, + "line": 1, }, "start": Object { - "column": 5, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 27, - 30, + 0, + 1, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { "column": 5, - "line": 4, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 1, + "line": 1, }, }, "range": Array [ - 35, - 36, + 1, + 5, ], "type": "Identifier", - "value": "y", + "value": "deco", }, Object { "loc": Object { "end": Object { "column": 6, - "line": 4, + "line": 1, }, "start": Object { "column": 5, - "line": 4, + "line": 1, }, }, "range": Array [ - 36, - 37, + 5, + 6, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, }, "start": Object { "column": 0, - "line": 5, + "line": 2, }, }, "range": Array [ - 38, - 39, + 8, + 17, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "M", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, ], "type": "Punctuator", "value": "}", @@ -88952,201 +92013,126 @@ Object { } `; -exports[`typescript fixtures/decorators/property-decorators/property-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/errorRecovery/decorator-on-variable.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "a", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 18, + "column": 7, "line": 2, }, "start": Object { - "column": 4, + "column": 6, "line": 2, }, }, + "name": "a", "range": Array [ 14, - 28, + 15, ], - "static": true, - "type": "ClassProperty", - "value": null, + "type": "Identifier", }, - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "qux", - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 33, - 37, - ], - "type": "Decorator", + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, }, + }, + "range": Array [ + 18, + 19, ], - "key": Object { + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "VariableDeclarator", + }, + ], + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 5, + "line": 1, }, "start": Object { - "column": 11, - "line": 4, + "column": 1, + "line": 1, }, }, - "name": "b", + "name": "deco", "range": Array [ - 49, - 50, + 1, + 5, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 1, + "line": 1, }, }, "range": Array [ - 33, - 51, + 1, + 7, ], - "static": true, - "type": "ClassProperty", - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 53, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, + "type": "CallExpression", }, - "start": Object { - "column": 6, - "line": 1, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", }, - "name": "C", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 11, + "line": 2, }, "start": Object { "column": 0, @@ -89155,16 +92141,15 @@ Object { }, "range": Array [ 0, - 53, + 19, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 3, }, "start": Object { "column": 0, @@ -89173,14 +92158,14 @@ Object { }, "range": Array [ 0, - 54, + 20, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -89190,115 +92175,97 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 7, + 1, + 5, ], "type": "Identifier", - "value": "C", + "value": "deco", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { - "column": 8, + "column": 5, "line": 1, }, }, "range": Array [ - 8, - 9, + 5, + 6, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 7, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 14, - 15, + 6, + 7, ], "type": "Punctuator", - "value": "@", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { "column": 5, "line": 2, }, - }, - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - "value": "baz", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, "start": Object { - "column": 9, + "column": 0, "line": 2, }, }, "range": Array [ - 19, - 25, + 8, + 13, ], "type": "Keyword", - "value": "static", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 7, "line": 2, }, "start": Object { - "column": 16, + "column": 6, "line": 2, }, }, "range": Array [ - 26, - 27, + 14, + 15, ], "type": "Identifier", "value": "a", @@ -89306,178 +92273,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 9, "line": 2, }, "start": Object { - "column": 17, + "column": 8, "line": 2, }, }, "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 33, - 34, + 16, + 17, ], "type": "Punctuator", - "value": "@", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - "value": "qux", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "Keyword", - "value": "static", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { "column": 11, - "line": 4, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + "line": 2, }, "start": Object { - "column": 0, - "line": 5, + "column": 10, + "line": 2, }, }, "range": Array [ - 52, - 53, + 18, + 19, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "1", }, ], "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/class-empty-extends.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-arguments.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 22, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 14, + 16, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, }, - "start": Object { - "column": 6, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { "column": 0, @@ -89486,16 +92436,15 @@ Object { }, "range": Array [ 0, - 22, + 16, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 16, + "line": 1, }, "start": Object { "column": 0, @@ -89504,7 +92453,7 @@ Object { }, "range": Array [ 0, - 23, + 16, ], "sourceType": "script", "tokens": Array [ @@ -89524,7 +92473,7 @@ Object { 5, ], "type": "Keyword", - "value": "class", + "value": "const", }, Object { "loc": Object { @@ -89542,148 +92491,147 @@ Object { 9, ], "type": "Identifier", - "value": "Foo", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ + 9, 10, - 17, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 14, "line": 1, }, "start": Object { - "column": 18, + "column": 11, "line": 1, }, }, "range": Array [ - 18, - 19, + 11, + 14, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, ], "type": "Punctuator", - "value": "{", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 15, + "line": 1, }, }, "range": Array [ - 21, - 22, + 15, + 16, ], "type": "Punctuator", - "value": "}", + "value": ">", }, ], - "type": "Program", -} -`; - -exports[`typescript fixtures/errorRecovery/class-empty-extends-implements.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 1, + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", }, - "range": Array [ - 33, - 37, - ], - "type": "ClassBody", - }, - "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { - "column": 6, + "column": 0, "line": 1, }, }, - "name": "Foo", "range": Array [ - 6, - 9, + 0, + 7, ], - "type": "Identifier", - }, - "implements": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 29, - 32, - ], - "type": "Identifier", - }, + "type": "CallExpression", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 32, + "column": 5, "line": 1, }, "start": Object { - "column": 29, + "column": 3, "line": 1, }, }, + "params": Array [], "range": Array [ - 29, - 32, + 3, + 5, ], - "type": "TSClassImplements", + "type": "TSTypeParameterInstantiation", }, - ], + }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { "column": 0, @@ -89692,16 +92640,15 @@ Object { }, "range": Array [ 0, - 37, + 8, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -89710,14 +92657,14 @@ Object { }, "range": Array [ 0, - 38, + 9, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -89727,169 +92674,168 @@ Object { }, "range": Array [ 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 9, + 3, ], "type": "Identifier", - "value": "Foo", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 4, "line": 1, }, "start": Object { - "column": 10, + "column": 3, "line": 1, }, }, "range": Array [ - 10, - 17, + 3, + 4, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 5, "line": 1, }, "start": Object { - "column": 18, + "column": 4, "line": 1, }, }, "range": Array [ - 18, - 28, + 4, + 5, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 6, "line": 1, }, "start": Object { - "column": 29, + "column": 5, "line": 1, }, }, "range": Array [ - 29, - 32, + 5, + 6, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 7, "line": 1, }, "start": Object { - "column": 33, + "column": 6, "line": 1, }, }, "range": Array [ - 33, - 34, + 6, + 7, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 7, + "line": 1, }, }, "range": Array [ - 36, - 37, + 7, + 8, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/class-extends-empty-implements.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-arguments-in-new-expression.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 1, + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", }, - "range": Array [ - 33, - 37, - ], - "type": "ClassBody", - }, - "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 0, "line": 1, }, }, - "name": "Foo", "range": Array [ - 6, - 9, + 0, + 11, ], - "type": "Identifier", + "type": "NewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 7, + 9, + ], + "type": "TSTypeParameterInstantiation", + }, }, - "implements": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 11, + "line": 1, }, "start": Object { "column": 0, @@ -89898,33 +92844,15 @@ Object { }, "range": Array [ 0, - 37, + 11, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 18, - 21, - ], - "type": "Identifier", - }, - "type": "ClassDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -89933,14 +92861,14 @@ Object { }, "range": Array [ 0, - 38, + 12, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -89950,25 +92878,25 @@ Object { }, "range": Array [ 0, - 5, + 3, ], "type": "Keyword", - "value": "class", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 9, + 4, + 7, ], "type": "Identifier", "value": "Foo", @@ -89976,178 +92904,126 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 8, "line": 1, }, "start": Object { - "column": 10, + "column": 7, "line": 1, }, }, "range": Array [ - 10, - 17, + 7, + 8, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 9, "line": 1, }, "start": Object { - "column": 18, + "column": 8, "line": 1, }, }, "range": Array [ - 18, - 21, + 8, + 9, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 10, "line": 1, }, "start": Object { - "column": 22, + "column": 9, "line": 1, }, }, "range": Array [ - 22, - 32, + 9, + 10, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 11, "line": 1, }, "start": Object { - "column": 33, + "column": 10, "line": 1, }, }, "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 36, - 37, + 10, + 11, ], "type": "Punctuator", - "value": "}", + "value": ")", }, ], "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/class-multiple-implements.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { "body": Array [], "loc": Object { "end": Object { - "column": 36, + "column": 18, "line": 1, }, "start": Object { - "column": 34, + "column": 16, "line": 1, }, }, "range": Array [ - 34, - 36, + 16, + 18, ], - "type": "ClassBody", + "type": "BlockStatement", }, + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, - "name": "a", + "name": "f1", "range": Array [ - 6, - 7, + 9, + 11, ], "type": "Identifier", }, - "implements": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "TSClassImplements", - }, - ], "loc": Object { "end": Object { - "column": 36, + "column": 18, "line": 1, }, "start": Object { @@ -90155,12 +93031,30 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 36, + 18, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 13, + ], + "type": "TSTypeParameterDeclaration", + }, }, ], "loc": Object { @@ -90175,14 +93069,14 @@ Object { }, "range": Array [ 0, - 37, + 19, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -90192,115 +93086,115 @@ Object { }, "range": Array [ 0, - 5, + 8, ], "type": "Keyword", - "value": "class", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, "range": Array [ - 6, - 7, + 9, + 11, ], "type": "Identifier", - "value": "a", + "value": "f1", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 11, "line": 1, }, }, "range": Array [ - 8, - 18, + 11, + 12, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 13, "line": 1, }, "start": Object { - "column": 19, + "column": 12, "line": 1, }, }, "range": Array [ - 19, - 20, + 12, + 13, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 14, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, "range": Array [ - 21, - 31, + 13, + 14, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 15, "line": 1, }, "start": Object { - "column": 32, + "column": 14, "line": 1, }, }, "range": Array [ - 32, - 33, + 14, + 15, ], - "type": "Identifier", - "value": "c", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 17, "line": 1, }, "start": Object { - "column": 34, + "column": 16, "line": 1, }, }, "range": Array [ - 34, - 35, + 16, + 17, ], "type": "Punctuator", "value": "{", @@ -90308,17 +93202,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 18, "line": 1, }, "start": Object { - "column": 35, + "column": 17, "line": 1, }, }, - "range": Array [ - 35, - 36, + "range": Array [ + 17, + 18, ], "type": "Punctuator", "value": "}", @@ -90328,47 +93222,31 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/decorator-on-enum-declaration.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-arrow-function.src 1`] = ` Object { "body": Array [ Object { - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "dec", - "range": Array [ - 1, - 4, - ], - "type": "Identifier", + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "start": Object { + "column": 16, + "line": 1, }, - "range": Array [ - 0, - 4, - ], - "type": "Decorator", }, - ], + "range": Array [ + 16, + 18, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { @@ -90376,20 +93254,20 @@ Object { "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, - "name": "E", + "name": "f1", "range": Array [ - 10, + 9, 11, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 1, }, "start": Object { @@ -90397,18 +93275,36 @@ Object { "line": 1, }, }, - "members": Array [], + "params": Array [], "range": Array [ 0, - 14, + 18, ], - "type": "TSEnumDeclaration", + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 13, + ], + "type": "TSTypeParameterDeclaration", + }, }, ], "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -90417,14 +93313,14 @@ Object { }, "range": Array [ 0, - 14, + 19, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 8, "line": 1, }, "start": Object { @@ -90434,97 +93330,133 @@ Object { }, "range": Array [ 0, - 1, + 8, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 11, "line": 1, }, "start": Object { - "column": 1, + "column": 9, "line": 1, }, }, "range": Array [ - 1, - 4, + 9, + 11, ], "type": "Identifier", - "value": "dec", + "value": "f1", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { - "column": 5, + "column": 11, "line": 1, }, }, "range": Array [ - 5, - 9, + 11, + 12, ], - "type": "Keyword", - "value": "enum", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { - "column": 10, + "column": 12, "line": 1, }, }, "range": Array [ - 10, - 11, + 12, + 13, ], - "type": "Identifier", - "value": "E", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, ], "type": "Punctuator", "value": "}", @@ -90534,71 +93466,165 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/decorator-on-function.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-constructor.src 1`] = ` Object { "body": Array [ Object { - "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 32, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 32, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 25, + 32, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 25, + 27, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + ], "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 17, - 19, + 10, + 34, ], - "type": "BlockStatement", + "type": "ClassBody", }, - "expression": false, - "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 6, + "line": 1, }, }, - "name": "b", + "name": "foo", "range": Array [ - 14, - 15, + 6, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [], "range": Array [ 0, - 19, + 34, ], - "type": "FunctionDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -90607,14 +93633,14 @@ Object { }, "range": Array [ 0, - 20, + 35, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -90624,79 +93650,115 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 9, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 4, + 6, + 9, ], "type": "Identifier", - "value": "dec", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 5, - 13, + 10, + 11, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 2, }, "start": Object { - "column": 9, + "column": 2, "line": 2, }, }, "range": Array [ 14, - 15, + 25, ], "type": "Identifier", - "value": "b", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 14, "line": 2, }, "start": Object { - "column": 10, + "column": 13, "line": 2, }, }, "range": Array [ - 15, - 16, + 25, + 26, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, ], "type": "Punctuator", "value": "(", @@ -90704,17 +93766,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 2, }, "start": Object { - "column": 11, + "column": 16, "line": 2, }, }, "range": Array [ - 16, - 17, + 28, + 29, ], "type": "Punctuator", "value": ")", @@ -90722,17 +93784,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 19, "line": 2, }, "start": Object { - "column": 12, + "column": 18, "line": 2, }, }, "range": Array [ - 17, - 18, + 30, + 31, ], "type": "Punctuator", "value": "{", @@ -90740,17 +93802,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 20, "line": 2, }, "start": Object { - "column": 13, + "column": 19, "line": 2, }, }, "range": Array [ - 18, - 19, + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, ], "type": "Punctuator", "value": "}", @@ -90760,105 +93840,110 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 20, - 22, - ], - "type": "TSInterfaceBody", - }, - "decorators": Array [ + "declarations": Array [ Object { - "expression": Object { - "arguments": Array [], - "callee": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 5, + "column": 27, "line": 1, }, "start": Object { - "column": 1, + "column": 25, "line": 1, }, }, - "name": "deco", "range": Array [ - 1, - 5, + 25, + 27, ], - "type": "Identifier", + "type": "BlockStatement", }, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 7, + "column": 27, "line": 1, }, "start": Object { - "column": 1, + "column": 12, "line": 1, }, }, + "params": Array [], "range": Array [ - 1, - 7, + 12, + 27, ], - "type": "CallExpression", + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 20, + 22, + ], + "type": "TSTypeParameterDeclaration", + }, }, "loc": Object { "end": Object { - "column": 7, + "column": 27, "line": 1, }, "start": Object { - "column": 0, + "column": 6, "line": 1, }, }, "range": Array [ - 0, - 7, + 6, + 27, ], - "type": "Decorator", + "type": "VariableDeclarator", }, ], - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "name": "M", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, + "kind": "const", "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { "column": 0, @@ -90867,14 +93952,14 @@ Object { }, "range": Array [ 0, - 22, + 27, ], - "type": "TSInterfaceDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 14, + "column": 0, "line": 2, }, "start": Object { @@ -90884,14 +93969,14 @@ Object { }, "range": Array [ 0, - 22, + 28, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -90901,115 +93986,151 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 5, + 6, + 9, ], "type": "Identifier", - "value": "deco", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 1, }, "start": Object { - "column": 5, + "column": 10, "line": 1, }, }, "range": Array [ - 5, - 6, + 10, + 11, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 20, "line": 1, }, "start": Object { - "column": 6, + "column": 12, "line": 1, }, }, "range": Array [ - 6, - 7, + 12, + 20, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 8, - 17, + 21, + 22, ], - "type": "Keyword", - "value": "interface", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 18, - 19, + 22, + 23, ], - "type": "Identifier", - "value": "M", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 20, - 21, + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, ], "type": "Punctuator", "value": "{", @@ -91017,17 +94138,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 26, + "line": 1, }, }, "range": Array [ - 21, - 22, + 26, + 27, ], "type": "Punctuator", "value": "}", @@ -91037,71 +94158,147 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/decorator-on-variable.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-method.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "test", + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + }, + "kind": "method", "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 2, }, "start": Object { - "column": 6, + "column": 2, "line": 2, }, }, - "name": "a", "range": Array [ 14, - 15, + 25, ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", }, - "start": Object { - "column": 10, - "line": 2, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 25, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 20, + ], + "type": "TSTypeParameterDeclaration", }, }, - "range": Array [ - 18, - 19, - ], - "raw": "1", - "type": "Literal", - "value": 1, }, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, }, - "range": Array [ - 14, - 19, - ], - "type": "VariableDeclarator", }, - ], - "kind": "const", + "range": Array [ + 10, + 27, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -91110,15 +94307,16 @@ Object { }, "range": Array [ 0, - 19, + 27, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -91127,14 +94325,14 @@ Object { }, "range": Array [ 0, - 20, + 28, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -91144,259 +94342,296 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 5, + 6, + 9, ], "type": "Identifier", - "value": "deco", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 1, }, "start": Object { - "column": 5, + "column": 10, "line": 1, }, }, "range": Array [ - 5, - 6, + 10, + 11, ], "type": "Punctuator", - "value": "(", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "test", }, Object { "loc": Object { "end": Object { "column": 7, - "line": 1, + "line": 2, }, "start": Object { "column": 6, - "line": 1, + "line": 2, }, }, "range": Array [ - 6, - 7, + 18, + 19, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 2, }, "start": Object { - "column": 0, + "column": 7, "line": 2, }, }, "range": Array [ - 8, - 13, + 19, + 20, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 2, }, "start": Object { - "column": 6, + "column": 8, "line": 2, }, }, "range": Array [ - 14, - 15, + 20, + 21, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 2, }, "start": Object { - "column": 8, + "column": 9, "line": 2, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { "column": 11, "line": 2, }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, "start": Object { - "column": 10, + "column": 12, "line": 2, }, }, "range": Array [ - 18, - 19, + 24, + 25, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/empty-type-arguments.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-method-signature.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "test", + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 2, + "line": 2, }, }, - "name": "foo", + "params": Array [], "range": Array [ - 6, - 16, + 18, + 27, ], - "type": "Identifier", - "typeAnnotation": Object { + "type": "TSMethodSignature", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 6, + "line": 2, }, }, + "params": Array [], "range": Array [ - 9, - 16, + 22, + 24, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 16, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 11, - 14, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 14, - 16, - ], - "type": "TSTypeParameterInstantiation", - }, - }, + "type": "TSTypeParameterDeclaration", }, }, - "init": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, }, - "range": Array [ - 6, - 16, - ], - "type": "VariableDeclarator", }, - ], - "kind": "const", + "range": Array [ + 14, + 29, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -91405,15 +94640,15 @@ Object { }, "range": Array [ 0, - 16, + 29, ], - "type": "VariableDeclaration", + "type": "TSInterfaceDeclaration", }, ], "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -91422,14 +94657,14 @@ Object { }, "range": Array [ 0, - 16, + 30, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { @@ -91439,25 +94674,25 @@ Object { }, "range": Array [ 0, - 5, + 9, ], "type": "Keyword", - "value": "const", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { - "column": 6, + "column": 10, "line": 1, }, }, "range": Array [ - 6, - 9, + 10, + 13, ], "type": "Identifier", "value": "foo", @@ -91465,53 +94700,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { - "column": 9, + "column": 14, "line": 1, }, }, "range": Array [ - 9, - 10, + 14, + 15, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 11, - 14, + 18, + 22, ], "type": "Identifier", - "value": "Foo", + "value": "test", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 6, + "line": 2, }, }, "range": Array [ - 14, - 15, + 22, + 23, ], "type": "Punctuator", "value": "<", @@ -91519,21 +94754,93 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 15, - 16, + 23, + 24, ], "type": "Punctuator", "value": ">", }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, ], "type": "Program", } @@ -104123,131 +107430,563 @@ Object { "line": 1, }, }, - "range": Array [ - 9, - 231, - ], - "type": "TSModuleBlock", + "range": Array [ + 9, + 231, + ], + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 31, + 44, + ], + "type": "String", + "value": "'hello world'", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "range": Array [ + 49, + 55, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, }, - "name": "A", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", }, + "range": Array [ + 56, + 61, + ], + "type": "Keyword", + "value": "class", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 12, + "column": 22, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 4, }, }, "range": Array [ - 0, - 231, + 62, + 67, ], - "type": "TSModuleDeclaration", + "type": "Identifier", + "value": "Point", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 12, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 89, + ], + "type": "Identifier", + "value": "constructor", }, - }, - "range": Array [ - 0, - 231, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 20, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 19, + "line": 5, }, }, "range": Array [ - 0, - 6, + 89, + 90, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, ], "type": "Identifier", - "value": "module", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 29, + "line": 5, }, "start": Object { - "column": 7, - "line": 1, + "column": 28, + "line": 5, }, }, "range": Array [ - 7, - 8, + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 100, + 106, ], "type": "Identifier", - "value": "A", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 37, + "line": 5, }, "start": Object { - "column": 9, - "line": 1, + "column": 36, + "line": 5, }, }, "range": Array [ - 9, - 10, + 106, + 107, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 108, + 114, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 46, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 126, + 127, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 58, + "line": 5, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "}", + }, Object { "loc": Object { "end": Object { "column": 10, - "line": 3, + "line": 7, }, "start": Object { "column": 4, - "line": 3, + "line": 7, }, }, "range": Array [ - 16, - 22, + 140, + 146, ], "type": "Keyword", "value": "export", @@ -104255,593 +107994,932 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 17, + "line": 7, }, "start": Object { "column": 11, - "line": 3, + "line": 7, }, }, "range": Array [ - 23, - 26, + 147, + 153, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 166, + 172, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 173, + 182, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "range": Array [ + 183, + 185, + ], + "type": "Identifier", + "value": "Id", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 8, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 200, + 204, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 24, + "line": 9, }, "start": Object { - "column": 15, - "line": 3, + "column": 18, + "line": 9, }, }, "range": Array [ - 27, - 28, + 206, + 212, ], "type": "Identifier", - "value": "x", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 9, }, "start": Object { - "column": 17, - "line": 3, + "column": 24, + "line": 9, }, }, "range": Array [ - 29, - 30, + 212, + 213, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 9, + "line": 10, }, "start": Object { - "column": 19, - "line": 3, + "column": 8, + "line": 10, }, }, "range": Array [ - 31, - 44, + 222, + 223, ], - "type": "String", - "value": "'hello world'", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 5, + "line": 11, }, "start": Object { "column": 4, - "line": 4, + "line": 11, }, }, "range": Array [ - 49, - 55, + 228, + 229, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 1, + "line": 12, }, "start": Object { - "column": 11, - "line": 4, + "column": 0, + "line": 12, }, }, "range": Array [ - 56, - 61, + 230, + 231, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +Object { + "body": Array [ Object { + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "raw": "\\"hot-new-module\\"", + "type": "Literal", + "value": "hot-new-module", + }, "loc": Object { "end": Object { - "column": 22, - "line": 4, + "column": 32, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 62, - 67, + 0, + 32, ], - "type": "Identifier", - "value": "Point", + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { - "column": 23, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 68, - 69, + 0, + 7, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 5, + "column": 14, + "line": 1, }, "start": Object { "column": 8, - "line": 5, + "line": 1, }, }, "range": Array [ - 78, - 89, + 8, + 14, ], "type": "Identifier", - "value": "constructor", + "value": "module", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 5, + "column": 31, + "line": 1, }, "start": Object { - "column": 19, - "line": 5, + "column": 15, + "line": 1, }, }, "range": Array [ - 89, - 90, + 15, + 31, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"hot-new-module\\"", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 5, + "column": 32, + "line": 1, }, "start": Object { - "column": 20, - "line": 5, + "column": 31, + "line": 1, }, }, "range": Array [ - 90, - 96, + 31, + 32, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/array-type.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 28, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 27, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 97, - 98, + 0, + 19, ], - "type": "Identifier", - "value": "x", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "TSArrayType", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 29, - "line": 5, + "column": 4, + "line": 1, }, "start": Object { - "column": 28, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 98, - 99, + 0, + 4, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 5, + "column": 8, + "line": 1, }, "start": Object { - "column": 30, - "line": 5, + "column": 5, + "line": 1, }, }, "range": Array [ - 100, - 106, + 5, + 8, ], "type": "Identifier", - "value": "number", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 5, + "column": 10, + "line": 1, }, "start": Object { - "column": 36, - "line": 5, + "column": 9, + "line": 1, }, }, "range": Array [ - 106, - 107, + 9, + 10, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 5, + "column": 17, + "line": 1, }, "start": Object { - "column": 38, - "line": 5, + "column": 11, + "line": 1, }, }, "range": Array [ - 108, - 114, + 11, + 17, ], - "type": "Keyword", - "value": "public", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 5, + "column": 18, + "line": 1, }, "start": Object { - "column": 45, - "line": 5, + "column": 17, + "line": 1, }, }, "range": Array [ - 115, - 116, + 17, + 18, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 46, - "line": 5, + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/conditional.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", + }, + "type": "TSConditionalType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 116, - 117, ], - "type": "Punctuator", - "value": ":", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { "column": 48, - "line": 5, - }, - }, - "range": Array [ - 118, - 124, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 5, + "line": 1, }, "start": Object { - "column": 54, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 124, - 125, + 0, + 48, ], - "type": "Punctuator", - "value": ")", + "type": "VariableDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 5, - }, - "start": Object { - "column": 56, - "line": 5, - }, - }, - "range": Array [ - 126, - 127, - ], - "type": "Punctuator", - "value": "{", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, - Object { - "loc": Object { - "end": Object { - "column": 59, - "line": 5, - }, - "start": Object { - "column": 58, - "line": 5, - }, - }, - "range": Array [ - 128, - 129, - ], - "type": "Punctuator", - "value": "}", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 3, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 134, - 135, + 0, + 3, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 7, + "column": 5, + "line": 1, }, "start": Object { "column": 4, - "line": 7, + "line": 1, }, }, "range": Array [ - 140, - 146, + 4, + 5, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 7, + "column": 6, + "line": 1, }, "start": Object { - "column": 11, - "line": 7, + "column": 5, + "line": 1, }, }, "range": Array [ - 147, - 153, + 5, + 6, ], - "type": "Identifier", - "value": "module", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 7, + "column": 13, + "line": 1, }, "start": Object { - "column": 18, - "line": 7, + "column": 7, + "line": 1, }, }, "range": Array [ - 154, - 155, + 7, + 13, ], "type": "Identifier", - "value": "B", + "value": "number", }, Object { "loc": Object { "end": Object { "column": 21, - "line": 7, + "line": 1, }, "start": Object { - "column": 20, - "line": 7, - }, - }, - "range": Array [ - 156, - 157, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { "column": 14, - "line": 8, - }, - "start": Object { - "column": 8, - "line": 8, - }, - }, - "range": Array [ - 166, - 172, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 8, - }, - "start": Object { - "column": 15, - "line": 8, + "line": 1, }, }, "range": Array [ - 173, - 182, + 14, + 21, ], "type": "Keyword", - "value": "interface", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 8, + "column": 28, + "line": 1, }, "start": Object { - "column": 25, - "line": 8, + "column": 22, + "line": 1, }, }, "range": Array [ - 183, - 185, + 22, + 28, ], "type": "Identifier", - "value": "Id", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 8, + "column": 30, + "line": 1, }, "start": Object { - "column": 28, - "line": 8, + "column": 29, + "line": 1, }, }, "range": Array [ - 186, - 187, + 29, + 30, ], "type": "Punctuator", - "value": "{", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 9, + "column": 38, + "line": 1, }, "start": Object { - "column": 12, - "line": 9, + "column": 31, + "line": 1, }, }, "range": Array [ - 200, - 204, + 31, + 38, ], "type": "Identifier", - "value": "name", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 9, + "column": 40, + "line": 1, }, "start": Object { - "column": 16, - "line": 9, + "column": 39, + "line": 1, }, }, "range": Array [ - 204, - 205, + 39, + 40, ], "type": "Punctuator", "value": ":", @@ -104849,17 +108927,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 9, + "column": 47, + "line": 1, }, "start": Object { - "column": 18, - "line": 9, + "column": 41, + "line": 1, }, }, "range": Array [ - 206, - 212, + 41, + 47, ], "type": "Identifier", "value": "string", @@ -104867,141 +108945,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 9, + "column": 48, + "line": 1, }, "start": Object { - "column": 24, - "line": 9, + "column": 47, + "line": 1, }, }, "range": Array [ - 212, - 213, + 47, + 48, ], "type": "Punctuator", "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 10, - }, - "start": Object { - "column": 8, - "line": 10, - }, - }, - "range": Array [ - 222, - 223, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 11, - }, - "start": Object { - "column": 4, - "line": 11, - }, - }, - "range": Array [ - 228, - 229, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 12, - }, - "start": Object { - "column": 0, - "line": 12, - }, - }, - "range": Array [ - 230, - 231, - ], - "type": "Punctuator", - "value": "}", - }, ], "type": "Program", } `; -exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer.src 1`] = ` Object { "body": Array [ Object { - "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 31, + "column": 12, "line": 1, }, "start": Object { - "column": 15, + "column": 5, "line": 1, }, }, + "name": "Element", "range": Array [ - 15, - 31, + 5, + 12, ], - "raw": "\\"hot-new-module\\"", - "type": "Literal", - "value": "hot-new-module", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "Identifier", }, - "range": Array [ - 0, - 32, - ], - "type": "TSModuleDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 33, - ], - "sourceType": "script", - "tokens": Array [ - Object { "loc": Object { "end": Object { - "column": 7, + "column": 48, "line": 1, }, "start": Object { @@ -105011,140 +108999,270 @@ Object { }, "range": Array [ 0, - 7, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 14, + 48, ], - "type": "Identifier", - "value": "module", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 15, - 31, - ], - "type": "String", - "value": "\\"hot-new-module\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, + "extendsType": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 37, + ], + "type": "TSParenthesizedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 39, + ], + "type": "TSArrayType", }, - "start": Object { - "column": 31, - "line": 1, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/array-type.src 1`] = ` -Object { - "body": Array [ - Object { - "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 47, "line": 1, }, "start": Object { - "column": 5, + "column": 18, "line": 1, }, }, - "name": "Foo", "range": Array [ - 5, - 8, + 18, + 47, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 19, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "elementType": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 17, + "column": 43, "line": 1, }, "start": Object { - "column": 11, + "column": 42, "line": 1, }, }, "range": Array [ - 11, - 17, + 42, + 43, ], - "type": "TSStringKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, }, + "type": "TSConditionalType", + }, + "typeParameters": Object { "loc": Object { "end": Object { - "column": 19, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 14, + ], + "type": "TSTypeParameter", + }, + ], "range": Array [ - 11, - 19, + 12, + 15, ], - "type": "TSArrayType", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -105160,7 +109278,7 @@ Object { }, "range": Array [ 0, - 20, + 49, ], "sourceType": "script", "tokens": Array [ @@ -105185,7 +109303,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -105195,64 +109313,82 @@ Object { }, "range": Array [ 5, - 8, + 12, ], "type": "Identifier", - "value": "Foo", + "value": "Element", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 1, }, "start": Object { - "column": 9, + "column": 12, "line": 1, }, }, "range": Array [ - 9, - 10, + 12, + 13, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 14, "line": 1, }, "start": Object { - "column": 11, + "column": 13, "line": 1, }, }, "range": Array [ - 11, - 17, + 13, + 14, ], "type": "Identifier", - "value": "string", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 15, "line": 1, }, "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { "column": 17, "line": 1, }, + "start": Object { + "column": 16, + "line": 1, + }, }, "range": Array [ + 16, 17, - 18, ], "type": "Punctuator", - "value": "[", + "value": "=", }, Object { "loc": Object { @@ -105269,314 +109405,149 @@ Object { 18, 19, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "T", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/conditional.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 47, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 13, - ], - "type": "TSNumberKeyword", - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 47, - ], - "type": "TSStringKeyword", - }, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 47, - ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 38, - ], - "type": "TSBooleanKeyword", - }, - "type": "TSConditionalType", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 47, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", "loc": Object { "end": Object { - "column": 48, + "column": 27, "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, - 48, + 20, + 27, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "extends", }, - }, - "range": Array [ - 0, - 49, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 29, "line": 1, }, "start": Object { - "column": 0, + "column": 28, "line": 1, }, }, "range": Array [ - 0, - 3, + 28, + 29, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 34, "line": 1, }, "start": Object { - "column": 4, + "column": 29, "line": 1, }, }, "range": Array [ - 4, - 5, + 29, + 34, ], "type": "Identifier", - "value": "x", + "value": "infer", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 36, "line": 1, }, "start": Object { - "column": 5, + "column": 35, "line": 1, }, }, "range": Array [ - 5, - 6, + 35, + 36, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 37, "line": 1, }, "start": Object { - "column": 7, + "column": 36, "line": 1, }, }, "range": Array [ - 7, - 13, + 36, + 37, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 14, + "column": 37, "line": 1, }, }, "range": Array [ - 14, - 21, + 37, + 38, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 39, "line": 1, }, "start": Object { - "column": 22, + "column": 38, "line": 1, }, }, - "range": Array [ - 22, - 28, + "range": Array [ + 38, + 39, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 41, "line": 1, }, "start": Object { - "column": 29, + "column": 40, "line": 1, }, }, "range": Array [ - 29, - 30, + 40, + 41, ], "type": "Punctuator", "value": "?", @@ -105584,35 +109555,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 43, "line": 1, }, "start": Object { - "column": 31, + "column": 42, "line": 1, }, }, "range": Array [ - 31, - 38, + 42, + 43, ], "type": "Identifier", - "value": "boolean", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 45, "line": 1, }, "start": Object { - "column": 39, + "column": 44, "line": 1, }, }, "range": Array [ - 39, - 40, + 44, + 45, ], "type": "Punctuator", "value": ":", @@ -105624,16 +109595,16 @@ Object { "line": 1, }, "start": Object { - "column": 41, + "column": 46, "line": 1, }, }, "range": Array [ - 41, + 46, 47, ], "type": "Identifier", - "value": "string", + "value": "T", }, Object { "loc": Object { @@ -105658,14 +109629,14 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { @@ -105673,17 +109644,17 @@ Object { "line": 1, }, }, - "name": "Element", + "name": "Unpacked", "range": Array [ 5, - 12, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { "column": 0, @@ -105692,41 +109663,41 @@ Object { }, "range": Array [ 0, - 48, + 126, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "checkType": Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 19, + 21, + 22, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "name": "T", "range": Array [ - 18, - 19, + 21, + 22, ], "type": "Identifier", }, @@ -105735,67 +109706,67 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 37, + 31, + 40, ], "type": "TSParenthesizedType", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 29, - 36, + 32, + 39, ], "type": "TSInferType", "typeParameter": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "name": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "name": "U", "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Identifier", }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "TSTypeParameter", }, @@ -105803,100 +109774,432 @@ Object { }, "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 39, + 31, + 42, ], "type": "TSArrayType", }, "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 70, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + }, + "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "T", + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + }, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 109, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "Promise", + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 108, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + }, + "range": Array [ + 107, + 108, + ], + "type": "TSTypeParameter", + }, + }, + ], + "range": Array [ + 100, + 109, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 124, + 125, + ], + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 125, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + }, + }, + "type": "TSConditionalType", + }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 46, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 46, - 47, + 53, + 125, ], - "type": "TSTypeReference", - "typeName": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 25, + "line": 3, }, "start": Object { - "column": 46, - "line": 1, + "column": 24, + "line": 3, }, }, - "name": "T", "range": Array [ - 46, - 47, + 73, + 74, ], - "type": "Identifier", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + }, }, + "type": "TSConditionalType", }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, - "range": Array [ - 18, - 47, + "range": Array [ + 21, + 125, ], "trueType": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 42, - 43, + 45, + 46, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "name": "U", "range": Array [ - 42, - 43, + 45, + 46, ], "type": "Identifier", }, @@ -105906,11 +110209,11 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, @@ -105918,42 +110221,42 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "name": "T", "range": Array [ - 13, 14, + 15, ], "type": "Identifier", }, "range": Array [ - 13, 14, + 15, ], "type": "TSTypeParameter", }, ], "range": Array [ - 12, - 15, + 13, + 16, ], "type": "TSTypeParameterDeclaration", }, @@ -105962,7 +110265,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 6, }, "start": Object { "column": 0, @@ -105971,7 +110274,7 @@ Object { }, "range": Array [ 0, - 49, + 127, ], "sourceType": "script", "tokens": Array [ @@ -105996,7 +110299,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { @@ -106006,25 +110309,25 @@ Object { }, "range": Array [ 5, - 12, + 13, ], "type": "Identifier", - "value": "Element", + "value": "Unpacked", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], "type": "Punctuator", "value": "<", @@ -106032,17 +110335,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, ], "type": "Identifier", "value": "T", @@ -106050,17 +110353,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, 15, + 16, ], "type": "Punctuator", "value": ">", @@ -106068,17 +110371,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 16, + "column": 17, "line": 1, }, }, "range": Array [ - 16, 17, + 18, ], "type": "Punctuator", "value": "=", @@ -106086,17 +110389,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 19, + 21, + 22, ], "type": "Identifier", "value": "T", @@ -106104,17 +110407,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 20, - 27, + 23, + 30, ], "type": "Keyword", "value": "extends", @@ -106122,17 +110425,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 29, + 31, + 32, ], "type": "Punctuator", "value": "(", @@ -106140,17 +110443,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 29, - 34, + 32, + 37, ], "type": "Identifier", "value": "infer", @@ -106158,17 +110461,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Identifier", "value": "U", @@ -106176,17 +110479,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 36, - 37, + 39, + 40, ], "type": "Punctuator", "value": ")", @@ -106194,17 +110497,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 37, - 38, + 40, + 41, ], "type": "Punctuator", "value": "[", @@ -106212,17 +110515,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 38, - 39, + 41, + 42, ], "type": "Punctuator", "value": "]", @@ -106230,17 +110533,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 40, - "line": 1, + "column": 24, + "line": 2, }, }, "range": Array [ - 40, - 41, + 43, + 44, ], "type": "Punctuator", "value": "?", @@ -106248,17 +110551,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 42, - 43, + 45, + 46, ], "type": "Identifier", "value": "U", @@ -106266,17 +110569,323 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 44, - "line": 1, + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 55, + 62, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 85, + 92, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + "value": "Promise", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 37, + "line": 4, }, }, "range": Array [ - 44, - 45, + 114, + 115, ], "type": "Punctuator", "value": ":", @@ -106284,17 +110893,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 46, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 46, - 47, + 124, + 125, ], "type": "Identifier", "value": "T", @@ -106302,17 +110911,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, }, "range": Array [ - 47, - 48, + 125, + 126, ], "type": "Punctuator", "value": ";", @@ -106322,14 +110931,14 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -106337,17 +110946,17 @@ Object { "line": 1, }, }, - "name": "Unpacked", + "name": "Foo", "range": Array [ 5, - 13, + 8, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 63, + "line": 1, }, "start": Object { "column": 0, @@ -106356,543 +110965,336 @@ Object { }, "range": Array [ 0, - 126, + 63, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "checkType": Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "name": "T", "range": Array [ - 21, - 22, + 14, + 15, ], "type": "Identifier", }, }, "extendsType": Object { - "elementType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 40, - ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 32, - 39, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": "U", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "range": Array [ - 38, - 39, - ], - "type": "TSTypeParameter", - }, - }, - }, "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 50, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 42, - ], - "type": "TSArrayType", - }, - "falseType": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 63, - 70, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "name": "U", - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - }, - "range": Array [ - 69, - 70, - ], - "type": "TSTypeParameter", + "column": 24, + "line": 1, }, }, - "falseType": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "TSTypeReference", - "typeName": Object { + "members": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 27, + "line": 1, }, "start": Object { - "column": 6, - "line": 4, + "column": 26, + "line": 1, }, }, - "name": "T", + "name": "a", "range": Array [ - 83, - 84, + 26, + 27, ], "type": "Identifier", }, - }, - "extendsType": Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 37, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 26, + "line": 1, }, }, "range": Array [ - 93, - 109, + 26, + 37, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 27, + "line": 1, }, }, - "name": "Promise", "range": Array [ - 93, - 100, + 27, + 36, ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 4, - }, - "start": Object { - "column": 23, - "line": 4, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 4, + "column": 35, + "line": 1, }, }, - "range": Array [ - 101, - 108, - ], - "type": "TSInferType", - "typeParameter": Object { + "name": Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 4, - }, - "start": Object { - "column": 30, - "line": 4, - }, + "column": 35, + "line": 1, }, - "name": "U", - "range": Array [ - 107, - 108, - ], - "type": "Identifier", }, + "name": "U", "range": Array [ - 107, - 108, + 35, + 36, ], - "type": "TSTypeParameter", + "type": "Identifier", }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", }, - ], - "range": Array [ - 100, - 109, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 5, }, }, - "range": Array [ - 124, - 125, - ], - "type": "TSTypeReference", - "typeName": Object { + }, + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 39, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 38, + "line": 1, }, }, - "name": "T", + "name": "b", "range": Array [ - 124, - 125, + 38, + 39, ], "type": "Identifier", }, - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 125, - ], - "trueType": Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 112, - 113, + 38, + 48, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "range": Array [ + 47, + 48, + ], + "type": "TSTypeParameter", }, }, - "name": "U", - "range": Array [ - 112, - 113, - ], - "type": "Identifier", }, }, - "type": "TSConditionalType", - }, + ], + "range": Array [ + 24, + 50, + ], + "type": "TSTypeLiteral", + }, + "falseType": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 57, + "line": 1, }, }, "range": Array [ - 53, - 125, + 57, + 62, ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "range": Array [ - 73, - 74, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "name": "U", - "range": Array [ - 73, - 74, - ], - "type": "Identifier", - }, - }, - "type": "TSConditionalType", + "type": "TSNeverKeyword", }, "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 125, + 14, + 62, ], "trueType": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 53, + "line": 1, }, }, "range": Array [ - 45, - 46, + 53, + 54, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 53, + "line": 1, }, }, "name": "U", "range": Array [ - 45, - 46, + 53, + 54, ], "type": "Identifier", }, @@ -106902,11 +111304,11 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, @@ -106914,42 +111316,42 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "name": "T", "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Identifier", }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "TSTypeParameter", }, ], "range": Array [ - 13, - 16, + 8, + 11, ], "type": "TSTypeParameterDeclaration", }, @@ -106958,7 +111360,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -106967,7 +111369,7 @@ Object { }, "range": Array [ 0, - 127, + 64, ], "sourceType": "script", "tokens": Array [ @@ -106992,7 +111394,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -107002,25 +111404,25 @@ Object { }, "range": Array [ 5, - 13, + 8, ], "type": "Identifier", - "value": "Unpacked", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, "range": Array [ - 13, - 14, + 8, + 9, ], "type": "Punctuator", "value": "<", @@ -107028,17 +111430,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Identifier", "value": "T", @@ -107046,17 +111448,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 15, + "column": 10, "line": 1, }, }, "range": Array [ - 15, - 16, + 10, + 11, ], "type": "Punctuator", "value": ">", @@ -107064,17 +111466,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", "value": "=", @@ -107082,17 +111484,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], "type": "Identifier", "value": "T", @@ -107100,179 +111502,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ + 16, 23, - 30, ], "type": "Keyword", "value": "extends", }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 32, - 37, - ], - "type": "Identifier", - "value": "infer", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 40, - 41, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": "]", - }, Object { "loc": Object { "end": Object { "column": 25, - "line": 2, + "line": 1, }, "start": Object { "column": 24, - "line": 2, + "line": 1, }, }, "range": Array [ - 43, - 44, + 24, + 25, ], "type": "Punctuator", - "value": "?", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 27, - "line": 2, + "line": 1, }, "start": Object { "column": 26, - "line": 2, + "line": 1, }, }, "range": Array [ - 45, - 46, + 26, + 27, ], "type": "Identifier", - "value": "U", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 28, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ - 47, - 48, + 27, + 28, ], "type": "Punctuator", "value": ":", @@ -107280,53 +111574,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 55, - 62, - ], - "type": "Keyword", - "value": "extends", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 29, + "line": 1, }, }, "range": Array [ - 63, - 68, + 29, + 34, ], "type": "Identifier", "value": "infer", @@ -107334,53 +111592,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 3, - }, - }, - "range": Array [ - 71, - 72, - ], - "type": "Punctuator", - "value": "?", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 3, + "column": 35, + "line": 1, }, }, "range": Array [ - 73, - 74, + 35, + 36, ], "type": "Identifier", "value": "U", @@ -107388,107 +111610,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 37, + "line": 1, }, "start": Object { - "column": 26, - "line": 3, + "column": 36, + "line": 1, }, }, "range": Array [ - 75, - 76, + 36, + 37, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 85, - 92, - ], - "type": "Keyword", - "value": "extends", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 39, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 93, - 100, + 38, + 39, ], "type": "Identifier", - "value": "Promise", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 40, + "line": 1, }, "start": Object { - "column": 23, - "line": 4, + "column": 39, + "line": 1, }, }, "range": Array [ - 100, - 101, + 39, + 40, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 4, + "column": 46, + "line": 1, }, "start": Object { - "column": 24, - "line": 4, + "column": 41, + "line": 1, }, }, "range": Array [ - 101, - 106, + 41, + 46, ], "type": "Identifier", "value": "infer", @@ -107496,17 +111682,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, + "column": 47, + "line": 1, }, }, "range": Array [ - 107, - 108, + 47, + 48, ], "type": "Identifier", "value": "U", @@ -107514,35 +111700,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 50, + "line": 1, }, "start": Object { - "column": 31, - "line": 4, + "column": 49, + "line": 1, }, }, "range": Array [ - 108, - 109, + 49, + 50, ], "type": "Punctuator", - "value": ">", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 4, + "column": 52, + "line": 1, }, "start": Object { - "column": 33, - "line": 4, + "column": 51, + "line": 1, }, }, "range": Array [ - 110, - 111, + 51, + 52, ], "type": "Punctuator", "value": "?", @@ -107550,17 +111736,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 54, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 53, + "line": 1, }, }, "range": Array [ - 112, - 113, + 53, + 54, ], "type": "Identifier", "value": "U", @@ -107568,17 +111754,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 4, + "column": 56, + "line": 1, }, "start": Object { - "column": 37, - "line": 4, + "column": 55, + "line": 1, }, }, "range": Array [ - 114, - 115, + 55, + 56, ], "type": "Punctuator", "value": ":", @@ -107586,35 +111772,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 57, + "line": 1, }, }, "range": Array [ - 124, - 125, + 57, + 62, ], "type": "Identifier", - "value": "T", + "value": "never", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 63, + "line": 1, }, "start": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, }, "range": Array [ - 125, - 126, + 62, + 63, ], "type": "Punctuator", "value": ";", @@ -107624,430 +111810,166 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = ` +exports[`typescript fixtures/types/conditional-with-null.src 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 63, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 63, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeReference", - "typeName": Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 45, "line": 1, }, "start": Object { - "column": 14, + "column": 4, "line": 1, }, }, - "name": "T", + "name": "x", "range": Array [ - 14, - 15, + 4, + 45, ], "type": "Identifier", - }, - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 1, }, "start": Object { - "column": 26, + "column": 5, "line": 1, }, }, "range": Array [ - 26, - 37, + 5, + 45, ], - "type": "TSPropertySignature", + "type": "TSTypeAnnotation", "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 36, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "checkType": Object { "loc": Object { "end": Object { - "column": 36, + "column": 13, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 36, + 7, + 13, ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", + "start": Object { + "column": 22, + "line": 1, }, - "range": Array [ - 35, - 36, - ], - "type": "TSTypeParameter", }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", }, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, }, + "range": Array [ + 41, + 45, + ], + "type": "TSNullKeyword", }, - "name": "b", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 48, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 48, + "column": 45, "line": 1, }, "start": Object { - "column": 39, + "column": 7, "line": 1, }, }, "range": Array [ - 39, - 48, + 7, + 45, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 41, + "column": 38, "line": 1, - }, - }, - "range": Array [ - 41, - 48, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 47, - 48, - ], - "type": "Identifier", - }, - "range": Array [ - 47, - 48, - ], - "type": "TSTypeParameter", - }, - }, - }, - }, - ], - "range": Array [ - 24, - 50, - ], - "type": "TSTypeLiteral", - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 57, - "line": 1, - }, - }, - "range": Array [ - 57, - 62, - ], - "type": "TSNeverKeyword", - }, - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 62, - ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - }, - "type": "TSConditionalType", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", }, + "type": "TSConditionalType", }, - "name": "T", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, - "range": Array [ - 9, - 10, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 8, - 11, - ], - "type": "TSTypeParameterDeclaration", + "init": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", }, ], "loc": Object { @@ -108062,14 +111984,14 @@ Object { }, "range": Array [ 0, - 64, + 47, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 3, "line": 1, }, "start": Object { @@ -108079,15 +112001,33 @@ Object { }, "range": Array [ 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ 4, + 5, ], "type": "Identifier", - "value": "type", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -108097,169 +112037,461 @@ Object { }, "range": Array [ 5, - 8, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, ], "type": "Identifier", - "value": "Foo", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 21, "line": 1, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, "range": Array [ - 8, - 9, + 14, + 21, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 28, "line": 1, }, "start": Object { - "column": 9, + "column": 22, "line": 1, }, }, "range": Array [ - 9, - 10, + 22, + 28, ], "type": "Identifier", - "value": "T", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 30, "line": 1, }, "start": Object { - "column": 10, + "column": 29, "line": 1, }, }, "range": Array [ - 10, - 11, + 29, + 30, ], "type": "Punctuator", - "value": ">", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 38, "line": 1, }, "start": Object { - "column": 12, + "column": 31, "line": 1, }, }, "range": Array [ - 12, - 13, + 31, + 38, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 40, "line": 1, }, "start": Object { - "column": 14, + "column": 39, "line": 1, }, }, "range": Array [ - 14, - 15, + 39, + 40, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 45, "line": 1, }, "start": Object { - "column": 16, + "column": 41, "line": 1, }, }, "range": Array [ - 16, - 23, + 41, + 45, ], "type": "Keyword", - "value": "extends", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 46, "line": 1, }, "start": Object { - "column": 24, + "column": 45, "line": 1, }, }, "range": Array [ - 24, - 25, + 45, + 46, ], "type": "Punctuator", - "value": "{", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 4, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 42, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 42, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 27, + "column": 3, "line": 1, }, "start": Object { - "column": 26, + "column": 0, "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, ], "type": "Identifier", - "value": "a", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 6, "line": 1, }, "start": Object { - "column": 27, + "column": 5, "line": 1, }, }, "range": Array [ - 27, - 28, + 5, + 6, ], "type": "Punctuator", "value": ":", @@ -108267,233 +112499,251 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 10, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 34, + 7, + 10, ], - "type": "Identifier", - "value": "infer", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 12, "line": 1, }, "start": Object { - "column": 35, + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, "line": 1, }, }, "range": Array [ - 35, - 36, + 12, + 13, ], "type": "Identifier", - "value": "U", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 14, "line": 1, }, "start": Object { - "column": 36, + "column": 13, "line": 1, }, }, "range": Array [ - 36, - 37, + 13, + 14, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 21, "line": 1, }, "start": Object { - "column": 38, + "column": 15, "line": 1, }, }, "range": Array [ - 38, - 39, + 15, + 21, ], "type": "Identifier", - "value": "b", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 22, "line": 1, }, "start": Object { - "column": 39, + "column": 21, "line": 1, }, }, "range": Array [ - 39, - 40, + 21, + 22, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 24, "line": 1, }, "start": Object { - "column": 41, + "column": 23, "line": 1, }, }, "range": Array [ - 41, - 46, + 23, + 24, ], "type": "Identifier", - "value": "infer", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 25, "line": 1, }, "start": Object { - "column": 47, + "column": 24, "line": 1, }, }, "range": Array [ - 47, - 48, + 24, + 25, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 50, + "column": 26, "line": 1, }, "start": Object { - "column": 49, + "column": 25, "line": 1, }, }, "range": Array [ - 49, - 50, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 52, + "column": 33, "line": 1, }, "start": Object { - "column": 51, + "column": 27, "line": 1, }, }, "range": Array [ - 51, - 52, + 27, + 33, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 54, + "column": 34, "line": 1, }, "start": Object { - "column": 53, + "column": 33, "line": 1, }, }, "range": Array [ - 53, - 54, + 33, + 34, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 37, "line": 1, }, "start": Object { - "column": 55, + "column": 35, "line": 1, }, }, "range": Array [ - 55, - 56, + 35, + 37, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 62, + "column": 42, "line": 1, }, "start": Object { - "column": 57, + "column": 38, "line": 1, }, }, "range": Array [ - 57, - 62, + 38, + 42, ], - "type": "Identifier", - "value": "never", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 63, + "column": 43, "line": 1, }, "start": Object { - "column": 62, + "column": 42, "line": 1, }, }, "range": Array [ - 62, - 63, + 42, + 43, ], "type": "Punctuator", "value": ";", @@ -108503,7 +112753,7 @@ Object { } `; -exports[`typescript fixtures/types/conditional-with-null.src 1`] = ` +exports[`typescript fixtures/types/constructor-generic.src 1`] = ` Object { "body": Array [ Object { @@ -108512,7 +112762,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -108520,16 +112770,16 @@ Object { "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ 4, - 45, + 25, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -108539,100 +112789,210 @@ Object { }, "range": Array [ 5, - 45, + 25, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, }, - "range": Array [ - 7, - 13, - ], - "type": "TSNumberKeyword", }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, }, - "start": Object { - "column": 22, - "line": 1, + "name": "a", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + }, }, }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - "falseType": Object { + ], + "range": Array [ + 7, + 25, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { - "column": 41, + "column": 21, "line": 1, }, }, "range": Array [ - 41, - 45, + 21, + 25, ], - "type": "TSNullKeyword", - }, - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, }, }, - "range": Array [ - 7, - 45, - ], - "trueType": Object { + "type": "TSConstructorType", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 38, + "column": 14, "line": 1, }, "start": Object { - "column": 31, + "column": 11, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "range": Array [ + 12, + 13, + ], + "type": "TSTypeParameter", + }, + ], "range": Array [ - 31, - 38, + 11, + 14, ], - "type": "TSBooleanKeyword", + "type": "TSTypeParameterDeclaration", }, - "type": "TSConditionalType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -108642,7 +113002,7 @@ Object { }, "range": Array [ 4, - 45, + 25, ], "type": "VariableDeclarator", }, @@ -108650,7 +113010,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 46, + "column": 26, "line": 1, }, "start": Object { @@ -108660,7 +113020,7 @@ Object { }, "range": Array [ 0, - 46, + 26, ], "type": "VariableDeclaration", }, @@ -108677,7 +113037,7 @@ Object { }, "range": Array [ 0, - 47, + 27, ], "sourceType": "script", "tokens": Array [ @@ -108715,7 +113075,7 @@ Object { 5, ], "type": "Identifier", - "value": "x", + "value": "f", }, Object { "loc": Object { @@ -108738,7 +113098,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { @@ -108748,15 +113108,69 @@ Object { }, "range": Array [ 7, + 10, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, 13, ], "type": "Identifier", - "value": "number", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, "line": 1, }, "start": Object { @@ -108766,115 +113180,133 @@ Object { }, "range": Array [ 14, - 21, + 15, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 16, "line": 1, }, "start": Object { - "column": 22, + "column": 15, "line": 1, }, }, "range": Array [ - 22, - 28, + 15, + 16, ], "type": "Identifier", - "value": "string", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 17, "line": 1, }, "start": Object { - "column": 29, + "column": 16, "line": 1, }, }, "range": Array [ - 29, - 30, + 16, + 17, ], "type": "Punctuator", - "value": "?", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 19, "line": 1, }, "start": Object { - "column": 31, + "column": 18, "line": 1, }, }, "range": Array [ - 31, - 38, + 18, + 19, ], "type": "Identifier", - "value": "boolean", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 20, "line": 1, }, "start": Object { - "column": 39, + "column": 19, "line": 1, }, }, "range": Array [ - 39, - 40, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 23, "line": 1, }, "start": Object { - "column": 41, + "column": 21, "line": 1, }, }, "range": Array [ - 41, - 45, + 21, + 23, ], - "type": "Keyword", - "value": "null", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 25, "line": 1, }, "start": Object { - "column": 45, + "column": 24, "line": 1, }, }, "range": Array [ - 45, - 46, + 24, + 25, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -108884,7 +113316,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor.src 1`] = ` +exports[`typescript fixtures/types/constructor-in-generic.src 1`] = ` Object { "body": Array [ Object { @@ -108893,7 +113325,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -108901,16 +113333,16 @@ Object { "line": 1, }, }, - "name": "f", + "name": "x", "range": Array [ 4, - 42, + 30, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -108920,13 +113352,13 @@ Object { }, "range": Array [ 5, - 42, + 30, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -108934,28 +113366,45 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "range": Array [ + 7, + 30, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "a", - "range": Array [ - 12, - 21, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { @@ -108963,130 +113412,61 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 13, - 21, + 29, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { - "column": 15, + "column": 20, "line": 1, }, }, "range": Array [ - 15, - 21, + 20, + 29, ], - "type": "TSNumberKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "b", - "optional": true, - "range": Array [ - 23, - 33, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 33, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, }, + "range": Array [ + 23, + 29, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 27, - 33, - ], - "type": "TSNumberKeyword", }, + "type": "TSConstructorType", }, - }, - ], - "range": Array [ - 7, - 42, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, + ], "range": Array [ - 35, - 42, + 12, + 30, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 42, - ], - "type": "TSVoidKeyword", - }, + "type": "TSTypeParameterInstantiation", }, - "type": "TSConstructorType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -109096,7 +113476,7 @@ Object { }, "range": Array [ 4, - 42, + 30, ], "type": "VariableDeclarator", }, @@ -109104,7 +113484,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 43, + "column": 31, "line": 1, }, "start": Object { @@ -109114,7 +113494,7 @@ Object { }, "range": Array [ 0, - 43, + 31, ], "type": "VariableDeclaration", }, @@ -109131,7 +113511,7 @@ Object { }, "range": Array [ 0, - 44, + 32, ], "sourceType": "script", "tokens": Array [ @@ -109169,7 +113549,7 @@ Object { 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { @@ -109192,7 +113572,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -109202,28 +113582,10 @@ Object { }, "range": Array [ 7, - 10, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { @@ -109240,13 +113602,13 @@ Object { 12, 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { @@ -109256,187 +113618,115 @@ Object { }, "range": Array [ 13, - 14, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 21, + 16, ], - "type": "Identifier", - "value": "number", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 18, "line": 1, }, "start": Object { - "column": 21, + "column": 17, "line": 1, }, }, "range": Array [ - 21, - 22, + 17, + 18, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - "value": "b", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 19, "line": 1, }, "start": Object { - "column": 24, + "column": 18, "line": 1, }, }, "range": Array [ - 24, - 25, + 18, + 19, ], "type": "Punctuator", - "value": "?", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 22, "line": 1, }, "start": Object { - "column": 25, + "column": 20, "line": 1, }, }, "range": Array [ - 25, - 26, + 20, + 22, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 29, "line": 1, }, "start": Object { - "column": 27, + "column": 23, "line": 1, }, }, "range": Array [ - 27, - 33, + 23, + 29, ], "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": ")", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 30, "line": 1, }, "start": Object { - "column": 35, + "column": 29, "line": 1, }, }, "range": Array [ - 35, - 37, + 29, + 30, ], "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 42, - ], - "type": "Keyword", - "value": "void", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 31, "line": 1, }, "start": Object { - "column": 42, + "column": 30, "line": 1, }, }, "range": Array [ - 42, - 43, + 30, + 31, ], "type": "Punctuator", "value": ";", @@ -109446,7 +113736,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-generic.src 1`] = ` +exports[`typescript fixtures/types/constructor-with-rest.src 1`] = ` Object { "body": Array [ Object { @@ -109455,7 +113745,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -109466,13 +113756,13 @@ Object { "name": "f", "range": Array [ 4, - 25, + 35, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -109482,13 +113772,13 @@ Object { }, "range": Array [ 5, - 25, + 35, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -109498,194 +113788,138 @@ Object { }, "params": Array [ Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 19, - ], - "type": "Identifier", - "typeAnnotation": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, + "name": "a", "range": Array [ + 15, 16, - 19, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - }, - }, - }, - ], - "range": Array [ - 7, - 25, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + "type": "Identifier", }, - }, - "range": Array [ - 21, - 25, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 26, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 26, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 24, - 25, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSConstructorType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "params": Array [ - Object { + "type": "RestElement", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 16, "line": 1, }, }, - "name": Object { + "range": Array [ + 16, + 26, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "TSNumberKeyword", + }, "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 18, "line": 1, }, }, - "name": "T", "range": Array [ - 12, - 13, + 18, + 26, ], - "type": "Identifier", + "type": "TSArrayType", }, - "range": Array [ - 12, - 13, - ], - "type": "TSTypeParameter", }, - ], + }, + ], + "range": Array [ + 7, + 35, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, "range": Array [ - 11, - 14, + 28, + 35, ], - "type": "TSTypeParameterDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSConstructorType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -109695,7 +113929,7 @@ Object { }, "range": Array [ 4, - 25, + 35, ], "type": "VariableDeclarator", }, @@ -109703,7 +113937,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { @@ -109713,7 +113947,7 @@ Object { }, "range": Array [ 0, - 26, + 36, ], "type": "VariableDeclaration", }, @@ -109730,7 +113964,7 @@ Object { }, "range": Array [ 0, - 27, + 37, ], "sourceType": "script", "tokens": Array [ @@ -109822,12 +114056,12 @@ Object { 12, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { @@ -109837,115 +114071,115 @@ Object { }, "range": Array [ 12, - 13, + 15, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { - "column": 13, + "column": 15, "line": 1, }, }, "range": Array [ - 13, - 14, + 15, + 16, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 14, + "column": 16, "line": 1, }, }, "range": Array [ - 14, - 15, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 1, }, "start": Object { - "column": 15, + "column": 18, "line": 1, }, }, "range": Array [ - 15, - 16, + 18, + 24, ], "type": "Identifier", - "value": "a", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 1, }, "start": Object { - "column": 16, + "column": 24, "line": 1, }, }, "range": Array [ - 16, - 17, + 24, + 25, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 26, "line": 1, }, "start": Object { - "column": 18, + "column": 25, "line": 1, }, }, "range": Array [ - 18, - 19, + 25, + 26, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 27, "line": 1, }, "start": Object { - "column": 19, + "column": 26, "line": 1, }, }, "range": Array [ - 19, - 20, + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -109953,17 +114187,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 30, "line": 1, }, "start": Object { - "column": 21, + "column": 28, "line": 1, }, }, "range": Array [ - 21, - 23, + 28, + 30, ], "type": "Punctuator", "value": "=>", @@ -109971,35 +114205,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { - "column": 24, + "column": 31, "line": 1, }, }, "range": Array [ - 24, - 25, + 31, + 35, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { - "column": 25, + "column": 35, "line": 1, }, }, "range": Array [ - 25, - 26, + 35, + 36, ], "type": "Punctuator", "value": ";", @@ -110009,7 +114243,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-in-generic.src 1`] = ` +exports[`typescript fixtures/types/function.src 1`] = ` Object { "body": Array [ Object { @@ -110018,7 +114252,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -110026,16 +114260,16 @@ Object { "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ 4, - 30, + 38, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -110045,13 +114279,13 @@ Object { }, "range": Array [ 5, - 30, + 38, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -110059,107 +114293,159 @@ Object { "line": 1, }, }, - "range": Array [ - 7, - 30, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - "start": Object { - "column": 7, - "line": 1, + "name": "a", + "range": Array [ + 8, + 17, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, }, }, - "name": "Array", - "range": Array [ - 7, - 12, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "name": "b", + "optional": true, + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 29, "line": 1, }, "start": Object { - "column": 13, + "column": 21, "line": 1, }, }, - "params": Array [], "range": Array [ - 13, + 21, 29, ], - "returnType": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 29, "line": 1, }, "start": Object { - "column": 20, + "column": 23, "line": 1, }, }, "range": Array [ - 20, + 23, 29, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 29, - ], - "type": "TSStringKeyword", - }, + "type": "TSNumberKeyword", }, - "type": "TSConstructorType", }, - ], + }, + ], + "range": Array [ + 7, + 38, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, "range": Array [ - 12, - 30, + 31, + 38, ], - "type": "TSTypeParameterInstantiation", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -110169,7 +114455,7 @@ Object { }, "range": Array [ 4, - 30, + 38, ], "type": "VariableDeclarator", }, @@ -110177,7 +114463,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { @@ -110187,7 +114473,7 @@ Object { }, "range": Array [ 0, - 31, + 39, ], "type": "VariableDeclaration", }, @@ -110204,7 +114490,7 @@ Object { }, "range": Array [ 0, - 32, + 40, ], "sourceType": "script", "tokens": Array [ @@ -110242,7 +114528,7 @@ Object { 5, ], "type": "Identifier", - "value": "x", + "value": "f", }, Object { "loc": Object { @@ -110265,7 +114551,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { @@ -110275,46 +114561,64 @@ Object { }, "range": Array [ 7, - 12, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, ], "type": "Identifier", - "value": "Array", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { - "column": 12, + "column": 9, "line": 1, }, }, "range": Array [ - 12, - 13, + 9, + 10, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { - "column": 13, + "column": 11, "line": 1, }, }, "range": Array [ - 13, - 16, + 11, + 17, ], - "type": "Keyword", - "value": "new", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { @@ -110332,30 +114636,30 @@ Object { 18, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { - "column": 18, + "column": 19, "line": 1, }, }, "range": Array [ - 18, 19, + 20, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 21, "line": 1, }, "start": Object { @@ -110365,10 +114669,28 @@ Object { }, "range": Array [ 20, + 21, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, 22, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { @@ -110386,7 +114708,7 @@ Object { 29, ], "type": "Identifier", - "value": "string", + "value": "number", }, Object { "loc": Object { @@ -110403,23 +114725,59 @@ Object { 29, 30, ], - "type": "Punctuator", - "value": ">", + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { - "column": 30, + "column": 38, "line": 1, }, }, "range": Array [ - 30, - 31, + 38, + 39, ], "type": "Punctuator", "value": ";", @@ -110429,7 +114787,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-with-rest.src 1`] = ` +exports[`typescript fixtures/types/function-generic.src 1`] = ` Object { "body": Array [ Object { @@ -110438,7 +114796,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -110449,13 +114807,13 @@ Object { "name": "f", "range": Array [ 4, - 35, + 21, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -110465,13 +114823,13 @@ Object { }, "range": Array [ 5, - 35, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -110481,138 +114839,194 @@ Object { }, "params": Array [ Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, + "name": "a", "range": Array [ - 12, - 26, + 11, + 15, ], - "type": "RestElement", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 16, + "column": 12, "line": 1, }, }, "range": Array [ - 16, - 26, + 12, + 15, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { - "elementType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 24, + "column": 15, "line": 1, }, "start": Object { - "column": 18, + "column": 14, "line": 1, }, }, + "name": "T", "range": Array [ - 18, - 24, + 14, + 15, ], - "type": "TSNumberKeyword", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "type": "Identifier", }, - "range": Array [ - 18, - 26, - ], - "type": "TSArrayType", }, }, }, ], "range": Array [ 7, - 35, + 21, ], "returnType": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 35, + 17, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 35, + 20, + 21, ], - "type": "TSVoidKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, }, }, - "type": "TSConstructorType", + "type": "TSFunctionType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, }, "init": null, "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -110622,7 +115036,7 @@ Object { }, "range": Array [ 4, - 35, + 21, ], "type": "VariableDeclarator", }, @@ -110630,7 +115044,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { @@ -110640,7 +115054,7 @@ Object { }, "range": Array [ 0, - 36, + 22, ], "type": "VariableDeclaration", }, @@ -110657,7 +115071,7 @@ Object { }, "range": Array [ 0, - 37, + 23, ], "sourceType": "script", "tokens": Array [ @@ -110718,7 +115132,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { @@ -110728,151 +115142,133 @@ Object { }, "range": Array [ 7, - 10, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, + 8, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { - "column": 12, + "column": 8, "line": 1, }, }, "range": Array [ - 12, - 15, + 8, + 9, ], - "type": "Punctuator", - "value": "...", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { - "column": 15, + "column": 9, "line": 1, }, }, "range": Array [ - 15, - 16, + 9, + 10, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 11, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 12, "line": 1, }, "start": Object { - "column": 18, + "column": 11, "line": 1, }, }, "range": Array [ - 18, - 24, + 11, + 12, ], "type": "Identifier", - "value": "number", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 13, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 13, ], "type": "Punctuator", - "value": "[", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 25, + "column": 14, "line": 1, }, }, "range": Array [ - 25, - 26, + 14, + 15, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 16, "line": 1, }, "start": Object { - "column": 26, + "column": 15, "line": 1, }, }, "range": Array [ - 26, - 27, + 15, + 16, ], "type": "Punctuator", "value": ")", @@ -110880,17 +115276,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 19, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 30, + 17, + 19, ], "type": "Punctuator", "value": "=>", @@ -110898,35 +115294,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 35, + 20, + 21, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { - "column": 35, + "column": 21, "line": 1, }, }, "range": Array [ - 35, - 36, + 21, + 22, ], "type": "Punctuator", "value": ";", @@ -110936,7 +115332,7 @@ Object { } `; -exports[`typescript fixtures/types/function.src 1`] = ` +exports[`typescript fixtures/types/function-in-generic.src 1`] = ` Object { "body": Array [ Object { @@ -110945,7 +115341,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -110953,16 +115349,16 @@ Object { "line": 1, }, }, - "name": "f", + "name": "x", "range": Array [ 4, - 38, + 24, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -110972,13 +115368,13 @@ Object { }, "range": Array [ 5, - 38, + 24, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -110986,159 +115382,107 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "range": Array [ + 7, + 24, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "a", - "range": Array [ - 8, - 17, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 17, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 17, - ], - "type": "TSNumberKeyword", - }, + "start": Object { + "column": 7, + "line": 1, }, }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, + "name": "Array", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, }, - "name": "b", - "optional": true, - "range": Array [ - 19, - 29, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, + "params": Array [], "range": Array [ - 21, - 29, + 13, + 23, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 23, + "column": 16, "line": 1, }, }, "range": Array [ + 16, 23, - 29, ], - "type": "TSNumberKeyword", - }, - }, - }, - ], - "range": Array [ - 7, - 38, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 34, - 38, - ], - "type": "TSVoidKeyword", - }, + ], + "range": Array [ + 12, + 24, + ], + "type": "TSTypeParameterInstantiation", }, - "type": "TSFunctionType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -111148,7 +115492,7 @@ Object { }, "range": Array [ 4, - 38, + 24, ], "type": "VariableDeclarator", }, @@ -111156,7 +115500,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 39, + "column": 25, "line": 1, }, "start": Object { @@ -111166,7 +115510,7 @@ Object { }, "range": Array [ 0, - 39, + 25, ], "type": "VariableDeclaration", }, @@ -111183,7 +115527,7 @@ Object { }, "range": Array [ 0, - 40, + 26, ], "sourceType": "script", "tokens": Array [ @@ -111221,7 +115565,7 @@ Object { 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { @@ -111244,7 +115588,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -111254,64 +115598,64 @@ Object { }, "range": Array [ 7, - 8, + 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { - "column": 8, + "column": 12, "line": 1, }, }, "range": Array [ - 8, - 9, + 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 13, "line": 1, }, }, "range": Array [ - 9, - 10, + 13, + 14, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 14, "line": 1, }, }, "range": Array [ - 11, - 17, + 14, + 15, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -111320,21 +115664,21 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 16, "line": 1, }, }, "range": Array [ - 17, + 16, 18, ], "type": "Punctuator", - "value": ",", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 23, "line": 1, }, "start": Object { @@ -111344,51 +115688,15 @@ Object { }, "range": Array [ 19, - 20, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": "?", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, + 23, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 24, "line": 1, }, "start": Object { @@ -111398,358 +115706,195 @@ Object { }, "range": Array [ 23, - 29, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, + 24, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 25, "line": 1, }, "start": Object { - "column": 31, + "column": 24, "line": 1, }, }, "range": Array [ - 31, - 33, + 24, + 25, ], "type": "Punctuator", - "value": "=>", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/function-with-array-destruction.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", }, - "range": Array [ - 34, - 38, - ], - "type": "Keyword", - "value": "void", - }, - Object { "loc": Object { "end": Object { - "column": 39, + "column": 28, "line": 1, }, "start": Object { - "column": 38, + "column": 0, "line": 1, }, }, "range": Array [ - 38, - 39, + 0, + 28, ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/function-generic.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "f", "range": Array [ - 4, - 21, + 12, + 20, ], - "type": "Identifier", + "type": "ArrayPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 5, + "column": 15, "line": 1, }, }, "range": Array [ - 5, - 21, + 15, + 20, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 11, - 15, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 15, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - }, - }, - }, - ], "range": Array [ - 7, - 21, + 17, + 20, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 21, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSFunctionType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - "range": Array [ - 8, - 9, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 7, - 10, - ], - "type": "TSTypeParameterDeclaration", - }, + "type": "TSAnyKeyword", }, }, }, - "init": null, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, "range": Array [ - 4, - 21, + 22, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "TSFunctionType", + }, }, ], "loc": Object { @@ -111764,14 +115909,14 @@ Object { }, "range": Array [ 0, - 23, + 29, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -111781,33 +115926,15 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Keyword", - "value": "let", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ 4, - 5, ], "type": "Identifier", - "value": "f", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -111817,46 +115944,10 @@ Object { }, "range": Array [ 5, - 6, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ 8, - 9, ], "type": "Identifier", - "value": "T", + "value": "foo", }, Object { "loc": Object { @@ -111874,22 +115965,22 @@ Object { 10, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, 11, + 12, ], "type": "Punctuator", "value": "(", @@ -111897,38 +115988,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, "range": Array [ - 11, 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -111945,8 +116036,8 @@ Object { 14, 15, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -111964,12 +116055,12 @@ Object { 16, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { @@ -111979,10 +116070,10 @@ Object { }, "range": Array [ 17, - 19, + 20, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { @@ -111999,213 +116090,250 @@ Object { 20, 21, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 24, "line": 1, }, "start": Object { - "column": 21, + "column": 22, "line": 1, }, }, "range": Array [ - 21, 22, + 24, ], "type": "Punctuator", - "value": ";", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", }, ], "type": "Program", } `; -exports[`typescript fixtures/types/function-in-generic.src 1`] = ` +exports[`typescript fixtures/types/function-with-object-destruction.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 24, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "x", - "range": Array [ - 4, - 24, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", }, - }, - "range": Array [ - 5, - 24, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, + "method": false, "range": Array [ - 7, - 24, + 13, + 14, ], - "type": "TSTypeReference", - "typeName": Object { + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, - "name": "Array", + "name": "a", "range": Array [ - 7, - 12, + 13, + 14, ], "type": "Identifier", }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 13, - 23, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 23, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 23, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSFunctionType", - }, - ], - "range": Array [ - 12, - 24, - ], - "type": "TSTypeParameterInstantiation", }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", }, }, }, - "init": null, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 24, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, "range": Array [ - 4, - 24, + 22, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 0, - 25, - ], - "type": "VariableDeclaration", }, ], "loc": Object { @@ -112220,14 +116348,14 @@ Object { }, "range": Array [ 0, - 26, + 29, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -112237,46 +116365,46 @@ Object { }, "range": Array [ 0, - 3, + 4, ], - "type": "Keyword", - "value": "let", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 5, "line": 1, }, }, "range": Array [ - 4, 5, + 8, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 6, + 9, + 10, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { @@ -112285,16 +116413,16 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 11, "line": 1, }, }, "range": Array [ - 7, + 11, 12, ], - "type": "Identifier", - "value": "Array", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -112312,7 +116440,7 @@ Object { 13, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { @@ -112329,8 +116457,8 @@ Object { 13, 14, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -112348,43 +116476,61 @@ Object { 15, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 18, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 20, "line": 1, }, "start": Object { - "column": 19, + "column": 17, "line": 1, }, }, "range": Array [ - 19, - 23, + 17, + 20, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -112393,34 +116539,34 @@ Object { "line": 1, }, "start": Object { - "column": 23, + "column": 22, "line": 1, }, }, "range": Array [ - 23, + 22, 24, ], "type": "Punctuator", - "value": ">", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 28, "line": 1, }, "start": Object { - "column": 24, + "column": 25, "line": 1, }, }, "range": Array [ - 24, 25, + 28, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "any", }, ], "type": "Program", diff --git a/packages/typescript-estree/tests/lib/comments.ts b/packages/typescript-estree/tests/lib/comments.ts index 1d02e2fa671..63b53ce9047 100644 --- a/packages/typescript-estree/tests/lib/comments.ts +++ b/packages/typescript-estree/tests/lib/comments.ts @@ -11,7 +11,8 @@ import { extname } from 'path'; import { ParserOptions } from '../../src/parser-options'; import { createSnapshotTestBlock, - formatSnapshotName + formatSnapshotName, + isJSXFileType } from '../../tools/test-utils'; //------------------------------------------------------------------------------ @@ -35,7 +36,7 @@ describe('Comments', () => { range: true, tokens: true, comment: true, - jsx: fileExtension === '.js' + jsx: isJSXFileType(fileExtension) }; it( formatSnapshotName(filename, FIXTURES_DIR, fileExtension), diff --git a/packages/typescript-estree/tests/lib/convert.ts b/packages/typescript-estree/tests/lib/convert.ts index ee2a44f7b7c..6fb1077a471 100644 --- a/packages/typescript-estree/tests/lib/convert.ts +++ b/packages/typescript-estree/tests/lib/convert.ts @@ -45,6 +45,30 @@ describe('convert', () => { expect((instance as any).deeplyCopy(ast.statements[0])).toMatchSnapshot(); }); + it('deeplyCopy should convert node with type arguments correctly', () => { + const ast = convertCode('new foo()'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect( + (instance as any).deeplyCopy((ast.statements[0] as any).expression) + ).toMatchSnapshot(); + }); + + it('deeplyCopy should convert array of nodes', () => { + const ast = convertCode('new foo()'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect((instance as any).deeplyCopy(ast)).toMatchSnapshot(); + }); + it('deeplyCopy should fail on unknown node', () => { const ast = convertCode('type foo = ?foo | ?(() => void)?'); diff --git a/packages/typescript-estree/tests/lib/parse.ts b/packages/typescript-estree/tests/lib/parse.ts index 2f8463cc0a2..60aee02b1a0 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -104,4 +104,37 @@ describe('parse()', () => { ); }); }); + + describe('errorOnTypeScriptSyntacticAndSemanticIssues', () => { + const code = '@test const foo = 2'; + const options: ParserOptions = { + comment: true, + tokens: true, + range: true, + loc: true, + errorOnTypeScriptSyntacticAndSemanticIssues: true + }; + + it('should throw on invalid option when used in parse', () => { + expect(() => { + parser.parse(code, options); + }).toThrow( + `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()` + ); + }); + + it('should not throw when used in parseAndGenerateServices', () => { + expect(() => { + parser.parseAndGenerateServices(code, options); + }).not.toThrow( + `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()` + ); + }); + + it('should error on invalid code', () => { + expect(() => { + parser.parseAndGenerateServices(code, options); + }).toThrow('Decorators are not valid here.'); + }); + }); }); diff --git a/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.ts b/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.ts index 8231b96185d..2cd5555bce7 100644 --- a/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.ts +++ b/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.ts @@ -8,7 +8,7 @@ import { readFileSync } from 'fs'; import glob from 'glob'; import * as parser from '../../src/parser'; import { extname } from 'path'; -import { formatSnapshotName } from '../../tools/test-utils'; +import { formatSnapshotName, isJSXFileType } from '../../tools/test-utils'; //------------------------------------------------------------------------------ // Setup @@ -30,12 +30,13 @@ describe('Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" testFiles.forEach(filename => { const code = readFileSync(filename, 'utf8'); const fileExtension = extname(filename); - const config = { + const config: parser.ParserOptions = { loc: true, range: true, tokens: true, errorOnUnknownASTType: true, - errorOnTypeScriptSyntacticAndSemanticIssues: true + errorOnTypeScriptSyntacticAndSemanticIssues: true, + jsx: isJSXFileType(fileExtension) }; it(formatSnapshotName(filename, FIXTURES_DIR, fileExtension), () => { expect.assertions(1); diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index a164288ceb0..531ab1a34d5 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -123,10 +123,10 @@ describe('semanticInfo', () => { arrayBoundName ); expect(tsArrayBoundName).toBeDefined(); - checkNumberArrayType(checker, tsArrayBoundName); + checkNumberArrayType(checker, tsArrayBoundName!); expect( - parseResult.services.tsNodeToESTreeNodeMap!.get(tsArrayBoundName) + parseResult.services.tsNodeToESTreeNodeMap!.get(tsArrayBoundName!) ).toBe(arrayBoundName); }); @@ -149,9 +149,9 @@ describe('semanticInfo', () => { ); expect(tsBoundName).toBeDefined(); - checkNumberArrayType(checker, tsBoundName); + checkNumberArrayType(checker, tsBoundName!); - expect(parseResult.services.tsNodeToESTreeNodeMap!.get(tsBoundName)).toBe( + expect(parseResult.services.tsNodeToESTreeNodeMap!.get(tsBoundName!)).toBe( boundName ); }); diff --git a/packages/typescript-estree/tests/lib/tsx.ts b/packages/typescript-estree/tests/lib/tsx.ts index 21dbbd57efe..c9409877b84 100644 --- a/packages/typescript-estree/tests/lib/tsx.ts +++ b/packages/typescript-estree/tests/lib/tsx.ts @@ -10,7 +10,8 @@ import { extname } from 'path'; import { ParserOptions } from '../../src/parser-options'; import { createSnapshotTestBlock, - formatSnapshotName + formatSnapshotName, + isJSXFileType } from '../../tools/test-utils'; //------------------------------------------------------------------------------ @@ -28,16 +29,17 @@ const testFiles = glob.sync(`${FIXTURES_DIR}/**/*.src.tsx`); describe('TSX', () => { testFiles.forEach(filename => { const code = readFileSync(filename, 'utf8'); + const fileExtension = extname(filename); const config: ParserOptions = { loc: true, range: true, tokens: true, errorOnUnknownASTType: true, useJSXTextNode: true, - jsx: true + jsx: isJSXFileType(fileExtension) }; it( - formatSnapshotName(filename, FIXTURES_DIR, extname(filename)), + formatSnapshotName(filename, FIXTURES_DIR, fileExtension), createSnapshotTestBlock(code, config) ); }); diff --git a/packages/typescript-estree/tests/lib/typescript.ts b/packages/typescript-estree/tests/lib/typescript.ts index 9740c4570e7..2ccd8cb9786 100644 --- a/packages/typescript-estree/tests/lib/typescript.ts +++ b/packages/typescript-estree/tests/lib/typescript.ts @@ -11,7 +11,8 @@ import { extname } from 'path'; import { ParserOptions } from '../../src/parser-options'; import { createSnapshotTestBlock, - formatSnapshotName + formatSnapshotName, + isJSXFileType } from '../../tools/test-utils'; //------------------------------------------------------------------------------ @@ -29,14 +30,16 @@ const testFiles = glob.sync(`${FIXTURES_DIR}/**/*.src.ts`); describe('typescript', () => { testFiles.forEach(filename => { const code = readFileSync(filename, 'utf8'); + const fileExtension = extname(filename); const config: ParserOptions = { loc: true, range: true, tokens: true, - errorOnUnknownASTType: true + errorOnUnknownASTType: true, + jsx: isJSXFileType(fileExtension) }; it( - formatSnapshotName(filename, FIXTURES_DIR, extname(filename)), + formatSnapshotName(filename, FIXTURES_DIR, fileExtension), createSnapshotTestBlock(code, config) ); }); diff --git a/packages/typescript-estree/tools/test-utils.ts b/packages/typescript-estree/tools/test-utils.ts index c2d57246ca0..d06d229a36e 100644 --- a/packages/typescript-estree/tools/test-utils.ts +++ b/packages/typescript-estree/tools/test-utils.ts @@ -80,3 +80,14 @@ export function formatSnapshotName( .replace(fixturesDir + '/', '') .replace(fileExtension, '')}`; } + +/** + * Check if file extension is one used for jsx + * @param fileType + */ +export function isJSXFileType(fileType: string): boolean { + if (fileType.startsWith('.')) { + fileType = fileType.slice(1); + } + return fileType === 'js' || fileType === 'jsx' || fileType === 'tsx'; +} diff --git a/yarn.lock b/yarn.lock index 51d8518fb37..95f575e0097 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,10 +18,10 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.0.tgz#930251fe6714df47ce540a919ccdf6dcfb652b61" - integrity sha512-8M30TzMpLHGmuthHZStm4F+az5wxyYeh8U+LWK7+b2qnlQ0anXBmOQ1I8DCMV1K981wPY3C3kWZ4SA1lR3Y3xQ== +"@babel/parser@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.2.tgz#95cdeddfc3992a6ca2a1315191c1679ca32c55cd" + integrity sha512-QzNUC2RO1gadg+fs21fi0Uu0OuGNzRKEmgCxoLNzbCdoprLwjfmZwzUrpUNfJPaVRwBpDY47A17yYEGWyRelnQ== "@commitlint/cli@^7.1.2", "@commitlint/cli@^7.3.2": version "7.3.2" @@ -816,7 +816,7 @@ "@types/estree" "*" "@types/json-schema" "*" -"@types/estree@*", "@types/estree@^0.0.39": +"@types/estree@*": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==