From 0ef07c4075049018e93592931439757ccc4cf0d0 Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Tue, 19 Mar 2019 16:37:02 -0700 Subject: [PATCH 01/16] fix(typescript-estree): only call watch callback on new files (#367) --- .eslintrc.json | 3 ++- packages/typescript-estree/src/tsconfig-parser.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e3abc256901..818b90dfab5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -25,7 +25,8 @@ "sourceType": "module", "ecmaFeatures": { "jsx": false - } + }, + "project": "./tsconfig.base.json" }, "overrides": [ { diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index c136c518c2d..135bbdfbc04 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -28,6 +28,8 @@ const knownWatchProgramMap = new Map< */ const watchCallbackTrackingMap = new Map(); +const parsedFilesSeen = new Set(); + /** * Holds information about the file currently being linted */ @@ -71,7 +73,7 @@ export function calculateProjectParserOptions( // Update file version if necessary // TODO: only update when necessary, currently marks as changed on every lint const watchCallback = watchCallbackTrackingMap.get(filePath); - if (typeof watchCallback !== 'undefined') { + if (parsedFilesSeen.has(filePath) && typeof watchCallback !== 'undefined') { watchCallback(filePath, ts.FileWatcherEventKind.Changed); } @@ -174,6 +176,7 @@ export function calculateProjectParserOptions( results.push(program); } + parsedFilesSeen.add(filePath); return results; } From 6ffaa0b02a56efce3f62e1dd8f9d9ec5478a00fd Mon Sep 17 00:00:00 2001 From: Armando Aguirre Date: Tue, 19 Mar 2019 17:01:04 -0700 Subject: [PATCH 02/16] feat(eslint-plugin): Add unified-signature rule (#178) --- packages/eslint-plugin/README.md | 1 + packages/eslint-plugin/ROADMAP.md | 3 +- .../docs/rules/unified-signatures.md | 33 + .../src/rules/unified-signatures.ts | 576 +++++++++++++++++ packages/eslint-plugin/src/util/misc.ts | 17 + .../tests/rules/unified-signatures.test.ts | 595 ++++++++++++++++++ packages/eslint-plugin/typings/ts-eslint.d.ts | 10 + 7 files changed, 1234 insertions(+), 1 deletion(-) create mode 100644 packages/eslint-plugin/docs/rules/unified-signatures.md create mode 100644 packages/eslint-plugin/src/rules/unified-signatures.ts create mode 100644 packages/eslint-plugin/tests/rules/unified-signatures.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 10268b00635..ba235a7bc63 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -152,5 +152,6 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async. (`promise-function-async` from TSLint) | :heavy_check_mark: | | | [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string. (`restrict-plus-operands` from TSLint) | | | | [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations (`typedef-whitespace` from TSLint) | :heavy_check_mark: | :wrench: | +| [`@typescript-eslint/unified-signatures`](./docs/rules/unified-signatures.md) | Warns for any two overloads that could be unified into one. (`unified-signatures` from TSLint) | | | diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index e10dc03292a..11ccb8ac22b 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -34,7 +34,7 @@ | [`promise-function-async`] | ✅ | [`@typescript-eslint/promise-function-async`] | | [`typedef`] | 🛑 | N/A | | [`typedef-whitespace`] | ✅ | [`@typescript-eslint/type-annotation-spacing`] | -| [`unified-signatures`] | 🛑 | N/A | +| [`unified-signatures`] | ✅ | [`@typescript-eslint/unified-signatures`] | ### Functionality @@ -589,6 +589,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- [`@typescript-eslint/no-unnecessary-type-assertion`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md [`@typescript-eslint/no-var-requires`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-var-requires.md [`@typescript-eslint/type-annotation-spacing`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/type-annotation-spacing.md +[`@typescript-eslint/unified-signatures`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unified-signatures.md [`@typescript-eslint/no-misused-new`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-new.md [`@typescript-eslint/no-object-literal-type-assertion`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-object-literal-type-assertion.md [`@typescript-eslint/no-this-alias`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-this-alias.md diff --git a/packages/eslint-plugin/docs/rules/unified-signatures.md b/packages/eslint-plugin/docs/rules/unified-signatures.md new file mode 100644 index 00000000000..929c82ae159 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/unified-signatures.md @@ -0,0 +1,33 @@ +# Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter. (unified-signatures) + +Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter. + +## Rule Details + +This rule aims to keep the source code as maintanable as posible by reducing the amount of overloads. + +Examples of **incorrect** code for this rule: + +```ts +function f(x: number): void; +function f(x: string): void; +``` + +```ts +f(): void; +f(...x: number[]): void; +``` + +Examples of **correct** code for this rule: + +```ts +function f(x: number | string): void; +``` + +```ts +function f(x?: ...number[]): void; +``` + +## Related to + +- TSLint: ['unified-signatures`](https://palantir.github.io/tslint/rules/unified-signatures/) diff --git a/packages/eslint-plugin/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts new file mode 100644 index 00000000000..1b54bd4217f --- /dev/null +++ b/packages/eslint-plugin/src/rules/unified-signatures.ts @@ -0,0 +1,576 @@ +import * as util from '../util'; +import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; + +interface Failure { + unify: Unify; + only2: boolean; +} + +type Unify = + | { + kind: 'single-parameter-difference'; + p0: TSESTree.Parameter; + p1: TSESTree.Parameter; + } + | { + kind: 'extra-parameter'; + extraParameter: TSESTree.Parameter; + otherSignature: SignatureDefinition; + }; + +/** + * Returns true if typeName is the name of an *outer* type parameter. + * In: `interface I { m(x: U): T }`, only `T` is an outer type parameter. + */ +type IsTypeParameter = (typeName: string) => boolean; + +type ScopeNode = + | TSESTree.Program + | TSESTree.TSModuleBlock + | TSESTree.TSInterfaceBody + | TSESTree.ClassBody + | TSESTree.TSTypeLiteral; + +type OverloadNode = MethodDefinition | SignatureDefinition; + +type SignatureDefinition = + | TSESTree.FunctionExpression + | TSESTree.TSCallSignatureDeclaration + | TSESTree.TSConstructSignatureDeclaration + | TSESTree.TSDeclareFunction + | TSESTree.TSEmptyBodyFunctionExpression + | TSESTree.TSMethodSignature; + +type MethodDefinition = + | TSESTree.MethodDefinition + | TSESTree.TSAbstractMethodDefinition; + +export default util.createRule({ + name: 'unified-signatures', + meta: { + docs: { + description: + 'Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter.', + category: 'Variables', + recommended: false, + tslintName: 'unified-signatures', + }, + type: 'suggestion', + messages: { + omittingRestParameter: '{{failureStringStart}} with a rest parameter.', + omittingSingleParameter: + '{{failureStringStart}} with an optional parameter.', + singleParameterDifference: + '{{failureStringStart}} taking `{{type1}} | {{type2}}`.', + }, + schema: [], + }, + defaultOptions: [], + create(context) { + const sourceCode = context.getSourceCode(); + + //---------------------------------------------------------------------- + // Helpers + //---------------------------------------------------------------------- + + function failureStringStart(otherLine?: number): string { + // For only 2 overloads we don't need to specify which is the other one. + const overloads = + otherLine === undefined + ? 'These overloads' + : `This overload and the one on line ${otherLine}`; + return `${overloads} can be combined into one signature`; + } + + function addFailures(failures: Failure[]): void { + for (const failure of failures) { + const { unify, only2 } = failure; + switch (unify.kind) { + case 'single-parameter-difference': { + const { p0, p1 } = unify; + const lineOfOtherOverload = only2 ? undefined : p0.loc.start.line; + + const typeAnnotation0 = isTSParameterProperty(p0) + ? p0.parameter.typeAnnotation + : p0.typeAnnotation; + const typeAnnotation1 = isTSParameterProperty(p1) + ? p1.parameter.typeAnnotation + : p1.typeAnnotation; + + context.report({ + loc: p1.loc, + messageId: 'singleParameterDifference', + data: { + failureStringStart: failureStringStart(lineOfOtherOverload), + type1: sourceCode.getText( + typeAnnotation0 && typeAnnotation0.typeAnnotation, + ), + type2: sourceCode.getText( + typeAnnotation1 && typeAnnotation1.typeAnnotation, + ), + }, + node: p1, + }); + break; + } + case 'extra-parameter': { + const { extraParameter, otherSignature } = unify; + const lineOfOtherOverload = only2 + ? undefined + : otherSignature.loc.start.line; + + context.report({ + loc: extraParameter.loc, + messageId: + extraParameter.type === AST_NODE_TYPES.RestElement + ? 'omittingRestParameter' + : 'omittingSingleParameter', + data: { + failureStringStart: failureStringStart(lineOfOtherOverload), + }, + node: extraParameter, + }); + } + } + } + } + + function checkOverloads( + signatures: ReadonlyArray, + typeParameters?: TSESTree.TSTypeParameterDeclaration, + ): Failure[] { + const result: Failure[] = []; + const isTypeParameter = getIsTypeParameter(typeParameters); + for (const overloads of signatures) { + if (overloads.length === 2) { + const signature0 = + (overloads[0] as MethodDefinition).value || overloads[0]; + const signature1 = + (overloads[1] as MethodDefinition).value || overloads[1]; + + const unify = compareSignatures( + signature0, + signature1, + isTypeParameter, + ); + if (unify !== undefined) { + result.push({ unify, only2: true }); + } + } else { + forEachPair(overloads, (a, b) => { + const signature0 = (a as MethodDefinition).value || a; + const signature1 = (b as MethodDefinition).value || b; + + const unify = compareSignatures( + signature0, + signature1, + isTypeParameter, + ); + if (unify !== undefined) { + result.push({ unify, only2: false }); + } + }); + } + } + return result; + } + + function compareSignatures( + a: SignatureDefinition, + b: SignatureDefinition, + isTypeParameter: IsTypeParameter, + ): Unify | undefined { + if (!signaturesCanBeUnified(a, b, isTypeParameter)) { + return undefined; + } + + return a.params.length === b.params.length + ? signaturesDifferBySingleParameter(a.params, b.params) + : signaturesDifferByOptionalOrRestParameter(a, b); + } + + function signaturesCanBeUnified( + a: SignatureDefinition, + b: SignatureDefinition, + isTypeParameter: IsTypeParameter, + ): boolean { + // Must return the same type. + + const aTypeParams = + a.typeParameters !== undefined ? a.typeParameters.params : undefined; + const bTypeParams = + b.typeParameters !== undefined ? b.typeParameters.params : undefined; + + return ( + typesAreEqual(a.returnType, b.returnType) && + // Must take the same type parameters. + // If one uses a type parameter (from outside) and the other doesn't, they shouldn't be joined. + util.arraysAreEqual(aTypeParams, bTypeParams, typeParametersAreEqual) && + signatureUsesTypeParameter(a, isTypeParameter) === + signatureUsesTypeParameter(b, isTypeParameter) + ); + } + + /** Detect `a(x: number, y: number, z: number)` and `a(x: number, y: string, z: number)`. */ + function signaturesDifferBySingleParameter( + types1: ReadonlyArray, + types2: ReadonlyArray, + ): Unify | undefined { + const index = getIndexOfFirstDifference( + types1, + types2, + parametersAreEqual, + ); + if (index === undefined) { + return undefined; + } + + // If remaining arrays are equal, the signatures differ by just one parameter type + if ( + !util.arraysAreEqual( + types1.slice(index + 1), + types2.slice(index + 1), + parametersAreEqual, + ) + ) { + return undefined; + } + + const a = types1[index]; + const b = types2[index]; + // Can unify `a?: string` and `b?: number`. Can't unify `...args: string[]` and `...args: number[]`. + // See https://github.com/Microsoft/TypeScript/issues/5077 + return parametersHaveEqualSigils(a, b) && + a.type !== AST_NODE_TYPES.RestElement + ? { kind: 'single-parameter-difference', p0: a, p1: b } + : undefined; + } + + /** + * Detect `a(): void` and `a(x: number): void`. + * Returns the parameter declaration (`x: number` in this example) that should be optional/rest, and overload it's a part of. + */ + function signaturesDifferByOptionalOrRestParameter( + a: SignatureDefinition, + b: SignatureDefinition, + ): Unify | undefined { + const sig1 = a.params; + const sig2 = b.params; + + const minLength = Math.min(sig1.length, sig2.length); + const longer = sig1.length < sig2.length ? sig2 : sig1; + const shorter = sig1.length < sig2.length ? sig1 : sig2; + const shorterSig = sig1.length < sig2.length ? a : b; + + // If one is has 2+ parameters more than the other, they must all be optional/rest. + // Differ by optional parameters: f() and f(x), f() and f(x, ?y, ...z) + // Not allowed: f() and f(x, y) + for (let i = minLength + 1; i < longer.length; i++) { + if (!parameterMayBeMissing(longer[i])) { + return undefined; + } + } + + for (let i = 0; i < minLength; i++) { + const sig1i = sig1[i]; + const sig2i = sig2[i]; + const typeAnnotation1 = isTSParameterProperty(sig1i) + ? sig1i.parameter.typeAnnotation + : sig1i.typeAnnotation; + const typeAnnotation2 = isTSParameterProperty(sig2i) + ? sig2i.parameter.typeAnnotation + : sig2i.typeAnnotation; + + if (!typesAreEqual(typeAnnotation1, typeAnnotation2)) { + return undefined; + } + } + + if ( + minLength > 0 && + shorter[minLength - 1].type === AST_NODE_TYPES.RestElement + ) { + return undefined; + } + + return { + extraParameter: longer[longer.length - 1], + kind: 'extra-parameter', + otherSignature: shorterSig, + }; + } + + /** Given type parameters, returns a function to test whether a type is one of those parameters. */ + function getIsTypeParameter( + typeParameters?: TSESTree.TSTypeParameterDeclaration, + ): IsTypeParameter { + if (typeParameters === undefined) { + return () => false; + } + + const set = new Set(); + for (const t of typeParameters.params) { + set.add(t.name.name); + } + return typeName => set.has(typeName); + } + + /** True if any of the outer type parameters are used in a signature. */ + function signatureUsesTypeParameter( + sig: SignatureDefinition, + isTypeParameter: IsTypeParameter, + ): boolean { + return sig.params.some((p: TSESTree.Parameter) => + typeContainsTypeParameter( + isTSParameterProperty(p) + ? p.parameter.typeAnnotation + : p.typeAnnotation, + ), + ); + + function typeContainsTypeParameter( + type?: TSESTree.TSTypeAnnotation | TSESTree.TypeNode, + ): boolean { + if (!type) { + return false; + } + + if (type.type === AST_NODE_TYPES.TSTypeReference) { + const typeName = type.typeName; + if (isIdentifier(typeName) && isTypeParameter(typeName.name)) { + return true; + } + } + + return typeContainsTypeParameter( + (type as TSESTree.TSTypeAnnotation).typeAnnotation || + (type as TSESTree.TSArrayType).elementType, + ); + } + } + + function isTSParameterProperty( + node: TSESTree.Node, + ): node is TSESTree.TSParameterProperty { + return ( + (node as TSESTree.TSParameterProperty).type === + AST_NODE_TYPES.TSParameterProperty + ); + } + + function parametersAreEqual( + a: TSESTree.Parameter, + b: TSESTree.Parameter, + ): boolean { + const typeAnnotationA = isTSParameterProperty(a) + ? a.parameter.typeAnnotation + : a.typeAnnotation; + const typeAnnotationB = isTSParameterProperty(b) + ? b.parameter.typeAnnotation + : b.typeAnnotation; + + return ( + parametersHaveEqualSigils(a, b) && + typesAreEqual(typeAnnotationA, typeAnnotationB) + ); + } + + /** True for optional/rest parameters. */ + function parameterMayBeMissing(p: TSESTree.Parameter): boolean | undefined { + const optional = isTSParameterProperty(p) + ? p.parameter.optional + : p.optional; + + return p.type === AST_NODE_TYPES.RestElement || optional; + } + + /** False if one is optional and the other isn't, or one is a rest parameter and the other isn't. */ + function parametersHaveEqualSigils( + a: TSESTree.Parameter, + b: TSESTree.Parameter, + ): boolean { + const optionalA = isTSParameterProperty(a) + ? a.parameter.optional + : a.optional; + const optionalB = isTSParameterProperty(b) + ? b.parameter.optional + : b.optional; + + return ( + (a.type === AST_NODE_TYPES.RestElement) === + (b.type === AST_NODE_TYPES.RestElement) && + (optionalA !== undefined) === (optionalB !== undefined) + ); + } + + function typeParametersAreEqual( + a: TSESTree.TSTypeParameter, + b: TSESTree.TSTypeParameter, + ): boolean { + return ( + a.name.name === b.name.name && + constraintsAreEqual(a.constraint, b.constraint) + ); + } + + function typesAreEqual( + a: TSESTree.TSTypeAnnotation | undefined, + b: TSESTree.TSTypeAnnotation | undefined, + ): boolean { + return ( + a === b || + (a !== undefined && + b !== undefined && + a.typeAnnotation.type === b.typeAnnotation.type) + ); + } + + function constraintsAreEqual( + a: TSESTree.TypeNode | undefined, + b: TSESTree.TypeNode | undefined, + ): boolean { + return ( + a === b || (a !== undefined && b !== undefined && a.type === b.type) + ); + } + + /* Returns the first index where `a` and `b` differ. */ + function getIndexOfFirstDifference( + a: ReadonlyArray, + b: ReadonlyArray, + equal: util.Equal, + ): number | undefined { + for (let i = 0; i < a.length && i < b.length; i++) { + if (!equal(a[i], b[i])) { + return i; + } + } + return undefined; + } + + /** Calls `action` for every pair of values in `values`. */ + function forEachPair( + values: ReadonlyArray, + action: (a: T, b: T) => void, + ): void { + for (let i = 0; i < values.length; i++) { + for (let j = i + 1; j < values.length; j++) { + action(values[i], values[j]); + } + } + } + + interface Scope { + overloads: Map; + parent?: ScopeNode; + typeParameters?: TSESTree.TSTypeParameterDeclaration; + } + + const scopes: Scope[] = []; + let currentScope: Scope = { + overloads: new Map(), + }; + + function createScope( + parent: ScopeNode, + typeParameters?: TSESTree.TSTypeParameterDeclaration, + ) { + currentScope && scopes.push(currentScope); + currentScope = { + overloads: new Map(), + parent, + typeParameters, + }; + } + + function checkScope() { + const failures = checkOverloads( + Array.from(currentScope.overloads.values()), + currentScope.typeParameters, + ); + addFailures(failures); + currentScope = scopes.pop()!; + } + + function addOverload(signature: OverloadNode, key?: string) { + key = key || getOverloadKey(signature); + if (currentScope && signature.parent === currentScope.parent && key) { + const overloads = currentScope.overloads.get(key); + if (overloads !== undefined) { + overloads.push(signature); + } else { + currentScope.overloads.set(key, [signature]); + } + } + } + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + Program: createScope, + TSModuleBlock: createScope, + TSInterfaceDeclaration(node) { + createScope(node.body, node.typeParameters); + }, + ClassDeclaration(node) { + createScope(node.body, node.typeParameters); + }, + TSTypeLiteral: createScope, + // collect overloads + TSDeclareFunction(node) { + if (node.id && !node.body) { + addOverload(node, node.id.name); + } + }, + TSCallSignatureDeclaration: addOverload, + TSConstructSignatureDeclaration: addOverload, + TSMethodSignature: addOverload, + TSAbstractMethodDefinition(node) { + if (!node.value.body) { + addOverload(node); + } + }, + MethodDefinition(node) { + if (!node.value.body) { + addOverload(node); + } + }, + // validate scopes + 'Program:exit': checkScope, + 'TSModuleBlock:exit': checkScope, + 'TSInterfaceDeclaration:exit': checkScope, + 'ClassDeclaration:exit': checkScope, + 'TSTypeLiteral:exit': checkScope, + }; + }, +}); + +function getOverloadKey(node: OverloadNode): string | undefined { + const info = getOverloadInfo(node); + + return ( + ((node as MethodDefinition).computed ? '0' : '1') + + ((node as MethodDefinition).static ? '0' : '1') + + info + ); +} + +function getOverloadInfo(node: OverloadNode): string { + switch (node.type) { + case AST_NODE_TYPES.TSConstructSignatureDeclaration: + return 'constructor'; + case AST_NODE_TYPES.TSCallSignatureDeclaration: + return '()'; + default: { + const { key } = node as MethodDefinition; + + return isIdentifier(key) ? key.name : (key as TSESTree.Literal).raw; + } + } +} + +function isIdentifier(node: TSESTree.Node): node is TSESTree.Identifier { + return node.type === AST_NODE_TYPES.Identifier; +} diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index ab56cd4e694..4e3d34937f9 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -65,6 +65,23 @@ export function getNameFromPropertyName( return `${propertyName.value}`; } +/** Return true if both parameters are equal. */ +export type Equal = (a: T, b: T) => boolean; + +export function arraysAreEqual( + a: T[] | undefined, + b: T[] | undefined, + eq: (a: T, b: T) => boolean, +): boolean { + return ( + a === b || + (a !== undefined && + b !== undefined && + a.length === b.length && + a.every((x, idx) => eq(x, b[idx]))) + ); +} + /** * Gets a string name representation of the name of the given MethodDefinition * or ClassProperty node, with handling for computed property names. diff --git a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts new file mode 100644 index 00000000000..94b6520de81 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts @@ -0,0 +1,595 @@ +import rule from '../../src/rules/unified-signatures'; +import { RuleTester } from '../RuleTester'; + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +var ruleTester = new RuleTester({ parser: '@typescript-eslint/parser' }); + +ruleTester.run('unified-signatures', rule, { + valid: [ + ` +function g(): void; +function g(a: number, b: number): void; +function g(a?: number, b?: number): void {} + `, + ` +function rest(...xs: number[]): void; +function rest(xs: number[], y: string): void; +function rest(...args: any[]) {} +`, + ` +class C { + constructor(); + constructor(a: number, b: number); + constructor(a?: number, b?: number) {} + + a(): void; + a(a: number, b: number): void; + a(a?: number, b?: number): void {} +} +`, + // No error for arity difference greater than 1. + ` +interface I { + a2(): void; + a2(x: number, y: number): void; +} +`, + // No error for different return types. + ` +interface I { + a4(): void; + a4(x: number): number; +} +`, + // No error if one takes a type parameter and the other doesn't. + ` +interface I { + a5(x: T): T; + a5(x: number): number; +} +`, + // No error if one is a rest parameter and other isn't. + ` +interface I { + b2(x: string): void; + b2(...x: number[]): void; +} +`, + // No error if both are rest parameters. (https://github.com/Microsoft/TypeScript/issues/5077) + ` +interface I { + b3(...x: number[]): void; + b3(...x: string[]): void; +} +`, + // No error if one is optional and the other isn't. + ` +interface I { + c3(x: number): void; + c3(x?: string): void; +} +`, + // No error if they differ by 2 or more parameters. + ` +interface I { + d2(x: string, y: number): void; + d2(x: number, y: string): void; +} +`, + // No conflict between static/non-static members. + ` +declare class D { + static a(); + a(x: number); +} +`, + // Allow separate overloads if one is generic and the other isn't. + ` +interface Generic { + x(): void; + x(x: T[]): void; +} +`, + // Allow signatures if the type is not equal. + ` +interface I { + f(x1:number): void; + f(x1:boolean, x2?: number): void; +} +`, + // AllowType parameters that are not equal + ` +function f(x: T[]): void; +function f(x: T): void; + `, + ], + invalid: [ + { + code: ` +function f(x: number): void; +function f(x: string): void; +function f(x: any): any { + return x; +} +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'number', + type2: 'string', + }, + line: 3, + column: 12, + }, + ], + }, + { + code: ` +function opt(xs?: number[]): void; +function opt(xs: number[], y: string): void; +function opt(...args: any[]) {} +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 3, + column: 28, + }, + ], + }, + { + // For 3 or more overloads, mentions the line. + code: ` +interface I { + a0(): void; + a0(x: string): string; + a0(x: number): void; +} +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'This overload and the one on line 3 can be combined into one signature', + }, + line: 5, + column: 8, + }, + ], + }, + { + // Error for extra parameter. + code: ` +interface I { + a1(): void; + a1(x: number): void; +} +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 4, + column: 8, + }, + ], + }, + { + // Error for arity difference greater than 1 if the additional parameters are all optional/rest. + code: ` +interface I { + a3(): void; + a3(x: number, y?: number, ...z: number[]): void; +} +`, + errors: [ + { + messageId: 'omittingRestParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 4, + column: 31, + }, + ], + }, + { + // Error if only one defines a rest parameter. + code: ` +interface I { + b(): void; + b(...x: number[]): void; +} +`, + errors: [ + { + messageId: 'omittingRestParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 4, + column: 7, + }, + ], + }, + { + // Error if only one defines an optional parameter. + code: ` +interface I { + c(): void; + c(x?: number): void; +} +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 4, + column: 7, + }, + ], + }, + { + // Error if both are optional. + code: ` +interface I { + c2(x?: number): void; + c2(x?: string): void; +} +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'number', + type2: 'string', + }, + line: 4, + column: 8, + }, + ], + }, + { + // Error for different types (could be a union) + code: ` +interface I { + d(x: number): void; + d(x: string): void; +} +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'number', + type2: 'string', + }, + line: 4, + column: 7, + }, + ], + }, + { + // Works for type literal and call signature too. + code: ` +type T = { + (): void; + (x: number): void; +} +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 4, + column: 6, + }, + ], + }, + { + // Works for constructor. + code: ` +declare class C { + constructor(); + constructor(x: number); +} +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 4, + column: 17, + }, + ], + }, + { + // Works with unions. + code: ` +interface I { + f(x: number); + f(x: string | boolean); +} +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'number', + type2: 'string | boolean', + }, + line: 4, + column: 7, + }, + ], + }, + { + // Works with tuples. + code: ` +interface I { + f(x: number); + f(x: [string, boolean]); +} +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'number', + type2: '[string, boolean]', + }, + line: 4, + column: 7, + }, + ], + }, + { + code: ` +interface Generic { + y(x: T[]): void; + y(x: T): void; +} +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'T[]', + type2: 'T', + }, + line: 4, + column: 7, + }, + ], + }, + { + // Check type parameters when equal + code: ` +function f(x: T[]): void; +function f(x: T): void; +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'T[]', + type2: 'T', + }, + line: 3, + column: 15, + }, + ], + }, + { + // Verifies type parameters and constraints + code: ` +function f(x: T[]): void; +function f(x: T): void; +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'T[]', + type2: 'T', + }, + line: 3, + column: 30, + }, + ], + }, + { + // Works with abstract + code: ` +abstract class Foo { + public abstract f(x: number): void; + public abstract f(x: string): void; +} +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'number', + type2: 'string', + }, + line: 4, + column: 23, + }, + ], + }, + { + // Works with literals + code: ` +interface Foo { + "f"(x: string): void; + "f"(x: number): void; +} +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'string', + type2: 'number', + }, + line: 4, + column: 9, + }, + ], + }, + { + // Works with new constructor + code: ` +interface Foo { + new(x: string): Foo; + new(x: number): Foo; +} +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'string', + type2: 'number', + }, + line: 4, + column: 9, + }, + ], + }, + { + // Works with new computed properties + code: ` +enum Enum { + Func = "function", +} + +interface IFoo { + [Enum.Func](x: string): void; + [Enum.Func](x: number): void; +} +`, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'string', + type2: 'number', + }, + line: 8, + column: 17, + }, + ], + }, + { + // Works with parameter properties. Note that this is invalid TypeScript syntax. + code: ` +class Foo { + constructor(readonly x: number); + constructor(readonly x: string); +} + `, + errors: [ + { + messageId: 'singleParameterDifference', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'number', + type2: 'string', + }, + line: 4, + column: 17, + }, + ], + }, + { + // Works with parameter properties. Note that this is invalid TypeScript syntax. + code: ` +class Foo { + constructor(readonly x: number); + constructor(readonly x: number, readonly y: string); +} +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 4, + column: 37, + }, + ], + }, + { + // Works with parameter properties. Note that this is invalid TypeScript syntax. + code: ` +class Foo { + constructor(readonly x: number); + constructor(readonly x: number, readonly y?: string, readonly z?: string); +} +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 4, + column: 58, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/typings/ts-eslint.d.ts b/packages/eslint-plugin/typings/ts-eslint.d.ts index b757a1b5982..33b667dab46 100644 --- a/packages/eslint-plugin/typings/ts-eslint.d.ts +++ b/packages/eslint-plugin/typings/ts-eslint.d.ts @@ -473,14 +473,24 @@ declare module 'ts-eslint' { Token?: RuleFunction; TryStatement?: RuleFunction; TSAbstractKeyword?: RuleFunction; + TSAbstractMethodDefinition?: RuleFunction< + TSESTree.TSAbstractMethodDefinition + >; TSAnyKeyword?: RuleFunction; TSArrayType?: RuleFunction; TSAsExpression?: RuleFunction; TSAsyncKeyword?: RuleFunction; TSBigIntKeyword?: RuleFunction; TSBooleanKeyword?: RuleFunction; + TSCallSignatureDeclaration?: RuleFunction< + TSESTree.TSCallSignatureDeclaration + >; TSConditionalType?: RuleFunction; + TSConstructSignatureDeclaration?: RuleFunction< + TSESTree.TSConstructSignatureDeclaration + >; TSDeclareKeyword?: RuleFunction; + TSDeclareFunction?: RuleFunction; TSEnumDeclaration?: RuleFunction; TSEnumMember?: RuleFunction; TSExportAssignment?: RuleFunction; From 0a5146b7ed1b3987dbbca1589515bb27be1d770b Mon Sep 17 00:00:00 2001 From: claneo Date: Thu, 21 Mar 2019 00:52:25 +0800 Subject: [PATCH 03/16] fix(eslint-plugin): fix incorrect rule name (#357) --- packages/eslint-plugin/src/rules/camelcase.ts | 2 +- .../eslint-plugin/src/rules/no-object-literal-type-assertion.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/src/rules/camelcase.ts b/packages/eslint-plugin/src/rules/camelcase.ts index 009ba186aa1..ec7ba9ea4fe 100644 --- a/packages/eslint-plugin/src/rules/camelcase.ts +++ b/packages/eslint-plugin/src/rules/camelcase.ts @@ -6,7 +6,7 @@ type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; export default util.createRule({ - name: 'ban-types', + name: 'camelcase', meta: { type: 'suggestion', docs: { diff --git a/packages/eslint-plugin/src/rules/no-object-literal-type-assertion.ts b/packages/eslint-plugin/src/rules/no-object-literal-type-assertion.ts index a5e6e6788c9..55c91ac6e51 100644 --- a/packages/eslint-plugin/src/rules/no-object-literal-type-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-object-literal-type-assertion.ts @@ -9,7 +9,7 @@ type Options = [ type MessageIds = 'unexpectedTypeAssertion'; export default util.createRule({ - name: 'no-object-literal-type-assertions', + name: 'no-object-literal-type-assertion', meta: { type: 'problem', docs: { From c7db5942054e52d8e2cef3be662d98ffe3cc6454 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 20 Mar 2019 11:44:15 -0700 Subject: [PATCH 04/16] chore: publish v1.5.0 --- CHANGELOG.md | 13 +++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 4 ++++ packages/eslint-plugin-tslint/package.json | 4 ++-- packages/eslint-plugin/CHANGELOG.md | 12 ++++++++++++ packages/eslint-plugin/package.json | 6 +++--- packages/parser/CHANGELOG.md | 4 ++++ packages/parser/package.json | 6 +++--- packages/shared-fixtures/CHANGELOG.md | 8 ++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 7 +++++++ packages/typescript-estree/package.json | 4 ++-- 12 files changed, 60 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19e950868dc..f2067d136e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) + +### Bug Fixes + +- **eslint-plugin:** [interface-name-prefix] correct error message in always mode ([#333](https://github.com/typescript-eslint/typescript-eslint/issues/333)) ([097262f](https://github.com/typescript-eslint/typescript-eslint/commit/097262f)) +- **eslint-plugin:** fix false positives for adjacent-overload-signatures regarding computed property names ([#340](https://github.com/typescript-eslint/typescript-eslint/issues/340)) ([f6e5118](https://github.com/typescript-eslint/typescript-eslint/commit/f6e5118)) +- **eslint-plugin:** fix incorrect rule name ([#357](https://github.com/typescript-eslint/typescript-eslint/issues/357)) ([0a5146b](https://github.com/typescript-eslint/typescript-eslint/commit/0a5146b)) +- **typescript-estree:** only call watch callback on new files ([#367](https://github.com/typescript-eslint/typescript-eslint/issues/367)) ([0ef07c4](https://github.com/typescript-eslint/typescript-eslint/commit/0ef07c4)) + +### Features + +- **eslint-plugin:** Add unified-signature rule ([#178](https://github.com/typescript-eslint/typescript-eslint/issues/178)) ([6ffaa0b](https://github.com/typescript-eslint/typescript-eslint/commit/6ffaa0b)) + ## [1.4.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.1...v1.4.2) (2019-02-25) ### Bug Fixes diff --git a/lerna.json b/lerna.json index 06b203850da..b4a4a814bd4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.4.2", + "version": "1.5.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index eaa8acd6892..0dfa48c6dcb 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + ## [1.4.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.1...v1.4.2) (2019-02-25) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 955573693fe..744391c0224 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "1.4.2", + "version": "1.5.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -35,6 +35,6 @@ "devDependencies": { "@types/eslint": "^4.16.3", "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "1.4.2" + "@typescript-eslint/parser": "1.5.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index c4c8d82eb58..fa1ee2e2d49 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) + +### Bug Fixes + +- **eslint-plugin:** [interface-name-prefix] correct error message in always mode ([#333](https://github.com/typescript-eslint/typescript-eslint/issues/333)) ([097262f](https://github.com/typescript-eslint/typescript-eslint/commit/097262f)) +- **eslint-plugin:** fix false positives for adjacent-overload-signatures regarding computed property names ([#340](https://github.com/typescript-eslint/typescript-eslint/issues/340)) ([f6e5118](https://github.com/typescript-eslint/typescript-eslint/commit/f6e5118)) +- **eslint-plugin:** fix incorrect rule name ([#357](https://github.com/typescript-eslint/typescript-eslint/issues/357)) ([0a5146b](https://github.com/typescript-eslint/typescript-eslint/commit/0a5146b)) + +### Features + +- **eslint-plugin:** Add unified-signature rule ([#178](https://github.com/typescript-eslint/typescript-eslint/issues/178)) ([6ffaa0b](https://github.com/typescript-eslint/typescript-eslint/commit/6ffaa0b)) + ## [1.4.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.1...v1.4.2) (2019-02-25) **Note:** Version bump only for package @typescript-eslint/eslint-plugin diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 95c90865e32..7b96d677e1f 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "1.4.2", + "version": "1.5.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -35,8 +35,8 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/parser": "1.4.2", - "@typescript-eslint/typescript-estree": "1.4.2", + "@typescript-eslint/parser": "1.5.0", + "@typescript-eslint/typescript-estree": "1.5.0", "requireindex": "^1.2.0", "tsutils": "^3.7.0" }, diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 30591e33637..fa1e9998cc9 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) + +**Note:** Version bump only for package @typescript-eslint/parser + ## [1.4.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.1...v1.4.2) (2019-02-25) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 78dcd57c077..fd4313e33c0 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "1.4.2", + "version": "1.5.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "files": [ @@ -37,13 +37,13 @@ "typescript": "*" }, "dependencies": { - "@typescript-eslint/typescript-estree": "1.4.2", + "@typescript-eslint/typescript-estree": "1.5.0", "eslint-scope": "^4.0.0", "eslint-visitor-keys": "^1.0.0" }, "devDependencies": { "@types/eslint": "^4.16.5", "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/shared-fixtures": "1.4.2" + "@typescript-eslint/shared-fixtures": "1.5.0" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 61c52cc2bd9..0643583ced5 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + ## [1.4.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.1...v1.4.2) (2019-02-25) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index ce8b8ae975f..f6df565d711 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "1.4.2", + "version": "1.5.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 9326f0eb6c9..4195b359e3d 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) + +### Bug Fixes + +- **eslint-plugin:** fix false positives for adjacent-overload-signatures regarding computed property names ([#340](https://github.com/typescript-eslint/typescript-eslint/issues/340)) ([f6e5118](https://github.com/typescript-eslint/typescript-eslint/commit/f6e5118)) +- **typescript-estree:** only call watch callback on new files ([#367](https://github.com/typescript-eslint/typescript-eslint/issues/367)) ([0ef07c4](https://github.com/typescript-eslint/typescript-eslint/commit/0ef07c4)) + ## [1.4.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.1...v1.4.2) (2019-02-25) **Note:** Version bump only for package @typescript-eslint/typescript-estree diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 23188c301b9..69a07ac4f19 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "1.4.2", + "version": "1.5.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -44,6 +44,6 @@ }, "devDependencies": { "@babel/types": "^7.3.2", - "@typescript-eslint/shared-fixtures": "1.4.2" + "@typescript-eslint/shared-fixtures": "1.5.0" } } From bea6b92596942f551fedecf4d1fcc8551d103644 Mon Sep 17 00:00:00 2001 From: Gilbert Gilb's Date: Thu, 21 Mar 2019 03:47:53 +0100 Subject: [PATCH 05/16] feat(eslint-plugin): allow explicit variable type with arrow functions (#260) Fixes #149 Not sure if this is really acceptable though. Please tell me if it has some edge cases I didn't see or if it's just too broad. --- .../rules/explicit-function-return-type.md | 14 ++++++ .../rules/explicit-function-return-type.ts | 44 ++++++++++++++---- .../explicit-function-return-type.test.ts | 46 +++++++++++++++++++ 3 files changed, 95 insertions(+), 9 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index fb8ad9a7ffc..e63d3d351a2 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -84,6 +84,20 @@ node.addEventListener('click', function() {}); const foo = arr.map(i => i * i); ``` +### allowTypedFunctionExpressions + +Examples of additional **correct** code for this rule with `{ allowTypedFunctionExpressions: true }`: + +```ts +type FuncType = () => string; + +let arrowFn: FuncType = () => 'test'; + +let funcExpr: FuncType = function() { + return 'test'; +}; +``` + ## When Not To Use It If you don't wish to prevent calling code from using function return values in unexpected ways, then diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index e4f5dd46a3c..d767959c29f 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -4,6 +4,7 @@ import * as util from '../util'; type Options = [ { allowExpressions?: boolean; + allowTypedFunctionExpressions?: boolean; } ]; type MessageIds = 'missingReturnType'; @@ -28,6 +29,9 @@ export default util.createRule({ allowExpressions: { type: 'boolean', }, + allowTypedFunctionExpressions: { + type: 'boolean', + }, }, additionalProperties: false, }, @@ -36,27 +40,41 @@ export default util.createRule({ defaultOptions: [ { allowExpressions: true, + allowTypedFunctionExpressions: false, }, ], create(context, [options]) { /** - * Checks if the parent of a function expression is a constructor. - * @param parent The parent of a function expression node + * Checks if a node is a constructor. + * @param node The node to check + */ + function isConstructor(node: TSESTree.Node): boolean { + return ( + node.type === AST_NODE_TYPES.MethodDefinition && + node.kind === 'constructor' + ); + } + + /** + * Checks if a node is a setter. + * @param parent The node to check */ - function isConstructor(parent: TSESTree.Node): boolean { + function isSetter(node: TSESTree.Node): boolean { return ( - parent.type === AST_NODE_TYPES.MethodDefinition && - parent.kind === 'constructor' + node.type === AST_NODE_TYPES.MethodDefinition && node.kind === 'set' ); } /** - * Checks if the parent of a function expression is a setter. - * @param parent The parent of a function expression node + * Checks if a node is a variable declarator with a type annotation. + * @param node The node to check */ - function isSetter(parent: TSESTree.Node): boolean { + function isVariableDeclaratorWithTypeAnnotation( + node: TSESTree.Node, + ): boolean { return ( - parent.type === AST_NODE_TYPES.MethodDefinition && parent.kind === 'set' + node.type === AST_NODE_TYPES.VariableDeclarator && + !!node.id.typeAnnotation ); } @@ -103,6 +121,14 @@ export default util.createRule({ return; } + if ( + options.allowTypedFunctionExpressions && + node.parent && + isVariableDeclaratorWithTypeAnnotation(node.parent) + ) { + return; + } + checkFunctionReturnType(node); } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 0abc6000f18..932e50e9714 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -92,6 +92,28 @@ function test() { }, ], }, + { + filename: 'test.ts', + code: ` +var arrowFn: Foo = () => 'test'; + `, + options: [ + { + allowTypedFunctionExpressions: true, + }, + ], + }, + { + filename: 'test.ts', + code: ` +var funcExpr: Foo = function() { return 'test'; }; + `, + options: [ + { + allowTypedFunctionExpressions: true, + }, + ], + }, ], invalid: [ { @@ -188,5 +210,29 @@ class Test { }, ], }, + { + filename: 'test.ts', + code: `var arrowFn = () => 'test';`, + options: [{ allowTypedFunctionExpressions: true }], + errors: [ + { + messageId: 'missingReturnType', + line: 1, + column: 15, + }, + ], + }, + { + filename: 'test.ts', + code: `var funcExpr = function() { return 'test'; };`, + options: [{ allowTypedFunctionExpressions: true }], + errors: [ + { + messageId: 'missingReturnType', + line: 1, + column: 16, + }, + ], + }, ], }); From ad0f2bea46edd7c022772d8804adcaf6f1fc2c03 Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Wed, 27 Mar 2019 09:09:05 -0700 Subject: [PATCH 06/16] fix(eslint-plugin): member-naming false flagging constructors (#376) Fixes #359 --- packages/eslint-plugin/docs/rules/member-naming.md | 4 +++- packages/eslint-plugin/src/rules/member-naming.ts | 3 +++ packages/eslint-plugin/tests/rules/member-naming.test.ts | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/member-naming.md b/packages/eslint-plugin/docs/rules/member-naming.md index 04c9e882c10..0d66a9f466c 100644 --- a/packages/eslint-plugin/docs/rules/member-naming.md +++ b/packages/eslint-plugin/docs/rules/member-naming.md @@ -4,7 +4,9 @@ It can be helpful to enforce naming conventions for `private` (and sometimes `pr ## Rule Details -This rule allows you to enforce conventions for class property names by their visibility. By default, it enforces nothing. +This rule allows you to enforce conventions for class property and method names by their visibility. By default, it enforces nothing. + +> Note: constructors are explicitly ignored regardless of the the regular expression options provided ## Options diff --git a/packages/eslint-plugin/src/rules/member-naming.ts b/packages/eslint-plugin/src/rules/member-naming.ts index 2efdf6ea307..1e6fcdd226e 100644 --- a/packages/eslint-plugin/src/rules/member-naming.ts +++ b/packages/eslint-plugin/src/rules/member-naming.ts @@ -75,6 +75,9 @@ export default util.createRule({ const accessibility: Modifiers = node.accessibility || 'public'; const convention = conventions[accessibility]; + const method = node as TSESTree.MethodDefinition; + if (method.kind === 'constructor') return; + if (!convention || convention.test(name)) return; context.report({ diff --git a/packages/eslint-plugin/tests/rules/member-naming.test.ts b/packages/eslint-plugin/tests/rules/member-naming.test.ts index c826600714b..96ec4b104f3 100644 --- a/packages/eslint-plugin/tests/rules/member-naming.test.ts +++ b/packages/eslint-plugin/tests/rules/member-naming.test.ts @@ -11,6 +11,14 @@ ruleTester.run('member-naming', rule, { code: `class Class { _fooBar() {} }`, options: [{ public: '^_' }], }, + { + code: `class Class { private constructor(); _fooBar() {} }`, + options: [{ private: '^_' }], + }, + { + code: `class Class { constructor() {}; _fooBar() {} }`, + options: [{ public: '^_' }], + }, { code: `class Class { public _fooBar() {} }`, options: [{ public: '^_' }], From 6f5c0fa5504677368f678afd63bb9f6c7ffb87d1 Mon Sep 17 00:00:00 2001 From: Thomas Levy Date: Wed, 27 Mar 2019 09:25:46 -0700 Subject: [PATCH 07/16] docs(eslint-plugin): list rules requiring type info (#360) Fixes #341 --- packages/eslint-plugin/README.md | 90 ++++++++++++++++---------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index ba235a7bc63..6d433a5eef5 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -105,53 +105,53 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e -**Key**: :heavy_check_mark: = recommended, :wrench: = fixable +**Key**: :heavy_check_mark: = recommended, :wrench: = fixable, :thought_balloon: = requires type information -| Name | Description | :heavy_check_mark: | :wrench: | -| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | -| [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive (`adjacent-overload-signatures` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays (`array-type` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Enforces that types will not to be used (`ban-types` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/ban-ts-ignore`](./docs/rules/ban-ts-ignore.md) | Bans “// @ts-ignore” comments from being used (`ban-ts-ignore` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/camelcase`](./docs/rules/camelcase.md) | Enforce camelCase naming convention | :heavy_check_mark: | | -| [`@typescript-eslint/class-name-casing`](./docs/rules/class-name-casing.md) | Require PascalCased class and interface names (`class-name` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | :heavy_check_mark: | | -| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods (`member-access` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/generic-type-naming`](./docs/rules/generic-type-naming.md) | Enforces naming of generic type variables | | | -| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation (`indent` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/interface-name-prefix`](./docs/rules/interface-name-prefix.md) | Require that interface names be prefixed with `I` (`interface-name` from TSLint) | :heavy_check_mark: | | +| Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | ----------------- | +| [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive (`adjacent-overload-signatures` from TSLint) | :heavy_check_mark: | | | +| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays (`array-type` from TSLint) | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Enforces that types will not to be used (`ban-types` from TSLint) | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/ban-ts-ignore`](./docs/rules/ban-ts-ignore.md) | Bans “// @ts-ignore” comments from being used (`ban-ts-ignore` from TSLint) | | | | +| [`@typescript-eslint/camelcase`](./docs/rules/camelcase.md) | Enforce camelCase naming convention | :heavy_check_mark: | | | +| [`@typescript-eslint/class-name-casing`](./docs/rules/class-name-casing.md) | Require PascalCased class and interface names (`class-name` from TSLint) | :heavy_check_mark: | | | +| [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | :heavy_check_mark: | | | +| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods (`member-access` from TSLint) | :heavy_check_mark: | | | +| [`@typescript-eslint/generic-type-naming`](./docs/rules/generic-type-naming.md) | Enforces naming of generic type variables | | | | +| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation (`indent` from TSLint) | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/interface-name-prefix`](./docs/rules/interface-name-prefix.md) | Require that interface names be prefixed with `I` (`interface-name` from TSLint) | :heavy_check_mark: | | | | [`@typescript-eslint/member-delimiter-style`](./docs/rules/member-delimiter-style.md) | Require a specific member delimiter style for interfaces and type literals | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/member-naming`](./docs/rules/member-naming.md) | Enforces naming conventions for class members by visibility. | | | -| [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order (`member-ordering` from TSLint) | | | -| [`@typescript-eslint/no-angle-bracket-type-assertion`](./docs/rules/no-angle-bracket-type-assertion.md) | Enforces the use of `as Type` assertions instead of `` assertions (`no-angle-bracket-type-assertion` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: | -| [`@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: | | -| [`@typescript-eslint/no-non-null-assertion`](./docs/rules/no-non-null-assertion.md) | Disallows non-null assertions using the `!` postfix operator (`no-non-null-assertion` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-object-literal-type-assertion`](./docs/rules/no-object-literal-type-assertion.md) | Forbids an object literal to appear in a type assertion expression (`no-object-literal-type-assertion` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors. (`no-parameter-properties` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-require-imports`](./docs/rules/no-require-imports.md) | Disallows invocation of `require()` (`no-require-imports` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` (`no-this-assignment` from TSLint) | | | -| [`@typescript-eslint/no-triple-slash-reference`](./docs/rules/no-triple-slash-reference.md) | Disallow `/// ` comments (`no-reference` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases (`interface-over-type-literal` from TSLint) | | | -| [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary (`no-unnecessary-qualifier` from TSLint) | | :wrench: | -| [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression (`no-unnecessary-type-assertion` from TSLint) | | :wrench: | -| [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables (`no-unused-variable` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | :heavy_check_mark: | | -| [`@typescript-eslint/no-useless-constructor`](./docs/rules/no-useless-constructor.md) | Disallow unnecessary constructors | | | -| [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements (`no-var-requires` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/prefer-function-type`](./docs/rules/prefer-function-type.md) | Use function types instead of interfaces with call signatures (`callable-types` from TSLint) | | :wrench: | -| [`@typescript-eslint/prefer-interface`](./docs/rules/prefer-interface.md) | Prefer an interface declaration over a type literal (type T = { ... }) (`interface-over-type-literal` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules. (`no-internal-module` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async. (`promise-function-async` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string. (`restrict-plus-operands` from TSLint) | | | -| [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations (`typedef-whitespace` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/unified-signatures`](./docs/rules/unified-signatures.md) | Warns for any two overloads that could be unified into one. (`unified-signatures` from TSLint) | | | +| [`@typescript-eslint/member-naming`](./docs/rules/member-naming.md) | Enforces naming conventions for class members by visibility. | | | | +| [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order (`member-ordering` from TSLint) | | | | +| [`@typescript-eslint/no-angle-bracket-type-assertion`](./docs/rules/no-angle-bracket-type-assertion.md) | Enforces the use of `as Type` assertions instead of `` assertions (`no-angle-bracket-type-assertion` from TSLint) | :heavy_check_mark: | | | +| [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: | | +| [`@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) | | | :thought_balloon: | +| [`@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: | | | +| [`@typescript-eslint/no-non-null-assertion`](./docs/rules/no-non-null-assertion.md) | Disallows non-null assertions using the `!` postfix operator (`no-non-null-assertion` from TSLint) | :heavy_check_mark: | | | +| [`@typescript-eslint/no-object-literal-type-assertion`](./docs/rules/no-object-literal-type-assertion.md) | Forbids an object literal to appear in a type assertion expression (`no-object-literal-type-assertion` from TSLint) | :heavy_check_mark: | | | +| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors. (`no-parameter-properties` from TSLint) | :heavy_check_mark: | | | +| [`@typescript-eslint/no-require-imports`](./docs/rules/no-require-imports.md) | Disallows invocation of `require()` (`no-require-imports` from TSLint) | | | | +| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` (`no-this-assignment` from TSLint) | | | | +| [`@typescript-eslint/no-triple-slash-reference`](./docs/rules/no-triple-slash-reference.md) | Disallow `/// ` comments (`no-reference` from TSLint) | :heavy_check_mark: | | | +| [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases (`interface-over-type-literal` from TSLint) | | | | +| [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary (`no-unnecessary-qualifier` from TSLint) | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression (`no-unnecessary-type-assertion` from TSLint) | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables (`no-unused-variable` from TSLint) | :heavy_check_mark: | | | +| [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | :heavy_check_mark: | | | +| [`@typescript-eslint/no-useless-constructor`](./docs/rules/no-useless-constructor.md) | Disallow unnecessary constructors | | | | +| [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements (`no-var-requires` from TSLint) | :heavy_check_mark: | | | +| [`@typescript-eslint/prefer-function-type`](./docs/rules/prefer-function-type.md) | Use function types instead of interfaces with call signatures (`callable-types` from TSLint) | | :wrench: | | +| [`@typescript-eslint/prefer-interface`](./docs/rules/prefer-interface.md) | Prefer an interface declaration over a type literal (type T = { ... }) (`interface-over-type-literal` from TSLint) | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules. (`no-internal-module` from TSLint) | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async. (`promise-function-async` from TSLint) | | | :thought_balloon: | +| [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string. (`restrict-plus-operands` from TSLint) | | | :thought_balloon: | +| [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations (`typedef-whitespace` from TSLint) | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/unified-signatures`](./docs/rules/unified-signatures.md) | Warns for any two overloads that could be unified into one. (`unified-signatures` from TSLint) | | | | From 643a223d6298567da6083d95572be0d44899effb Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Wed, 27 Mar 2019 11:59:50 -0700 Subject: [PATCH 08/16] fix(eslint-plugin): explicit-function-return-type: ensure class arrow methods are validated (#377) Fixes #348 --- .../src/rules/explicit-function-return-type.ts | 1 + .../tests/rules/explicit-function-return-type.test.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index d767959c29f..9cb9c983104 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -114,6 +114,7 @@ export default util.createRule({ ): void { if ( options.allowExpressions && + node.type !== AST_NODE_TYPES.ArrowFunctionExpression && node.parent && node.parent.type !== AST_NODE_TYPES.VariableDeclarator && node.parent.type !== AST_NODE_TYPES.MethodDefinition diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 932e50e9714..6786b92f4b1 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -41,6 +41,7 @@ class Test { method(): void { return; } + arrow = (): string => 'arrow'; } `, }, @@ -171,6 +172,7 @@ class Test { method() { return; } + arrow = () => 'arrow'; } `, errors: [ @@ -184,6 +186,11 @@ class Test { line: 8, column: 9, }, + { + messageId: 'missingReturnType', + line: 11, + column: 11, + }, ], }, { From bf04398289801c2ef74040efba2fb25f55bac1e0 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 27 Mar 2019 23:03:32 +0100 Subject: [PATCH 09/16] fix(typescript-estree): add ExportDefaultDeclaration to union DeclarationStatement (#378) --- packages/typescript-estree/src/ts-estree/ts-estree.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index f15f50abca3..6c0808b9562 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -254,6 +254,7 @@ export type ClassElement = export type DeclarationStatement = | ClassDeclaration | ClassExpression + | ExportDefaultDeclaration | ExportAllDeclaration | ExportNamedDeclaration | FunctionDeclaration From cebcfe640ec56535bc565dabad6fb4b90db60afc Mon Sep 17 00:00:00 2001 From: Jonathan Skeate Date: Wed, 27 Mar 2019 19:04:58 -0400 Subject: [PATCH 10/16] fix(eslint-plugin): no-type-alias: fix typeof alias erroring (#380) --- packages/eslint-plugin/src/rules/no-type-alias.ts | 1 + packages/eslint-plugin/tests/rules/no-type-alias.test.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index c15795773a0..890e6b04aa5 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -108,6 +108,7 @@ export default util.createRule({ AST_NODE_TYPES.TSArrayType, AST_NODE_TYPES.TSTypeReference, AST_NODE_TYPES.TSLiteralType, + AST_NODE_TYPES.TSTypeQuery, ]; type CompositionType = TSESTree.TSUnionType | TSESTree.TSIntersectionType; diff --git a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts index df42dd0f082..d34cb9957b8 100644 --- a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts @@ -364,6 +364,14 @@ type Foo = { }, ], }, + { + code: 'type Foo = typeof bar;', + options: [{ allowAliases: 'always' }], + }, + { + code: 'type Foo = typeof bar | typeof baz;', + options: [{ allowAliases: 'in-unions' }], + }, ], invalid: [ { From f29d1c9d37b0a9865ec2eeda38ffac6e93fb2d3a Mon Sep 17 00:00:00 2001 From: Gilbert Gilb's Date: Thu, 28 Mar 2019 18:43:00 +0100 Subject: [PATCH 11/16] fix(eslint-plugin): Fix `allowExpressions` false positives in explicit-function-return-type and incorrect documentation (#388) Fixes #387 --- .../rules/explicit-function-return-type.md | 6 +++-- .../rules/explicit-function-return-type.ts | 22 +++++++++---------- .../explicit-function-return-type.test.ts | 19 ++++++++++++++++ 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index e63d3d351a2..b6f37038aba 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -62,9 +62,11 @@ class Test { The rule accepts an options object with the following properties: - `allowExpressions` if true, only functions which are part of a declaration will be checked +- `allowTypedFunctionExpressions` if true, type annotations are also allowed on the variable + of a function expression rather than on the function directly. -By default, `allowExpressions: false` is used, meaning all declarations and -expressions _must_ have a return type. +By default, `allowExpressions: false` and `allowTypedFunctionExpressions: false` are used, +meaning all declarations and expressions _must_ have a return type. ### allowExpressions diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index 9cb9c983104..0d9f9304d2a 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -39,7 +39,7 @@ export default util.createRule({ }, defaultOptions: [ { - allowExpressions: true, + allowExpressions: false, allowTypedFunctionExpressions: false, }, ], @@ -88,6 +88,16 @@ export default util.createRule({ | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, ): void { + if ( + options.allowExpressions && + node.type !== AST_NODE_TYPES.FunctionDeclaration && + node.parent && + node.parent.type !== AST_NODE_TYPES.VariableDeclarator && + node.parent.type !== AST_NODE_TYPES.MethodDefinition + ) { + return; + } + if ( !node.returnType && node.parent && @@ -112,16 +122,6 @@ export default util.createRule({ | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, ): void { - if ( - options.allowExpressions && - node.type !== AST_NODE_TYPES.ArrowFunctionExpression && - node.parent && - node.parent.type !== AST_NODE_TYPES.VariableDeclarator && - node.parent.type !== AST_NODE_TYPES.MethodDefinition - ) { - return; - } - if ( options.allowTypedFunctionExpressions && node.parent && diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 6786b92f4b1..45ff620d616 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -54,6 +54,7 @@ function test() { `, }, { + filename: 'test.ts', code: `fn(() => {});`, options: [ { @@ -62,6 +63,7 @@ function test() { ], }, { + filename: 'test.ts', code: `fn(function() {});`, options: [ { @@ -70,6 +72,7 @@ function test() { ], }, { + filename: 'test.ts', code: `[function() {}, () => {}]`, options: [ { @@ -78,6 +81,7 @@ function test() { ], }, { + filename: 'test.ts', code: `(function() {});`, options: [ { @@ -86,6 +90,7 @@ function test() { ], }, { + filename: 'test.ts', code: `(() => {})();`, options: [ { @@ -193,6 +198,20 @@ class Test { }, ], }, + { + filename: 'test.ts', + code: `function test() { + return; + }`, + options: [{ allowExpressions: true }], + errors: [ + { + messageId: 'missingReturnType', + line: 1, + column: 1, + }, + ], + }, { filename: 'test.ts', code: `const foo = () => {};`, From 492b737ea51e8cca1afbde28a71ec3e7227acb7e Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sat, 30 Mar 2019 14:08:28 +1030 Subject: [PATCH 12/16] fix(parser): Make eslint traverse enum id (#383) --- packages/parser/src/visitor-keys.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/parser/src/visitor-keys.ts b/packages/parser/src/visitor-keys.ts index b39c2e28557..7cc4aa9d893 100644 --- a/packages/parser/src/visitor-keys.ts +++ b/packages/parser/src/visitor-keys.ts @@ -65,7 +65,7 @@ export const visitorKeys = eslintVisitorKeys.unionWith({ 'params', 'returnType', ], - TSEnumDeclaration: ['members'], + TSEnumDeclaration: ['id', 'members'], TSEnumMember: ['id', 'initializer'], TSExportAssignment: ['expression'], TSExportKeyword: [], From 5d81f8c88aea0413ab04a5040ad4fb99a2313b8b Mon Sep 17 00:00:00 2001 From: Teppei Sato Date: Tue, 2 Apr 2019 06:34:04 +0900 Subject: [PATCH 13/16] docs(eslint-plugin): fix markdown format (#394) --- packages/eslint-plugin/docs/rules/unified-signatures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/unified-signatures.md b/packages/eslint-plugin/docs/rules/unified-signatures.md index 929c82ae159..7fe46beceaf 100644 --- a/packages/eslint-plugin/docs/rules/unified-signatures.md +++ b/packages/eslint-plugin/docs/rules/unified-signatures.md @@ -30,4 +30,4 @@ function f(x?: ...number[]): void; ## Related to -- TSLint: ['unified-signatures`](https://palantir.github.io/tslint/rules/unified-signatures/) +- TSLint: [`unified-signatures`](https://palantir.github.io/tslint/rules/unified-signatures/) From 95a948d27827da9423c088f3c2fc46b2c1fc3126 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 2 Apr 2019 20:32:10 -0400 Subject: [PATCH 14/16] chore: initial pull request templates --- .github/PULL_REQUEST_TEMPLATE/default.md | 9 +++++++++ .../typescript_version_upgrade.md | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE/default.md create mode 100644 .github/PULL_REQUEST_TEMPLATE/typescript_version_upgrade.md diff --git a/.github/PULL_REQUEST_TEMPLATE/default.md b/.github/PULL_REQUEST_TEMPLATE/default.md new file mode 100644 index 00000000000..e0edbeb5541 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/default.md @@ -0,0 +1,9 @@ +--- +name: 'Default' +about: Default Pull Request Template +title: '' +labels: '' +assignees: '' +--- + + diff --git a/.github/PULL_REQUEST_TEMPLATE/typescript_version_upgrade.md b/.github/PULL_REQUEST_TEMPLATE/typescript_version_upgrade.md new file mode 100644 index 00000000000..93dd24bf0c7 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/typescript_version_upgrade.md @@ -0,0 +1,18 @@ +--- +name: 'TypeScript Version Upgrade' +about: Used when upgrading the supported version of TypeScript +title: '' +labels: '' +assignees: '' +--- + +**Please complete the following:** + +TypeScript version added by this PR: `{{ INSERT_TYPESCRIPT_VERSION }}` + +- [ ] I have updated the devDependency range in the root package.json +- [ ] I have updated the range value in `packages/typescript-estree/src/parser.ts` +- [ ] I have run the existing tests to make sure they still pass, or made any required updates +- [ ] I have added new tests for the features introduced in this newer version of TypeScript + - New features tests added: + - From a4f95d36ab6d799d7e48b7e984d1cf74a4641214 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 2 Apr 2019 21:15:13 -0400 Subject: [PATCH 15/16] feat(*): change TypeScript version range to >=3.2.1 <3.5.0 (#399) --- .../{default.md => standard.md} | 4 +- .../typescript_version_upgrade.md | 4 +- package.json | 2 +- packages/eslint-plugin/src/util/createRule.ts | 2 +- .../lib/__snapshots__/typescript.ts.snap | 3166 +- .../typescript/basics/const-assertions.src.ts | 17 + .../typescript/basics/global-this.src.ts | 12 + .../typescript/basics/readonly-arrays.src.ts | 9 + .../typescript/basics/readonly-tuples.src.ts | 4 + packages/typescript-estree/src/node-utils.ts | 1 + packages/typescript-estree/src/parser.ts | 2 +- .../tests/ast-alignment/fixtures-to-test.ts | 6 + .../tests/lib/__snapshots__/convert.ts.snap | 17 +- .../semantic-diagnostics-enabled.ts.snap | 8 + .../lib/__snapshots__/typescript.ts.snap | 30082 +++++++++------- yarn.lock | 8 +- 16 files changed, 20130 insertions(+), 13214 deletions(-) rename .github/PULL_REQUEST_TEMPLATE/{default.md => standard.md} (61%) create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/const-assertions.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/global-this.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/readonly-arrays.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/readonly-tuples.src.ts diff --git a/.github/PULL_REQUEST_TEMPLATE/default.md b/.github/PULL_REQUEST_TEMPLATE/standard.md similarity index 61% rename from .github/PULL_REQUEST_TEMPLATE/default.md rename to .github/PULL_REQUEST_TEMPLATE/standard.md index e0edbeb5541..fb7952bc768 100644 --- a/.github/PULL_REQUEST_TEMPLATE/default.md +++ b/.github/PULL_REQUEST_TEMPLATE/standard.md @@ -1,6 +1,6 @@ --- -name: 'Default' -about: Default Pull Request Template +name: 'Standard' +about: Standard Pull Request Template title: '' labels: '' assignees: '' diff --git a/.github/PULL_REQUEST_TEMPLATE/typescript_version_upgrade.md b/.github/PULL_REQUEST_TEMPLATE/typescript_version_upgrade.md index 93dd24bf0c7..d51581780f2 100644 --- a/.github/PULL_REQUEST_TEMPLATE/typescript_version_upgrade.md +++ b/.github/PULL_REQUEST_TEMPLATE/typescript_version_upgrade.md @@ -14,5 +14,5 @@ TypeScript version added by this PR: `{{ INSERT_TYPESCRIPT_VERSION }}` - [ ] I have updated the range value in `packages/typescript-estree/src/parser.ts` - [ ] I have run the existing tests to make sure they still pass, or made any required updates - [ ] I have added new tests for the features introduced in this newer version of TypeScript - - New features tests added: - - +- New feature tests added: + - ... diff --git a/package.json b/package.json index 57a5e6124b0..87f47a22a52 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,6 @@ "ts-jest": "^24.0.0", "ts-node": "^8.0.1", "tslint": "^5.11.0", - "typescript": ">=3.2.1 <3.4.0" + "typescript": ">=3.2.1 <3.5.0" } } diff --git a/packages/eslint-plugin/src/util/createRule.ts b/packages/eslint-plugin/src/util/createRule.ts index 97b0f18c51e..ac61c39cb55 100644 --- a/packages/eslint-plugin/src/util/createRule.ts +++ b/packages/eslint-plugin/src/util/createRule.ts @@ -26,7 +26,7 @@ type CreateRuleMeta = { // This function will get much easier to call when this is merged https://github.com/Microsoft/TypeScript/pull/26349 // TODO - when the above rule lands; add type checking for the context.report `data` property export function createRule< - TOptions extends Readonly, + TOptions extends any[], TMessageIds extends string, TRuleListener extends RuleListener = RuleListener >({ diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index a0cf4bcc5d6..aab28814499 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -10983,225 +10983,457 @@ Object { } `; -exports[`typescript fixtures/basics/const-enum.src 1`] = ` +exports[`typescript fixtures/basics/const-assertions.src 1`] = ` Object { - "$id": 6, + "$id": 10, "block": Object { "range": Array [ - 0, - 39, + 13, + 323, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 5, + "$id": 9, "block": Object { "range": Array [ - 0, - 39, + 13, + 323, ], "type": "Program", }, - "childScopes": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "x", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 21, + 32, + ], + "type": "TSAsExpression", + }, + }, Object { "$id": 4, - "block": Object { + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "y", "range": Array [ - 0, - 39, + 67, + 68, ], - "type": "TSEnumDeclaration", + "type": "Identifier", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 71, + 88, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "z", + "range": Array [ + 132, + 133, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": Object { + "range": Array [ + 136, + 162, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "x", + "range": Array [ + 182, + 183, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 186, + 195, + ], + "type": "TSTypeAssertion", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "y", + "range": Array [ + 230, + 231, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 234, + 249, + ], + "type": "TSTypeAssertion", + }, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "z", + "range": Array [ + 293, + 294, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": Object { + "range": Array [ + 297, + 321, + ], + "type": "TSTypeAssertion", + }, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + "y": Object { + "$ref": 1, + }, + "z": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ Object { - "$id": 3, - "from": Object { - "$ref": 4, + "name": Object { + "name": "x", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", }, - "identifier": Object { - "name": "foo", + "node": Object { "range": Array [ - 21, - 24, + 17, + 32, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 13, + 33, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + Object { + "name": Object { + "name": "x", + "range": Array [ + 182, + 183, ], "type": "Identifier", }, - "kind": "w", - "resolved": Object { - "$ref": 1, + "node": Object { + "range": Array [ + 182, + 195, + ], + "type": "VariableDeclarator", }, - "writeExpr": Object { + "parent": Object { "range": Array [ - 27, - 28, + 178, + 196, ], - "type": "Literal", + "type": "VariableDeclaration", }, + "type": "Variable", }, ], - "throughReferences": Array [], - "type": "enum", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "bar": Object { - "$ref": 2, - }, - "foo": Object { - "$ref": 1, + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "foo", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 21, - 28, - ], - "type": "TSEnumMember", - }, - "parent": undefined, - "type": "EnumMemberName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "foo", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - ], - "name": "foo", - "references": Array [ - Object { - "$ref": 3, - }, + "name": "x", + "range": Array [ + 182, + 183, ], - "scope": Object { - "$ref": 4, + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "y", + "range": Array [ + 67, + 68, + ], + "type": "Identifier", }, + "node": Object { + "range": Array [ + 67, + 88, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 63, + 89, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", }, Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "bar", - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 34, - 37, - ], - "type": "TSEnumMember", - }, - "parent": undefined, - "type": "EnumMemberName", - }, + "name": Object { + "name": "y", + "range": Array [ + 230, + 231, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 230, + 249, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 226, + 250, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "y", + "range": Array [ + 67, + 68, ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "bar", - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - }, + "type": "Identifier", + }, + Object { + "name": "y", + "range": Array [ + 230, + 231, ], - "name": "bar", - "references": Array [], - "scope": Object { - "$ref": 4, - }, + "type": "Identifier", }, ], + "name": "y", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 9, + }, }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 6, - }, - "variableMap": Object { - "Foo": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ Object { - "$id": 0, + "$id": 2, "defs": Array [ Object { "name": Object { - "name": "Foo", + "name": "z", "range": Array [ - 11, - 14, + 132, + 133, ], "type": "Identifier", }, "node": Object { "range": Array [ - 0, - 39, + 132, + 162, ], - "type": "TSEnumDeclaration", + "type": "VariableDeclarator", }, - "parent": undefined, - "type": "EnumName", + "parent": Object { + "range": Array [ + 128, + 163, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + Object { + "name": Object { + "name": "z", + "range": Array [ + 293, + 294, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 293, + 321, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 289, + 322, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "Foo", + "name": "z", "range": Array [ - 11, - 14, + 132, + 133, + ], + "type": "Identifier", + }, + Object { + "name": "z", + "range": Array [ + 293, + 294, ], "type": "Identifier", }, ], - "name": "Foo", - "references": Array [], + "name": "z", + "references": Array [ + Object { + "$ref": 5, + }, + Object { + "$ref": 8, + }, + ], "scope": Object { - "$ref": 5, + "$ref": 9, }, }, ], @@ -11215,41 +11447,279 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 6, + "$ref": 10, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/declare-class-with-optional-method.src 1`] = ` +exports[`typescript fixtures/basics/const-enum.src 1`] = ` Object { - "$id": 4, + "$id": 6, "block": Object { "range": Array [ 0, - 38, + 39, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 3, + "$id": 5, "block": Object { "range": Array [ 0, - 38, + 39, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 2, + "$id": 4, "block": Object { "range": Array [ 0, - 38, + 39, ], - "type": "ClassDeclaration", + "type": "TSEnumDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 27, + 28, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "enum", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "bar": Object { + "$ref": 2, + }, + "foo": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 28, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 34, + 37, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + ], + "name": "bar", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 39, + ], + "type": "TSEnumDeclaration", + }, + "parent": undefined, + "type": "EnumName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/declare-class-with-optional-method.src 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 38, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 38, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 38, + ], + "type": "ClassDeclaration", }, "childScopes": Array [], "functionExpressionScope": false, @@ -16795,36 +17265,293 @@ Object { } `; -exports[`typescript fixtures/basics/import-equal-declaration.src 1`] = ` +exports[`typescript fixtures/basics/global-this.src 1`] = ` Object { - "$id": 2, + "$id": 7, "block": Object { "range": Array [ - 0, - 29, + 22, + 206, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 1, + "$id": 6, "block": Object { "range": Array [ - 0, - 29, + 22, + 206, ], "type": "Program", }, "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "abc", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 32, + 35, + ], + "type": "Literal", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "globalThis", + "range": Array [ + 69, + 79, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "answer", + "range": Array [ + 97, + 103, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 106, + 108, + ], + "type": "Literal", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "globalThis", + "range": Array [ + 178, + 188, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "abc": Object { + "$ref": 0, + }, + "answer": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "abc", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 26, + 35, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 22, + 36, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "abc", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + ], + "name": "abc", + "references": Array [ + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "answer", + "range": Array [ + 97, + 103, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 97, + 108, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 93, + 109, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "answer", + "range": Array [ + 97, + 103, + ], + "type": "Identifier", + }, + ], + "name": "answer", + "references": Array [ + Object { + "$ref": 4, + }, + ], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/import-equal-declaration.src 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { "foo": Object { "$ref": 0, }, @@ -17781,49 +18508,609 @@ Object { "functionExpressionScope": false, "isStrict": true, "references": Array [], - "throughReferences": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 44, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 44, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "nestedArray": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "nestedArray", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "nestedArray", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + ], + "name": "nestedArray", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/never-type-param.src 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 46, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 46, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "Observable", + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 6, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 6, + 17, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` +Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "validateEntity", + "range": Array [ + 41, + 55, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "e", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "range": Array [ + 72, + 79, + ], + "type": "MemberExpression", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "e", + "range": Array [ + 72, + 73, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "e": Object { + "$ref": 2, + }, + "s": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "e", + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "e", + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + }, + ], + "name": "e", + "references": Array [ + Object { + "$ref": 5, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 68, + 79, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 64, + 80, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], "type": "module", "upperScope": Object { - "$ref": 1, + "$ref": 10, + }, + "variableMap": Object { + "processEntity": Object { + "$ref": 0, + }, }, - "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 9, }, - "variables": Array [], + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "processEntity", + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "processEntity", + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + }, + ], + "name": "processEntity", + "references": Array [], + "scope": Object { + "$ref": 9, + }, + }, + ], }, ], "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 1, + "$ref": 10, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` +exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` Object { - "$id": 2, + "$id": 3, "block": Object { "range": Array [ 0, - 44, + 30, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, - 44, + 30, ], "type": "Program", }, @@ -17834,15 +19121,18 @@ Object { "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 2, + "$ref": 3, }, "variableMap": Object { - "nestedArray": Object { + "x": Object { "$ref": 0, }, + "y": Object { + "$ref": 1, + }, }, "variableScope": Object { - "$ref": 1, + "$ref": 2, }, "variables": Array [ Object { @@ -17850,24 +19140,24 @@ Object { "defs": Array [ Object { "name": Object { - "name": "nestedArray", + "name": "x", "range": Array [ 4, - 44, + 11, ], "type": "Identifier", }, "node": Object { "range": Array [ 4, - 44, + 11, ], "type": "VariableDeclarator", }, "parent": Object { "range": Array [ 0, - 44, + 12, ], "type": "VariableDeclaration", }, @@ -17877,18 +19167,64 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "nestedArray", + "name": "x", "range": Array [ 4, - 44, + 11, ], "type": "Identifier", }, ], - "name": "nestedArray", + "name": "x", "references": Array [], "scope": Object { - "$ref": 1, + "$ref": 2, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "y", + "range": Array [ + 17, + 29, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 17, + 29, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 13, + 30, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "y", + "range": Array [ + 17, + 29, + ], + "type": "Identifier", + }, + ], + "name": "y", + "references": Array [], + "scope": Object { + "$ref": 2, }, }, ], @@ -17902,70 +19238,158 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 2, + "$ref": 3, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/never-type-param.src 1`] = ` +exports[`typescript fixtures/basics/object-with-escaped-properties.src 1`] = ` Object { - "$id": 3, + "$id": 6, "block": Object { "range": Array [ 0, - 46, + 82, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 2, + "$id": 5, "block": Object { "range": Array [ 0, - 46, + 82, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "childScopes": Array [ Object { - "$id": 1, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "Observable", + "$id": 2, + "block": Object { "range": Array [ - 19, - 29, + 26, + 31, ], - "type": "Identifier", + "type": "FunctionExpression", }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], }, - ], - "throughReferences": Array [ Object { - "$ref": 1, + "$id": 4, + "block": Object { + "range": Array [ + 58, + 81, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "X": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "X", + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 81, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "X", + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + }, + ], + "name": "X", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], }, ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 3, + "$ref": 6, }, "variableMap": Object { - "x": Object { + "X": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 2, + "$ref": 5, }, "variables": Array [ Object { @@ -17973,45 +19397,39 @@ Object { "defs": Array [ Object { "name": Object { - "name": "x", + "name": "X", "range": Array [ - 6, - 17, + 64, + 65, ], "type": "Identifier", }, "node": Object { "range": Array [ - 6, - 17, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 18, + 58, + 81, ], - "type": "VariableDeclaration", + "type": "ClassDeclaration", }, - "type": "Variable", + "parent": null, + "type": "ClassName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "x", + "name": "X", "range": Array [ - 6, - 17, + 64, + 65, ], "type": "Identifier", }, ], - "name": "x", + "name": "X", "references": Array [], "scope": Object { - "$ref": 2, + "$ref": 5, }, }, ], @@ -18020,189 +19438,217 @@ Object { "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 1, - }, - ], + "throughReferences": Array [], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 3, + "$ref": 6, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` +exports[`typescript fixtures/basics/object-with-typed-methods.src 1`] = ` Object { - "$id": 10, + "$id": 12, "block": Object { "range": Array [ 0, - 82, + 176, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 9, + "$id": 11, "block": Object { "range": Array [ 0, - 82, + 176, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 8, + "$id": 3, "block": Object { "range": Array [ - 0, - 82, + 29, + 61, ], - "type": "FunctionDeclaration", + "type": "FunctionExpression", }, "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, - "references": Array [ - Object { - "$id": 4, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "validateEntity", - "range": Array [ - 41, - 55, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "e", - "range": Array [ - 56, - 57, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": undefined, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { "$ref": 3, }, - "writeExpr": Object { - "range": Array [ - 72, - 79, - ], - "type": "MemberExpression", - }, }, + ], + }, + Object { + "$id": 5, + "block": Object { + "range": Array [ + 68, + 100, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "e", - "range": Array [ - 72, - 73, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 2, + "$id": 4, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, }, - "writeExpr": undefined, }, ], - "throughReferences": Array [ + }, + Object { + "$id": 7, + "block": Object { + "range": Array [ + 109, + 138, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 6, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ Object { - "$ref": 4, + "$id": 6, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 7, + }, }, ], + }, + Object { + "$id": 10, + "block": Object { + "range": Array [ + 147, + 172, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 9, + "$ref": 11, }, "variableMap": Object { "arguments": Object { - "$ref": 1, - }, - "e": Object { - "$ref": 2, + "$ref": 8, }, - "s": Object { - "$ref": 3, + "x": Object { + "$ref": 9, }, }, "variableScope": Object { - "$ref": 8, + "$ref": 10, }, "variables": Array [ Object { - "$id": 1, + "$id": 8, "defs": Array [], "eslintUsed": undefined, "identifiers": Array [], "name": "arguments", "references": Array [], "scope": Object { - "$ref": 8, + "$ref": 10, }, }, Object { - "$id": 2, + "$id": 9, "defs": Array [ Object { "name": Object { - "name": "e", + "name": "x", "range": Array [ - 23, - 33, + 148, + 157, ], "type": "Identifier", }, "node": Object { "range": Array [ - 0, - 82, + 147, + 172, ], - "type": "FunctionDeclaration", + "type": "FunctionExpression", }, "parent": null, "type": "Parameter", @@ -18211,75 +19657,18 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "e", - "range": Array [ - 23, - 33, - ], - "type": "Identifier", - }, - ], - "name": "e", - "references": Array [ - Object { - "$ref": 5, - }, - Object { - "$ref": 7, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "s", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 68, - 79, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 64, - 80, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s", + "name": "x", "range": Array [ - 68, - 69, + 148, + 157, ], "type": "Identifier", }, ], - "name": "s", - "references": Array [ - Object { - "$ref": 6, - }, - ], + "name": "x", + "references": Array [], "scope": Object { - "$ref": 8, + "$ref": 10, }, }, ], @@ -18287,125 +19676,45 @@ Object { ], "functionExpressionScope": false, "isStrict": true, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 10, - }, - "variableMap": Object { - "processEntity": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 9, - }, - "variables": Array [ + "references": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "processEntity", - "range": Array [ - 9, - 22, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 82, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "processEntity", - "range": Array [ - 9, - 22, - ], - "type": "Identifier", - }, - ], - "name": "processEntity", - "references": Array [], - "scope": Object { - "$ref": 9, + "$id": 1, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 12, + 174, + ], + "type": "ObjectExpression", }, }, ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 10, - }, - "variables": Array [], -} -`; - -exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` -Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 30, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 30, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 3, + "$ref": 12, }, "variableMap": Object { - "x": Object { + "foo": Object { "$ref": 0, }, - "y": Object { - "$ref": 1, - }, }, "variableScope": Object { - "$ref": 2, + "$ref": 11, }, "variables": Array [ Object { @@ -18413,24 +19722,24 @@ Object { "defs": Array [ Object { "name": Object { - "name": "x", + "name": "foo", "range": Array [ - 4, - 11, + 6, + 9, ], "type": "Identifier", }, "node": Object { "range": Array [ - 4, - 11, + 6, + 174, ], "type": "VariableDeclarator", }, "parent": Object { "range": Array [ 0, - 12, + 175, ], "type": "VariableDeclaration", }, @@ -18440,64 +19749,22 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "x", + "name": "foo", "range": Array [ - 4, - 11, + 6, + 9, ], "type": "Identifier", }, ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "y", - "range": Array [ - 17, - 29, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 17, - 29, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 13, - 30, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + "name": "foo", + "references": Array [ Object { - "name": "y", - "range": Array [ - 17, - 29, - ], - "type": "Identifier", + "$ref": 1, }, ], - "name": "y", - "references": Array [], "scope": Object { - "$ref": 2, + "$ref": 11, }, }, ], @@ -18511,138 +19778,337 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 3, + "$ref": 12, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/object-with-escaped-properties.src 1`] = ` +exports[`typescript fixtures/basics/parenthesized-use-strict.src 1`] = ` Object { - "$id": 6, + "$id": 1, + "block": Object { + "range": Array [ + 45, + 60, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 45, + 60, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/readonly-arrays.src 1`] = ` +Object { + "$id": 12, "block": Object { "range": Array [ 0, - 82, + 211, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 5, + "$id": 11, "block": Object { "range": Array [ 0, - 82, + 211, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 2, + "$id": 5, + "block": Object { + "range": Array [ + 0, + 106, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "arr", + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "arr", + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "arr": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "arr", + "range": Array [ + 13, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 106, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "arr", + "range": Array [ + 13, + 39, + ], + "type": "Identifier", + }, + ], + "name": "arr", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + ], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + Object { + "$id": 10, "block": Object { "range": Array [ - 26, - 31, + 108, + 210, ], - "type": "FunctionExpression", + "type": "FunctionDeclaration", }, "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, - "references": Array [], + "references": Array [ + Object { + "$id": 8, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "arr", + "range": Array [ + 149, + 152, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 7, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "arr", + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 7, + }, + "writeExpr": undefined, + }, + ], "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 5, + "$ref": 11, }, "variableMap": Object { "arguments": Object { - "$ref": 1, + "$ref": 6, + }, + "arr": Object { + "$ref": 7, }, }, "variableScope": Object { - "$ref": 2, + "$ref": 10, }, "variables": Array [ Object { - "$id": 1, + "$id": 6, "defs": Array [], "eslintUsed": undefined, "identifiers": Array [], "name": "arguments", "references": Array [], "scope": Object { - "$ref": 2, + "$ref": 10, }, }, - ], - }, - Object { - "$id": 4, - "block": Object { - "range": Array [ - 58, - 81, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "X": Object { - "$ref": 3, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ Object { - "$id": 3, + "$id": 7, "defs": Array [ Object { "name": Object { - "name": "X", + "name": "arr", "range": Array [ - 64, - 65, + 121, + 143, ], "type": "Identifier", }, "node": Object { "range": Array [ - 58, - 81, + 108, + 210, ], - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, - "parent": undefined, - "type": "ClassName", + "parent": null, + "type": "Parameter", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "X", + "name": "arr", "range": Array [ - 64, - 65, + 121, + 143, ], "type": "Identifier", }, ], - "name": "X", - "references": Array [], + "name": "arr", + "references": Array [ + Object { + "$ref": 8, + }, + Object { + "$ref": 9, + }, + ], "scope": Object { - "$ref": 4, + "$ref": 10, }, }, ], @@ -18654,15 +20120,15 @@ Object { "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 6, + "$ref": 12, }, "variableMap": Object { - "X": Object { + "foo": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 5, + "$ref": 11, }, "variables": Array [ Object { @@ -18670,39 +20136,66 @@ Object { "defs": Array [ Object { "name": Object { - "name": "X", + "name": "foo", "range": Array [ - 64, - 65, + 9, + 12, ], "type": "Identifier", }, "node": Object { "range": Array [ - 58, - 81, + 0, + 106, ], - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, "parent": null, - "type": "ClassName", + "type": "FunctionName", + }, + Object { + "name": Object { + "name": "foo", + "range": Array [ + 117, + 120, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 108, + 210, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "X", + "name": "foo", "range": Array [ - 64, - 65, + 9, + 12, + ], + "type": "Identifier", + }, + Object { + "name": "foo", + "range": Array [ + 117, + 120, ], "type": "Identifier", }, ], - "name": "X", + "name": "foo", "references": Array [], "scope": Object { - "$ref": 5, + "$ref": 11, }, }, ], @@ -18716,212 +20209,152 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 6, + "$ref": 12, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/object-with-typed-methods.src 1`] = ` +exports[`typescript fixtures/basics/readonly-tuples.src 1`] = ` Object { - "$id": 12, + "$id": 8, "block": Object { "range": Array [ 0, - 176, + 119, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 11, - "block": Object { - "range": Array [ - 0, - 176, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 3, - "block": Object { - "range": Array [ - 29, - 61, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 2, - }, - }, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [ - Object { - "$id": 2, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - ], - }, - Object { - "$id": 5, - "block": Object { - "range": Array [ - 68, - 100, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 4, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ - Object { - "$id": 4, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - ], - }, + "$id": 7, + "block": Object { + "range": Array [ + 0, + 119, + ], + "type": "Program", + }, + "childScopes": Array [ Object { - "$id": 7, + "$id": 6, "block": Object { "range": Array [ - 109, - 138, + 0, + 118, ], - "type": "FunctionExpression", + "type": "FunctionDeclaration", }, "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 6, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "console", + "range": Array [ + 50, + 57, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - }, - "variableScope": Object { - "$ref": 7, - }, - "variables": Array [ Object { - "$id": 6, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 7, + "$id": 4, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "pair", + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "pair", + "range": Array [ + 84, + 88, + ], + "type": "Identifier", }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, }, ], - }, - Object { - "$id": 10, - "block": Object { - "range": Array [ - 147, - 172, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 11, + "$ref": 7, }, "variableMap": Object { "arguments": Object { - "$ref": 8, + "$ref": 1, }, - "x": Object { - "$ref": 9, + "pair": Object { + "$ref": 2, }, }, "variableScope": Object { - "$ref": 10, + "$ref": 6, }, "variables": Array [ Object { - "$id": 8, + "$id": 1, "defs": Array [], "eslintUsed": undefined, "identifiers": Array [], "name": "arguments", "references": Array [], "scope": Object { - "$ref": 10, + "$ref": 6, }, }, Object { - "$id": 9, + "$id": 2, "defs": Array [ Object { "name": Object { - "name": "x", + "name": "pair", "range": Array [ - 148, - 157, + 13, + 44, ], "type": "Identifier", }, "node": Object { "range": Array [ - 147, - 172, + 0, + 118, ], - "type": "FunctionExpression", + "type": "FunctionDeclaration", }, "parent": null, "type": "Parameter", @@ -18930,18 +20363,25 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "x", + "name": "pair", "range": Array [ - 148, - 157, + 13, + 44, ], "type": "Identifier", }, ], - "name": "x", - "references": Array [], + "name": "pair", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + ], "scope": Object { - "$ref": 10, + "$ref": 6, }, }, ], @@ -18949,37 +20389,15 @@ Object { ], "functionExpressionScope": false, "isStrict": true, - "references": Array [ + "references": Array [], + "throughReferences": Array [ Object { - "$id": 1, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 12, - 174, - ], - "type": "ObjectExpression", - }, + "$ref": 3, }, ], - "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 12, + "$ref": 8, }, "variableMap": Object { "foo": Object { @@ -18987,7 +20405,7 @@ Object { }, }, "variableScope": Object { - "$ref": 11, + "$ref": 7, }, "variables": Array [ Object { @@ -18997,26 +20415,20 @@ Object { "name": Object { "name": "foo", "range": Array [ - 6, 9, + 12, ], "type": "Identifier", }, "node": Object { - "range": Array [ - 6, - 174, - ], - "type": "VariableDeclarator", - }, - "parent": Object { "range": Array [ 0, - 175, + 118, ], - "type": "VariableDeclaration", + "type": "FunctionDeclaration", }, - "type": "Variable", + "parent": null, + "type": "FunctionName", }, ], "eslintUsed": undefined, @@ -19024,20 +20436,16 @@ Object { Object { "name": "foo", "range": Array [ - 6, 9, + 12, ], "type": "Identifier", }, ], "name": "foo", - "references": Array [ - Object { - "$ref": 1, - }, - ], + "references": Array [], "scope": Object { - "$ref": 11, + "$ref": 7, }, }, ], @@ -19046,62 +20454,16 @@ Object { "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 12, - }, - "variables": Array [], -} -`; - -exports[`typescript fixtures/basics/parenthesized-use-strict.src 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 45, - 60, - ], - "type": "Program", - }, - "childScopes": Array [ + "throughReferences": Array [ Object { - "$id": 0, - "block": Object { - "range": Array [ - 45, - 60, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], + "$ref": 3, }, ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 1, + "$ref": 8, }, "variables": Array [], } diff --git a/packages/shared-fixtures/fixtures/typescript/basics/const-assertions.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/const-assertions.src.ts new file mode 100644 index 00000000000..d95b3cb4e6c --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/const-assertions.src.ts @@ -0,0 +1,17 @@ +// Type '10' +let x = 10 as const; + +// Type 'readonly [10, 20]' +let y = [10, 20] as const; + +// Type '{ readonly text: "hello" }' +let z = { text: "hello" } as const; + +// Type '10' +let x = 10; + +// Type 'readonly [10, 20]' +let y = [10, 20]; + +// Type '{ readonly text: "hello" }' +let z = { text: "hello" }; diff --git a/packages/shared-fixtures/fixtures/typescript/basics/global-this.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/global-this.src.ts new file mode 100644 index 00000000000..a219fe27178 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/global-this.src.ts @@ -0,0 +1,12 @@ +// in a global file: + +var abc = 100; + +// Refers to 'abc' from above. +globalThis.abc = 200; + + +let answer = 42; + +// error! Property 'answer' does not exist on 'typeof globalThis'. +globalThis.answer = 333333; diff --git a/packages/shared-fixtures/fixtures/typescript/basics/readonly-arrays.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/readonly-arrays.src.ts new file mode 100644 index 00000000000..83f7deafe47 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/readonly-arrays.src.ts @@ -0,0 +1,9 @@ +function foo(arr: ReadonlyArray) { + arr.slice(); // okay + arr.push("hello!"); // error! +} + +function foo(arr: readonly string[]) { + arr.slice(); // okay + arr.push("hello!"); // error! +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/readonly-tuples.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/readonly-tuples.src.ts new file mode 100644 index 00000000000..7943731f1ba --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/readonly-tuples.src.ts @@ -0,0 +1,4 @@ +function foo(pair: readonly [string, string]) { + console.log(pair[0]); // okay + pair[1] = "hello!"; // error +} diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index b3e75f21edb..b476413731b 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -86,6 +86,7 @@ const TOKEN_TO_TEXT: { readonly [P in ts.SyntaxKind]?: string } = { [SyntaxKind.KeyOfKeyword]: 'keyof', [SyntaxKind.NewKeyword]: 'new', [SyntaxKind.ImportKeyword]: 'import', + [SyntaxKind.ReadonlyKeyword]: 'readonly', }; /** diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 28a0c157a29..8504513ef2e 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -15,7 +15,7 @@ import { getFirstSemanticOrSyntacticError } from './semantic-errors'; * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.4.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.5.0'; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, 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 7c8b4f2d5eb..f30b35c3283 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -389,6 +389,12 @@ tester.addFixturePatternConfig('typescript/basics', { * TODO: remove me in next babel > 7.3.2 */ 'arrow-function-with-optional-parameter', + /** + * [BABEL ERRORED, BUT TS-ESTREE DID NOT] + */ + 'const-assertions', + 'readonly-arrays', + 'readonly-tuples', ], ignoreSourceType: [ /** diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap index 3049a51ae47..edb333d7c83 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap @@ -21,6 +21,7 @@ Object { 12, 12, ], + "transformFlags": 0, "type": "TSEndOfFileToken", }, "externalModuleIndicator": undefined, @@ -33,7 +34,7 @@ Object { }, "isDeclarationFile": false, "languageVariant": 1, - "languageVersion": 6, + "languageVersion": 7, "libReferenceDirectives": Array [], "lineMap": Array [ null, @@ -168,7 +169,7 @@ Object { }, ], "text": "new foo()", - "transformFlags": undefined, + "transformFlags": 0, "type": "TSSourceFile", "typeReferenceDirectives": Array [], } @@ -226,7 +227,7 @@ Object { 11, 35, ], - "transformFlags": undefined, + "transformFlags": 0, "type": "TSJSDocNullableType", "typeAnnotation": Object { "loc": Object { @@ -366,7 +367,7 @@ Object { 21, 35, ], - "transformFlags": undefined, + "transformFlags": 0, "type": "TSJSDocNullableType", "typeAnnotation": Object { "loc": Object { @@ -399,7 +400,7 @@ Object { 22, 35, ], - "transformFlags": undefined, + "transformFlags": 0, "type": "TSJSDocNullableType", "typeAnnotation": Object { "loc": Object { @@ -589,7 +590,7 @@ Object { 0, 18, ], - "transformFlags": undefined, + "transformFlags": 0, "type": "TSClassDeclaration", "typeParameters": null, } @@ -630,7 +631,7 @@ Object { 0, 12, ], - "transformFlags": undefined, + "transformFlags": 0, "type": "TSNewExpression", "typeParameters": Object { "loc": Object { @@ -726,7 +727,7 @@ Object { 0, 15, ], - "transformFlags": undefined, + "transformFlags": 0, "type": "TSClassDeclaration", "typeParameters": Object { "loc": Object { 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 733bb36fbfc..efd3dd82094 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 @@ -1770,6 +1770,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-type-parameter-underscore.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/const-assertions.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/const-enum.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/declare-class-with-optional-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -1834,6 +1836,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-types-assignation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/global-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-equal-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-export-equal-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -1889,6 +1893,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/parenthesized-use-strict.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/readonly-arrays.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/readonly-tuples.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/symbol-type-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-alias-declaration.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 d8494a997ac..c8f0cf9e364 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -30001,45 +30001,16 @@ Object { } `; -exports[`typescript fixtures/basics/const-enum.src 1`] = ` +exports[`typescript fixtures/basics/const-assertions.src 1`] = ` Object { "body": Array [ Object { - "const": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 11, - 14, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "members": Array [ + "declarations": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 2, }, "start": Object { @@ -30047,1287 +30018,1331 @@ Object { "line": 2, }, }, - "name": "foo", + "name": "x", "range": Array [ - 21, - 24, + 17, + 18, ], "type": "Identifier", }, - "initializer": Object { + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 21, + 23, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, "loc": Object { "end": Object { - "column": 11, + "column": 19, "line": 2, }, "start": Object { - "column": 10, + "column": 8, "line": 2, }, }, "range": Array [ - 27, - 28, + 21, + 32, ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 21, - 28, - ], - "type": "TSEnumMember", - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, }, - "start": Object { - "column": 4, - "line": 3, + "range": Array [ + 27, + 32, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "const", + "range": Array [ + 27, + 32, + ], + "type": "Identifier", }, }, - "name": "bar", - "range": Array [ - 34, - 37, - ], - "type": "Identifier", }, "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 19, + "line": 2, }, "start": Object { "column": 4, - "line": 3, + "line": 2, }, }, "range": Array [ - 34, - 37, + 17, + 32, ], - "type": "TSEnumMember", - }, - ], - "range": Array [ - 0, - 39, - ], - "type": "TSEnumDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 39, - ], - "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": "const", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 10, - ], - "type": "Keyword", - "value": "enum", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 14, - ], - "type": "Identifier", - "value": "Foo", - }, - 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": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, + "type": "VariableDeclarator", }, - }, - "range": Array [ - 27, - 28, ], - "type": "Numeric", - "value": "1", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, + "column": 20, "line": 2, }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, "start": Object { "column": 0, - "line": 4, + "line": 2, }, }, "range": Array [ - 38, - 39, + 13, + 33, ], - "type": "Punctuator", - "value": "}", + "type": "VariableDeclaration", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/declare-class-with-optional-method.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": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "y", + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 72, + 74, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 76, + 78, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + ], "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 16, + "line": 5, }, "start": Object { - "column": 4, - "line": 2, + "column": 8, + "line": 5, }, }, - "name": "bar", - "optional": true, "range": Array [ - 24, - 27, + 71, + 79, ], - "type": "Identifier", + "type": "ArrayExpression", }, - "kind": "method", "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 25, + "line": 5, }, "start": Object { - "column": 4, - "line": 2, + "column": 8, + "line": 5, }, }, "range": Array [ - 24, - 36, + 71, + 88, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, + "type": "TSAsExpression", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 25, + "line": 5, }, "start": Object { - "column": 8, - "line": 2, + "column": 20, + "line": 5, }, }, - "params": Array [], "range": Array [ - 28, - 36, + 83, + 88, ], - "returnType": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 25, + "line": 5, }, "start": Object { - "column": 10, - "line": 2, + "column": 20, + "line": 5, }, }, + "name": "const", "range": Array [ - 30, - 35, + 83, + 88, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 32, - 35, - ], - "type": "TSAnyKeyword", - }, + "type": "Identifier", }, - "type": "FunctionExpression", }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 38, - ], - "type": "ClassBody", - }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, }, + "range": Array [ + 67, + 88, + ], + "type": "VariableDeclarator", }, - "name": "Foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 26, + "line": 5, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 38, + 63, + 89, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "VariableDeclaration", }, - }, - "range": Array [ - 0, - 38, - ], - "sourceType": "script", - "tokens": Array [ Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "z", + "range": Array [ + 132, + 133, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "name": "text", + "range": Array [ + 138, + 142, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "method": false, + "range": Array [ + 138, + 151, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 144, + 151, + ], + "raw": "\\"hello\\"", + "type": "Literal", + "value": "hello", + }, + }, + ], + "range": Array [ + 136, + 153, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 136, + 162, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 29, + "line": 8, + }, + }, + "range": Array [ + 157, + 162, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 29, + "line": 8, + }, + }, + "name": "const", + "range": Array [ + 157, + 162, + ], + "type": "Identifier", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 132, + 162, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 0, - 7, ], - "type": "Identifier", - "value": "declare", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 35, + "line": 8, }, "start": Object { - "column": 8, - "line": 1, + "column": 0, + "line": 8, }, }, "range": Array [ - 8, - 13, + 128, + 163, ], - "type": "Keyword", - "value": "class", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "name": "x", + "range": Array [ + 182, + 183, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 193, + 195, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 186, + 195, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 187, + 192, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "name": "const", + "range": Array [ + 187, + 192, + ], + "type": "Identifier", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 182, + 195, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 14, - 17, ], - "type": "Identifier", - "value": "Foo", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 18, + "line": 11, }, "start": Object { - "column": 18, - "line": 1, + "column": 0, + "line": 11, }, }, "range": Array [ - 18, - 19, + 178, + 196, ], - "type": "Punctuator", - "value": "{", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "name": "y", + "range": Array [ + 230, + 231, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 242, + 244, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 14, + }, + "start": Object { + "column": 20, + "line": 14, + }, + }, + "range": Array [ + 246, + 248, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 15, + "line": 14, + }, + }, + "range": Array [ + 241, + 249, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "range": Array [ + 234, + 249, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 9, + "line": 14, + }, + }, + "range": Array [ + 235, + 240, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 9, + "line": 14, + }, + }, + "name": "const", + "range": Array [ + 235, + 240, + ], + "type": "Identifier", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 230, + 249, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 24, - 27, ], - "type": "Identifier", - "value": "bar", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 24, + "line": 14, }, "start": Object { - "column": 7, - "line": 2, + "column": 0, + "line": 14, }, }, "range": Array [ - 27, - 28, + 226, + 250, ], - "type": "Punctuator", - "value": "?", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 35, - 36, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 37, - 38, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/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": 42, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ + "declarations": Array [ Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 17, + }, + "start": Object { + "column": 4, + "line": 17, + }, }, + "name": "z", + "range": Array [ + 293, + 294, + ], + "type": "Identifier", }, - "name": "bar", - "range": Array [ - 21, - 32, - ], - "type": "Identifier", - "typeAnnotation": Object { + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 15, + "line": 17, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "name": "text", + "range": Array [ + 306, + 310, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 30, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "method": false, + "range": Array [ + 306, + 319, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 17, + }, + "start": Object { + "column": 23, + "line": 17, + }, + }, + "range": Array [ + 312, + 319, + ], + "raw": "\\"hello\\"", + "type": "Literal", + "value": "hello", + }, + }, + ], + "range": Array [ + 304, + 321, + ], + "type": "ObjectExpression", + }, "loc": Object { "end": Object { "column": 32, - "line": 1, + "line": 17, }, "start": Object { - "column": 24, - "line": 1, + "column": 8, + "line": 17, }, }, "range": Array [ - 24, - 32, + 297, + 321, ], - "type": "TSTypeAnnotation", + "type": "TSTypeAssertion", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 14, + "line": 17, }, "start": Object { - "column": 26, - "line": 1, + "column": 9, + "line": 17, }, }, "range": Array [ - 26, - 32, + 298, + 303, ], - "type": "TSStringKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 17, + }, + "start": Object { + "column": 9, + "line": 17, + }, + }, + "name": "const", + "range": Array [ + 298, + 303, + ], + "type": "Identifier", + }, }, }, - }, - ], - "range": Array [ - 0, - 42, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 41, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 32, + "line": 17, }, "start": Object { - "column": 35, - "line": 1, + "column": 4, + "line": 17, }, }, "range": Array [ - 35, - 41, + 293, + 321, ], - "type": "TSStringKeyword", + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 33, + "line": 17, + }, + "start": Object { + "column": 0, + "line": 17, }, }, - "type": "TSDeclareFunction", + "range": Array [ + 289, + 322, + ], + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 0, + "line": 18, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 42, + 13, + 323, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 7, + 13, + 16, ], - "type": "Identifier", - "value": "declare", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 8, - 16, + 17, + 18, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 6, + "line": 2, }, }, "range": Array [ - 17, + 19, 20, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 20, 21, + 23, ], - "type": "Punctuator", - "value": "(", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 21, 24, + 26, ], "type": "Identifier", - "value": "bar", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 24, - 25, + 27, + 32, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 26, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 26, 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 63, + 66, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 67, + 68, ], "type": "Identifier", - "value": "string", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 7, + "line": 5, }, "start": Object { - "column": 32, - "line": 1, + "column": 6, + "line": 5, }, }, "range": Array [ - 32, - 33, + 69, + 70, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 33, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 33, - 34, + 71, + 72, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 11, + "line": 5, }, "start": Object { - "column": 35, - "line": 1, + "column": 9, + "line": 5, }, }, "range": Array [ - 35, - 41, + 72, + 74, ], - "type": "Identifier", - "value": "string", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 12, + "line": 5, }, "start": Object { - "column": 41, - "line": 1, + "column": 11, + "line": 5, }, }, "range": Array [ - 41, - 42, + 74, + 75, ], "type": "Punctuator", - "value": ";", + "value": ",", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/destructuring-assignment.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 3, - 6, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 3, - 11, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 3, - 6, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 11, - ], - "right": Object { - "elements": Array [], - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "type": "ArrayExpression", - }, - "type": "AssignmentPattern", - }, - }, - ], - "range": Array [ - 1, - 13, - ], - "type": "ObjectPattern", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 15, + "line": 5, }, - "operator": "=", - "range": Array [ - 1, - 19, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 16, - 19, - ], - "type": "Identifier", + "start": Object { + "column": 13, + "line": 5, }, - "type": "AssignmentExpression", }, + "range": Array [ + 76, + 78, + ], + "type": "Numeric", + "value": "20", + }, + Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 16, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 15, + "line": 5, }, }, "range": Array [ - 0, - 21, + 78, + 79, ], - "type": "ExpressionStatement", + "type": "Punctuator", + "value": "]", }, - ], - "loc": Object { - "end": Object { - "column": 21, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 80, + 82, + ], + "type": "Identifier", + "value": "as", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 83, + 88, + ], + "type": "Keyword", + "value": "const", }, - }, - "range": Array [ - 0, - 21, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, - "line": 1, + "column": 26, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 25, + "line": 5, }, }, "range": Array [ - 0, - 1, + 88, + 89, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 1, + "column": 3, + "line": 8, }, "start": Object { - "column": 1, - "line": 1, + "column": 0, + "line": 8, }, }, "range": Array [ - 1, - 2, + 128, + 131, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 5, + "line": 8, }, "start": Object { - "column": 3, - "line": 1, + "column": 4, + "line": 8, }, }, "range": Array [ - 3, - 6, + 132, + 133, ], "type": "Identifier", - "value": "foo", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 7, + "line": 8, }, "start": Object { - "column": 7, - "line": 1, + "column": 6, + "line": 8, }, }, "range": Array [ - 7, - 8, + 134, + 135, ], "type": "Punctuator", "value": "=", @@ -31335,53 +31350,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 9, + "line": 8, }, "start": Object { - "column": 9, - "line": 1, + "column": 8, + "line": 8, }, }, "range": Array [ - 9, - 10, + 136, + 137, ], "type": "Punctuator", - "value": "[", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 14, + "line": 8, }, "start": Object { "column": 10, - "line": 1, + "line": 8, }, }, "range": Array [ - 10, - 11, + 138, + 142, + ], + "type": "Identifier", + "value": "text", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 142, + 143, ], "type": "Punctuator", - "value": "]", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 23, + "line": 8, }, "start": Object { - "column": 12, - "line": 1, + "column": 16, + "line": 8, }, }, "range": Array [ - 12, - 13, + 144, + 151, + ], + "type": "String", + "value": "\\"hello\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 8, + }, + "start": Object { + "column": 24, + "line": 8, + }, + }, + "range": Array [ + 152, + 153, ], "type": "Punctuator", "value": "}", @@ -31389,119 +31440,2139 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 28, + "line": 8, }, "start": Object { - "column": 14, - "line": 1, + "column": 26, + "line": 8, }, }, "range": Array [ - 14, - 15, + 154, + 156, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 29, + "line": 8, + }, + }, + "range": Array [ + 157, + 162, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 8, + }, + "start": Object { + "column": 34, + "line": 8, + }, + }, + "range": Array [ + 162, + 163, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 11, }, "start": Object { - "column": 16, - "line": 1, + "column": 0, + "line": 11, }, }, "range": Array [ - 16, - 19, + 178, + 181, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 182, + 183, ], "type": "Identifier", - "value": "bar", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 7, + "line": 11, }, "start": Object { - "column": 19, - "line": 1, + "column": 6, + "line": 11, }, }, "range": Array [ - 19, - 20, + 184, + 185, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 9, + "line": 11, }, "start": Object { - "column": 20, - "line": 1, + "column": 8, + "line": 11, }, }, "range": Array [ - 20, - 21, + 186, + 187, ], "type": "Punctuator", - "value": ";", + "value": "<", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/destructuring-assignment-nested.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 81, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 3, - 6, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 187, + 192, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "range": Array [ + 192, + 193, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 193, + 195, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 14, + }, + }, + "range": Array [ + 226, + 229, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 230, + 231, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 14, + }, + "start": Object { + "column": 6, + "line": 14, + }, + }, + "range": Array [ + 232, + 233, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "range": Array [ + 234, + 235, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 9, + "line": 14, + }, + }, + "range": Array [ + 235, + 240, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 14, + "line": 14, + }, + }, + "range": Array [ + 240, + 241, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 14, + }, + "start": Object { + "column": 15, + "line": 14, + }, + }, + "range": Array [ + 241, + 242, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 242, + 244, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 14, + }, + "start": Object { + "column": 18, + "line": 14, + }, + }, + "range": Array [ + 244, + 245, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 14, + }, + "start": Object { + "column": 20, + "line": 14, + }, + }, + "range": Array [ + 246, + 248, + ], + "type": "Numeric", + "value": "20", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 22, + "line": 14, + }, + }, + "range": Array [ + 248, + 249, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 14, + }, + "start": Object { + "column": 23, + "line": 14, + }, + }, + "range": Array [ + 249, + 250, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 17, + }, + "start": Object { + "column": 0, + "line": 17, + }, + }, + "range": Array [ + 289, + 292, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 17, + }, + "start": Object { + "column": 4, + "line": 17, + }, + }, + "range": Array [ + 293, + 294, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 17, + }, + "start": Object { + "column": 6, + "line": 17, + }, + }, + "range": Array [ + 295, + 296, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 297, + 298, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 17, + }, + "start": Object { + "column": 9, + "line": 17, + }, + }, + "range": Array [ + 298, + 303, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 17, + }, + "start": Object { + "column": 14, + "line": 17, + }, + }, + "range": Array [ + 303, + 304, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 17, + }, + "start": Object { + "column": 15, + "line": 17, + }, + }, + "range": Array [ + 304, + 305, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "range": Array [ + 306, + 310, + ], + "type": "Identifier", + "value": "text", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 17, + }, + "start": Object { + "column": 21, + "line": 17, + }, + }, + "range": Array [ + 310, + 311, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 17, + }, + "start": Object { + "column": 23, + "line": 17, + }, + }, + "range": Array [ + 312, + 319, + ], + "type": "String", + "value": "\\"hello\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 31, + "line": 17, + }, + }, + "range": Array [ + 320, + 321, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 17, + }, + "start": Object { + "column": 32, + "line": 17, + }, + }, + "range": Array [ + 321, + 322, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/const-enum.src 1`] = ` +Object { + "body": Array [ + Object { + "const": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "TSEnumMember", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 0, + 39, + ], + "type": "TSEnumDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "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": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "Foo", + }, + 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": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "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 [ + 27, + 28, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/declare-class-with-optional-method.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": "bar", + "optional": true, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 36, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 28, + 36, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 38, + ], + "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": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/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": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 21, + 32, + ], + "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 [ + 0, + 42, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSDeclareFunction", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "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": "Keyword", + "value": "function", + }, + 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, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "bar", + }, + 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": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + 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": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/destructuring-assignment.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 11, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 1, + 13, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 19, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "value": "foo", + }, + 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": "Punctuator", + "value": "[", + }, + 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": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "bar", + }, + 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": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/destructuring-assignment-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 81, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { "end": Object { "column": 79, "line": 1, @@ -32047,396 +34118,1206 @@ Object { ], "type": "ObjectPattern", }, - "loc": Object { - "end": Object { - "column": 127, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 127, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 127, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 127, + "line": 1, + }, + "start": Object { + "column": 84, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 1, + }, + "start": Object { + "column": 86, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 86, + 89, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 126, + "line": 1, + }, + "start": Object { + "column": 86, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 86, + 126, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 126, + "line": 1, + }, + "start": Object { + "column": 91, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 96, + "line": 1, + }, + "start": Object { + "column": 93, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 93, + 96, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 124, + "line": 1, + }, + "start": Object { + "column": 93, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 93, + 124, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 124, + "line": 1, + }, + "start": Object { + "column": 98, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 103, + "line": 1, + }, + "start": Object { + "column": 100, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 100, + 103, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 122, + "line": 1, + }, + "start": Object { + "column": 100, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 100, + 122, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 107, + "line": 1, + }, + "start": Object { + "column": 106, + "line": 1, + }, + }, + "range": Array [ + 106, + 107, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + Object { + "loc": Object { + "end": Object { + "column": 121, + "line": 1, + }, + "start": Object { + "column": 109, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 114, + "line": 1, + }, + "start": Object { + "column": 111, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 111, + 114, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 119, + "line": 1, + }, + "start": Object { + "column": 111, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 111, + 119, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 118, + "line": 1, + }, + "start": Object { + "column": 117, + "line": 1, + }, + }, + "range": Array [ + 117, + 118, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + ], + "loc": Object { + "end": Object { + "column": 119, + "line": 1, + }, + "start": Object { + "column": 116, + "line": 1, + }, + }, + "range": Array [ + 116, + 119, + ], + "type": "ArrayExpression", + }, + }, + ], + "range": Array [ + 109, + 121, + ], + "type": "ObjectExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 122, + "line": 1, + }, + "start": Object { + "column": 105, + "line": 1, + }, + }, + "range": Array [ + 105, + 122, + ], + "type": "ArrayExpression", + }, + }, + ], + "range": Array [ + 98, + 124, + ], + "type": "ObjectExpression", + }, + }, + ], + "range": Array [ + 91, + 126, + ], + "type": "ObjectExpression", + }, + }, + ], + "range": Array [ + 84, + 127, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 129, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 129, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 130, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "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": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "bar", + }, + 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": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "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": "baz", + }, + 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": 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": "Identifier", + "value": "a", + }, + 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": 31, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ":", + }, + 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, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "x", + }, + 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": 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": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 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 { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, }, - "operator": "=", - "range": Array [ - 1, - 127, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 127, - "line": 1, - }, - "start": Object { - "column": 84, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 89, - "line": 1, - }, - "start": Object { - "column": 86, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 86, - 89, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 126, - "line": 1, - }, - "start": Object { - "column": 86, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 86, - 126, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 126, - "line": 1, - }, - "start": Object { - "column": 91, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 96, - "line": 1, - }, - "start": Object { - "column": 93, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 93, - 96, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 124, - "line": 1, - }, - "start": Object { - "column": 93, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 93, - 124, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 124, - "line": 1, - }, - "start": Object { - "column": 98, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 103, - "line": 1, - }, - "start": Object { - "column": 100, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 100, - 103, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 122, - "line": 1, - }, - "start": Object { - "column": 100, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 100, - 122, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 107, - "line": 1, - }, - "start": Object { - "column": 106, - "line": 1, - }, - }, - "range": Array [ - 106, - 107, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - Object { - "loc": Object { - "end": Object { - "column": 121, - "line": 1, - }, - "start": Object { - "column": 109, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 114, - "line": 1, - }, - "start": Object { - "column": 111, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 111, - 114, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 119, - "line": 1, - }, - "start": Object { - "column": 111, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 111, - 119, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 118, - "line": 1, - }, - "start": Object { - "column": 117, - "line": 1, - }, - }, - "range": Array [ - 117, - 118, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - ], - "loc": Object { - "end": Object { - "column": 119, - "line": 1, - }, - "start": Object { - "column": 116, - "line": 1, - }, - }, - "range": Array [ - 116, - 119, - ], - "type": "ArrayExpression", - }, - }, - ], - "range": Array [ - 109, - 121, - ], - "type": "ObjectExpression", - }, - ], - "loc": Object { - "end": Object { - "column": 122, - "line": 1, - }, - "start": Object { - "column": 105, - "line": 1, - }, - }, - "range": Array [ - 105, - 122, - ], - "type": "ArrayExpression", - }, - }, - ], - "range": Array [ - 98, - 124, - ], - "type": "ObjectExpression", - }, - }, - ], - "range": Array [ - 91, - 126, - ], - "type": "ObjectExpression", - }, - }, - ], - "range": Array [ - 84, - 127, - ], - "type": "ObjectExpression", + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 60, + "line": 1, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 67, + "line": 1, + }, + }, + "range": Array [ + 67, + 68, + ], + "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": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, }, - "type": "AssignmentExpression", }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "}", + }, + Object { "loc": Object { "end": Object { - "column": 129, + "column": 75, "line": 1, }, "start": Object { - "column": 0, + "column": 74, "line": 1, }, }, "range": Array [ - 0, - 129, + 74, + 75, ], - "type": "ExpressionStatement", + "type": "Punctuator", + "value": "=", }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 76, + "line": 1, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 130, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 81, "line": 1, }, "start": Object { - "column": 0, + "column": 80, "line": 1, }, }, "range": Array [ - 0, - 1, + 80, + 81, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 83, "line": 1, }, "start": Object { - "column": 1, + "column": 82, "line": 1, }, }, "range": Array [ - 1, - 2, + 82, + 83, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 85, + "line": 1, + }, + "start": Object { + "column": 84, + "line": 1, + }, + }, + "range": Array [ + 84, + 85, ], "type": "Punctuator", "value": "{", @@ -32444,17 +35325,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 89, "line": 1, }, "start": Object { - "column": 3, + "column": 86, "line": 1, }, }, "range": Array [ - 3, - 6, + 86, + 89, ], "type": "Identifier", "value": "foo", @@ -32462,17 +35343,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 90, "line": 1, }, "start": Object { - "column": 6, + "column": 89, "line": 1, }, }, "range": Array [ - 6, - 7, + 89, + 90, ], "type": "Punctuator", "value": ":", @@ -32480,17 +35361,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 92, "line": 1, }, "start": Object { - "column": 8, + "column": 91, "line": 1, }, }, "range": Array [ - 8, - 9, + 91, + 92, ], "type": "Punctuator", "value": "{", @@ -32498,17 +35379,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 96, "line": 1, }, "start": Object { - "column": 10, + "column": 93, "line": 1, }, }, "range": Array [ - 10, - 13, + 93, + 96, ], "type": "Identifier", "value": "bar", @@ -32516,17 +35397,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 97, "line": 1, }, "start": Object { - "column": 13, + "column": 96, "line": 1, }, }, "range": Array [ - 13, - 14, + 96, + 97, ], "type": "Punctuator", "value": ":", @@ -32534,17 +35415,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 99, "line": 1, }, "start": Object { - "column": 15, + "column": 98, "line": 1, }, }, "range": Array [ - 15, - 16, + 98, + 99, ], "type": "Punctuator", "value": "{", @@ -32552,17 +35433,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 103, "line": 1, }, "start": Object { - "column": 17, + "column": 100, "line": 1, }, }, "range": Array [ - 17, - 20, + 100, + 103, ], "type": "Identifier", "value": "baz", @@ -32570,17 +35451,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 104, "line": 1, }, "start": Object { - "column": 20, + "column": 103, "line": 1, }, }, "range": Array [ - 20, - 21, + 103, + 104, ], "type": "Punctuator", "value": ":", @@ -32588,17 +35469,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 106, "line": 1, }, "start": Object { - "column": 22, + "column": 105, "line": 1, }, }, "range": Array [ - 22, - 23, + 105, + 106, ], "type": "Punctuator", "value": "[", @@ -32606,35 +35487,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 107, "line": 1, }, "start": Object { - "column": 23, + "column": 106, "line": 1, }, }, "range": Array [ - 23, - 24, + 106, + 107, ], - "type": "Identifier", - "value": "a", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 108, "line": 1, }, "start": Object { - "column": 24, + "column": 107, "line": 1, }, }, "range": Array [ - 24, - 25, + 107, + 108, ], "type": "Punctuator", "value": ",", @@ -32642,17 +35523,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 110, "line": 1, }, "start": Object { - "column": 26, + "column": 109, "line": 1, }, }, "range": Array [ - 26, - 27, + 109, + 110, ], "type": "Punctuator", "value": "{", @@ -32660,17 +35541,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 114, "line": 1, }, "start": Object { - "column": 28, + "column": 111, "line": 1, }, }, "range": Array [ - 28, - 31, + 111, + 114, ], "type": "Identifier", "value": "foo", @@ -32678,17 +35559,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 115, "line": 1, }, "start": Object { - "column": 31, + "column": 114, "line": 1, }, }, "range": Array [ - 31, - 32, + 114, + 115, ], "type": "Punctuator", "value": ":", @@ -32696,17 +35577,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 117, "line": 1, }, "start": Object { - "column": 33, + "column": 116, "line": 1, }, }, "range": Array [ - 33, - 34, + 116, + 117, ], "type": "Punctuator", "value": "[", @@ -32714,35 +35595,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 118, "line": 1, }, "start": Object { - "column": 34, + "column": 117, "line": 1, }, }, "range": Array [ - 34, - 35, + 117, + 118, ], - "type": "Identifier", - "value": "x", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 119, "line": 1, }, "start": Object { - "column": 35, + "column": 118, "line": 1, }, }, "range": Array [ - 35, - 36, + 118, + 119, ], "type": "Punctuator", "value": "]", @@ -32750,125 +35631,350 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 121, "line": 1, }, "start": Object { - "column": 37, + "column": 120, "line": 1, }, }, "range": Array [ - 37, - 38, + 120, + 121, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 122, "line": 1, }, "start": Object { - "column": 39, + "column": 121, + "line": 1, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 124, + "line": 1, + }, + "start": Object { + "column": 123, + "line": 1, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 126, + "line": 1, + }, + "start": Object { + "column": 125, + "line": 1, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 127, + "line": 1, + }, + "start": Object { + "column": 126, + "line": 1, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 128, + "line": 1, + }, + "start": Object { + "column": 127, + "line": 1, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 129, + "line": 1, + }, + "start": Object { + "column": 128, "line": 1, }, }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": "[", - }, - Object { + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/destructuring-assignment-object.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 9, + 11, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 1, + 13, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 19, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, "loc": Object { "end": Object { - "column": 41, + "column": 21, "line": 1, }, "start": Object { - "column": 40, + "column": 0, "line": 1, }, }, "range": Array [ - 40, - 41, + 0, + 21, ], - "type": "Numeric", - "value": "3", + "type": "ExpressionStatement", }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": "]", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, - Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 43, - "line": 1, - }, - }, - "range": Array [ - 43, - 44, - ], - "type": "Punctuator", - "value": "}", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 46, + "column": 1, "line": 1, }, "start": Object { - "column": 45, + "column": 0, "line": 1, }, }, "range": Array [ - 45, - 46, + 0, + 1, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 2, "line": 1, }, "start": Object { - "column": 47, + "column": 1, "line": 1, }, }, "range": Array [ - 47, - 48, + 1, + 2, ], "type": "Punctuator", "value": "{", @@ -32876,17 +35982,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 52, + "column": 6, "line": 1, }, "start": Object { - "column": 49, + "column": 3, "line": 1, }, }, "range": Array [ - 49, - 52, + 3, + 6, ], "type": "Identifier", "value": "foo", @@ -32894,89 +36000,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 53, - "line": 1, - }, - "start": Object { - "column": 52, - "line": 1, - }, - }, - "range": Array [ - 52, - 53, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 55, + "column": 8, "line": 1, }, "start": Object { - "column": 54, + "column": 7, "line": 1, }, }, "range": Array [ - 54, - 55, + 7, + 8, ], "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 56, - "line": 1, - }, - "start": Object { - "column": 55, - "line": 1, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Numeric", - "value": "2", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 57, + "column": 10, "line": 1, }, "start": Object { - "column": 56, + "column": 9, "line": 1, }, }, "range": Array [ - 56, - 57, + 9, + 10, ], "type": "Punctuator", - "value": "]", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 58, + "column": 11, "line": 1, }, "start": Object { - "column": 57, + "column": 10, "line": 1, }, }, "range": Array [ - 57, - 58, + 10, + 11, ], "type": "Punctuator", "value": "}", @@ -32984,35 +36054,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 59, + "column": 13, "line": 1, }, "start": Object { - "column": 58, + "column": 12, "line": 1, }, }, "range": Array [ - 58, - 59, + 12, + 13, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 61, + "column": 15, "line": 1, }, "start": Object { - "column": 60, + "column": 14, "line": 1, }, }, "range": Array [ - 60, - 61, + 14, + 15, ], "type": "Punctuator", "value": "=", @@ -33020,233 +36090,354 @@ Object { Object { "loc": Object { "end": Object { - "column": 63, + "column": 19, "line": 1, }, "start": Object { - "column": 62, + "column": 16, "line": 1, }, }, "range": Array [ - 62, - 63, + 16, + 19, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 64, + "column": 20, "line": 1, }, "start": Object { - "column": 63, + "column": 19, "line": 1, }, }, "range": Array [ - 63, - 64, + 19, + 20, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 66, + "column": 21, "line": 1, }, "start": Object { - "column": 65, + "column": 20, "line": 1, }, }, "range": Array [ - 65, - 66, + 20, + 21, ], "type": "Punctuator", - "value": "}", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/destructuring-assignment-property.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 68, - "line": 1, - }, - "start": Object { - "column": 67, - "line": 1, + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, }, + "range": Array [ + 33, + 37, + ], + "type": "BlockStatement", }, - "range": Array [ - 67, - 68, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 70, - "line": 1, - }, - "start": Object { - "column": 69, - "line": 1, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", }, - "range": Array [ - 69, - 70, - ], - "type": "Punctuator", - "value": "{", - }, - Object { "loc": Object { "end": Object { - "column": 71, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 70, + "column": 0, "line": 1, }, }, - "range": Array [ - 70, - 71, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 73, - "line": 1, - }, - "start": Object { - "column": 72, - "line": 1, + "params": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 15, + 23, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": 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": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 13, + 25, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + }, + "type": "AssignmentPattern", }, - }, - "range": Array [ - 72, - 73, ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 75, - "line": 1, - }, - "start": Object { - "column": 74, - "line": 1, - }, - }, "range": Array [ - 74, - 75, + 0, + 37, ], - "type": "Punctuator", - "value": "=", + "type": "FunctionDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 76, - "line": 1, - }, - }, - "range": Array [ - 76, - 77, - ], - "type": "Punctuator", - "value": "{", + ], + "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": 79, + "column": 8, "line": 1, }, "start": Object { - "column": 78, + "column": 0, "line": 1, }, }, "range": Array [ - 78, - 79, + 0, + 8, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 81, + "column": 12, "line": 1, }, "start": Object { - "column": 80, + "column": 9, "line": 1, }, }, "range": Array [ - 80, - 81, + 9, + 12, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 83, + "column": 13, "line": 1, }, "start": Object { - "column": 82, + "column": 12, "line": 1, }, }, "range": Array [ - 82, - 83, + 12, + 13, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 85, + "column": 14, "line": 1, }, "start": Object { - "column": 84, + "column": 13, "line": 1, }, }, "range": Array [ - 84, - 85, + 13, + 14, ], "type": "Punctuator", "value": "{", @@ -33254,17 +36445,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 89, + "column": 18, "line": 1, }, "start": Object { - "column": 86, + "column": 15, "line": 1, }, }, "range": Array [ - 86, - 89, + 15, + 18, ], "type": "Identifier", "value": "foo", @@ -33272,215 +36463,423 @@ Object { Object { "loc": Object { "end": Object { - "column": 90, + "column": 20, "line": 1, }, "start": Object { - "column": 89, + "column": 19, "line": 1, }, }, "range": Array [ - 89, - 90, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 92, + "column": 22, "line": 1, }, "start": Object { - "column": 91, + "column": 21, "line": 1, }, }, "range": Array [ - 91, - 92, + 21, + 22, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 96, + "column": 23, "line": 1, }, "start": Object { - "column": 93, + "column": 22, "line": 1, }, }, "range": Array [ - 93, - 96, + 22, + 23, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 97, + "column": 25, "line": 1, }, "start": Object { - "column": 96, + "column": 24, "line": 1, }, }, "range": Array [ - 96, - 97, + 24, + 25, ], "type": "Punctuator", - "value": ":", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 99, + "column": 27, "line": 1, }, "start": Object { - "column": 98, + "column": 26, "line": 1, }, }, "range": Array [ - 98, - 99, + 26, + 27, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 103, + "column": 31, "line": 1, }, "start": Object { - "column": 100, + "column": 28, "line": 1, }, }, "range": Array [ - 100, - 103, + 28, + 31, ], "type": "Identifier", - "value": "baz", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 104, + "column": 32, "line": 1, }, "start": Object { - "column": 103, + "column": 31, "line": 1, }, }, "range": Array [ - 103, - 104, + 31, + 32, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 106, + "column": 34, "line": 1, }, "start": Object { - "column": 105, + "column": 33, "line": 1, }, }, "range": Array [ - 105, - 106, + 33, + 34, ], "type": "Punctuator", - "value": "[", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 107, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 106, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 106, - 107, + 36, + 37, ], - "type": "Numeric", - "value": "2", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/directive-in-module.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 27, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 28, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 35, + 40, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 31, + 41, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 44, + 56, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 44, + 57, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 59, + ], + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 108, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 107, + "column": 0, "line": 1, }, }, "range": Array [ - 107, - 108, + 0, + 59, ], - "type": "Punctuator", - "value": ",", + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 60, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 110, + "column": 6, "line": 1, }, "start": Object { - "column": 109, + "column": 0, "line": 1, }, }, "range": Array [ - 109, - 110, + 0, + 6, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "module", }, Object { "loc": Object { "end": Object { - "column": 114, + "column": 10, "line": 1, }, "start": Object { - "column": 111, + "column": 7, "line": 1, }, }, "range": Array [ - 111, - 114, + 7, + 10, ], "type": "Identifier", "value": "foo", @@ -33488,361 +36887,398 @@ Object { Object { "loc": Object { "end": Object { - "column": 115, + "column": 12, "line": 1, }, "start": Object { - "column": 114, + "column": 11, "line": 1, }, }, "range": Array [ - 114, - 115, + 11, + 12, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 117, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 116, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 116, - 117, + 15, + 27, ], - "type": "Punctuator", - "value": "[", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 118, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 117, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 117, - 118, + 27, + 28, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 119, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 118, - "line": 1, + "column": 2, + "line": 3, }, }, "range": Array [ - 118, - 119, + 31, + 34, ], - "type": "Punctuator", - "value": "]", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 121, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 120, - "line": 1, + "column": 6, + "line": 3, }, }, "range": Array [ - 120, - 121, + 35, + 36, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 122, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { - "column": 121, - "line": 1, + "column": 8, + "line": 3, }, }, "range": Array [ - 121, - 122, + 37, + 38, ], "type": "Punctuator", - "value": "]", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 124, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 123, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 123, - 124, + 39, + 40, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 126, - "line": 1, + "column": 12, + "line": 3, }, "start": Object { - "column": 125, - "line": 1, + "column": 11, + "line": 3, }, }, "range": Array [ - 125, - 126, + 40, + 41, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 127, - "line": 1, + "column": 14, + "line": 4, }, "start": Object { - "column": 126, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 126, - 127, + 44, + 56, ], - "type": "Punctuator", - "value": "}", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 128, - "line": 1, + "column": 15, + "line": 4, }, "start": Object { - "column": 127, - "line": 1, + "column": 14, + "line": 4, }, }, "range": Array [ - 127, - 128, + 56, + 57, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 129, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 128, - "line": 1, + "column": 0, + "line": 5, }, }, "range": Array [ - 128, - 129, + 58, + 59, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/destructuring-assignment-object.src 1`] = ` +exports[`typescript fixtures/basics/directive-in-namespace.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 3, - 6, - ], - "type": "Identifier", - }, - "kind": "init", + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 3, - "line": 1, + "column": 2, + "line": 2, }, }, - "method": false, "range": Array [ - 3, - 11, + 18, + 30, ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 31, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 3, - "line": 1, + "column": 6, + "line": 3, }, }, - "name": "foo", + "name": "a", "range": Array [ - 3, - 6, + 38, + 39, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 11, - ], - "right": Object { + "init": Object { "loc": Object { "end": Object { "column": 11, - "line": 1, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 10, + "line": 3, }, }, - "properties": Array [], "range": Array [ - 9, - 11, + 42, + 43, ], - "type": "ObjectExpression", + "raw": "1", + "type": "Literal", + "value": 1, }, - "type": "AssignmentPattern", + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 38, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, }, }, - ], - "range": Array [ - 1, - 13, - ], - "type": "ObjectPattern", - }, + "range": Array [ + 34, + 44, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 47, + 59, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 47, + 60, + ], + "type": "ExpressionStatement", + }, + ], "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 1, + "column": 14, "line": 1, }, }, - "operator": "=", "range": Array [ - 1, - 19, + 14, + 62, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, }, - "name": "bar", - "range": Array [ - 16, - 19, - ], - "type": "Identifier", }, - "type": "AssignmentExpression", + "name": "foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -33851,15 +37287,15 @@ Object { }, "range": Array [ 0, - 21, + 62, ], - "type": "ExpressionStatement", + "type": "TSModuleDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 6, }, "start": Object { "column": 0, @@ -33868,14 +37304,14 @@ Object { }, "range": Array [ 0, - 22, + 63, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 9, "line": 1, }, "start": Object { @@ -33885,133 +37321,133 @@ Object { }, "range": Array [ 0, - 1, + 9, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "namespace", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 13, "line": 1, }, "start": Object { - "column": 1, + "column": 10, "line": 1, }, }, "range": Array [ - 1, - 2, + 10, + 13, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 15, "line": 1, }, "start": Object { - "column": 3, + "column": 14, "line": 1, }, }, "range": Array [ - 3, - 6, + 14, + 15, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 7, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 7, - 8, + 18, + 30, ], - "type": "Punctuator", - "value": "=", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 9, - 10, + 30, + 31, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 10, - "line": 1, + "column": 2, + "line": 3, }, }, "range": Array [ - 10, - 11, + 34, + 37, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 12, - "line": 1, + "column": 6, + "line": 3, }, }, "range": Array [ - 12, - 13, + 38, + 39, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { - "column": 14, - "line": 1, + "column": 8, + "line": 3, }, }, "range": Array [ - 14, - 15, + 40, + 41, ], "type": "Punctuator", "value": "=", @@ -34019,274 +37455,141 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 16, - 19, + 42, + 43, ], - "type": "Identifier", - "value": "bar", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 12, + "line": 3, }, "start": Object { - "column": 19, - "line": 1, + "column": 11, + "line": 3, }, }, "range": Array [ - 19, - 20, + 43, + 44, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 14, + "line": 4, }, "start": Object { - "column": 20, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 20, - 21, + 47, + 59, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, ], "type": "Punctuator", "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/destructuring-assignment-property.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, }, - "range": Array [ - 33, - 37, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-as-namespace.src 1`] = ` +Object { + "body": Array [ + Object { "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 21, "line": 1, }, "start": Object { - "column": 9, + "column": 20, "line": 1, }, }, - "name": "Foo", + "name": "a", "range": Array [ - 9, - 12, + 20, + 21, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 15, - 23, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": 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": 23, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 23, - ], - "right": Object { - "elements": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 23, - ], - "type": "ArrayExpression", - }, - "type": "AssignmentPattern", - }, - }, - ], - "range": Array [ - 13, - 25, - ], - "type": "ObjectPattern", - }, - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 31, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 28, - 31, - ], - "type": "Identifier", - }, - "type": "AssignmentPattern", - }, - ], "range": Array [ 0, - 37, + 22, ], - "type": "FunctionDeclaration", + "type": "TSNamespaceExportDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -34295,14 +37598,14 @@ Object { }, "range": Array [ 0, - 38, + 23, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -34312,100 +37615,64 @@ Object { }, "range": Array [ 0, - 8, + 6, ], "type": "Keyword", - "value": "function", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 9, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ + 7, 9, - 12, ], "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Punctuator", - "value": "{", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 19, "line": 1, }, "start": Object { - "column": 15, + "column": 10, "line": 1, }, }, "range": Array [ - 15, - 18, + 10, + 19, ], "type": "Identifier", - "value": "foo", + "value": "namespace", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 21, "line": 1, }, "start": Object { - "column": 19, + "column": 20, "line": 1, }, }, "range": Array [ - 19, 20, + 21, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -34423,58 +37690,100 @@ Object { 22, ], "type": "Punctuator", - "value": "[", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-assignment.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 23, + "column": 13, "line": 1, }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, "range": Array [ - 22, - 23, + 0, + 13, ], - "type": "Punctuator", - "value": "]", + "type": "TSExportAssignment", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 25, + "column": 6, "line": 1, }, "start": Object { - "column": 24, + "column": 0, "line": 1, }, }, "range": Array [ - 24, - 25, + 0, + 6, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 8, "line": 1, }, "start": Object { - "column": 26, + "column": 7, "line": 1, }, }, "range": Array [ - 26, - 27, + 7, + 8, ], "type": "Punctuator", "value": "=", @@ -34482,272 +37791,180 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 12, "line": 1, }, "start": Object { - "column": 28, + "column": 9, "line": 1, }, }, "range": Array [ - 28, - 31, + 9, + 12, ], "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": ")", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 13, "line": 1, }, "start": Object { - "column": 33, + "column": 12, "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, + 12, + 13, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/directive-in-module.src 1`] = ` +exports[`typescript fixtures/basics/export-declare-const-named-enum.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ + "declaration": Object { + "const": true, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [ Object { - "directive": "use strict", - "expression": Object { + "id": Object { "loc": Object { "end": Object { - "column": 14, + "column": 7, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, + "name": "foo", "range": Array [ - 15, - 27, + 36, + 39, ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, + "type": "Identifier", }, - "range": Array [ - 15, - 28, - ], - "type": "ExpressionStatement", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 39, - 40, - ], - "raw": "1", - "type": "Literal", - "value": 1, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, }, - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, + "start": Object { + "column": 10, + "line": 2, }, - "range": Array [ - 35, - 40, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 42, + 43, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 11, + "line": 2, }, "start": Object { - "column": 2, - "line": 3, + "column": 4, + "line": 2, }, }, "range": Array [ - 31, - 41, + 36, + 43, ], - "type": "VariableDeclaration", + "type": "TSEnumMember", }, Object { - "expression": Object { + "id": Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 7, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 4, + "line": 3, }, }, + "name": "bar", "range": Array [ - 44, - 56, + 49, + 52, ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 7, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 4, + "line": 3, }, }, "range": Array [ - 44, - 57, + 49, + 52, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 1, + "type": "TSEnumMember", }, - }, - "range": Array [ - 11, - 59, ], - "type": "TSModuleBlock", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "foo", "range": Array [ 7, - 10, + 54, ], - "type": "Identifier", + "type": "TSEnumDeclaration", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -34756,15 +37973,17 @@ Object { }, "range": Array [ 0, - 59, + 54, ], - "type": "TSModuleDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 5, }, "start": Object { "column": 0, @@ -34773,9 +37992,9 @@ Object { }, "range": Array [ 0, - 60, + 55, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -34792,13 +38011,13 @@ Object { 0, 6, ], - "type": "Identifier", - "value": "module", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 14, "line": 1, }, "start": Object { @@ -34808,115 +38027,115 @@ Object { }, "range": Array [ 7, - 10, + 14, ], "type": "Identifier", - "value": "foo", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 20, "line": 1, }, "start": Object { - "column": 11, + "column": 15, "line": 1, }, }, "range": Array [ - 11, - 12, + 15, + 20, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 15, - 27, + 21, + 25, ], - "type": "String", - "value": "\\"use strict\\"", + "type": "Keyword", + "value": "enum", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 26, + "line": 1, }, }, "range": Array [ - 27, - 28, + 26, + 29, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 31, + "line": 1, }, "start": Object { - "column": 2, - "line": 3, + "column": 30, + "line": 1, }, }, "range": Array [ + 30, 31, - 34, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 7, - "line": 3, + "line": 2, }, "start": Object { - "column": 6, - "line": 3, + "column": 4, + "line": 2, }, }, "range": Array [ - 35, 36, + 39, ], "type": "Identifier", - "value": "a", + "value": "foo", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 3, + "line": 2, }, "start": Object { "column": 8, - "line": 3, + "line": 2, }, }, "range": Array [ - 37, - 38, + 40, + 41, ], "type": "Punctuator", "value": "=", @@ -34925,16 +38144,16 @@ Object { "loc": Object { "end": Object { "column": 11, - "line": 3, + "line": 2, }, "start": Object { "column": 10, - "line": 3, + "line": 2, }, }, "range": Array [ - 39, - 40, + 42, + 43, ], "type": "Numeric", "value": "1", @@ -34943,70 +38162,52 @@ Object { "loc": Object { "end": Object { "column": 12, - "line": 3, + "line": 2, }, "start": Object { "column": 11, - "line": 3, - }, - }, - "range": Array [ - 40, - 41, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, + "line": 2, }, }, "range": Array [ + 43, 44, - 56, ], - "type": "String", - "value": "\\"use strict\\"", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 7, + "line": 3, }, "start": Object { - "column": 14, - "line": 4, + "column": 4, + "line": 3, }, }, "range": Array [ - 56, - 57, + 49, + 52, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 4, }, "start": Object { "column": 0, - "line": 5, + "line": 4, }, }, "range": Array [ - 58, - 59, + 53, + 54, ], "type": "Punctuator", "value": "}", @@ -35016,198 +38217,141 @@ Object { } `; -exports[`typescript fixtures/basics/directive-in-namespace.src 1`] = ` +exports[`typescript fixtures/basics/export-declare-named-enum.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ + "declaration": Object { + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [ Object { - "directive": "use strict", - "expression": Object { + "id": Object { "loc": Object { "end": Object { - "column": 14, + "column": 7, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, + "name": "foo", "range": Array [ - 18, 30, + 33, ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, + "type": "Identifier", }, - "range": Array [ - 18, - 31, - ], - "type": "ExpressionStatement", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 42, - 43, - ], - "raw": "1", - "type": "Literal", - "value": 1, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, }, - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, + "start": Object { + "column": 10, + "line": 2, }, - "range": Array [ - 38, - 43, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 36, + 37, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 11, + "line": 2, }, "start": Object { - "column": 2, - "line": 3, + "column": 4, + "line": 2, }, }, "range": Array [ - 34, - 44, + 30, + 37, ], - "type": "VariableDeclaration", + "type": "TSEnumMember", }, Object { - "expression": Object { + "id": Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 7, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 4, + "line": 3, }, }, + "name": "bar", "range": Array [ - 47, - 59, + 43, + 46, ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 7, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 4, + "line": 3, }, }, "range": Array [ - 47, - 60, + 43, + 46, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 1, + "type": "TSEnumMember", }, - }, - "range": Array [ - 14, - 62, ], - "type": "TSModuleBlock", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "foo", "range": Array [ - 10, - 13, + 7, + 48, ], - "type": "Identifier", + "type": "TSEnumDeclaration", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -35216,15 +38360,17 @@ Object { }, "range": Array [ 0, - 62, + 48, ], - "type": "TSModuleDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 5, }, "start": Object { "column": 0, @@ -35233,14 +38379,14 @@ Object { }, "range": Array [ 0, - 63, + 49, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { @@ -35250,133 +38396,115 @@ Object { }, "range": Array [ 0, - 9, - ], - "type": "Identifier", - "value": "namespace", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 13, + 6, ], - "type": "Identifier", - "value": "foo", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 1, }, "start": Object { - "column": 14, + "column": 7, "line": 1, }, }, "range": Array [ + 7, 14, - 15, - ], - "type": "Punctuator", - "value": "{", + ], + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ - 18, - 30, + 15, + 19, ], - "type": "String", - "value": "\\"use strict\\"", + "type": "Keyword", + "value": "enum", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ - 30, - 31, + 20, + 23, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 2, - "line": 3, + "column": 24, + "line": 1, }, }, "range": Array [ - 34, - 37, + 24, + 25, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 7, - "line": 3, + "line": 2, }, "start": Object { - "column": 6, - "line": 3, + "column": 4, + "line": 2, }, }, "range": Array [ - 38, - 39, + 30, + 33, ], "type": "Identifier", - "value": "a", + "value": "foo", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 3, + "line": 2, }, "start": Object { "column": 8, - "line": 3, + "line": 2, }, }, "range": Array [ - 40, - 41, + 34, + 35, ], "type": "Punctuator", "value": "=", @@ -35385,16 +38513,16 @@ Object { "loc": Object { "end": Object { "column": 11, - "line": 3, + "line": 2, }, "start": Object { "column": 10, - "line": 3, + "line": 2, }, }, "range": Array [ - 42, - 43, + 36, + 37, ], "type": "Numeric", "value": "1", @@ -35403,70 +38531,52 @@ Object { "loc": Object { "end": Object { "column": 12, - "line": 3, + "line": 2, }, "start": Object { "column": 11, - "line": 3, + "line": 2, }, }, "range": Array [ - 43, - 44, + 37, + 38, ], "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 47, - 59, - ], - "type": "String", - "value": "\\"use strict\\"", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 7, + "line": 3, }, "start": Object { - "column": 14, - "line": 4, + "column": 4, + "line": 3, }, }, "range": Array [ - 59, - 60, + 43, + 46, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 4, }, "start": Object { "column": 0, - "line": 5, + "line": 4, }, }, "range": Array [ - 61, - 62, + 47, + 48, ], "type": "Punctuator", "value": "}", @@ -35476,32 +38586,105 @@ Object { } `; -exports[`typescript fixtures/basics/export-as-namespace.src 1`] = ` +exports[`typescript fixtures/basics/export-default-class-with-generic.src 1`] = ` Object { "body": Array [ Object { - "id": Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "ClassBody", + }, + "id": null, "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 20, + "column": 15, "line": 1, }, }, - "name": "a", "range": Array [ - 20, - 21, + 15, + 28, ], - "type": "Identifier", + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 20, + 23, + ], + "type": "TSTypeParameterDeclaration", + }, }, "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -35510,15 +38693,15 @@ Object { }, "range": Array [ 0, - 22, + 28, ], - "type": "TSNamespaceExportDeclaration", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -35527,9 +38710,9 @@ Object { }, "range": Array [ 0, - 23, + 29, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -35552,7 +38735,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 14, "line": 1, }, "start": Object { @@ -35562,28 +38745,28 @@ Object { }, "range": Array [ 7, - 9, + 14, ], - "type": "Identifier", - "value": "as", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { - "column": 10, + "column": 15, "line": 1, }, }, "range": Array [ - 10, - 19, + 15, + 20, ], - "type": "Identifier", - "value": "namespace", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { @@ -35600,8 +38783,8 @@ Object { 20, 21, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { @@ -35618,282 +38801,202 @@ Object { 21, 22, ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/export-assignment.src 1`] = ` -Object { - "body": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 13, - ], - "type": "TSExportAssignment", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 14, - ], - "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", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 23, "line": 1, }, "start": Object { - "column": 7, + "column": 22, "line": 1, }, }, "range": Array [ - 7, - 8, + 22, + 23, ], "type": "Punctuator", - "value": "=", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 25, "line": 1, }, "start": Object { - "column": 9, + "column": 24, "line": 1, }, }, "range": Array [ - 9, - 12, + 24, + 25, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 12, - 13, + 27, + 28, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/export-declare-const-named-enum.src 1`] = ` +exports[`typescript fixtures/basics/export-default-class-with-multiple-generics.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "const": true, - "declare": true, - "id": Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 26, + "column": 27, "line": 1, }, }, - "name": "Foo", "range": Array [ - 26, - 29, + 27, + 31, ], - "type": "Identifier", + "type": "ClassBody", }, + "id": null, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { - "column": 7, + "column": 15, "line": 1, }, }, - "members": Array [ - Object { - "id": Object { + "range": Array [ + 15, + 31, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 21, + "line": 1, }, }, - "name": "foo", - "range": Array [ - 36, - 39, - ], - "type": "Identifier", - }, - "initializer": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, + "name": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", }, "range": Array [ - 42, - 43, + 21, + 22, ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "type": "TSTypeParameter", }, - "range": Array [ - 36, - 43, - ], - "type": "TSEnumMember", - }, - Object { - "id": Object { + Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 24, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, }, + "name": "U", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", }, - "name": "bar", "range": Array [ - 49, - 52, + 24, + 25, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "type": "TSTypeParameter", }, - "range": Array [ - 49, - 52, - ], - "type": "TSEnumMember", - }, - ], - "range": Array [ - 7, - 54, - ], - "type": "TSEnumDeclaration", + ], + "range": Array [ + 20, + 26, + ], + "type": "TSTypeParameterDeclaration", + }, }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -35902,17 +39005,15 @@ Object { }, "range": Array [ 0, - 54, + 31, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -35921,7 +39022,7 @@ Object { }, "range": Array [ 0, - 55, + 32, ], "sourceType": "module", "tokens": Array [ @@ -35958,8 +39059,8 @@ Object { 7, 14, ], - "type": "Identifier", - "value": "declare", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { @@ -35977,166 +39078,130 @@ Object { 20, ], "type": "Keyword", - "value": "const", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 21, "line": 1, }, "start": Object { - "column": 21, + "column": 20, "line": 1, }, }, "range": Array [ + 20, 21, - 25, ], - "type": "Keyword", - "value": "enum", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 1, }, "start": Object { - "column": 26, + "column": 21, "line": 1, }, }, "range": Array [ - 26, - 29, + 21, + 22, ], "type": "Identifier", - "value": "Foo", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 1, }, "start": Object { - "column": 30, + "column": 22, "line": 1, }, }, "range": Array [ - 30, - 31, + 22, + 23, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 24, + "line": 1, }, }, "range": Array [ - 36, - 39, + 24, + 25, ], "type": "Identifier", - "value": "foo", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 26, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 25, + "line": 1, }, }, "range": Array [ - 40, - 41, + 25, + 26, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 42, - 43, - ], - "type": "Numeric", - "value": "1", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ - 43, - 44, + 27, + 28, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 49, - 52, - ], - "type": "Identifier", - "value": "bar", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, - "line": 4, + "line": 3, }, }, "range": Array [ - 53, - 54, + 30, + 31, ], "type": "Punctuator", "value": "}", @@ -36146,141 +39211,122 @@ Object { } `; -exports[`typescript fixtures/basics/export-declare-named-enum.src 1`] = ` +exports[`typescript fixtures/basics/export-named-class-with-generic.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "declare": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "ClassBody", + }, "id": Object { "loc": Object { "end": Object { - "column": 23, + "column": 16, "line": 1, }, "start": Object { - "column": 20, + "column": 13, "line": 1, }, }, "name": "Foo", "range": Array [ - 20, - 23, + 13, + 16, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 7, "line": 1, }, }, - "members": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 30, - 33, - ], - "type": "Identifier", - }, - "initializer": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 36, - 37, - ], - "raw": "1", - "type": "Literal", - "value": 1, + "range": Array [ + 7, + 24, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "start": Object { + "column": 16, + "line": 1, }, - "range": Array [ - 30, - 37, - ], - "type": "TSEnumMember", }, - Object { - "id": Object { + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 17, + "line": 1, }, }, - "name": "bar", + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, "range": Array [ - 43, - 46, + 17, + 18, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "type": "TSTypeParameter", }, - "range": Array [ - 43, - 46, - ], - "type": "TSEnumMember", - }, - ], - "range": Array [ - 7, - 48, - ], - "type": "TSEnumDeclaration", + ], + "range": Array [ + 16, + 19, + ], + "type": "TSTypeParameterDeclaration", + }, }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -36289,7 +39335,7 @@ Object { }, "range": Array [ 0, - 48, + 24, ], "source": null, "specifiers": Array [], @@ -36299,7 +39345,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -36308,7 +39354,7 @@ Object { }, "range": Array [ 0, - 49, + 25, ], "sourceType": "module", "tokens": Array [ @@ -36333,7 +39379,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 12, "line": 1, }, "start": Object { @@ -36343,43 +39389,25 @@ Object { }, "range": Array [ 7, - 14, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 19, + 12, ], "type": "Keyword", - "value": "enum", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 16, "line": 1, }, "start": Object { - "column": 20, + "column": 13, "line": 1, }, }, "range": Array [ - 20, - 23, + 13, + 16, ], "type": "Identifier", "value": "Foo", @@ -36387,125 +39415,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 17, "line": 1, }, "start": Object { - "column": 24, + "column": 16, "line": 1, }, }, "range": Array [ - 24, - 25, + 16, + 17, ], "type": "Punctuator", - "value": "{", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 30, - 33, + 17, + 18, ], "type": "Identifier", - "value": "foo", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 18, + "line": 1, }, }, "range": Array [ - 34, - 35, + 18, + 19, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 36, - 37, - ], - "type": "Numeric", - "value": "1", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ - 37, - 38, + 20, + 21, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 43, - 46, - ], - "type": "Identifier", - "value": "bar", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, - "line": 4, + "line": 3, }, }, "range": Array [ - 47, - 48, + 23, + 24, ], "type": "Punctuator", "value": "}", @@ -36515,7 +39507,7 @@ Object { } `; -exports[`typescript fixtures/basics/export-default-class-with-generic.src 1`] = ` +exports[`typescript fixtures/basics/export-named-class-with-multiple-generics.src 1`] = ` Object { "body": Array [ Object { @@ -36528,41 +39520,58 @@ Object { "line": 3, }, "start": Object { - "column": 24, + "column": 23, "line": 1, }, }, "range": Array [ - 24, - 28, + 23, + 27, ], "type": "ClassBody", }, - "id": null, + "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": 3, }, "start": Object { - "column": 15, + "column": 7, "line": 1, }, }, "range": Array [ - 15, - 28, + 7, + 27, ], "superClass": null, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { "end": Object { - "column": 23, + "column": 22, "line": 1, }, "start": Object { - "column": 20, + "column": 16, "line": 1, }, }, @@ -36570,42 +39579,77 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 18, "line": 1, }, "start": Object { - "column": 21, + "column": 17, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 22, + "column": 18, "line": 1, }, "start": Object { - "column": 21, + "column": 17, "line": 1, }, }, "name": "T", "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "range": Array [ + 17, + 18, + ], + "type": "TSTypeParameter", + }, + 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": "U", + "range": Array [ + 20, 21, - 22, ], "type": "Identifier", }, "range": Array [ + 20, 21, - 22, ], "type": "TSTypeParameter", }, ], "range": Array [ - 20, - 23, + 16, + 22, ], "type": "TSTypeParameterDeclaration", }, @@ -36622,9 +39666,11 @@ Object { }, "range": Array [ 0, - 28, + 27, ], - "type": "ExportDefaultDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -36639,7 +39685,7 @@ Object { }, "range": Array [ 0, - 29, + 28, ], "sourceType": "module", "tokens": Array [ @@ -36664,7 +39710,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 12, "line": 1, }, "start": Object { @@ -36674,43 +39720,43 @@ Object { }, "range": Array [ 7, - 14, + 12, ], "type": "Keyword", - "value": "default", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 16, "line": 1, }, "start": Object { - "column": 15, + "column": 13, "line": 1, }, }, "range": Array [ - 15, - 20, + 13, + 16, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 1, }, "start": Object { - "column": 20, + "column": 16, "line": 1, }, }, "range": Array [ - 20, - 21, + 16, + 17, ], "type": "Punctuator", "value": "<", @@ -36718,17 +39764,17 @@ Object { 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": "Identifier", "value": "T", @@ -36736,17 +39782,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, "line": 1, }, "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { "column": 22, "line": 1, }, + "start": Object { + "column": 21, + "line": 1, + }, }, "range": Array [ + 21, 22, - 23, ], "type": "Punctuator", "value": ">", @@ -36754,17 +39836,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 24, "line": 1, }, "start": Object { - "column": 24, + "column": 23, "line": 1, }, }, "range": Array [ + 23, 24, - 25, ], "type": "Punctuator", "value": "{", @@ -36781,8 +39863,8 @@ Object { }, }, "range": Array [ + 26, 27, - 28, ], "type": "Punctuator", "value": "}", @@ -36792,140 +39874,140 @@ Object { } `; -exports[`typescript fixtures/basics/export-default-class-with-multiple-generics.src 1`] = ` +exports[`typescript fixtures/basics/export-named-enum.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "body": Object { - "body": Array [], + "id": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { - "column": 27, + "column": 12, "line": 1, }, }, + "name": "Foo", "range": Array [ - 27, - 31, + 12, + 15, ], - "type": "ClassBody", + "type": "Identifier", }, - "id": null, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { - "column": 15, + "column": 7, "line": 1, }, }, - "range": Array [ - 15, - 31, - ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "params": Array [ - Object { + "members": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, + "column": 4, + "line": 2, }, - "name": "T", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", }, + "name": "foo", "range": Array [ - 21, 22, + 25, ], - "type": "TSTypeParameter", + "type": "Identifier", }, - Object { + "initializer": Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 10, + "line": 2, }, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, + "range": Array [ + 28, + 29, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 29, + ], + "type": "TSEnumMember", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, }, - "name": "U", - "range": Array [ - 24, - 25, - ], - "type": "Identifier", }, + "name": "bar", "range": Array [ - 24, - 25, + 35, + 38, ], - "type": "TSTypeParameter", + "type": "Identifier", }, - ], - "range": Array [ - 20, - 26, - ], - "type": "TSTypeParameterDeclaration", - }, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 7, + 40, + ], + "type": "TSEnumDeclaration", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -36934,14 +40016,16 @@ Object { }, "range": Array [ 0, - 31, + 40, ], - "type": "ExportDefaultDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, + "column": 1, "line": 4, }, "start": Object { @@ -36951,7 +40035,7 @@ Object { }, "range": Array [ 0, - 32, + 40, ], "sourceType": "module", "tokens": Array [ @@ -36976,7 +40060,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 11, "line": 1, }, "start": Object { @@ -36986,151 +40070,151 @@ Object { }, "range": Array [ 7, - 14, + 11, ], "type": "Keyword", - "value": "default", + "value": "enum", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 15, "line": 1, }, "start": Object { - "column": 15, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 15, - 20, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 1, }, "start": Object { - "column": 20, + "column": 16, "line": 1, }, }, "range": Array [ - 20, - 21, + 16, + 17, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 21, 22, + 25, ], "type": "Identifier", - "value": "T", + "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 [ - 22, - 23, + 26, + 27, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 24, - 25, + 28, + 29, ], - "type": "Identifier", - "value": "U", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 25, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 25, - 26, + 29, + 30, ], "type": "Punctuator", - "value": ">", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 27, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 27, - 28, + 35, + 38, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, - "line": 3, + "line": 4, }, }, "range": Array [ - 30, - 31, + 39, + 40, ], "type": "Punctuator", "value": "}", @@ -37140,51 +40224,33 @@ Object { } `; -exports[`typescript fixtures/basics/export-named-class-with-generic.src 1`] = ` +exports[`typescript fixtures/basics/export-type-alias-declaration.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 24, - ], - "type": "ClassBody", - }, "id": Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, - "name": "Foo", + "name": "TestAlias", "range": Array [ - 13, - 16, + 12, + 21, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 40, + "line": 1, }, "start": Object { "column": 7, @@ -37193,69 +40259,67 @@ Object { }, "range": Array [ 7, - 24, + 40, ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 19, + "column": 39, "line": 1, }, "start": Object { - "column": 16, + "column": 24, "line": 1, }, }, - "params": Array [ + "range": Array [ + 24, + 39, + ], + "type": "TSUnionType", + "types": Array [ Object { "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 1, }, "start": Object { - "column": 17, + "column": 24, "line": 1, }, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "range": Array [ + 24, + 30, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, }, - "name": "T", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", }, "range": Array [ - 17, - 18, + 33, + 39, ], - "type": "TSTypeParameter", + "type": "TSNumberKeyword", }, ], - "range": Array [ - 16, - 19, - ], - "type": "TSTypeParameterDeclaration", }, }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 40, + "line": 1, }, "start": Object { "column": 0, @@ -37264,7 +40328,7 @@ Object { }, "range": Array [ 0, - 24, + 40, ], "source": null, "specifiers": Array [], @@ -37273,8 +40337,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 40, + "line": 1, }, "start": Object { "column": 0, @@ -37283,7 +40347,7 @@ Object { }, "range": Array [ 0, - 25, + 40, ], "sourceType": "module", "tokens": Array [ @@ -37308,7 +40372,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 11, "line": 1, }, "start": Object { @@ -37318,168 +40382,150 @@ Object { }, "range": Array [ 7, - 12, + 11, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, "range": Array [ - 13, - 16, + 12, + 21, ], "type": "Identifier", - "value": "Foo", + "value": "TestAlias", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 23, "line": 1, }, "start": Object { - "column": 16, + "column": 22, "line": 1, }, }, "range": Array [ - 16, - 17, + 22, + 23, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 1, }, "start": Object { - "column": 17, + "column": 24, "line": 1, }, }, "range": Array [ - 17, - 18, + 24, + 30, ], "type": "Identifier", - "value": "T", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 32, "line": 1, }, "start": Object { - "column": 18, + "column": 31, "line": 1, }, }, "range": Array [ - 18, - 19, + 31, + 32, ], "type": "Punctuator", - "value": ">", + "value": "|", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 39, "line": 1, }, "start": Object { - "column": 20, + "column": 33, "line": 1, }, }, "range": Array [ - 20, - 21, + 33, + 39, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 40, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 39, + "line": 1, }, }, "range": Array [ - 23, - 24, + 39, + 40, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/export-named-class-with-multiple-generics.src 1`] = ` +exports[`typescript fixtures/basics/export-type-class-declaration.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 27, - ], - "type": "ClassBody", - }, "id": Object { "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, - "name": "Foo", + "name": "TestClassProps", "range": Array [ - 13, - 16, + 12, + 26, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, + "column": 2, "line": 3, }, "start": Object { @@ -37489,103 +40535,102 @@ Object { }, "range": Array [ 7, - 27, + 51, ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 16, + "column": 29, "line": 1, }, }, - "params": Array [ + "members": Array [ Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 4, + "line": 2, }, }, - "name": "T", + "name": "count", "range": Array [ - 17, - 18, + 35, + 40, ], "type": "Identifier", }, - "range": Array [ - 17, - 18, - ], - "type": "TSTypeParameter", - }, - Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 4, + "line": 2, }, }, - "name": Object { + "range": Array [ + 35, + 48, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 9, + "line": 2, }, }, - "name": "U", "range": Array [ - 20, - 21, + 40, + 48, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSNumberKeyword", + }, }, - "range": Array [ - 20, - 21, - ], - "type": "TSTypeParameter", }, ], "range": Array [ - 16, - 22, + 29, + 50, ], - "type": "TSTypeParameterDeclaration", + "type": "TSTypeLiteral", }, }, "loc": Object { "end": Object { - "column": 1, + "column": 2, "line": 3, }, "start": Object { @@ -37595,7 +40640,7 @@ Object { }, "range": Array [ 0, - 27, + 51, ], "source": null, "specifiers": Array [], @@ -37604,8 +40649,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 2, + "line": 3, }, "start": Object { "column": 0, @@ -37614,7 +40659,7 @@ Object { }, "range": Array [ 0, - 28, + 51, ], "sourceType": "module", "tokens": Array [ @@ -37639,7 +40684,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 11, "line": 1, }, "start": Object { @@ -37649,161 +40694,161 @@ Object { }, "range": Array [ 7, - 12, + 11, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, "range": Array [ - 13, - 16, + 12, + 26, ], "type": "Identifier", - "value": "Foo", + "value": "TestClassProps", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 28, "line": 1, }, "start": Object { - "column": 16, + "column": 27, "line": 1, }, }, "range": Array [ - 16, - 17, + 27, + 28, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 1, }, "start": Object { - "column": 17, + "column": 29, "line": 1, }, }, "range": Array [ - 17, - 18, + 29, + 30, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 18, - 19, + 35, + 40, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "count", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 20, - 21, + 40, + 41, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 21, - 22, + 42, + 48, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 23, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 23, - 24, + 49, + 50, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 2, "line": 3, }, "start": Object { - "column": 0, + "column": 1, "line": 3, }, }, "range": Array [ - 26, - 27, + 50, + 51, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/export-named-enum.src 1`] = ` +exports[`typescript fixtures/basics/export-type-function-declaration.src 1`] = ` Object { "body": Array [ Object { @@ -37811,7 +40856,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 24, "line": 1, }, "start": Object { @@ -37819,124 +40864,138 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "TestCallback", "range": Array [ 12, - 15, + 24, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 47, + "line": 1, }, "start": Object { "column": 7, "line": 1, }, }, - "members": Array [ - Object { - "id": Object { + "range": Array [ + 7, + 47, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 37, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 28, + "line": 1, }, }, - "name": "foo", + "name": "a", "range": Array [ - 22, - 25, + 28, + 37, ], "type": "Identifier", - }, - "initializer": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, }, - "start": Object { - "column": 10, - "line": 2, + "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": "TSNumberKeyword", }, }, - "range": Array [ - 28, - 29, - ], - "raw": "1", - "type": "Literal", - "value": 1, }, + ], + "range": Array [ + 27, + 46, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 46, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 39, + "line": 1, }, }, "range": Array [ - 22, - 29, + 39, + 46, ], - "type": "TSEnumMember", - }, - Object { - "id": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 46, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 42, + "line": 1, }, }, - "name": "bar", "range": Array [ - 35, - 38, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 35, - 38, - ], - "type": "TSEnumMember", + 42, + 46, + ], + "type": "TSVoidKeyword", + }, }, - ], - "range": Array [ - 7, - 40, - ], - "type": "TSEnumDeclaration", + "type": "TSFunctionType", + }, }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 47, + "line": 1, }, "start": Object { "column": 0, @@ -37945,7 +41004,7 @@ Object { }, "range": Array [ 0, - 40, + 47, ], "source": null, "specifiers": Array [], @@ -37954,8 +41013,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 47, + "line": 1, }, "start": Object { "column": 0, @@ -37964,7 +41023,7 @@ Object { }, "range": Array [ 0, - 40, + 47, ], "sourceType": "module", "tokens": Array [ @@ -38001,13 +41060,13 @@ Object { 7, 11, ], - "type": "Keyword", - "value": "enum", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 24, "line": 1, }, "start": Object { @@ -38017,322 +41076,561 @@ Object { }, "range": Array [ 12, - 15, + 24, ], "type": "Identifier", - "value": "Foo", + "value": "TestCallback", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 26, "line": 1, }, "start": Object { - "column": 16, + "column": 25, "line": 1, }, }, "range": Array [ - 16, - 17, + 25, + 26, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ - 22, - 25, + 27, + 28, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 26, - 27, + 28, + 29, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 29, + "line": 1, }, }, "range": Array [ - 28, 29, + 30, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 37, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 31, + "line": 1, }, }, "range": Array [ - 29, - 30, + 31, + 37, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 38, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 37, + "line": 1, }, }, "range": Array [ - 35, + 37, 38, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 41, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 39, + "line": 1, }, }, "range": Array [ 39, - 40, + 41, ], "type": "Punctuator", - "value": "}", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/export-type-alias-declaration.src 1`] = ` +exports[`typescript fixtures/basics/function-anonymus-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "TestAlias", - "range": Array [ - 12, - 21, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 40, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, + "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", }, - "range": Array [ - 24, - 39, - ], - "type": "TSUnionType", - "types": Array [ - 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": 30, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 24, + "column": 34, "line": 1, }, }, "range": Array [ - 24, - 30, + 34, + 49, ], - "type": "TSStringKeyword", + "type": "BlockStatement", }, - Object { + "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": 32, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 23, + 32, + ], + "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": 39, + "column": 22, "line": 1, }, "start": Object { - "column": 33, + "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 [ - 33, - 39, + 19, + 22, ], - "type": "TSNumberKeyword", + "type": "TSTypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, }, + }, + "range": Array [ + 4, + 49, ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "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": 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": "obj", + }, + 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": 40, + "column": 18, "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 40, + 10, + 18, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "function", }, - }, - "range": Array [ - 0, - 40, - ], - "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": 11, + "column": 21, "line": 1, }, "start": Object { - "column": 7, + "column": 20, "line": 1, }, }, "range": Array [ - 7, - 11, + 20, + 21, ], "type": "Identifier", - "value": "type", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 22, "line": 1, }, "start": Object { - "column": 12, + "column": 21, "line": 1, }, }, "range": Array [ - 12, 21, + 22, ], - "type": "Identifier", - "value": "TestAlias", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { @@ -38350,76 +41648,184 @@ Object { 23, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { - "column": 24, + "column": 23, "line": 1, }, }, "range": Array [ + 23, 24, - 30, ], "type": "Identifier", - "value": "string", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 25, "line": 1, }, "start": Object { - "column": 31, + "column": 24, "line": 1, }, }, "range": Array [ - 31, - 32, + 24, + 25, ], "type": "Punctuator", - "value": "|", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 32, "line": 1, }, "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { "column": 33, "line": 1, }, + "start": Object { + "column": 32, + "line": 1, + }, }, "range": Array [ + 32, 33, - 39, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 35, "line": 1, }, "start": Object { - "column": 39, + "column": 34, "line": 1, }, }, "range": Array [ - 39, - 40, + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "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": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, ], "type": "Punctuator", "value": ";", @@ -38429,138 +41835,126 @@ Object { } `; -exports[`typescript fixtures/basics/export-type-class-declaration.src 1`] = ` +exports[`typescript fixtures/basics/function-anynomus-with-return-type.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "TestClassProps", - "range": Array [ - 12, - 26, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 51, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 29, - "line": 1, + "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", }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, }, - "name": "count", - "range": Array [ - 35, - 40, - ], - "type": "Identifier", + "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": 17, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 35, - 48, + 21, + 27, ], - "type": "TSPropertySignature", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 40, - 48, + 23, + 27, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "TSNumberKeyword", - }, + "type": "TSVoidKeyword", }, }, - ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, "range": Array [ - 29, - 50, + 4, + 31, ], - "type": "TSTypeLiteral", + "type": "VariableDeclarator", }, - }, + ], + "kind": "var", "loc": Object { "end": Object { "column": 2, - "line": 3, + "line": 2, }, "start": Object { "column": 0, @@ -38569,16 +41963,14 @@ Object { }, "range": Array [ 0, - 51, + 32, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 2, + "column": 0, "line": 3, }, "start": Object { @@ -38588,14 +41980,14 @@ Object { }, "range": Array [ 0, - 51, + 33, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 3, "line": 1, }, "start": Object { @@ -38605,115 +41997,115 @@ Object { }, "range": Array [ 0, - 6, + 3, ], "type": "Keyword", - "value": "export", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 1, }, "start": Object { - "column": 7, + "column": 4, "line": 1, }, }, "range": Array [ + 4, 7, - 11, ], "type": "Identifier", - "value": "type", + "value": "obj", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 9, "line": 1, }, "start": Object { - "column": 12, + "column": 8, "line": 1, }, }, "range": Array [ - 12, - 26, + 8, + 9, ], - "type": "Identifier", - "value": "TestClassProps", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 18, "line": 1, }, "start": Object { - "column": 27, + "column": 10, "line": 1, }, }, "range": Array [ - 27, - 28, + 10, + 18, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 20, "line": 1, }, "start": Object { - "column": 29, + "column": 19, "line": 1, }, }, "range": Array [ - 29, - 30, + 19, + 20, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ - 35, - 40, + 20, + 21, ], - "type": "Identifier", - "value": "count", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 40, - 41, + 21, + 22, ], "type": "Punctuator", "value": ":", @@ -38721,35 +42113,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 42, - 48, + 23, + 27, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 2, }, "start": Object { "column": 0, - "line": 3, + "line": 2, }, }, "range": Array [ - 49, - 50, + 30, + 31, ], "type": "Punctuator", "value": "}", @@ -38758,16 +42168,16 @@ Object { "loc": Object { "end": Object { "column": 2, - "line": 3, + "line": 2, }, "start": Object { "column": 1, - "line": 3, + "line": 2, }, }, "range": Array [ - 50, - 51, + 31, + 32, ], "type": "Punctuator", "value": ";", @@ -38777,32 +42187,35 @@ Object { } `; -exports[`typescript fixtures/basics/export-type-function-declaration.src 1`] = ` +exports[`typescript fixtures/basics/function-overloads.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { + "async": false, + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 24, + "column": 17, "line": 1, }, "start": Object { - "column": 12, + "column": 16, "line": 1, }, }, - "name": "TestCallback", + "name": "f", "range": Array [ - 12, - 24, + 16, + 17, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 47, + "column": 37, "line": 1, }, "start": Object { @@ -38810,130 +42223,529 @@ Object { "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, - 47, + 37, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 46, + "column": 36, "line": 1, }, "start": Object { - "column": 27, + "column": 28, "line": 1, }, }, - "params": Array [ - Object { + "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": 37, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 19, + "line": 2, }, }, - "name": "a", "range": Array [ - 28, - 37, + 57, + 65, ], - "type": "Identifier", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 29, - 37, + 59, + 65, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, + "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, }, - "range": Array [ - 31, - 37, - ], - "type": "TSNumberKeyword", + "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 [ - 27, - 46, + 92, + 93, ], - "returnType": Object { + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 36, + "line": 3, }, "start": Object { - "column": 39, - "line": 1, + "column": 18, + "line": 3, }, }, + "name": "x", "range": Array [ - 39, - 46, + 94, + 112, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "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, + }, }, - "start": Object { - "column": 42, - "line": 1, + "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", }, - "range": Array [ - 42, - 46, - ], - "type": "TSVoidKeyword", - }, + ], }, - "type": "TSFunctionType", }, + "type": "FunctionDeclaration", }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 47, + 76, + 146, ], "source": null, "specifiers": Array [], @@ -38942,8 +42754,8 @@ Object { ], "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -38952,7 +42764,7 @@ Object { }, "range": Array [ 0, - 47, + 147, ], "sourceType": "module", "tokens": Array [ @@ -38977,7 +42789,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 15, "line": 1, }, "start": Object { @@ -38987,46 +42799,100 @@ Object { }, "range": Array [ 7, - 11, + 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": "type", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 18, "line": 1, }, "start": Object { - "column": 12, + "column": 17, "line": 1, }, }, "range": Array [ - 12, - 24, + 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": "TestCallback", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 1, }, "start": Object { - "column": 25, + "column": 19, "line": 1, }, }, "range": Array [ - 25, - 26, + 19, + 20, ], "type": "Punctuator", - "value": "=", + "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 { @@ -39044,7 +42910,7 @@ Object { 28, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { @@ -39061,26 +42927,26 @@ Object { 28, 29, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 36, "line": 1, }, "start": Object { - "column": 29, + "column": 30, "line": 1, }, }, "range": Array [ - 29, 30, + 36, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { @@ -39089,528 +42955,409 @@ Object { "line": 1, }, "start": Object { - "column": 31, + "column": 36, "line": 1, }, }, "range": Array [ - 31, + 36, 37, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 37, - "line": 1, + "column": 0, + "line": 2, }, }, "range": Array [ - 37, 38, + 44, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 39, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 39, - 41, + 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": "=>", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 42, - 46, + 56, + 57, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 46, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 46, - 47, + 57, + 58, ], "type": "Punctuator", - "value": ";", + "value": ":", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-anonymus-with-type-parameters.src 1`] = ` -Object { - "body": Array [ Object { - "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 [ - 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": 1, - "line": 3, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "range": Array [ - 34, - 49, - ], - "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": 32, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 23, - 32, - ], - "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", - }, - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 49, - ], - "type": "VariableDeclarator", + "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, ], - "kind": "var", + "type": "Punctuator", + "value": ")", + }, + Object { "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 29, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 0, - 50, + 66, + 67, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": ":", }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "Identifier", + "value": "string", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", }, - }, - "range": Array [ - 0, - 51, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 6, + "line": 3, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 3, + 76, + 82, ], "type": "Keyword", - "value": "var", + "value": "export", }, Object { "loc": Object { "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { "column": 7, - "line": 1, + "line": 3, + }, + }, + "range": Array [ + 83, + 91, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, }, "start": Object { - "column": 4, - "line": 1, + "column": 16, + "line": 3, }, }, "range": Array [ - 4, - 7, + 92, + 93, ], "type": "Identifier", - "value": "obj", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 17, + "line": 3, }, }, "range": Array [ - 8, - 9, + 93, + 94, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 10, - "line": 1, + "column": 18, + "line": 3, }, }, "range": Array [ - 10, - 18, + 94, + 95, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { "column": 20, - "line": 1, + "line": 3, }, "start": Object { "column": 19, - "line": 1, + "line": 3, }, }, "range": Array [ - 19, - 20, + 95, + 96, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 27, + "line": 3, }, "start": Object { - "column": 20, - "line": 1, + "column": 21, + "line": 3, }, }, "range": Array [ - 20, - 21, + 97, + 103, ], "type": "Identifier", - "value": "T", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 29, + "line": 3, }, "start": Object { - "column": 21, - "line": 1, + "column": 28, + "line": 3, }, }, "range": Array [ - 21, - 22, + 104, + 105, ], "type": "Punctuator", - "value": ">", + "value": "|", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 36, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 30, + "line": 3, }, }, "range": Array [ - 22, - 23, + 106, + 112, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 37, + "line": 3, }, "start": Object { - "column": 23, - "line": 1, + "column": 36, + "line": 3, }, }, "range": Array [ - 23, - 24, + 112, + 113, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 38, + "line": 3, }, "start": Object { - "column": 24, - "line": 1, + "column": 37, + "line": 3, }, }, "range": Array [ - 24, - 25, + 113, + 114, ], "type": "Punctuator", "value": ":", @@ -39618,17 +43365,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 45, + "line": 3, }, "start": Object { - "column": 26, - "line": 1, + "column": 39, + "line": 3, }, }, "range": Array [ - 26, - 32, + 115, + 121, ], "type": "Identifier", "value": "string", @@ -39636,35 +43383,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 47, + "line": 3, }, "start": Object { - "column": 32, - "line": 1, + "column": 46, + "line": 3, }, }, "range": Array [ - 32, - 33, + 122, + 123, ], "type": "Punctuator", - "value": ")", + "value": "|", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 54, + "line": 3, }, "start": Object { - "column": 34, - "line": 1, + "column": 48, + "line": 3, }, }, "range": Array [ - 34, - 35, + 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": "{", @@ -39673,16 +43438,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 2, + "line": 4, }, "start": Object { "column": 2, - "line": 2, + "line": 4, }, }, "range": Array [ - 38, - 44, + 135, + 141, ], "type": "Keyword", "value": "return", @@ -39691,34 +43456,34 @@ Object { "loc": Object { "end": Object { "column": 10, - "line": 2, + "line": 4, }, "start": Object { "column": 9, - "line": 2, + "line": 4, }, }, "range": Array [ - 45, - 46, + 142, + 143, ], "type": "Identifier", - "value": "a", + "value": "x", }, Object { "loc": Object { "end": Object { "column": 11, - "line": 2, + "line": 4, }, "start": Object { "column": 10, - "line": 2, + "line": 4, }, }, "range": Array [ - 46, - 47, + 143, + 144, ], "type": "Punctuator", "value": ";", @@ -39727,180 +43492,162 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 48, - 49, + 145, + 146, ], "type": "Punctuator", "value": "}", }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 1, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "Punctuator", - "value": ";", - }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/function-anynomus-with-return-type.src 1`] = ` +exports[`typescript fixtures/basics/function-with-await.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, + "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", }, - }, - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": Object { - "async": false, - "body": Object { - "body": Array [], "loc": Object { "end": Object { - "column": 1, + "column": 16, "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 28, - 31, + 34, + 46, ], - "type": "BlockStatement", + "type": "AwaitExpression", }, - "expression": false, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 1, + "column": 17, "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 4, + "line": 2, }, }, - "params": Array [], "range": Array [ - 10, - 31, + 34, + 47, ], - "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", + "type": "ExpressionStatement", }, - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 1, }, - "range": Array [ - 4, - 31, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "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": 2, - "line": 2, + "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, - 32, + 49, ], - "type": "VariableDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -39909,14 +43656,14 @@ Object { }, "range": Array [ 0, - 33, + 50, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -39926,97 +43673,97 @@ Object { }, "range": Array [ 0, - 3, + 5, ], - "type": "Keyword", - "value": "var", + "type": "Identifier", + "value": "async", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 14, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, - 7, + 6, + 14, ], - "type": "Identifier", - "value": "obj", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 19, "line": 1, }, "start": Object { - "column": 8, + "column": 15, "line": 1, }, }, "range": Array [ - 8, - 9, + 15, + 19, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "hope", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 20, "line": 1, }, "start": Object { - "column": 10, + "column": 19, "line": 1, }, }, "range": Array [ - 10, - 18, + 19, + 20, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 26, "line": 1, }, "start": Object { - "column": 19, + "column": 20, "line": 1, }, }, "range": Array [ - 19, 20, + 26, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "future", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 27, "line": 1, }, "start": Object { - "column": 20, + "column": 26, "line": 1, }, }, "range": Array [ - 20, - 21, + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -40024,667 +43771,441 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 29, "line": 1, }, "start": Object { - "column": 21, + "column": 28, "line": 1, }, }, "range": Array [ - 21, - 22, + 28, + 29, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 23, - 27, + 34, + 39, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "await", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 28, - 29, + 40, + 46, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "future", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 17, "line": 2, }, "start": Object { - "column": 0, + "column": 16, "line": 2, }, }, "range": Array [ - 30, - 31, + 46, + 47, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 1, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 31, - 32, + 48, + 49, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/function-overloads.src 1`] = ` +exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.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", - }, + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 7, + "column": 47, "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, + 47, + 51, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "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", + "start": Object { + "column": 9, + "line": 1, }, }, - "type": "TSDeclareFunction", + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 1, + "line": 3, }, "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 { + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 45, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 13, + "line": 1, }, }, - "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, + "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", }, - }, - "name": "x", - "range": Array [ - 56, - 65, - ], - "type": "Identifier", - "typeAnnotation": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 14, + "line": 1, }, }, + "method": false, "range": Array [ - 57, - 65, + 14, + 17, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 21, - "line": 2, + "column": 14, + "line": 1, }, }, + "name": "bar", "range": Array [ - 59, - 65, + 14, + 17, ], - "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, + "type": "Identifier", }, }, - "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 { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 22, + "line": 1, }, "start": Object { - "column": 9, - "line": 4, + "column": 19, + "line": 1, }, }, - "name": "x", + "name": "baz", "range": Array [ - 142, - 143, + 19, + 22, ], "type": "Identifier", }, + "kind": "init", "loc": Object { "end": Object { - "column": 11, - "line": 4, + "column": 22, + "line": 1, }, "start": Object { - "column": 2, - "line": 4, + "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 [ - 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, + 13, + 45, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "params": Array [ - Object { + "type": "ObjectPattern", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 3, + "column": 45, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 23, + "line": 1, }, }, - "name": "x", "range": Array [ - 94, - 112, + 23, + 45, ], - "type": "Identifier", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 3, + "column": 45, + "line": 1, }, "start": Object { - "column": 19, - "line": 3, + "column": 25, + "line": 1, }, }, - "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 { + "members": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 29, + "line": 1, }, "start": Object { - "column": 21, - "line": 3, + "column": 26, + "line": 1, }, }, + "name": "bar", "range": Array [ - 97, - 103, + 26, + 29, ], - "type": "TSStringKeyword", + "type": "Identifier", }, - Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "optional": true, + "range": Array [ + 26, + 39, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 3, + "column": 38, + "line": 1, }, "start": Object { "column": 30, - "line": 3, + "line": 1, }, }, "range": Array [ - 106, - 112, + 30, + 38, ], - "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, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, }, }, - "range": Array [ - 115, - 121, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 54, - "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", }, - "start": Object { - "column": 48, - "line": 3, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, }, + "optional": true, + "range": Array [ + 40, + 44, + ], + "type": "TSPropertySignature", }, - "range": Array [ - 124, - 130, - ], - "type": "TSNumberKeyword", - }, - ], + ], + "range": Array [ + 25, + 45, + ], + "type": "TSTypeLiteral", + }, }, }, - "type": "FunctionDeclaration", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, + ], "range": Array [ - 76, - 146, + 0, + 51, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -40693,14 +44214,14 @@ Object { }, "range": Array [ 0, - 147, + 52, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -40710,25 +44231,7 @@ Object { }, "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, + 8, ], "type": "Keyword", "value": "function", @@ -40736,35 +44239,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 12, "line": 1, }, "start": Object { - "column": 16, + "column": 9, "line": 1, }, }, "range": Array [ - 16, - 17, + 9, + 12, ], "type": "Identifier", - "value": "f", + "value": "foo", }, 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": "(", @@ -40772,287 +44275,179 @@ Object { 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, + "column": 14, "line": 1, }, "start": Object { - "column": 19, + "column": 13, "line": 1, }, }, "range": Array [ - 19, - 20, + 13, + 14, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 17, "line": 1, }, "start": Object { - "column": 21, + "column": 14, "line": 1, }, }, "range": Array [ - 21, - 27, + 14, + 17, ], "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": ")", + "value": "bar", }, 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": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { - "column": 30, + "column": 19, "line": 1, }, }, "range": Array [ - 30, - 36, + 19, + 22, ], "type": "Identifier", - "value": "number", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 23, "line": 1, }, "start": Object { - "column": 36, + "column": 22, "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, + 22, + 23, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 56, - 57, + 23, + 24, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 26, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 25, + "line": 1, }, }, "range": Array [ - 57, - 58, + 25, + 26, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 21, - "line": 2, + "column": 26, + "line": 1, }, }, "range": Array [ - 59, - 65, + 26, + 29, ], "type": "Identifier", - "value": "string", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { - "column": 27, - "line": 2, + "column": 29, + "line": 1, }, }, "range": Array [ - 65, - 66, + 29, + 30, ], "type": "Punctuator", - "value": ")", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 31, + "line": 1, }, "start": Object { - "column": 28, - "line": 2, + "column": 30, + "line": 1, }, }, "range": Array [ - 66, - 67, + 30, + 31, ], "type": "Punctuator", "value": ":", @@ -41060,17 +44455,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 38, + "line": 1, }, "start": Object { - "column": 30, - "line": 2, + "column": 32, + "line": 1, }, }, "range": Array [ - 68, - 74, + 32, + 38, ], "type": "Identifier", "value": "string", @@ -41078,696 +44473,810 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 39, + "line": 1, }, "start": Object { - "column": 36, - "line": 2, + "column": 38, + "line": 1, }, }, "range": Array [ - 74, - 75, + 38, + 39, ], "type": "Punctuator", - "value": ";", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 43, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 40, + "line": 1, }, }, "range": Array [ - 76, - 82, + 40, + 43, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 44, + "line": 1, }, "start": Object { - "column": 7, - "line": 3, + "column": 43, + "line": 1, }, }, "range": Array [ - 83, - 91, + 43, + 44, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 45, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 44, + "line": 1, }, }, "range": Array [ - 92, - 93, + 44, + 45, ], - "type": "Identifier", - "value": "f", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 46, + "line": 1, }, "start": Object { - "column": 17, - "line": 3, + "column": 45, + "line": 1, }, }, "range": Array [ - 93, - 94, + 45, + 46, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 48, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 47, + "line": 1, }, }, "range": Array [ - 94, - 95, + 47, + 48, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 1, "line": 3, }, "start": Object { - "column": 19, + "column": 0, "line": 3, }, }, "range": Array [ - 95, - 96, + 50, + 51, ], "type": "Punctuator", - "value": ":", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 45, + "line": 1, + }, }, - "start": Object { - "column": 21, - "line": 3, + "range": Array [ + 45, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", }, - "range": Array [ - 97, - 103, - ], - "type": "Identifier", - "value": "string", - }, - Object { "loc": Object { "end": Object { - "column": 29, + "column": 1, "line": 3, }, "start": Object { - "column": 28, - "line": 3, + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 43, + "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", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 14, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + }, + 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 [ + 13, + 43, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 43, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "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 [ + 25, + 43, + ], + "type": "TSTypeLiteral", + }, + }, }, - }, - "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, + 0, + 49, ], - "type": "Identifier", - "value": "number", + "type": "FunctionDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 36, - "line": 3, - }, - }, - "range": Array [ - 112, - 113, - ], - "type": "Punctuator", - "value": ")", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 37, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 113, - 114, + 0, + 8, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 45, - "line": 3, + "column": 12, + "line": 1, }, "start": Object { - "column": 39, - "line": 3, + "column": 9, + "line": 1, }, }, "range": Array [ - 115, - 121, + 9, + 12, ], "type": "Identifier", - "value": "string", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 3, + "column": 13, + "line": 1, }, "start": Object { - "column": 46, - "line": 3, + "column": 12, + "line": 1, }, }, "range": Array [ - 122, - 123, + 12, + 13, ], "type": "Punctuator", - "value": "|", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 54, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 48, - "line": 3, + "column": 13, + "line": 1, }, }, "range": Array [ - 124, - 130, + 13, + 14, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 56, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 55, - "line": 3, + "column": 14, + "line": 1, }, }, "range": Array [ - 131, - 132, + 14, + 17, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 4, + "column": 18, + "line": 1, }, "start": Object { - "column": 2, - "line": 4, + "column": 17, + "line": 1, }, }, "range": Array [ - 135, - 141, + 17, + 18, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 22, + "line": 1, }, "start": Object { - "column": 9, - "line": 4, + "column": 19, + "line": 1, }, }, "range": Array [ - 142, - 143, + 19, + 22, ], "type": "Identifier", - "value": "x", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 4, + "column": 23, + "line": 1, }, "start": Object { - "column": 10, - "line": 4, + "column": 22, + "line": 1, }, }, "range": Array [ - 143, - 144, + 22, + 23, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 24, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 23, + "line": 1, }, }, "range": Array [ - 145, - 146, + 23, + 24, ], "type": "Punctuator", - "value": "}", + "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, - }, - }, - "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, + "column": 26, + "line": 1, }, "start": Object { - "column": 0, + "column": 25, "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, + 25, + 26, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 50, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 29, "line": 1, }, "start": Object { - "column": 0, + "column": 26, "line": 1, }, }, "range": Array [ - 0, - 5, + 26, + 29, ], "type": "Identifier", - "value": "async", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 30, "line": 1, }, "start": Object { - "column": 6, + "column": 29, "line": 1, }, }, "range": Array [ - 6, - 14, + 29, + 30, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 37, "line": 1, }, "start": Object { - "column": 15, + "column": 31, "line": 1, }, }, "range": Array [ - 15, - 19, + 31, + 37, ], "type": "Identifier", - "value": "hope", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 38, "line": 1, }, "start": Object { - "column": 19, + "column": 37, "line": 1, }, }, "range": Array [ - 19, - 20, + 37, + 38, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 42, "line": 1, }, "start": Object { - "column": 20, + "column": 39, "line": 1, }, }, "range": Array [ - 20, - 26, + 39, + 42, ], "type": "Identifier", - "value": "future", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 43, "line": 1, }, "start": Object { - "column": 26, + "column": 42, "line": 1, }, }, "range": Array [ - 26, - 27, + 42, + 43, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 44, "line": 1, }, "start": Object { - "column": 28, + "column": 43, "line": 1, }, }, "range": Array [ - 28, - 29, + 43, + 44, ], "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", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 46, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 45, + "line": 1, }, }, "range": Array [ + 45, 46, - 47, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { @@ -41792,26 +45301,62 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { "async": false, "body": Object { - "body": Array [], + "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", + }, + ], "loc": Object { "end": Object { "column": 1, "line": 3, }, "start": Object { - "column": 47, + "column": 23, "line": 1, }, }, "range": Array [ - 47, - 51, + 23, + 40, ], "type": "BlockStatement", }, @@ -41820,7 +45365,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 10, "line": 1, }, "start": Object { @@ -41828,10 +45373,10 @@ Object { "line": 1, }, }, - "name": "foo", + "name": "a", "range": Array [ 9, - 12, + 10, ], "type": "Identifier", }, @@ -41849,286 +45394,185 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, + "column": 18, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "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", + "name": "b", + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, }, - "kind": "init", + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 14, + "column": 17, "line": 1, }, }, - "method": false, "range": Array [ - 14, 17, + 18, ], - "shorthand": true, - "type": "Property", - "value": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 14, + "column": 17, "line": 1, }, }, - "name": "bar", + "name": "X", "range": Array [ - 14, 17, + 18, ], "type": "Identifier", }, }, - 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 [ + 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, + }, + }, "range": Array [ - 13, - 45, + 21, + 22, ], - "type": "ObjectPattern", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 45, + "column": 22, "line": 1, }, "start": Object { - "column": 23, + "column": 21, "line": 1, }, }, + "name": "X", "range": Array [ - 23, - 45, + 21, + 22, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "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 { "loc": Object { "end": Object { - "column": 45, + "column": 12, "line": 1, }, "start": Object { - "column": 25, + "column": 11, "line": 1, }, }, - "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": 39, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "optional": true, - "range": Array [ - 26, - 39, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 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", - }, - }, - }, - 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", - }, - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, - }, - }, - "optional": true, - "range": Array [ - 40, - 44, - ], - "type": "TSPropertySignature", - }, - ], + "name": "X", "range": Array [ - 25, - 45, + 11, + 12, ], - "type": "TSTypeLiteral", + "type": "Identifier", }, + "range": Array [ + 11, + 12, + ], + "type": "TSTypeParameter", }, - }, - ], - "range": Array [ - 0, - 51, - ], - "type": "FunctionDeclaration", + ], + "range": Array [ + 10, + 13, + ], + "type": "TSTypeParameterDeclaration", + }, }, ], "loc": Object { @@ -42143,7 +45587,7 @@ Object { }, "range": Array [ 0, - 52, + 41, ], "sourceType": "script", "tokens": Array [ @@ -42168,7 +45612,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 10, "line": 1, }, "start": Object { @@ -42178,334 +45622,262 @@ Object { }, "range": Array [ 9, - 12, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": "(", - }, - 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": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 17, + 10, ], "type": "Identifier", - "value": "bar", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 11, "line": 1, }, "start": Object { - "column": 17, + "column": 10, "line": 1, }, }, "range": Array [ - 17, - 18, + 10, + 11, ], "type": "Punctuator", - "value": ",", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 12, "line": 1, }, "start": Object { - "column": 19, + "column": 11, "line": 1, }, }, "range": Array [ - 19, - 22, + 11, + 12, ], "type": "Identifier", - "value": "baz", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "}", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 13, "line": 1, }, "start": Object { - "column": 23, + "column": 12, "line": 1, }, }, "range": Array [ - 23, - 24, + 12, + 13, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 14, "line": 1, }, "start": Object { - "column": 25, + "column": 13, "line": 1, }, }, "range": Array [ - 25, - 26, + 13, + 14, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 15, "line": 1, }, "start": Object { - "column": 26, + "column": 14, "line": 1, }, }, "range": Array [ - 26, - 29, + 14, + 15, ], "type": "Identifier", - "value": "bar", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 16, "line": 1, }, "start": Object { - "column": 29, + "column": 15, "line": 1, }, }, "range": Array [ - 29, - 30, + 15, + 16, ], "type": "Punctuator", - "value": "?", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 18, "line": 1, }, "start": Object { - "column": 30, + "column": 17, "line": 1, }, }, "range": Array [ - 30, - 31, + 17, + 18, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 19, "line": 1, }, "start": Object { - "column": 32, + "column": 18, "line": 1, }, }, "range": Array [ - 32, - 38, + 18, + 19, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 20, "line": 1, }, "start": Object { - "column": 38, + "column": 19, "line": 1, }, }, "range": Array [ - 38, - 39, + 19, + 20, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 22, "line": 1, }, "start": Object { - "column": 40, + "column": 21, "line": 1, }, }, "range": Array [ - 40, - 43, + 21, + 22, ], "type": "Identifier", - "value": "baz", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 24, "line": 1, }, "start": Object { - "column": 43, + "column": 23, "line": 1, }, }, "range": Array [ - 43, - 44, + 23, + 24, ], "type": "Punctuator", - "value": "?", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 44, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 44, - 45, + 29, + 35, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 45, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 45, - 46, + 36, + 37, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 47, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 47, - 48, + 37, + 38, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { @@ -42519,8 +45891,8 @@ Object { }, }, "range": Array [ - 50, - 51, + 39, + 40, ], "type": "Punctuator", "value": "}", @@ -42530,7 +45902,7 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = ` Object { "body": Array [ Object { @@ -42539,17 +45911,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { - "column": 45, + "column": 33, "line": 1, }, }, "range": Array [ - 45, - 49, + 33, + 35, ], "type": "BlockStatement", }, @@ -42558,7 +45930,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 16, "line": 1, }, "start": Object { @@ -42566,502 +45938,154 @@ Object { "line": 1, }, }, - "name": "foo", + "name": "compare", "range": Array [ 9, - 12, + 16, ], "type": "Identifier", }, "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": 43, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "params": Array [], + "range": Array [ + 0, + 35, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "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", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 14, - 17, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - }, - 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 [ - 13, - 43, - ], - "type": "ObjectPattern", - "typeAnnotation": Object { + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 43, + "column": 29, "line": 1, }, "start": Object { - "column": 23, + "column": 28, "line": 1, }, }, - "range": Array [ - 23, - 43, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "name": Object { "loc": Object { "end": Object { - "column": 43, + "column": 29, "line": 1, }, "start": Object { - "column": 25, + "column": 28, "line": 1, }, }, - "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", - }, - ], + "name": "T", "range": Array [ - 25, - 43, + 28, + 29, ], - "type": "TSTypeLiteral", + "type": "Identifier", }, + "range": Array [ + 28, + 29, + ], + "type": "TSTypeParameter", }, - }, - ], - "range": Array [ - 0, - 49, - ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 50, - ], - "sourceType": "script", - "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": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": "(", - }, - 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": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + ], + "range": Array [ + 16, + 30, + ], + "type": "TSTypeParameterDeclaration", }, - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - "value": "bar", }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": ",", + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - "value": "baz", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 23, + "column": 8, "line": 1, }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, "range": Array [ - 22, - 23, + 0, + 8, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 16, "line": 1, }, "start": Object { - "column": 23, + "column": 9, "line": 1, }, }, "range": Array [ - 23, - 24, + 9, + 16, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "compare", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 17, "line": 1, }, "start": Object { - "column": 25, + "column": 16, "line": 1, }, }, "range": Array [ - 25, - 26, + 16, + 17, ], "type": "Punctuator", - "value": "{", + "value": "<", }, Object { "loc": Object { @@ -43070,16 +46094,16 @@ Object { "line": 1, }, "start": Object { - "column": 26, + "column": 28, "line": 1, }, }, "range": Array [ - 26, + 28, 29, ], "type": "Identifier", - "value": "bar", + "value": "T", }, Object { "loc": Object { @@ -43097,94 +46121,40 @@ Object { 30, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { "column": 31, "line": 1, }, - }, - "range": Array [ - 31, - 37, - ], - "type": "Identifier", - "value": "string", - }, - 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": 42, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 42, - ], - "type": "Identifier", - "value": "baz", - }, - Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, "start": Object { - "column": 42, + "column": 30, "line": 1, }, }, "range": Array [ - 42, - 43, + 30, + 31, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 32, "line": 1, }, "start": Object { - "column": 43, + "column": 31, "line": 1, }, }, "range": Array [ - 43, - 44, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -43192,17 +46162,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 46, + "column": 34, "line": 1, }, "start": Object { - "column": 45, + "column": 33, "line": 1, }, }, "range": Array [ - 45, - 46, + 33, + 34, ], "type": "Punctuator", "value": "{", @@ -43210,17 +46180,17 @@ Object { 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 [ - 48, - 49, + 34, + 35, ], "type": "Punctuator", "value": "}", @@ -43230,7 +46200,7 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = ` Object { "body": Array [ Object { @@ -43251,8 +46221,8 @@ Object { }, "name": "b", "range": Array [ - 36, - 37, + 47, + 48, ], "type": "Identifier", }, @@ -43267,8 +46237,8 @@ Object { }, }, "range": Array [ - 29, - 38, + 40, + 49, ], "type": "ReturnStatement", }, @@ -43279,13 +46249,13 @@ Object { "line": 3, }, "start": Object { - "column": 23, + "column": 34, "line": 1, }, }, "range": Array [ - 23, - 40, + 34, + 51, ], "type": "BlockStatement", }, @@ -43323,67 +46293,67 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 29, "line": 1, }, "start": Object { - "column": 14, + "column": 25, "line": 1, }, }, "name": "b", "range": Array [ - 14, - 18, + 25, + 29, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 18, + "column": 29, "line": 1, }, "start": Object { - "column": 15, + "column": 26, "line": 1, }, }, "range": Array [ - 15, - 18, + 26, + 29, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 18, + "column": 29, "line": 1, }, "start": Object { - "column": 17, + "column": 28, "line": 1, }, }, "range": Array [ - 17, - 18, + 28, + 29, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 18, + "column": 29, "line": 1, }, "start": Object { - "column": 17, + "column": 28, "line": 1, }, }, "name": "X", "range": Array [ - 17, - 18, + 28, + 29, ], "type": "Identifier", }, @@ -43393,55 +46363,55 @@ Object { ], "range": Array [ 0, - 40, + 51, ], "returnType": Object { "loc": Object { "end": Object { - "column": 22, + "column": 33, "line": 1, }, "start": Object { - "column": 19, + "column": 30, "line": 1, }, }, "range": Array [ - 19, - 22, + 30, + 33, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, + "column": 33, "line": 1, }, "start": Object { - "column": 21, + "column": 32, "line": 1, }, }, "range": Array [ - 21, - 22, + 32, + 33, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 22, + "column": 33, "line": 1, }, "start": Object { - "column": 21, + "column": 32, "line": 1, }, }, "name": "X", "range": Array [ - 21, - 22, + 32, + 33, ], "type": "Identifier", }, @@ -43451,7 +46421,7 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 13, + "column": 24, "line": 1, }, "start": Object { @@ -43461,9 +46431,27 @@ 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": 12, + "column": 23, "line": 1, }, "start": Object { @@ -43491,14 +46479,14 @@ Object { }, "range": Array [ 11, - 12, + 23, ], "type": "TSTypeParameter", }, ], "range": Array [ 10, - 13, + 24, ], "type": "TSTypeParameterDeclaration", }, @@ -43516,7 +46504,7 @@ Object { }, "range": Array [ 0, - 41, + 52, ], "sourceType": "script", "tokens": Array [ @@ -43595,17 +46583,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 20, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 20, + ], + "type": "Keyword", + "value": "extends", + }, + 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": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, ], "type": "Punctuator", "value": ">", @@ -43613,17 +46655,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 25, "line": 1, }, "start": Object { - "column": 13, + "column": 24, "line": 1, }, }, "range": Array [ - 13, - 14, + 24, + 25, ], "type": "Punctuator", "value": "(", @@ -43631,17 +46673,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 26, "line": 1, }, "start": Object { - "column": 14, + "column": 25, "line": 1, }, }, "range": Array [ - 14, - 15, + 25, + 26, ], "type": "Identifier", "value": "b", @@ -43649,17 +46691,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 27, "line": 1, }, "start": Object { - "column": 15, + "column": 26, "line": 1, }, }, "range": Array [ - 15, - 16, + 26, + 27, ], "type": "Punctuator", "value": ":", @@ -43667,17 +46709,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 29, "line": 1, }, "start": Object { - "column": 17, + "column": 28, "line": 1, }, }, "range": Array [ - 17, - 18, + 28, + 29, ], "type": "Identifier", "value": "X", @@ -43685,17 +46727,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 30, "line": 1, }, "start": Object { - "column": 18, + "column": 29, "line": 1, }, }, "range": Array [ - 18, - 19, + 29, + 30, ], "type": "Punctuator", "value": ")", @@ -43703,17 +46745,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 31, "line": 1, }, "start": Object { - "column": 19, + "column": 30, "line": 1, }, }, "range": Array [ - 19, - 20, + 30, + 31, ], "type": "Punctuator", "value": ":", @@ -43721,17 +46763,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 33, "line": 1, }, "start": Object { - "column": 21, + "column": 32, "line": 1, }, }, "range": Array [ - 21, - 22, + 32, + 33, ], "type": "Identifier", "value": "X", @@ -43739,17 +46781,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 35, "line": 1, }, "start": Object { - "column": 23, + "column": 34, "line": 1, }, }, "range": Array [ - 23, - 24, + 34, + 35, ], "type": "Punctuator", "value": "{", @@ -43766,8 +46808,8 @@ Object { }, }, "range": Array [ - 29, - 35, + 40, + 46, ], "type": "Keyword", "value": "return", @@ -43784,8 +46826,8 @@ Object { }, }, "range": Array [ - 36, - 37, + 47, + 48, ], "type": "Identifier", "value": "b", @@ -43802,8 +46844,8 @@ Object { }, }, "range": Array [ - 37, - 38, + 48, + 49, ], "type": "Punctuator", "value": ";", @@ -43820,8 +46862,8 @@ Object { }, }, "range": Array [ - 39, - 40, + 50, + 51, ], "type": "Punctuator", "value": "}", @@ -43831,26 +46873,62 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = ` +exports[`typescript fixtures/basics/function-with-types.src 1`] = ` Object { "body": Array [ Object { "async": false, "body": Object { - "body": Array [], + "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": 35, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 33, + "column": 37, "line": 1, }, }, "range": Array [ - 33, - 35, + 37, + 57, ], "type": "BlockStatement", }, @@ -43867,7 +46945,7 @@ Object { "line": 1, }, }, - "name": "compare", + "name": "message", "range": Array [ 9, 16, @@ -43876,80 +46954,113 @@ Object { }, "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 1, + "line": 3, }, "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": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "name": "name", + "range": Array [ + 17, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 29, + "column": 28, "line": 1, }, "start": Object { - "column": 28, + "column": 21, "line": 1, }, }, - "name": Object { + "range": Array [ + 21, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 29, + "column": 28, "line": 1, }, "start": Object { - "column": 28, + "column": 22, "line": 1, }, }, - "name": "T", "range": Array [ + 22, 28, - 29, ], - "type": "Identifier", + "type": "TSStringKeyword", }, - "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 [ - 16, - 30, + 29, + 36, ], - "type": "TSTypeParameterDeclaration", + "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": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -43958,7 +47069,7 @@ Object { }, "range": Array [ 0, - 35, + 58, ], "sourceType": "script", "tokens": Array [ @@ -43996,7 +47107,7 @@ Object { 16, ], "type": "Identifier", - "value": "compare", + "value": "message", }, Object { "loc": Object { @@ -44014,7 +47125,61 @@ Object { 17, ], "type": "Punctuator", - "value": "<", + "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", }, Object { "loc": Object { @@ -44031,8 +47196,8 @@ Object { 28, 29, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -44050,12 +47215,12 @@ Object { 30, ], "type": "Punctuator", - "value": ">", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 36, "line": 1, }, "start": Object { @@ -44065,61 +47230,97 @@ Object { }, "range": Array [ 30, - 31, + 36, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 38, "line": 1, }, "start": Object { - "column": 31, + "column": 37, "line": 1, }, }, "range": Array [ - 31, - 32, + 37, + 38, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 33, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 33, - 34, + 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", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, ], "type": "Punctuator", - "value": "{", + "value": ";", }, 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, + 56, + 57, ], "type": "Punctuator", "value": "}", @@ -44129,7 +47330,7 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = ` +exports[`typescript fixtures/basics/function-with-types-assignation.src 1`] = ` Object { "body": Array [ Object { @@ -44140,34 +47341,34 @@ Object { "argument": Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 2, }, "start": Object { - "column": 11, + "column": 9, "line": 2, }, }, - "name": "b", + "name": "name", "range": Array [ - 47, - 48, + 89, + 93, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 40, - 49, + 82, + 94, ], "type": "ReturnStatement", }, @@ -44178,13 +47379,13 @@ Object { "line": 3, }, "start": Object { - "column": 34, + "column": 78, "line": 1, }, }, "range": Array [ - 34, - 51, + 78, + 96, ], "type": "BlockStatement", }, @@ -44193,7 +47394,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { @@ -44201,10 +47402,10 @@ Object { "line": 1, }, }, - "name": "a", + "name": "message", "range": Array [ 9, - 10, + 16, ], "type": "Identifier", }, @@ -44222,203 +47423,306 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 28, "line": 1, }, "start": Object { - "column": 25, + "column": 17, "line": 1, }, }, - "name": "b", + "name": "name", "range": Array [ - 25, - 29, + 17, + 28, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 29, + "column": 28, "line": 1, }, "start": Object { - "column": 26, + "column": 21, "line": 1, }, }, "range": Array [ - 26, - 29, + 21, + 28, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 29, + "column": 28, "line": 1, }, "start": Object { - "column": 28, + "column": 22, "line": 1, }, }, "range": Array [ + 22, 28, - 29, ], - "type": "TSTypeReference", - "typeName": Object { + "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 { "loc": Object { "end": Object { - "column": 29, + "column": 40, "line": 1, }, "start": Object { - "column": 28, + "column": 34, "line": 1, }, }, - "name": "X", "range": Array [ - 28, - 29, + 34, + 40, ], - "type": "Identifier", + "type": "TSNumberKeyword", }, }, }, - }, - ], - "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, + "column": 46, "line": 1, }, "start": Object { - "column": 32, + "column": 30, "line": 1, }, }, "range": Array [ - 32, - 33, + 30, + 46, ], - "type": "TSTypeReference", - "typeName": Object { + "right": Object { "loc": Object { "end": Object { - "column": 33, + "column": 46, "line": 1, }, "start": Object { - "column": 32, + "column": 43, "line": 1, }, }, - "name": "X", "range": Array [ - 32, - 33, + 43, + 46, ], - "type": "Identifier", - }, - }, - }, - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, + "raw": "100", + "type": "Literal", + "value": 100, }, + "type": "AssignmentPattern", }, - "params": Array [ - Object { - "constraint": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, }, - "members": Array [], - "range": Array [ - 21, - 23, - ], - "type": "TSTypeLiteral", + "start": Object { + "column": 51, + "line": 1, + }, + }, + "name": "args", + "range": Array [ + 51, + 55, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, }, + }, + "range": Array [ + 48, + 69, + ], + "type": "RestElement", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, + "column": 69, "line": 1, }, "start": Object { - "column": 11, + "column": 55, "line": 1, }, }, - "name": Object { + "range": Array [ + 55, + 69, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 12, + "column": 69, "line": 1, }, "start": Object { - "column": 11, + "column": 56, "line": 1, }, }, - "name": "X", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", + "range": Array [ + 56, + 69, + ], + "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", + }, }, - "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 [ - 10, - 24, + 70, + 77, ], - "type": "TSTypeParameterDeclaration", + "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", }, ], "loc": Object { @@ -44433,7 +47737,7 @@ Object { }, "range": Array [ 0, - 52, + 97, ], "sourceType": "script", "tokens": Array [ @@ -44458,7 +47762,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { @@ -44468,64 +47772,46 @@ Object { }, "range": Array [ 9, - 10, + 16, ], "type": "Identifier", - "value": "a", + "value": "message", }, 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": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 21, "line": 1, }, "start": Object { - "column": 11, + "column": 17, "line": 1, }, }, "range": Array [ - 11, - 12, + 17, + 21, ], "type": "Identifier", - "value": "X", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 20, - ], - "type": "Keyword", - "value": "extends", + "value": "name", }, Object { "loc": Object { @@ -44543,12 +47829,12 @@ Object { 22, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 28, "line": 1, }, "start": Object { @@ -44558,82 +47844,10 @@ Object { }, "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": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, + 28, ], "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": ":", + "value": "string", }, Object { "loc": Object { @@ -44650,41 +47864,41 @@ Object { 28, 29, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 33, "line": 1, }, "start": Object { - "column": 29, + "column": 30, "line": 1, }, }, "range": Array [ - 29, 30, + 33, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "age", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 34, "line": 1, }, "start": Object { - "column": 30, + "column": 33, "line": 1, }, }, "range": Array [ - 30, - 31, + 33, + 34, ], "type": "Punctuator", "value": ":", @@ -44692,438 +47906,215 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 40, "line": 1, }, "start": Object { - "column": 32, + "column": 34, "line": 1, }, }, "range": Array [ - 32, - 33, + 34, + 40, ], "type": "Identifier", - "value": "X", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 42, "line": 1, }, "start": Object { - "column": 34, + "column": 41, "line": 1, }, }, "range": Array [ - 34, - 35, + 41, + 42, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 46, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 43, + "line": 1, }, }, "range": Array [ - 40, + 43, 46, ], - "type": "Keyword", - "value": "return", + "type": "Numeric", + "value": "100", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 47, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 46, + "line": 1, }, }, "range": Array [ + 46, 47, - 48, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 48, - 49, ], "type": "Punctuator", - "value": ";", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 51, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 48, + "line": 1, }, }, "range": Array [ - 50, + 48, 51, ], "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-types.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", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 37, - "line": 1, - }, - }, - "range": Array [ - 37, - 57, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "message", - "range": Array [ - 9, - 16, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 17, - "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", - }, - }, - }, - ], - "range": Array [ - 0, - 57, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 36, - ], - "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": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "value": "...", }, - }, - "range": Array [ - 0, - 58, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 55, "line": 1, }, "start": Object { - "column": 0, + "column": 51, "line": 1, }, }, "range": Array [ - 0, - 8, + 51, + 55, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "args", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 56, "line": 1, }, "start": Object { - "column": 9, + "column": 55, "line": 1, }, }, "range": Array [ - 9, - 16, + 55, + 56, ], - "type": "Identifier", - "value": "message", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 61, "line": 1, }, "start": Object { - "column": 16, + "column": 56, "line": 1, }, }, "range": Array [ - 16, - 17, + 56, + 61, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 62, "line": 1, }, "start": Object { - "column": 17, + "column": 61, "line": 1, }, }, "range": Array [ - 17, - 21, + 61, + 62, ], - "type": "Identifier", - "value": "name", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 68, "line": 1, }, "start": Object { - "column": 21, + "column": 62, "line": 1, }, }, "range": Array [ - 21, - 22, + 62, + 68, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 69, "line": 1, }, "start": Object { - "column": 22, + "column": 68, "line": 1, }, }, "range": Array [ - 22, - 28, + 68, + 69, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 70, "line": 1, }, "start": Object { - "column": 28, + "column": 69, "line": 1, }, }, "range": Array [ - 28, - 29, + 69, + 70, ], "type": "Punctuator", "value": ")", @@ -45131,17 +48122,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 71, "line": 1, }, "start": Object { - "column": 29, + "column": 70, "line": 1, }, }, "range": Array [ - 29, - 30, + 70, + 71, ], "type": "Punctuator", "value": ":", @@ -45149,17 +48140,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 77, "line": 1, }, "start": Object { - "column": 30, + "column": 71, "line": 1, }, }, "range": Array [ - 30, - 36, + 71, + 77, ], "type": "Identifier", "value": "string", @@ -45167,17 +48158,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 79, "line": 1, }, "start": Object { - "column": 37, + "column": 78, "line": 1, }, }, "range": Array [ - 37, - 38, + 78, + 79, ], "type": "Punctuator", "value": "{", @@ -45185,17 +48176,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 43, - 49, + 82, + 88, ], "type": "Keyword", "value": "return", @@ -45203,17 +48194,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 13, "line": 2, }, "start": Object { - "column": 11, + "column": 9, "line": 2, }, }, "range": Array [ - 50, - 54, + 89, + 93, ], "type": "Identifier", "value": "name", @@ -45221,17 +48212,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 14, "line": 2, }, "start": Object { - "column": 15, + "column": 13, "line": 2, }, }, "range": Array [ - 54, - 55, + 93, + 94, ], "type": "Punctuator", "value": ";", @@ -45248,8 +48239,8 @@ Object { }, }, "range": Array [ - 56, - 57, + 95, + 96, ], "type": "Punctuator", "value": "}", @@ -45259,611 +48250,548 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-types-assignation.src 1`] = ` +exports[`typescript fixtures/basics/global-this.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, }, - "name": "name", - "range": Array [ - 89, - 93, - ], - "type": "Identifier", }, + "name": "abc", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "init": Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 13, + "line": 3, }, "start": Object { - "column": 2, - "line": 2, + "column": 10, + "line": 3, }, }, "range": Array [ - 82, - 94, + 32, + 35, ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 78, - "line": 1, - }, - }, - "range": Array [ - 78, - 96, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, + "raw": "100", + "type": "Literal", + "value": 100, }, - "start": Object { - "column": 9, - "line": 1, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, }, + "range": Array [ + 26, + 35, + ], + "type": "VariableDeclarator", }, - "name": "message", - "range": Array [ - 9, - 16, - ], - "type": "Identifier", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 1, + "column": 14, "line": 3, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, - "params": Array [ - Object { + "range": Array [ + 22, + 36, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { + "left": Object { + "computed": false, "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 14, + "line": 6, }, "start": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 6, }, }, - "name": "name", - "range": Array [ - 17, - 28, - ], - "type": "Identifier", - "typeAnnotation": Object { + "object": Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 10, + "line": 6, }, "start": Object { - "column": 21, - "line": 1, + "column": 0, + "line": 6, }, }, + "name": "globalThis", "range": Array [ - 21, - 28, + 69, + 79, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, + "type": "Identifier", }, - }, - Object { - "left": Object { + "property": Object { "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 14, + "line": 6, }, "start": Object { - "column": 30, - "line": 1, + "column": 11, + "line": 6, }, }, - "name": "age", + "name": "abc", "range": Array [ - 30, - 40, + 80, + 83, ], "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", - }, - }, }, + "range": Array [ + 69, + 83, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "operator": "=", + "range": Array [ + 69, + 89, + ], + "right": Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 20, + "line": 6, }, "start": Object { - "column": 30, - "line": 1, + "column": 17, + "line": 6, }, }, "range": Array [ - 30, - 46, + 86, + 89, ], - "right": Object { + "raw": "200", + "type": "Literal", + "value": 200, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 69, + 90, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 10, + "line": 9, }, "start": Object { - "column": 43, - "line": 1, + "column": 4, + "line": 9, }, }, + "name": "answer", "range": Array [ - 43, - 46, + 97, + 103, ], - "raw": "100", - "type": "Literal", - "value": 100, + "type": "Identifier", }, - "type": "AssignmentPattern", - }, - Object { - "argument": Object { + "init": Object { "loc": Object { "end": Object { - "column": 55, - "line": 1, + "column": 15, + "line": 9, }, "start": Object { - "column": 51, - "line": 1, + "column": 13, + "line": 9, }, }, - "name": "args", "range": Array [ - 51, - 55, + 106, + 108, ], - "type": "Identifier", + "raw": "42", + "type": "Literal", + "value": 42, }, "loc": Object { "end": Object { - "column": 69, - "line": 1, + "column": 15, + "line": 9, }, "start": Object { - "column": 48, - "line": 1, + "column": 4, + "line": 9, }, }, "range": Array [ - 48, - 69, + 97, + 108, ], - "type": "RestElement", - "typeAnnotation": Object { + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 93, + 109, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "object": Object { "loc": Object { "end": Object { - "column": 69, - "line": 1, + "column": 10, + "line": 12, }, "start": Object { - "column": 55, - "line": 1, + "column": 0, + "line": 12, }, }, + "name": "globalThis", "range": Array [ - 55, - 69, + 178, + 188, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 69, - "line": 1, - }, - "start": Object { - "column": 56, - "line": 1, - }, - }, - "range": Array [ - 56, - 69, - ], - "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", + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 12, }, - "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", + "start": Object { + "column": 11, + "line": 12, }, }, + "name": "answer", + "range": Array [ + 189, + 195, + ], + "type": "Identifier", }, + "range": Array [ + 178, + 195, + ], + "type": "MemberExpression", }, - ], - "range": Array [ - 0, - 96, - ], - "returnType": Object { "loc": Object { "end": Object { - "column": 77, - "line": 1, + "column": 26, + "line": 12, }, "start": Object { - "column": 70, - "line": 1, + "column": 0, + "line": 12, }, }, + "operator": "=", "range": Array [ - 70, - 77, + 178, + 204, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "right": Object { "loc": Object { "end": Object { - "column": 77, - "line": 1, + "column": 26, + "line": 12, }, "start": Object { - "column": 71, - "line": 1, + "column": 20, + "line": 12, }, }, "range": Array [ - 71, - 77, + 198, + 204, ], - "type": "TSStringKeyword", + "raw": "333333", + "type": "Literal", + "value": 333333, }, + "type": "AssignmentExpression", }, - "type": "FunctionDeclaration", + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "range": Array [ + 178, + 205, + ], + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 13, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 97, + 22, + 206, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 3, + "line": 3, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 8, + 22, + 25, ], "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 16, - ], - "type": "Identifier", - "value": "message", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": "(", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 17, - 21, + 26, + 29, ], "type": "Identifier", - "value": "name", + "value": "abc", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { - "column": 21, - "line": 1, + "column": 8, + "line": 3, }, }, "range": Array [ - 21, - 22, + 30, + 31, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 22, - 28, + 32, + 35, ], - "type": "Identifier", - "value": "string", + "type": "Numeric", + "value": "100", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { - "column": 28, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ - 28, - 29, + 35, + 36, ], "type": "Punctuator", - "value": ",", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 10, + "line": 6, }, "start": Object { - "column": 30, - "line": 1, + "column": 0, + "line": 6, }, }, "range": Array [ - 30, - 33, + 69, + 79, ], "type": "Identifier", - "value": "age", + "value": "globalThis", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 11, + "line": 6, }, "start": Object { - "column": 33, - "line": 1, + "column": 10, + "line": 6, }, }, "range": Array [ - 33, - 34, + 79, + 80, ], "type": "Punctuator", - "value": ":", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 14, + "line": 6, }, "start": Object { - "column": 34, - "line": 1, + "column": 11, + "line": 6, }, }, "range": Array [ - 34, - 40, + 80, + 83, ], "type": "Identifier", - "value": "number", + "value": "abc", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 16, + "line": 6, }, "start": Object { - "column": 41, - "line": 1, + "column": 15, + "line": 6, }, }, "range": Array [ - 41, - 42, + 84, + 85, ], "type": "Punctuator", "value": "=", @@ -45871,309 +48799,237 @@ Object { Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 20, + "line": 6, }, "start": Object { - "column": 43, - "line": 1, + "column": 17, + "line": 6, }, }, "range": Array [ - 43, - 46, + 86, + 89, ], "type": "Numeric", - "value": "100", + "value": "200", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 21, + "line": 6, }, "start": Object { - "column": 46, - "line": 1, + "column": 20, + "line": 6, }, }, "range": Array [ - 46, - 47, + 89, + 90, ], "type": "Punctuator", - "value": ",", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 51, - "line": 1, + "column": 3, + "line": 9, }, "start": Object { - "column": 48, - "line": 1, + "column": 0, + "line": 9, }, }, "range": Array [ - 48, - 51, + 93, + 96, ], - "type": "Punctuator", - "value": "...", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 55, - "line": 1, + "column": 10, + "line": 9, }, "start": Object { - "column": 51, - "line": 1, + "column": 4, + "line": 9, }, }, "range": Array [ - 51, - 55, + 97, + 103, ], "type": "Identifier", - "value": "args", + "value": "answer", }, Object { "loc": Object { "end": Object { - "column": 56, - "line": 1, + "column": 12, + "line": 9, }, "start": Object { - "column": 55, - "line": 1, + "column": 11, + "line": 9, }, }, "range": Array [ - 55, - 56, + 104, + 105, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 61, - "line": 1, + "column": 15, + "line": 9, }, "start": Object { - "column": 56, - "line": 1, + "column": 13, + "line": 9, }, }, "range": Array [ - 56, - 61, + 106, + 108, ], - "type": "Identifier", - "value": "Array", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 62, - "line": 1, + "column": 16, + "line": 9, }, "start": Object { - "column": 61, - "line": 1, + "column": 15, + "line": 9, }, }, "range": Array [ - 61, - 62, + 108, + 109, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 68, - "line": 1, + "column": 10, + "line": 12, }, "start": Object { - "column": 62, - "line": 1, + "column": 0, + "line": 12, }, }, "range": Array [ - 62, - 68, + 178, + 188, ], "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 69, - "line": 1, - }, - "start": Object { - "column": 68, - "line": 1, - }, - }, - "range": Array [ - 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": ")", + "value": "globalThis", }, Object { "loc": Object { "end": Object { - "column": 71, - "line": 1, + "column": 11, + "line": 12, }, "start": Object { - "column": 70, - "line": 1, + "column": 10, + "line": 12, }, }, "range": Array [ - 70, - 71, + 188, + 189, ], "type": "Punctuator", - "value": ":", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 77, - "line": 1, + "column": 17, + "line": 12, }, "start": Object { - "column": 71, - "line": 1, + "column": 11, + "line": 12, }, }, "range": Array [ - 71, - 77, + 189, + 195, ], "type": "Identifier", - "value": "string", + "value": "answer", }, Object { "loc": Object { "end": Object { - "column": 79, - "line": 1, + "column": 19, + "line": 12, }, "start": Object { - "column": 78, - "line": 1, + "column": 18, + "line": 12, }, }, "range": Array [ - 78, - 79, + 196, + 197, ], "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", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 26, + "line": 12, }, "start": Object { - "column": 9, - "line": 2, + "column": 20, + "line": 12, }, }, "range": Array [ - 89, - 93, + 198, + 204, ], - "type": "Identifier", - "value": "name", + "type": "Numeric", + "value": "333333", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 27, + "line": 12, }, "start": Object { - "column": 13, - "line": 2, + "column": 26, + "line": 12, }, }, "range": Array [ - 93, - 94, + 204, + 205, ], "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", } @@ -53111,16 +55967,331 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 2, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "range": Array [ + 15, + 16, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 14, + 17, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "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": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "T", + }, + 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": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-jsdoc.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "bar", + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 76, + 85, + ], + "type": "TSMethodSignature", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, }, "start": Object { - "column": 18, + "column": 15, "line": 1, }, }, "range": Array [ - 18, - 21, + 15, + 87, ], "type": "TSInterfaceBody", }, @@ -53145,7 +56316,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 2, + "line": 7, }, "start": Object { "column": 0, @@ -53154,69 +56325,15 @@ Object { }, "range": Array [ 0, - 21, + 87, ], "type": "TSInterfaceDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - "range": Array [ - 15, - 16, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 14, - 17, - ], - "type": "TSTypeParameterDeclaration", - }, }, ], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 8, }, "start": Object { "column": 0, @@ -53225,7 +56342,7 @@ Object { }, "range": Array [ 0, - 22, + 88, ], "sourceType": "script", "tokens": Array [ @@ -53268,89 +56385,125 @@ 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": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 7, + "line": 6, }, "start": Object { - "column": 15, - "line": 1, + "column": 4, + "line": 6, }, }, "range": Array [ - 15, - 16, + 76, + 79, ], "type": "Identifier", - "value": "T", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 8, + "line": 6, }, "start": Object { - "column": 16, - "line": 1, + "column": 7, + "line": 6, }, }, "range": Array [ - 16, - 17, + 79, + 80, ], "type": "Punctuator", - "value": ">", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 11, + "line": 6, }, "start": Object { - "column": 18, - "line": 1, + "column": 8, + "line": 6, }, }, "range": Array [ - 18, - 19, + 80, + 83, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 83, + 84, ], "type": "Punctuator", - "value": "{", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 2, + "line": 7, }, "start": Object { "column": 0, - "line": 2, + "line": 7, }, }, "range": Array [ - 20, - 21, + 86, + 87, ], "type": "Punctuator", "value": "}", @@ -53360,7 +56513,7 @@ Object { } `; -exports[`typescript fixtures/basics/interface-with-jsdoc.src 1`] = ` +exports[`typescript fixtures/basics/interface-with-method.src 1`] = ` Object { "body": Array [ Object { @@ -53371,62 +56524,344 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 7, - "line": 6, + "column": 3, + "line": 2, }, "start": Object { - "column": 4, - "line": 6, + "column": 2, + "line": 2, }, }, - "name": "foo", + "name": "h", "range": Array [ - 76, - 79, + 19, + 20, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 23, + "line": 2, }, "start": Object { - "column": 4, - "line": 6, + "column": 2, + "line": 2, }, }, "params": Array [ Object { "loc": Object { "end": Object { - "column": 11, - "line": 6, + "column": 15, + "line": 2, }, "start": Object { - "column": 8, - "line": 6, + "column": 4, + "line": 2, }, }, "name": "bar", "range": Array [ - 80, - 83, + 21, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 19, + 40, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 35, + 39, + ], + "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 [ + 43, + 44, + ], + "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 [ + 48, + 54, ], "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + }, + }, }, ], "range": Array [ - 76, - 85, + 43, + 59, ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 55, + 58, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 57, + 58, + ], + "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 [ + 45, + 46, + ], + "type": "Identifier", + }, + "range": Array [ + 45, + 46, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 44, + 47, + ], + "type": "TSTypeParameterDeclaration", + }, }, ], "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 4, }, "start": Object { "column": 15, @@ -53435,7 +56870,7 @@ Object { }, "range": Array [ 15, - 87, + 61, ], "type": "TSInterfaceBody", }, @@ -53450,7 +56885,7 @@ Object { "line": 1, }, }, - "name": "Test", + "name": "test", "range": Array [ 10, 14, @@ -53460,7 +56895,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 4, }, "start": Object { "column": 0, @@ -53469,7 +56904,7 @@ Object { }, "range": Array [ 0, - 87, + 61, ], "type": "TSInterfaceDeclaration", }, @@ -53477,7 +56912,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 8, + "line": 5, }, "start": Object { "column": 0, @@ -53486,7 +56921,7 @@ Object { }, "range": Array [ 0, - 88, + 62, ], "sourceType": "script", "tokens": Array [ @@ -53524,7 +56959,7 @@ Object { 14, ], "type": "Identifier", - "value": "Test", + "value": "test", }, Object { "loc": Object { @@ -53544,38 +56979,254 @@ Object { "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "h", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, Object { "loc": Object { "end": Object { "column": 7, - "line": 6, + "line": 2, }, "start": Object { "column": 4, - "line": 6, + "line": 2, }, }, "range": Array [ - 76, - 79, + 21, + 24, ], "type": "Identifier", - "value": "foo", + "value": "bar", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 6, + "line": 2, }, "start": Object { "column": 7, - "line": 6, + "line": 2, }, }, "range": Array [ - 79, - 80, + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 35, + 39, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, ], "type": "Punctuator", "value": "(", @@ -53583,17 +57234,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 6, + "column": 10, + "line": 3, }, "start": Object { - "column": 8, - "line": 6, + "column": 7, + "line": 3, }, }, "range": Array [ - 80, - 83, + 48, + 51, ], "type": "Identifier", "value": "bar", @@ -53601,35 +57252,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 11, + "line": 3, }, "start": Object { - "column": 11, - "line": 6, + "column": 10, + "line": 3, }, }, "range": Array [ - 83, - 84, + 51, + 52, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { "column": 13, - "line": 6, + "line": 3, }, "start": Object { "column": 12, - "line": 6, + "line": 3, }, }, "range": Array [ - 84, - 85, + 53, + 54, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, ], "type": "Punctuator", "value": ";", @@ -53638,16 +57361,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 4, }, "start": Object { "column": 0, - "line": 7, + "line": 4, }, }, "range": Array [ - 86, - 87, + 60, + 61, ], "type": "Punctuator", "value": "}", @@ -53657,7 +57380,7 @@ Object { } `; -exports[`typescript fixtures/basics/interface-with-method.src 1`] = ` +exports[`typescript fixtures/basics/interface-with-optional-properties.src 1`] = ` Object { "body": Array [ Object { @@ -53668,344 +57391,243 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, - "name": "h", + "name": "foo", "range": Array [ - 19, - 20, + 21, + 24, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 23, + "column": 9, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "optional": true, + "range": Array [ + 21, + 26, + ], + "type": "TSPropertySignature", + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, }, - "name": "bar", - "range": Array [ - 21, - 32, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 24, - 32, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 26, - 32, - ], - "type": "TSStringKeyword", - }, + "start": Object { + "column": 4, + "line": 3, }, }, - ], + "name": "bar", + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": true, "range": Array [ - 19, - 40, + 31, + 44, ], - "returnType": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 16, + "line": 3, }, "start": Object { - "column": 16, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 33, - 39, + 35, + 43, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 16, + "line": 3, }, "start": Object { - "column": 18, - "line": 2, + "column": 10, + "line": 3, }, }, "range": Array [ - 35, - 39, + 37, + 43, ], - "type": "TSVoidKeyword", + "type": "TSStringKeyword", }, }, - "type": "TSMethodSignature", }, Object { "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 3, - "line": 3, + "column": 7, + "line": 4, }, "start": Object { - "column": 2, - "line": 3, + "column": 4, + "line": 4, }, }, - "name": "g", + "name": "baz", "range": Array [ - 43, - 44, + 49, + 52, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 34, + "line": 4, }, "start": Object { - "column": 2, - "line": 3, + "column": 4, + "line": 4, }, }, + "optional": true, "params": Array [ Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 12, + "line": 4, }, "start": Object { - "column": 7, - "line": 3, + "column": 9, + "line": 4, }, }, - "name": "bar", + "name": "foo", "range": Array [ - 48, 54, + 57, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "name": "bar", + "optional": true, + "range": Array [ + 59, + 71, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 26, + "line": 4, }, "start": Object { - "column": 10, - "line": 3, + "column": 18, + "line": 4, }, }, "range": Array [ - 51, - 54, + 63, + 71, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 26, + "line": 4, }, "start": Object { - "column": 12, - "line": 3, + "column": 20, + "line": 4, }, }, "range": Array [ - 53, - 54, + 65, + 71, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, + "type": "TSStringKeyword", }, }, }, - ], - "range": Array [ - 43, - 59, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 55, - 58, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 32, + "line": 4, }, "start": Object { - "column": 16, - "line": 3, + "column": 28, + "line": 4, }, }, + "name": "baz", + "optional": true, "range": Array [ - 57, - 58, + 73, + 77, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 57, - 58, - ], - "type": "Identifier", - }, + "type": "Identifier", }, - }, + ], + "range": Array [ + 49, + 79, + ], "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 [ - 45, - 46, - ], - "type": "Identifier", - }, - "range": Array [ - 45, - 46, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 44, - 47, - ], - "type": "TSTypeParameterDeclaration", - }, }, ], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { "column": 15, @@ -54014,7 +57636,7 @@ Object { }, "range": Array [ 15, - 61, + 81, ], "type": "TSInterfaceBody", }, @@ -54039,7 +57661,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { "column": 0, @@ -54048,7 +57670,7 @@ Object { }, "range": Array [ 0, - 61, + 81, ], "type": "TSInterfaceDeclaration", }, @@ -54056,7 +57678,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 6, }, "start": Object { "column": 0, @@ -54065,747 +57687,1170 @@ Object { }, "range": Array [ 0, - 62, + 82, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "test", + }, + 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": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 4, }, }, "range": Array [ - 0, - 9, + 59, + 62, ], - "type": "Keyword", - "value": "interface", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 18, + "line": 4, }, "start": Object { - "column": 10, - "line": 1, + "column": 17, + "line": 4, }, }, "range": Array [ - 10, - 14, + 62, + 63, ], - "type": "Identifier", - "value": "test", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 19, + "line": 4, }, "start": Object { - "column": 15, - "line": 1, + "column": 18, + "line": 4, }, }, "range": Array [ - 15, - 16, + 63, + 64, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 26, + "line": 4, }, "start": Object { - "column": 2, - "line": 2, + "column": 20, + "line": 4, }, }, "range": Array [ - 19, - 20, + 65, + 71, ], "type": "Identifier", - "value": "h", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 2, + "column": 27, + "line": 4, }, "start": Object { - "column": 3, - "line": 2, + "column": 26, + "line": 4, }, }, "range": Array [ - 20, - 21, + 71, + 72, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 31, + "line": 4, }, "start": Object { - "column": 4, - "line": 2, + "column": 28, + "line": 4, }, }, "range": Array [ - 21, - 24, + 73, + 76, ], "type": "Identifier", - "value": "bar", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 32, + "line": 4, }, "start": Object { - "column": 7, - "line": 2, + "column": 31, + "line": 4, }, }, "range": Array [ - 24, - 25, + 76, + 77, ], "type": "Punctuator", - "value": ":", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 33, + "line": 4, }, "start": Object { - "column": 9, - "line": 2, + "column": 32, + "line": 4, }, }, "range": Array [ - 26, - 32, + 77, + 78, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 34, + "line": 4, }, "start": Object { - "column": 15, - "line": 2, + "column": 33, + "line": 4, }, }, "range": Array [ - 32, - 33, + 78, + 79, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 1, + "line": 5, }, "start": Object { - "column": 16, - "line": 2, + "column": 0, + "line": 5, }, }, "range": Array [ - 33, - 34, + 80, + 81, ], "type": "Punctuator", - "value": ":", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-without-type-annotation.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": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "TSPropertySignature", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 27, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 18, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 35, - 39, + 0, + 27, ], - "type": "Keyword", - "value": "void", + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 22, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 39, - 40, + 0, + 9, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 2, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 43, - 44, + 10, + 14, ], "type": "Identifier", - "value": "g", + "value": "test", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { - "column": 3, - "line": 3, + "column": 15, + "line": 1, }, }, "range": Array [ - 44, - 45, + 15, + 16, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 7, + "line": 2, }, "start": Object { "column": 4, - "line": 3, + "line": 2, }, }, "range": Array [ - 45, - 46, + 21, + 24, ], "type": "Identifier", - "value": "T", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 8, + "line": 2, }, "start": Object { - "column": 5, - "line": 3, + "column": 7, + "line": 2, }, }, "range": Array [ - 46, - 47, + 24, + 25, ], "type": "Punctuator", - "value": ">", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 1, "line": 3, }, "start": Object { - "column": 6, + "column": 0, "line": 3, }, }, "range": Array [ - 47, - 48, + 26, + 27, ], "type": "Punctuator", - "value": "(", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/keyof-operator.src 1`] = ` +Object { + "body": Array [ Object { + "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": 10, - "line": 3, + "column": 19, + "line": 1, }, "start": Object { - "column": 7, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 48, - 51, + 0, + 19, ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, - "start": Object { - "column": 10, - "line": 3, + "operator": "keyof", + "range": Array [ + 9, + 18, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, }, }, - "range": Array [ - 51, - 52, - ], - "type": "Punctuator", - "value": ":", }, + ], + "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": 13, - "line": 3, + "column": 4, + "line": 1, }, "start": Object { - "column": 12, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 53, - 54, + 0, + 4, ], "type": "Identifier", - "value": "T", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 6, + "line": 1, }, "start": Object { - "column": 13, - "line": 3, + "column": 5, + "line": 1, }, }, "range": Array [ - 54, - 55, + 5, + 6, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 7, + "line": 1, }, }, "range": Array [ - 55, - 56, + 7, + 8, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 9, + "line": 1, }, }, "range": Array [ - 57, - 58, + 9, + 14, ], "type": "Identifier", - "value": "T", + "value": "keyof", }, Object { "loc": Object { "end": Object { "column": 18, - "line": 3, + "line": 1, }, "start": Object { - "column": 17, - "line": 3, + "column": 15, + "line": 1, }, }, "range": Array [ - 58, - 59, + 15, + 18, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 19, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 18, + "line": 1, }, }, "range": Array [ - 60, - 61, + 18, + 19, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/interface-with-optional-properties.src 1`] = ` +exports[`typescript fixtures/basics/nested-type-arguments.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": "foo", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "optional": true, - "range": Array [ - 21, - 26, - ], - "type": "TSPropertySignature", - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 31, - 34, - ], - "type": "Identifier", - }, + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 44, + "line": 1, }, "start": Object { "column": 4, - "line": 3, + "line": 1, }, }, - "optional": true, + "name": "nestedArray", "range": Array [ - 31, + 4, 44, ], - "type": "TSPropertySignature", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 44, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 15, + "line": 1, }, }, "range": Array [ - 35, - 43, + 15, + 44, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 37, - 43, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "name": "baz", - "range": Array [ - 49, - 52, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 34, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "optional": true, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "name": "foo", - "range": Array [ - 54, - 57, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 4, + "column": 44, + "line": 1, }, "start": Object { - "column": 14, - "line": 4, + "column": 17, + "line": 1, }, }, - "name": "bar", - "optional": true, "range": Array [ - 59, - 71, + 17, + 44, ], - "type": "Identifier", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 22, + "line": 1, }, "start": Object { - "column": 18, - "line": 4, + "column": 17, + "line": 1, }, }, + "name": "Array", "range": Array [ - 63, - 71, + 17, + 22, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 4, + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, }, - "start": Object { - "column": 20, - "line": 4, + "range": Array [ + 23, + 43, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 23, + 28, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 42, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 29, + 34, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 34, + 42, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 28, + 43, + ], + "type": "TSTypeParameterInstantiation", }, }, - "range": Array [ - 65, - 71, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 4, - }, - "start": Object { - "column": 28, - "line": 4, - }, + ], + "range": Array [ + 22, + 44, + ], + "type": "TSTypeParameterInstantiation", }, - "name": "baz", - "optional": true, - "range": Array [ - 73, - 77, - ], - "type": "Identifier", }, - ], - "range": Array [ - 49, - 79, - ], - "type": "TSMethodSignature", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 81, - ], - "type": "TSInterfaceBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, + }, }, - "start": Object { - "column": 10, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", }, - "name": "test", - "range": Array [ - 10, - 14, - ], - "type": "Identifier", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 44, + "line": 1, }, "start": Object { "column": 0, @@ -54814,15 +58859,15 @@ Object { }, "range": Array [ 0, - 81, + 44, ], - "type": "TSInterfaceDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 6, + "column": 44, + "line": 1, }, "start": Object { "column": 0, @@ -54831,14 +58876,14 @@ Object { }, "range": Array [ 0, - 82, + 44, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 3, "line": 1, }, "start": Object { @@ -54848,28 +58893,28 @@ Object { }, "range": Array [ 0, - 9, + 3, ], "type": "Keyword", - "value": "interface", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 10, + "column": 4, "line": 1, }, }, "range": Array [ - 10, - 14, + 4, + 15, ], "type": "Identifier", - "value": "test", + "value": "nestedArray", }, Object { "loc": Object { @@ -54887,130 +58932,130 @@ Object { 16, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 21, - 24, + 17, + 22, ], "type": "Identifier", - "value": "foo", + "value": "Array", }, Object { "loc": Object { - "end": Object { - "column": 8, - "line": 2, + "end": Object { + "column": 23, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 24, - 25, + 22, + 23, ], "type": "Punctuator", - "value": "?", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 25, - 26, + 23, + 28, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 29, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 28, + "line": 1, }, }, "range": Array [ - 31, - 34, + 28, + 29, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { - "column": 7, - "line": 3, + "column": 29, + "line": 1, }, }, "range": Array [ + 29, 34, - 35, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 34, + "line": 1, }, }, "range": Array [ + 34, 35, - 36, ], "type": "Punctuator", - "value": ":", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 41, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 35, + "line": 1, }, }, "range": Array [ - 37, - 43, + 35, + 41, ], "type": "Identifier", "value": "string", @@ -55018,161 +59063,401 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 42, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 41, + "line": 1, }, }, "range": Array [ - 43, - 44, + 41, + 42, ], "type": "Punctuator", - "value": ";", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 43, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 42, + "line": 1, }, }, "range": Array [ - 49, - 52, + 42, + 43, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 4, + "column": 44, + "line": 1, }, "start": Object { - "column": 7, - "line": 4, + "column": 43, + "line": 1, }, }, "range": Array [ - 52, - 53, + 43, + 44, ], "type": "Punctuator", - "value": "?", + "value": ">", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/never-type-param.src 1`] = ` +Object { + "body": Array [ Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 17, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSNeverKeyword", + }, + ], + "range": Array [ + 10, + 17, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 18, + "line": 1, }, "start": Object { - "column": 8, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 53, - 54, + 0, + 18, ], - "type": "Punctuator", - "value": "(", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "Observable", + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "empty", + "range": Array [ + 30, + 35, + ], + "type": "Identifier", + }, + "range": Array [ + 19, + 35, + ], + "type": "MemberExpression", }, - "start": Object { - "column": 9, - "line": 4, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 19, + 44, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "TSNeverKeyword", + }, + ], + "range": Array [ + 35, + 42, + ], + "type": "TSTypeParameterInstantiation", }, }, - "range": Array [ - 54, - 57, - ], - "type": "Identifier", - "value": "foo", - }, - Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 26, + "line": 2, }, "start": Object { - "column": 12, - "line": 4, + "column": 0, + "line": 2, }, }, "range": Array [ - 57, - 58, + 19, + 45, ], - "type": "Punctuator", - "value": ",", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 5, + "line": 1, }, "start": Object { - "column": 14, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 59, - 62, + 0, + 5, ], - "type": "Identifier", - "value": "bar", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 6, + "line": 1, }, }, "range": Array [ - 62, - 63, + 6, + 7, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 8, + "line": 1, }, "start": Object { - "column": 18, - "line": 4, + "column": 7, + "line": 1, }, }, "range": Array [ - 63, - 64, + 7, + 8, ], "type": "Punctuator", "value": ":", @@ -55180,398 +59465,488 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 10, + "line": 1, }, "start": Object { - "column": 20, - "line": 4, + "column": 9, + "line": 1, }, }, "range": Array [ - 65, - 71, + 9, + 10, ], "type": "Identifier", - "value": "string", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 4, + "column": 11, + "line": 1, }, "start": Object { - "column": 26, - "line": 4, + "column": 10, + "line": 1, }, }, "range": Array [ - 71, - 72, + 10, + 11, ], "type": "Punctuator", - "value": ",", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 16, + "line": 1, }, "start": Object { - "column": 28, - "line": 4, + "column": 11, + "line": 1, }, }, "range": Array [ - 73, - 76, + 11, + 16, ], "type": "Identifier", - "value": "baz", + "value": "never", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 31, - "line": 4, + "column": 16, + "line": 1, }, }, "range": Array [ - 76, - 77, + 16, + 17, ], "type": "Punctuator", - "value": "?", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 4, + "column": 18, + "line": 1, }, "start": Object { - "column": 32, - "line": 4, + "column": 17, + "line": 1, }, }, "range": Array [ - 77, - 78, + 17, + 18, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 4, + "column": 10, + "line": 2, }, "start": Object { - "column": 33, - "line": 4, + "column": 0, + "line": 2, }, }, "range": Array [ - 78, - 79, + 19, + 29, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "Observable", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 11, + "line": 2, }, "start": Object { - "column": 0, - "line": 5, + "column": 10, + "line": 2, }, }, "range": Array [ - 80, - 81, + 29, + 30, ], "type": "Punctuator", - "value": "}", + "value": ".", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-without-type-annotation.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": "foo", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 21, - 25, - ], - "type": "TSPropertySignature", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 27, - ], - "type": "TSInterfaceBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "test", - "range": Array [ - 10, - 14, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 16, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 0, - 27, + 30, + 35, ], - "type": "TSInterfaceDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "empty", }, - }, - "range": Array [ - 0, - 28, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 0, - 9, + 35, + 36, ], - "type": "Keyword", - "value": "interface", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 10, - 14, + 36, + 41, ], "type": "Identifier", - "value": "test", + "value": "never", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 15, - 16, + 41, + 42, ], "type": "Punctuator", - "value": "{", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 24, "line": 2, }, "start": Object { - "column": 4, + "column": 23, "line": 2, }, }, "range": Array [ - 21, - 24, + 42, + 43, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 25, "line": 2, }, "start": Object { - "column": 7, + "column": 24, "line": 2, }, }, "range": Array [ - 24, - 25, + 43, + 44, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 26, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 25, + "line": 2, }, }, "range": Array [ - 26, - 27, + 44, + 45, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/keyof-operator.src 1`] = ` +exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` Object { "body": Array [ Object { - "id": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": "e", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "validateEntity", + "range": Array [ + 41, + 55, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 58, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 59, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "s", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "init": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "e", + "range": Array [ + 72, + 73, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "TSNonNullExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 75, + 79, + ], + "type": "Identifier", + }, + "range": Array [ + 72, + 79, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 68, + 79, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 64, + 80, + ], + "type": "VariableDeclaration", + }, + ], "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 5, + "column": 35, "line": 1, }, }, - "name": "x", "range": Array [ - 5, - 6, + 35, + 82, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "BlockStatement", }, - "range": Array [ - 0, - 19, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { + "expression": false, + "generator": false, + "id": Object { "loc": Object { "end": Object { - "column": 18, + "column": 22, "line": 1, }, "start": Object { @@ -55579,54 +59954,107 @@ Object { "line": 1, }, }, - "operator": "keyof", + "name": "processEntity", "range": Array [ 9, - 18, + 22, ], - "type": "TSTypeOperator", - "typeAnnotation": Object { + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 18, + "column": 33, "line": 1, }, "start": Object { - "column": 15, + "column": 23, "line": 1, }, }, + "name": "e", + "optional": true, "range": Array [ - 15, - 18, + 23, + 33, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 18, + "column": 33, "line": 1, }, "start": Object { - "column": 15, + "column": 25, "line": 1, }, }, - "name": "foo", "range": Array [ - 15, - 18, + 25, + 33, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "Entity", + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + }, + }, }, }, - }, + ], + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -55635,14 +60063,14 @@ Object { }, "range": Array [ 0, - 20, + 82, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 8, "line": 1, }, "start": Object { @@ -55652,618 +60080,413 @@ Object { }, "range": Array [ 0, - 4, + 8, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 22, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 6, + 9, + 22, ], "type": "Identifier", - "value": "x", + "value": "processEntity", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 23, "line": 1, }, "start": Object { - "column": 7, + "column": 22, "line": 1, }, }, "range": Array [ - 7, - 8, + 22, + 23, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 24, "line": 1, }, "start": Object { - "column": 9, + "column": 23, "line": 1, }, }, "range": Array [ - 9, - 14, + 23, + 24, ], "type": "Identifier", - "value": "keyof", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 25, "line": 1, }, "start": Object { - "column": 15, + "column": 24, "line": 1, }, }, "range": Array [ - 15, - 18, + 24, + 25, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "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": "Punctuator", - "value": ";", + "value": ":", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "nestedArray", - "range": Array [ - 4, - 44, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 44, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 44, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 17, - 22, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 43, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 23, - 28, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 42, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 29, - 34, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 41, - ], - "type": "TSStringKeyword", - }, - ], - "range": Array [ - 34, - 42, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - ], - "range": Array [ - 28, - 43, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - ], - "range": Array [ - 22, - 44, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 44, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, }, + }, + "range": Array [ + 27, + 33, ], - "kind": "var", + "type": "Identifier", + "value": "Entity", + }, + Object { "loc": Object { "end": Object { - "column": 44, + "column": 34, "line": 1, }, "start": Object { - "column": 0, + "column": 33, "line": 1, }, }, "range": Array [ - 0, - 44, + 33, + 34, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 44, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 36, "line": 1, }, "start": Object { - "column": 0, + "column": 35, "line": 1, }, }, "range": Array [ - 0, - 3, + 35, + 36, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { "column": 4, - "line": 1, + "line": 2, }, }, "range": Array [ - 4, - 15, + 41, + 55, ], "type": "Identifier", - "value": "nestedArray", + "value": "validateEntity", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 15, - 16, + 55, + 56, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 17, - 22, + 56, + 57, ], "type": "Identifier", - "value": "Array", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { "column": 22, - "line": 1, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, }, }, "range": Array [ - 22, - 23, + 64, + 67, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { - "column": 23, - "line": 1, + "column": 8, + "line": 3, }, }, "range": Array [ - 23, - 28, + 68, + 69, ], "type": "Identifier", - "value": "Array", + "value": "s", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 28, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 28, - 29, + 70, + 71, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 29, - "line": 1, + "column": 12, + "line": 3, }, }, "range": Array [ - 29, - 34, + 72, + 73, ], "type": "Identifier", - "value": "Array", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { - "column": 34, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ - 34, - 35, + 73, + 74, ], "type": "Punctuator", - "value": "<", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 35, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ - 35, - 41, + 74, + 75, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 41, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ - 41, - 42, + 75, + 79, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 20, + "line": 3, }, "start": Object { - "column": 42, - "line": 1, + "column": 19, + "line": 3, }, }, "range": Array [ - 42, - 43, + 79, + 80, ], "type": "Punctuator", - "value": ">", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 43, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 43, - 44, + 81, + 82, ], "type": "Punctuator", - "value": ">", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/never-type-param.src 1`] = ` +exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` Object { "body": Array [ Object { @@ -56272,131 +60495,77 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "name": "x", "range": Array [ - 6, - 17, + 4, + 11, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 7, + "column": 5, "line": 1, }, }, "range": Array [ - 7, - 17, + 5, + 11, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ - 9, - 17, + 7, + 11, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "X", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 16, - ], - "type": "TSNeverKeyword", - }, - ], - "range": Array [ - 10, - 17, - ], - "type": "TSTypeParameterInstantiation", - }, + "type": "TSNullKeyword", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 17, + 4, + 11, ], "type": "VariableDeclarator", }, ], - "kind": "const", + "kind": "let", "loc": Object { "end": Object { - "column": 18, + "column": 12, "line": 1, }, "start": Object { @@ -56406,122 +60575,87 @@ Object { }, "range": Array [ 0, - 18, + 12, ], "type": "VariableDeclaration", }, Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "object": Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 2, }, "start": Object { - "column": 0, + "column": 4, "line": 2, }, }, - "name": "Observable", + "name": "y", "range": Array [ - 19, + 17, 29, ], "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, }, - "start": Object { - "column": 11, - "line": 2, + "range": Array [ + 18, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "TSUndefinedKeyword", }, }, - "name": "empty", - "range": Array [ - 30, - 35, - ], - "type": "Identifier", - }, - "range": Array [ - 19, - 35, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 2, }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 19, - 44, - ], - "type": "CallExpression", - "typeParameters": Object { + "init": null, "loc": Object { "end": Object { - "column": 23, + "column": 16, "line": 2, }, "start": Object { - "column": 16, + "column": 4, "line": 2, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 36, - 41, - ], - "type": "TSNeverKeyword", - }, - ], "range": Array [ - 35, - 42, + 17, + 29, ], - "type": "TSTypeParameterInstantiation", + "type": "VariableDeclarator", }, - }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 26, + "column": 17, "line": 2, }, "start": Object { @@ -56530,16 +60664,16 @@ Object { }, }, "range": Array [ - 19, - 45, + 13, + 30, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 3, + "column": 17, + "line": 2, }, "start": Object { "column": 0, @@ -56548,14 +60682,14 @@ Object { }, "range": Array [ 0, - 46, + 30, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -56565,25 +60699,25 @@ Object { }, "range": Array [ 0, - 5, + 3, ], "type": "Keyword", - "value": "const", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 7, + 4, + 5, ], "type": "Identifier", "value": "x", @@ -56591,17 +60725,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { - "column": 7, + "column": 5, "line": 1, }, }, "range": Array [ - 7, - 8, + 5, + 6, ], "type": "Punctuator", "value": ":", @@ -56609,251 +60743,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "X", - }, - 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": 16, - "line": 1, - }, - "start": Object { "column": 11, "line": 1, }, - }, - "range": Array [ - 11, - 16, - ], - "type": "Identifier", - "value": "never", - }, - 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": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 19, - 29, - ], - "type": "Identifier", - "value": "Observable", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": ".", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, "start": Object { - "column": 11, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 30, - 35, + 7, + 11, ], - "type": "Identifier", - "value": "empty", + "type": "Keyword", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 35, - 36, + 11, + 12, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 3, "line": 2, }, "start": Object { - "column": 17, + "column": 0, "line": 2, }, }, "range": Array [ - 36, - 41, + 13, + 16, ], - "type": "Identifier", - "value": "never", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 5, "line": 2, }, "start": Object { - "column": 22, + "column": 4, "line": 2, }, }, "range": Array [ - 41, - 42, + 17, + 18, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 6, "line": 2, }, "start": Object { - "column": 23, + "column": 5, "line": 2, }, }, "range": Array [ - 42, - 43, + 18, + 19, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 16, "line": 2, }, "start": Object { - "column": 24, + "column": 7, "line": 2, }, }, "range": Array [ - 43, - 44, + 20, + 29, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "undefined", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 17, "line": 2, }, "start": Object { - "column": 25, + "column": 16, "line": 2, }, }, "range": Array [ - 44, - 45, + 29, + 30, ], "type": "Punctuator", "value": ";", @@ -56863,342 +60871,432 @@ Object { } `; -exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` +exports[`typescript fixtures/basics/object-with-escaped-properties.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ + "expression": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": "e", - "range": Array [ - 56, - 57, - ], - "type": "Identifier", + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 13, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, }, + }, + "range": Array [ + 9, + 13, ], - "callee": Object { + "raw": "null", + "type": "Literal", + "value": null, + }, + }, + ], + "range": Array [ + 1, + 15, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 22, + 26, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "method": true, + "range": Array [ + 22, + 31, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 12, + "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 10, + "line": 3, }, }, - "name": "validateEntity", "range": Array [ - 41, - 55, + 29, + 31, ], - "type": "Identifier", + "type": "BlockStatement", }, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 12, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 26, + 31, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 20, + 33, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 19, + 35, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, }, "start": Object { "column": 4, - "line": 2, + "line": 5, }, }, "range": Array [ 41, - 58, + 45, ], - "type": "CallExpression", + "raw": "'__'", + "type": "Literal", + "value": "__", }, + "kind": "init", "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 15, + "line": 5, }, "start": Object { - "column": 4, - "line": 2, + "column": 3, + "line": 5, }, }, + "method": false, "range": Array [ - 41, - 59, + 40, + 52, ], - "type": "ExpressionStatement", + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 48, + 52, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, }, + ], + "range": Array [ + 38, + 54, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 37, + 56, + ], + "type": "ExpressionStatement", + }, + Object { + "body": Object { + "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "name": "s", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - }, - "init": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "object": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "name": "e", - "range": Array [ - 72, - 73, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 72, - 74, - ], - "type": "TSNonNullExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 75, - 79, - ], - "type": "Identifier", - }, - "range": Array [ - 72, - 79, - ], - "type": "MemberExpression", + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, }, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, + "start": Object { + "column": 10, + "line": 7, }, - "range": Array [ - 68, - 79, - ], - "type": "VariableDeclarator", }, - ], - "kind": "let", + "range": Array [ + 68, + 72, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, "loc": Object { "end": Object { - "column": 20, - "line": 3, + "column": 21, + "line": 7, }, "start": Object { - "column": 4, - "line": 3, + "column": 10, + "line": 7, }, }, "range": Array [ - 64, - 80, + 68, + 79, ], - "type": "VariableDeclaration", + "static": false, + "type": "ClassProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 75, + 79, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, }, ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 23, + "line": 7, }, "start": Object { - "column": 35, - "line": 1, + "column": 8, + "line": 7, }, }, "range": Array [ - 35, - 82, + 66, + 81, ], - "type": "BlockStatement", + "type": "ClassBody", }, - "expression": false, - "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 7, + "line": 7, }, "start": Object { - "column": 9, - "line": 1, + "column": 6, + "line": 7, }, }, - "name": "processEntity", + "name": "X", "range": Array [ - 9, - 22, + 64, + 65, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 23, + "line": 7, }, "start": Object { "column": 0, - "line": 1, + "line": 7, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "e", - "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": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "name": "Entity", - "range": Array [ - 27, - 33, - ], - "type": "Identifier", - }, - }, - }, - }, - ], "range": Array [ - 0, - 82, + 58, + 81, ], - "type": "FunctionDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -57214,7 +61312,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -57224,128 +61322,290 @@ Object { }, "range": Array [ 0, - 8, + 1, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 2, "line": 1, }, "start": Object { - "column": 9, + "column": 1, "line": 1, }, }, "range": Array [ - 9, - 22, + 1, + 2, ], - "type": "Identifier", - "value": "processEntity", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 7, "line": 1, }, "start": Object { - "column": 22, + "column": 3, "line": 1, }, }, "range": Array [ - 22, - 23, + 3, + 7, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 13, "line": 1, }, "start": Object { - "column": 23, + "column": 9, "line": 1, }, }, "range": Array [ - 23, - 24, + 9, + 13, ], - "type": "Identifier", - "value": "e", + "type": "Keyword", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 1, }, "start": Object { - "column": 24, + "column": 14, "line": 1, }, }, "range": Array [ - 24, - 25, + 14, + 15, ], "type": "Punctuator", - "value": "?", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 16, "line": 1, }, "start": Object { - "column": 25, + "column": 15, "line": 1, }, }, "range": Array [ - 25, - 26, + 15, + 16, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 17, "line": 1, }, "start": Object { - "column": 27, + "column": 16, "line": 1, }, }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, "range": Array [ 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 32, 33, ], - "type": "Identifier", - "value": "Entity", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 33, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ @@ -57358,17 +61618,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 16, + "line": 3, }, "start": Object { - "column": 35, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ + 34, 35, - 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, ], "type": "Punctuator", "value": "{", @@ -57376,251 +61672,269 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, }, "start": Object { "column": 4, - "line": 2, + "line": 5, }, }, "range": Array [ 41, - 55, + 45, ], - "type": "Identifier", - "value": "validateEntity", + "type": "String", + "value": "'__'", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 9, + "line": 5, }, "start": Object { - "column": 18, - "line": 2, + "column": 8, + "line": 5, }, }, "range": Array [ - 55, - 56, + 45, + 46, ], "type": "Punctuator", - "value": "(", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 10, + "line": 5, }, "start": Object { - "column": 19, - "line": 2, + "column": 9, + "line": 5, }, }, "range": Array [ - 56, - 57, + 46, + 47, ], - "type": "Identifier", - "value": "e", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 15, + "line": 5, }, "start": Object { - "column": 20, - "line": 2, + "column": 11, + "line": 5, }, }, "range": Array [ - 57, - 58, + 48, + 52, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 17, + "line": 5, }, "start": Object { - "column": 21, - "line": 2, + "column": 16, + "line": 5, }, }, "range": Array [ - 58, - 59, + 53, + 54, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 18, + "line": 5, }, "start": Object { - "column": 4, - "line": 3, + "column": 17, + "line": 5, }, }, "range": Array [ - 64, - 67, + 54, + 55, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 19, + "line": 5, }, "start": Object { - "column": 8, - "line": 3, + "column": 18, + "line": 5, }, }, "range": Array [ - 68, - 69, + 55, + 56, ], - "type": "Identifier", - "value": "s", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 5, + "line": 7, }, "start": Object { - "column": 10, - "line": 3, + "column": 0, + "line": 7, }, }, "range": Array [ - 70, - 71, + 58, + 63, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 7, + "line": 7, }, "start": Object { - "column": 12, - "line": 3, + "column": 6, + "line": 7, }, }, "range": Array [ - 72, - 73, + 64, + 65, ], "type": "Identifier", - "value": "e", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 9, + "line": 7, }, "start": Object { - "column": 13, - "line": 3, + "column": 8, + "line": 7, }, }, "range": Array [ - 73, - 74, + 66, + 67, ], "type": "Punctuator", - "value": "!", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 14, + "line": 7, }, "start": Object { - "column": 14, - "line": 3, + "column": 10, + "line": 7, }, }, "range": Array [ - 74, - 75, + 68, + 72, ], - "type": "Punctuator", - "value": ".", + "type": "String", + "value": "'__'", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 16, + "line": 7, }, "start": Object { "column": 15, - "line": 3, + "line": 7, }, }, "range": Array [ - 75, - 79, + 73, + 74, ], - "type": "Identifier", - "value": "name", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 3, + "column": 21, + "line": 7, }, "start": Object { - "column": 19, - "line": 3, + "column": 17, + "line": 7, }, }, "range": Array [ + 75, 79, - 80, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 23, + "line": 7, }, "start": Object { - "column": 0, - "line": 4, + "column": 22, + "line": 7, }, }, "range": Array [ + 80, 81, - 82, ], "type": "Punctuator", "value": "}", @@ -57630,7 +61944,7 @@ Object { } `; -exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` +exports[`typescript fixtures/basics/object-with-typed-methods.src 1`] = ` Object { "body": Array [ Object { @@ -57639,185 +61953,804 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, - "name": "x", + "name": "foo", "range": Array [ - 4, - 11, + 6, + 9, ], "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 16, + 29, + ], + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", }, - "start": Object { - "column": 5, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 16, + 61, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 57, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 43, + 61, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 29, + 61, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 34, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "range": Array [ + 30, + 31, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 29, + 32, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "foo", + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "method": true, + "range": Array [ + 65, + 100, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 95, + 96, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 88, + 96, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 82, + 100, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 68, + 100, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 73, + 81, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 75, + 81, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 68, + 71, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, - "range": Array [ - 5, - 11, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "name": "a", + "range": Array [ + 108, + 109, + ], + "type": "Identifier", + }, + "kind": "get", "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 3, + "line": 10, }, "start": Object { - "column": 7, - "line": 1, + "column": 2, + "line": 8, }, }, + "method": false, "range": Array [ - 7, - 11, + 104, + 138, ], - "type": "TSNullKeyword", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 11, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 12, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "y", - "range": Array [ - 17, - 29, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 133, + 134, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 126, + 134, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 120, + 138, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "params": Array [], + "range": Array [ + 109, + 138, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 111, + 119, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 113, + 119, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", }, }, - "range": Array [ - 18, - 29, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 6, + "line": 11, + }, + }, + "name": "a", + "range": Array [ + 146, + 147, + ], + "type": "Identifier", + }, + "kind": "set", "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 3, + "line": 12, }, "start": Object { - "column": 7, - "line": 2, + "column": 2, + "line": 11, }, }, + "method": false, "range": Array [ - 20, - 29, + 142, + 172, ], - "type": "TSUndefinedKeyword", + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 27, + "line": 11, + }, + }, + "range": Array [ + 167, + 172, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "name": "x", + "range": Array [ + 148, + 157, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 149, + 157, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 11, + }, + }, + "range": Array [ + 151, + 157, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 147, + 172, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 158, + 166, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 20, + "line": 11, + }, + }, + "range": Array [ + 160, + 166, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + }, }, - }, + ], + "range": Array [ + 12, + 174, + ], + "type": "ObjectExpression", }, - "init": null, "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 1, + "line": 13, }, "start": Object { - "column": 4, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 17, - 29, + 6, + 174, ], "type": "VariableDeclarator", }, ], - "kind": "let", + "kind": "const", "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 2, + "line": 13, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 13, - 30, + 0, + 175, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 0, + "line": 14, }, "start": Object { "column": 0, @@ -57826,14 +62759,14 @@ Object { }, "range": Array [ 0, - 30, + 176, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -57843,630 +62776,385 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "let", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, - 5, + 6, + 9, ], "type": "Identifier", - "value": "x", + "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": 11, + "column": 13, "line": 1, }, "start": Object { - "column": 7, + "column": 12, "line": 1, }, }, "range": Array [ - 7, - 11, + 12, + 13, ], - "type": "Keyword", - "value": "null", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 11, - 12, + 16, + 29, ], - "type": "Punctuator", - "value": ";", + "type": "String", + "value": "\\"constructor\\"", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 16, "line": 2, }, "start": Object { - "column": 0, + "column": 15, "line": 2, }, }, "range": Array [ - 13, - 16, + 29, + 30, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 17, "line": 2, }, "start": Object { - "column": 4, + "column": 16, "line": 2, }, }, "range": Array [ - 17, - 18, + 30, + 31, ], "type": "Identifier", - "value": "y", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 18, "line": 2, }, "start": Object { - "column": 5, + "column": 17, "line": 2, }, }, "range": Array [ - 18, - 19, + 31, + 32, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 19, "line": 2, }, "start": Object { - "column": 7, + "column": 18, "line": 2, }, }, "range": Array [ - 20, - 29, + 32, + 33, ], - "type": "Identifier", - "value": "undefined", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 20, "line": 2, }, "start": Object { - "column": 16, + "column": 19, "line": 2, }, }, "range": Array [ - 29, - 30, + 33, + 34, ], "type": "Punctuator", - "value": ";", + "value": ")", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/object-with-escaped-properties.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 7, - ], - "raw": "'__'", - "type": "Literal", - "value": "__", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 3, - 13, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 13, - ], - "raw": "null", - "type": "Literal", - "value": null, - }, - }, - ], - "range": Array [ - 1, - 15, - ], - "type": "ObjectExpression", }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ":", + }, + Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 28, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 0, - 17, + 36, + 42, ], - "type": "ExpressionStatement", + "type": "Identifier", + "value": "number", }, Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 1, - "line": 3, - }, + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 3, - "line": 3, - }, - }, - "range": Array [ - 22, - 26, - ], - "raw": "'__'", - "type": "Literal", - "value": "__", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 3, - "line": 3, - }, - }, - "method": true, - "range": Array [ - 22, - 31, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 29, - 31, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 26, - 31, - ], - "type": "FunctionExpression", - }, - }, - ], - "range": Array [ - 20, - 33, - ], - "type": "ObjectExpression", }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 3, }, "start": Object { - "column": 0, + "column": 4, "line": 3, }, }, "range": Array [ - 19, - 35, + 49, + 55, ], - "type": "ExpressionStatement", + "type": "Keyword", + "value": "return", }, Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 1, - "line": 5, - }, + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, }, - "properties": Array [ - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "range": Array [ - 41, - 45, - ], - "raw": "'__'", - "type": "Literal", - "value": "__", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 3, - "line": 5, - }, - }, - "method": false, - "range": Array [ - 40, - 52, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 5, - }, - }, - "range": Array [ - 48, - 52, - ], - "raw": "null", - "type": "Literal", - "value": null, - }, - }, - ], - "range": Array [ - 38, - 54, - ], - "type": "ObjectExpression", }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "<", + }, + Object { "loc": Object { "end": Object { - "column": 19, + "column": 7, "line": 5, }, "start": Object { - "column": 0, + "column": 6, "line": 5, }, }, "range": Array [ - 37, - 56, + 69, + 70, ], - "type": "ExpressionStatement", + "type": "Identifier", + "value": "T", }, Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 7, - }, - "start": Object { - "column": 10, - "line": 7, - }, - }, - "range": Array [ - 68, - 72, - ], - "raw": "'__'", - "type": "Literal", - "value": "__", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 7, - }, - "start": Object { - "column": 10, - "line": 7, - }, - }, - "range": Array [ - 68, - 79, - ], - "static": false, - "type": "ClassProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 7, - }, - "start": Object { - "column": 17, - "line": 7, - }, - }, - "range": Array [ - 75, - 79, - ], - "raw": "null", - "type": "Literal", - "value": null, - }, - }, - ], - "loc": Object { - "end": Object { - "column": 23, - "line": 7, - }, - "start": Object { - "column": 8, - "line": 7, - }, - }, - "range": Array [ - 66, - 81, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 6, - "line": 7, - }, - }, - "name": "X", - "range": Array [ - 64, - 65, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 23, - "line": 7, + "column": 8, + "line": 5, }, "start": Object { - "column": 0, - "line": 7, + "column": 7, + "line": 5, }, }, "range": Array [ - 58, - 81, + 70, + 71, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 8, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ">", }, - }, - "range": Array [ - 0, - 82, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 0, - 1, + 71, + 72, ], "type": "Punctuator", "value": "(", @@ -58474,197 +63162,197 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { - "column": 1, - "line": 1, + "column": 9, + "line": 5, }, }, "range": Array [ - 1, - 2, + 72, + 73, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 11, + "line": 5, }, "start": Object { - "column": 3, - "line": 1, + "column": 10, + "line": 5, }, }, "range": Array [ - 3, - 7, + 73, + 74, ], - "type": "String", - "value": "'__'", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 18, + "line": 5, }, "start": Object { - "column": 7, - "line": 1, + "column": 12, + "line": 5, }, }, "range": Array [ - 7, - 8, + 75, + 81, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 20, + "line": 5, }, "start": Object { - "column": 9, - "line": 1, + "column": 19, + "line": 5, }, }, "range": Array [ - 9, - 13, + 82, + 83, ], - "type": "Keyword", - "value": "null", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 10, + "line": 6, }, "start": Object { - "column": 14, - "line": 1, + "column": 4, + "line": 6, }, }, "range": Array [ - 14, - 15, + 88, + 94, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 12, + "line": 6, }, "start": Object { - "column": 15, - "line": 1, + "column": 11, + "line": 6, }, }, "range": Array [ - 15, - 16, + 95, + 96, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 3, + "line": 7, }, "start": Object { - "column": 16, - "line": 1, + "column": 2, + "line": 7, }, }, "range": Array [ - 16, - 17, + 99, + 100, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 4, + "line": 7, }, "start": Object { - "column": 0, - "line": 3, + "column": 3, + "line": 7, }, }, "range": Array [ - 19, - 20, + 100, + 101, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 5, + "line": 8, }, "start": Object { - "column": 1, - "line": 3, + "column": 2, + "line": 8, }, }, "range": Array [ - 20, - 21, + 104, + 107, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "get", }, Object { "loc": Object { "end": Object { "column": 7, - "line": 3, + "line": 8, }, "start": Object { - "column": 3, - "line": 3, + "column": 6, + "line": 8, }, }, "range": Array [ - 22, - 26, + 108, + 109, ], - "type": "String", - "value": "'__'", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 3, + "line": 8, }, "start": Object { "column": 7, - "line": 3, + "line": 8, }, }, "range": Array [ - 26, - 27, + 109, + 110, ], "type": "Punctuator", "value": "(", @@ -58673,16 +63361,16 @@ Object { "loc": Object { "end": Object { "column": 9, - "line": 3, + "line": 8, }, "start": Object { "column": 8, - "line": 3, + "line": 8, }, }, "range": Array [ - 27, - 28, + 110, + 111, ], "type": "Punctuator", "value": ")", @@ -58690,53 +63378,107 @@ Object { Object { "loc": Object { "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { "column": 11, - "line": 3, + "line": 8, + }, + }, + "range": Array [ + 113, + 119, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, }, "start": Object { - "column": 10, - "line": 3, + "column": 18, + "line": 8, }, }, "range": Array [ - 29, - 30, + 120, + 121, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "Keyword", + "value": "return", + }, Object { "loc": Object { "end": Object { "column": 12, - "line": 3, + "line": 9, }, "start": Object { "column": 11, - "line": 3, + "line": 9, }, }, "range": Array [ - 30, - 31, + 133, + 134, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 3, + "line": 10, }, "start": Object { - "column": 13, - "line": 3, + "column": 2, + "line": 10, }, }, "range": Array [ - 32, - 33, + 137, + 138, ], "type": "Punctuator", "value": "}", @@ -58744,53 +63486,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 4, + "line": 10, }, "start": Object { - "column": 14, - "line": 3, + "column": 3, + "line": 10, }, }, "range": Array [ - 33, - 34, + 138, + 139, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 5, + "line": 11, }, "start": Object { - "column": 15, - "line": 3, + "column": 2, + "line": 11, }, }, "range": Array [ - 34, - 35, + 142, + 145, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 7, + "line": 11, }, "start": Object { - "column": 0, - "line": 5, + "column": 6, + "line": 11, }, }, "range": Array [ - 37, - 38, + 146, + 147, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 11, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "range": Array [ + 147, + 148, ], "type": "Punctuator", "value": "(", @@ -58798,89 +63558,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, - "line": 5, + "column": 9, + "line": 11, }, "start": Object { - "column": 1, - "line": 5, + "column": 8, + "line": 11, }, }, "range": Array [ - 38, - 39, + 148, + 149, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 5, + "column": 10, + "line": 11, }, "start": Object { - "column": 3, - "line": 5, + "column": 9, + "line": 11, }, }, "range": Array [ - 40, - 41, + 149, + 150, ], "type": "Punctuator", - "value": "[", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 5, + "column": 17, + "line": 11, }, "start": Object { - "column": 4, - "line": 5, + "column": 11, + "line": 11, }, }, "range": Array [ - 41, - 45, + 151, + 157, ], - "type": "String", - "value": "'__'", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 18, + "line": 11, }, "start": Object { - "column": 8, - "line": 5, + "column": 17, + "line": 11, }, }, "range": Array [ - 45, - 46, + 157, + 158, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 19, + "line": 11, }, "start": Object { - "column": 9, - "line": 5, + "column": 18, + "line": 11, }, }, "range": Array [ - 46, - 47, + 158, + 159, ], "type": "Punctuator", "value": ":", @@ -58888,248 +63648,257 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 5, + "column": 26, + "line": 11, }, "start": Object { - "column": 11, - "line": 5, + "column": 20, + "line": 11, }, }, "range": Array [ - 48, - 52, + 160, + 166, ], - "type": "Keyword", - "value": "null", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 5, + "column": 28, + "line": 11, }, "start": Object { - "column": 16, - "line": 5, + "column": 27, + "line": 11, }, }, "range": Array [ - 53, - 54, + 167, + 168, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 3, + "line": 12, }, "start": Object { - "column": 17, - "line": 5, + "column": 2, + "line": 12, }, }, "range": Array [ - 54, - 55, + 171, + 172, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 5, + "column": 1, + "line": 13, }, "start": Object { - "column": 18, - "line": 5, + "column": 0, + "line": 13, }, }, "range": Array [ - 55, - 56, + 173, + 174, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 7, + "column": 2, + "line": 13, }, "start": Object { - "column": 0, - "line": 7, + "column": 1, + "line": 13, }, }, "range": Array [ - 58, - 63, + 174, + 175, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/parenthesized-use-strict.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 46, + 58, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, "loc": Object { "end": Object { - "column": 7, - "line": 7, + "column": 15, + "line": 2, }, "start": Object { - "column": 6, - "line": 7, + "column": 0, + "line": 2, }, }, "range": Array [ - 64, - 65, + 45, + 60, ], - "type": "Identifier", - "value": "X", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, }, + }, + "range": Array [ + 45, + 60, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 7, + "column": 1, + "line": 2, }, "start": Object { - "column": 8, - "line": 7, + "column": 0, + "line": 2, }, }, "range": Array [ - 66, - 67, + 45, + 46, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 7, + "column": 13, + "line": 2, }, "start": Object { - "column": 10, - "line": 7, + "column": 1, + "line": 2, }, }, "range": Array [ - 68, - 72, + 46, + 58, ], "type": "String", - "value": "'__'", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 7, + "column": 14, + "line": 2, }, "start": Object { - "column": 15, - "line": 7, + "column": 13, + "line": 2, }, }, "range": Array [ - 73, - 74, + 58, + 59, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 7, - }, - "start": Object { - "column": 17, - "line": 7, - }, - }, - "range": Array [ - 75, - 79, - ], - "type": "Keyword", - "value": "null", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 7, + "column": 15, + "line": 2, }, "start": Object { - "column": 22, - "line": 7, + "column": 14, + "line": 2, }, }, "range": Array [ - 80, - 81, + 59, + 60, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/object-with-typed-methods.src 1`] = ` +exports[`typescript fixtures/basics/readonly-arrays.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 { - "loc": Object { - "end": Object { - "column": 1, - "line": 13, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "properties": Array [ - Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { "computed": false, - "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { "loc": Object { "end": Object { - "column": 15, + "column": 5, "line": 2, }, "start": Object { @@ -59137,764 +63906,688 @@ Object { "line": 2, }, }, + "name": "arr", "range": Array [ - 16, - 29, + 45, + 48, ], - "raw": "\\"constructor\\"", - "type": "Literal", - "value": "constructor", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 2, - }, + "type": "Identifier", }, - "method": true, - "range": Array [ - 16, - 61, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 56, - 57, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 49, - 57, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 43, - 61, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + "property": Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 11, + "line": 2, }, "start": Object { - "column": 15, + "column": 6, "line": 2, }, }, - "params": Array [], + "name": "slice", "range": Array [ - 29, - 61, + 49, + 54, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 34, - 42, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 36, - 42, - ], - "type": "TSNumberKeyword", - }, - }, - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "T", - "range": Array [ - 30, - 31, - ], - "type": "Identifier", - }, - "range": Array [ - 30, - 31, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 29, - 32, - ], - "type": "TSTypeParameterDeclaration", - }, + "type": "Identifier", }, + "range": Array [ + 45, + 54, + ], + "type": "MemberExpression", }, - Object { - "computed": false, - "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 45, + 56, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 45, + 57, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [ + Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 19, + "line": 3, }, "start": Object { - "column": 2, - "line": 5, + "column": 11, + "line": 3, }, }, - "name": "foo", "range": Array [ - 65, - 68, + 84, + 92, ], - "type": "Identifier", + "raw": "\\"hello!\\"", + "type": "Literal", + "value": "hello!", }, - "kind": "init", + ], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 3, - "line": 7, + "column": 10, + "line": 3, }, "start": Object { "column": 2, - "line": 5, + "line": 3, }, }, - "method": true, - "range": Array [ - 65, - 100, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 11, - "line": 6, - }, - }, - "range": Array [ - 95, - 96, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "range": Array [ - 88, - 96, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 7, - }, - "start": Object { - "column": 19, - "line": 5, - }, - }, - "range": Array [ - 82, - 100, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + "object": Object { "loc": Object { "end": Object { - "column": 3, - "line": 7, + "column": 5, + "line": 3, }, "start": Object { - "column": 5, - "line": 5, + "column": 2, + "line": 3, }, }, - "params": Array [], + "name": "arr", "range": Array [ - 68, - 100, + 75, + 78, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 5, - }, - }, - "range": Array [ - 73, - 81, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 5, - }, - "start": Object { - "column": 12, - "line": 5, - }, - }, - "range": Array [ - 75, - 81, - ], - "type": "TSNumberKeyword", - }, - }, - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 5, - "line": 5, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": "T", - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - }, - "range": Array [ - 69, - 70, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 68, - 71, - ], - "type": "TSTypeParameterDeclaration", - }, + "type": "Identifier", }, - }, - Object { - "computed": false, - "key": Object { + "property": Object { "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 10, + "line": 3, }, "start": Object { "column": 6, - "line": 8, + "line": 3, }, }, - "name": "a", + "name": "push", "range": Array [ - 108, - 109, + 79, + 83, ], "type": "Identifier", }, - "kind": "get", + "range": Array [ + 75, + 83, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 75, + 93, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 75, + 94, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 106, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "arr", + "range": Array [ + 13, + 39, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 39, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 39, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 3, - "line": 10, + "column": 31, + "line": 1, }, "start": Object { - "column": 2, - "line": 8, + "column": 18, + "line": 1, }, }, - "method": false, + "name": "ReadonlyArray", "range": Array [ - 104, - 138, + 18, + 31, ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 9, - }, - "start": Object { - "column": 11, - "line": 9, - }, - }, - "range": Array [ - 133, - 134, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 9, - }, - }, - "range": Array [ - 126, - 134, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 10, - }, - "start": Object { - "column": 18, - "line": 8, - }, - }, - "range": Array [ - 120, - 138, - ], - "type": "BlockStatement", + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 3, - "line": 10, - }, - "start": Object { - "column": 7, - "line": 8, - }, + "start": Object { + "column": 31, + "line": 1, }, - "params": Array [], - "range": Array [ - 109, - 138, - ], - "returnType": Object { + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 17, - "line": 8, + "column": 38, + "line": 1, }, "start": Object { - "column": 9, - "line": 8, + "column": 32, + "line": 1, }, }, "range": Array [ - 111, - 119, + 32, + 38, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 8, - }, - "start": Object { - "column": 11, - "line": 8, - }, - }, - "range": Array [ - 113, - 119, - ], - "type": "TSNumberKeyword", + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 31, + 39, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 106, + ], + "type": "FunctionDeclaration", + }, + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, }, }, - "type": "FunctionExpression", + "name": "arr", + "range": Array [ + 149, + 152, + ], + "type": "Identifier", }, - }, - Object { - "computed": false, - "key": Object { + "property": Object { "loc": Object { "end": Object { - "column": 7, - "line": 11, + "column": 11, + "line": 7, }, "start": Object { "column": 6, - "line": 11, + "line": 7, }, }, - "name": "a", + "name": "slice", "range": Array [ - 146, - 147, + 153, + 158, ], "type": "Identifier", }, - "kind": "set", + "range": Array [ + 149, + 158, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 149, + 160, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 149, + 161, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 188, + 196, + ], + "raw": "\\"hello!\\"", + "type": "Literal", + "value": "hello!", + }, + ], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 3, - "line": 12, + "column": 10, + "line": 8, }, "start": Object { "column": 2, - "line": 11, + "line": 8, }, }, - "method": false, - "range": Array [ - 142, - 172, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 3, - "line": 12, - }, - "start": Object { - "column": 27, - "line": 11, - }, - }, - "range": Array [ - 167, - 172, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + "object": Object { "loc": Object { "end": Object { - "column": 3, - "line": 12, + "column": 5, + "line": 8, }, "start": Object { - "column": 7, - "line": 11, + "column": 2, + "line": 8, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 11, - }, - "start": Object { - "column": 8, - "line": 11, - }, - }, - "name": "x", - "range": Array [ - 148, - 157, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 11, - }, - "start": Object { - "column": 9, - "line": 11, - }, - }, - "range": Array [ - 149, - 157, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 11, - }, - "start": Object { - "column": 11, - "line": 11, - }, - }, - "range": Array [ - 151, - 157, - ], - "type": "TSNumberKeyword", - }, - }, - }, - ], + "name": "arr", "range": Array [ - 147, - 172, + 179, + 182, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 11, - }, - "start": Object { - "column": 18, - "line": 11, - }, + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, }, - "range": Array [ - 158, - 166, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 11, - }, - "start": Object { - "column": 20, - "line": 11, - }, - }, - "range": Array [ - 160, - 166, - ], - "type": "TSNumberKeyword", + "start": Object { + "column": 6, + "line": 8, }, }, - "type": "FunctionExpression", + "name": "push", + "range": Array [ + 183, + 187, + ], + "type": "Identifier", }, + "range": Array [ + 179, + 187, + ], + "type": "MemberExpression", }, - ], + "loc": Object { + "end": Object { + "column": 20, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 179, + 197, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, "range": Array [ - 12, - 174, + 179, + 198, ], - "type": "ObjectExpression", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 37, + "line": 6, + }, + }, + "range": Array [ + 145, + 210, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, }, + }, + "name": "foo", + "range": Array [ + 117, + 120, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 1, - "line": 13, + "column": 35, + "line": 6, }, "start": Object { - "column": 6, - "line": 1, + "column": 13, + "line": 6, }, }, + "name": "arr", "range": Array [ - 6, - 174, + 121, + 143, ], - "type": "VariableDeclarator", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 124, + 143, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "operator": "readonly", + "range": Array [ + 126, + 143, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 135, + 143, + ], + "type": "TSArrayType", + }, + }, + }, }, ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 2, - "line": 13, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, "range": Array [ - 0, - 175, + 108, + 210, ], - "type": "VariableDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 14, + "line": 10, }, "start": Object { "column": 0, @@ -59903,78 +64596,204 @@ Object { }, "range": Array [ 0, - 176, + 211, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "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": "arr", + }, + 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": 31, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 31, + ], + "type": "Identifier", + "value": "ReadonlyArray", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, "line": 1, }, "start": Object { - "column": 0, + "column": 31, "line": 1, }, }, "range": Array [ - 0, - 5, + 31, + 32, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 38, "line": 1, }, "start": Object { - "column": 6, + "column": 32, "line": 1, }, }, "range": Array [ - 6, - 9, + 32, + 38, ], "type": "Identifier", - "value": "foo", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 39, "line": 1, }, "start": Object { - "column": 10, + "column": 38, "line": 1, }, }, "range": Array [ - 10, - 11, + 38, + 39, ], "type": "Punctuator", - "value": "=", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 40, "line": 1, }, "start": Object { - "column": 12, + "column": 39, "line": 1, }, }, "range": Array [ - 12, - 13, + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, ], "type": "Punctuator", "value": "{", @@ -59982,7 +64801,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 5, "line": 2, }, "start": Object { @@ -59991,206 +64810,242 @@ Object { }, }, "range": Array [ - 16, - 29, + 45, + 48, ], - "type": "String", - "value": "\\"constructor\\"", + "type": "Identifier", + "value": "arr", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 6, "line": 2, }, "start": Object { - "column": 15, + "column": 5, "line": 2, }, }, "range": Array [ - 29, - 30, + 48, + 49, ], "type": "Punctuator", - "value": "<", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 2, }, "start": Object { - "column": 16, + "column": 6, "line": 2, }, }, "range": Array [ - 30, - 31, + 49, + 54, ], "type": "Identifier", - "value": "T", + "value": "slice", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 12, "line": 2, }, "start": Object { - "column": 17, + "column": 11, "line": 2, }, }, "range": Array [ - 31, - 32, + 54, + 55, ], "type": "Punctuator", - "value": ">", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 13, "line": 2, }, "start": Object { - "column": 18, + "column": 12, "line": 2, }, }, "range": Array [ - 32, - 33, + 55, + 56, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 14, "line": 2, }, "start": Object { - "column": 19, + "column": 13, "line": 2, }, }, "range": Array [ - 33, - 34, + 56, + 57, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 20, - "line": 2, + "column": 2, + "line": 3, }, }, "range": Array [ - 34, - 35, + 75, + 78, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, ], "type": "Punctuator", - "value": ":", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 10, + "line": 3, }, "start": Object { - "column": 22, - "line": 2, + "column": 6, + "line": 3, }, }, "range": Array [ - 36, - 42, + 79, + 83, ], "type": "Identifier", - "value": "number", + "value": "push", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 29, - "line": 2, + "column": 10, + "line": 3, }, }, "range": Array [ - 43, - 44, + 83, + 84, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 19, "line": 3, }, "start": Object { - "column": 4, + "column": 11, "line": 3, }, }, "range": Array [ - 49, - 55, + 84, + 92, ], - "type": "Keyword", - "value": "return", + "type": "String", + "value": "\\"hello!\\"", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 20, "line": 3, }, "start": Object { - "column": 11, + "column": 19, "line": 3, }, }, "range": Array [ - 56, - 57, + 92, + 93, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, "line": 4, }, "start": Object { - "column": 2, + "column": 0, "line": 4, }, }, "range": Array [ - 60, - 61, + 105, + 106, ], "type": "Punctuator", "value": "}", @@ -60198,819 +65053,1454 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, - "line": 4, + "column": 8, + "line": 6, }, "start": Object { - "column": 3, - "line": 4, + "column": 0, + "line": 6, }, }, "range": Array [ - 61, - 62, + 108, + 116, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 117, + 120, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 120, + 121, ], "type": "Punctuator", - "value": ",", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 121, + 124, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 126, + 134, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 37, + "line": 6, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 5, - "line": 5, + "line": 7, }, "start": Object { "column": 2, - "line": 5, + "line": 7, }, }, "range": Array [ - 65, - 68, + 149, + 152, ], "type": "Identifier", - "value": "foo", + "value": "arr", }, Object { "loc": Object { "end": Object { "column": 6, - "line": 5, + "line": 7, }, "start": Object { "column": 5, - "line": 5, + "line": 7, }, }, "range": Array [ - 68, - 69, + 152, + 153, ], "type": "Punctuator", - "value": "<", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 11, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 153, + 158, + ], + "type": "Identifier", + "value": "slice", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, }, "start": Object { - "column": 6, - "line": 5, + "column": 2, + "line": 8, }, }, "range": Array [ - 69, - 70, + 179, + 182, ], "type": "Identifier", - "value": "T", + "value": "arr", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 5, + "column": 6, + "line": 8, }, "start": Object { - "column": 7, - "line": 5, + "column": 5, + "line": 8, }, }, "range": Array [ - 70, - 71, + 182, + 183, ], "type": "Punctuator", - "value": ">", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 10, + "line": 8, }, "start": Object { - "column": 8, - "line": 5, + "column": 6, + "line": 8, }, }, "range": Array [ - 71, - 72, + 183, + 187, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "push", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 11, + "line": 8, }, "start": Object { - "column": 9, - "line": 5, + "column": 10, + "line": 8, }, }, "range": Array [ - 72, - 73, + 187, + 188, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 5, + "column": 19, + "line": 8, }, "start": Object { - "column": 10, - "line": 5, + "column": 11, + "line": 8, }, }, "range": Array [ - 73, - 74, + 188, + 196, ], - "type": "Punctuator", - "value": ":", + "type": "String", + "value": "\\"hello!\\"", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 20, + "line": 8, }, "start": Object { - "column": 12, - "line": 5, + "column": 19, + "line": 8, }, }, "range": Array [ - 75, - 81, + 196, + 197, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 5, + "column": 21, + "line": 8, }, "start": Object { - "column": 19, - "line": 5, + "column": 20, + "line": 8, }, }, "range": Array [ - 82, - 83, + 197, + 198, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 6, + "column": 1, + "line": 9, }, "start": Object { - "column": 4, - "line": 6, + "column": 0, + "line": 9, }, }, "range": Array [ - 88, - 94, + 209, + 210, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/readonly-tuples.src 1`] = ` +Object { + "body": Array [ Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "pair", + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "range": Array [ + 62, + 69, + ], + "type": "MemberExpression", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "console", + "range": Array [ + 50, + 57, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "log", + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + }, + "range": Array [ + 50, + 61, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 70, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 71, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "left": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "pair", + "range": Array [ + 84, + 88, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "range": Array [ + 84, + 91, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "operator": "=", + "range": Array [ + 84, + 102, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 94, + 102, + ], + "raw": "\\"hello!\\"", + "type": "Literal", + "value": "hello!", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 84, + 103, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 118, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 1, + "line": 4, }, "start": Object { - "column": 11, - "line": 6, + "column": 0, + "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "pair", + "range": Array [ + 13, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "operator": "readonly", + "range": Array [ + 19, + 44, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "TSStringKeyword", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 44, + ], + "type": "TSTupleType", + }, + }, + }, + }, + ], "range": Array [ - 95, - 96, + 0, + 118, ], - "type": "Numeric", - "value": "1", + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 119, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 7, + "column": 8, + "line": 1, }, "start": Object { - "column": 2, - "line": 7, + "column": 0, + "line": 1, }, }, "range": Array [ - 99, - 100, + 0, + 8, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 7, + "column": 12, + "line": 1, }, "start": Object { - "column": 3, - "line": 7, + "column": 9, + "line": 1, }, }, "range": Array [ - 100, - 101, + 9, + 12, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 8, + "column": 13, + "line": 1, }, "start": Object { - "column": 2, - "line": 8, + "column": 12, + "line": 1, }, }, "range": Array [ - 104, - 107, + 12, + 13, ], - "type": "Identifier", - "value": "get", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 17, + "line": 1, }, "start": Object { - "column": 6, - "line": 8, + "column": 13, + "line": 1, }, }, "range": Array [ - 108, - 109, + 13, + 17, ], "type": "Identifier", - "value": "a", + "value": "pair", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 8, + "column": 18, + "line": 1, }, "start": Object { - "column": 7, - "line": 8, + "column": 17, + "line": 1, }, }, "range": Array [ - 109, - 110, + 17, + 18, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 8, + "column": 27, + "line": 1, }, "start": Object { - "column": 8, - "line": 8, + "column": 19, + "line": 1, }, }, "range": Array [ - 110, - 111, + 19, + 27, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 29, + "line": 1, }, "start": Object { - "column": 9, - "line": 8, + "column": 28, + "line": 1, }, }, "range": Array [ - 111, - 112, + 28, + 29, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 8, + "column": 35, + "line": 1, }, "start": Object { - "column": 11, - "line": 8, + "column": 29, + "line": 1, }, }, "range": Array [ - 113, - 119, + 29, + 35, ], "type": "Identifier", - "value": "number", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 8, + "column": 36, + "line": 1, }, "start": Object { - "column": 18, - "line": 8, + "column": 35, + "line": 1, }, }, "range": Array [ - 120, - 121, + 35, + 36, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 9, + "column": 43, + "line": 1, }, "start": Object { - "column": 4, - "line": 9, + "column": 37, + "line": 1, }, }, "range": Array [ - 126, - 132, + 37, + 43, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 9, + "column": 44, + "line": 1, }, "start": Object { - "column": 11, - "line": 9, + "column": 43, + "line": 1, }, }, "range": Array [ - 133, - 134, + 43, + 44, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 10, + "column": 45, + "line": 1, }, "start": Object { - "column": 2, - "line": 10, + "column": 44, + "line": 1, }, }, "range": Array [ - 137, - 138, + 44, + 45, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 10, + "column": 47, + "line": 1, }, "start": Object { - "column": 3, - "line": 10, + "column": 46, + "line": 1, }, }, "range": Array [ - 138, - 139, + 46, + 47, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 11, + "column": 9, + "line": 2, }, "start": Object { "column": 2, - "line": 11, + "line": 2, }, }, "range": Array [ - 142, - 145, + 50, + 57, ], "type": "Identifier", - "value": "set", + "value": "console", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 11, + "column": 10, + "line": 2, }, "start": Object { - "column": 6, - "line": 11, + "column": 9, + "line": 2, }, }, "range": Array [ - 146, - 147, + 57, + 58, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 11, + "column": 13, + "line": 2, }, "start": Object { - "column": 7, - "line": 11, + "column": 10, + "line": 2, }, }, "range": Array [ - 147, - 148, + 58, + 61, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "log", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 11, + "column": 14, + "line": 2, }, "start": Object { - "column": 8, - "line": 11, + "column": 13, + "line": 2, }, }, "range": Array [ - 148, - 149, + 61, + 62, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 11, + "column": 18, + "line": 2, }, "start": Object { - "column": 9, - "line": 11, + "column": 14, + "line": 2, }, }, "range": Array [ - 149, - 150, + 62, + 66, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "pair", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 11, + "column": 19, + "line": 2, }, "start": Object { - "column": 11, - "line": 11, + "column": 18, + "line": 2, }, }, "range": Array [ - 151, - 157, + 66, + 67, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 11, + "column": 20, + "line": 2, }, "start": Object { - "column": 17, - "line": 11, + "column": 19, + "line": 2, }, }, "range": Array [ - 157, - 158, + 67, + 68, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "0", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 11, + "column": 21, + "line": 2, }, "start": Object { - "column": 18, - "line": 11, + "column": 20, + "line": 2, }, }, "range": Array [ - 158, - 159, + 68, + 69, ], "type": "Punctuator", - "value": ":", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 11, + "column": 22, + "line": 2, }, "start": Object { - "column": 20, - "line": 11, + "column": 21, + "line": 2, }, }, "range": Array [ - 160, - 166, + 69, + 70, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 11, + "column": 23, + "line": 2, }, "start": Object { - "column": 27, - "line": 11, + "column": 22, + "line": 2, }, }, "range": Array [ - 167, - 168, + 70, + 71, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 12, + "column": 6, + "line": 3, }, "start": Object { "column": 2, - "line": 12, + "line": 3, }, }, "range": Array [ - 171, - 172, + 84, + 88, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "pair", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 13, + "column": 7, + "line": 3, }, "start": Object { - "column": 0, - "line": 13, + "column": 6, + "line": 3, }, }, "range": Array [ - 173, - 174, + 88, + 89, ], "type": "Punctuator", - "value": "}", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 13, + "column": 8, + "line": 3, }, "start": Object { - "column": 1, - "line": 13, + "column": 7, + "line": 3, }, }, "range": Array [ - 174, - 175, + 89, + 90, ], - "type": "Punctuator", - "value": ";", + "type": "Numeric", + "value": "1", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/parenthesized-use-strict.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, - }, - }, - "range": Array [ - 46, - 58, - ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", - }, "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 9, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 45, - 60, + 90, + 91, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, + "type": "Punctuator", + "value": "]", }, - }, - "range": Array [ - 45, - 60, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 10, + "line": 3, }, }, "range": Array [ - 45, - 46, + 92, + 93, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 20, + "line": 3, }, "start": Object { - "column": 1, - "line": 2, + "column": 12, + "line": 3, }, }, "range": Array [ - 46, - 58, + 94, + 102, ], "type": "String", - "value": "\\"use strict\\"", + "value": "\\"hello!\\"", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 21, + "line": 3, }, "start": Object { - "column": 13, - "line": 2, + "column": 20, + "line": 3, }, }, "range": Array [ - 58, - 59, + 102, + 103, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 1, + "line": 4, }, "start": Object { - "column": 14, - "line": 2, + "column": 0, + "line": 4, }, }, "range": Array [ - 59, - 60, + 117, + 118, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", @@ -94896,6 +100386,7 @@ Object { 7, 14, ], + "transformFlags": 0, "type": "TSPrivateKeyword", }, Object { @@ -94913,6 +100404,7 @@ Object { 15, 21, ], + "transformFlags": 0, "type": "TSPublicKeyword", }, Object { @@ -94930,6 +100422,7 @@ Object { 22, 31, ], + "transformFlags": 0, "type": "TSProtectedKeyword", }, Object { @@ -94947,6 +100440,7 @@ Object { 32, 38, ], + "transformFlags": 0, "type": "TSStaticKeyword", }, Object { @@ -94964,6 +100458,7 @@ Object { 39, 47, ], + "transformFlags": 0, "type": "TSReadonlyKeyword", }, Object { @@ -94998,6 +100493,7 @@ Object { 57, 62, ], + "transformFlags": 0, "type": "TSAsyncKeyword", }, ], diff --git a/yarn.lock b/yarn.lock index 40864e48b49..d26da3f9306 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7052,10 +7052,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -"typescript@>=3.2.1 <3.4.0": - version "3.3.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3.tgz#f1657fc7daa27e1a8930758ace9ae8da31403221" - integrity sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A== +"typescript@>=3.2.1 <3.5.0": + version "3.4.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.1.tgz#b6691be11a881ffa9a05765a205cb7383f3b63c6" + integrity sha512-3NSMb2VzDQm8oBTLH6Nj55VVtUEpe/rgkIzMir0qVoLyjDZlnMBva0U6vDiV3IH+sl/Yu6oP5QwsAQtHPmDd2Q== uglify-js@^3.1.4: version "3.4.9" From ab3c1a1613a9b0a064d634822d7eff14bd94f5a5 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 2 Apr 2019 21:25:59 -0400 Subject: [PATCH 16/16] chore: publish v1.6.0 --- CHANGELOG.md | 16 ++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 4 ++++ packages/eslint-plugin-tslint/package.json | 4 ++-- packages/eslint-plugin/CHANGELOG.md | 14 ++++++++++++++ packages/eslint-plugin/package.json | 6 +++--- packages/parser/CHANGELOG.md | 10 ++++++++++ packages/parser/package.json | 6 +++--- packages/shared-fixtures/CHANGELOG.md | 11 +++++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 10 ++++++++++ packages/typescript-estree/package.json | 4 ++-- 12 files changed, 77 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2067d136e6..7eb1d41a284 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.5.0...v1.6.0) (2019-04-03) + +### Bug Fixes + +- **eslint-plugin:** explicit-function-return-type: ensure class arrow methods are validated ([#377](https://github.com/typescript-eslint/typescript-eslint/issues/377)) ([643a223](https://github.com/typescript-eslint/typescript-eslint/commit/643a223)), closes [#348](https://github.com/typescript-eslint/typescript-eslint/issues/348) +- **eslint-plugin:** Fix `allowExpressions` false positives in explicit-function-return-type and incorrect documentation ([#388](https://github.com/typescript-eslint/typescript-eslint/issues/388)) ([f29d1c9](https://github.com/typescript-eslint/typescript-eslint/commit/f29d1c9)), closes [#387](https://github.com/typescript-eslint/typescript-eslint/issues/387) +- **eslint-plugin:** member-naming false flagging constructors ([#376](https://github.com/typescript-eslint/typescript-eslint/issues/376)) ([ad0f2be](https://github.com/typescript-eslint/typescript-eslint/commit/ad0f2be)), closes [#359](https://github.com/typescript-eslint/typescript-eslint/issues/359) +- **eslint-plugin:** no-type-alias: fix typeof alias erroring ([#380](https://github.com/typescript-eslint/typescript-eslint/issues/380)) ([cebcfe6](https://github.com/typescript-eslint/typescript-eslint/commit/cebcfe6)) +- **parser:** Make eslint traverse enum id ([#383](https://github.com/typescript-eslint/typescript-eslint/issues/383)) ([492b737](https://github.com/typescript-eslint/typescript-eslint/commit/492b737)) +- **typescript-estree:** add ExportDefaultDeclaration to union DeclarationStatement ([#378](https://github.com/typescript-eslint/typescript-eslint/issues/378)) ([bf04398](https://github.com/typescript-eslint/typescript-eslint/commit/bf04398)) + +### Features + +- change TypeScript version range to >=3.2.1 <3.5.0 ([#399](https://github.com/typescript-eslint/typescript-eslint/issues/399)) ([a4f95d3](https://github.com/typescript-eslint/typescript-eslint/commit/a4f95d3)) +- **eslint-plugin:** allow explicit variable type with arrow functions ([#260](https://github.com/typescript-eslint/typescript-eslint/issues/260)) ([bea6b92](https://github.com/typescript-eslint/typescript-eslint/commit/bea6b92)), closes [#149](https://github.com/typescript-eslint/typescript-eslint/issues/149) + # [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) ### Bug Fixes diff --git a/lerna.json b/lerna.json index b4a4a814bd4..f7243f760b6 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.5.0", + "version": "1.6.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 0dfa48c6dcb..a932eb1dc8c 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.5.0...v1.6.0) (2019-04-03) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + # [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 744391c0224..c8279102b38 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "1.5.0", + "version": "1.6.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -35,6 +35,6 @@ "devDependencies": { "@types/eslint": "^4.16.3", "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "1.5.0" + "@typescript-eslint/parser": "1.6.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index fa1ee2e2d49..628a911c334 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,20 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.5.0...v1.6.0) (2019-04-03) + +### Bug Fixes + +- **eslint-plugin:** explicit-function-return-type: ensure class arrow methods are validated ([#377](https://github.com/typescript-eslint/typescript-eslint/issues/377)) ([643a223](https://github.com/typescript-eslint/typescript-eslint/commit/643a223)), closes [#348](https://github.com/typescript-eslint/typescript-eslint/issues/348) +- **eslint-plugin:** Fix `allowExpressions` false positives in explicit-function-return-type and incorrect documentation ([#388](https://github.com/typescript-eslint/typescript-eslint/issues/388)) ([f29d1c9](https://github.com/typescript-eslint/typescript-eslint/commit/f29d1c9)), closes [#387](https://github.com/typescript-eslint/typescript-eslint/issues/387) +- **eslint-plugin:** member-naming false flagging constructors ([#376](https://github.com/typescript-eslint/typescript-eslint/issues/376)) ([ad0f2be](https://github.com/typescript-eslint/typescript-eslint/commit/ad0f2be)), closes [#359](https://github.com/typescript-eslint/typescript-eslint/issues/359) +- **eslint-plugin:** no-type-alias: fix typeof alias erroring ([#380](https://github.com/typescript-eslint/typescript-eslint/issues/380)) ([cebcfe6](https://github.com/typescript-eslint/typescript-eslint/commit/cebcfe6)) + +### Features + +- change TypeScript version range to >=3.2.1 <3.5.0 ([#399](https://github.com/typescript-eslint/typescript-eslint/issues/399)) ([a4f95d3](https://github.com/typescript-eslint/typescript-eslint/commit/a4f95d3)) +- **eslint-plugin:** allow explicit variable type with arrow functions ([#260](https://github.com/typescript-eslint/typescript-eslint/issues/260)) ([bea6b92](https://github.com/typescript-eslint/typescript-eslint/commit/bea6b92)), closes [#149](https://github.com/typescript-eslint/typescript-eslint/issues/149) + # [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) ### Bug Fixes diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 7b96d677e1f..e350e5ab9e6 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "1.5.0", + "version": "1.6.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -35,8 +35,8 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/parser": "1.5.0", - "@typescript-eslint/typescript-estree": "1.5.0", + "@typescript-eslint/parser": "1.6.0", + "@typescript-eslint/typescript-estree": "1.6.0", "requireindex": "^1.2.0", "tsutils": "^3.7.0" }, diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index fa1e9998cc9..9c7424ad92e 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.5.0...v1.6.0) (2019-04-03) + +### Bug Fixes + +- **parser:** Make eslint traverse enum id ([#383](https://github.com/typescript-eslint/typescript-eslint/issues/383)) ([492b737](https://github.com/typescript-eslint/typescript-eslint/commit/492b737)) + +### Features + +- change TypeScript version range to >=3.2.1 <3.5.0 ([#399](https://github.com/typescript-eslint/typescript-eslint/issues/399)) ([a4f95d3](https://github.com/typescript-eslint/typescript-eslint/commit/a4f95d3)) + # [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index fd4313e33c0..b2fac500f33 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "1.5.0", + "version": "1.6.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "files": [ @@ -37,13 +37,13 @@ "typescript": "*" }, "dependencies": { - "@typescript-eslint/typescript-estree": "1.5.0", + "@typescript-eslint/typescript-estree": "1.6.0", "eslint-scope": "^4.0.0", "eslint-visitor-keys": "^1.0.0" }, "devDependencies": { "@types/eslint": "^4.16.5", "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/shared-fixtures": "1.5.0" + "@typescript-eslint/shared-fixtures": "1.6.0" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 0643583ced5..93be6b44971 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.5.0...v1.6.0) (2019-04-03) + + +### Features + +* change TypeScript version range to >=3.2.1 <3.5.0 ([#399](https://github.com/typescript-eslint/typescript-eslint/issues/399)) ([a4f95d3](https://github.com/typescript-eslint/typescript-eslint/commit/a4f95d3)) + + + + + # [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index f6df565d711..049c984ba45 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "1.5.0", + "version": "1.6.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 4195b359e3d..45dd075c5ff 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.5.0...v1.6.0) (2019-04-03) + +### Bug Fixes + +- **typescript-estree:** add ExportDefaultDeclaration to union DeclarationStatement ([#378](https://github.com/typescript-eslint/typescript-eslint/issues/378)) ([bf04398](https://github.com/typescript-eslint/typescript-eslint/commit/bf04398)) + +### Features + +- change TypeScript version range to >=3.2.1 <3.5.0 ([#399](https://github.com/typescript-eslint/typescript-eslint/issues/399)) ([a4f95d3](https://github.com/typescript-eslint/typescript-eslint/commit/a4f95d3)) + # [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) ### Bug Fixes diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 69a07ac4f19..10bc1779c11 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "1.5.0", + "version": "1.6.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -44,6 +44,6 @@ }, "devDependencies": { "@babel/types": "^7.3.2", - "@typescript-eslint/shared-fixtures": "1.5.0" + "@typescript-eslint/shared-fixtures": "1.6.0" } }