diff --git a/.eslintrc.json b/.eslintrc.json index e3abc256901a..818b90dfab53 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -25,7 +25,8 @@ "sourceType": "module", "ecmaFeatures": { "jsx": false - } + }, + "project": "./tsconfig.base.json" }, "overrides": [ { diff --git a/.github/PULL_REQUEST_TEMPLATE/standard.md b/.github/PULL_REQUEST_TEMPLATE/standard.md new file mode 100644 index 000000000000..fb7952bc7689 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/standard.md @@ -0,0 +1,9 @@ +--- +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 new file mode 100644 index 000000000000..d51581780f2e --- /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 feature tests added: + - ... diff --git a/CHANGELOG.md b/CHANGELOG.md index fb91349b8106..7eb1d41a2848 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,41 @@ 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 + +- **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 + +- trigger new release ([eaaa471](https://github.com/typescript-eslint/typescript-eslint/commit/eaaa471)) + ## [1.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.0...v1.4.1) (2019-02-23) ### Bug Fixes diff --git a/README.md b/README.md index ab38f5e7a59f..0aef0f23d0b1 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,6 @@ If you use a non-supported version of TypeScript, the parser will log a warning **Please ensure that you are using a supported version before submitting any issues/bug reports.** -## Contributing - -COMING SOON! - ## License TypeScript ESLint inherits from the the original TypeScript ESLint Parser license, as the majority of the work began there. It is licensed under a permissive BSD 2-clause license. @@ -63,3 +59,7 @@ TypeScript ESLint inherits from the the original TypeScript ESLint Parser licens ## Contributors Thanks goes to the wonderful people listed in [`CONTRIBUTORS.md`](./CONTRIBUTORS.md). + +## Contributing Guide + +COMING SOON! diff --git a/lerna.json b/lerna.json index bbbc1c975b82..f7243f760b61 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.4.1", + "version": "1.6.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/package.json b/package.json index 4e2eff52b004..87f47a22a52c 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "glob": "7.1.2", "husky": "^1.3.1", "isomorphic-fetch": "^2.2.1", - "jest": "24.1.0", + "jest": "24.3.0", "lerna": "^3.10.5", "lint-staged": "8.1.0", "lodash.isplainobject": "4.0.6", @@ -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-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 0e51b5ccf752..a932eb1dc8c6 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/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.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 + +## [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 + ## [1.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.0...v1.4.1) (2019-02-23) **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 c412989d549c..c8279102b38d 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.1", + "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.4.1" + "@typescript-eslint/parser": "1.6.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 8bbf10f4a2b8..628a911c3343 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,36 @@ 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 + +- **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 + ## [1.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.0...v1.4.1) (2019-02-23) ### Bug Fixes diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 74c335ba9c89..3451e063ab66 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -105,53 +105,54 @@ 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/boolean-literal-compare`](./docs/rules/boolean-literal-compare.md) | Flags unnecessary equality comparisons against booleans (`no-boolean-literal-compare` 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/boolean-literal-compare`](./docs/rules/boolean-literal-compare.md) | Flags unnecessary equality comparisons against booleans (`no-boolean-literal-compare` from TSLint) | :heavy_check_mark: | | :thought_balloon: | +| [`@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/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) | | | | diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index 119c3d09c7e7..ae6b1f5d095a 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/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index fb8ad9a7ffc8..b6f37038aba1 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 @@ -84,6 +86,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/docs/rules/member-naming.md b/packages/eslint-plugin/docs/rules/member-naming.md index 04c9e882c102..0d66a9f466c8 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/docs/rules/member-ordering.md b/packages/eslint-plugin/docs/rules/member-ordering.md index a0b8f8983565..50c4a7eacd33 100644 --- a/packages/eslint-plugin/docs/rules/member-ordering.md +++ b/packages/eslint-plugin/docs/rules/member-ordering.md @@ -5,591 +5,638 @@ expressions easier to read, navigate and edit. ## Rule Details -This rule aims to standardise the way interfaces, type literals, classes and class expressions are structured. +This rule aims to standardize the way class declarations, class expressions, interfaces and type literals are structured. -## Options +It allows to group members by their type (e.g. `public-static-field`, `protected-static-field`, `private-static-field`, `public-instance-field`, ...). By default, their order is the same inside `classes`, `classExpressions`, `interfaces` and `typeLiterals` (note: not all member types apply to `interfaces` and `typeLiterals`). It is possible to define the order for any of those individually or to change the default order for all of them by setting the `default` option. -This rule, in its default state, does not require any argument, in which case the following order is enforced: - -- `public-static-field` -- `protected-static-field` -- `private-static-field` -- `public-instance-field` -- `protected-instance-field` -- `private-instance-field` -- `public-field` (ignores scope) -- `protected-field` (ignores scope) -- `private-field` (ignores scope) -- `static-field` (ignores accessibility) -- `instance-field` (ignores accessibility) -- `field` (ignores scope and/or accessibility) -- `constructor` (ignores scope and/or accessibility) -- `public-static-method` -- `protected-static-method` -- `private-static-method` -- `public-instance-method` -- `protected-instance-method` -- `private-instance-method` -- `public-method` (ignores scope) -- `protected-method` (ignores scope) -- `private-method` (ignores scope) -- `static-method` (ignores accessibility) -- `instance-method` (ignores accessibility) -- `method` (ignores scope and/or accessibility) - -The rule can also take one or more of the following options: - -- `default`, use this to change the default order (used when no specific configuration has been provided). -- `classes`, use this to change the order in classes. -- `classExpressions`, use this to change the order in class expressions. -- `interfaces`, use this to change the order in interfaces. -- `typeLiterals`, use this to change the order in type literals. - -### default - -Disable using `never` or use one of the following values to specify an order: - -- Fields: - `public-static-field` - `protected-static-field` - `private-static-field` - `public-instance-field` - `protected-instance-field` - `private-instance-field` - `public-field` (= public-_-field) - `protected-field` (= protected-_-field) - `private-field` (= private-_-field) - `static-field` (= _-static-field) - `instance-field` (= \*-instance-field) - `field` (= all) - -- Constructors: - `public-constructor` - `protected-constructor` - `private-constructor` - `constructor` (= \*-constructor) - -- Methods: - `public-static-method` - `protected-static-method` - `private-static-method` - `public-instance-method` - `protected-instance-method` - `private-instance-method` - `public-method` (= public-_-method) - `protected-method` (= protected-_-method) - `private-method` (= private-_-method) - `static-method` (= _-static-method) - `instance-method` (= \*-instance-method) - `method` (= all) - -Examples of **incorrect** code for the `{ "default": [...] }` option: +## Options ```ts -// { "default": ["method", "constructor", "field"] } +{ + default?: Array | never + classes?: Array | never + classExpressions?: Array | never + + interfaces?: ['field' | 'method' | 'constructor'] | never + typeLiterals?: ['field' | 'method' | 'constructor'] | never +} +``` + +See below for the possible definitions of `MemberType`. + +### Member types (granular form) + +There are multiple ways to specify the member types. The most explicit and granular form is the following: + +```json5 +[ + // Fields + 'public-static-field', + 'protected-static-field', + 'private-static-field', + 'public-instance-field', + 'protected-instance-field', + 'private-instance-field', + + // Constructors + 'public-constructor', + 'protected-constructor', + 'private-constructor', + + // Methods + 'public-static-method', + 'protected-static-method', + 'private-static-method', + 'public-instance-method', + 'protected-instance-method', + 'private-instance-method', +] +``` + +Note: If you only specify some of the possible types, the non-specified ones can have any particular order. This means that they can be placed before, within or after the specified types and the linter won't complain about it. + +### Member group types (with accessibility, ignoring scope) + +It is also possible to group member types by their accessibility (`static`, `instance`), ignoring their scope. + +```json5 +[ + // Fields + 'public-field', // = ['public-static-field', 'public-instance-field']) + 'protected-field', // = ['protected-static-field', 'protected-instance-field']) + 'private-field', // = ['private-static-field', 'private-instance-field']) + + // Constructors + // Only the accessibility of constructors is configurable. See below. + + // Methods + 'public-method', // = ['public-static-method', 'public-instance-method']) + 'protected-method', // = ['protected-static-method', 'protected-instance-method']) + 'private-method', // = ['private-static-method', 'private-instance-method']) +] +``` + +### Member group types (with scope, ignoring accessibility) + +Another option is to group the member types by their scope (`public`, `protected`, `private`), ignoring their accessibility. + +```json5 +[ + // Fields + 'static-field', // = ['public-static-field', 'protected-static-field', 'private-static-field']) + 'instance-field', // = ['public-instance-field', 'protected-instance-field', 'private-instance-field']) + + // Constructors + 'constructor', // = ['public-constructor', 'protected-constructor', 'private-constructor']) + + // Methods + 'static-method', // = ['public-static-method', 'protected-static-method', 'private-static-method']) + 'instance-method', // = ['public-instance-method', 'protected-instance-method', 'private-instance-method'] +] +``` + +### Member group types (with scope and accessibility) + +The third grouping option is to ignore both scope and accessibility. + +```json5 +[ + // Fields + 'field', // = ['public-static-field', 'protected-static-field', 'private-static-field', 'public-instance-field', 'protected-instance-field', 'private-instance-field']) + + // Constructors + // Only the accessibility of constructors is configurable. See above. + + // Methods + 'method', // = ['public-static-method', 'protected-static-method', 'private-static-method', 'public-instance-method', 'protected-instance-method', 'private-instance-method']) +] +``` + +### Default configuration + +The default configuration looks as follows: + +```json +{ + "default": [ + "public-static-field", + "protected-static-field", + "private-static-field", + + "public-instance-field", + "protected-instance-field", + "private-instance-field", + + "public-field", + "protected-field", + "private-field", + + "static-field", + "instance-field", + + "field", + + "constructor", + + "public-static-method", + "protected-static-method", + "private-static-method", + + "public-instance-method", + "protected-instance-method", + "private-instance-method", + + "public-method", + "protected-method", + "private-method", + + "static-method", + "instance-method", + + "method" + ] +} +``` + +Note: The default configuration contains member group types which contain other member types (see above). This is intentional to provide better error messages. + +## Examples + +### Custom `default` configuration + +Note: The `default` options are overwritten in these examples. +#### Configuration: `{ "default": ["method", "constructor", "field"] }` + +##### Incorrect examples + +```ts interface Foo { - // -> field - B: string; + B: string; // -> field - // -> constructor - new (); + new (); // -> constructor - // -> method - A(): void; + A(): void; // -> method } +``` + +Note: Wrong order. +```ts type Foo = { - // -> field - B: string; + B: string; // -> field // no constructor - // -> method - A(): void; + A(): void; // -> method }; +``` + +Note: Not all specified member types have to exist. +```ts class Foo { - // -> * field - private C: string; - public D: string; - protected static E: string; + private C: string; // -> field + public D: string; // -> field + protected static E: string; // -> field - // -> constructor - constructor() {} + constructor() {} // -> constructor - // -> * method - public static A(): void {} - public B(): void {} + public static A(): void {} // -> method + public B(): void {} // -> method } +``` +Note: Accessibility or scope are ignored with this ignored. + +```ts const Foo = class { - // -> * field - private C: string; - public D: string; + private C: string; // -> field + public D: string; // -> field - // -> constructor - constructor() {} + constructor() {} // -> constructor - // -> * method - public static A(): void {} - public B(): void {} + public static A(): void {} // -> method + public B(): void {} // -> method - // * field - protected static E: string; + protected static E: string; // -> field }; +``` -// { "default": ["public-instance-method", "public-static-field"] } +Note: Not all members have to be grouped to find rule violations. -// does not apply for interfaces/type literals (accessibility and scope are not part of interfaces/type literals) +##### Correct examples -class Foo { - // private instance field - private C: string; +```ts +interface Foo { + A(): void; // -> method - // public instance field - public D: string; + new (); // -> constructor - // -> public static field - public static E: string; + B: string; // -> field +} +``` - // constructor - constructor() {} +```ts +type Foo = { + A(): void; // -> method - // public static method - public static A(): void {} + // no constructor - // -> public instance method - public B(): void {} -} + B: string; // -> field +}; +``` -const Foo = class { - // private instance field - private C: string; +```ts +class Foo { + public static A(): void {} // -> method + public B(): void {} // -> method - // -> public static field - public static E: string; + constructor() {} // -> constructor - // public instance field - public D: string; + private C: string; // -> field + public D: string; // -> field + protected static E: string; // -> field +} +``` - // constructor - constructor() {} +```ts +const Foo = class { + public static A(): void {} // -> method + public B(): void {} // -> method - // public static method - public static A(): void {} + constructor() {} // -> constructor - // -> public instance method - public B(): void {} + private C: string; // -> field + public D: string; // -> field + protected static E: string; // -> field }; ``` -Examples of **correct** code for the `{ "default": [...] }` option: +#### Configuration: `{ "default": ["public-instance-method", "public-static-field"] }` + +Note: This configuration does not apply to interfaces/type literals as accessibility and scope are not part of interfaces/type literals. + +##### Incorrect examples ```ts -// { "default": ["method", "constructor", "field"] } +class Foo { + private C: string; // (irrelevant) -interface Foo { - // -> method - A() : void; + public D: string; // (irrelevant) - // -> constructor - new(); + public static E: string; // -> public static field - // -> field - B: string; -} + constructor() {} // (irrelevant) -type Foo = { - // -> method - A() : void; + public static A(): void {} // (irrelevant) - // -> field - B: string; + public B(): void {} // -> public instance method } +``` -class Foo { - // -> * method - public static A(): void {} - public B(): void {} +Note: Public instance methods should come first before public static fields. Everything else can be placed anywhere. + +```ts +const Foo = class { + private C: string; // (irrelevant) - // -> constructor - constructor() {} + public static E: string; // -> public static field - // -> * field - private C: string - public D: string - protected static E: string -} + public D: string; // (irrelevant) -const Foo = class { - // -> * method - public static A(): void {} - public B(): void {} + constructor() {} // (irrelevant) - // -> constructor - constructor() {} + public static A(): void {} // (irrelevant) - // -> * field - private C: string - public D: string - protected static E: string -} + public B(): void {} // -> public instance method +}; +``` -// { "default": ["public-instance-method", "public-static-field"] } +Note: Public instance methods should come first before public static fields. Everything else can be placed anywhere. -// does not apply for interfaces/type literals (accessibility and scope are not part of interfaces/type literals) +##### Correct examples +```ts class Foo { - // -> public instance method - public B(): void {} + public B(): void {} // -> public instance method - // private instance field - private C: string + private C: string; // (irrelevant) - // public instance field - public D: string + public D: string; // (irrelevant) - // -> public static field - public static E: string + public static E: string; // -> public static field - // constructor - constructor() {} + constructor() {} // (irrelevant) - // public static method - public static A(): void {} + public static A(): void {} // (irrelevant) } +``` +```ts const Foo = class { - // -> public instance method - public B(): void {} + public B(): void {} // -> public instance method - // private instance field - private C: string + private C: string; // (irrelevant) - // public instance field - public D: string + public D: string; // (irrelevant) - // constructor - constructor() {} + constructor() {} // (irrelevant) - // public static method - public static A(): void {} + public static A(): void {} // (irrelevant) - // -> protected static field - protected static: string -} + public static E: string; // -> public static field +}; +``` -// { "default": ["public-static-field", "static-field", "instance-field"] } +#### Configuration: `{ "default": ["public-static-field", "static-field", "instance-field"] }` -// does not apply for interfaces/type literals (accessibility and scope are not part of interfaces/type literals) +Note: This configuration does not apply to interfaces/type literals as accessibility and scope are not part of interfaces/type literals. +##### Incorrect examples + +```ts class Foo { - // -> public static field - public static A: string; + private E: string; // -> instance field - // -> * static field - private static B: string; - protected statis C:string; - private static D: string; + private static B: string; // -> static field + protected static C: string; // -> static field + private static D: string; // -> static field - // -> * instance field - private E: string; + public static A: string; // -> public static field } +``` + +Note: Public static fields should come first, followed by static fields and instance fields. +```ts const foo = class { - // * method - public T(): void {} + public T(): void {} // (irrelevant) - // -> public static field - public static A: string; + private static B: string; // -> static field - // constructor - constructor(){} + constructor() {} // (irrelevant) - // -> * static field - private static B: string; - protected statis C:string; - private static D: string; + private E: string; // -> instance field - // -> * instance field - private E: string; -} + protected static C: string; // -> static field + private static D: string; // -> static field + + public static A: string; // -> public static field +}; ``` -### classes +Issue: Public static fields should come first, followed by static fields and instance fields. + +##### Correct examples + +```ts +class Foo { + public static A: string; // -> public static field -Disable using `never` or use one of the valid values (see default) to specify an order. + private static B: string; // -> static field + protected static C: string; // -> static field + private static D: string; // -> static field -Examples of **incorrect** code for the `{ "classes": [...] }` option: + private E: string; // -> instance field +} +``` ```ts -// { "classes": ["method", "constructor", "field"] } +const foo = class { + public static A: string; // -> public static field -// does not apply for interfaces/type literals/class expressions. + constructor() {} // -> constructor -class Foo { - // -> field - private C: string; - public D: string; - protected static E: string; + private static B: string; // -> static field + protected static C: string; // -> static field + private static D: string; // -> static field - // -> constructor - constructor() {} + private E: string; // -> instance field - // -> method - public static A(): void {} - public B(): void {} -} + public T(): void {} // -> method +}; +``` -// { "classes": ["public-instance-method", "public-static-field"] } +### Custom `classes` configuration -// does not apply for interfaces/type literals/class expressions. +Note: If this is not set, the `default` will automatically be applied to classes as well. If a `classes` configuration is provided, only this configuration will be used for `classes` (i.e. nothing will be merged with `default`). -class Foo { - // private instance field - private C: string; +Note: The configuration for `classes` does not apply to class expressions (use `classExpressions` for them). - // public instance field - public D: string; +#### Configuration: `{ "classes": ["method", "constructor", "field"] }` - // -> public static field - public static E: string; +##### Incorrect example - // constructor - constructor() {} +```ts +class Foo { + private C: string; // -> field + public D: string; // -> field + protected static E: string; // -> field - // public static method - public static A(): void {} + constructor() {} // -> constructor - // -> public instance method - public B(): void {} + public static A(): void {} // -> method + public B(): void {} // -> method } ``` -Examples of **correct** code for `{ "classes": [...] }` option: +##### Correct example ```ts -// { "classes": ["method", "constructor", "field"] } - -// does not apply for interfaces/type literals/class expressions. - class Foo { - // -> * method - public static A(): void {} - public B(): void {} + public static A(): void {} // -> method + public B(): void {} // -> method - // -> constructor - constructor() {} + constructor() {} // -> constructor - // -> * field - private C: string; - public D: string; - protected static E: string; + private C: string; // -> field + public D: string; // -> field + protected static E: string; // -> field } +``` -// { "classes": ["public-instance-method", "public-static-field"] } +#### Configuration: `{ "classes": ["public-instance-method", "public-static-field"] }` -// does not apply for interfaces/type literals/class expressions. +##### Incorrect example +```ts class Foo { - // private instance field - private C: string; + private C: string; // (irrelevant) - // public instance field - public D: string; + public D: string; // (irrelevant) - // -> public static field - public static E: string; + public static E: string; // -> public static field - // constructor - constructor() {} + constructor() {} // (irrelevant) - // public static method - public static A(): void {} + public static A(): void {} // (irrelevant) - // -> public instance method - public B(): void {} + public B(): void {} // -> public instance method } ``` -### classExpressions +##### Correct example -Disable using `never` or use one of the valid values (see default) to specify an order. - -Examples of **incorrect** code for the `{ "classExpressions": [...] }` option: +Examples of **correct** code for `{ "classes": [...] }` option: ```ts -// { "classExpressions": ["method", "constructor", "field"] } +class Foo { + private C: string; // (irrelevant) -// does not apply for interfaces/type literals/class expressions. + public D: string; // (irrelevant) -const foo = class { - // -> field - private C: string; - public D: string; - protected static E: string; + public static E: string; // -> public static field - // -> constructor - constructor() {} + constructor() {} // (irrelevant) - // -> method - public static A(): void {} - public B(): void {} -}; + public static A(): void {} // (irrelevant) -// { "classExpressions": ["public-instance-method", "public-static-field"] } + public B(): void {} // -> public instance method +} +``` -// does not apply for interfaces/type literals/class expressions. +### Custom `classExpressions` configuration -const foo = class { - // private instance field - private C: string; +Note: If this is not set, the `default` will automatically be applied to classes expressions as well. If a `classExpressions` configuration is provided, only this configuration will be used for `classExpressions` (i.e. nothing will be merged with `default`). - // public instance field - public D: string; +Note: The configuration for `classExpressions` does not apply to classes (use `classes` for them). - // -> public static field - public static E: string; +#### Configuration: `{ "classExpressions": ["method", "constructor", "field"] }` - // constructor - constructor() {} +##### Incorrect example + +```ts +const foo = class { + private C: string; // -> field + public D: string; // -> field + protected static E: string; // -> field - // public static method - public static A(): void {} + constructor() {} // -> constructor - // -> public instance method - public B(): void {} + public static A(): void {} // -> method + public B(): void {} // -> method }; ``` -Examples of **correct** code for `{ "classExpressions": [...] }` option: +##### Correct example ```ts -// { "classExpressions": ["method", "constructor", "field"] } +const foo = class { + public static A(): void {} // -> method + public B(): void {} // -> method + + constructor() {} // -> constructor + + private C: string; // -> field + public D: string; // -> field + protected static E: string; // -> field +}; +``` + +#### Configuration: `{ "classExpressions": ["public-instance-method", "public-static-field"] }` -// does not apply for interfaces/type literals/class expressions. +##### Incorrect example +```ts const foo = class { - // -> * method - public static A(): void {} - public B(): void {} + private C: string; // (irrelevant) - // -> constructor - constructor() {} + public D: string; // (irrelevant) - // -> * field - private C: string; - public D: string; - protected static E: string; -}; + public static E: string; // -> public static field + + constructor() {} // (irrelevant) -// { "classExpressions": ["public-instance-method", "public-static-field"] } + public static A(): void {} // (irrelevant) -// does not apply for interfaces/type literals/class expressions. + public B(): void {} // -> public instance method +}; +``` + +##### Correct example +```ts const foo = class { - // private instance field - private C: string; + private C: string; // (irrelevant) - // public instance field - public D: string; + public D: string; // (irrelevant) - // -> public static field - public static E: string; + public B(): void {} // -> public instance method - // constructor - constructor() {} + public static E: string; // -> public static field - // public static method - public static A(): void {} + constructor() {} // (irrelevant) - // -> public instance method - public B(): void {} + public static A(): void {} // (irrelevant) }; ``` -### interfaces +### Custom `interfaces` configuration -Disable using `never` or use one of the following values to specify an order: -`field` -`constructor` -`method` +Note: If this is not set, the `default` will automatically be applied to classes expressions as well. If a `interfaces` configuration is provided, only this configuration will be used for `interfaces` (i.e. nothing will be merged with `default`). -Examples of **incorrect** code for the `{ "interfaces": [...] }` option: +Note: The configuration for `interfaces` only allows a limited set of member types: `field`, `constructor` and `method`. -```ts -// { "interfaces": ["method", "constructor", "field"] } +Note: The configuration for `interfaces` does not apply to type literals (use `typeLiterals` for them). -// does not apply for classes/class expressions/type literals +#### Configuration: `{ "interfaces": ["method", "constructor", "field"] }` +##### Incorrect example + +```ts interface Foo { - // -> field - B: string; + B: string; // -> field - // -> constructor - new (); + new (); // -> constructor - // -> method - A(): void; + A(): void; // -> method } ``` -Examples of **correct** code for the `{ "interfaces": [...] }` option: +##### Correct example ```ts -// { "interfaces": ["method", "constructor", "field"] } - -// does not apply for classes/class expressions/type literals - interface Foo { - // -> method - A(): void; + A(): void; // -> method - // -> constructor - new (); + new (); // -> constructor - // -> field - B: string; + B: string; // -> field } ``` -### typeLiterals +### Custom `typeLiterals` configuration -Disable using `never` or use one of the valid values (see interfaces) to specify an order. +Note: If this is not set, the `default` will automatically be applied to classes expressions as well. If a `typeLiterals` configuration is provided, only this configuration will be used for `typeLiterals` (i.e. nothing will be merged with `default`). -Examples of **incorrect** code for the `{ "typeLiterals": [...] }` option: +Note: The configuration for `typeLiterals` only allows a limited set of member types: `field`, `constructor` and `method`. -```ts -// { "typeLiterals": ["method", "constructor", "field"] } +Note: The configuration for `typeLiterals` does not apply to type literals (use `interfaces` for them). -// does not apply for classes/class expressions/interfaces +#### Configuration: `{ "typeLiterals": ["method", "constructor", "field"] }` +##### Incorrect example + +```ts type Foo = { - // -> field - B: string; + B: string; // -> field + + A(): void; // -> method - // -> method - A(): void; + new (); // -> constructor }; ``` -Examples of **correct** code for the `{ "typeLiterals": [...] }` option: +##### Correct example ```ts -// { "typeLiterals": ["method", "constructor", "field"] } - -// does not apply for classes/class expressions/interfaces - type Foo = { - // -> method - A(): void; + A(): void; // -> method - // -> constructor - new (); + new (); // -> constructor - // -> field - B: string; + B: string; // -> field }; ``` diff --git a/packages/eslint-plugin/docs/rules/no-useless-constructor.md b/packages/eslint-plugin/docs/rules/no-useless-constructor.md index 0e136d122ac1..821f6a5d1052 100644 --- a/packages/eslint-plugin/docs/rules/no-useless-constructor.md +++ b/packages/eslint-plugin/docs/rules/no-useless-constructor.md @@ -23,7 +23,7 @@ This rule flags class constructors that can be safely removed without changing h Examples of **incorrect** code for this rule: ```js -/*eslint no-useless-constructor: "error"*/ +/*eslint @typescript-eslint/no-useless-constructor: "error"*/ class A { constructor() {} @@ -39,7 +39,7 @@ class A extends B { Examples of **correct** code for this rule: ```js -/*eslint no-useless-constructor: "error"*/ +/*eslint @typescript-eslint/no-useless-constructor: "error"*/ class A {} 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 000000000000..7fe46beceafc --- /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/package.json b/packages/eslint-plugin/package.json index ca82d78f6fbe..e350e5ab9e6a 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.1", + "version": "1.6.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -35,8 +35,8 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/parser": "1.4.1", - "@typescript-eslint/typescript-estree": "1.4.1", + "@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/eslint-plugin/src/rules/adjacent-overload-signatures.ts b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts index 7007b1c3bdf0..8e864c9c4a2a 100644 --- a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts +++ b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts @@ -26,6 +26,8 @@ export default util.createRule({ }, defaultOptions: [], create(context) { + const sourceCode = context.getSourceCode(); + /** * Gets the name of the member being processed. * @param member the member being processed. @@ -57,7 +59,7 @@ export default util.createRule({ case AST_NODE_TYPES.TSConstructSignatureDeclaration: return 'new'; case AST_NODE_TYPES.MethodDefinition: - return util.getNameFromPropertyName(member.key); + return util.getNameFromClassMember(member, sourceCode); } return null; diff --git a/packages/eslint-plugin/src/rules/camelcase.ts b/packages/eslint-plugin/src/rules/camelcase.ts index 009ba186aa16..ec7ba9ea4fe2 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/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index e4f5dd46a3c5..0d9f9304d2a4 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, }, @@ -35,28 +39,42 @@ export default util.createRule({ }, defaultOptions: [ { - allowExpressions: true, + allowExpressions: false, + 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 ); } @@ -70,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 && @@ -95,10 +123,9 @@ export default util.createRule({ | TSESTree.FunctionExpression, ): void { if ( - options.allowExpressions && + options.allowTypedFunctionExpressions && node.parent && - node.parent.type !== AST_NODE_TYPES.VariableDeclarator && - node.parent.type !== AST_NODE_TYPES.MethodDefinition + isVariableDeclaratorWithTypeAnnotation(node.parent) ) { return; } diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index afae022c2627..66029faa5018 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -20,6 +20,7 @@ export default util.createRule({ }, defaultOptions: [], create(context) { + const sourceCode = context.getSourceCode(); /** * Checks if a method declaration has an accessibility modifier. * @param methodDefinition The node representing a MethodDefinition. @@ -36,7 +37,7 @@ export default util.createRule({ messageId: 'missingAccessibility', data: { type: 'method definition', - name: util.getNameFromPropertyName(methodDefinition.key), + name: util.getNameFromClassMember(methodDefinition, sourceCode), }, }); } diff --git a/packages/eslint-plugin/src/rules/interface-name-prefix.ts b/packages/eslint-plugin/src/rules/interface-name-prefix.ts index 175cbf41c3bb..b9c3b91a052e 100644 --- a/packages/eslint-plugin/src/rules/interface-name-prefix.ts +++ b/packages/eslint-plugin/src/rules/interface-name-prefix.ts @@ -1,7 +1,7 @@ import * as util from '../util'; type Options = ['never' | 'always']; -type MessageIds = 'noPrefix'; +type MessageIds = 'noPrefix' | 'alwaysPrefix'; export default util.createRule({ name: 'interface-name-prefix', @@ -15,6 +15,7 @@ export default util.createRule({ }, messages: { noPrefix: 'Interface name must not be prefixed with "I".', + alwaysPrefix: 'Interface name must be prefixed with "I".', }, schema: [ { @@ -51,7 +52,7 @@ export default util.createRule({ if (!isPrefixedWithI(node.id.name)) { context.report({ node: node.id, - messageId: 'noPrefix', + messageId: 'alwaysPrefix', }); } } diff --git a/packages/eslint-plugin/src/rules/member-naming.ts b/packages/eslint-plugin/src/rules/member-naming.ts index 23c14c8b39c5..1e6fcdd226e0 100644 --- a/packages/eslint-plugin/src/rules/member-naming.ts +++ b/packages/eslint-plugin/src/rules/member-naming.ts @@ -51,6 +51,8 @@ export default util.createRule({ }, defaultOptions: [{}], create(context, [config]) { + const sourceCode = context.getSourceCode(); + const conventions = (Object.keys(config) as Modifiers[]).reduce< Config >((acc, accessibility) => { @@ -69,10 +71,13 @@ export default util.createRule({ function validateName( node: TSESTree.MethodDefinition | TSESTree.ClassProperty, ): void { - const name = util.getNameFromPropertyName(node.key); + const name = util.getNameFromClassMember(node, sourceCode); 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/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index dff4752bab45..6811cf5a2e42 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -13,23 +13,26 @@ type Options = [ } ]; -const schemaOptions = ['field', 'method', 'constructor'].reduce( - (options, type) => { - options.push(type); +const allMemberTypes = ['field', 'method', 'constructor'].reduce( + (all, type) => { + all.push(type); ['public', 'protected', 'private'].forEach(accessibility => { - options.push(`${accessibility}-${type}`); + all.push(`${accessibility}-${type}`); // e.g. `public-field` + if (type !== 'constructor') { + // There is no `static-constructor` or `instance-constructor ['static', 'instance'].forEach(scope => { - if (options.indexOf(`${scope}-${type}`) === -1) { - options.push(`${scope}-${type}`); + if (all.indexOf(`${scope}-${type}`) === -1) { + all.push(`${scope}-${type}`); } - options.push(`${accessibility}-${scope}-${type}`); + + all.push(`${accessibility}-${scope}-${type}`); }); } }); - return options; + return all; }, [], ); @@ -60,7 +63,7 @@ export default util.createRule({ { type: 'array', items: { - enum: schemaOptions, + enum: allMemberTypes, }, }, ], @@ -73,7 +76,7 @@ export default util.createRule({ { type: 'array', items: { - enum: schemaOptions, + enum: allMemberTypes, }, }, ], @@ -86,7 +89,7 @@ export default util.createRule({ { type: 'array', items: { - enum: schemaOptions, + enum: allMemberTypes, }, }, ], @@ -164,6 +167,8 @@ export default util.createRule({ }, ], create(context, [options]) { + const sourceCode = context.getSourceCode(); + const functionExpressions = [ AST_NODE_TYPES.FunctionExpression, AST_NODE_TYPES.ArrowFunctionExpression, @@ -213,7 +218,7 @@ export default util.createRule({ case AST_NODE_TYPES.MethodDefinition: return node.kind === 'constructor' ? 'constructor' - : util.getNameFromPropertyName(node.key); + : util.getNameFromClassMember(node, sourceCode); case AST_NODE_TYPES.TSConstructSignatureDeclaration: return 'new'; default: @@ -228,12 +233,14 @@ export default util.createRule({ * - If there is no order for accessibility-scope-type, then strip out the accessibility. * - If there is no order for scope-type, then strip out the scope. * - If there is no order for type, then return -1 - * @param names the valid names to be validated. + * @param memberTypes the valid names to be validated. * @param order the current order to be validated. + * + * @return Index of the matching member type in the order configuration. */ - function getRankOrder(names: string[], order: string[]): number { + function getRankOrder(memberTypes: string[], order: string[]): number { let rank = -1; - const stack = names.slice(); + const stack = memberTypes.slice(); // Get a copy of the member types while (stack.length > 0 && rank === -1) { rank = order.indexOf(stack.shift()!); @@ -246,7 +253,7 @@ export default util.createRule({ * Gets the rank of the node given the order. * @param node the node to be evaluated. * @param order the current order to be validated. - * @param supportsModifiers a flag indicating whether the type supports modifiers or not. + * @param supportsModifiers a flag indicating whether the type supports modifiers (scope or accessibility) or not. */ function getRank( node: TSESTree.ClassElement | TSESTree.TypeElement, @@ -265,19 +272,21 @@ export default util.createRule({ ? node.accessibility : 'public'; - const names = []; + const memberTypes = []; if (supportsModifiers) { if (type !== 'constructor') { - names.push(`${accessibility}-${scope}-${type}`); - names.push(`${scope}-${type}`); + // Constructors have no scope + memberTypes.push(`${accessibility}-${scope}-${type}`); + memberTypes.push(`${scope}-${type}`); } - names.push(`${accessibility}-${type}`); + + memberTypes.push(`${accessibility}-${type}`); } - names.push(type); + memberTypes.push(type); - return getRankOrder(names, order); + return getRankOrder(memberTypes, order); } /** @@ -316,12 +325,13 @@ export default util.createRule({ } /** - * Validates each member rank. - * @param members the members to be validated. - * @param order the current order to be validated. - * @param supportsModifiers a flag indicating whether the type supports modifiers or not. + * Validates if all members are correctly sorted. + * + * @param members Members to be validated. + * @param order Current order to be validated. + * @param supportsModifiers A flag indicating whether the type supports modifiers (scope or accessibility) or not. */ - function validateMembers( + function validateMembersOrder( members: (TSESTree.ClassElement | TSESTree.TypeElement)[], order: OrderConfig, supportsModifiers: boolean, @@ -329,6 +339,7 @@ export default util.createRule({ if (members && order !== 'never') { const previousRanks: number[] = []; + // Find first member which isn't correctly sorted members.forEach(member => { const rank = getRank(member, order, supportsModifiers); @@ -352,28 +363,28 @@ export default util.createRule({ return { ClassDeclaration(node) { - validateMembers( + validateMembersOrder( node.body.body, options.classes || options.default!, true, ); }, ClassExpression(node) { - validateMembers( + validateMembersOrder( node.body.body, options.classExpressions || options.default!, true, ); }, TSInterfaceDeclaration(node) { - validateMembers( + validateMembersOrder( node.body.body, options.interfaces || options.default!, false, ); }, TSTypeLiteral(node) { - validateMembers( + validateMembersOrder( node.members, options.typeLiterals || options.default!, false, 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 a5e6e6788c96..55c91ac6e512 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: { diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index c15795773a09..890e6b04aa5d 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/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts new file mode 100644 index 000000000000..1b54bd4217f7 --- /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/createRule.ts b/packages/eslint-plugin/src/util/createRule.ts index 97b0f18c51e1..ac61c39cb559 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/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index dbaaebc3f7ae..4e3d34937f91 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -4,6 +4,7 @@ import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; import RuleModule from 'ts-eslint'; +import { SourceCode } from 'ts-eslint'; /** * Check if the context file name is *.ts or *.tsx @@ -63,3 +64,48 @@ 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. + */ +export function getNameFromClassMember( + methodDefinition: TSESTree.MethodDefinition | TSESTree.ClassProperty, + sourceCode: SourceCode, +): string { + if (keyCanBeReadAsPropertyName(methodDefinition.key)) { + return getNameFromPropertyName(methodDefinition.key); + } + + return sourceCode.text.slice(...methodDefinition.key.range); +} + +/** + * This covers both actual property names, as well as computed properties that are either + * an identifier or a literal at the top level. + */ +function keyCanBeReadAsPropertyName( + node: TSESTree.Expression, +): node is TSESTree.PropertyName { + return ( + node.type === AST_NODE_TYPES.Literal || + node.type === AST_NODE_TYPES.Identifier + ); +} diff --git a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts index 01680fef838e..c040362a1286 100644 --- a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts @@ -217,6 +217,11 @@ class Test { // examples from https://github.com/nzakas/eslint-plugin-typescript/issues/138 'export default function(foo : T) {}', 'export default function named(foo : T) {}', + ` +interface Foo { + [Symbol.toStringTag](): void; + [Symbol.iterator](): void; +}`, ], invalid: [ { 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 0abc6000f182..45ff620d6169 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'; } `, }, @@ -53,6 +54,7 @@ function test() { `, }, { + filename: 'test.ts', code: `fn(() => {});`, options: [ { @@ -61,6 +63,7 @@ function test() { ], }, { + filename: 'test.ts', code: `fn(function() {});`, options: [ { @@ -69,6 +72,7 @@ function test() { ], }, { + filename: 'test.ts', code: `[function() {}, () => {}]`, options: [ { @@ -77,6 +81,7 @@ function test() { ], }, { + filename: 'test.ts', code: `(function() {});`, options: [ { @@ -85,6 +90,7 @@ function test() { ], }, { + filename: 'test.ts', code: `(() => {})();`, options: [ { @@ -92,6 +98,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: [ { @@ -149,6 +177,7 @@ class Test { method() { return; } + arrow = () => 'arrow'; } `, errors: [ @@ -162,6 +191,25 @@ class Test { line: 8, column: 9, }, + { + messageId: 'missingReturnType', + line: 11, + column: 11, + }, + ], + }, + { + filename: 'test.ts', + code: `function test() { + return; + }`, + options: [{ allowExpressions: true }], + errors: [ + { + messageId: 'missingReturnType', + line: 1, + column: 1, + }, ], }, { @@ -188,5 +236,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, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts b/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts index d954d160fa94..09cf548c7ac8 100644 --- a/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts +++ b/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts @@ -77,7 +77,7 @@ interface Animal { options: ['always'], errors: [ { - messageId: 'noPrefix', + messageId: 'alwaysPrefix', line: 2, column: 11, }, @@ -92,7 +92,7 @@ interface Iguana { options: ['always'], errors: [ { - messageId: 'noPrefix', + messageId: 'alwaysPrefix', line: 2, column: 11, }, diff --git a/packages/eslint-plugin/tests/rules/member-naming.test.ts b/packages/eslint-plugin/tests/rules/member-naming.test.ts index c826600714b8..96ec4b104f3c 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: '^_' }], 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 df42dd0f0820..d34cb9957b8a 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: [ { 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 000000000000..94b6520de811 --- /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 998c69583428..33b667dab46a 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; @@ -683,6 +693,7 @@ declare module 'ts-eslint' { RuleMetaData, RuleMetaDataDocs, Scope, + SourceCode, }; export default RuleModule; } diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 3bba55647a49..9c7424ad92ef 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,24 @@ 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 + +## [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 + ## [1.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.0...v1.4.1) (2019-02-23) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 3f9e52628a21..b2fac500f33e 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "1.4.1", + "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.4.1", + "@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.4.1" + "@typescript-eslint/shared-fixtures": "1.6.0" } } diff --git a/packages/parser/src/visitor-keys.ts b/packages/parser/src/visitor-keys.ts index b39c2e28557f..7cc4aa9d8935 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: [], diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index a0cf4bcc5d6d..aab288144990 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/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index a2f78595c1ee..93be6b449718 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,33 @@ 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 + + + + + +## [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 + + + + + ## [1.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.0...v1.4.1) (2019-02-23) **Note:** Version bump only for package @typescript-eslint/shared-fixtures 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 000000000000..d95b3cb4e6cd --- /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 000000000000..a219fe271785 --- /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 000000000000..83f7deafe474 --- /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 000000000000..7943731f1bad --- /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/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 4ecb32d41840..049c984ba45f 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.1", + "version": "1.6.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index fafdfdf6e44c..45dd075c5ff2 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,27 @@ 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 + +- **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 + ## [1.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.0...v1.4.1) (2019-02-23) **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 40106ba1dd24..10bc1779c11e 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.1", + "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.4.1" + "@typescript-eslint/shared-fixtures": "1.6.0" } } diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index b3e75f21edb3..b476413731bf 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 28a0c157a29e..8504513ef2e9 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/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index 4a9c7b91ae10..6c0808b95624 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 @@ -500,7 +501,7 @@ interface LiteralBase extends BaseNode { } interface MethodDefinitionBase extends BaseNode { - key: PropertyName; + key: Expression; value: FunctionExpression | TSEmptyBodyFunctionExpression; computed: boolean; static: boolean; diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index c136c518c2d6..135bbdfbc04e 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; } 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 7c8b4f2d5eb7..f30b35c32838 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 3049a51ae47a..edb333d7c836 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 733bb36fbfcc..efd3dd82094f 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 d8494a997ac3..c8f0cf9e3649 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/tsconfig.base.json b/tsconfig.base.json index fe87d8e95ab8..ee6c33f86e51 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -14,6 +14,7 @@ "pretty": true, "sourceMap": true, "strict": true, - "target": "es2017" + "target": "es2017", + "lib": ["es2017"] } } diff --git a/yarn.lock b/yarn.lock index fe9efe6c836e..d26da3f9306d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -96,6 +96,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.3.tgz#092d450db02bdb6ccb1ca8ffd47d8774a91aef87" integrity sha512-xsH1CJoln2r74hR+y7cg2B5JCPaTh+Hd+EbBRk9nWGSNspuo6krjhX0Om6RnRQuIvFq8wVXCLKH3kwKDYhanSg== +"@babel/parser@^7.1.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.4.tgz#a43357e4bbf4b92a437fb9e465c192848287f27c" + integrity sha512-tXZCqWtlOOP4wgCp6RjRvLmfuhnqTLy9VHwRochJBCP2nDm27JnnuFEnXFASVyQNHk36jD1tAammsCEEqgscIQ== + "@babel/plugin-syntax-object-rest-spread@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" @@ -143,6 +148,14 @@ lodash "^4.17.11" to-fast-properties "^2.0.0" +"@cnakazawa/watch@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" + integrity sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA== + dependencies: + exec-sh "^0.3.2" + minimist "^1.2.0" + "@commitlint/cli@^7.1.2", "@commitlint/cli@^7.5.2": version "7.5.2" resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-7.5.2.tgz#2475cd8f7ed3b2f9c2ab96c06bc24d61d23f8716" @@ -297,6 +310,143 @@ log-update "^2.3.0" strip-ansi "^3.0.1" +"@jest/console@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.3.0.tgz#7bd920d250988ba0bf1352c4493a48e1cb97671e" + integrity sha512-NaCty/OOei6rSDcbPdMiCbYCI0KGFGPgGO6B09lwWt5QTxnkuhKYET9El5u5z1GAcSxkQmSMtM63e24YabCWqA== + dependencies: + "@jest/source-map" "^24.3.0" + "@types/node" "*" + chalk "^2.0.1" + slash "^2.0.0" + +"@jest/core@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.3.0.tgz#ae5732af96567205d79ed97dc0b9b9033acea298" + integrity sha512-kGnyXAEjFPK4SfikxyrugXZ/SpWYmA09jMOvZRxeRfarVy+yIE6NkilRA85MRqR2qOcQhWgZ48T3KXEVPZC1zw== + dependencies: + "@jest/console" "^24.3.0" + "@jest/reporters" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/transform" "^24.3.0" + "@jest/types" "^24.3.0" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-changed-files "^24.3.0" + jest-config "^24.3.0" + jest-haste-map "^24.3.0" + jest-message-util "^24.3.0" + jest-regex-util "^24.3.0" + jest-resolve-dependencies "^24.3.0" + jest-runner "^24.3.0" + jest-runtime "^24.3.0" + jest-snapshot "^24.3.0" + jest-util "^24.3.0" + jest-validate "^24.3.0" + jest-watcher "^24.3.0" + micromatch "^3.1.10" + p-each-series "^1.0.0" + pirates "^4.0.1" + realpath-native "^1.1.0" + rimraf "^2.5.4" + strip-ansi "^5.0.0" + +"@jest/environment@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.3.0.tgz#45e7c5cc996cb8f2287a30f8de08b152fa226fe2" + integrity sha512-rPrnhX3cBvGqODfd6aUsCruUijVp2tmBC0YfeXIku0MciQSR9ek5tjdEk31iBvxE9WlGQus+E/slRLqJmCRZTw== + dependencies: + "@jest/fake-timers" "^24.3.0" + "@jest/transform" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/node" "*" + jest-mock "^24.3.0" + +"@jest/fake-timers@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.3.0.tgz#0a7f8b877b78780c3fa5c3f8683cc0aaf9488331" + integrity sha512-rHwVI17dGMHxHzfAhnZ04+wFznjFfZ246QugeBnbiYr7/bDosPD2P1qeNjWnJUUcfl0HpS6kkr+OB/mqSJxQFg== + dependencies: + "@jest/types" "^24.3.0" + "@types/node" "*" + jest-message-util "^24.3.0" + jest-mock "^24.3.0" + +"@jest/reporters@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.3.0.tgz#beaa8b7d0148db8438a12102daf4d36268a150f5" + integrity sha512-/Gwdcej9x4QuhFIWTKyiiMLAMzfCtIIvuk2AnreqmuxLRAyUbkR5BoUoPvwowKVyZn20ZdCG5Qf7/KaoHhCG8Q== + dependencies: + "@jest/environment" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/transform" "^24.3.0" + "@jest/types" "^24.3.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.2" + istanbul-api "^2.1.1" + istanbul-lib-coverage "^2.0.2" + istanbul-lib-instrument "^3.0.1" + istanbul-lib-source-maps "^3.0.1" + jest-haste-map "^24.3.0" + jest-resolve "^24.3.0" + jest-runtime "^24.3.0" + jest-util "^24.3.0" + jest-worker "^24.3.0" + node-notifier "^5.2.1" + slash "^2.0.0" + source-map "^0.6.0" + string-length "^2.0.0" + +"@jest/source-map@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.3.0.tgz#563be3aa4d224caf65ff77edc95cd1ca4da67f28" + integrity sha512-zALZt1t2ou8le/crCeeiRYzvdnTzaIlpOWaet45lNSqNJUnXbppUUFR4ZUAlzgDmKee4Q5P/tKXypI1RiHwgag== + dependencies: + callsites "^3.0.0" + graceful-fs "^4.1.15" + source-map "^0.6.0" + +"@jest/test-result@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.3.0.tgz#4c0b1c9716212111920f7cf8c4329c69bc81924a" + integrity sha512-j7UZ49T8C4CVipEY99nLttnczVTtLyVzFfN20OiBVn7awOs0U3endXSTq7ouPrLR5y4YjI5GDcbcvDUjgeamzg== + dependencies: + "@jest/console" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/istanbul-lib-coverage" "^1.1.0" + +"@jest/transform@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.3.0.tgz#a18bfd18f25ca28566f5bc398551c047199f4c75" + integrity sha512-qrOIa34c+C5kqABGslBz7Lcwi9qbksO9/XcoCcYWD6AnrOmVUBRZSFHzo7Enk5iHUXRGnVnXvb8AyBXKlwpdGQ== + dependencies: + "@babel/core" "^7.1.0" + "@jest/types" "^24.3.0" + babel-plugin-istanbul "^5.1.0" + chalk "^2.0.1" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.1.15" + jest-haste-map "^24.3.0" + jest-regex-util "^24.3.0" + jest-util "^24.3.0" + micromatch "^3.1.10" + realpath-native "^1.1.0" + slash "^2.0.0" + source-map "^0.6.1" + write-file-atomic "2.4.1" + +"@jest/types@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.3.0.tgz#3f6e117e47248a9a6b5f1357ec645bd364f7ad23" + integrity sha512-VoO1F5tU2n/93QN/zaZ7Q8SeV/Rj+9JJOgbvKbBwy4lenvmdj1iDaQEPXGTKrO6OSvDeb2drTFipZJYxgo6kIQ== + dependencies: + "@types/istanbul-lib-coverage" "^1.1.0" + "@types/yargs" "^12.0.9" + "@lerna/add@3.13.0": version "3.13.0" resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.13.0.tgz#e971a17c1f85cba40f22c816a2bb9d855b62d07d" @@ -991,6 +1141,39 @@ resolved "https://registry.yarnpkg.com/@types/babel-code-frame/-/babel-code-frame-6.20.2.tgz#d923c88d94e66b864fd3693f07b18ad78489a222" integrity sha512-HAdhFeYOZKIkrR2jbonCJxp3I/o2G/kxY+CIx7qX9Kmv5jY+9D7OgmgSLdRqeHacB5RlqE5efj2WIDFL9NXCyg== +"@types/babel__core@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.0.tgz#710f2487dda4dcfd010ca6abb2b4dc7394365c51" + integrity sha512-wJTeJRt7BToFx3USrCDs2BhEi4ijBInTQjOIukj6a/5tEkwpFMVZ+1ppgmE+Q/FQyc5P/VWUbx7I9NELrKruHA== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.0.2.tgz#d2112a6b21fad600d7674274293c85dce0cb47fc" + integrity sha512-NHcOfab3Zw4q5sEE2COkpfXjoE7o+PmqD9DQW4koUT3roNxwziUdXGnRndMat/LJNUtePwn1TlP4do3uoe3KZQ== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" + integrity sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.0.6" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.6.tgz#328dd1a8fc4cfe3c8458be9477b219ea158fd7b2" + integrity sha512-XYVgHF2sQ0YblLRMLNPB3CkFMewzFmlDsH/TneZFHUXDlABQgh88uOxuez7ZcXxayLFrqLwtDH1t+FmlFwNZxw== + dependencies: + "@babel/types" "^7.3.0" + "@types/eslint-visitor-keys@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" @@ -1023,6 +1206,11 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/istanbul-lib-coverage@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.0.tgz#2cc2ca41051498382b43157c8227fea60363f94a" + integrity sha512-ohkhb9LehJy+PA40rDtGAji61NCgdtKLAlFoYp4cnuuQEswwdK3vz9SOIkkyc3wrk8dzjphQApNs56yyXLStaQ== + "@types/jest-diff@*": version "20.0.1" resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" @@ -1086,6 +1274,16 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" integrity sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ== +"@types/stack-utils@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" + integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== + +"@types/yargs@^12.0.2", "@types/yargs@^12.0.9": + version "12.0.9" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.9.tgz#693e76a52f61a2f1e7fb48c0eef167b95ea4ffd0" + integrity sha512-sCZy4SxP9rN2w30Hlmg5dtdRwgYQfYRiLo9usw8X9cxlf+H4FqM1xX7+sNH7NNKVdbXMJWqva7iyy+fxh/V7fA== + JSONStream@^1.0.4, JSONStream@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -1389,13 +1587,16 @@ babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-jest@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.1.0.tgz#441e23ef75ded3bd547e300ac3194cef87b55190" - integrity sha512-MLcagnVrO9ybQGLEfZUqnOzv36iQzU7Bj4elm39vCukumLVSfoX+tRy3/jW7lUKc7XdpRmB/jech6L/UCsSZjw== +babel-jest@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.3.0.tgz#4f484d1a13e1be1b349e715cc41ad34fbe770ad7" + integrity sha512-YH62Flana1vImnB3Q59R9t7PzMUbFTlhI4KR/Ri/5hshm+WgxCTuFS8N2uSvEhQXcvzkhrvjBBciJWzOb+4rOA== dependencies: + "@jest/transform" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/babel__core" "^7.1.0" babel-plugin-istanbul "^5.1.0" - babel-preset-jest "^24.1.0" + babel-preset-jest "^24.3.0" chalk "^2.4.2" slash "^2.0.0" @@ -1408,10 +1609,12 @@ babel-plugin-istanbul@^5.1.0: istanbul-lib-instrument "^3.0.0" test-exclude "^5.0.0" -babel-plugin-jest-hoist@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.1.0.tgz#dfecc491fb15e2668abbd690a697a8fd1411a7f8" - integrity sha512-gljYrZz8w1b6fJzKcsfKsipSru2DU2DmQ39aB6nV3xQ0DDv3zpIzKGortA5gknrhNnPN8DweaEgrnZdmbGmhnw== +babel-plugin-jest-hoist@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.3.0.tgz#f2e82952946f6e40bb0a75d266a3790d854c8b5b" + integrity sha512-nWh4N1mVH55Tzhx2isvUN5ebM5CDUvIpXPZYMRazQughie/EqGnbR+czzoQlhUmJG9pPJmYDRhvocotb2THl1w== + dependencies: + "@types/babel__traverse" "^7.0.6" babel-polyfill@6.26.0: version "6.26.0" @@ -1422,13 +1625,13 @@ babel-polyfill@6.26.0: core-js "^2.5.0" regenerator-runtime "^0.10.5" -babel-preset-jest@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.1.0.tgz#83bc564fdcd4903641af65ec63f2f5de6b04132e" - integrity sha512-FfNLDxFWsNX9lUmtwY7NheGlANnagvxq8LZdl5PKnVG3umP+S/g0XbVBfwtA4Ai3Ri/IMkWabBz3Tyk9wdspcw== +babel-preset-jest@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.3.0.tgz#db88497e18869f15b24d9c0e547d8e0ab950796d" + integrity sha512-VGTV2QYBa/Kn3WCOKdfS31j9qomaXSgJqi65B6o05/1GsJyj9LVhSljM9ro4S+IBGj/ENhNBuH9bpqzztKAQSw== dependencies: "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - babel-plugin-jest-hoist "^24.1.0" + babel-plugin-jest-hoist "^24.3.0" babel-runtime@6.26.0, babel-runtime@^6.23.0, babel-runtime@^6.26.0: version "6.26.0" @@ -2143,7 +2346,7 @@ debug@3.1.0: dependencies: ms "2.0.0" -debug@^2.1.2, debug@^2.2.0, debug@^2.3.3: +debug@^2.2.0, debug@^2.3.3: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== @@ -2192,11 +2395,6 @@ dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -2277,11 +2475,6 @@ detect-indent@^5.0.0: resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50= -detect-libc@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= - detect-newline@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" @@ -2295,10 +2488,10 @@ dezalgo@^1.0.0: asap "^2.0.0" wrappy "1" -diff-sequences@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.0.0.tgz#cdf8e27ed20d8b8d3caccb4e0c0d8fe31a173013" - integrity sha512-46OkIuVGBBnrC0soO/4LHu5LHGHx0uhP65OVz8XOrAJpqiCB2aVIuESvjI1F9oqebuvY8lekS1pt6TN7vt7qsw== +diff-sequences@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" + integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw== diff@^3.1.0, diff@^3.2.0, diff@^3.5.0: version "3.5.0" @@ -2575,12 +2768,10 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= -exec-sh@^0.2.0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.2.tgz#2a5e7ffcbd7d0ba2755bdecb16e5a427dfbdec36" - integrity sha512-FIUCJz1RbuS0FKTdaAafAByGS0CPvU3R0MeHxgtl+djzCc//F8HakL8GzmVNZanasTbTAY/3DRFA0KpVqj/eAw== - dependencies: - merge "^1.2.0" +exec-sh@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" + integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== execa@0.9.0: version "0.9.0" @@ -2639,16 +2830,17 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.1.0.tgz#88e73301c4c785cde5f16da130ab407bdaf8c0f2" - integrity sha512-lVcAPhaYkQcIyMS+F8RVwzbm1jro20IG8OkvxQ6f1JfqhVZyyudCwYogQ7wnktlf14iF3ii7ArIUO/mqvrW9Gw== +expect@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.3.0.tgz#84c2bff9d3eaf4ffe088ec13e84a7d7a8d014945" + integrity sha512-maPswEFJ1mJaa3Hx0aeyiqlf/FhJnvTyCzeksmqHGgWyM8m+cIhf1t5Gz8qIRdJPm0m4XPiin/0wxdru2l+hCw== dependencies: + "@jest/types" "^24.3.0" ansi-styles "^3.2.0" - jest-get-type "^24.0.0" - jest-matcher-utils "^24.0.0" - jest-message-util "^24.0.0" - jest-regex-util "^24.0.0" + jest-get-type "^24.3.0" + jest-matcher-utils "^24.3.0" + jest-message-util "^24.3.0" + jest-regex-util "^24.3.0" extend-shallow@^2.0.1: version "2.0.1" @@ -2896,14 +3088,6 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@^1.2.3: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.7.tgz#4851b664a3783e52003b3c66eb0eee1074933aa4" - integrity sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw== - dependencies: - nan "^2.9.2" - node-pre-gyp "^0.10.0" - fstream@^1.0.0, fstream@^1.0.2: version "1.0.11" resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" @@ -3309,7 +3493,7 @@ husky@^1.3.1: run-node "^1.0.0" slash "^2.0.0" -iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -3400,7 +3584,7 @@ inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -ini@^1.3.2, ini@^1.3.4, ini@~1.3.0: +ini@^1.3.2, ini@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== @@ -3748,7 +3932,7 @@ isstream@~0.1.2: resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= -istanbul-api@^2.0.8: +istanbul-api@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-2.1.1.tgz#194b773f6d9cbc99a9258446848b0f988951c4d0" integrity sha512-kVmYrehiwyeBAk/wE71tW6emzLiHGjYIiDrc8sfyty4F8M02/lrgXSm+R1kXysmF20zArvmZXjlE/mg24TVPJw== @@ -3819,299 +4003,308 @@ istanbul-reports@^2.1.1: dependencies: handlebars "^4.1.0" -jest-changed-files@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.0.0.tgz#c02c09a8cc9ca93f513166bc773741bd39898ff7" - integrity sha512-nnuU510R9U+UX0WNb5XFEcsrMqriSiRLeO9KWDFgPrpToaQm60prfQYpxsXigdClpvNot5bekDY440x9dNGnsQ== +jest-changed-files@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.3.0.tgz#7050ae29aaf1d59437c80f21d5b3cd354e88a499" + integrity sha512-fTq0YAUR6644fgsqLC7Zi2gXA/bAplMRvfXQdutmkwgrCKK6upkj+sgXqsUfUZRm15CVr3YSojr/GRNn71IMvg== dependencies: + "@jest/types" "^24.3.0" execa "^1.0.0" throat "^4.0.0" -jest-cli@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.1.0.tgz#f7cc98995f36e7210cce3cbb12974cbf60940843" - integrity sha512-U/iyWPwOI0T1CIxVLtk/2uviOTJ/OiSWJSe8qt6X1VkbbgP+nrtLJlmT9lPBe4lK78VNFJtrJ7pttcNv/s7yCw== +jest-cli@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.3.0.tgz#b180ac1d3d0188d38d528268d99413e21baa8f64" + integrity sha512-FNGfJItAiXuJJBSZIQzaLCb63/BIAUEyucGf892Vg2n/dyk1M7O+o6YPFtwWOHMwVXX873MLsINBUbFNt1ugLQ== dependencies: - ansi-escapes "^3.0.0" + "@jest/core" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" chalk "^2.0.1" exit "^0.1.2" - glob "^7.1.2" - graceful-fs "^4.1.15" import-local "^2.0.0" is-ci "^2.0.0" - istanbul-api "^2.0.8" - istanbul-lib-coverage "^2.0.2" - istanbul-lib-instrument "^3.0.1" - istanbul-lib-source-maps "^3.0.1" - jest-changed-files "^24.0.0" - jest-config "^24.1.0" - jest-environment-jsdom "^24.0.0" - jest-get-type "^24.0.0" - jest-haste-map "^24.0.0" - jest-message-util "^24.0.0" - jest-regex-util "^24.0.0" - jest-resolve-dependencies "^24.1.0" - jest-runner "^24.1.0" - jest-runtime "^24.1.0" - jest-snapshot "^24.1.0" - jest-util "^24.0.0" - jest-validate "^24.0.0" - jest-watcher "^24.0.0" - jest-worker "^24.0.0" - micromatch "^3.1.10" - node-notifier "^5.2.1" - p-each-series "^1.0.0" - pirates "^4.0.0" + jest-config "^24.3.0" + jest-util "^24.3.0" + jest-validate "^24.3.0" prompts "^2.0.1" - realpath-native "^1.0.0" - rimraf "^2.5.4" - slash "^2.0.0" - string-length "^2.0.0" - strip-ansi "^5.0.0" - which "^1.2.12" + realpath-native "^1.1.0" yargs "^12.0.2" -jest-config@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.1.0.tgz#6ea6881cfdd299bc86cc144ee36d937c97c3850c" - integrity sha512-FbbRzRqtFC6eGjG5VwsbW4E5dW3zqJKLWYiZWhB0/4E5fgsMw8GODLbGSrY5t17kKOtCWb/Z7nsIThRoDpuVyg== +jest-config@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.3.0.tgz#d12296b5a8f700b13fb31eaea7c30f5473aab1a5" + integrity sha512-GrPEBZ1nIQ6KnHHNiQYN30ekJG+w7l2IWRctCQUDKbmV5IE5bnirz8tHpMzkTHyClZH2g1NcvW2tUX0Glqgp4A== dependencies: "@babel/core" "^7.1.0" - babel-jest "^24.1.0" + "@jest/types" "^24.3.0" + babel-jest "^24.3.0" chalk "^2.0.1" glob "^7.1.1" - jest-environment-jsdom "^24.0.0" - jest-environment-node "^24.0.0" - jest-get-type "^24.0.0" - jest-jasmine2 "^24.1.0" - jest-regex-util "^24.0.0" - jest-resolve "^24.1.0" - jest-util "^24.0.0" - jest-validate "^24.0.0" + jest-environment-jsdom "^24.3.0" + jest-environment-node "^24.3.0" + jest-get-type "^24.3.0" + jest-jasmine2 "^24.3.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.3.0" + jest-util "^24.3.0" + jest-validate "^24.3.0" micromatch "^3.1.10" - pretty-format "^24.0.0" - realpath-native "^1.0.2" + pretty-format "^24.3.0" + realpath-native "^1.1.0" -jest-diff@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.0.0.tgz#a3e5f573dbac482f7d9513ac9cfa21644d3d6b34" - integrity sha512-XY5wMpRaTsuMoU+1/B2zQSKQ9RdE9gsLkGydx3nvApeyPijLA8GtEvIcPwISRCer+VDf9W1mStTYYq6fPt8ryA== +jest-diff@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.3.0.tgz#38a76ccc52130e6d273ef952e4bac358924be8a6" + integrity sha512-B3FHbTaQObcew5H639Ok6Yv8MMkU4BZqwyt1TQgJXlOiR9TdSfjoViYmb0iWucOPMT3xvz3lN6n2phymdQRyEQ== dependencies: chalk "^2.0.1" - diff-sequences "^24.0.0" - jest-get-type "^24.0.0" - pretty-format "^24.0.0" + diff-sequences "^24.3.0" + jest-get-type "^24.3.0" + pretty-format "^24.3.0" -jest-docblock@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.0.0.tgz#54d77a188743e37f62181a91a01eb9222289f94e" - integrity sha512-KfAKZ4SN7CFOZpWg4i7g7MSlY0M+mq7K0aMqENaG2vHuhC9fc3vkpU/iNN9sOus7v3h3Y48uEjqz3+Gdn2iptA== +jest-docblock@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.3.0.tgz#b9c32dac70f72e4464520d2ba4aec02ab14db5dd" + integrity sha512-nlANmF9Yq1dufhFlKG9rasfQlrY7wINJbo3q01tu56Jv5eBU5jirylhF2O5ZBnLxzOVBGRDz/9NAwNyBtG4Nyg== dependencies: detect-newline "^2.1.0" -jest-each@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.0.0.tgz#10987a06b21c7ffbfb7706c89d24c52ed864be55" - integrity sha512-gFcbY4Cu55yxExXMkjrnLXov3bWO3dbPAW7HXb31h/DNWdNc/6X8MtxGff8nh3/MjkF9DpVqnj0KsPKuPK0cpA== +jest-each@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.3.0.tgz#83ae8c6368791bf6ad6c5bf3f67ace0724e9d13e" + integrity sha512-FuAhGgS1k6MpOG9vHsEVYH7mwiHheRIH9vFf8xKxmM5vnuCMhoZqExojmw5vAglkEPJPVH9rjZakOD5kqWV0UA== dependencies: + "@jest/types" "^24.3.0" chalk "^2.0.1" - jest-get-type "^24.0.0" - jest-util "^24.0.0" - pretty-format "^24.0.0" - -jest-environment-jsdom@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.0.0.tgz#5affa0654d6e44cd798003daa1a8701dbd6e4d11" - integrity sha512-1YNp7xtxajTRaxbylDc2pWvFnfDTH5BJJGyVzyGAKNt/lEULohwEV9zFqTgG4bXRcq7xzdd+sGFws+LxThXXOw== - dependencies: - jest-mock "^24.0.0" - jest-util "^24.0.0" + jest-get-type "^24.3.0" + jest-util "^24.3.0" + pretty-format "^24.3.0" + +jest-environment-jsdom@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.3.0.tgz#974d4293bd9d714eeeb1376c7235a8ab9d736db7" + integrity sha512-Cor5RiE8WMoDErKZSXDfh6KAEOP8lrz04PgNLczEV7IkB2++0U4NC+gTyrO0PenfIlKbCZ6g0sRubEJOgjiXUA== + dependencies: + "@jest/environment" "^24.3.0" + "@jest/fake-timers" "^24.3.0" + "@jest/types" "^24.3.0" + jest-mock "^24.3.0" + jest-util "^24.3.0" jsdom "^11.5.1" -jest-environment-node@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.0.0.tgz#330948980656ed8773ce2e04eb597ed91e3c7190" - integrity sha512-62fOFcaEdU0VLaq8JL90TqwI7hLn0cOKOl8vY2n477vRkCJRojiRRtJVRzzCcgFvs6gqU97DNqX5R0BrBP6Rxg== +jest-environment-node@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.3.0.tgz#127e214e4ebad9639f81d3c82ac5fb3d482024ad" + integrity sha512-VKJ1qE0Xn2IYNXusxce2M7IhHz4uARYDXO3JxkyQnFhLPE33e5UUx2MQHVpst2Qy98IFpO06WZtrHb5H06GGfQ== dependencies: - jest-mock "^24.0.0" - jest-util "^24.0.0" + "@jest/environment" "^24.3.0" + "@jest/fake-timers" "^24.3.0" + "@jest/types" "^24.3.0" + jest-mock "^24.3.0" + jest-util "^24.3.0" jest-get-type@^22.1.0: version "22.4.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" integrity sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w== -jest-get-type@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.0.0.tgz#36e72930b78e33da59a4f63d44d332188278940b" - integrity sha512-z6/Eyf6s9ZDGz7eOvl+fzpuJmN9i0KyTt1no37/dHu8galssxz5ZEgnc1KaV8R31q1khxyhB4ui/X5ZjjPk77w== +jest-get-type@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.3.0.tgz#582cfd1a4f91b5cdad1d43d2932f816d543c65da" + integrity sha512-HYF6pry72YUlVcvUx3sEpMRwXEWGEPlJ0bSPVnB3b3n++j4phUEoSPcS6GC0pPJ9rpyPSe4cb5muFo6D39cXow== -jest-haste-map@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.0.0.tgz#e9ef51b2c9257384b4d6beb83bd48c65b37b5e6e" - integrity sha512-CcViJyUo41IQqttLxXVdI41YErkzBKbE6cS6dRAploCeutePYfUimWd3C9rQEWhX0YBOQzvNsC0O9nYxK2nnxQ== +jest-haste-map@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.3.0.tgz#8fc0530c25b0705e9e908d9da8f1904cbec39058" + integrity sha512-LJCFLYZ9zgaZluzgyaum7HzApSYt2fFv39DoGwcLlWSDbjeI1tZuNOIWp5qHCHe7WXc99EgqLidpzsauA3HBBg== dependencies: + "@jest/types" "^24.3.0" fb-watchman "^2.0.0" graceful-fs "^4.1.15" invariant "^2.2.4" - jest-serializer "^24.0.0" - jest-util "^24.0.0" - jest-worker "^24.0.0" + jest-serializer "^24.3.0" + jest-util "^24.3.0" + jest-worker "^24.3.0" micromatch "^3.1.10" - sane "^3.0.0" + sane "^4.0.3" -jest-jasmine2@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.1.0.tgz#8377324b967037c440f0a549ee0bbd9912055db6" - integrity sha512-H+o76SdSNyCh9fM5K8upK45YTo/DiFx5w2YAzblQebSQmukDcoVBVeXynyr7DDnxh+0NTHYRCLwJVf3tC518wg== +jest-jasmine2@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.3.0.tgz#60814a23992891b955cbfe453947320e2e66076b" + integrity sha512-X0bseienL6wLdgHIrTyBbn3+llmEiXkMTJKFmJvQf4yP84bYdy1HaQYfchOWw5H9JllROM0kEBhRz8OS3p6FEA== dependencies: "@babel/traverse" "^7.1.0" + "@jest/environment" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" chalk "^2.0.1" co "^4.6.0" - expect "^24.1.0" + expect "^24.3.0" is-generator-fn "^2.0.0" - jest-each "^24.0.0" - jest-matcher-utils "^24.0.0" - jest-message-util "^24.0.0" - jest-snapshot "^24.1.0" - jest-util "^24.0.0" - pretty-format "^24.0.0" + jest-each "^24.3.0" + jest-matcher-utils "^24.3.0" + jest-message-util "^24.3.0" + jest-runtime "^24.3.0" + jest-snapshot "^24.3.0" + jest-util "^24.3.0" + pretty-format "^24.3.0" throat "^4.0.0" -jest-leak-detector@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.0.0.tgz#78280119fd05ee98317daee62cddb3aa537a31c6" - integrity sha512-ZYHJYFeibxfsDSKowjDP332pStuiFT2xfc5R67Rjm/l+HFJWJgNIOCOlQGeXLCtyUn3A23+VVDdiCcnB6dTTrg== +jest-leak-detector@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.3.0.tgz#20216c2fb94a67d90b19c34e18880974bcd901f2" + integrity sha512-NUwLCYPVMnSo7mHaXY8ahKbzmPNBlRTPvmvoHK70Y2K17COFNfVz30wKhsa3Dpv3rmcnk2XaPq77DKjUAsyVGQ== dependencies: - pretty-format "^24.0.0" + pretty-format "^24.3.0" -jest-matcher-utils@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.0.0.tgz#fc9c41cfc49b2c3ec14e576f53d519c37729d579" - integrity sha512-LQTDmO+aWRz1Tf9HJg+HlPHhDh1E1c65kVwRFo5mwCVp5aQDzlkz4+vCvXhOKFjitV2f0kMdHxnODrXVoi+rlA== +jest-matcher-utils@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.3.0.tgz#c3277ee6d93583293f270e8d0ea864cfe17d2d1c" + integrity sha512-9imAV7r7dD1KGbGln2331RHAYfNQsZGYx1uLc45Fn+KuffFAqv5NS+8t9KaFZIo4rjBu/KNM3hBlu6l2/mRdqw== dependencies: chalk "^2.0.1" - jest-diff "^24.0.0" - jest-get-type "^24.0.0" - pretty-format "^24.0.0" + jest-diff "^24.3.0" + jest-get-type "^24.3.0" + pretty-format "^24.3.0" -jest-message-util@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.0.0.tgz#a07a141433b2c992dbaec68d4cbfe470ba289619" - integrity sha512-J9ROJIwz/IeC+eV1XSwnRK4oAwPuhmxEyYx1+K5UI+pIYwFZDSrfZaiWTdq0d2xYFw4Xiu+0KQWsdsQpgJMf3Q== +jest-message-util@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.3.0.tgz#e8f64b63ebc75b1a9c67ee35553752596e70d4a9" + integrity sha512-lXM0YgKYGqN5/eH1NGw4Ix+Pk2I9Y77beyRas7xM24n+XTTK3TbT0VkT3L/qiyS7WkW0YwyxoXnnAaGw4hsEDA== dependencies: "@babel/code-frame" "^7.0.0" + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/stack-utils" "^1.0.1" chalk "^2.0.1" micromatch "^3.1.10" slash "^2.0.0" stack-utils "^1.0.1" -jest-mock@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.0.0.tgz#9a4b53e01d66a0e780f7d857462d063e024c617d" - integrity sha512-sQp0Hu5fcf5NZEh1U9eIW2qD0BwJZjb63Yqd98PQJFvf/zzUTBoUAwv/Dc/HFeNHIw1f3hl/48vNn+j3STaI7A== +jest-mock@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.3.0.tgz#95a86b6ad474e3e33227e6dd7c4ff6b07e18d3cb" + integrity sha512-AhAo0qjbVWWGvcbW5nChFjR0ObQImvGtU6DodprNziDOt+pP0CBdht/sYcNIOXeim8083QUi9bC8QdKB8PTK4Q== + dependencies: + "@jest/types" "^24.3.0" -jest-regex-util@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.0.0.tgz#4feee8ec4a358f5bee0a654e94eb26163cb9089a" - integrity sha512-Jv/uOTCuC+PY7WpJl2mpoI+WbY2ut73qwwO9ByJJNwOCwr1qWhEW2Lyi2S9ZewUdJqeVpEBisdEVZSI+Zxo58Q== +jest-regex-util@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" + integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== -jest-resolve-dependencies@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.1.0.tgz#78f738a2ec59ff4d00751d9da56f176e3f589f6c" - integrity sha512-2VwPsjd3kRPu7qe2cpytAgowCObk5AKeizfXuuiwgm1a9sijJDZe8Kh1sFj6FKvSaNEfCPlBVkZEJa2482m/Uw== +jest-resolve-dependencies@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.3.0.tgz#fd364c149fcd9d330f1f3adce1ba2d6937eb9ed7" + integrity sha512-z4s8t+EM67sbsRG5j0VzW0a4cv3Fj4+oQWisUOJXOtPHaBVP5OySsQq9E+BSSwaS8YgNC1m0+PdfUZEp3DkDOw== dependencies: - jest-regex-util "^24.0.0" - jest-snapshot "^24.1.0" + "@jest/types" "^24.3.0" + jest-regex-util "^24.3.0" + jest-snapshot "^24.3.0" -jest-resolve@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.1.0.tgz#42ff0169b0ea47bfdbd0c52a0067ca7d022c7688" - integrity sha512-TPiAIVp3TG6zAxH28u/6eogbwrvZjBMWroSLBDkwkHKrqxB/RIdwkWDye4uqPlZIXWIaHtifY3L0/eO5Z0f2wg== +jest-resolve@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.3.0.tgz#484268892ceb25cc90694adc78aa99026907322b" + integrity sha512-lgU2nE475eZrB/KwrEdVwNhFKvHqgSB3G+yaJ6bpK3cOYt35uInteNu1BL5008F5AQsJKdmg3mIWwwizdgb/uA== dependencies: + "@jest/types" "^24.3.0" browser-resolve "^1.11.3" chalk "^2.0.1" - realpath-native "^1.0.0" + realpath-native "^1.1.0" -jest-runner@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.1.0.tgz#3686a2bb89ce62800da23d7fdc3da2c32792943b" - integrity sha512-CDGOkT3AIFl16BLL/OdbtYgYvbAprwJ+ExKuLZmGSCSldwsuU2dEGauqkpvd9nphVdAnJUcP12e/EIlnTX0QXg== +jest-runner@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.3.0.tgz#5bdc0378992b60f7b14f9d198c9cc1481883a27e" + integrity sha512-oAWdXY74DwXViSrczs6q8FSi2RdFEejM2q9KasgjI+b8+usOnxXpEpo6FEMUvSXzkjpPz4XND7jusUNhShu9jQ== dependencies: + "@jest/console" "^24.3.0" + "@jest/environment" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" chalk "^2.4.2" exit "^0.1.2" graceful-fs "^4.1.15" - jest-config "^24.1.0" - jest-docblock "^24.0.0" - jest-haste-map "^24.0.0" - jest-jasmine2 "^24.1.0" - jest-leak-detector "^24.0.0" - jest-message-util "^24.0.0" - jest-runtime "^24.1.0" - jest-util "^24.0.0" - jest-worker "^24.0.0" + jest-config "^24.3.0" + jest-docblock "^24.3.0" + jest-haste-map "^24.3.0" + jest-jasmine2 "^24.3.0" + jest-leak-detector "^24.3.0" + jest-message-util "^24.3.0" + jest-resolve "^24.3.0" + jest-runtime "^24.3.0" + jest-util "^24.3.0" + jest-worker "^24.3.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.1.0.tgz#7c157a2e776609e8cf552f956a5a19ec9c985214" - integrity sha512-59/BY6OCuTXxGeDhEMU7+N33dpMQyXq7MLK07cNSIY/QYt2QZgJ7Tjx+rykBI0skAoigFl0A5tmT8UdwX92YuQ== - dependencies: - "@babel/core" "^7.1.0" - babel-plugin-istanbul "^5.1.0" +jest-runtime@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.3.0.tgz#6ed1ba1260ad90c906a55fb4989021cfc7c967c4" + integrity sha512-ARqHo8nPQ0/QlTN9ZuE8ebIjleBVqJhdEcuoy7mEWNyOqEpuEMAVIp3asO+giAmwh5ih9NlbhWsx97DIt5N6KA== + dependencies: + "@jest/console" "^24.3.0" + "@jest/environment" "^24.3.0" + "@jest/source-map" "^24.3.0" + "@jest/transform" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/yargs" "^12.0.2" chalk "^2.0.1" - convert-source-map "^1.4.0" exit "^0.1.2" - fast-json-stable-stringify "^2.0.0" glob "^7.1.3" graceful-fs "^4.1.15" - jest-config "^24.1.0" - jest-haste-map "^24.0.0" - jest-message-util "^24.0.0" - jest-regex-util "^24.0.0" - jest-resolve "^24.1.0" - jest-snapshot "^24.1.0" - jest-util "^24.0.0" - jest-validate "^24.0.0" - micromatch "^3.1.10" - realpath-native "^1.0.0" + jest-config "^24.3.0" + jest-haste-map "^24.3.0" + jest-message-util "^24.3.0" + jest-mock "^24.3.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.3.0" + jest-snapshot "^24.3.0" + jest-util "^24.3.0" + jest-validate "^24.3.0" + realpath-native "^1.1.0" slash "^2.0.0" strip-bom "^3.0.0" - write-file-atomic "2.4.1" yargs "^12.0.2" -jest-serializer@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.0.0.tgz#522c44a332cdd194d8c0531eb06a1ee5afb4256b" - integrity sha512-9FKxQyrFgHtx3ozU+1a8v938ILBE7S8Ko3uiAVjT8Yfi2o91j/fj81jacCQZ/Ihjiff/VsUCXVgQ+iF1XdImOw== +jest-serializer@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.3.0.tgz#074e307300d1451617cf2630d11543ee4f74a1c8" + integrity sha512-RiSpqo2OFbVLJN/PgAOwQIUeHDfss6NBUDTLhjiJM8Bb5rMrwRqHfkaqahIsOf9cXXB5UjcqDCzbQ7AIoMqWkg== -jest-snapshot@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.1.0.tgz#85e22f810357aa5994ab61f236617dc2205f2f5b" - integrity sha512-th6TDfFqEmXvuViacU1ikD7xFb7lQsPn2rJl7OEmnfIVpnrx3QNY2t3PE88meeg0u/mQ0nkyvmC05PBqO4USFA== +jest-snapshot@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.3.0.tgz#00baac770e25df9a6217108dc8a4df59d80aa4aa" + integrity sha512-0zxK7KBX35vwbnQbxdO0tVzIyliWfU5WoE4nU2tMajLH0lSg8+5mgr/6TKHzDB5fWVggXgOI/iMTgsaChEq9tQ== dependencies: "@babel/types" "^7.0.0" + "@jest/types" "^24.3.0" chalk "^2.0.1" - jest-diff "^24.0.0" - jest-matcher-utils "^24.0.0" - jest-message-util "^24.0.0" - jest-resolve "^24.1.0" + expect "^24.3.0" + jest-diff "^24.3.0" + jest-matcher-utils "^24.3.0" + jest-message-util "^24.3.0" + jest-resolve "^24.3.0" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^24.0.0" + pretty-format "^24.3.0" semver "^5.5.0" -jest-util@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.0.0.tgz#fd38fcafd6dedbd0af2944d7a227c0d91b68f7d6" - integrity sha512-QxsALc4wguYS7cfjdQSOr5HTkmjzkHgmZvIDkcmPfl1ib8PNV8QUWLwbKefCudWS0PRKioV+VbQ0oCUPC691fQ== +jest-util@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.3.0.tgz#a549ae9910fedbd4c5912b204bb1bcc122ea0057" + integrity sha512-eKIAC+MTKWZthUUVOwZ3Tc5a0cKMnxalQHr6qZ4kPzKn6k09sKvsmjCygqZ1SxVVfUKoa8Sfn6XDv9uTJ1iXTg== dependencies: + "@jest/console" "^24.3.0" + "@jest/fake-timers" "^24.3.0" + "@jest/source-map" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/node" "*" callsites "^3.0.0" chalk "^2.0.1" graceful-fs "^4.1.15" is-ci "^2.0.0" - jest-message-util "^24.0.0" mkdirp "^0.5.1" slash "^2.0.0" source-map "^0.6.0" @@ -4126,42 +4319,48 @@ jest-validate@^23.5.0: leven "^2.1.0" pretty-format "^23.6.0" -jest-validate@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.0.0.tgz#aa8571a46983a6538328fef20406b4a496b6c020" - integrity sha512-vMrKrTOP4BBFIeOWsjpsDgVXATxCspC9S1gqvbJ3Tnn/b9ACsJmteYeVx9830UMV28Cob1RX55x96Qq3Tfad4g== +jest-validate@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.3.0.tgz#1701990cba3ca8193ec987fea768811e9448cd9f" + integrity sha512-K4p5QrCA6MYacPupnWHrrYiMkeBWD+tXjiO9zoR4+/H1ApjQzYrhdsTzGltlTE0KKdKbpZhxnIJkPVJQ4Z3CkA== dependencies: + "@jest/types" "^24.3.0" camelcase "^5.0.0" chalk "^2.0.1" - jest-get-type "^24.0.0" + jest-get-type "^24.3.0" leven "^2.1.0" - pretty-format "^24.0.0" + pretty-format "^24.3.0" -jest-watcher@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.0.0.tgz#20d44244d10b0b7312410aefd256c1c1eef68890" - integrity sha512-GxkW2QrZ4YxmW1GUWER05McjVDunBlKMFfExu+VsGmXJmpej1saTEKvONdx5RJBlVdpPI5x6E3+EDQSIGgl53g== +jest-watcher@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.3.0.tgz#ee51c6afbe4b35a12fcf1107556db6756d7b9290" + integrity sha512-EpJS/aUG8D3DMuy9XNA4fnkKWy3DQdoWhY92ZUdlETIeEn1xya4Np/96MBSh4II5YvxwKe6JKwbu3Bnzfwa7vA== dependencies: + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/node" "*" + "@types/yargs" "^12.0.9" ansi-escapes "^3.0.0" chalk "^2.0.1" - jest-util "^24.0.0" + jest-util "^24.3.0" string-length "^2.0.0" -jest-worker@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.0.0.tgz#3d3483b077bf04f412f47654a27bba7e947f8b6d" - integrity sha512-s64/OThpfQvoCeHG963MiEZOAAxu8kHsaL/rCMF7lpdzo7vgF0CtPml9hfguOMgykgH/eOm4jFP4ibfHLruytg== +jest-worker@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.3.0.tgz#2e02eea58f8e43d32e5d82e42aa411dee127dc2d" + integrity sha512-gJ5eGnHt73cCpwKGbx0drrVCypgUVINZ5nUAvzD57EUCFc1kzqA0wpPmn4LVWi7mkNeOE36daBbAyWPEmEf+CQ== dependencies: + "@types/node" "*" merge-stream "^1.0.1" supports-color "^6.1.0" -jest@24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.1.0.tgz#b1e1135caefcf2397950ecf7f90e395fde866fd2" - integrity sha512-+q91L65kypqklvlRFfXfdzUKyngQLOcwGhXQaLmVHv+d09LkNXuBuGxlofTFW42XMzu3giIcChchTsCNUjQ78A== +jest@24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.3.0.tgz#e16620880d9ce36b3f9341cd4d2808f85b8f16fd" + integrity sha512-c1EFvnRkTClSj9qcAF3r0UHCf5bpxdGs4+cKJwp53tct6S/ZhSk3NGjjMGBHxm41+6wnJSBl48u6nzIFxoNs9g== dependencies: import-local "^2.0.0" - jest-cli "^24.1.0" + jest-cli "^24.3.0" "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" @@ -4763,11 +4962,6 @@ merge2@^1.2.3: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" integrity sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA== -merge@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" - integrity sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ== - micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -4936,11 +5130,6 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nan@^2.9.2: - version "2.12.1" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552" - integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw== - nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -4963,15 +5152,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -needle@^2.2.1: - version "2.2.4" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.4.tgz#51931bff82533b1928b7d1d69e01f1b00ffd2a4e" - integrity sha512-HyoqEb4wr/rsoaIDfTH2aVL9nWtQqba2/HvMv+++m8u0dz808MaagKILxtfeSN7QU7nvbQ79zk3vYOJp9zsNEA== - dependencies: - debug "^2.1.2" - iconv-lite "^0.4.4" - sax "^1.2.4" - nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -5038,22 +5218,6 @@ node-notifier@^5.2.1: shellwords "^0.1.1" which "^1.3.0" -node-pre-gyp@^0.10.0: - version "0.10.3" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc" - integrity sha512-d1xFs+C/IPS8Id0qPTZ4bUT8wWryfR/OzzAFxweG+uLN85oPzyo2Iw6bVlLQ/JOdgNonXLCoRyqDzDWq4iw72A== - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.1" - needle "^2.2.1" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4" - "nopt@2 || 3": version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" @@ -5061,14 +5225,6 @@ node-pre-gyp@^0.10.0: dependencies: abbrev "1" -nopt@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" - integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= - dependencies: - abbrev "1" - osenv "^0.1.4" - normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5, normalize-package-data@^2.4.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -5120,7 +5276,7 @@ npm-lifecycle@^2.1.0: semver "^5.5.0" validate-npm-package-name "^3.0.0" -npm-packlist@^1.1.12, npm-packlist@^1.1.6: +npm-packlist@^1.1.12: version "1.3.0" resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.3.0.tgz#7f01e8e44408341379ca98cfd756e7b29bd2626c" integrity sha512-qPBc6CnxEzpOcc4bjoIBJbYdy0D/LFFPUdxvfwor4/w3vxeE0h6TiOVurCEPpQ6trjN77u/ShyfeJGsbAfB3dA== @@ -5172,7 +5328,7 @@ npm-which@^3.0.1: npm-path "^2.0.2" which "^1.2.10" -"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.2, npmlog@^4.1.2: +"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== @@ -5316,7 +5472,7 @@ os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@0, osenv@^0.1.4, osenv@^0.1.5: +osenv@0, osenv@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== @@ -5600,7 +5756,7 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= -pirates@^4.0.0: +pirates@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== @@ -5656,11 +5812,12 @@ pretty-format@^23.6.0: ansi-regex "^3.0.0" ansi-styles "^3.2.0" -pretty-format@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.0.0.tgz#cb6599fd73ac088e37ed682f61291e4678f48591" - integrity sha512-LszZaKG665djUcqg5ZQq+XzezHLKrxsA86ZABTozp+oNhkdqa+tG2dX4qa6ERl5c/sRDrAa3lHmwnvKoP+OG/g== +pretty-format@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.3.0.tgz#e7eaefecd28d714fc6425dc2d5f9ed30e1188b26" + integrity sha512-oz+EQc2uda3ql4JluWTWEQgegTo9cMkVcqXxBieSV1opZ4SE1TKuFBDoSk7jGOb08UgwQVHMkVSINB8jQyUFQg== dependencies: + "@jest/types" "^24.3.0" ansi-regex "^4.0.0" ansi-styles "^3.2.0" @@ -5779,16 +5936,6 @@ quick-lru@^1.0.0: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" integrity sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g= -rc@^1.2.7: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - read-cmd-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.1.tgz#2d5d157786a37c055d22077c32c53f8329e91c7b" @@ -5900,7 +6047,7 @@ readdir-scoped-modules@^1.0.0: graceful-fs "^4.1.2" once "^1.3.0" -realpath-native@^1.0.0, realpath-native@^1.0.2: +realpath-native@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" integrity sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA== @@ -6099,7 +6246,7 @@ right-pad@^1.0.1: resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0" integrity sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA= -rimraf@2, rimraf@2.6.3, rimraf@^2.2.8, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: +rimraf@2, rimraf@2.6.3, rimraf@^2.2.8, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -6154,22 +6301,20 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sane@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/sane/-/sane-3.1.0.tgz#995193b7dc1445ef1fe41ddfca2faf9f111854c6" - integrity sha512-G5GClRRxT1cELXfdAq7UKtUsv8q/ZC5k8lQGmjEm4HcAl3HzBy68iglyNCmw4+0tiXPCBZntslHlRhbnsSws+Q== +sane@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.0.3.tgz#e878c3f19e25cc57fbb734602f48f8a97818b181" + integrity sha512-hSLkC+cPHiBQs7LSyXkotC3UUtyn8C4FMn50TNaacRyvBlI+3ebcxMpqckmTdtXVtel87YS7GXN3UIOj7NiGVQ== dependencies: + "@cnakazawa/watch" "^1.0.3" anymatch "^2.0.0" capture-exit "^1.2.0" - exec-sh "^0.2.0" + exec-sh "^0.3.2" execa "^1.0.0" fb-watchman "^2.0.0" micromatch "^3.1.4" minimist "^1.1.1" walker "~1.0.5" - watch "~0.18.0" - optionalDependencies: - fsevents "^1.2.3" sax@^1.2.4: version "1.2.4" @@ -6591,7 +6736,7 @@ strip-indent@^2.0.0: resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g= -strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: +strip-json-comments@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= @@ -6653,7 +6798,7 @@ tar@^2.0.0: fstream "^1.0.2" inherits "2" -tar@^4, tar@^4.4.8: +tar@^4.4.8: version "4.4.8" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.8.tgz#b19eec3fde2a96e64666df9fdb40c5ca1bc3747d" integrity sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ== @@ -6907,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" @@ -7052,14 +7197,6 @@ walker@~1.0.5: dependencies: makeerror "1.0.x" -watch@~0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986" - integrity sha1-KAlUdsbffJDJYxOJkMClQj60uYY= - dependencies: - exec-sh "^0.2.0" - minimist "^1.2.0" - wcwidth@^1.0.0, wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" @@ -7112,7 +7249,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1, which@^1.2.10, which@^1.2.12, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@1, which@^1.2.10, which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==