diff --git a/.codecov.yml b/.codecov.yml
index 119f1a50499c..750d876773d3 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -7,3 +7,7 @@ coverage:
default:
target: auto
threshold: 2%
+comment:
+ layout: diff, flags, files
+ require_changes: true
+
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 000000000000..58fa04212589
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,8 @@
+node_modules
+dist
+jest.config.js
+fixtures
+coverage
+
+packages/typescript-estree/src/estree
+packages/eslint-plugin-tslint/tests
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 000000000000..40a5182652ad
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,75 @@
+{
+ "root": true,
+ "plugins": ["eslint-plugin", "@typescript-eslint", "jest"],
+ "env": {
+ "es6": true,
+ "node": true
+ },
+ "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
+ "rules": {
+ "no-mixed-operators": "error",
+ "no-console": "off",
+ "no-undef": "off",
+ "@typescript-eslint/indent": "off",
+ "@typescript-eslint/no-explicit-any": "off",
+ "@typescript-eslint/no-non-null-assertion": "off",
+ "@typescript-eslint/explicit-function-return-type": "off",
+ "@typescript-eslint/explicit-member-accessibility": "off",
+ "@typescript-eslint/no-var-requires": "off",
+ "@typescript-eslint/no-use-before-define": "off",
+ "@typescript-eslint/no-object-literal-type-assertion": "off",
+ "@typescript-eslint/no-parameter-properties": "off"
+ },
+ "parserOptions": {
+ "sourceType": "module",
+ "ecmaFeatures": {
+ "jsx": false
+ }
+ },
+ "overrides": [
+ {
+ "files": [
+ "packages/eslint-plugin-tslint/tests/**/*.ts",
+ "packages/eslint-plugin/tests/**/*.js",
+ "packages/parser/tests/**/*.ts",
+ "packages/typescript-estree/tests/**/*.ts"
+ ],
+ "env": {
+ "jest/globals": true
+ },
+ "rules": {
+ "jest/no-disabled-tests": "warn",
+ "jest/no-focused-tests": "error",
+ "jest/no-alias-methods": "error",
+ "jest/no-identical-title": "error",
+ "jest/no-jasmine-globals": "error",
+ "jest/no-jest-import": "error",
+ "jest/no-test-prefixes": "error",
+ "jest/no-test-callback": "error",
+ "jest/no-test-return-statement": "error",
+ "jest/prefer-to-have-length": "warn",
+ "jest/prefer-spy-on": "error",
+ "jest/valid-expect": "error"
+ }
+ },
+ {
+ "files": ["packages/eslint-plugin/**/*.js"],
+ "rules": {
+ "eslint-plugin/fixer-return": "error",
+ "eslint-plugin/no-identical-tests": "error",
+ "eslint-plugin/no-missing-placeholders": "error",
+ "eslint-plugin/no-unused-placeholders": "error",
+ "eslint-plugin/no-useless-token-range": "error",
+ "eslint-plugin/require-meta-fixable": "error",
+ "eslint-plugin/prefer-placeholders": "error",
+ "eslint-plugin/prefer-replace-text": "error",
+ "eslint-plugin/no-deprecated-report-api": "error",
+ "eslint-plugin/report-message-format": ["error", "^[A-Z'{].*[\\.}]$"],
+ "eslint-plugin/no-deprecated-context-methods": "error",
+ "eslint-plugin/prefer-output-null": "error",
+ "eslint-plugin/test-case-shorthand-strings": "error",
+ "eslint-plugin/require-meta-type": "error"
+ }
+ }
+ ]
+}
diff --git a/.github/ISSUE_TEMPLATE/eslint-plugin-tslint.md b/.github/ISSUE_TEMPLATE/eslint-plugin-tslint.md
index 45bcc4faea88..313c1880a1ab 100644
--- a/.github/ISSUE_TEMPLATE/eslint-plugin-tslint.md
+++ b/.github/ISSUE_TEMPLATE/eslint-plugin-tslint.md
@@ -1,23 +1,11 @@
---
-name: eslint-plugin-tslint
-about: Report an issue with the eslint-plugin-tslint package
+name: '@typescript-eslint/eslint-plugin-tslint'
+about: Report an issue with the '@typescript-eslint/eslint-plugin-tslint' package
title: ''
-labels: 'package: eslint-plugin-tslint, triage'
+labels: 'package: @typescript-eslint/eslint-plugin-tslint, triage'
assignees: ''
---
-**What version of Node.js and npm are you using?**
-
-- Node:
-- npm:
-
-**What version of the following packages are you using?**
-
-- eslint-plugin-tslint:
-- typescript-eslint-parser:
-- TypeScript:
-- ESLint:
-
**What code were you trying to parse?**
```ts
@@ -27,3 +15,14 @@ assignees: ''
**What did you expect to happen?**
**What actually happened?**
+
+**Versions**
+
+| package | version |
+| ----------------------------------------- | ------- |
+| `@typescript-eslint/eslint-plugin-tslint` | `X.Y.Z` |
+| `@typescript-eslint/parser` | `X.Y.Z` |
+| `TypeScript` | `X.Y.Z` |
+| `ESLint` | `X.Y.Z` |
+| `node` | `X.Y.Z` |
+| `npm` | `X.Y.Z` |
diff --git a/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md b/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md
index 73a267c54343..ddae219da635 100644
--- a/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md
+++ b/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md
@@ -1,6 +1,6 @@
---
-name: eslint-plugin-typescript
-about: Report an issue with the eslint-plugin-typescript package
+name: '@typescript-eslint/eslint-plugin'
+about: Report an issue with the '@typescript-eslint/eslint-plugin' package
title: ''
labels: 'package: eslint-plugin, triage'
assignees: ''
@@ -38,8 +38,11 @@ Please try to avoid code that isn't directly related to the bug, as it makes it
**Versions**
-| package | version |
-| -------------------------- | ------- |
-| `eslint-plugin-typescript` | `X.Y.Z` |
-| `typescript-eslint-parser` | `X.Y.Z` |
-| `typescript` | `X.Y.Z` |
+| package | version |
+| ---------------------------------- | ------- |
+| `@typescript-eslint/eslint-plugin` | `X.Y.Z` |
+| `@typescript-eslint/parser` | `X.Y.Z` |
+| `TypeScript` | `X.Y.Z` |
+| `ESLint` | `X.Y.Z` |
+| `node` | `X.Y.Z` |
+| `npm` | `X.Y.Z` |
diff --git a/.github/ISSUE_TEMPLATE/typescript-eslint-parser.md b/.github/ISSUE_TEMPLATE/typescript-eslint-parser.md
index 21301124a3b6..f0cfe5a1e158 100644
--- a/.github/ISSUE_TEMPLATE/typescript-eslint-parser.md
+++ b/.github/ISSUE_TEMPLATE/typescript-eslint-parser.md
@@ -1,22 +1,11 @@
---
-name: 'typescript-eslint-parser'
-about: Report an issue with the typescript-eslint-parser package
+name: '@typescript-eslint/parser'
+about: Report an issue with the '@typescript-eslint/parser' package
title: ''
labels: 'package: parser, triage'
assignees: ''
---
-**What version of Node.js and npm are you using?**
-
-- Node:
-- npm:
-
-**What version of the following packages are you using?**
-
-- typescript-eslint-parser:
-- TypeScript:
-- ESLint:
-
**What code were you trying to parse?**
```ts
@@ -26,3 +15,13 @@ assignees: ''
**What did you expect to happen?**
**What actually happened?**
+
+**Versions**
+
+| package | version |
+| --------------------------- | ------- |
+| `@typescript-eslint/parser` | `X.Y.Z` |
+| `TypeScript` | `X.Y.Z` |
+| `ESLint` | `X.Y.Z` |
+| `node` | `X.Y.Z` |
+| `npm` | `X.Y.Z` |
diff --git a/.github/ISSUE_TEMPLATE/typescript-estree.md b/.github/ISSUE_TEMPLATE/typescript-estree.md
index 650f84db5142..fc8cca3d9a39 100644
--- a/.github/ISSUE_TEMPLATE/typescript-estree.md
+++ b/.github/ISSUE_TEMPLATE/typescript-estree.md
@@ -1,15 +1,11 @@
---
-name: typescript-estree
-about: Report an issue with the `typescript-estree` package
+name: '@typescript-eslint/typescript-estree'
+about: Report an issue with the `@typescript-eslint/typescript-estree` package
title: ''
labels: 'package: typescript-estree, triage'
assignees: ''
---
-**What version of TypeScript are you using?**
-
-**What version of `typescript-estree` are you using?**
-
**What code were you trying to parse?**
```ts
@@ -19,3 +15,12 @@ assignees: ''
**What did you expect to happen?**
**What actually happened?**
+
+**Versions**
+
+| package | version |
+| -------------------------------------- | ------- |
+| `@typescript-eslint/typescript-estree` | `X.Y.Z` |
+| `TypeScript` | `X.Y.Z` |
+| `node` | `X.Y.Z` |
+| `npm` | `X.Y.Z` |
diff --git a/.gitignore b/.gitignore
index 213ae9c36aa4..41847c7fd604 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,6 +61,5 @@ typings/
.next
.DS_Store
-.vscode
.idea
dist
diff --git a/.huskyrc b/.huskyrc
new file mode 100644
index 000000000000..a3f3f7002ed4
--- /dev/null
+++ b/.huskyrc
@@ -0,0 +1,8 @@
+{
+ "hooks": {
+ "pre-commit": [
+ "yarn test && lint-staged"
+ ],
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
+ }
+}
diff --git a/.lintstagedrc b/.lintstagedrc
new file mode 100644
index 000000000000..889b734ac28f
--- /dev/null
+++ b/.lintstagedrc
@@ -0,0 +1,6 @@
+{
+ "*.{ts,js,json,md}": [
+ "prettier --write",
+ "git add"
+ ]
+}
diff --git a/.prettierignore b/.prettierignore
index 21ee8e970ee5..49b3a61e6d8f 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,7 +1,7 @@
**/tests/fixtures/**/*
**/dist
**/coverage
-**/typescript-eslint-shared-fixtures
+**/shared-fixtures
**/tests/integration/fixtures/**/*
**/lib/configs/recommended.json
**/.vscode
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 15d701f55054..000000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-sudo: required
-services:
- - docker
-language: node_js
-cache:
- yarn: true
- directories:
- - node_modules
-notifications:
- email: false
-node_js:
- - '11'
- - '10'
- - '9'
- - '8'
- - '6'
-install:
- - yarn --ignore-engines
-script:
- - commitlint-travis
- - yarn check-format
- - yarn workspace eslint-plugin-typescript docs:check
- - yarn build
- - yarn test
- - yarn integration-tests
- - yarn global add codecov
-after_success:
- - codecov
-branches:
- only:
- - master
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 000000000000..0a2e1c827047
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,8 @@
+{
+ "recommendations": [
+ "esbenp.prettier-vscode",
+ "dbaeumer.vscode-eslint",
+ "editorconfig.editorconfig"
+ ],
+ "unwantedRecommendations": ["hookyqr.beautify", "dbaeumer.jshint"]
+}
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 000000000000..4ac7bc13cdd0
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,21 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "node",
+ "request": "launch",
+ "name": "Jest Test Current eslint-plugin Rule",
+ "cwd": "${workspaceFolder}/packages/eslint-plugin/",
+ "program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
+ "args": [
+ "--colors",
+ "tests/lib/rules/${fileBasename}"
+ ],
+ "console": "integratedTerminal",
+ "internalConsoleOptions": "neverOpen"
+ }
+ ]
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000000000000..adcf2422e8f3
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,26 @@
+
+{
+ // An array of language ids which should be validated by ESLint
+ "eslint.validate": [
+ "javascript",
+ "javascriptreact",
+ {
+ "language": "typescript",
+ "autoFix": true
+ },
+ {
+ "language": "typescriptreact",
+ "autoFix": true
+ }
+ ],
+
+ // When enabled, will trim trailing whitespace when saving a file.
+ "files.trimTrailingWhitespace": true,
+
+ // typescript auto-format settings
+ "typescript.tsdk": "node_modules/typescript/lib",
+ "javascript.preferences.importModuleSpecifier": "auto",
+ "typescript.preferences.importModuleSpecifier": "auto",
+ "javascript.preferences.quoteStyle": "single",
+ "typescript.preferences.quoteStyle": "single"
+}
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 000000000000..ee67cc587fb7
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,78 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+# [1.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.2.0...v1.3.0) (2019-02-07)
+
+### Bug Fixes
+
+- **eslint-plugin:** fix false positive from adjacent-overload-signatures ([#206](https://github.com/typescript-eslint/typescript-eslint/issues/206)) ([07e950e](https://github.com/typescript-eslint/typescript-eslint/commit/07e950e))
+- **ts-estree:** align typeArguments and typeParameters across nodes ([#223](https://github.com/typescript-eslint/typescript-eslint/issues/223)) ([3306198](https://github.com/typescript-eslint/typescript-eslint/commit/3306198))
+- **ts-estree:** convert decorators on var and fn decs ([#211](https://github.com/typescript-eslint/typescript-eslint/issues/211)) ([0a1777f](https://github.com/typescript-eslint/typescript-eslint/commit/0a1777f))
+- **ts-estree:** fix issues with typeParams in FunctionExpression ([#208](https://github.com/typescript-eslint/typescript-eslint/issues/208)) ([d4dfa3b](https://github.com/typescript-eslint/typescript-eslint/commit/d4dfa3b))
+
+### Features
+
+- change TypeScript version range to >=3.2.1 <3.4.0 ([#184](https://github.com/typescript-eslint/typescript-eslint/issues/184)) ([f513a14](https://github.com/typescript-eslint/typescript-eslint/commit/f513a14))
+- **eslint-plugin:** add new rule no-for-in-array ([#155](https://github.com/typescript-eslint/typescript-eslint/issues/155)) ([84162ba](https://github.com/typescript-eslint/typescript-eslint/commit/84162ba))
+- **eslint-plugin:** add new rule no-require-imports ([#199](https://github.com/typescript-eslint/typescript-eslint/issues/199)) ([683e5bc](https://github.com/typescript-eslint/typescript-eslint/commit/683e5bc))
+- **eslint-plugin:** added new rule promise-function-async ([#194](https://github.com/typescript-eslint/typescript-eslint/issues/194)) ([5f3aec9](https://github.com/typescript-eslint/typescript-eslint/commit/5f3aec9))
+- **ts-estree:** enable errors 1098 and 1099 ([#219](https://github.com/typescript-eslint/typescript-eslint/issues/219)) ([fc50167](https://github.com/typescript-eslint/typescript-eslint/commit/fc50167))
+
+# [1.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.1...v1.2.0) (2019-02-01)
+
+### Bug Fixes
+
+- **eslint-plugin:** fix no-extraneous-class for class without name ([#174](https://github.com/typescript-eslint/typescript-eslint/issues/174)) ([b1dbb64](https://github.com/typescript-eslint/typescript-eslint/commit/b1dbb64))
+- **eslint-plugin:** fix wrong URL ([#180](https://github.com/typescript-eslint/typescript-eslint/issues/180)) ([00d020d](https://github.com/typescript-eslint/typescript-eslint/commit/00d020d))
+- **eslint-plugin:** use bracket for infer type in array-type rule ([#173](https://github.com/typescript-eslint/typescript-eslint/issues/173)) ([1f868ce](https://github.com/typescript-eslint/typescript-eslint/commit/1f868ce))
+- **parser:** fix regression with no-unused-vars for jsx attributes ([#161](https://github.com/typescript-eslint/typescript-eslint/issues/161)) ([6147de1](https://github.com/typescript-eslint/typescript-eslint/commit/6147de1))
+
+### Features
+
+- **eslint-plugin:** add eslint rule no-useless-constructor ([#167](https://github.com/typescript-eslint/typescript-eslint/issues/167)) ([3fb57a5](https://github.com/typescript-eslint/typescript-eslint/commit/3fb57a5))
+- **eslint-plugin:** add no-unnecessary-type-assertion rule ([#157](https://github.com/typescript-eslint/typescript-eslint/issues/157)) ([38abc28](https://github.com/typescript-eslint/typescript-eslint/commit/38abc28))
+
+## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29)
+
+### Bug Fixes
+
+- **eslint-plugin:** make parser services error clearer ([#132](https://github.com/typescript-eslint/typescript-eslint/issues/132)) ([aa9d1e1](https://github.com/typescript-eslint/typescript-eslint/commit/aa9d1e1))
+- **parser:** add visiting of type parameters in JSXOpeningElement ([#150](https://github.com/typescript-eslint/typescript-eslint/issues/150)) ([5e16003](https://github.com/typescript-eslint/typescript-eslint/commit/5e16003))
+- **ts-estree:** expand optional property to include question token ([#138](https://github.com/typescript-eslint/typescript-eslint/issues/138)) ([9068b62](https://github.com/typescript-eslint/typescript-eslint/commit/9068b62))
+
+### Performance Improvements
+
+- **ts-estree:** don't create Program in parse() ([#148](https://github.com/typescript-eslint/typescript-eslint/issues/148)) ([aacf5b0](https://github.com/typescript-eslint/typescript-eslint/commit/aacf5b0))
+
+# [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23)
+
+### Bug Fixes
+
+- **eslint-plugin:** don’t mark `declare class` as unused ([#110](https://github.com/typescript-eslint/typescript-eslint/issues/110)) ([5841cd2](https://github.com/typescript-eslint/typescript-eslint/commit/5841cd2)), closes [#106](https://github.com/typescript-eslint/typescript-eslint/issues/106)
+- **eslint-plugin:** improve detection of used vars in heritage ([#102](https://github.com/typescript-eslint/typescript-eslint/issues/102)) ([193b434](https://github.com/typescript-eslint/typescript-eslint/commit/193b434))
+- **typescript-estree:** correct range of parameters with comments ([#128](https://github.com/typescript-eslint/typescript-eslint/issues/128)) ([91eedf2](https://github.com/typescript-eslint/typescript-eslint/commit/91eedf2))
+- **typescript-estree:** fix range of assignment in parameter ([#115](https://github.com/typescript-eslint/typescript-eslint/issues/115)) ([4e781f1](https://github.com/typescript-eslint/typescript-eslint/commit/4e781f1))
+
+### Features
+
+- **eslint-plugin:** add new rule restrict-plus-operands ([#70](https://github.com/typescript-eslint/typescript-eslint/issues/70)) ([c541ede](https://github.com/typescript-eslint/typescript-eslint/commit/c541ede))
+- **eslint-plugin:** add option to no-object-literal-type-assertion rule ([#87](https://github.com/typescript-eslint/typescript-eslint/issues/87)) ([9f501a1](https://github.com/typescript-eslint/typescript-eslint/commit/9f501a1))
+
+# [1.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.1...v1.0.0) (2019-01-20)
+
+### Bug Fixes
+
+- **eslint-plugin:** fix crash in rule indent for eslint 5.12.1 ([#89](https://github.com/typescript-eslint/typescript-eslint/issues/89)) ([3f51d51](https://github.com/typescript-eslint/typescript-eslint/commit/3f51d51))
+- **eslint-plugin:** no-unused-vars: mark declared statements as used ([#88](https://github.com/typescript-eslint/typescript-eslint/issues/88)) ([2df5e0c](https://github.com/typescript-eslint/typescript-eslint/commit/2df5e0c))
+- **eslint-plugin:** update remaining parser refs ([#97](https://github.com/typescript-eslint/typescript-eslint/issues/97)) ([055c3fc](https://github.com/typescript-eslint/typescript-eslint/commit/055c3fc))
+
+### Features
+
+- **eslint-plugin:** remove exported parser ([#94](https://github.com/typescript-eslint/typescript-eslint/issues/94)) ([0ddb93c](https://github.com/typescript-eslint/typescript-eslint/commit/0ddb93c))
+- **parser:** support ecmaFeatures.jsx flag and tests ([#85](https://github.com/typescript-eslint/typescript-eslint/issues/85)) ([b321736](https://github.com/typescript-eslint/typescript-eslint/commit/b321736))
+
+## [0.2.1](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.0...v0.2.1) (2019-01-20)
+
+**Note:** Version bump only for package @typescript-eslint/typescript-eslint
diff --git a/README.md b/README.md
index 19ff42e897fc..fb5dbbcababd 100644
--- a/README.md
+++ b/README.md
@@ -3,10 +3,10 @@
Monorepo for all the tooling which enables ESLint to support TypeScript
-
+
-
-
+
+
@@ -16,23 +16,39 @@
This repo contains several packages which allow ESLint users to lint their TypeScript code.
-- [`typescript-estree`](./packages/typescript-estree/) - An entirely generic TypeScript parser which takes TypeScript source code and produces an ESTree -compatible AST
+- [`@typescript-eslint/typescript-estree`](./packages/typescript-estree/) - An entirely generic TypeScript parser which takes TypeScript source code and produces an ESTree -compatible AST
- This package is also used to power the amazing opinionated code formatter [Prettier](https://prettier.io)'s own TypeScript use-case.
-- [`typescript-eslint-parser`](./packages/typescript-eslint-parser/) - An ESLint-specific parser which leverages `typescript-estree` and is designed to be used as a replacement for ESLint's default parser, `espree`.
+- [`@typescript-eslint/parser`](./packages/parser/) - An ESLint-specific parser which leverages `typescript-estree` and is designed to be used as a replacement for ESLint's default parser, `espree`.
-- [`eslint-plugin-typescript`](./packages/eslint-plugin-typescript/) - An ESLint-specific plugin which, when used in conjunction with `typescript-eslint-parser`, allows for TypeScript-specific linting rules to run.
+- [`@typescript-eslint/eslint-plugin`](./packages/eslint-plugin/) - An ESLint-specific plugin which, when used in conjunction with `@typescript-eslint/parser`, allows for TypeScript-specific linting rules to run.
-- [`eslint-plugin-tslint`](./packages/eslint-plugin-tslint) - An ESLint-specific plugin which runs an instance of TSLint within your ESLint setup to allow for users to more easily migrate from TSLint to ESLint.
+- [`@typescript-eslint/eslint-plugin-tslint`](./packages/eslint-plugin-tslint) - An ESLint-specific plugin which runs an instance of TSLint within your ESLint setup to allow for users to more easily migrate from TSLint to ESLint.
+
+## Package Versions
+
+All of the packages are published with the same version number to make it easier to coordinate both releases and installations.
+
+Additionally, we also publish a canary release on every successful merge to master, so you never need to wait for a new stable version to make use of any updates.
+
+The `latest` (stable) version is:
+
+
+
+The `canary` (latest master) version is:
+
+
## Supported TypeScript Version
-We will always endeavor to support the latest stable version of TypeScript.
+We will always endeavor to support the latest stable version of TypeScript. Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript.
+
+**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.4.0`.**
-The version of TypeScript currently supported by this parser is `~3.2.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.
+This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.
-If you use a non-supported version of TypeScript, the parser will log a warning to the console.
+If you use a non-supported version of TypeScript, the parser will log a warning to the console. If you want to disable this warning, you can configure this in your `parserOptions`. See: [`@typescript-eslint/parser`](./packages/parser/) and [`@typescript-eslint/typescript-estree`](./packages/typescript-estree/).
**Please ensure that you are using a supported version before submitting any issues/bug reports.**
@@ -42,4 +58,4 @@ COMING SOON!
## License
-TypeScript ESTree 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.
+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.
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 000000000000..805b5c0a1ee9
--- /dev/null
+++ b/azure-pipelines.yml
@@ -0,0 +1,92 @@
+trigger:
+ - master
+
+jobs:
+ - job: primary_code_validation_and_tests
+ displayName: Primary code validation and tests
+ pool:
+ vmImage: 'Ubuntu-16.04'
+ steps:
+ - task: NodeTool@0
+ inputs:
+ versionSpec: 11
+ displayName: 'Install Node.js 11'
+
+ - script: |
+ # This also runs a build as part of the postinstall
+ # bootstrap
+ yarn --ignore-engines --frozen-lockfile
+
+ - script: |
+ yarn check-format
+ displayName: 'Check code formatting'
+
+ - script: |
+ yarn lint
+ displayName: 'Run linting'
+
+ - script: |
+ yarn test
+ displayName: 'Run unit tests'
+
+ - script: |
+ yarn integration-tests
+ displayName: 'Run integrations tests'
+
+ - script: |
+ npx codecov -t $(CODECOV_TOKEN)
+ displayName: 'Publish code coverage report'
+
+ - job: unit_tests_on_other_node_versions
+ displayName: Run unit tests on other Node.js versions
+ pool:
+ vmImage: 'Ubuntu-16.04'
+ strategy:
+ maxParallel: 3
+ matrix:
+ node_10_x:
+ node_version: 10.x
+ node_8_x:
+ node_version: 8.x
+ node_6_x:
+ node_version: 6.x
+ steps:
+ - task: NodeTool@0
+ inputs:
+ versionSpec: $(node_version)
+ displayName: 'Install Node.js $(node_version)'
+
+ - script: |
+ # This also runs a build as part of the postinstall
+ # bootstrap
+ yarn --ignore-engines --frozen-lockfile
+
+ - script: |
+ yarn test
+ displayName: 'Run unit tests'
+
+ - job: publish_canary_version
+ displayName: Publish the latest code as a canary version
+ dependsOn:
+ - primary_code_validation_and_tests
+ - unit_tests_on_other_node_versions
+ condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'), ne(variables['Build.Reason'], 'PullRequest'))
+ pool:
+ vmImage: 'Ubuntu-16.04'
+ steps:
+ - task: NodeTool@0
+ inputs:
+ versionSpec: 11
+ displayName: 'Install Node.js 11'
+
+ - script: |
+ # This also runs a build as part of the postinstall
+ # bootstrap
+ yarn --ignore-engines --frozen-lockfile
+
+ - script: |
+ npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN)
+
+ - script: |
+ npx lerna publish --canary --exact --force-publish --yes
+ displayName: 'Publish all packages to npm'
diff --git a/lerna.json b/lerna.json
index a3794ba26608..ba8df5d99378 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
{
- "version": "0.0.0",
+ "version": "1.3.0",
"npmClient": "yarn",
"useWorkspaces": true,
"stream": true
diff --git a/package.json b/package.json
index 4b0fbbeebba4..301ec05cfdf1 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "typescript-eslint",
+ "name": "@typescript-eslint/typescript-eslint",
"private": true,
"workspaces": [
"packages/*"
@@ -21,20 +21,14 @@
"test": "lerna run test --parallel",
"build": "lerna run build",
"clean": "lerna clean && lerna run clean",
- "precommit": "yarn test && lint-staged",
+ "lint": "eslint . --ext .js,.ts",
+ "lint-fix": "eslint . --ext .js,.ts --fix",
"cz": "git-cz",
- "commitmsg": "commitlint -E GIT_PARAMS",
"check-format": "prettier --list-different \"./**/*.{ts,js,json,md}\"",
"format": "prettier --write \"./**/*.{ts,js,json,md}\"",
"integration-tests": "docker-compose -f tests/integration/docker-compose.yml up",
"kill-integration-test-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local"
},
- "lint-staged": {
- "*.{ts,js,json,md}": [
- "prettier --write",
- "git add"
- ]
- },
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
@@ -50,7 +44,7 @@
},
"devDependencies": {
"@babel/code-frame": "7.0.0",
- "@babel/parser": "7.2.3",
+ "@babel/parser": "7.3.2",
"@commitlint/cli": "^7.1.2",
"@commitlint/config-conventional": "^7.1.2",
"@commitlint/travis-cli": "^7.1.2",
@@ -62,16 +56,19 @@
"@types/node": "^10.12.2",
"@types/semver": "^5.5.0",
"cz-conventional-changelog": "2.1.0",
- "eslint": "^4.19.1",
+ "eslint": "^5.12.1",
+ "eslint-plugin-eslint-plugin": "^2.0.1",
+ "eslint-plugin-jest": "^22.2.2",
"glob": "7.1.2",
- "husky": "0.14.3",
+ "husky": "^1.3.1",
"jest": "23.6.0",
"lerna": "^3.10.5",
- "lint-staged": "7.3.0",
+ "lint-staged": "8.1.0",
"lodash.isplainobject": "4.0.6",
"prettier": "^1.14.3",
"rimraf": "^2.6.3",
"ts-jest": "^23.10.4",
- "typescript": "~3.2.1"
+ "tslint": "^5.11.0",
+ "typescript": ">=3.2.1 <3.4.0"
}
}
diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md
index 762c01b51ef9..20c017da22b5 100644
--- a/packages/eslint-plugin-tslint/CHANGELOG.md
+++ b/packages/eslint-plugin-tslint/CHANGELOG.md
@@ -1,27 +1,28 @@
-# [3.1.0](https://github.com/JamesHenry/eslint-plugin-tslint/compare/v3.0.0...v3.1.0) (2018-10-19)
+# Change Log
-### Bug Fixes
+All notable changes to this project will be documented in this file.
+See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
-- Tiny lint note elimination ([a731838](https://github.com/JamesHenry/eslint-plugin-tslint/commit/a731838))
+# [1.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.2.0...v1.3.0) (2019-02-07)
-### Features
+**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
-- Support for tslint property ([18a4afb](https://github.com/JamesHenry/eslint-plugin-tslint/commit/18a4afb)), closes [#40](https://github.com/JamesHenry/eslint-plugin-tslint/issues/40)
+# [1.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.1...v1.2.0) (2019-02-01)
-# [3.0.0](https://github.com/JamesHenry/eslint-plugin-tslint/compare/v2.1.0...v3.0.0) (2018-09-09)
+**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
-### Bug Fixes
+## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29)
-- Fixed bug when file not defined in tsconfig ([20b498b](https://github.com/JamesHenry/eslint-plugin-tslint/commit/20b498b))
-- Pass sourceText parameter to service getSource ([dd4c2f8](https://github.com/JamesHenry/eslint-plugin-tslint/commit/dd4c2f8))
-- Update program when sourceFile was updated ([0fe933c](https://github.com/JamesHenry/eslint-plugin-tslint/commit/0fe933c))
-- Updated typescript-service dependency ([2f4f434](https://github.com/JamesHenry/eslint-plugin-tslint/commit/2f4f434))
+**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
-### Features
+# [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23)
-- **core:** Added support rules requires type information ([6bc1deb](https://github.com/JamesHenry/eslint-plugin-tslint/commit/6bc1deb)), closes [#32](https://github.com/JamesHenry/eslint-plugin-tslint/issues/32) [#34](https://github.com/JamesHenry/eslint-plugin-tslint/issues/34)
-- Post merge adapdation from tslint2 repository ([477c656](https://github.com/JamesHenry/eslint-plugin-tslint/commit/477c656)), closes [#32](https://github.com/JamesHenry/eslint-plugin-tslint/issues/32) [#34](https://github.com/JamesHenry/eslint-plugin-tslint/issues/34)
+**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
-### BREAKING CHANGES
+# [1.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.1...v1.0.0) (2019-01-20)
-- New dependency
+**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
+
+## [0.2.1](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.0...v0.2.1) (2019-01-20)
+
+**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
diff --git a/packages/eslint-plugin-tslint/README.md b/packages/eslint-plugin-tslint/README.md
index 388238b6a5fc..7eed5033dfbb 100644
--- a/packages/eslint-plugin-tslint/README.md
+++ b/packages/eslint-plugin-tslint/README.md
@@ -1,43 +1,49 @@
-# ESLint Plugin TSLint
+ESLint Plugin TSLint
-[](https://travis-ci.org/JamesHenry/eslint-plugin-tslint)
-[](https://github.com/JamesHenry/eslint-plugin-tslint/blob/master/LICENSE)
-[](https://www.npmjs.com/package/eslint-plugin-tslint)
-[](https://www.npmjs.com/package/eslint-plugin-tslint)
-[](http://commitizen.github.io/cz-cli/)
-[](https://github.com/semantic-release/semantic-release)
-[](https://greenkeeper.io)
+ESLint plugin wraps a TSLint configuration and lints the whole source using TSLint.
-ESLint plugin wraps a TSLint configuration and lints the whole source using TSLint.
+
+
+
+
+
+
+
-## INSTALL
+## Installation
-```
-npm i -D eslint-plugin-tslint
+```sh
+npm i @typescript-eslint/eslint-plugin-tslint --save-dev
```
-## USAGE
+## Usage
Configure in your eslint config file:
-```
-"plugins": [
- "tslint"
-],
-"rules": {
- "tslint/config": ["warn", {
- lintFile: '/* path to tslint.json of your project */',
- rules: { /* tslint rules (will be used if `lintFile` is not specified) */ },
- rulesDirectory: [ /* array of paths to directories with rules, e.g. 'node_modules/tslint/lib/rules' (will be used if `lintFile` is not specified) */ ]
+```js
+{
+ "plugins": [
+ "@typescript-eslint/tslint"
+ ],
+ "rules": {
+ "@typescript-eslint/tslint/config": ["warn", {
+ "lintFile": '', // path to tslint.json of your project
+ "rules": {
+ // tslint rules (will be used if `lintFile` is not specified)
+ },
+ "rulesDirectory": [
+ // array of paths to directories with rules, e.g. 'node_modules/tslint/lib/rules' (will be used if `lintFile` is not specified)
+ ]
}],
+ }
}
```
-## RULES
+## Rules
-Plugin contains only single rule `tslint/config`.
+Plugin contains only single rule `@typescript-eslint/tslint/config`.
-## EXAMPLES
+## Examples
- [unlight/node-package-starter/.eslintrc.js](https://github.com/unlight/node-package-starter/blob/master/.eslintrc.js)
diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json
index 3ffb8277614c..c69652e9c659 100644
--- a/packages/eslint-plugin-tslint/package.json
+++ b/packages/eslint-plugin-tslint/package.json
@@ -1,6 +1,6 @@
{
- "name": "eslint-plugin-tslint",
- "version": "3.1.0",
+ "name": "@typescript-eslint/eslint-plugin-tslint",
+ "version": "1.3.0",
"main": "dist/index.js",
"typings": "src/index.ts",
"description": "TSLint wrapper plugin for ESLint",
@@ -11,7 +11,7 @@
"tslint"
],
"engines": {
- "node": ">=6"
+ "node": "^6.14.0 || ^8.10.0 || >=9.10.0"
},
"repository": "typescript-eslint/typescript-eslint",
"bugs": {
@@ -28,12 +28,12 @@
"lodash.memoize": "^4.1.2"
},
"peerDependencies": {
+ "eslint": "^5.0.0",
"tslint": "^5.0.0"
},
"devDependencies": {
"@types/eslint": "^4.16.3",
"@types/lodash.memoize": "^4.1.4",
- "typescript-eslint-parser": "21.0.2",
- "tslint": "^5.11.0"
+ "@typescript-eslint/parser": "1.3.0"
}
}
diff --git a/packages/eslint-plugin-tslint/src/index.ts b/packages/eslint-plugin-tslint/src/index.ts
index 72d476b3b886..f2ae0e55efd3 100644
--- a/packages/eslint-plugin-tslint/src/index.ts
+++ b/packages/eslint-plugin-tslint/src/index.ts
@@ -3,20 +3,12 @@ import memoize from 'lodash.memoize';
import { Configuration, RuleSeverity } from 'tslint';
import { Program } from 'typescript';
import { CustomLinter } from './custom-linter';
+import { ParserServices } from '@typescript-eslint/typescript-estree';
//------------------------------------------------------------------------------
// Plugin Definition
//------------------------------------------------------------------------------
-/**
- * @todo share types between packages
- */
-interface ParserServices {
- program: Program | undefined;
- esTreeNodeToTSNodeMap: WeakMap | undefined;
- tsNodeToESTreeNodeMap: WeakMap | undefined;
-}
-
type RawRuleConfig =
| null
| undefined
@@ -98,11 +90,11 @@ export const rules = {
/**
* The user needs to have configured "project" in their parserOptions
- * for typescript-eslint-parser
+ * for @typescript-eslint/parser
*/
if (!parserServices || !parserServices.program) {
throw new Error(
- `You must provide a value for the "parserOptions.project" property for typescript-eslint-parser`
+ `You must provide a value for the "parserOptions.project" property for @typescript-eslint/parser`
);
}
diff --git a/packages/eslint-plugin-tslint/tests/index.spec.ts b/packages/eslint-plugin-tslint/tests/index.spec.ts
index 4b8394d20f03..8232a16ec21c 100644
--- a/packages/eslint-plugin-tslint/tests/index.spec.ts
+++ b/packages/eslint-plugin-tslint/tests/index.spec.ts
@@ -2,18 +2,19 @@ import { rules } from '../src/index';
import { RuleTester } from 'eslint';
import { readFileSync } from 'fs';
-const ruleTester = new RuleTester();
-
-const parserOptions: any = {
- ecmaVersion: 6,
- sourceType: 'module',
- ecmaFeatures: {},
- /**
- * Project is needed to generate the parserServices
- * within typescript-eslint-parser
- */
- project: './tests/tsconfig.json'
-};
+const ruleTester = new RuleTester({
+ parserOptions: {
+ ecmaVersion: 6,
+ sourceType: 'module',
+ ecmaFeatures: {},
+ /**
+ * Project is needed to generate the parserServices
+ * within @typescript-eslint/parser
+ */
+ project: './tests/tsconfig.json'
+ },
+ parser: '@typescript-eslint/parser'
+});
/**
* Inline rules should be supported
@@ -40,8 +41,6 @@ ruleTester.run('tslint/config', rules.config, {
valid: [
{
code: 'var foo = true;',
- parser: 'typescript-eslint-parser',
- parserOptions,
options: [tslintRulesConfig]
},
{
@@ -50,9 +49,7 @@ ruleTester.run('tslint/config', rules.config, {
/\n/g,
' '
),
- parser: 'typescript-eslint-parser',
parserOptions: {
- ...parserOptions,
project: `${__dirname}/test-project/tsconfig.json`
},
options: [
@@ -63,8 +60,6 @@ ruleTester.run('tslint/config', rules.config, {
},
{
code: 'throw "should be ok because rule is not loaded";',
- parser: 'typescript-eslint-parser',
- parserOptions,
options: [tslintRulesConfig]
}
],
@@ -72,8 +67,6 @@ ruleTester.run('tslint/config', rules.config, {
invalid: [
{
options: [{ lintFile: './tests/test-project/tslint.json' }],
- parser: 'typescript-eslint-parser',
- parserOptions,
code: 'throw "err" // no-string-throw',
errors: [
{
@@ -84,8 +77,6 @@ ruleTester.run('tslint/config', rules.config, {
},
{
code: 'var foo = true // semicolon',
- parser: 'typescript-eslint-parser',
- parserOptions,
options: [tslintRulesConfig],
output: 'var foo = true // semicolon',
errors: [
@@ -98,8 +89,6 @@ ruleTester.run('tslint/config', rules.config, {
},
{
code: 'var foo = true // fail',
- parser: 'typescript-eslint-parser',
- parserOptions,
options: [tslintRulesDirectoryConfig],
output: 'var foo = true // fail',
errors: [
@@ -116,9 +105,7 @@ ruleTester.run('tslint/config', rules.config, {
/\n/g,
' '
),
- parser: 'typescript-eslint-parser',
parserOptions: {
- ...parserOptions,
project: `${__dirname}/test-project/tsconfig.json`
},
options: [
diff --git a/packages/eslint-plugin-typescript/README.md b/packages/eslint-plugin-typescript/README.md
deleted file mode 100644
index 94306e30dcef..000000000000
--- a/packages/eslint-plugin-typescript/README.md
+++ /dev/null
@@ -1,111 +0,0 @@
-# eslint-plugin-typescript
-
-[](https://www.npmjs.com/package/eslint-plugin-typescript)
-[](https://www.npmjs.com/package/eslint-plugin-typescript)
-[](https://travis-ci.com/bradzacher/eslint-plugin-typescript)
-
-TypeScript support for ESLint. (This is still in the very early stages, so please be patient.)
-
-### The below readme is for the upcoming 1.0.0 release. [Please see this tag for the current NPM version (0.14.0)](https://github.com/bradzacher/eslint-plugin-typescript/tree/0.14.0)
-
-## Installation
-
-You'll first need to install [ESLint](http://eslint.org):
-
-```shellsession
-$ npm i eslint --save-dev
-```
-
-Next, install `typescript` if you haven’t already:
-
-```shellsession
-$ npm i typescript@~3.1.1 --save-dev
-```
-
-Last, install `eslint-plugin-typescript`:
-
-```shellsession
-$ npm install eslint-plugin-typescript --save-dev
-```
-
-**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-typescript` globally.
-
-## Usage
-
-Add `eslint-plugin-typescript/parser` to the `parser` field and `typescript` to the plugins section of your `.eslintrc` configuration file:
-
-```json
-{
- "parser": "eslint-plugin-typescript/parser",
- "plugins": ["typescript"]
-}
-```
-
-Note: The plugin provides its own version of the `typescript-eslint-parser` via `eslint-plugin-typescript/parser`.
-This helps us guarantee 100% compatibility between the plugin and the parser.
-
-Then configure the rules you want to use under the rules section.
-
-```json
-{
- "parser": "eslint-plugin-typescript/parser",
- "plugins": ["typescript"],
- "rules": {
- "typescript/rule-name": "error"
- }
-}
-```
-
-You can also enable all the recommended rules at once. Add `plugin:typescript/recommended` in extends:
-
-```json
-{
- "extends": ["plugin:typescript/recommended"]
-}
-```
-
-## Supported Rules
-
-
-
-
-**Key**: :heavy_check_mark: = recommended, :wrench: = fixable
-
-
-| Name | Description | :heavy_check_mark: | :wrench: |
-| ---- | ----------- | ------------------ | -------- |
-| [`typescript/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive (`adjacent-overload-signatures` from TSLint) | :heavy_check_mark: | |
-| [`typescript/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays (`array-type` from TSLint) | :heavy_check_mark: | :wrench: |
-| [`typescript/ban-types`](./docs/rules/ban-types.md) | Enforces that types will not to be used (`ban-types` from TSLint) | :heavy_check_mark: | :wrench: |
-| [`typescript/camelcase`](./docs/rules/camelcase.md) | Enforce camelCase naming convention | :heavy_check_mark: | |
-| [`typescript/class-name-casing`](./docs/rules/class-name-casing.md) | Require PascalCased class and interface names (`class-name` from TSLint) | :heavy_check_mark: | |
-| [`typescript/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | :heavy_check_mark: | |
-| [`typescript/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/generic-type-naming`](./docs/rules/generic-type-naming.md) | Enforces naming of generic type variables | | |
-| [`typescript/indent`](./docs/rules/indent.md) | Enforce consistent indentation (`indent` from TSLint) | :heavy_check_mark: | :wrench: |
-| [`typescript/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/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/member-naming`](./docs/rules/member-naming.md) | Enforces naming conventions for class members by visibility. | | |
-| [`typescript/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order (`member-ordering` from TSLint) | | |
-| [`typescript/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/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: |
-| [`typescript/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces (`no-empty-interface` from TSLint) | :heavy_check_mark: | |
-| [`typescript/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type (`no-any` from TSLint) | :heavy_check_mark: | |
-| [`typescript/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces (`no-unnecessary-class` from TSLint) | | |
-| [`typescript/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/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/no-namespace`](./docs/rules/no-namespace.md) | Disallow the use of custom TypeScript modules and namespaces (`no-namespace` from TSLint) | :heavy_check_mark: | |
-| [`typescript/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/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/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/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` (`no-this-assignment` from TSLint) | | |
-| [`typescript/no-triple-slash-reference`](./docs/rules/no-triple-slash-reference.md) | Disallow `/// ` comments (`no-reference` from TSLint) | :heavy_check_mark: | |
-| [`typescript/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases (`interface-over-type-literal` from TSLint) | | |
-| [`typescript/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables (`no-unused-variable` from TSLint) | :heavy_check_mark: | |
-| [`typescript/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | :heavy_check_mark: | |
-| [`typescript/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/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/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/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations (`typedef-whitespace` from TSLint) | :heavy_check_mark: | :wrench: |
-
-
diff --git a/packages/eslint-plugin-typescript/lib/configs/recommended.json b/packages/eslint-plugin-typescript/lib/configs/recommended.json
deleted file mode 100644
index 44d970341802..000000000000
--- a/packages/eslint-plugin-typescript/lib/configs/recommended.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "parser": "eslint-plugin-typescript/parser",
- "parserOptions": {
- "sourceType": "module"
- },
- "plugins": [
- "typescript"
- ],
- "rules": {
- "typescript/adjacent-overload-signatures": "error",
- "typescript/array-type": "error",
- "typescript/ban-types": "error",
- "camelcase": "off",
- "typescript/camelcase": "error",
- "typescript/class-name-casing": "error",
- "typescript/explicit-function-return-type": "warn",
- "typescript/explicit-member-accessibility": "error",
- "indent": "off",
- "typescript/indent": "error",
- "typescript/interface-name-prefix": "error",
- "typescript/member-delimiter-style": "error",
- "typescript/no-angle-bracket-type-assertion": "error",
- "no-array-constructor": "off",
- "typescript/no-array-constructor": "error",
- "typescript/no-empty-interface": "error",
- "typescript/no-explicit-any": "warn",
- "typescript/no-inferrable-types": "error",
- "typescript/no-misused-new": "error",
- "typescript/no-namespace": "error",
- "typescript/no-non-null-assertion": "error",
- "typescript/no-object-literal-type-assertion": "error",
- "typescript/no-parameter-properties": "error",
- "typescript/no-triple-slash-reference": "error",
- "no-unused-vars": "off",
- "typescript/no-unused-vars": "warn",
- "typescript/no-use-before-define": "error",
- "typescript/no-var-requires": "error",
- "typescript/prefer-interface": "error",
- "typescript/prefer-namespace-keyword": "error",
- "typescript/type-annotation-spacing": "error"
- }
-}
diff --git a/packages/eslint-plugin-typescript/parser.js b/packages/eslint-plugin-typescript/parser.js
deleted file mode 100644
index a2f0433ab12a..000000000000
--- a/packages/eslint-plugin-typescript/parser.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * @fileoverview Internal parser
- * @author Patricio Trevino
- */
-
-'use strict';
-
-// export the typescript-eslint-parser.
-// this forces the parser to be a direct dependency of the plugin.
-module.exports = require('typescript-eslint-parser');
diff --git a/packages/eslint-plugin-typescript/.npmignore b/packages/eslint-plugin/.npmignore
similarity index 100%
rename from packages/eslint-plugin-typescript/.npmignore
rename to packages/eslint-plugin/.npmignore
diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md
new file mode 100644
index 000000000000..1cecaf46e024
--- /dev/null
+++ b/packages/eslint-plugin/CHANGELOG.md
@@ -0,0 +1,66 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+# [1.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.2.0...v1.3.0) (2019-02-07)
+
+### Bug Fixes
+
+- **eslint-plugin:** fix false positive from adjacent-overload-signatures ([#206](https://github.com/typescript-eslint/typescript-eslint/issues/206)) ([07e950e](https://github.com/typescript-eslint/typescript-eslint/commit/07e950e))
+
+### Features
+
+- change TypeScript version range to >=3.2.1 <3.4.0 ([#184](https://github.com/typescript-eslint/typescript-eslint/issues/184)) ([f513a14](https://github.com/typescript-eslint/typescript-eslint/commit/f513a14))
+- **eslint-plugin:** add new rule no-for-in-array ([#155](https://github.com/typescript-eslint/typescript-eslint/issues/155)) ([84162ba](https://github.com/typescript-eslint/typescript-eslint/commit/84162ba))
+- **eslint-plugin:** add new rule no-require-imports ([#199](https://github.com/typescript-eslint/typescript-eslint/issues/199)) ([683e5bc](https://github.com/typescript-eslint/typescript-eslint/commit/683e5bc))
+- **eslint-plugin:** added new rule promise-function-async ([#194](https://github.com/typescript-eslint/typescript-eslint/issues/194)) ([5f3aec9](https://github.com/typescript-eslint/typescript-eslint/commit/5f3aec9))
+
+# [1.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.1...v1.2.0) (2019-02-01)
+
+### Bug Fixes
+
+- **eslint-plugin:** fix no-extraneous-class for class without name ([#174](https://github.com/typescript-eslint/typescript-eslint/issues/174)) ([b1dbb64](https://github.com/typescript-eslint/typescript-eslint/commit/b1dbb64))
+- **eslint-plugin:** fix wrong URL ([#180](https://github.com/typescript-eslint/typescript-eslint/issues/180)) ([00d020d](https://github.com/typescript-eslint/typescript-eslint/commit/00d020d))
+- **eslint-plugin:** use bracket for infer type in array-type rule ([#173](https://github.com/typescript-eslint/typescript-eslint/issues/173)) ([1f868ce](https://github.com/typescript-eslint/typescript-eslint/commit/1f868ce))
+- **parser:** fix regression with no-unused-vars for jsx attributes ([#161](https://github.com/typescript-eslint/typescript-eslint/issues/161)) ([6147de1](https://github.com/typescript-eslint/typescript-eslint/commit/6147de1))
+
+### Features
+
+- **eslint-plugin:** add eslint rule no-useless-constructor ([#167](https://github.com/typescript-eslint/typescript-eslint/issues/167)) ([3fb57a5](https://github.com/typescript-eslint/typescript-eslint/commit/3fb57a5))
+- **eslint-plugin:** add no-unnecessary-type-assertion rule ([#157](https://github.com/typescript-eslint/typescript-eslint/issues/157)) ([38abc28](https://github.com/typescript-eslint/typescript-eslint/commit/38abc28))
+
+## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29)
+
+### Bug Fixes
+
+- **eslint-plugin:** make parser services error clearer ([#132](https://github.com/typescript-eslint/typescript-eslint/issues/132)) ([aa9d1e1](https://github.com/typescript-eslint/typescript-eslint/commit/aa9d1e1))
+- **parser:** add visiting of type parameters in JSXOpeningElement ([#150](https://github.com/typescript-eslint/typescript-eslint/issues/150)) ([5e16003](https://github.com/typescript-eslint/typescript-eslint/commit/5e16003))
+
+# [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23)
+
+### Bug Fixes
+
+- **eslint-plugin:** don’t mark `declare class` as unused ([#110](https://github.com/typescript-eslint/typescript-eslint/issues/110)) ([5841cd2](https://github.com/typescript-eslint/typescript-eslint/commit/5841cd2)), closes [#106](https://github.com/typescript-eslint/typescript-eslint/issues/106)
+- **eslint-plugin:** improve detection of used vars in heritage ([#102](https://github.com/typescript-eslint/typescript-eslint/issues/102)) ([193b434](https://github.com/typescript-eslint/typescript-eslint/commit/193b434))
+
+### Features
+
+- **eslint-plugin:** add new rule restrict-plus-operands ([#70](https://github.com/typescript-eslint/typescript-eslint/issues/70)) ([c541ede](https://github.com/typescript-eslint/typescript-eslint/commit/c541ede))
+- **eslint-plugin:** add option to no-object-literal-type-assertion rule ([#87](https://github.com/typescript-eslint/typescript-eslint/issues/87)) ([9f501a1](https://github.com/typescript-eslint/typescript-eslint/commit/9f501a1))
+
+# [1.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.1...v1.0.0) (2019-01-20)
+
+### Bug Fixes
+
+- **eslint-plugin:** fix crash in rule indent for eslint 5.12.1 ([#89](https://github.com/typescript-eslint/typescript-eslint/issues/89)) ([3f51d51](https://github.com/typescript-eslint/typescript-eslint/commit/3f51d51))
+- **eslint-plugin:** no-unused-vars: mark declared statements as used ([#88](https://github.com/typescript-eslint/typescript-eslint/issues/88)) ([2df5e0c](https://github.com/typescript-eslint/typescript-eslint/commit/2df5e0c))
+- **eslint-plugin:** update remaining parser refs ([#97](https://github.com/typescript-eslint/typescript-eslint/issues/97)) ([055c3fc](https://github.com/typescript-eslint/typescript-eslint/commit/055c3fc))
+
+### Features
+
+- **eslint-plugin:** remove exported parser ([#94](https://github.com/typescript-eslint/typescript-eslint/issues/94)) ([0ddb93c](https://github.com/typescript-eslint/typescript-eslint/commit/0ddb93c))
+
+## [0.2.1](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.0...v0.2.1) (2019-01-20)
+
+**Note:** Version bump only for package @typescript-eslint/eslint-plugin
diff --git a/packages/eslint-plugin-typescript/LICENSE b/packages/eslint-plugin/LICENSE
similarity index 100%
rename from packages/eslint-plugin-typescript/LICENSE
rename to packages/eslint-plugin/LICENSE
diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md
new file mode 100644
index 000000000000..daacab20afdb
--- /dev/null
+++ b/packages/eslint-plugin/README.md
@@ -0,0 +1,154 @@
+ESLint Plugin TypeScript
+
+
+
+
+
+
+
+
+
+## Installation
+
+Make sure you have TypeScript and @typescript-eslint/parser installed, then install the plugin:
+
+```sh
+npm i @typescript-eslint/eslint-plugin --save-dev
+```
+
+It is important that you use the same version number for `@typescript-eslint/parser` and `@typescript-eslint/eslint-plugin`.
+
+**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `@typescript-eslint/eslint-plugin` globally.
+
+## Usage
+
+Add `@typescript-eslint/parser` to the `parser` field and `@typescript-eslint` to the plugins section of your `.eslintrc` configuration file:
+
+```json
+{
+ "parser": "@typescript-eslint/parser",
+ "plugins": ["@typescript-eslint"]
+}
+```
+
+Then configure the rules you want to use under the rules section.
+
+```json
+{
+ "parser": "@typescript-eslint/parser",
+ "plugins": ["@typescript-eslint"],
+ "rules": {
+ "@typescript-eslint/rule-name": "error"
+ }
+}
+```
+
+You can also enable all the recommended rules at once. Add `plugin:@typescript-eslint/recommended` in extends:
+
+```json
+{
+ "extends": ["plugin:@typescript-eslint/recommended"]
+}
+```
+
+If you want to use rules which require type information, you will need to specify a path to your tsconfig.json file in the "project" property of "parserOptions".
+
+```json
+{
+ "parser": "@typescript-eslint/parser",
+ "parserOptions": {
+ "project": "./tsconfig.json"
+ },
+ "plugins": ["@typescript-eslint"],
+ "rules": {
+ "@typescript-eslint/restrict-plus-operands": "error"
+ }
+}
+```
+
+See [@typescript-eslint/parser's README.md](../parser/README.md) for more information on the available "parserOptions".
+
+## Usage with Prettier
+
+Install [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) to disable our code formatting related rules:
+
+```json
+{
+ "extends": [
+ "plugin:@typescript-eslint/recommended",
+ "prettier",
+ "prettier/@typescript-eslint"
+ ]
+}
+```
+
+**Note: Make sure you have `eslint-config-prettier@4.0.0` or newer.**
+
+## Usage with Airbnb
+
+Airbnb has two configs, a base one [`eslint-config-airbnb-base`](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base) and one that includes rules for React [`eslint-config-airbnb`](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb).
+
+First you'll need to install the config according to the instructions in one of the links above. `npx install-peerdeps --dev eslint-config-airbnb` or `npx install-peerdeps --dev eslint-config-airbnb-base` should work if you are using **npm 5+**.
+
+Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.eslintrc`. You might also want to turn on `plugin:@typescript-eslint/recommended` as well to enable all of the recommended rules.
+
+```json
+{
+ "extends": ["airbnb-base", "plugin:@typescript-eslint/recommended"]
+}
+```
+
+**Note: You can use Airbnb's rules alongside Prettier, see [Usage with Prettier](#usage-with-prettier)**
+
+## Supported Rules
+
+
+
+
+**Key**: :heavy_check_mark: = recommended, :wrench: = fixable
+
+
+| 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/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-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: |
+
+
diff --git a/packages/eslint-plugin-typescript/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md
similarity index 82%
rename from packages/eslint-plugin-typescript/ROADMAP.md
rename to packages/eslint-plugin/ROADMAP.md
index 052ff7cdcb6c..9d4c2ef5a9f1 100644
--- a/packages/eslint-plugin-typescript/ROADMAP.md
+++ b/packages/eslint-plugin/ROADMAP.md
@@ -1,39 +1,39 @@
-# Roadmap
+# Roadmap
-✅ (27) = done
-🌟 (79) = in ESLint core
-🔌 (33) = in another plugin
-🌓 (16) = implementations differ or ESLint version is missing functionality
-🛑 (71) = unimplemented
+✅ = done
+🌟 = in ESLint core
+🔌 = in another plugin
+🌓 = implementations differ or ESLint version is missing functionality
+🛑 = unimplemented
## TSLint rules
### TypeScript-specific
-| TSLint rule | | ESLint rule |
-| --------------------------------- | :-: | -------------------------------------------- |
-| [`adjacent-overload-signatures`] | ✅ | [`typescript/adjacent-overload-signatures`] |
-| [`ban-types`] | ✅ | [`typescript/ban-types`] |
-| [`member-access`] | ✅ | [`typescript/explicit-member-accessibility`] |
-| [`member-ordering`] | ✅ | [`typescript/member-ordering`] |
-| [`no-any`] | ✅ | [`typescript/no-explicit-any`] |
-| [`no-empty-interface`] | ✅ | [`typescript/no-empty-interface`] |
-| [`no-import-side-effect`] | 🔌 | [`import/no-unassigned-import`] |
-| [`no-inferrable-types`] | ✅ | [`typescript/no-inferrable-types`] |
-| [`no-internal-module`] | ✅ | [`typescript/prefer-namespace-keyword`] |
-| [`no-magic-numbers`] | 🌟 | [`no-magic-numbers`][no-magic-numbers] |
-| [`no-namespace`] | ✅ | [`typescript/no-namespace`] |
-| [`no-non-null-assertion`] | ✅ | [`typescript/no-non-null-assertion`] |
-| [`no-parameter-reassignment`] | ✅ | [`no-param-reassign`][no-param-reassign] |
-| [`no-reference`] | ✅ | [`typescript/no-triple-slash-reference`] |
-| [`no-unnecessary-type-assertion`] | 🛑 | N/A |
-| [`no-var-requires`] | ✅ | [`typescript/no-var-requires`] |
-| [`only-arrow-functions`] | 🔌 | [`prefer-arrow/prefer-arrow-functions`] |
-| [`prefer-for-of`] | 🛑 | N/A |
-| [`promise-function-async`] | 🛑 | N/A ([relevant plugin][plugin:promise]) |
-| [`typedef`] | 🛑 | N/A |
-| [`typedef-whitespace`] | ✅ | [`typescript/type-annotation-spacing`] |
-| [`unified-signatures`] | 🛑 | N/A |
+| TSLint rule | | ESLint rule |
+| --------------------------------- | :-: | ---------------------------------------------------- |
+| [`adjacent-overload-signatures`] | ✅ | [`@typescript-eslint/adjacent-overload-signatures`] |
+| [`ban-types`] | ✅ | [`@typescript-eslint/ban-types`] |
+| [`member-access`] | ✅ | [`@typescript-eslint/explicit-member-accessibility`] |
+| [`member-ordering`] | ✅ | [`@typescript-eslint/member-ordering`] |
+| [`no-any`] | ✅ | [`@typescript-eslint/no-explicit-any`] |
+| [`no-empty-interface`] | ✅ | [`@typescript-eslint/no-empty-interface`] |
+| [`no-import-side-effect`] | 🔌 | [`import/no-unassigned-import`] |
+| [`no-inferrable-types`] | ✅ | [`@typescript-eslint/no-inferrable-types`] |
+| [`no-internal-module`] | ✅ | [`@typescript-eslint/prefer-namespace-keyword`] |
+| [`no-magic-numbers`] | 🌟 | [`no-magic-numbers`][no-magic-numbers] |
+| [`no-namespace`] | ✅ | [`@typescript-eslint/no-namespace`] |
+| [`no-non-null-assertion`] | ✅ | [`@typescript-eslint/no-non-null-assertion`] |
+| [`no-parameter-reassignment`] | ✅ | [`no-param-reassign`][no-param-reassign] |
+| [`no-reference`] | ✅ | [`@typescript-eslint/no-triple-slash-reference`] |
+| [`no-unnecessary-type-assertion`] | ✅ | [`@typescript-eslint/no-unnecessary-type-assertion`] |
+| [`no-var-requires`] | ✅ | [`@typescript-eslint/no-var-requires`] |
+| [`only-arrow-functions`] | 🔌 | [`prefer-arrow/prefer-arrow-functions`] |
+| [`prefer-for-of`] | 🛑 | N/A |
+| [`promise-function-async`] | ✅ | [`@typescript-eslint/promise-function-async`] |
+| [`typedef`] | 🛑 | N/A |
+| [`typedef-whitespace`] | ✅ | [`@typescript-eslint/type-annotation-spacing`] |
+| [`unified-signatures`] | 🛑 | N/A |
### Functionality
@@ -59,14 +59,14 @@
| [`no-empty`] | 🌟 | [`no-empty`][no-empty] |
| [`no-eval`] | 🌟 | [`no-eval`][no-eval] |
| [`no-floating-promises`] | 🛑 | N/A ([relevant plugin][plugin:promise]) |
-| [`no-for-in-array`] | 🛑 | N/A |
+| [`no-for-in-array`] | ✅ | [`@typescript-eslint/no-for-in-array`] |
| [`no-implicit-dependencies`] | 🔌 | [`import/no-extraneous-dependencies`] |
| [`no-inferred-empty-object-type`] | 🛑 | N/A |
| [`no-invalid-template-strings`] | 🌟 | [`no-template-curly-in-string`][no-template-curly-in-string] |
| [`no-invalid-this`] | 🌟 | [`no-invalid-this`][no-invalid-this] |
-| [`no-misused-new`] | ✅ | [`typescript/no-misused-new`] |
+| [`no-misused-new`] | ✅ | [`@typescript-eslint/no-misused-new`] |
| [`no-null-keyword`] | 🔌 | [`no-null/no-null`] (doesn’t handle `null` type) |
-| [`no-object-literal-type-assertion`] | ✅ | [`typescript/no-object-literal-type-assertion`] |
+| [`no-object-literal-type-assertion`] | ✅ | [`@typescript-eslint/no-object-literal-type-assertion`] |
| [`no-return-await`] | 🌟 | [`no-return-await`][no-return-await] |
| [`no-shadowed-variable`] | 🌟 | [`no-shadow`][no-shadow] |
| [`no-sparse-arrays`] | 🌟 | [`no-sparse-arrays`][no-sparse-arrays] |
@@ -74,20 +74,20 @@
| [`no-string-throw`] | 🌟 | [`no-throw-literal`][no-throw-literal] |
| [`no-submodule-imports`] | 🌓 | [`import/no-internal-modules`] (slightly different) |
| [`no-switch-case-fall-through`] | 🌟 | [`no-fallthrough`][no-fallthrough] |
-| [`no-this-assignment`] | ✅ | [`typescript/no-this-alias`] |
+| [`no-this-assignment`] | ✅ | [`@typescript-eslint/no-this-alias`] |
| [`no-unbound-method`] | 🛑 | N/A |
-| [`no-unnecessary-class`] | ✅ | [`typescript/no-extraneous-class`] |
+| [`no-unnecessary-class`] | ✅ | [`@typescript-eslint/no-extraneous-class`] |
| [`no-unsafe-any`] | 🛑 | N/A |
| [`no-unsafe-finally`] | 🌟 | [`no-unsafe-finally`][no-unsafe-finally] |
| [`no-unused-expression`] | 🌟 | [`no-unused-expression`][no-unused-expressions] |
| [`no-unused-variable`] | 🌓 | [`no-unused-vars`][no-unused-vars] [2] |
-| [`no-use-before-declare`] | ✅ | [`typescript/no-use-before-define`] |
+| [`no-use-before-declare`] | ✅ | [`@typescript-eslint/no-use-before-define`] |
| [`no-var-keyword`] | 🌟 | [`no-var`][no-var] |
| [`no-void-expression`] | 🌟 | [`no-void`][no-void] |
| [`prefer-conditional-expression`] | 🛑 | N/A |
| [`prefer-object-spread`] | 🌟 | [`prefer-object-spread`][prefer-object-spread] |
| [`radix`] | 🌟 | [`radix`][radix] |
-| [`restrict-plus-operands`] | 🛑 | N/A |
+| [`restrict-plus-operands`] | ✅ | [`@typescript-eslint/restrict-plus-operands`] |
| [`strict-boolean-expressions`] | 🛑 | N/A |
| [`strict-type-predicates`] | 🛑 | N/A |
| [`switch-default`] | 🌟 | [`default-case`][default-case] |
@@ -96,8 +96,8 @@
| [`use-default-type-parameter`] | 🛑 | N/A |
| [`use-isnan`] | 🌟 | [`use-isnan`][use-isnan] |
-[1] The ESLint rule also supports silencing with an extra set of parens (`if ((foo = bar)) {}`)
-[2] Missing private class member support. [`typescript/no-unused-vars`] adds support for some TS-specific features.
+[1] The ESLint rule also supports silencing with an extra set of parens (`if ((foo = bar)) {}`)
+[2] Missing private class member support. [`@typescript-eslint/no-unused-vars`] adds support for some TS-specific features.
### Maintainability
@@ -106,7 +106,7 @@
| [`cyclomatic-complexity`] | 🌟 | [`complexity`][complexity] |
| [`deprecation`] | 🌓 | [`import/no-deprecated`] [1] |
| [`eofline`] | 🌟 | [`eol-last`][eol-last] |
-| [`indent`] | ✅ | [`typescript/indent`] or [Prettier] |
+| [`indent`] | ✅ | [`@typescript-eslint/indent`] or [Prettier] |
| [`linebreak-style`] | 🌟 | [`linebreak-style`][linebreak-style] or [Prettier] |
| [`max-classes-per-file`] | 🌟 | [`max-classes-per-file`][max-classes-per-file] |
| [`max-file-line-count`] | 🌟 | [`max-lines`][max-lines] |
@@ -114,13 +114,13 @@
| [`no-default-export`] | 🔌 | [`import/no-default-export`] |
| [`no-duplicate-imports`] | 🔌 | [`import/no-duplicates`] |
| [`no-mergeable-namespace`] | 🛑 | N/A |
-| [`no-require-imports`] | 🛑 | N/A |
+| [`no-require-imports`] | ✅ | [`@typescript-eslint/no-require-imports`] |
| [`object-literal-sort-keys`] | 🌓 | [`sort-keys`][sort-keys] [2] |
| [`prefer-const`] | 🌟 | [`prefer-const`][prefer-const] |
| [`prefer-readonly`] | 🛑 | N/A |
| [`trailing-comma`] | 🌓 | [`comma-dangle`][comma-dangle] or [Prettier] |
-[1] Only warns when importing deprecated symbols
+[1] Only warns when importing deprecated symbols
[2] Missing support for blank-line-delimited sections
### Style
@@ -128,30 +128,30 @@
| TSLint rule | | ESLint rule |
| ----------------------------------- | :-: | ----------------------------------------------------------------------------------- |
| [`align`] | 🛑 | N/A |
-| [`array-type`] | ✅ | [`typescript/array-type`] |
+| [`array-type`] | ✅ | [`@typescript-eslint/array-type`] |
| [`arrow-parens`] | 🌟 | [`arrow-parens`][arrow-parens] |
| [`arrow-return-shorthand`] | 🌟 | [`arrow-body-style`][arrow-body-style] |
| [`binary-expression-operand-order`] | 🌟 | [`yoda`][yoda] |
-| [`callable-types`] | 🛑 | N/A |
-| [`class-name`] | ✅ | [`typescript/class-name-casing`] |
+| [`callable-types`] | ✅ | [`@typescript-eslint/prefer-function-type`] |
+| [`class-name`] | ✅ | [`@typescript-eslint/class-name-casing`] |
| [`comment-format`] | 🌟 | [`capitalized-comments`][capitalized-comments] & [`spaced-comment`][spaced-comment] |
| [`completed-docs`] | 🔌 | [`eslint-plugin-jsdoc`][plugin:jsdoc] |
| [`encoding`] | 🛑 | N/A |
| [`file-header`] | 🔌 | [`eslint-plugin-header`][plugin:header] or [`-file-header`][plugin:file-header] |
| [`file-name-casing`] | 🔌 | [`unicorn/filename-case`] |
| [`import-spacing`] | 🔌 | Use [Prettier] |
-| [`interface-name`] | ✅ | [`typescript/interface-name-prefix`] |
-| [`interface-over-type-literal`] | ✅ | [`typescript/prefer-interface`] |
+| [`interface-name`] | ✅ | [`@typescript-eslint/interface-name-prefix`] |
+| [`interface-over-type-literal`] | ✅ | [`@typescript-eslint/prefer-interface`] |
| [`jsdoc-format`] | 🌓 | [`valid-jsdoc`][valid-jsdoc] or [`eslint-plugin-jsdoc`][plugin:jsdoc] |
| [`match-default-export-name`] | 🛑 | N/A |
| [`newline-before-return`] | 🌟 | [`padding-line-between-statements`][padding-line-between-statements] [1] |
| [`newline-per-chained-call`] | 🌟 | [`newline-per-chained-call`][newline-per-chained-call] |
| [`new-parens`] | 🌟 | [`new-parens`][new-parens] |
-| [`no-angle-bracket-type-assertion`] | ✅ | [`typescript/no-angle-bracket-type-assertion`] |
+| [`no-angle-bracket-type-assertion`] | ✅ | [`@typescript-eslint/no-angle-bracket-type-assertion`] |
| [`no-boolean-literal-compare`] | 🛑 | N/A |
| [`no-consecutive-blank-lines`] | 🌟 | [`no-multiple-empty-lines`][no-multiple-empty-lines] |
| [`no-irregular-whitespace`] | 🌟 | [`no-irregular-whitespace`][no-irregular-whitespace] with `skipStrings: false` |
-| [`no-parameter-properties`] | ✅ | [`typescript/no-parameter-properties`] |
+| [`no-parameter-properties`] | ✅ | [`@typescript-eslint/no-parameter-properties`] |
| [`no-redundant-jsdoc`] | 🛑 | N/A ([open issue](https://github.com/gajus/eslint-plugin-jsdoc/issues/134)) |
| [`no-reference-import`] | 🛑 | N/A |
| [`no-trailing-whitespace`] | 🌟 | [`no-trailing-spaces`][no-trailing-spaces] |
@@ -175,12 +175,12 @@
| [`space-before-function-paren`] | 🌟 | [`space-before-function-paren`][space-after-function-paren] |
| [`space-within-parens`] | 🌟 | [`space-in-parens`][space-in-parens] |
| [`switch-final-break`] | 🛑 | N/A |
-| [`type-literal-delimiter`] | ✅ | [`typescript/member-delimiter-style`] |
+| [`type-literal-delimiter`] | ✅ | [`@typescript-eslint/member-delimiter-style`] |
| [`variable-name`] | 🌟 | [2] |
| [`whitespace`] | 🔌 | Use [Prettier] |
-[1] Recommended config: `["error", { blankLine: "always", prev: "*", next: "return" }]`
-[2] [`camelcase`][camelcase], [`no-underscore-dangle`][no-underscore-dangle], [`id-blacklist`][id-blacklist], and/or [`id-match`]
+[1] Recommended config: `["error", { blankLine: "always", prev: "*", next: "return" }]`
+[2] [`camelcase`][camelcase], [`no-underscore-dangle`][no-underscore-dangle], [`id-blacklist`][id-blacklist], and/or [`id-match`][id-match]
## tslint-microsoft-contrib rules
@@ -200,10 +200,10 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint-
### TypeScript
-| tslint-microsoft-contrib rule | | ESLint rule |
-| ----------------------------- | :-: | -------------------------------------------------- |
-| `prefer-array-literal` | 🌓 | [`typescript/no-array-constructor`] [1] |
-| `prefer-type-cast` | 🛑 | N/A |
+| tslint-microsoft-contrib rule | | ESLint rule |
+| ----------------------------- | :-: | ---------------------------------------------------------- |
+| `prefer-array-literal` | 🌓 | [`@typescript-eslint/no-array-constructor`] [1] |
+| `prefer-type-cast` | 🛑 | N/A |
[1] ESLint rule is slightly less strict, allowing `new Array()` and `Array(2)`.
@@ -214,7 +214,6 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint-
| `export-name` | 🛑 | N/A ([relevant plugin][plugin:import]) |
| `function-name` | 🛑 | N/A |
| `import-name` | 🛑 | N/A ([relevant plugin][plugin:import]) |
-| `function-name` | 🛑 | N/A |
| `informative-docs` | 🛑 | N/A |
| `insecure-random` | 🔌 | [custom implementation][insecure-random] |
| `max-func-body-length` | 🌟 | [`max-statements`][max-statements] |
@@ -245,10 +244,10 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint-
| `use-named-parameter` | 🛑 | N/A |
| `use-simple-attributes` | 🛑 | N/A |
-[1] Enforces blank lines both at the beginning and end of a block
-[2] Recommended config: `["error", "ForInStatement"]`
-[3] Recommended config: `["error", "declaration", { "allowArrowFunctions": true }]`
-[4] Recommended config: `["error", { "terms": ["BUG", "HACK", "FIXME", "LATER", "LATER2", "TODO"], "location": "anywhere" }]`
+[1] Enforces blank lines both at the beginning and end of a block
+[2] Recommended config: `["error", "ForInStatement"]`
+[3] Recommended config: `["error", "declaration", { "allowArrowFunctions": true }]`
+[4] Recommended config: `["error", { "terms": ["BUG", "HACK", "FIXME", "LATER", "LATER2", "TODO"], "location": "anywhere" }]`
[5] Does not check class fields.
[insecure-random]: https://github.com/desktop/desktop/blob/master/eslint-rules/insecure-random.js
@@ -282,7 +281,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint-
| `no-exec-script` | 🌓 | Use [`no-restricted-syntax`][no-restricted-syntax] |
| `no-jquery-raw-elements` | 🛑 | N/A |
| `no-unsupported-browser-code` | 🔌 | [`eslint-plugin-compat`][plugin:compat] |
-| `react-this-binding-issue` | 🛑 | |
+| `react-this-binding-issue` | 🛑 | N/A |
| `react-tsx-curly-spacing` | 🔌 | [`react/jsx-curly-spacing`] |
| `react-unused-props-and-state` | 🌓 | [`react/no-unused-state`] |
@@ -310,7 +309,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint-
| `react-a11y-titles` | 🛑 | N/A |
| `react-anchor-blank-noopener` | 🛑 | N/A |
-[1] TSLint rule is more strict
+[1] TSLint rule is more strict
[2] ESLint rule only reports for click handlers
[prettier]: https://prettier.io
@@ -555,36 +554,41 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint-
[no-with]: https://eslint.org/docs/rules/no-with
[no-warning-comments]: https://eslint.org/docs/rules/no-warning-comments
-
-
-[`typescript/adjacent-overload-signatures`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/adjacent-overload-signatures.md
-[`typescript/ban-types`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/ban-types.md
-[`typescript/explicit-member-accessibility`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/explicit-member-accessibility.md
-[`typescript/member-ordering`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/member-ordering.md
-[`typescript/no-explicit-any`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-explicit-any.md
-[`typescript/no-empty-interface`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-empty-interface.md
-[`typescript/no-inferrable-types`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-inferrable-types.md
-[`typescript/prefer-namespace-keyword`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/prefer-namespace-keyword.md
-[`typescript/no-namespace`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-namespace.md
-[`typescript/no-non-null-assertion`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-non-null-assertion.md
-[`typescript/no-triple-slash-reference`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-triple-slash-reference.md
-[`typescript/no-var-requires`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-var-requires.md
-[`typescript/type-annotation-spacing`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/type-annotation-spacing.md
-[`typescript/no-misused-new`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-misused-new.md
-[`typescript/no-object-literal-type-assertion`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-object-literal-type-assertion.md
-[`typescript/no-this-alias`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-this-alias.md
-[`typescript/no-extraneous-class`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-extraneous-class.md
-[`typescript/no-unused-vars`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-unused-vars.md
-[`typescript/no-use-before-define`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-use-before-define.md
-[`typescript/indent`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/indent.md
-[`typescript/array-type`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/array-type.md
-[`typescript/class-name-casing`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/class-name-casing.md
-[`typescript/interface-name-prefix`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/interface-name-prefix.md
-[`typescript/no-angle-bracket-type-assertion`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-angle-bracket-type-assertion.md
-[`typescript/no-parameter-properties`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-parameter-properties.md
-[`typescript/member-delimiter-style`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/member-delimiter-style.md
-[`typescript/prefer-interface`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/prefer-interface.md
-[`typescript/no-array-constructor`]: https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-array-constructor.md
+
+
+[`@typescript-eslint/adjacent-overload-signatures`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md
+[`@typescript-eslint/ban-types`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md
+[`@typescript-eslint/explicit-member-accessibility`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
+[`@typescript-eslint/member-ordering`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md
+[`@typescript-eslint/no-explicit-any`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md
+[`@typescript-eslint/no-empty-interface`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-interface.md
+[`@typescript-eslint/no-inferrable-types`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-inferrable-types.md
+[`@typescript-eslint/prefer-namespace-keyword`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md
+[`@typescript-eslint/no-namespace`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.md
+[`@typescript-eslint/no-non-null-assertion`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
+[`@typescript-eslint/no-triple-slash-reference`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-triple-slash-reference.md
+[`@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/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
+[`@typescript-eslint/no-extraneous-class`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extraneous-class.md
+[`@typescript-eslint/no-unused-vars`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
+[`@typescript-eslint/no-use-before-define`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
+[`@typescript-eslint/restrict-plus-operands`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-plus-operands.md
+[`@typescript-eslint/indent`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
+[`@typescript-eslint/no-require-imports`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-require-imports.md
+[`@typescript-eslint/array-type`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md
+[`@typescript-eslint/class-name-casing`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/class-name-casing.md
+[`@typescript-eslint/interface-name-prefix`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/interface-name-prefix.md
+[`@typescript-eslint/no-angle-bracket-type-assertion`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-angle-bracket-type-assertion.md
+[`@typescript-eslint/no-parameter-properties`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md
+[`@typescript-eslint/member-delimiter-style`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-delimiter-style.md
+[`@typescript-eslint/prefer-interface`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-interface.md
+[`@typescript-eslint/no-array-constructor`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
+[`@typescript-eslint/prefer-function-type`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-function-type.md
+[`@typescript-eslint/no-for-in-array`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-for-in-array.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/adjacent-overload-signatures.md b/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/adjacent-overload-signatures.md
rename to packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/array-type.md b/packages/eslint-plugin/docs/rules/array-type.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/array-type.md
rename to packages/eslint-plugin/docs/rules/array-type.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/ban-types.md b/packages/eslint-plugin/docs/rules/ban-types.md
similarity index 94%
rename from packages/eslint-plugin-typescript/docs/rules/ban-types.md
rename to packages/eslint-plugin/docs/rules/ban-types.md
index 64eaa018df9f..5ab5e6e96e76 100644
--- a/packages/eslint-plugin-typescript/docs/rules/ban-types.md
+++ b/packages/eslint-plugin/docs/rules/ban-types.md
@@ -32,7 +32,7 @@ class Foo extends Bar implements Baz {
```CJSON
{
- "typescript/ban-types": ["error", {
+ "@typescript-eslint/ban-types": ["error", {
"types": {
// report usages of the type using the default error message
"Foo": null,
@@ -54,7 +54,7 @@ class Foo extends Bar implements Baz {
```json
{
- "typescript/ban-types": [
+ "@typescript-eslint/ban-types": [
"error",
{
"types": {
diff --git a/packages/eslint-plugin-typescript/docs/rules/camelcase.md b/packages/eslint-plugin/docs/rules/camelcase.md
similarity index 87%
rename from packages/eslint-plugin-typescript/docs/rules/camelcase.md
rename to packages/eslint-plugin/docs/rules/camelcase.md
index ab624c2f9931..203a3885ed43 100644
--- a/packages/eslint-plugin-typescript/docs/rules/camelcase.md
+++ b/packages/eslint-plugin/docs/rules/camelcase.md
@@ -24,7 +24,7 @@ variable that will be imported into the local module scope.
{
// note you must disable the base rule as it can report incorrect errors
"camelcase": "off",
- "typescript/camelcase": ["error", { "properties": "always" }]
+ "@typescript-eslint/camelcase": ["error", { "properties": "always" }]
}
```
@@ -41,7 +41,7 @@ This rule has an object option:
Examples of **incorrect** code for this rule with the default `{ "properties": "always" }` option:
```js
-/*eslint typescript/camelcase: "error"*/
+/*eslint @typescript-eslint/camelcase: "error"*/
import { no_camelcased } from 'external-module';
@@ -81,7 +81,7 @@ var { foo: bar_baz = 1 } = quz;
Examples of **correct** code for this rule with the default `{ "properties": "always" }` option:
```js
-/*eslint typescript/camelcase: "error"*/
+/*eslint @typescript-eslint/camelcase: "error"*/
import { no_camelcased as camelCased } from 'external-module';
@@ -122,7 +122,7 @@ var { foo: isCamelCased = 1 } = quz;
Examples of **correct** code for this rule with the `{ "properties": "never" }` option:
```js
-/*eslint typescript/camelcase: ["error", {properties: "never"}]*/
+/*eslint @typescript-eslint/camelcase: ["error", {properties: "never"}]*/
var obj = {
my_pref: 1
@@ -134,7 +134,7 @@ var obj = {
Examples of **incorrect** code for this rule with the default `{ "ignoreDestructuring": false }` option:
```js
-/*eslint typescript/camelcase: "error"*/
+/*eslint @typescript-eslint/camelcase: "error"*/
var { category_id } = query;
@@ -152,7 +152,7 @@ var { category_id: categoryId, ...other_props } = query;
Examples of **incorrect** code for this rule with the `{ "ignoreDestructuring": true }` option:
```js
-/*eslint typescript/camelcase: ["error", {ignoreDestructuring: true}]*/
+/*eslint @typescript-eslint/camelcase: ["error", {ignoreDestructuring: true}]*/
var { category_id: category_alias } = query;
@@ -162,7 +162,7 @@ var { category_id, ...other_props } = query;
Examples of **correct** code for this rule with the `{ "ignoreDestructuring": true }` option:
```js
-/*eslint typescript/camelcase: ["error", {ignoreDestructuring: true}]*/
+/*eslint @typescript-eslint/camelcase: ["error", {ignoreDestructuring: true}]*/
var { category_id } = query;
@@ -176,7 +176,7 @@ var { category_id: category_id } = query;
Examples of **correct** code for this rule with the `allow` option:
```js
-/*eslint typescript/camelcase: ["error", {allow: ["UNSAFE_componentWillMount"]}]*/
+/*eslint @typescript-eslint/camelcase: ["error", {allow: ["UNSAFE_componentWillMount"]}]*/
function UNSAFE_componentWillMount() {
// ...
@@ -184,7 +184,7 @@ function UNSAFE_componentWillMount() {
```
```js
-/*eslint typescript/camelcase: ["error", {allow: ["^UNSAFE_"]}]*/
+/*eslint @typescript-eslint/camelcase: ["error", {allow: ["^UNSAFE_"]}]*/
function UNSAFE_componentWillMount() {
// ...
diff --git a/packages/eslint-plugin-typescript/docs/rules/class-name-casing.md b/packages/eslint-plugin/docs/rules/class-name-casing.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/class-name-casing.md
rename to packages/eslint-plugin/docs/rules/class-name-casing.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/explicit-function-return-type.md
rename to packages/eslint-plugin/docs/rules/explicit-function-return-type.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/explicit-member-accessibility.md
rename to packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/generic-type-naming.md b/packages/eslint-plugin/docs/rules/generic-type-naming.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/generic-type-naming.md
rename to packages/eslint-plugin/docs/rules/generic-type-naming.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/indent.md b/packages/eslint-plugin/docs/rules/indent.md
similarity index 80%
rename from packages/eslint-plugin-typescript/docs/rules/indent.md
rename to packages/eslint-plugin/docs/rules/indent.md
index 1ef6595a8ad8..5678ba291da2 100644
--- a/packages/eslint-plugin-typescript/docs/rules/indent.md
+++ b/packages/eslint-plugin/docs/rules/indent.md
@@ -30,7 +30,7 @@ For example, for 2-space indentation:
{
// note you must disable the base rule as it can report incorrect errors
"indent": "off",
- "typescript/indent": ["error", 2]
+ "@typescript-eslint/indent": ["error", 2]
}
```
@@ -40,7 +40,7 @@ Or for tabbed indentation:
{
// note you must disable the base rule as it can report incorrect errors
"indent": "off",
- "typescript/indent": ["error", "tab"]
+ "@typescript-eslint/indent": ["error", "tab"]
}
```
@@ -48,7 +48,7 @@ Examples of **incorrect** code for this rule with the default options:
```js
-/*eslint typescript/indent: "error"*/
+/*eslint @typescript-eslint/indent: "error"*/
if (a) {
b=c;
@@ -62,7 +62,7 @@ Examples of **correct** code for this rule with the default options:
```js
-/*eslint typescript/indent: "error"*/
+/*eslint @typescript-eslint/indent: "error"*/
if (a) {
b=c;
@@ -116,7 +116,7 @@ Examples of **incorrect** code for this rule with the `"tab"` option:
```js
-/*eslint typescript/indent: ["error", "tab"]*/
+/*eslint @typescript-eslint/indent: ["error", "tab"]*/
if (a) {
b=c;
@@ -130,7 +130,7 @@ Examples of **correct** code for this rule with the `"tab"` option:
```js
-/*eslint typescript/indent: ["error", "tab"]*/
+/*eslint @typescript-eslint/indent: ["error", "tab"]*/
if (a) {
/*tab*/b=c;
@@ -146,7 +146,7 @@ Examples of **incorrect** code for this rule with the `2, { "SwitchCase": 1 }` o
```js
-/*eslint typescript/indent: ["error", 2, { "SwitchCase": 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "SwitchCase": 1 }]*/
switch(a){
case "a":
@@ -160,7 +160,7 @@ Examples of **correct** code for this rule with the `2, { "SwitchCase": 1 }` opt
```js
-/*eslint typescript/indent: ["error", 2, { "SwitchCase": 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "SwitchCase": 1 }]*/
switch(a){
case "a":
@@ -176,7 +176,7 @@ Examples of **incorrect** code for this rule with the `2, { "VariableDeclarator"
```js
-/*eslint typescript/indent: ["error", 2, { "VariableDeclarator": 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "VariableDeclarator": 1 }]*/
/*eslint-env es6*/
var a,
@@ -194,7 +194,7 @@ Examples of **correct** code for this rule with the `2, { "VariableDeclarator":
```js
-/*eslint typescript/indent: ["error", 2, { "VariableDeclarator": 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "VariableDeclarator": 1 }]*/
/*eslint-env es6*/
var a,
@@ -212,7 +212,7 @@ Examples of **correct** code for this rule with the `2, { "VariableDeclarator":
```js
-/*eslint typescript/indent: ["error", 2, { "VariableDeclarator": 2 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "VariableDeclarator": 2 }]*/
/*eslint-env es6*/
var a,
@@ -230,7 +230,7 @@ Examples of **correct** code for this rule with the `2, { "VariableDeclarator":
```js
-/*eslint typescript/indent: ["error", 2, { "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } }]*/
/*eslint-env es6*/
var a,
@@ -250,7 +250,7 @@ Examples of **incorrect** code for this rule with the options `2, { "outerIIFEBo
```js
-/*eslint typescript/indent: ["error", 2, { "outerIIFEBody": 0 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "outerIIFEBody": 0 }]*/
(function() {
@@ -270,7 +270,7 @@ Examples of **correct** code for this rule with the options `2, {"outerIIFEBody"
```js
-/*eslint typescript/indent: ["error", 2, { "outerIIFEBody": 0 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "outerIIFEBody": 0 }]*/
(function() {
@@ -292,7 +292,7 @@ Examples of **incorrect** code for this rule with the `2, { "MemberExpression":
```js
-/*eslint typescript/indent: ["error", 2, { "MemberExpression": 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "MemberExpression": 1 }]*/
foo
.bar
@@ -303,7 +303,7 @@ Examples of **correct** code for this rule with the `2, { "MemberExpression": 1
```js
-/*eslint typescript/indent: ["error", 2, { "MemberExpression": 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "MemberExpression": 1 }]*/
foo
.bar
@@ -316,7 +316,7 @@ Examples of **incorrect** code for this rule with the `2, { "FunctionDeclaration
```js
-/*eslint typescript/indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} }]*/
function foo(bar,
baz,
@@ -329,7 +329,7 @@ Examples of **correct** code for this rule with the `2, { "FunctionDeclaration":
```js
-/*eslint typescript/indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} }]*/
function foo(bar,
baz,
@@ -342,7 +342,7 @@ Examples of **incorrect** code for this rule with the `2, { "FunctionDeclaration
```js
-/*eslint typescript/indent: ["error", 2, {"FunctionDeclaration": {"parameters": "first"}}]*/
+/*eslint @typescript-eslint/indent: ["error", 2, {"FunctionDeclaration": {"parameters": "first"}}]*/
function foo(bar, baz,
qux, boop) {
@@ -354,7 +354,7 @@ Examples of **correct** code for this rule with the `2, { "FunctionDeclaration":
```js
-/*eslint typescript/indent: ["error", 2, {"FunctionDeclaration": {"parameters": "first"}}]*/
+/*eslint @typescript-eslint/indent: ["error", 2, {"FunctionDeclaration": {"parameters": "first"}}]*/
function foo(bar, baz,
qux, boop) {
@@ -368,7 +368,7 @@ Examples of **incorrect** code for this rule with the `2, { "FunctionExpression"
```js
-/*eslint typescript/indent: ["error", 2, { "FunctionExpression": {"body": 1, "parameters": 2} }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "FunctionExpression": {"body": 1, "parameters": 2} }]*/
var foo = function(bar,
baz,
@@ -381,7 +381,7 @@ Examples of **correct** code for this rule with the `2, { "FunctionExpression":
```js
-/*eslint typescript/indent: ["error", 2, { "FunctionExpression": {"body": 1, "parameters": 2} }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "FunctionExpression": {"body": 1, "parameters": 2} }]*/
var foo = function(bar,
baz,
@@ -394,7 +394,7 @@ Examples of **incorrect** code for this rule with the `2, { "FunctionExpression"
```js
-/*eslint typescript/indent: ["error", 2, {"FunctionExpression": {"parameters": "first"}}]*/
+/*eslint @typescript-eslint/indent: ["error", 2, {"FunctionExpression": {"parameters": "first"}}]*/
var foo = function(bar, baz,
qux, boop) {
@@ -406,7 +406,7 @@ Examples of **correct** code for this rule with the `2, { "FunctionExpression":
```js
-/*eslint typescript/indent: ["error", 2, {"FunctionExpression": {"parameters": "first"}}]*/
+/*eslint @typescript-eslint/indent: ["error", 2, {"FunctionExpression": {"parameters": "first"}}]*/
var foo = function(bar, baz,
qux, boop) {
@@ -420,7 +420,7 @@ Examples of **incorrect** code for this rule with the `2, { "CallExpression": {"
```js
-/*eslint typescript/indent: ["error", 2, { "CallExpression": {"arguments": 1} }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "CallExpression": {"arguments": 1} }]*/
foo(bar,
baz,
@@ -432,7 +432,7 @@ Examples of **correct** code for this rule with the `2, { "CallExpression": {"ar
```js
-/*eslint typescript/indent: ["error", 2, { "CallExpression": {"arguments": 1} }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "CallExpression": {"arguments": 1} }]*/
foo(bar,
baz,
@@ -444,7 +444,7 @@ Examples of **incorrect** code for this rule with the `2, { "CallExpression": {"
```js
-/*eslint typescript/indent: ["error", 2, {"CallExpression": {"arguments": "first"}}]*/
+/*eslint @typescript-eslint/indent: ["error", 2, {"CallExpression": {"arguments": "first"}}]*/
foo(bar, baz,
baz, boop, beep);
@@ -454,7 +454,7 @@ Examples of **correct** code for this rule with the `2, { "CallExpression": {"ar
```js
-/*eslint typescript/indent: ["error", 2, {"CallExpression": {"arguments": "first"}}]*/
+/*eslint @typescript-eslint/indent: ["error", 2, {"CallExpression": {"arguments": "first"}}]*/
foo(bar, baz,
baz, boop, beep);
@@ -466,7 +466,7 @@ Examples of **incorrect** code for this rule with the `2, { "ArrayExpression": 1
```js
-/*eslint typescript/indent: ["error", 2, { "ArrayExpression": 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "ArrayExpression": 1 }]*/
var foo = [
bar,
@@ -479,7 +479,7 @@ Examples of **correct** code for this rule with the `2, { "ArrayExpression": 1 }
```js
-/*eslint typescript/indent: ["error", 2, { "ArrayExpression": 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "ArrayExpression": 1 }]*/
var foo = [
bar,
@@ -492,7 +492,7 @@ Examples of **incorrect** code for this rule with the `2, { "ArrayExpression": "
```js
-/*eslint typescript/indent: ["error", 2, {"ArrayExpression": "first"}]*/
+/*eslint @typescript-eslint/indent: ["error", 2, {"ArrayExpression": "first"}]*/
var foo = [bar,
baz,
@@ -504,7 +504,7 @@ Examples of **correct** code for this rule with the `2, { "ArrayExpression": "fi
```js
-/*eslint typescript/indent: ["error", 2, {"ArrayExpression": "first"}]*/
+/*eslint @typescript-eslint/indent: ["error", 2, {"ArrayExpression": "first"}]*/
var foo = [bar,
baz,
@@ -518,7 +518,7 @@ Examples of **incorrect** code for this rule with the `2, { "ObjectExpression":
```js
-/*eslint typescript/indent: ["error", 2, { "ObjectExpression": 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "ObjectExpression": 1 }]*/
var foo = {
bar: 1,
@@ -531,7 +531,7 @@ Examples of **correct** code for this rule with the `2, { "ObjectExpression": 1
```js
-/*eslint typescript/indent: ["error", 2, { "ObjectExpression": 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 2, { "ObjectExpression": 1 }]*/
var foo = {
bar: 1,
@@ -544,7 +544,7 @@ Examples of **incorrect** code for this rule with the `2, { "ObjectExpression":
```js
-/*eslint typescript/indent: ["error", 2, {"ObjectExpression": "first"}]*/
+/*eslint @typescript-eslint/indent: ["error", 2, {"ObjectExpression": "first"}]*/
var foo = { bar: 1,
baz: 2 };
@@ -554,7 +554,7 @@ Examples of **correct** code for this rule with the `2, { "ObjectExpression": "f
```js
-/*eslint typescript/indent: ["error", 2, {"ObjectExpression": "first"}]*/
+/*eslint @typescript-eslint/indent: ["error", 2, {"ObjectExpression": "first"}]*/
var foo = { bar: 1,
baz: 2 };
@@ -566,7 +566,7 @@ Examples of **correct** code for this rule with the `4, { "ImportDeclaration": 1
```js
-/*eslint typescript/indent: ["error", 4, { ImportDeclaration: 1 }]*/
+/*eslint @typescript-eslint/indent: ["error", 4, { ImportDeclaration: 1 }]*/
import { foo,
bar,
@@ -584,7 +584,7 @@ Examples of **incorrect** code for this rule with the `4, { ImportDeclaration: "
```js
-/*eslint typescript/indent: ["error", 4, { ImportDeclaration: "first" }]*/
+/*eslint @typescript-eslint/indent: ["error", 4, { ImportDeclaration: "first" }]*/
import { foo,
bar,
@@ -596,7 +596,7 @@ Examples of **correct** code for this rule with the `4, { ImportDeclaration: "fi
```js
-/*eslint typescript/indent: ["error", 4, { ImportDeclaration: "first" }]*/
+/*eslint @typescript-eslint/indent: ["error", 4, { ImportDeclaration: "first" }]*/
import { foo,
bar,
@@ -610,7 +610,7 @@ Examples of **incorrect** code for this rule with the default `4, { "flatTernary
```js
-/*eslint typescript/indent: ["error", 4, { "flatTernaryExpressions": false }]*/
+/*eslint @typescript-eslint/indent: ["error", 4, { "flatTernaryExpressions": false }]*/
var a =
foo ? bar :
@@ -622,7 +622,7 @@ Examples of **correct** code for this rule with the default `4, { "flatTernaryEx
```js
-/*eslint typescript/indent: ["error", 4, { "flatTernaryExpressions": false }]*/
+/*eslint @typescript-eslint/indent: ["error", 4, { "flatTernaryExpressions": false }]*/
var a =
foo ? bar :
@@ -634,7 +634,7 @@ Examples of **incorrect** code for this rule with the `4, { "flatTernaryExpressi
```js
-/*eslint typescript/indent: ["error", 4, { "flatTernaryExpressions": true }]*/
+/*eslint @typescript-eslint/indent: ["error", 4, { "flatTernaryExpressions": true }]*/
var a =
foo ? bar :
@@ -646,7 +646,7 @@ Examples of **correct** code for this rule with the `4, { "flatTernaryExpression
```js
-/*eslint typescript/indent: ["error", 4, { "flatTernaryExpressions": true }]*/
+/*eslint @typescript-eslint/indent: ["error", 4, { "flatTernaryExpressions": true }]*/
var a =
foo ? bar :
@@ -662,7 +662,7 @@ Examples of **correct** code for this rule with the `4, { "ignoredNodes": ["Cond
```js
-/*eslint typescript/indent: ["error", 4, { "ignoredNodes": ["ConditionalExpression"] }]*/
+/*eslint @typescript-eslint/indent: ["error", 4, { "ignoredNodes": ["ConditionalExpression"] }]*/
var a = foo
? bar
@@ -679,7 +679,7 @@ Examples of **correct** code for this rule with the `4, { "ignoredNodes": ["Call
```js
-/*eslint typescript/indent: ["error", 4, { "ignoredNodes": ["CallExpression > FunctionExpression.callee > BlockStatement.body"] }]*/
+/*eslint @typescript-eslint/indent: ["error", 4, { "ignoredNodes": ["CallExpression > FunctionExpression.callee > BlockStatement.body"] }]*/
(function() {
@@ -695,7 +695,7 @@ Examples of additional **correct** code for this rule with the `4, { "ignoreComm
```js
-/*eslint typescript/indent: ["error", 4, { "ignoreComments": true }] */
+/*eslint @typescript-eslint/indent: ["error", 4, { "ignoreComments": true }] */
if (foo) {
doSomething();
diff --git a/packages/eslint-plugin-typescript/docs/rules/interface-name-prefix.md b/packages/eslint-plugin/docs/rules/interface-name-prefix.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/interface-name-prefix.md
rename to packages/eslint-plugin/docs/rules/interface-name-prefix.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/member-delimiter-style.md b/packages/eslint-plugin/docs/rules/member-delimiter-style.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/member-delimiter-style.md
rename to packages/eslint-plugin/docs/rules/member-delimiter-style.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/member-naming.md b/packages/eslint-plugin/docs/rules/member-naming.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/member-naming.md
rename to packages/eslint-plugin/docs/rules/member-naming.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/member-ordering.md b/packages/eslint-plugin/docs/rules/member-ordering.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/member-ordering.md
rename to packages/eslint-plugin/docs/rules/member-ordering.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-angle-bracket-type-assertion.md b/packages/eslint-plugin/docs/rules/no-angle-bracket-type-assertion.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-angle-bracket-type-assertion.md
rename to packages/eslint-plugin/docs/rules/no-angle-bracket-type-assertion.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-array-constructor.md b/packages/eslint-plugin/docs/rules/no-array-constructor.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-array-constructor.md
rename to packages/eslint-plugin/docs/rules/no-array-constructor.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-empty-interface.md b/packages/eslint-plugin/docs/rules/no-empty-interface.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-empty-interface.md
rename to packages/eslint-plugin/docs/rules/no-empty-interface.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-explicit-any.md b/packages/eslint-plugin/docs/rules/no-explicit-any.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-explicit-any.md
rename to packages/eslint-plugin/docs/rules/no-explicit-any.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-extraneous-class.md b/packages/eslint-plugin/docs/rules/no-extraneous-class.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-extraneous-class.md
rename to packages/eslint-plugin/docs/rules/no-extraneous-class.md
diff --git a/packages/eslint-plugin/docs/rules/no-for-in-array.md b/packages/eslint-plugin/docs/rules/no-for-in-array.md
new file mode 100644
index 000000000000..3a1cf2bdd370
--- /dev/null
+++ b/packages/eslint-plugin/docs/rules/no-for-in-array.md
@@ -0,0 +1,44 @@
+# Disallow iterating over an array with a for-in loop (no-for-in-array)
+
+This rule prohibits iterating over an array with a for-in loop.
+
+## Rule Details
+
+Rationale from TSLint:
+
+A for-in loop (`for (var k in o)`) iterates over the properties of an Object.
+While it is legal to use for-in loops with array types, it is not common.
+for-in will iterate over the indices of the array as strings, omitting any "holes" in
+the array.
+More common is to use for-of, which iterates over the values of an array.
+If you want to iterate over the indices, alternatives include:
+
+```js
+array.forEach((value, index) => { ... });
+for (const [index, value] of array.entries()) { ... }
+for (let i = 0; i < array.length; i++) { ... }
+```
+
+Examples of **incorrect** code for this rule:
+
+```js
+for (const x in [3, 4, 5]) {
+ console.log(x);
+}
+```
+
+Examples of **correct** code for this rule:
+
+```js
+for (const x in { a: 3, b: 4, c: 5 }) {
+ console.log(x);
+}
+```
+
+## When Not To Use It
+
+If you want to iterate through a loop using the indices in an array as strings, you can turn off this rule.
+
+## Related to
+
+- TSLint: ['no-for-in-array'](https://palantir.github.io/tslint/rules/no-for-in-array/)
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-inferrable-types.md b/packages/eslint-plugin/docs/rules/no-inferrable-types.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-inferrable-types.md
rename to packages/eslint-plugin/docs/rules/no-inferrable-types.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-misused-new.md b/packages/eslint-plugin/docs/rules/no-misused-new.md
similarity index 92%
rename from packages/eslint-plugin-typescript/docs/rules/no-misused-new.md
rename to packages/eslint-plugin/docs/rules/no-misused-new.md
index ea588fd5ec29..df1aec7ad605 100644
--- a/packages/eslint-plugin-typescript/docs/rules/no-misused-new.md
+++ b/packages/eslint-plugin/docs/rules/no-misused-new.md
@@ -32,7 +32,7 @@ interface I {
```json
{
- "typescript/no-misused-new": "error"
+ "@typescript-eslint/no-misused-new": "error"
}
```
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-namespace.md b/packages/eslint-plugin/docs/rules/no-namespace.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-namespace.md
rename to packages/eslint-plugin/docs/rules/no-namespace.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-non-null-assertion.md b/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-non-null-assertion.md
rename to packages/eslint-plugin/docs/rules/no-non-null-assertion.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-object-literal-type-assertion.md b/packages/eslint-plugin/docs/rules/no-object-literal-type-assertion.md
similarity index 77%
rename from packages/eslint-plugin-typescript/docs/rules/no-object-literal-type-assertion.md
rename to packages/eslint-plugin/docs/rules/no-object-literal-type-assertion.md
index c833fe9fbbbd..b81ae0d87b69 100644
--- a/packages/eslint-plugin-typescript/docs/rules/no-object-literal-type-assertion.md
+++ b/packages/eslint-plugin/docs/rules/no-object-literal-type-assertion.md
@@ -20,9 +20,11 @@ const z = { ... } as unknown;
## Options
-```json
+```cjson
{
- "typescript/no-object-literal-type-assertion": "error"
+ "@typescript-eslint/no-object-literal-type-assertion": ["error", {
+ allowAsParameter: false // Allow type assertion in call and new expression, default false
+ }]
}
```
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-parameter-properties.md b/packages/eslint-plugin/docs/rules/no-parameter-properties.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-parameter-properties.md
rename to packages/eslint-plugin/docs/rules/no-parameter-properties.md
diff --git a/packages/eslint-plugin/docs/rules/no-require-imports.md b/packages/eslint-plugin/docs/rules/no-require-imports.md
new file mode 100644
index 000000000000..0d2b831a1acd
--- /dev/null
+++ b/packages/eslint-plugin/docs/rules/no-require-imports.md
@@ -0,0 +1,34 @@
+# Disallows invocation of `require()` (no-require-imports)
+
+Prefer the newer ES6-style imports over `require()`.
+
+## Rule Details
+
+Examples of **incorrect** code for this rule:
+
+```ts
+var lib = require('lib');
+let lib2 = require('lib2');
+var lib5 = require('lib5'),
+ lib6 = require('lib6');
+import lib8 = require('lib8');
+```
+
+Examples of **correct** code for this rule:
+
+```ts
+import { l } from 'lib';
+var lib3 = load('not_an_import');
+var lib4 = lib2.subImport;
+var lib7 = 700;
+import lib9 = lib2.anotherSubImport;
+import lib10 from 'lib10';
+```
+
+## When Not To Use It
+
+If you don't care about TypeScript module syntax, then you will not need this rule.
+
+## Compatibility
+
+- TSLint: [no-require-imports](https://palantir.github.io/tslint/rules/no-require-imports/)
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-this-alias.md b/packages/eslint-plugin/docs/rules/no-this-alias.md
similarity index 96%
rename from packages/eslint-plugin-typescript/docs/rules/no-this-alias.md
rename to packages/eslint-plugin/docs/rules/no-this-alias.md
index ea747805e0ee..b40c165b3db7 100644
--- a/packages/eslint-plugin-typescript/docs/rules/no-this-alias.md
+++ b/packages/eslint-plugin/docs/rules/no-this-alias.md
@@ -41,7 +41,7 @@ You can pass an object option:
```json5
{
- 'typescript/no-this-alias': [
+ '@typescript-eslint/no-this-alias': [
'error',
{
allowDestructuring: true, // Allow `const { props, state } = this`; false by default
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-triple-slash-reference.md b/packages/eslint-plugin/docs/rules/no-triple-slash-reference.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-triple-slash-reference.md
rename to packages/eslint-plugin/docs/rules/no-triple-slash-reference.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-type-alias.md b/packages/eslint-plugin/docs/rules/no-type-alias.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-type-alias.md
rename to packages/eslint-plugin/docs/rules/no-type-alias.md
diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md b/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md
new file mode 100644
index 000000000000..c41d0f2a4300
--- /dev/null
+++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md
@@ -0,0 +1,57 @@
+# Warns if a type assertion does not change the type of an expression (no-unnecessary-type-assertion)
+
+This rule prohibits using a type assertion that does not change the type of an expression.
+
+## Rule Details
+
+This rule aims to prevent unnecessary type assertions.
+
+Examples of **incorrect** code for this rule:
+
+```ts
+const foo = 3;
+const bar = foo!;
+```
+
+```ts
+const foo = <3>3;
+```
+
+```ts
+type Foo = 3;
+const foo = 3;
+```
+
+```ts
+type Foo = 3;
+const foo = 3 as Foo;
+```
+
+Examples of **correct** code for this rule:
+
+```ts
+const foo = 3;
+```
+
+```ts
+const foo = 3 as number;
+```
+
+### Options
+
+This rule optionally takes an object with a single property `typesToIgnore`, which can be set to a list of type names to ignore.
+
+For example, with `@typescript-eslint/no-unnecessary-type-assertion: ["error", { typesToIgnore: ['Foo'] }]`, the following is **correct** code":
+
+```ts
+type Foo = 3;
+const foo: Foo = 3;
+```
+
+## When Not To Use It
+
+If you don't care about having no-op type assertions in your code, then you can turn off this rule.
+
+## Related to
+
+- TSLint: ['no-unnecessary-type-assertion`](https://palantir.github.io/tslint/rules/no-unnecessary-type-assertion/)
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-unused-vars.md b/packages/eslint-plugin/docs/rules/no-unused-vars.md
similarity index 96%
rename from packages/eslint-plugin-typescript/docs/rules/no-unused-vars.md
rename to packages/eslint-plugin/docs/rules/no-unused-vars.md
index 58dcc78f1ee0..63f148f7a3f4 100644
--- a/packages/eslint-plugin-typescript/docs/rules/no-unused-vars.md
+++ b/packages/eslint-plugin/docs/rules/no-unused-vars.md
@@ -110,11 +110,15 @@ By default this rule is enabled with `all` option for variables and `after-used`
```CJSON
{
- "rules": {
- // note you must disable the base rule as it can report incorrect errors
- "no-unused-vars": "off",
- "typescript/no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
- }
+ "rules": {
+ // note you must disable the base rule as it can report incorrect errors
+ "no-unused-vars": "off",
+ "@typescript-eslint/no-unused-vars": ["error", {
+ "vars": "all",
+ "args": "after-used",
+ "ignoreRestSiblings": false
+ }]
+ }
}
```
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-use-before-define.md b/packages/eslint-plugin/docs/rules/no-use-before-define.md
similarity index 98%
rename from packages/eslint-plugin-typescript/docs/rules/no-use-before-define.md
rename to packages/eslint-plugin/docs/rules/no-use-before-define.md
index 553924c9c567..d439d0111a00 100644
--- a/packages/eslint-plugin-typescript/docs/rules/no-use-before-define.md
+++ b/packages/eslint-plugin/docs/rules/no-use-before-define.md
@@ -88,7 +88,7 @@ let myVar: StringOrNumber;
If this is `true`, the rule warns every reference to a variable before the variable declaration.
Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration.
Default is `true`.
-- `typedefs` (`boolean`, **added** in `eslint-plugin-typescript`) -
+- `typedefs` (`boolean`, **added** in `@typescript-eslint/eslint-plugin`) -
The flag which shows whether or not this rule checks type declarations.
If this is `true`, this rule warns every reference to a type before the type declaration.
Otherwise, ignores those references.
diff --git a/packages/eslint-plugin/docs/rules/no-useless-constructor.md b/packages/eslint-plugin/docs/rules/no-useless-constructor.md
new file mode 100644
index 000000000000..0e136d122ac1
--- /dev/null
+++ b/packages/eslint-plugin/docs/rules/no-useless-constructor.md
@@ -0,0 +1,78 @@
+# Disallow unnecessary constructors (no-useless-constructor)
+
+ES2015 provides a default class constructor if one is not specified. As such, it is unnecessary to provide an empty constructor or one that simply delegates into its parent class, as in the following examples:
+
+```js
+class A {
+ constructor() {}
+}
+
+class A extends B {
+ constructor(value) {
+ super(value);
+ }
+}
+```
+
+## Rule Details
+
+This rule flags class constructors that can be safely removed without changing how the class works.
+
+## Examples
+
+Examples of **incorrect** code for this rule:
+
+```js
+/*eslint no-useless-constructor: "error"*/
+
+class A {
+ constructor() {}
+}
+
+class A extends B {
+ constructor(...args) {
+ super(...args);
+ }
+}
+```
+
+Examples of **correct** code for this rule:
+
+```js
+/*eslint no-useless-constructor: "error"*/
+
+class A {}
+
+class A {
+ constructor() {
+ doSomething();
+ }
+}
+
+class A extends B {
+ constructor() {
+ super('foo');
+ }
+}
+
+class A extends B {
+ constructor() {
+ super();
+ doSomething();
+ }
+}
+
+class A extends B {
+ constructor(protected name: string) {}
+}
+
+class A extends B {
+ protected constructor() {}
+}
+```
+
+## When Not To Use It
+
+If you don't want to be notified about unnecessary constructors, you can safely disable this rule.
+
+Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-useless-constructor.md)
diff --git a/packages/eslint-plugin-typescript/docs/rules/no-var-requires.md b/packages/eslint-plugin/docs/rules/no-var-requires.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/no-var-requires.md
rename to packages/eslint-plugin/docs/rules/no-var-requires.md
diff --git a/packages/eslint-plugin/docs/rules/prefer-function-type.md b/packages/eslint-plugin/docs/rules/prefer-function-type.md
new file mode 100644
index 000000000000..7cbf2be0480d
--- /dev/null
+++ b/packages/eslint-plugin/docs/rules/prefer-function-type.md
@@ -0,0 +1,57 @@
+# Use function types instead of interfaces with call signatures (prefer-function-type)
+
+## Rule Details
+
+This rule suggests using a function type instead of an interface or object type literal with a single call signature.
+
+Examples of **incorrect** code for this rule:
+
+```ts
+interface Foo {
+ (): string;
+}
+```
+
+```ts
+function foo(bar: { (): number }): number {
+ return bar();
+}
+```
+
+```ts
+interface Foo extends Function {
+ (): void;
+}
+```
+
+Examples of **correct** code for this rule:
+
+```ts
+interface Foo {
+ (): void;
+ bar: number;
+}
+```
+
+```ts
+function foo(bar: { (): string; baz: number }): string {
+ return bar();
+}
+```
+
+```ts
+interface Foo {
+ bar: string;
+}
+interface Bar extends Foo {
+ (): void;
+}
+```
+
+## When Not To Use It
+
+If you specifically want to use an interface or type literal with a single call signature for stylistic reasons, you can disable this rule.
+
+## Further Reading
+
+- TSLint: [`callable-types`](https://palantir.github.io/tslint/rules/callable-types/)
diff --git a/packages/eslint-plugin-typescript/docs/rules/prefer-interface.md b/packages/eslint-plugin/docs/rules/prefer-interface.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/prefer-interface.md
rename to packages/eslint-plugin/docs/rules/prefer-interface.md
diff --git a/packages/eslint-plugin-typescript/docs/rules/prefer-namespace-keyword.md b/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/prefer-namespace-keyword.md
rename to packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md
diff --git a/packages/eslint-plugin/docs/rules/promise-function-async.md b/packages/eslint-plugin/docs/rules/promise-function-async.md
new file mode 100644
index 000000000000..c64c25c11b5a
--- /dev/null
+++ b/packages/eslint-plugin/docs/rules/promise-function-async.md
@@ -0,0 +1,65 @@
+# Functions that return promises must be async (promise-function-async)
+
+Requires any function or method that returns a Promise to be marked async.
+Ensures that each function is only capable of:
+
+- returning a rejected promise, or
+- throwing an Error object.
+
+In contrast, non-`async` `Promise`-returning functions are technically capable of either.
+Code that handles the results of those functions will often need to handle both cases, which can get complex.
+This rule's practice removes a requirement for creating code to handle both cases.
+
+## Rule Details
+
+Examples of **incorrect** code for this rule
+
+```ts
+const arrowFunctionReturnsPromise = () => Promise.resolve('value');
+
+function functionDeturnsPromise() {
+ return Math.random() > 0.5 ? Promise.resolve('value') : false;
+}
+```
+
+Examples of **correct** code for this rule
+
+```ts
+const arrowFunctionReturnsPromise = async () => 'value';
+
+async function functionDeturnsPromise() {
+ return Math.random() > 0.5 ? 'value' : false;
+}
+```
+
+## Options
+
+Options may be provided as an object with:
+
+- `allowedPromiseNames` to indicate any extra names of classes or interfaces to be considered Promises when returned.
+
+In addition, each of the following properties may be provided, and default to `true`:
+
+- `checkArrowFunctions`
+- `checkFunctionDeclarations`
+- `checkFunctionExpressions`
+- `checkMethodDeclarations`
+
+```json
+{
+ "@typescript-eslint/promise-function-async": [
+ "error",
+ {
+ "allowedPromiseNames": ["Thenable"],
+ "checkArrowFunctions": true,
+ "checkFunctionDeclarations": true,
+ "checkFunctionExpressions": true,
+ "checkMethodDeclarations": true
+ }
+ ]
+}
+```
+
+## Related To
+
+- TSLint: [promise-function-async](https://palantir.github.io/tslint/rules/promise-function-async)
diff --git a/packages/eslint-plugin/docs/rules/restrict-plus-operands.md b/packages/eslint-plugin/docs/rules/restrict-plus-operands.md
new file mode 100644
index 000000000000..a1436daf7695
--- /dev/null
+++ b/packages/eslint-plugin/docs/rules/restrict-plus-operands.md
@@ -0,0 +1,25 @@
+# When adding two variables, operands must both be of type number or of type string. (restrict-plus-operands)
+
+Examples of **correct** code:
+
+```ts
+var foo = parseInt('5.5', 10) + 10;
+```
+
+Examples of **incorrect** code:
+
+```ts
+var foo = '5.5' + 5;
+```
+
+## Options
+
+```json
+{
+ "@typescript-eslint/restrict-plus-operands": "error"
+}
+```
+
+## Compatibility
+
+- TSLint: [restrict-plus-operands](https://palantir.github.io/tslint/rules/restrict-plus-operands/)
diff --git a/packages/eslint-plugin-typescript/docs/rules/type-annotation-spacing.md b/packages/eslint-plugin/docs/rules/type-annotation-spacing.md
similarity index 100%
rename from packages/eslint-plugin-typescript/docs/rules/type-annotation-spacing.md
rename to packages/eslint-plugin/docs/rules/type-annotation-spacing.md
diff --git a/packages/eslint-plugin-typescript/jest.config.js b/packages/eslint-plugin/jest.config.js
similarity index 100%
rename from packages/eslint-plugin-typescript/jest.config.js
rename to packages/eslint-plugin/jest.config.js
diff --git a/packages/eslint-plugin/lib/configs/recommended.json b/packages/eslint-plugin/lib/configs/recommended.json
new file mode 100644
index 000000000000..cd21778bfff1
--- /dev/null
+++ b/packages/eslint-plugin/lib/configs/recommended.json
@@ -0,0 +1,42 @@
+{
+ "parser": "@typescript-eslint/parser",
+ "parserOptions": {
+ "sourceType": "module"
+ },
+ "plugins": [
+ "@typescript-eslint"
+ ],
+ "rules": {
+ "@typescript-eslint/adjacent-overload-signatures": "error",
+ "@typescript-eslint/array-type": "error",
+ "@typescript-eslint/ban-types": "error",
+ "camelcase": "off",
+ "@typescript-eslint/camelcase": "error",
+ "@typescript-eslint/class-name-casing": "error",
+ "@typescript-eslint/explicit-function-return-type": "warn",
+ "@typescript-eslint/explicit-member-accessibility": "error",
+ "indent": "off",
+ "@typescript-eslint/indent": "error",
+ "@typescript-eslint/interface-name-prefix": "error",
+ "@typescript-eslint/member-delimiter-style": "error",
+ "@typescript-eslint/no-angle-bracket-type-assertion": "error",
+ "no-array-constructor": "off",
+ "@typescript-eslint/no-array-constructor": "error",
+ "@typescript-eslint/no-empty-interface": "error",
+ "@typescript-eslint/no-explicit-any": "warn",
+ "@typescript-eslint/no-inferrable-types": "error",
+ "@typescript-eslint/no-misused-new": "error",
+ "@typescript-eslint/no-namespace": "error",
+ "@typescript-eslint/no-non-null-assertion": "error",
+ "@typescript-eslint/no-object-literal-type-assertion": "error",
+ "@typescript-eslint/no-parameter-properties": "error",
+ "@typescript-eslint/no-triple-slash-reference": "error",
+ "no-unused-vars": "off",
+ "@typescript-eslint/no-unused-vars": "warn",
+ "@typescript-eslint/no-use-before-define": "error",
+ "@typescript-eslint/no-var-requires": "error",
+ "@typescript-eslint/prefer-interface": "error",
+ "@typescript-eslint/prefer-namespace-keyword": "error",
+ "@typescript-eslint/type-annotation-spacing": "error"
+ }
+}
diff --git a/packages/eslint-plugin-typescript/lib/index.js b/packages/eslint-plugin/lib/index.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/index.js
rename to packages/eslint-plugin/lib/index.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/adjacent-overload-signatures.js b/packages/eslint-plugin/lib/rules/adjacent-overload-signatures.js
similarity index 77%
rename from packages/eslint-plugin-typescript/lib/rules/adjacent-overload-signatures.js
rename to packages/eslint-plugin/lib/rules/adjacent-overload-signatures.js
index d8eb79509558..0c53769c0e8c 100644
--- a/packages/eslint-plugin-typescript/lib/rules/adjacent-overload-signatures.js
+++ b/packages/eslint-plugin/lib/rules/adjacent-overload-signatures.js
@@ -73,6 +73,17 @@ module.exports = {
}
}
+ /**
+ * Determine whether two methods are the same or not
+ * @param {{ name: string; static: boolean }} method1 a method to compare
+ * @param {{ name: string; static: boolean }} method2 another method to compare with
+ * @returns {boolean} true if two methods are the same
+ * @private
+ */
+ function isSameMethod(method1, method2) {
+ return method1.name === method2.name && method1.static === method2.static;
+ }
+
/**
* Check the body for overload methods.
* @param {ASTNode} node the body to be inspected.
@@ -83,28 +94,32 @@ module.exports = {
const members = node.body || node.members;
if (members) {
- let name;
- let index;
- let lastName;
- const seen = [];
+ let lastMethod;
+ const seenMethods = [];
members.forEach(member => {
- name = getMemberName(member);
+ const name = getMemberName(member);
+ const method = {
+ name,
+ static: member.static
+ };
- index = seen.indexOf(name);
- if (index > -1 && lastName !== name) {
+ const index = seenMethods.findIndex(seenMethod =>
+ isSameMethod(method, seenMethod)
+ );
+ if (index > -1 && !isSameMethod(method, lastMethod)) {
context.report({
node: member,
messageId: 'adjacentSignature',
data: {
- name
+ name: (method.static ? 'static ' : '') + method.name
}
});
} else if (name && index === -1) {
- seen.push(name);
+ seenMethods.push(method);
}
- lastName = name;
+ lastMethod = method;
});
}
}
diff --git a/packages/eslint-plugin-typescript/lib/rules/array-type.js b/packages/eslint-plugin/lib/rules/array-type.js
similarity index 99%
rename from packages/eslint-plugin-typescript/lib/rules/array-type.js
rename to packages/eslint-plugin/lib/rules/array-type.js
index 9d30f23cfb4f..ba7d83a5a7f5 100644
--- a/packages/eslint-plugin-typescript/lib/rules/array-type.js
+++ b/packages/eslint-plugin/lib/rules/array-type.js
@@ -67,6 +67,7 @@ function typeNeedsParentheses(node) {
case 'TSFunctionType':
case 'TSIntersectionType':
case 'TSTypeOperator':
+ case 'TSInferType':
return true;
default:
return false;
diff --git a/packages/eslint-plugin-typescript/lib/rules/ban-types.js b/packages/eslint-plugin/lib/rules/ban-types.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/ban-types.js
rename to packages/eslint-plugin/lib/rules/ban-types.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/camelcase.js b/packages/eslint-plugin/lib/rules/camelcase.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/camelcase.js
rename to packages/eslint-plugin/lib/rules/camelcase.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/class-name-casing.js b/packages/eslint-plugin/lib/rules/class-name-casing.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/class-name-casing.js
rename to packages/eslint-plugin/lib/rules/class-name-casing.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/explicit-function-return-type.js b/packages/eslint-plugin/lib/rules/explicit-function-return-type.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/explicit-function-return-type.js
rename to packages/eslint-plugin/lib/rules/explicit-function-return-type.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/explicit-member-accessibility.js b/packages/eslint-plugin/lib/rules/explicit-member-accessibility.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/explicit-member-accessibility.js
rename to packages/eslint-plugin/lib/rules/explicit-member-accessibility.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/generic-type-naming.js b/packages/eslint-plugin/lib/rules/generic-type-naming.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/generic-type-naming.js
rename to packages/eslint-plugin/lib/rules/generic-type-naming.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/indent.js b/packages/eslint-plugin/lib/rules/indent.js
similarity index 99%
rename from packages/eslint-plugin-typescript/lib/rules/indent.js
rename to packages/eslint-plugin/lib/rules/indent.js
index a8024145a1c4..84144219faff 100644
--- a/packages/eslint-plugin-typescript/lib/rules/indent.js
+++ b/packages/eslint-plugin/lib/rules/indent.js
@@ -101,7 +101,8 @@ module.exports = Object.assign({}, baseRule, {
url: util.metaDocsUrl('indent')
},
fixable: 'whitespace',
- schema: baseRule.meta.schema
+ schema: baseRule.meta.schema,
+ messages: baseRule.meta.messages
},
create(context) {
diff --git a/packages/eslint-plugin-typescript/lib/rules/interface-name-prefix.js b/packages/eslint-plugin/lib/rules/interface-name-prefix.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/interface-name-prefix.js
rename to packages/eslint-plugin/lib/rules/interface-name-prefix.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/member-delimiter-style.js b/packages/eslint-plugin/lib/rules/member-delimiter-style.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/member-delimiter-style.js
rename to packages/eslint-plugin/lib/rules/member-delimiter-style.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/member-naming.js b/packages/eslint-plugin/lib/rules/member-naming.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/member-naming.js
rename to packages/eslint-plugin/lib/rules/member-naming.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/member-ordering.js b/packages/eslint-plugin/lib/rules/member-ordering.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/member-ordering.js
rename to packages/eslint-plugin/lib/rules/member-ordering.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-angle-bracket-type-assertion.js b/packages/eslint-plugin/lib/rules/no-angle-bracket-type-assertion.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-angle-bracket-type-assertion.js
rename to packages/eslint-plugin/lib/rules/no-angle-bracket-type-assertion.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-array-constructor.js b/packages/eslint-plugin/lib/rules/no-array-constructor.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-array-constructor.js
rename to packages/eslint-plugin/lib/rules/no-array-constructor.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-empty-interface.js b/packages/eslint-plugin/lib/rules/no-empty-interface.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-empty-interface.js
rename to packages/eslint-plugin/lib/rules/no-empty-interface.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-explicit-any.js b/packages/eslint-plugin/lib/rules/no-explicit-any.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-explicit-any.js
rename to packages/eslint-plugin/lib/rules/no-explicit-any.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-extraneous-class.js b/packages/eslint-plugin/lib/rules/no-extraneous-class.js
similarity index 90%
rename from packages/eslint-plugin-typescript/lib/rules/no-extraneous-class.js
rename to packages/eslint-plugin/lib/rules/no-extraneous-class.js
index e2eb3f0216dc..0690fc3963de 100644
--- a/packages/eslint-plugin-typescript/lib/rules/no-extraneous-class.js
+++ b/packages/eslint-plugin/lib/rules/no-extraneous-class.js
@@ -68,7 +68,10 @@ module.exports = {
if (node.body.length === 0) {
if (allowEmpty) return;
- context.report({ node: id, messageId: 'empty' });
+ context.report({
+ node: id || node.parent,
+ messageId: 'empty'
+ });
return;
}
@@ -97,14 +100,17 @@ module.exports = {
if (onlyConstructor) {
if (!allowConstructorOnly) {
context.report({
- node: id,
+ node: id || node.parent,
messageId: 'onlyConstructor'
});
}
return;
}
if (onlyStatic && !allowStaticOnly) {
- context.report({ node: id, messageId: 'onlyStatic' });
+ context.report({
+ node: id || node.parent,
+ messageId: 'onlyStatic'
+ });
}
}
};
diff --git a/packages/eslint-plugin/lib/rules/no-for-in-array.js b/packages/eslint-plugin/lib/rules/no-for-in-array.js
new file mode 100644
index 000000000000..23a19732ac45
--- /dev/null
+++ b/packages/eslint-plugin/lib/rules/no-for-in-array.js
@@ -0,0 +1,56 @@
+/**
+ * @fileoverview Disallow iterating over an array with a for-in loop
+ * @author Benjamin Lichtman
+ */
+'use strict';
+const ts = require('typescript');
+const util = require('../util');
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+/**
+ * @type {import("eslint").Rule.RuleModule}
+ */
+module.exports = {
+ meta: {
+ docs: {
+ description: 'Disallow iterating over an array with a for-in loop',
+ category: 'Functionality',
+ recommended: false,
+ extraDescription: [util.tslintRule('no-for-in-array')],
+ url: util.metaDocsUrl('no-for-in-array')
+ },
+ fixable: null,
+ messages: {
+ forInViolation:
+ 'For-in loops over arrays are forbidden. Use for-of or array.forEach instead.'
+ },
+ schema: [],
+ type: 'problem'
+ },
+
+ create(context) {
+ return {
+ ForInStatement(node) {
+ const parserServices = util.getParserServices(context);
+ const checker = parserServices.program.getTypeChecker();
+ const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node);
+
+ const type = checker.getTypeAtLocation(originalNode.expression);
+
+ if (
+ (typeof type.symbol !== 'undefined' &&
+ type.symbol.name === 'Array') ||
+ (type.flags & ts.TypeFlags.StringLike) !== 0
+ ) {
+ context.report({
+ node,
+ messageId: 'forInViolation'
+ });
+ }
+ }
+ };
+ }
+};
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-inferrable-types.js b/packages/eslint-plugin/lib/rules/no-inferrable-types.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-inferrable-types.js
rename to packages/eslint-plugin/lib/rules/no-inferrable-types.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-misused-new.js b/packages/eslint-plugin/lib/rules/no-misused-new.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-misused-new.js
rename to packages/eslint-plugin/lib/rules/no-misused-new.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-namespace.js b/packages/eslint-plugin/lib/rules/no-namespace.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-namespace.js
rename to packages/eslint-plugin/lib/rules/no-namespace.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-non-null-assertion.js b/packages/eslint-plugin/lib/rules/no-non-null-assertion.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-non-null-assertion.js
rename to packages/eslint-plugin/lib/rules/no-non-null-assertion.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-object-literal-type-assertion.js b/packages/eslint-plugin/lib/rules/no-object-literal-type-assertion.js
similarity index 76%
rename from packages/eslint-plugin-typescript/lib/rules/no-object-literal-type-assertion.js
rename to packages/eslint-plugin/lib/rules/no-object-literal-type-assertion.js
index f98a28a38f0c..11258a99315f 100644
--- a/packages/eslint-plugin-typescript/lib/rules/no-object-literal-type-assertion.js
+++ b/packages/eslint-plugin/lib/rules/no-object-literal-type-assertion.js
@@ -10,6 +10,12 @@ const util = require('../util');
// Rule Definition
//------------------------------------------------------------------------------
+const defaultOptions = [
+ {
+ allowAsParameter: false
+ }
+];
+
module.exports = {
meta: {
type: 'problem',
@@ -25,9 +31,24 @@ module.exports = {
unexpectedTypeAssertion:
'Type assertion on object literals is forbidden, use a type annotation instead.'
},
- schema: []
+ schema: [
+ {
+ type: 'object',
+ additionalProperties: false,
+ properties: {
+ allowAsParameter: {
+ type: 'boolean'
+ }
+ }
+ }
+ ]
},
create(context) {
+ const { allowAsParameter } = util.applyDefault(
+ defaultOptions,
+ context.options
+ )[0];
+
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
@@ -52,6 +73,14 @@ module.exports = {
return {
'TSTypeAssertion, TSAsExpression'(node) {
+ if (
+ allowAsParameter &&
+ (node.parent.type === 'NewExpression' ||
+ node.parent.type === 'CallExpression')
+ ) {
+ return;
+ }
+
if (
checkType(node.typeAnnotation) &&
node.expression.type === 'ObjectExpression'
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-parameter-properties.js b/packages/eslint-plugin/lib/rules/no-parameter-properties.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-parameter-properties.js
rename to packages/eslint-plugin/lib/rules/no-parameter-properties.js
diff --git a/packages/eslint-plugin/lib/rules/no-require-imports.js b/packages/eslint-plugin/lib/rules/no-require-imports.js
new file mode 100644
index 000000000000..82537a4dcdaa
--- /dev/null
+++ b/packages/eslint-plugin/lib/rules/no-require-imports.js
@@ -0,0 +1,50 @@
+/**
+ * @fileoverview Disallows invocation of `require()`.
+ * @author Kanitkorn Sujautra
+ */
+'use strict';
+
+const util = require('../util');
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+ meta: {
+ type: 'problem',
+ docs: {
+ description: 'Disallows invocation of `require()`.',
+ extraDescription: [util.tslintRule('no-require-imports')],
+ category: 'TypeScript',
+ url: util.metaDocsUrl('no-require-imports'),
+ recommended: 'error'
+ },
+ schema: [],
+ messages: {
+ noRequireImports: 'A `require()` style import is forbidden.'
+ }
+ },
+ create(context) {
+ //----------------------------------------------------------------------
+ // Public
+ //----------------------------------------------------------------------
+
+ return {
+ CallExpression(node) {
+ if (node.callee.name === 'require') {
+ context.report({
+ node,
+ messageId: 'noRequireImports'
+ });
+ }
+ },
+ TSExternalModuleReference(node) {
+ context.report({
+ node,
+ messageId: 'noRequireImports'
+ });
+ }
+ };
+ }
+};
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-this-alias.js b/packages/eslint-plugin/lib/rules/no-this-alias.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-this-alias.js
rename to packages/eslint-plugin/lib/rules/no-this-alias.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-triple-slash-reference.js b/packages/eslint-plugin/lib/rules/no-triple-slash-reference.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-triple-slash-reference.js
rename to packages/eslint-plugin/lib/rules/no-triple-slash-reference.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-type-alias.js b/packages/eslint-plugin/lib/rules/no-type-alias.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-type-alias.js
rename to packages/eslint-plugin/lib/rules/no-type-alias.js
diff --git a/packages/eslint-plugin/lib/rules/no-unnecessary-type-assertion.js b/packages/eslint-plugin/lib/rules/no-unnecessary-type-assertion.js
new file mode 100644
index 000000000000..bcbe300a01b0
--- /dev/null
+++ b/packages/eslint-plugin/lib/rules/no-unnecessary-type-assertion.js
@@ -0,0 +1,185 @@
+/**
+ * @fileoverview Rule to warn if a type assertion does not change the type of an expression
+ * @author Benjamin Lichtman
+ */
+
+'use strict';
+const tsutils = require('tsutils');
+const ts = require('typescript');
+const util = require('../util');
+
+/** @typedef {import("estree").Node} Node */
+/** @typedef {import("eslint").Rule.RuleContext} Context */
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+/** @type {import("eslint").Rule.RuleModule} */
+module.exports = {
+ meta: {
+ docs: {
+ description:
+ 'Warns if a type assertion does not change the type of an expression',
+ category: 'TypeScript-specific',
+ recommended: false,
+ extraDescription: [util.tslintRule('no-unnecessary-type-assertion')],
+ url: util.metaDocsUrl('no-unnecessary-type-assertion')
+ },
+ fixable: 'code',
+ messages: {
+ unnecessaryAssertion:
+ 'This assertion is unnecessary since it does not change the type of the expression.'
+ },
+ schema: [
+ {
+ type: 'object',
+ properties: {
+ typesToIgnore: {
+ type: 'array',
+ items: {
+ type: 'string'
+ }
+ }
+ }
+ }
+ ],
+ type: 'suggestion'
+ },
+
+ create(context) {
+ const sourceCode = context.getSourceCode();
+ const checker = util.getParserServices(context).program.getTypeChecker();
+
+ /**
+ * Sometimes tuple types don't have ObjectFlags.Tuple set, like when they're being matched against an inferred type.
+ * So, in addition, check if there are integer properties 0..n and no other numeric keys
+ * @param {ts.ObjectType} type type
+ * @returns {boolean} true if type could be a tuple type
+ */
+ function couldBeTupleType(type) {
+ const properties = type.getProperties();
+
+ if (properties.length === 0) {
+ return false;
+ }
+ let i = 0;
+
+ for (; i < properties.length; ++i) {
+ const name = properties[i].name;
+
+ if (String(i) !== name) {
+ if (i === 0) {
+ // if there are no integer properties, this is not a tuple
+ return false;
+ }
+ break;
+ }
+ }
+ for (; i < properties.length; ++i) {
+ if (String(+properties[i].name) === properties[i].name) {
+ return false; // if there are any other numeric properties, this is not a tuple
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @param {Node} node node being linted
+ * @returns {void}
+ */
+ function checkNonNullAssertion(node) {
+ /**
+ * Corresponding TSNode is guaranteed to be in map
+ * @type {ts.NonNullExpression}
+ */
+ const originalNode = context.parserServices.esTreeNodeToTSNodeMap.get(
+ node
+ );
+ const type = checker.getTypeAtLocation(originalNode.expression);
+
+ if (type === checker.getNonNullableType(type)) {
+ context.report({
+ node,
+ messageId: 'unnecessaryAssertion',
+ fix(fixer) {
+ return fixer.removeRange([
+ originalNode.expression.end,
+ originalNode.end
+ ]);
+ }
+ });
+ }
+ }
+
+ /**
+ * @param {Node} node node being linted
+ * @returns {void}
+ */
+ function verifyCast(node) {
+ const options = context.options[0];
+
+ if (
+ options &&
+ options.typesToIgnore &&
+ options.typesToIgnore.indexOf(
+ sourceCode.getText(node.typeAnnotation)
+ ) !== -1
+ ) {
+ return;
+ }
+
+ /**
+ * Corresponding TSNode is guaranteed to be in map
+ * @type {ts.AssertionExpression}
+ */
+ const originalNode = context.parserServices.esTreeNodeToTSNodeMap.get(
+ node
+ );
+ const castType = checker.getTypeAtLocation(originalNode);
+
+ if (
+ tsutils.isTypeFlagSet(castType, ts.TypeFlags.Literal) ||
+ (tsutils.isObjectType(castType) &&
+ (tsutils.isObjectFlagSet(castType, ts.ObjectFlags.Tuple) ||
+ couldBeTupleType(castType)))
+ ) {
+ // It's not always safe to remove a cast to a literal type or tuple
+ // type, as those types are sometimes widened without the cast.
+ return;
+ }
+
+ const uncastType = checker.getTypeAtLocation(originalNode.expression);
+
+ if (uncastType === castType) {
+ context.report({
+ node,
+ messageId: 'unnecessaryAssertion',
+ fix(fixer) {
+ return originalNode.kind === ts.SyntaxKind.TypeAssertionExpression
+ ? fixer.removeRange([
+ originalNode.getStart(),
+ originalNode.expression.getStart()
+ ])
+ : fixer.removeRange([
+ originalNode.expression.end,
+ originalNode.end
+ ]);
+ }
+ });
+ }
+ }
+
+ return {
+ TSNonNullExpression(node) {
+ checkNonNullAssertion(node);
+ },
+ TSTypeAssertion(node) {
+ verifyCast(node);
+ },
+ TSAsExpression(node) {
+ verifyCast(node);
+ }
+ };
+ }
+};
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-unused-vars.js b/packages/eslint-plugin/lib/rules/no-unused-vars.js
similarity index 64%
rename from packages/eslint-plugin-typescript/lib/rules/no-unused-vars.js
rename to packages/eslint-plugin/lib/rules/no-unused-vars.js
index eef6ddb2310f..79c60d437c24 100644
--- a/packages/eslint-plugin-typescript/lib/rules/no-unused-vars.js
+++ b/packages/eslint-plugin/lib/rules/no-unused-vars.js
@@ -21,7 +21,8 @@ module.exports = Object.assign({}, baseRule, {
url: util.metaDocsUrl('no-unused-vars'),
recommended: 'warn'
},
- schema: baseRule.meta.schema
+ schema: baseRule.meta.schema,
+ messages: baseRule.meta.messages
},
create(context) {
@@ -44,6 +45,25 @@ module.exports = Object.assign({}, baseRule, {
}
}
+ /**
+ * Mark heritage clause as used
+ * @param node The node currently being traversed
+ * @returns {void}
+ */
+ function markHeritageAsUsed(node) {
+ switch (node.type) {
+ case 'Identifier':
+ context.markVariableAsUsed(node.name);
+ break;
+ case 'MemberExpression':
+ markHeritageAsUsed(node.object);
+ break;
+ case 'CallExpression':
+ markHeritageAsUsed(node.callee);
+ break;
+ }
+ }
+
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
@@ -53,8 +73,15 @@ module.exports = Object.assign({}, baseRule, {
'TSTypeReference Identifier'(node) {
context.markVariableAsUsed(node.name);
},
- 'TSClassImplements Identifier'(node) {
- context.markVariableAsUsed(node.name);
+ TSInterfaceHeritage(node) {
+ if (node.expression) {
+ markHeritageAsUsed(node.expression);
+ }
+ },
+ TSClassImplements(node) {
+ if (node.expression) {
+ markHeritageAsUsed(node.expression);
+ }
},
'TSParameterProperty Identifier'(node) {
// just assume parameter properties are used
@@ -62,6 +89,15 @@ module.exports = Object.assign({}, baseRule, {
},
'TSEnumMember Identifier'(node) {
context.markVariableAsUsed(node.name);
+ },
+ '*[declare=true] Identifier'(node) {
+ context.markVariableAsUsed(node.name);
+ const scope = context.getScope();
+ const { variableScope } = scope;
+ if (variableScope !== scope) {
+ const superVar = variableScope.set.get(node.name);
+ if (superVar) superVar.eslintUsed = true;
+ }
}
});
}
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-use-before-define.js b/packages/eslint-plugin/lib/rules/no-use-before-define.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-use-before-define.js
rename to packages/eslint-plugin/lib/rules/no-use-before-define.js
diff --git a/packages/eslint-plugin/lib/rules/no-useless-constructor.js b/packages/eslint-plugin/lib/rules/no-useless-constructor.js
new file mode 100644
index 000000000000..c30cdcf872bf
--- /dev/null
+++ b/packages/eslint-plugin/lib/rules/no-useless-constructor.js
@@ -0,0 +1,80 @@
+/**
+ * @fileoverview Disallow unnecessary constructors
+ * @author Armano
+ */
+'use strict';
+
+const baseRule = require('eslint/lib/rules/no-useless-constructor');
+const util = require('../util');
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+/**
+ * Check if method with accessibility is not useless
+ * @param {MethodDefinition} node
+ * @returns {boolean}
+ */
+function checkAccessibility(node) {
+ switch (node.accessibility) {
+ case 'protected':
+ case 'private':
+ return false;
+ case 'public':
+ if (
+ node.parent.type === 'ClassBody' &&
+ node.parent.parent &&
+ node.parent.parent.superClass
+ ) {
+ return false;
+ }
+ break;
+ }
+ return true;
+}
+
+/**
+ * Check if method is not unless due to typescript parameter properties
+ * @param {MethodDefinition} node
+ * @returns {boolean}
+ */
+function checkParams(node) {
+ return (
+ !node.value.params ||
+ !node.value.params.some(param => param.type === 'TSParameterProperty')
+ );
+}
+
+module.exports = Object.assign({}, baseRule, {
+ meta: {
+ type: 'problem',
+ docs: {
+ description: 'Disallow unnecessary constructors',
+ category: 'ECMAScript 6',
+ url: util.metaDocsUrl('no-useless-constructor')
+ },
+ schema: baseRule.meta.schema,
+ messages: baseRule.meta.messages
+ },
+
+ create(context) {
+ const rules = baseRule.create(context);
+
+ //----------------------------------------------------------------------
+ // Public
+ //----------------------------------------------------------------------
+ return {
+ MethodDefinition(node) {
+ if (
+ node.value &&
+ node.value.type === 'FunctionExpression' &&
+ checkAccessibility(node) &&
+ checkParams(node)
+ ) {
+ rules.MethodDefinition(node);
+ }
+ }
+ };
+ }
+});
diff --git a/packages/eslint-plugin-typescript/lib/rules/no-var-requires.js b/packages/eslint-plugin/lib/rules/no-var-requires.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/no-var-requires.js
rename to packages/eslint-plugin/lib/rules/no-var-requires.js
diff --git a/packages/eslint-plugin/lib/rules/prefer-function-type.js b/packages/eslint-plugin/lib/rules/prefer-function-type.js
new file mode 100644
index 000000000000..a34b7ba4c1a3
--- /dev/null
+++ b/packages/eslint-plugin/lib/rules/prefer-function-type.js
@@ -0,0 +1,171 @@
+/**
+ * @fileoverview Use function types instead of interfaces with call signatures
+ * @author Benjamin Lichtman
+ */
+'use strict';
+const util = require('../util');
+
+/**
+ * @typedef {import("eslint").Rule.RuleModule} RuleModule
+ * @typedef {import("estree").Node} ESTreeNode
+ */
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+/**
+ * @type {RuleModule}
+ */
+module.exports = {
+ meta: {
+ docs: {
+ description:
+ 'Use function types instead of interfaces with call signatures',
+ category: 'TypeScript',
+ recommended: false,
+ extraDescription: [util.tslintRule('callable-types')],
+ url: util.metaDocsUrl('prefer-function-type')
+ },
+ fixable: 'code',
+ messages: {
+ functionTypeOverCallableType:
+ "{{ type }} has only a call signature - use '{{ sigSuggestion }}' instead."
+ },
+ schema: [],
+ type: 'suggestion'
+ },
+
+ create(context) {
+ const sourceCode = context.getSourceCode();
+
+ //----------------------------------------------------------------------
+ // Helpers
+ //----------------------------------------------------------------------
+
+ /**
+ * Checks if there is no supertype or if the supertype is 'Function'
+ * @param {ESTreeNode} node The node being checked
+ * @returns {boolean} Returns true iff there is no supertype or if the supertype is 'Function'
+ */
+ function noSupertype(node) {
+ if (!node.extends || node.extends.length === 0) {
+ return true;
+ }
+ if (node.extends.length !== 1) {
+ return false;
+ }
+ const expr = node.extends[0].expression;
+
+ return expr.type === 'Identifier' && expr.name === 'Function';
+ }
+
+ /**
+ * @param {ESTreeNode} parent The parent of the call signature causing the diagnostic
+ * @returns {boolean} true iff the parent node needs to be wrapped for readability
+ */
+ function shouldWrapSuggestion(parent) {
+ switch (parent.type) {
+ case 'TSUnionType':
+ case 'TSIntersectionType':
+ case 'TSArrayType':
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * @param {ESTreeNode} call The call signature causing the diagnostic
+ * @param {ESTreeNode} parent The parent of the call
+ * @returns {string} The suggestion to report
+ */
+ function renderSuggestion(call, parent) {
+ const start = call.range[0];
+ const colonPos = call.returnType.range[0] - start;
+ const text = sourceCode.getText().slice(start, call.range[1]);
+
+ let suggestion = `${text.slice(0, colonPos)} =>${text.slice(
+ colonPos + 1
+ )}`;
+
+ if (shouldWrapSuggestion(parent.parent)) {
+ suggestion = `(${suggestion})`;
+ }
+ if (parent.type === 'TSInterfaceDeclaration') {
+ if (typeof parent.typeParameters !== 'undefined') {
+ return `type ${sourceCode
+ .getText()
+ .slice(
+ parent.id.range[0],
+ parent.typeParameters.range[1]
+ )} = ${suggestion}`;
+ }
+ return `type ${parent.id.name} = ${suggestion}`;
+ }
+ return suggestion.endsWith(';') ? suggestion.slice(0, -1) : suggestion;
+ }
+
+ /**
+ * @param {ESTreeNode} member The TypeElement being checked
+ * @param {ESTreeNode} node The parent of member being checked
+ * @returns {void}
+ */
+ function checkMember(member, node) {
+ if (
+ (member.type === 'TSCallSignatureDeclaration' ||
+ member.type === 'TSConstructSignatureDeclaration') &&
+ typeof member.returnType !== 'undefined'
+ ) {
+ const suggestion = renderSuggestion(member, node);
+ const fixStart =
+ node.type === 'TSTypeLiteral'
+ ? node.range[0]
+ : sourceCode
+ .getTokens(node)
+ .filter(
+ token =>
+ token.type === 'Keyword' && token.value === 'interface'
+ )[0].range[0];
+
+ context.report({
+ node: member,
+ messageId: 'functionTypeOverCallableType',
+ data: {
+ type: node.type === 'TSTypeLiteral' ? 'Type literal' : 'Interface',
+ sigSuggestion: suggestion
+ },
+ fix(fixer) {
+ return fixer.replaceTextRange(
+ [fixStart, node.range[1]],
+ suggestion
+ );
+ }
+ });
+ }
+ }
+
+ //----------------------------------------------------------------------
+ // Public
+ //----------------------------------------------------------------------
+
+ return {
+ /**
+ * @param {TSInterfaceDeclaration} node The node being checked
+ * @returns {void}
+ */
+ TSInterfaceDeclaration(node) {
+ if (noSupertype(node) && node.body.body.length === 1) {
+ checkMember(node.body.body[0], node);
+ }
+ },
+ /**
+ * @param {TSTypeLiteral} node The node being checked
+ * @returns {void}
+ */
+ 'TSTypeLiteral[members.length = 1]'(node) {
+ checkMember(node.members[0], node);
+ }
+ };
+ }
+};
diff --git a/packages/eslint-plugin-typescript/lib/rules/prefer-interface.js b/packages/eslint-plugin/lib/rules/prefer-interface.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/prefer-interface.js
rename to packages/eslint-plugin/lib/rules/prefer-interface.js
diff --git a/packages/eslint-plugin-typescript/lib/rules/prefer-namespace-keyword.js b/packages/eslint-plugin/lib/rules/prefer-namespace-keyword.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/prefer-namespace-keyword.js
rename to packages/eslint-plugin/lib/rules/prefer-namespace-keyword.js
diff --git a/packages/eslint-plugin/lib/rules/promise-function-async.js b/packages/eslint-plugin/lib/rules/promise-function-async.js
new file mode 100644
index 000000000000..febbbc2a012b
--- /dev/null
+++ b/packages/eslint-plugin/lib/rules/promise-function-async.js
@@ -0,0 +1,125 @@
+/**
+ * @fileoverview Requires any function or method that returns a Promise to be marked async
+ * @author Josh Goldberg
+ */
+'use strict';
+
+const util = require('../util');
+const types = require('../utils/types');
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+const defaultOptions = [
+ {
+ allowedPromiseNames: [],
+ checkArrowFunctions: true,
+ checkFunctionDeclarations: true,
+ checkFunctionExpressions: true,
+ checkMethodDeclarations: true
+ }
+];
+
+/**
+ * @type {import("eslint").Rule.RuleModule}
+ */
+module.exports = {
+ meta: {
+ type: 'suggestion',
+ docs: {
+ description:
+ 'Requires any function or method that returns a Promise to be marked async.',
+ extraDescription: [util.tslintRule('promise-function-async')],
+ category: 'TypeScript',
+ url: util.metaDocsUrl('promise-function-async'),
+ recommended: 'error'
+ },
+ fixable: null,
+ messages: {
+ missingAsync: 'Functions that return promises must be async.'
+ },
+ schema: [
+ {
+ type: 'object',
+ properties: {
+ allowedPromiseNames: {
+ type: 'array',
+ items: {
+ type: 'string'
+ }
+ },
+ checkArrowFunctions: {
+ type: 'boolean'
+ },
+ checkFunctionDeclarations: {
+ type: 'boolean'
+ },
+ checkFunctionExpressions: {
+ type: 'boolean'
+ },
+ checkMethodDeclarations: {
+ type: 'boolean'
+ }
+ },
+ additionalProperties: false
+ }
+ ]
+ },
+
+ create(context) {
+ const {
+ allowedPromiseNames,
+ checkArrowFunctions,
+ checkFunctionDeclarations,
+ checkFunctionExpressions,
+ checkMethodDeclarations
+ } = util.applyDefault(defaultOptions, context.options)[0];
+
+ const allAllowedPromiseNames = new Set(['Promise', ...allowedPromiseNames]);
+ const parserServices = util.getParserServices(context);
+ const checker = parserServices.program.getTypeChecker();
+
+ /**
+ * @param {import("estree").Function} node
+ */
+ function validateNode(node) {
+ const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node);
+ const [callSignature] = checker
+ .getTypeAtLocation(originalNode)
+ .getCallSignatures();
+ const returnType = checker.getReturnTypeOfSignature(callSignature);
+
+ if (!types.containsTypeByName(returnType, allAllowedPromiseNames)) {
+ return;
+ }
+
+ context.report({
+ messageId: 'missingAsync',
+ node
+ });
+ }
+
+ return {
+ ArrowFunctionExpression(node) {
+ if (checkArrowFunctions && !node.async) {
+ validateNode(node);
+ }
+ },
+ FunctionDeclaration(node) {
+ if (checkFunctionDeclarations && !node.async) {
+ validateNode(node);
+ }
+ },
+ FunctionExpression(node) {
+ if (!!node.parent && node.parent.kind === 'method') {
+ if (checkMethodDeclarations && !node.async) {
+ validateNode(node.parent);
+ }
+ } else if (checkFunctionExpressions && !node.async) {
+ validateNode(node);
+ }
+ }
+ };
+ }
+};
diff --git a/packages/eslint-plugin/lib/rules/restrict-plus-operands.js b/packages/eslint-plugin/lib/rules/restrict-plus-operands.js
new file mode 100644
index 000000000000..222f51e5c8af
--- /dev/null
+++ b/packages/eslint-plugin/lib/rules/restrict-plus-operands.js
@@ -0,0 +1,104 @@
+/**
+ * @fileoverview When adding two variables, operands must both be of type number or of type string.
+ * @author James Henry
+ * @author Armano
+ */
+'use strict';
+
+const util = require('../util');
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+ meta: {
+ type: 'problem',
+ docs: {
+ description:
+ 'When adding two variables, operands must both be of type number or of type string.',
+ extraDescription: [util.tslintRule('restrict-plus-operands')],
+ category: 'TypeScript',
+ url: util.metaDocsUrl('restrict-plus-operands')
+ },
+ messages: {
+ notNumbers:
+ "Operands of '+' operation must either be both strings or both numbers.",
+ notStrings:
+ "Operands of '+' operation must either be both strings or both numbers. Consider using a template literal."
+ },
+ schema: []
+ },
+
+ create(context) {
+ const service = util.getParserServices(context);
+
+ const typeChecker = service.program.getTypeChecker();
+
+ /**
+ * Helper function to get base type of node
+ * @param {ts.Type} type type to be evaluated
+ * @returns {*} string, number or invalid
+ */
+ function getBaseTypeOfLiteralType(type) {
+ if (type.isNumberLiteral()) {
+ return 'number';
+ }
+ if (type.isStringLiteral()) {
+ return 'string';
+ }
+ if (type.isUnion()) {
+ const types = type.types.map(getBaseTypeOfLiteralType);
+
+ return types.every(value => value === types[0]) ? types[0] : 'invalid';
+ }
+
+ const stringType = typeChecker.typeToString(type);
+
+ if (stringType === 'number' || stringType === 'string') {
+ return stringType;
+ }
+ return 'invalid';
+ }
+
+ /**
+ * Helper function to get base type of node
+ * @param {ASTNode} node the node to be evaluated.
+ * @returns {*} string, number or invalid
+ */
+ function getNodeType(node) {
+ const tsNode = service.esTreeNodeToTSNodeMap.get(node);
+ const type = typeChecker.getTypeAtLocation(tsNode);
+
+ return getBaseTypeOfLiteralType(type);
+ }
+
+ //----------------------------------------------------------------------
+ // Public
+ //----------------------------------------------------------------------
+ return {
+ "BinaryExpression[operator='+']"(node) {
+ const leftType = getNodeType(node.left);
+ const rightType = getNodeType(node.right);
+
+ if (
+ leftType === 'invalid' ||
+ rightType === 'invalid' ||
+ leftType !== rightType
+ ) {
+ if (leftType === 'string' || rightType === 'string') {
+ context.report({
+ node,
+ messageId: 'notStrings'
+ });
+ } else {
+ context.report({
+ node,
+ messageId: 'notNumbers'
+ });
+ }
+ }
+ }
+ };
+ }
+};
diff --git a/packages/eslint-plugin-typescript/lib/rules/type-annotation-spacing.js b/packages/eslint-plugin/lib/rules/type-annotation-spacing.js
similarity index 100%
rename from packages/eslint-plugin-typescript/lib/rules/type-annotation-spacing.js
rename to packages/eslint-plugin/lib/rules/type-annotation-spacing.js
diff --git a/packages/eslint-plugin-typescript/lib/util.js b/packages/eslint-plugin/lib/util.js
similarity index 84%
rename from packages/eslint-plugin-typescript/lib/util.js
rename to packages/eslint-plugin/lib/util.js
index 2578c60aa806..6714e600ee65 100644
--- a/packages/eslint-plugin-typescript/lib/util.js
+++ b/packages/eslint-plugin/lib/util.js
@@ -5,7 +5,7 @@ const version = require('../package.json').version;
exports.tslintRule = name => `\`${name}\` from TSLint`;
exports.metaDocsUrl = name =>
- `https://github.com/typescript-eslint/typescript-eslint/blob/${version}/packages/eslint-plugin-typescript/docs/rules/${name}.md`;
+ `https://github.com/typescript-eslint/typescript-eslint/blob/v${version}/packages/eslint-plugin/docs/rules/${name}.md`;
/**
* Check if the context file name is *.ts or *.tsx
@@ -109,7 +109,7 @@ exports.upperCaseFirst = str => str[0].toUpperCase() + str.slice(1);
/**
* Try to retrieve typescript parser service from context
* @param {RuleContext} context Rule context
- * @returns {{esTreeNodeToTSNodeMap}|{program}|Object|*} parserServices
+ * @returns {{program: Program, esTreeNodeToTSNodeMap: NodeMap}} parserServices
*/
exports.getParserServices = context => {
if (
@@ -117,11 +117,12 @@ exports.getParserServices = context => {
!context.parserServices.program ||
!context.parserServices.esTreeNodeToTSNodeMap
) {
- // TODO - the message will require revisiting once the typescript-eslint-parser/typescript-estree finalises
- // their work around exposing the parser. They may require that there be a project config field in
- // the eslint config, in which case we should check and/or report that here appropriately.
+ /**
+ * The user needs to have configured "project" in their parserOptions
+ * for @typescript-eslint/parser
+ */
throw new Error(
- 'This rule requires you to use `eslint-plugin-typescript/parser`.'
+ `You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.`
);
}
return context.parserServices;
diff --git a/packages/eslint-plugin/lib/utils/types.js b/packages/eslint-plugin/lib/utils/types.js
new file mode 100644
index 000000000000..adfb402b72ae
--- /dev/null
+++ b/packages/eslint-plugin/lib/utils/types.js
@@ -0,0 +1,38 @@
+'use strict';
+
+const tsutils = require('tsutils');
+const ts = require('typescript');
+
+/**
+ * @param {string} type Type being checked by name.
+ * @param {Set} allowedNames Symbol names checking on the type.
+ * @returns {boolean} Whether the type is, extends, or contains any of the allowed names.
+ */
+function containsTypeByName(type, allowedNames) {
+ if (tsutils.isTypeFlagSet(type, ts.TypeFlags.Any | ts.TypeFlags.Unknown)) {
+ return true;
+ }
+
+ if (tsutils.isTypeReference(type)) {
+ type = type.target;
+ }
+
+ if (
+ typeof type.symbol !== 'undefined' &&
+ allowedNames.has(type.symbol.name)
+ ) {
+ return true;
+ }
+
+ if (tsutils.isUnionOrIntersectionType(type)) {
+ return type.types.some(t => containsTypeByName(t, allowedNames));
+ }
+
+ const bases = type.getBaseTypes();
+ return (
+ typeof bases !== 'undefined' &&
+ bases.some(t => containsTypeByName(t, allowedNames))
+ );
+}
+
+exports.containsTypeByName = containsTypeByName;
diff --git a/packages/eslint-plugin-typescript/package.json b/packages/eslint-plugin/package.json
similarity index 75%
rename from packages/eslint-plugin-typescript/package.json
rename to packages/eslint-plugin/package.json
index ac55100bc692..7b1c3d4bc204 100644
--- a/packages/eslint-plugin-typescript/package.json
+++ b/packages/eslint-plugin/package.json
@@ -1,6 +1,6 @@
{
- "name": "eslint-plugin-typescript",
- "version": "1.0.0-rc.3",
+ "name": "@typescript-eslint/eslint-plugin",
+ "version": "1.3.0",
"description": "TypeScript plugin for ESLint",
"keywords": [
"eslint",
@@ -9,7 +9,7 @@
"typescript"
],
"engines": {
- "node": ">=6"
+ "node": "^6.14.0 || ^8.10.0 || >=9.10.0"
},
"repository": "typescript-eslint/typescript-eslint",
"bugs": {
@@ -24,15 +24,16 @@
"recommended:update": "node tools/update-recommended.js"
},
"dependencies": {
+ "@typescript-eslint/parser": "1.3.0",
"requireindex": "^1.2.0",
- "typescript-eslint-parser": "21.0.2"
+ "tsutils": "^3.7.0"
},
"devDependencies": {
"eslint": "^5.9.0",
"eslint-docs": "^0.2.6"
},
"peerDependencies": {
- "eslint": ">=4.13.1 < 6",
- "typescript": "~3.2.1"
+ "eslint": "^5.0.0",
+ "typescript": "*"
}
}
diff --git a/packages/eslint-plugin/tests/fixtures/tsconfig.json b/packages/eslint-plugin/tests/fixtures/tsconfig.json
new file mode 100644
index 000000000000..8702b63472ba
--- /dev/null
+++ b/packages/eslint-plugin/tests/fixtures/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "module": "commonjs",
+ "strict": true,
+ "esModuleInterop": true,
+ "lib": ["es2015", "es2017"]
+ }
+}
diff --git a/packages/eslint-plugin/tests/lib/eslint-rules/arrow-parens.js b/packages/eslint-plugin/tests/lib/eslint-rules/arrow-parens.js
new file mode 100644
index 000000000000..e8a77ca2013d
--- /dev/null
+++ b/packages/eslint-plugin/tests/lib/eslint-rules/arrow-parens.js
@@ -0,0 +1,44 @@
+'use strict';
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const rule = require('eslint/lib/rules/arrow-parens'),
+ RuleTester = require('eslint').RuleTester;
+
+const ruleTester = new RuleTester({
+ parser: '@typescript-eslint/parser'
+});
+
+ruleTester.run('arrow-parens', rule, {
+ valid: [
+ // https://github.com/typescript-eslint/typescript-eslint/issues/14
+ 'const foo = (t) => {};',
+ 'const foo = (t) => {};',
+ 'const foo = (t: T) => {};',
+ 'const foo = ((t: T) => {});',
+ 'const foo = function (t: T) {};',
+ {
+ code: 'const foo = t => {};',
+ options: ['as-needed']
+ },
+ {
+ code: 'const foo = (t) => {};',
+ options: ['as-needed']
+ },
+ {
+ code: 'const foo = (t: T) => {};',
+ options: ['as-needed']
+ },
+ {
+ code: 'const foo = (t: T) => {};',
+ options: ['as-needed']
+ },
+ {
+ code: 'const foo = (t: T) => ({});',
+ options: ['as-needed', { requireForBlockBody: true }]
+ }
+ ],
+ invalid: []
+});
diff --git a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-dupe-args.js b/packages/eslint-plugin/tests/lib/eslint-rules/no-dupe-args.js
similarity index 94%
rename from packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-dupe-args.js
rename to packages/eslint-plugin/tests/lib/eslint-rules/no-dupe-args.js
index eda55ccd242c..65d2c88314e0 100644
--- a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-dupe-args.js
+++ b/packages/eslint-plugin/tests/lib/eslint-rules/no-dupe-args.js
@@ -13,7 +13,7 @@ const ruleTester = new RuleTester({
sourceType: 'module',
ecmaFeatures: {}
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-dupe-args', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-implicit-globals.js b/packages/eslint-plugin/tests/lib/eslint-rules/no-implicit-globals.js
similarity index 94%
rename from packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-implicit-globals.js
rename to packages/eslint-plugin/tests/lib/eslint-rules/no-implicit-globals.js
index 410f23df03ff..654c3374ca8b 100644
--- a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-implicit-globals.js
+++ b/packages/eslint-plugin/tests/lib/eslint-rules/no-implicit-globals.js
@@ -12,7 +12,7 @@ const ruleTester = new RuleTester({
ecmaVersion: 6,
sourceType: 'module'
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-implicit-globals', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-redeclare.js b/packages/eslint-plugin/tests/lib/eslint-rules/no-redeclare.js
similarity index 95%
rename from packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-redeclare.js
rename to packages/eslint-plugin/tests/lib/eslint-rules/no-redeclare.js
index e6bf91facaf6..05b3efa9bb41 100644
--- a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-redeclare.js
+++ b/packages/eslint-plugin/tests/lib/eslint-rules/no-redeclare.js
@@ -13,7 +13,7 @@ const ruleTester = new RuleTester({
sourceType: 'module',
ecmaFeatures: {}
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-redeclare', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-restricted-globals.js b/packages/eslint-plugin/tests/lib/eslint-rules/no-restricted-globals.js
similarity index 95%
rename from packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-restricted-globals.js
rename to packages/eslint-plugin/tests/lib/eslint-rules/no-restricted-globals.js
index 2e19c54dc4ab..a88cb359a5df 100644
--- a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-restricted-globals.js
+++ b/packages/eslint-plugin/tests/lib/eslint-rules/no-restricted-globals.js
@@ -13,7 +13,7 @@ const ruleTester = new RuleTester({
sourceType: 'module',
ecmaFeatures: {}
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-restricted-globals', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-shadow.js b/packages/eslint-plugin/tests/lib/eslint-rules/no-shadow.js
similarity index 95%
rename from packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-shadow.js
rename to packages/eslint-plugin/tests/lib/eslint-rules/no-shadow.js
index 23bd827e8c81..68901aed4310 100644
--- a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-shadow.js
+++ b/packages/eslint-plugin/tests/lib/eslint-rules/no-shadow.js
@@ -13,7 +13,7 @@ const ruleTester = new RuleTester({
sourceType: 'module',
ecmaFeatures: {}
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-shadow', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-undef.js b/packages/eslint-plugin/tests/lib/eslint-rules/no-undef.js
similarity index 97%
rename from packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-undef.js
rename to packages/eslint-plugin/tests/lib/eslint-rules/no-undef.js
index d4bd42a46464..53a148eee9da 100644
--- a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-undef.js
+++ b/packages/eslint-plugin/tests/lib/eslint-rules/no-undef.js
@@ -17,7 +17,7 @@ const ruleTester = new RuleTester({
sourceType: 'module',
ecmaFeatures: {}
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-undef', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-unused-vars.js b/packages/eslint-plugin/tests/lib/eslint-rules/no-unused-vars.js
similarity index 95%
rename from packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-unused-vars.js
rename to packages/eslint-plugin/tests/lib/eslint-rules/no-unused-vars.js
index 0dc372bd215f..1e80a0dd6502 100644
--- a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-unused-vars.js
+++ b/packages/eslint-plugin/tests/lib/eslint-rules/no-unused-vars.js
@@ -13,7 +13,7 @@ const ruleTester = new RuleTester({
sourceType: 'module',
ecmaFeatures: {}
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-unused-vars', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-use-before-define.js b/packages/eslint-plugin/tests/lib/eslint-rules/no-use-before-define.js
similarity index 95%
rename from packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-use-before-define.js
rename to packages/eslint-plugin/tests/lib/eslint-rules/no-use-before-define.js
index be61759ac52b..4a16ea4c8a03 100644
--- a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/no-use-before-define.js
+++ b/packages/eslint-plugin/tests/lib/eslint-rules/no-use-before-define.js
@@ -12,7 +12,7 @@ const ruleTester = new RuleTester({
ecmaVersion: 6,
sourceType: 'module'
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-undef', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/strict.js b/packages/eslint-plugin/tests/lib/eslint-rules/strict.js
similarity index 84%
rename from packages/eslint-plugin-typescript/tests/lib/eslint-rules/strict.js
rename to packages/eslint-plugin/tests/lib/eslint-rules/strict.js
index 198e6f12b73d..173849371d9f 100644
--- a/packages/eslint-plugin-typescript/tests/lib/eslint-rules/strict.js
+++ b/packages/eslint-plugin/tests/lib/eslint-rules/strict.js
@@ -12,12 +12,11 @@ const ruleTester = new RuleTester({
ecmaVersion: 6,
sourceType: 'module'
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('strict', rule, {
valid: [
- // https://github.com/bradzacher/eslint-plugin-typescript/issues/255
// https://github.com/typescript-eslint/typescript-eslint/issues/58
`
window.whatevs = {
@@ -29,7 +28,6 @@ window.whatevs = {
],
invalid: [
{
- // https://github.com/bradzacher/eslint-plugin-typescript/issues/255
// https://github.com/typescript-eslint/typescript-eslint/issues/58
code: `
window.whatevs = {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/adjacent-overload-signatures.js b/packages/eslint-plugin/tests/lib/rules/adjacent-overload-signatures.js
similarity index 95%
rename from packages/eslint-plugin-typescript/tests/lib/rules/adjacent-overload-signatures.js
rename to packages/eslint-plugin/tests/lib/rules/adjacent-overload-signatures.js
index a482155f1fc2..fe42efd1015b 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/adjacent-overload-signatures.js
+++ b/packages/eslint-plugin/tests/lib/rules/adjacent-overload-signatures.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/adjacent-overload-signatures'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('adjacent-overload-signatures', rule, {
@@ -211,6 +211,23 @@ class Foo {
foo(sn: string | number): void {}
bar(): void {}
baz(): void {}
+}
+ `,
+ `
+class Foo {
+ name: string;
+ static foo(s: string): void;
+ static foo(n: number): void;
+ static foo(sn: string | number): void {}
+ bar(): void {}
+ baz(): void {}
+}
+ `,
+ `
+class Test {
+ static test() {}
+ untest() {}
+ test() {}
}
`,
// examples from https://github.com/nzakas/eslint-plugin-typescript/issues/138
@@ -789,6 +806,26 @@ class Foo {
column: 5
}
]
+ },
+ {
+ code: `
+class Foo {
+ static foo(s: string): void;
+ name: string;
+ static foo(n: number): void;
+ static foo(sn: string | number): void {}
+ bar(): void {}
+ baz(): void {}
+}
+ `,
+ errors: [
+ {
+ messageId: 'adjacentSignature',
+ data: { name: 'static foo' },
+ line: 5,
+ column: 5
+ }
+ ]
}
]
});
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/array-type.js b/packages/eslint-plugin/tests/lib/rules/array-type.js
similarity index 94%
rename from packages/eslint-plugin-typescript/tests/lib/rules/array-type.js
rename to packages/eslint-plugin/tests/lib/rules/array-type.js
index 12b084b7f1dd..39716675cf1c 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/array-type.js
+++ b/packages/eslint-plugin/tests/lib/rules/array-type.js
@@ -18,7 +18,7 @@ const rule = require('../../../lib/rules/array-type'),
//------------------------------------------------------------------------------
const ruleTester = new eslint.RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('array-type', rule, {
@@ -138,6 +138,11 @@ ruleTester.run('array-type', rule, {
}`,
options: ['array']
},
+ {
+ // https://github.com/typescript-eslint/typescript-eslint/issues/172
+ code: 'type Unwrap = T extends (infer E)[] ? E : T',
+ options: ['array']
+ },
{
code: `let z: Array = [3, "4"];`,
options: ['generic']
@@ -173,6 +178,11 @@ ruleTester.run('array-type', rule, {
{
code: `type fooIntersection = Array;`,
options: ['generic']
+ },
+ {
+ // https://github.com/typescript-eslint/typescript-eslint/issues/172
+ code: 'type Unwrap = T extends Array ? E : T',
+ options: ['generic']
}
],
invalid: [
@@ -774,6 +784,34 @@ let yyyy: Arr>>> = [[[["2"]]]];`,
column: 19
}
]
+ },
+ {
+ // https://github.com/typescript-eslint/typescript-eslint/issues/172
+ code: 'type Unwrap = T extends Array ? E : T',
+ output: 'type Unwrap = T extends (infer E)[] ? E : T',
+ options: ['array'],
+ errors: [
+ {
+ messageId: 'errorStringArray',
+ data: { type: 'T' },
+ line: 1,
+ column: 28
+ }
+ ]
+ },
+ {
+ // https://github.com/typescript-eslint/typescript-eslint/issues/172
+ code: 'type Unwrap = T extends (infer E)[] ? E : T',
+ output: 'type Unwrap = T extends Array ? E : T',
+ options: ['generic'],
+ errors: [
+ {
+ messageId: 'errorStringGeneric',
+ data: { type: 'T' },
+ line: 1,
+ column: 28
+ }
+ ]
}
]
});
@@ -793,7 +831,7 @@ describe('array-type (nested)', () => {
rules: {
'array-type': [2, option]
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
},
{
fix: true
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/ban-types.js b/packages/eslint-plugin/tests/lib/rules/ban-types.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/ban-types.js
rename to packages/eslint-plugin/tests/lib/rules/ban-types.js
index 4f6cdcc8fab4..520640cc2063 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/ban-types.js
+++ b/packages/eslint-plugin/tests/lib/rules/ban-types.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/ban-types'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
const options = [
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/camelcase.js b/packages/eslint-plugin/tests/lib/rules/camelcase.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/camelcase.js
rename to packages/eslint-plugin/tests/lib/rules/camelcase.js
index 5927af4449c3..05efff9af562 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/camelcase.js
+++ b/packages/eslint-plugin/tests/lib/rules/camelcase.js
@@ -14,7 +14,7 @@ const ruleCamelcase = require('../../../lib/rules/camelcase');
const RuleTester = require('eslint').RuleTester;
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
//------------------------------------------------------------------------------
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/class-name-casing.js b/packages/eslint-plugin/tests/lib/rules/class-name-casing.js
similarity index 98%
rename from packages/eslint-plugin-typescript/tests/lib/rules/class-name-casing.js
rename to packages/eslint-plugin/tests/lib/rules/class-name-casing.js
index e21c4679b522..59c2217ceadf 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/class-name-casing.js
+++ b/packages/eslint-plugin/tests/lib/rules/class-name-casing.js
@@ -17,7 +17,7 @@ const rule = require('../../../lib/rules/class-name-casing'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('class-name-casing', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/explicit-function-return-type.js b/packages/eslint-plugin/tests/lib/rules/explicit-function-return-type.js
similarity index 98%
rename from packages/eslint-plugin-typescript/tests/lib/rules/explicit-function-return-type.js
rename to packages/eslint-plugin/tests/lib/rules/explicit-function-return-type.js
index e4383a39569d..e5454b6ccc78 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/explicit-function-return-type.js
+++ b/packages/eslint-plugin/tests/lib/rules/explicit-function-return-type.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/explicit-function-return-type'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('explicit-function-return-type', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/explicit-member-accessibility.js b/packages/eslint-plugin/tests/lib/rules/explicit-member-accessibility.js
similarity index 98%
rename from packages/eslint-plugin-typescript/tests/lib/rules/explicit-member-accessibility.js
rename to packages/eslint-plugin/tests/lib/rules/explicit-member-accessibility.js
index f87820f5f8f0..0ec5f048e1fd 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/explicit-member-accessibility.js
+++ b/packages/eslint-plugin/tests/lib/rules/explicit-member-accessibility.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/explicit-member-accessibility'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('explicit-member-accessibility', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/generic-type-naming.js b/packages/eslint-plugin/tests/lib/rules/generic-type-naming.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/generic-type-naming.js
rename to packages/eslint-plugin/tests/lib/rules/generic-type-naming.js
index 1ed16884dfa7..98b0532ec6c8 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/generic-type-naming.js
+++ b/packages/eslint-plugin/tests/lib/rules/generic-type-naming.js
@@ -15,7 +15,7 @@ const rule = require('../../../lib/rules/generic-type-naming'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('generic-type-naming', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/indent.js b/packages/eslint-plugin/tests/lib/rules/indent.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/indent.js
rename to packages/eslint-plugin/tests/lib/rules/indent.js
index 612ce758f2d2..c4e069e31f5c 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/indent.js
+++ b/packages/eslint-plugin/tests/lib/rules/indent.js
@@ -664,7 +664,7 @@ const ruleTester = new RuleTester({
sourceType: 'module',
ecmaFeatures: {}
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('indent', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/interface-name-prefix.js b/packages/eslint-plugin/tests/lib/rules/interface-name-prefix.js
similarity index 98%
rename from packages/eslint-plugin-typescript/tests/lib/rules/interface-name-prefix.js
rename to packages/eslint-plugin/tests/lib/rules/interface-name-prefix.js
index b72eb7cd6d3c..6243d5a6d11a 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/interface-name-prefix.js
+++ b/packages/eslint-plugin/tests/lib/rules/interface-name-prefix.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/interface-name-prefix'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('interface-name-prefix', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/member-delimiter-style.js b/packages/eslint-plugin/tests/lib/rules/member-delimiter-style.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/member-delimiter-style.js
rename to packages/eslint-plugin/tests/lib/rules/member-delimiter-style.js
index ac4b7721d676..288269243af9 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/member-delimiter-style.js
+++ b/packages/eslint-plugin/tests/lib/rules/member-delimiter-style.js
@@ -17,7 +17,7 @@ const rule = require('../../../lib/rules/member-delimiter-style'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('member-delimiter-style', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/member-naming.js b/packages/eslint-plugin/tests/lib/rules/member-naming.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/member-naming.js
rename to packages/eslint-plugin/tests/lib/rules/member-naming.js
index cad66d192367..c3e0d8a69209 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/member-naming.js
+++ b/packages/eslint-plugin/tests/lib/rules/member-naming.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/member-naming'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('member-naming', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/member-ordering.js b/packages/eslint-plugin/tests/lib/rules/member-ordering.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/member-ordering.js
rename to packages/eslint-plugin/tests/lib/rules/member-ordering.js
index f08b8f140d7a..b74bcce32006 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/member-ordering.js
+++ b/packages/eslint-plugin/tests/lib/rules/member-ordering.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/member-ordering'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('member-ordering', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-angle-bracket-type-assertion.js b/packages/eslint-plugin/tests/lib/rules/no-angle-bracket-type-assertion.js
similarity index 98%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-angle-bracket-type-assertion.js
rename to packages/eslint-plugin/tests/lib/rules/no-angle-bracket-type-assertion.js
index 9720ab90f704..f4aa7b362740 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-angle-bracket-type-assertion.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-angle-bracket-type-assertion.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-angle-bracket-type-assertion'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-angle-bracket-type-assertion', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-array-constructor.js b/packages/eslint-plugin/tests/lib/rules/no-array-constructor.js
similarity index 98%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-array-constructor.js
rename to packages/eslint-plugin/tests/lib/rules/no-array-constructor.js
index 7197eac80ccd..90a551722538 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-array-constructor.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-array-constructor.js
@@ -17,7 +17,7 @@ const rule = require('../../../lib/rules/no-array-constructor'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
const message = 'The array literal notation [] is preferrable.';
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-empty-interface.js b/packages/eslint-plugin/tests/lib/rules/no-empty-interface.js
similarity index 97%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-empty-interface.js
rename to packages/eslint-plugin/tests/lib/rules/no-empty-interface.js
index d58d6a14674c..a16d875a366c 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-empty-interface.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-empty-interface.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-empty-interface'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-empty-interface', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-explicit-any.js b/packages/eslint-plugin/tests/lib/rules/no-explicit-any.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-explicit-any.js
rename to packages/eslint-plugin/tests/lib/rules/no-explicit-any.js
index 6039ea2e74bd..2f6e09350055 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-explicit-any.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-explicit-any.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-explicit-any'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-explicit-any', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-extraneous-class.js b/packages/eslint-plugin/tests/lib/rules/no-extraneous-class.js
similarity index 86%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-extraneous-class.js
rename to packages/eslint-plugin/tests/lib/rules/no-extraneous-class.js
index d50b7178d859..713e5224ccb1 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-extraneous-class.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-extraneous-class.js
@@ -21,7 +21,7 @@ const onlyConstructor = { messageId: 'onlyConstructor', type: 'Identifier' };
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-extraneous-class', rule, {
@@ -70,7 +70,9 @@ export class Bar {
}
`.trim(),
options: [{ allowStaticOnly: true }]
- }
+ },
+ // https://github.com/typescript-eslint/typescript-eslint/issues/170
+ 'export default class { hello() { return "I am foo!"; } }'
],
invalid: [
@@ -117,9 +119,13 @@ export class AClass {
}
}
}
-
`.trim(),
errors: [onlyStatic, empty]
+ },
+ {
+ // https://github.com/typescript-eslint/typescript-eslint/issues/170
+ code: 'export default class { static hello() {} }',
+ errors: [{ messageId: 'onlyStatic', type: 'ClassDeclaration' }]
}
]
});
diff --git a/packages/eslint-plugin/tests/lib/rules/no-for-in-array.js b/packages/eslint-plugin/tests/lib/rules/no-for-in-array.js
new file mode 100644
index 000000000000..91984453000d
--- /dev/null
+++ b/packages/eslint-plugin/tests/lib/rules/no-for-in-array.js
@@ -0,0 +1,69 @@
+/**
+ * @fileoverview Disallow iterating over an array with a for-in loop
+ * @author Benjamin Lichtman
+ */
+'use strict';
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const rule = require('../../../lib/rules/no-for-in-array'),
+ RuleTester = require('eslint').RuleTester,
+ path = require('path');
+
+//------------------------------------------------------------------------------
+// Tests
+//------------------------------------------------------------------------------
+
+const rootDir = path.join(process.cwd(), 'tests/fixtures/');
+const parserOptions = {
+ ecmaVersion: 2015,
+ tsconfigRootDir: rootDir,
+ project: './tsconfig.json'
+};
+const ruleTester = new RuleTester({
+ parserOptions,
+ parser: '@typescript-eslint/parser'
+});
+
+ruleTester.run('no-for-in-array', rule, {
+ valid: [
+ `
+for (const x of [3, 4, 5]) {
+ console.log(x);
+}`,
+ `
+for (const x in { a: 1, b: 2, c: 3 }) {
+ console.log(x);
+}`
+ ],
+
+ invalid: [
+ {
+ code: `
+for (const x in [3, 4, 5]) {
+ console.log(x);
+}`,
+ errors: [
+ {
+ messageId: 'forInViolation',
+ type: 'ForInStatement'
+ }
+ ]
+ },
+ {
+ code: `
+const z = [3, 4, 5];
+for (const x in z) {
+ console.log(x);
+}`,
+ errors: [
+ {
+ messageId: 'forInViolation',
+ type: 'ForInStatement'
+ }
+ ]
+ }
+ ]
+});
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-inferrable-types.js b/packages/eslint-plugin/tests/lib/rules/no-inferrable-types.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-inferrable-types.js
rename to packages/eslint-plugin/tests/lib/rules/no-inferrable-types.js
index e2827293cb8c..955647e27f31 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-inferrable-types.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-inferrable-types.js
@@ -16,7 +16,7 @@ const RuleTester = require('eslint').RuleTester;
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-inferrable-types', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-misused-new.js b/packages/eslint-plugin/tests/lib/rules/no-misused-new.js
similarity index 98%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-misused-new.js
rename to packages/eslint-plugin/tests/lib/rules/no-misused-new.js
index 9a5ac534ef5d..f770f509872a 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-misused-new.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-misused-new.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-misused-new'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-misused-new', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-namespace.js b/packages/eslint-plugin/tests/lib/rules/no-namespace.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-namespace.js
rename to packages/eslint-plugin/tests/lib/rules/no-namespace.js
index d3809144034c..cadabf185d06 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-namespace.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-namespace.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-namespace'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-namespace', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-non-null-assertion.js b/packages/eslint-plugin/tests/lib/rules/no-non-null-assertion.js
similarity index 96%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-non-null-assertion.js
rename to packages/eslint-plugin/tests/lib/rules/no-non-null-assertion.js
index ad3d3dcd78ed..81b79c6972dd 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-non-null-assertion.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-non-null-assertion.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-non-null-assertion'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-non-null-assertion', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-object-literal-type-assertion.js b/packages/eslint-plugin/tests/lib/rules/no-object-literal-type-assertion.js
similarity index 70%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-object-literal-type-assertion.js
rename to packages/eslint-plugin/tests/lib/rules/no-object-literal-type-assertion.js
index dd073102dc61..aa19b09e8601 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-object-literal-type-assertion.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-object-literal-type-assertion.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-object-literal-type-assertion'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser',
+ parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
@@ -39,7 +39,23 @@ ruleTester.run('no-object-literal-type-assertion', rule, {
`const foo = {};`,
// Allow cast to 'unknown'
`const foo = {} as unknown;`,
- `const foo = {};`
+ `const foo = {};`,
+ {
+ code: `print({ bar: 5 } as Foo)`,
+ options: [
+ {
+ allowAsParameter: true
+ }
+ ]
+ },
+ {
+ code: `new print({ bar: 5 } as Foo)`,
+ options: [
+ {
+ allowAsParameter: true
+ }
+ ]
+ }
],
invalid: [
{
@@ -71,6 +87,26 @@ ruleTester.run('no-object-literal-type-assertion', rule, {
column: 11
}
]
+ },
+ {
+ code: `print({ bar: 5 } as Foo)`,
+ errors: [
+ {
+ messageId: 'unexpectedTypeAssertion',
+ line: 1,
+ column: 7
+ }
+ ]
+ },
+ {
+ code: `new print({ bar: 5 } as Foo)`,
+ errors: [
+ {
+ messageId: 'unexpectedTypeAssertion',
+ line: 1,
+ column: 11
+ }
+ ]
}
]
});
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-parameter-properties.js b/packages/eslint-plugin/tests/lib/rules/no-parameter-properties.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-parameter-properties.js
rename to packages/eslint-plugin/tests/lib/rules/no-parameter-properties.js
index 43ada16f00f1..80129de18cc6 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-parameter-properties.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-parameter-properties.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-parameter-properties'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-parameter-properties', rule, {
diff --git a/packages/eslint-plugin/tests/lib/rules/no-require-imports.js b/packages/eslint-plugin/tests/lib/rules/no-require-imports.js
new file mode 100644
index 000000000000..1eb40a59c34e
--- /dev/null
+++ b/packages/eslint-plugin/tests/lib/rules/no-require-imports.js
@@ -0,0 +1,81 @@
+/**
+ * @fileoverview Disallows invocation of `require()`.
+ * @author Kanitkorn Sujautra
+ */
+'use strict';
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const rule = require('../../../lib/rules/no-require-imports'),
+ RuleTester = require('eslint').RuleTester;
+
+//------------------------------------------------------------------------------
+// Tests
+//------------------------------------------------------------------------------
+
+const ruleTester = new RuleTester({
+ parserOptions: {
+ sourceType: 'module'
+ },
+ parser: '@typescript-eslint/parser'
+});
+
+ruleTester.run('no-require-imports', rule, {
+ valid: [
+ "import {l} from 'lib'",
+ "var lib3 = load('not_an_import')",
+ 'var lib4 = lib2.subImport',
+ 'var lib7 = 700',
+ 'import lib9 = lib2.anotherSubImport',
+ "import lib10 from 'lib10'"
+ ],
+ invalid: [
+ {
+ code: "var lib = require('lib')",
+ errors: [
+ {
+ message: 'A `require()` style import is forbidden.',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: "let lib2 = require('lib2')",
+ errors: [
+ {
+ message: 'A `require()` style import is forbidden.',
+ line: 1,
+ column: 12
+ }
+ ]
+ },
+ {
+ code: "var lib5 = require('lib5'), lib6 = require('lib6')",
+ errors: [
+ {
+ message: 'A `require()` style import is forbidden.',
+ line: 1,
+ column: 12
+ },
+ {
+ message: 'A `require()` style import is forbidden.',
+ line: 1,
+ column: 36
+ }
+ ]
+ },
+ {
+ code: "import lib8 = require('lib8')",
+ errors: [
+ {
+ message: 'A `require()` style import is forbidden.',
+ line: 1,
+ column: 15
+ }
+ ]
+ }
+ ]
+});
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-this-alias.js b/packages/eslint-plugin/tests/lib/rules/no-this-alias.js
similarity index 98%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-this-alias.js
rename to packages/eslint-plugin/tests/lib/rules/no-this-alias.js
index 73c07e3dd748..e2f76005da4d 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-this-alias.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-this-alias.js
@@ -27,7 +27,7 @@ const arrayDestructureError = {
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-this-alias', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-triple-slash-reference.js b/packages/eslint-plugin/tests/lib/rules/no-triple-slash-reference.js
similarity index 94%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-triple-slash-reference.js
rename to packages/eslint-plugin/tests/lib/rules/no-triple-slash-reference.js
index f38218e663d7..5e61a3736c0c 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-triple-slash-reference.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-triple-slash-reference.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-triple-slash-reference'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-triple-slash-reference', rule, {
@@ -47,7 +47,7 @@ let a
///
let a
`,
- parser: 'typescript-eslint-parser',
+ parser: '@typescript-eslint/parser',
errors: [
{
messageId: 'tripleSlashReference',
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-type-alias.js b/packages/eslint-plugin/tests/lib/rules/no-type-alias.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-type-alias.js
rename to packages/eslint-plugin/tests/lib/rules/no-type-alias.js
index dd27c4f4a4aa..fc3c91f7fa1d 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-type-alias.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-type-alias.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-type-alias'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-type-alias', rule, {
diff --git a/packages/eslint-plugin/tests/lib/rules/no-unnecessary-type-assertion.js b/packages/eslint-plugin/tests/lib/rules/no-unnecessary-type-assertion.js
new file mode 100644
index 000000000000..8795cff89c51
--- /dev/null
+++ b/packages/eslint-plugin/tests/lib/rules/no-unnecessary-type-assertion.js
@@ -0,0 +1,134 @@
+/**
+ * @fileoverview Warns if a type assertion does not change the type of an expression.
+ * @author Benjamin Lichtman
+ */
+'use strict';
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const rule = require('../../../lib/rules/no-unnecessary-type-assertion'),
+ RuleTester = require('eslint').RuleTester,
+ path = require('path');
+
+//------------------------------------------------------------------------------
+// Tests
+//------------------------------------------------------------------------------
+
+const rootDir = path.join(process.cwd(), 'tests/fixtures');
+const parserOptions = {
+ ecmaVersion: 2015,
+ tsconfigRootDir: rootDir,
+ project: './tsconfig.json'
+};
+const ruleTester = new RuleTester({
+ parserOptions,
+ parser: '@typescript-eslint/parser'
+});
+
+ruleTester.run('no-unnecessary-type-assertion', rule, {
+ valid: [
+ 'const foo = 3 as number;',
+ 'const foo = 3;',
+ 'const foo = <3>3;',
+ 'const foo = 3 as 3;',
+ `
+type Tuple = [3, "hi", "bye"];
+const foo = ([3, "hi", "bye"]) as Tuple;`,
+ `
+type PossibleTuple = {};
+const foo = ({}) as PossibleTuple;`,
+ `
+type PossibleTuple = { hello: "hello" };
+const foo = ({ hello: "hello" }) as PossibleTuple;`,
+ `
+type PossibleTuple = { 0: "hello", 5: "hello" };
+const foo = ({ 0: "hello", 5: "hello" }) as PossibleTuple;`,
+ {
+ code: `
+type Foo = number;
+const foo = (3 + 5) as Foo;`,
+ options: [{ typesToIgnore: ['Foo'] }]
+ },
+ {
+ code: `const foo = (3 + 5) as any;`,
+ options: [{ typesToIgnore: ['any'] }]
+ },
+ {
+ code: `((Syntax as any).ArrayExpression = 'foo')`,
+ options: [{ typesToIgnore: ['any'] }]
+ },
+ {
+ code: `const foo = (3 + 5) as string;`,
+ options: [{ typesToIgnore: ['string'] }]
+ },
+ {
+ code: `
+type Foo = number;
+const foo = (3 + 5);`,
+ options: [{ typesToIgnore: ['Foo'] }]
+ }
+ ],
+
+ invalid: [
+ {
+ code: `
+const foo = 3;
+const bar = foo!;`,
+ errors: [
+ {
+ messageId: 'unnecessaryAssertion',
+ line: 3,
+ column: 13
+ }
+ ]
+ },
+ {
+ code: `
+const foo = (3 + 5) as number;`,
+ errors: [
+ {
+ messageId: 'unnecessaryAssertion',
+ line: 2,
+ column: 13
+ }
+ ]
+ },
+ {
+ code: `
+const foo = (3 + 5);`,
+ errors: [
+ {
+ messageId: 'unnecessaryAssertion',
+ line: 2,
+ column: 13
+ }
+ ]
+ },
+ {
+ code: `
+type Foo = number;
+const foo = (3 + 5) as Foo;`,
+ errors: [
+ {
+ messageId: 'unnecessaryAssertion',
+ line: 3,
+ column: 13
+ }
+ ]
+ },
+ {
+ code: `
+type Foo = number;
+const foo = (3 + 5);`,
+ errors: [
+ {
+ messageId: 'unnecessaryAssertion',
+ line: 3,
+ column: 13
+ }
+ ]
+ }
+ ]
+});
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-unused-vars.js b/packages/eslint-plugin/tests/lib/rules/no-unused-vars.js
similarity index 85%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-unused-vars.js
rename to packages/eslint-plugin/tests/lib/rules/no-unused-vars.js
index cbacd42d0e08..6aef8a1e50ad 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-unused-vars.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-unused-vars.js
@@ -17,7 +17,7 @@ const ruleTester = new RuleTester({
sourceType: 'module',
ecmaFeatures: {}
},
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
//------------------------------------------------------------------------------
@@ -525,7 +525,66 @@ import * as fastify from 'fastify'
import { Server, IncomingMessage, ServerResponse } from 'http'
const server: fastify.FastifyInstance = fastify({})
server.get('/ping')
+ `,
+ // https://github.com/typescript-eslint/typescript-eslint/issues/61
+ `declare function foo();`,
+ // https://github.com/typescript-eslint/typescript-eslint/issues/61
+ `
+declare namespace Foo {
+ function bar(line: string, index: number | null, tabSize: number): number;
+ var baz: string;
+}
+ `,
+ // https://github.com/typescript-eslint/typescript-eslint/issues/61
+ `
+declare var Foo: {
+ new (value?: any): Object,
+ foo(): string
+}
+ `,
+ // https://github.com/typescript-eslint/typescript-eslint/issues/106
`
+declare class Foo {
+ constructor(value?: any): Object;
+ foo(): string;
+}
+ `,
+ `
+import foo from 'foo';
+export interface Bar extends foo.i18n {}
+ `,
+ `
+import foo from 'foo';
+import bar from 'foo';
+export interface Bar extends foo.i18n {}
+ `,
+ {
+ // https://github.com/typescript-eslint/typescript-eslint/issues/141
+ filename: 'test.tsx',
+ code: `
+import { TypeA } from './interface';
+export const a = />;
+ `,
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true
+ }
+ }
+ },
+ {
+ // https://github.com/typescript-eslint/typescript-eslint/issues/160
+ filename: 'test.tsx',
+ code: `
+const text = 'text';
+export function Foo() {
+ return (
+
+
+
+ );
+}
+ `
+ }
],
invalid: [
@@ -747,6 +806,62 @@ enum FormFieldIds {
column: 6
}
]
+ },
+ {
+ code: `
+import test from 'test';
+import baz from 'baz';
+export interface Bar extends baz.test {}
+ `,
+ errors: [
+ {
+ message: "'test' is defined but never used.",
+ line: 2,
+ column: 8
+ }
+ ]
+ },
+ {
+ code: `
+import test from 'test';
+import baz from 'baz';
+export interface Bar extends baz().test {}
+ `,
+ errors: [
+ {
+ message: "'test' is defined but never used.",
+ line: 2,
+ column: 8
+ }
+ ]
+ },
+ {
+ code: `
+import test from 'test';
+import baz from 'baz';
+export class Bar implements baz.test {}
+ `,
+ errors: [
+ {
+ message: "'test' is defined but never used.",
+ line: 2,
+ column: 8
+ }
+ ]
+ },
+ {
+ code: `
+import test from 'test';
+import baz from 'baz';
+export class Bar implements baz().test {}
+ `,
+ errors: [
+ {
+ message: "'test' is defined but never used.",
+ line: 2,
+ column: 8
+ }
+ ]
}
]
});
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-use-before-define.js b/packages/eslint-plugin/tests/lib/rules/no-use-before-define.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-use-before-define.js
rename to packages/eslint-plugin/tests/lib/rules/no-use-before-define.js
index b0b8ec21889f..b74645208d6d 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-use-before-define.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-use-before-define.js
@@ -18,7 +18,7 @@ const rule = require('../../../lib/rules/no-use-before-define'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-use-before-define', rule, {
@@ -220,7 +220,7 @@ export namespace Third {
}
`,
parserOptions: { ecmaVersion: 6, sourceType: 'module' },
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
}
],
invalid: [
diff --git a/packages/eslint-plugin/tests/lib/rules/no-useless-constructor.js b/packages/eslint-plugin/tests/lib/rules/no-useless-constructor.js
new file mode 100644
index 000000000000..c73c5034f121
--- /dev/null
+++ b/packages/eslint-plugin/tests/lib/rules/no-useless-constructor.js
@@ -0,0 +1,100 @@
+'use strict';
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const rule = require('../../../lib/rules/no-useless-constructor'),
+ RuleTester = require('eslint').RuleTester;
+
+const ruleTester = new RuleTester({
+ parserOptions: {
+ ecmaVersion: 6,
+ sourceType: 'module'
+ },
+ parser: '@typescript-eslint/parser'
+});
+
+const error = { message: 'Useless constructor.', type: 'MethodDefinition' };
+
+ruleTester.run('no-useless-constructor', rule, {
+ valid: [
+ 'class A { }',
+ 'class A { constructor(){ doSomething(); } }',
+ 'class A extends B { constructor(){} }',
+ "class A extends B { constructor(){ super('foo'); } }",
+ 'class A extends B { constructor(foo, bar){ super(foo, bar, 1); } }',
+ 'class A extends B { constructor(){ super(); doSomething(); } }',
+ 'class A extends B { constructor(...args){ super(...args); doSomething(); } }',
+ 'class A { dummyMethod(){ doSomething(); } }',
+ 'class A extends B.C { constructor() { super(foo); } }',
+ 'class A extends B.C { constructor([a, b, c]) { super(...arguments); } }',
+ 'class A extends B.C { constructor(a = f()) { super(...arguments); } }',
+ 'class A extends B { constructor(a, b, c) { super(a, b); } }',
+ 'class A extends B { constructor(foo, bar){ super(foo); } }',
+ 'class A extends B { constructor(test) { super(); } }',
+ 'class A extends B { constructor() { foo; } }',
+ 'class A extends B { constructor(foo, bar) { super(bar); } }',
+ // https://github.com/typescript-eslint/typescript-eslint/issues/15
+ 'declare class A { constructor(); }',
+ 'class A { constructor(); }',
+ 'abstract class A { constructor(); }',
+ 'abstract class A { abstract constructor(); }',
+ // https://github.com/typescript-eslint/typescript-eslint/issues/48
+ 'class A { constructor(private name: string) {} }',
+ 'class A { constructor(public name: string) {} }',
+ 'class A { constructor(protected name: string) {} }',
+ // https://github.com/typescript-eslint/typescript-eslint/pull/167#discussion_r252638401
+ 'class A { private constructor() {} }',
+ 'class A { protected constructor() {} }',
+ 'class A extends B { public constructor() {} }',
+ 'class A extends B { protected constructor(foo, bar) { super(bar); } }',
+ 'class A extends B { private constructor(foo, bar) { super(bar); } }',
+ 'class A extends B { public constructor(foo){ super(foo); } }',
+ 'class A extends B { public constructor(foo){} }'
+ ],
+ invalid: [
+ {
+ code: 'class A { constructor(){} }',
+ errors: [error]
+ },
+ {
+ code: "class A { 'constructor'(){} }",
+ errors: [error]
+ },
+ {
+ code: 'class A extends B { constructor() { super(); } }',
+ errors: [error]
+ },
+ {
+ code: 'class A extends B { constructor(foo){ super(foo); } }',
+ errors: [error]
+ },
+ {
+ code: 'class A extends B { constructor(foo, bar){ super(foo, bar); } }',
+ errors: [error]
+ },
+ {
+ code: 'class A extends B { constructor(...args){ super(...args); } }',
+ errors: [error]
+ },
+ {
+ code: 'class A extends B.C { constructor() { super(...arguments); } }',
+ errors: [error]
+ },
+ {
+ code:
+ 'class A extends B { constructor(a, b, ...c) { super(...arguments); } }',
+ errors: [error]
+ },
+ {
+ code:
+ 'class A extends B { constructor(a, b, ...c) { super(a, b, ...c); } }',
+ errors: [error]
+ },
+ {
+ code: 'class A { public constructor() {} }',
+ errors: [error]
+ }
+ ]
+});
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/no-var-requires.js b/packages/eslint-plugin/tests/lib/rules/no-var-requires.js
similarity index 97%
rename from packages/eslint-plugin-typescript/tests/lib/rules/no-var-requires.js
rename to packages/eslint-plugin/tests/lib/rules/no-var-requires.js
index 44d4675506e9..64662f95de2b 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/no-var-requires.js
+++ b/packages/eslint-plugin/tests/lib/rules/no-var-requires.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/no-var-requires'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('no-var-requires', rule, {
diff --git a/packages/eslint-plugin/tests/lib/rules/prefer-function-type.js b/packages/eslint-plugin/tests/lib/rules/prefer-function-type.js
new file mode 100644
index 000000000000..d0587afcaf7c
--- /dev/null
+++ b/packages/eslint-plugin/tests/lib/rules/prefer-function-type.js
@@ -0,0 +1,147 @@
+/**
+ * @fileoverview Use function types instead of interfaces with call signatures
+ * @author Benjamin Lichtman
+ */
+'use strict';
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+var rule = require('../../../lib/rules/prefer-function-type'),
+ RuleTester = require('eslint').RuleTester;
+
+//------------------------------------------------------------------------------
+// Tests
+//------------------------------------------------------------------------------
+
+const parserOptions = {
+ ecmaVersion: 2015
+};
+var ruleTester = new RuleTester({
+ parserOptions,
+ parser: '@typescript-eslint/parser'
+});
+ruleTester.run('prefer-function-type', rule, {
+ valid: [
+ `
+interface Foo {
+ (): void;
+ bar: number;
+}`,
+ `
+type Foo = {
+ (): void;
+ bar: number;
+}`,
+ `
+function foo(bar: { (): string, baz: number }): string {
+ return bar();
+}`,
+ `
+interface Foo {
+ bar: string;
+}
+interface Bar extends Foo {
+ (): void;
+}`,
+ `
+interface Foo {
+ bar: string;
+}
+interface Bar extends Function, Foo {
+ (): void;
+}`
+ ],
+
+ invalid: [
+ {
+ code: `
+interface Foo {
+ (): string;
+}`,
+ errors: [
+ {
+ messageId: 'functionTypeOverCallableType',
+ type: 'TSCallSignatureDeclaration'
+ }
+ ],
+ output: `
+type Foo = () => string;`
+ },
+ {
+ code: `
+type Foo = {
+ (): string;
+}`,
+ errors: [
+ {
+ messageId: 'functionTypeOverCallableType',
+ type: 'TSCallSignatureDeclaration'
+ }
+ ],
+ output: `
+type Foo = () => string`
+ },
+ {
+ code: `
+function foo(bar: { (s: string): number }): number {
+ return bar("hello");
+}`,
+ errors: [
+ {
+ messageId: 'functionTypeOverCallableType',
+ type: 'TSCallSignatureDeclaration'
+ }
+ ],
+ output: `
+function foo(bar: (s: string) => number): number {
+ return bar("hello");
+}`
+ },
+ {
+ code: `
+function foo(bar: { (s: string): number } | undefined): number {
+ return bar("hello");
+}`,
+ errors: [
+ {
+ messageId: 'functionTypeOverCallableType',
+ type: 'TSCallSignatureDeclaration'
+ }
+ ],
+ output: `
+function foo(bar: ((s: string) => number) | undefined): number {
+ return bar("hello");
+}`
+ },
+ {
+ code: `
+interface Foo extends Function {
+ (): void;
+}`,
+ errors: [
+ {
+ messageId: 'functionTypeOverCallableType',
+ type: 'TSCallSignatureDeclaration'
+ }
+ ],
+ output: `
+type Foo = () => void;`
+ },
+ {
+ code: `
+interface Foo {
+ (bar: T): string;
+}`,
+ errors: [
+ {
+ messageId: 'functionTypeOverCallableType',
+ type: 'TSCallSignatureDeclaration'
+ }
+ ],
+ output: `
+type Foo = (bar: T) => string;`
+ }
+ ]
+});
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/prefer-interface.js b/packages/eslint-plugin/tests/lib/rules/prefer-interface.js
similarity index 97%
rename from packages/eslint-plugin-typescript/tests/lib/rules/prefer-interface.js
rename to packages/eslint-plugin/tests/lib/rules/prefer-interface.js
index b253f2cfb16a..1617cdbe6877 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/prefer-interface.js
+++ b/packages/eslint-plugin/tests/lib/rules/prefer-interface.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/prefer-interface'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('interface-over-type-literal', rule, {
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/prefer-namespace-keyword.js b/packages/eslint-plugin/tests/lib/rules/prefer-namespace-keyword.js
similarity index 98%
rename from packages/eslint-plugin-typescript/tests/lib/rules/prefer-namespace-keyword.js
rename to packages/eslint-plugin/tests/lib/rules/prefer-namespace-keyword.js
index 4e090617b017..6107dc0d2ff0 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/prefer-namespace-keyword.js
+++ b/packages/eslint-plugin/tests/lib/rules/prefer-namespace-keyword.js
@@ -17,7 +17,7 @@ const rule = require('../../../lib/rules/prefer-namespace-keyword'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('prefer-namespace-keyword', rule, {
diff --git a/packages/eslint-plugin/tests/lib/rules/promise-function-async.js b/packages/eslint-plugin/tests/lib/rules/promise-function-async.js
new file mode 100644
index 000000000000..dddb26046435
--- /dev/null
+++ b/packages/eslint-plugin/tests/lib/rules/promise-function-async.js
@@ -0,0 +1,275 @@
+/**
+ * @fileoverview Requires any function or method that returns a Promise to be marked async
+ * @author Josh Goldberg
+ */
+'use strict';
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const rule = require('../../../lib/rules/promise-function-async'),
+ RuleTester = require('eslint').RuleTester,
+ path = require('path');
+
+//------------------------------------------------------------------------------
+// Tests
+//------------------------------------------------------------------------------
+
+const rootDir = path.join(process.cwd(), 'tests/fixtures/');
+const parserOptions = {
+ ecmaVersion: 2018,
+ tsconfigRootDir: rootDir,
+ project: './tsconfig.json'
+};
+
+const messageId = 'missingAsync';
+
+const ruleTester = new RuleTester({
+ parserOptions,
+ parser: '@typescript-eslint/parser'
+});
+
+ruleTester.run('promise-function-async', rule, {
+ valid: [
+ `
+const nonAsyncNonPromiseArrowFunction = (n: number) => n;
+
+function nonAsyncNonPromiseFunctionDeclaration(n: number) { return n; }
+
+const asyncPromiseFunctionExpressionA = async function(p: Promise) { return p; };
+const asyncPromiseFunctionExpressionB = async function() { return new Promise(); };
+
+class Test {
+ public nonAsyncNonPromiseArrowFunction = (n: number) => n;
+
+ public nonAsyncNonPromiseMethod() {
+ return 0;
+ }
+
+ public async asyncPromiseMethodA(p: Promise) {
+ return p;
+ }
+
+ public async asyncPromiseMethodB() {
+ return new Promise();
+ }
+}
+`
+ ],
+ invalid: [
+ {
+ code: `
+const nonAsyncPromiseFunctionExpressionA = function(p: Promise) { return p; };
+
+const nonAsyncPromiseFunctionExpressionB = function() { return new Promise(); };
+
+function nonAsyncPromiseFunctionDeclarationA(p: Promise) { return p; }
+
+function nonAsyncPromiseFunctionDeclarationB() { return new Promise(); }
+
+const nonAsyncPromiseArrowFunctionA = (p: Promise) => p;
+
+const nonAsyncPromiseArrowFunctionB = () => new Promise();
+
+class Test {
+ public nonAsyncPromiseMethodA(p: Promise) {
+ return p;
+ }
+
+ public nonAsyncPromiseMethodB() {
+ return new Promise();
+ }
+}
+`,
+ errors: [
+ {
+ line: 2,
+ messageId
+ },
+ {
+ line: 4,
+ messageId
+ },
+ {
+ line: 6,
+ messageId
+ },
+ {
+ line: 8,
+ messageId
+ },
+ {
+ line: 10,
+ messageId
+ },
+ {
+ line: 12,
+ messageId
+ },
+ {
+ line: 15,
+ messageId
+ },
+ {
+ line: 19,
+ messageId
+ }
+ ]
+ },
+ {
+ code: `
+const nonAsyncPromiseFunctionExpression = function(p: Promise) { return p; };
+
+function nonAsyncPromiseFunctionDeclaration(p: Promise) { return p; }
+
+const nonAsyncPromiseArrowFunction = (p: Promise) => p;
+
+class Test {
+ public nonAsyncPromiseMethod(p: Promise) {
+ return p;
+ }
+}
+`,
+ options: [
+ {
+ checkArrowFunctions: false
+ }
+ ],
+ errors: [
+ {
+ line: 2,
+ messageId
+ },
+ {
+ line: 4,
+ messageId
+ },
+ {
+ line: 9,
+ messageId
+ }
+ ]
+ },
+ {
+ code: `
+const nonAsyncPromiseFunctionExpression = function(p: Promise) { return p; };
+
+function nonAsyncPromiseFunctionDeclaration(p: Promise) { return p; }
+
+const nonAsyncPromiseArrowFunction = (p: Promise) => p;
+
+class Test {
+ public nonAsyncPromiseMethod(p: Promise) {
+ return p;
+ }
+}
+`,
+ options: [
+ {
+ checkFunctionDeclarations: false
+ }
+ ],
+ errors: [
+ {
+ line: 2,
+ messageId
+ },
+ {
+ line: 6,
+ messageId
+ },
+ {
+ line: 9,
+ messageId
+ }
+ ]
+ },
+ {
+ code: `
+const nonAsyncPromiseFunctionExpression = function(p: Promise) { return p; };
+
+function nonAsyncPromiseFunctionDeclaration(p: Promise) { return p; }
+
+const nonAsyncPromiseArrowFunction = (p: Promise) => p;
+
+class Test {
+ public nonAsyncPromiseMethod(p: Promise) {
+ return p;
+ }
+}
+`,
+ options: [
+ {
+ checkFunctionExpressions: false
+ }
+ ],
+ errors: [
+ {
+ line: 4,
+ messageId
+ },
+ {
+ line: 6,
+ messageId
+ },
+ {
+ line: 9,
+ messageId
+ }
+ ]
+ },
+ {
+ code: `
+const nonAsyncPromiseFunctionExpression = function(p: Promise) { return p; };
+
+function nonAsyncPromiseFunctionDeclaration(p: Promise) { return p; }
+
+const nonAsyncPromiseArrowFunction = (p: Promise) => p;
+
+class Test {
+ public nonAsyncPromiseMethod(p: Promise) {
+ return p;
+ }
+}
+`,
+ options: [
+ {
+ checkMethodDeclarations: false
+ }
+ ],
+ errors: [
+ {
+ line: 2,
+ messageId
+ },
+ {
+ line: 4,
+ messageId
+ },
+ {
+ line: 6,
+ messageId
+ }
+ ]
+ },
+ {
+ code: `
+class PromiseType { }
+
+const returnAllowedType = () => new PromiseType();
+`,
+ options: [
+ {
+ allowedPromiseNames: ['PromiseType']
+ }
+ ],
+ errors: [
+ {
+ line: 4,
+ messageId
+ }
+ ]
+ }
+ ]
+});
diff --git a/packages/eslint-plugin/tests/lib/rules/restrict-plus-operands.js b/packages/eslint-plugin/tests/lib/rules/restrict-plus-operands.js
new file mode 100644
index 000000000000..d5a07e596982
--- /dev/null
+++ b/packages/eslint-plugin/tests/lib/rules/restrict-plus-operands.js
@@ -0,0 +1,281 @@
+/**
+ * @fileoverview When adding two variables, operands must both be of type number or of type string.
+ * @author James Henry
+ * @author Armano
+ */
+'use strict';
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+const path = require('path');
+
+const rule = require('../../../lib/rules/restrict-plus-operands'),
+ RuleTester = require('eslint').RuleTester;
+
+//------------------------------------------------------------------------------
+// Tests
+//------------------------------------------------------------------------------
+
+const rootPath = path.join(process.cwd(), 'tests/fixtures/');
+
+const ruleTester = new RuleTester({
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ tsconfigRootDir: rootPath,
+ project: './tsconfig.json'
+ }
+});
+
+ruleTester.run('restrict-plus-operands', rule, {
+ valid: [
+ `var x = 5;`,
+ `var y = "10";`,
+ `var z = 8.2;`,
+ `var w = "6.5";`,
+ `var foo = 5 + 10;`,
+ `var foo = "5.5" + "10";`,
+ `var foo = parseInt("5.5", 10) + 10;`,
+ `var foo = parseFloat("5.5", 10) + 10;`,
+ `
+function test () : number { return 2; }
+var foo = test("5.5", 10) + 10;
+ `,
+ `
+var x = 5;
+var z = 8.2;
+var foo = x + z;
+ `,
+ `
+var w = "6.5";
+var y = "10";
+var foo = y + w;
+ `,
+ 'var foo = 1 + 1;',
+ "var foo = '1' + '1';",
+ `
+var pair: { first: number, second: string } = { first: 5, second: "10" };
+var foo = pair.first + 10;
+ `,
+ `
+var pair: { first: number, second: string } = { first: 5, second: "10" };
+var foo = pair.first + (10 as number);
+ `,
+ `
+var pair: { first: number, second: string } = { first: 5, second: "10" };
+var foo = "5.5" + pair.second;
+ `,
+ `
+var pair: { first: number, second: string } = { first: 5, second: "10" };
+var foo = ("5.5" as string) + pair.second;
+ `,
+ `const foo = 'hello' + (someBoolean ? 'a' : 'b') + (() => someBoolean ? 'c' : 'd')() + 'e';`,
+ `const balls = true;`,
+ `balls === true;`
+ ],
+ invalid: [
+ {
+ code: "var foo = '1' + 1;",
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: 'var foo = [] + {};',
+ errors: [
+ {
+ messageId: 'notNumbers',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `var foo = 5 + "10";`,
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `var foo = [] + 5;`,
+ errors: [
+ {
+ messageId: 'notNumbers',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `var foo = [] + {};`,
+ errors: [
+ {
+ messageId: 'notNumbers',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `var foo = [] + [];`,
+ errors: [
+ {
+ messageId: 'notNumbers',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `var foo = 5 + [];`,
+ errors: [
+ {
+ messageId: 'notNumbers',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `var foo = "5" + {};`,
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `var foo = 5.5 + "5";`,
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `var foo = "5.5" + 5;`,
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `
+var x = 5;
+var y = "10";
+var foo = x + y;
+ `,
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 4,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `
+var x = 5;
+var y = "10";
+var foo = y + x;
+ `,
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 4,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `
+var x = 5;
+var foo = x + {};
+ `,
+ errors: [
+ {
+ messageId: 'notNumbers',
+ line: 3,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `
+var y = "10";
+var foo = [] + y;
+ `,
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 3,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `
+var pair: { first: number, second: string } = { first: 5, second: "10" };
+var foo = pair.first + "10";
+ `,
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 3,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `
+var pair: { first: number, second: string } = { first: 5, second: "10" };
+var foo = 5 + pair.second;
+ `,
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 3,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `var foo = parseInt("5.5", 10) + "10";`,
+ errors: [
+ {
+ messageId: 'notStrings',
+ line: 1,
+ column: 11
+ }
+ ]
+ },
+ {
+ code: `
+var pair = { first: 5, second: "10" };
+var foo = pair + pair;
+ `,
+ errors: [
+ {
+ messageId: 'notNumbers',
+ line: 3,
+ column: 11
+ }
+ ]
+ }
+ ]
+});
diff --git a/packages/eslint-plugin-typescript/tests/lib/rules/type-annotation-spacing.js b/packages/eslint-plugin/tests/lib/rules/type-annotation-spacing.js
similarity index 99%
rename from packages/eslint-plugin-typescript/tests/lib/rules/type-annotation-spacing.js
rename to packages/eslint-plugin/tests/lib/rules/type-annotation-spacing.js
index eca025ba624d..b5826a54e29f 100644
--- a/packages/eslint-plugin-typescript/tests/lib/rules/type-annotation-spacing.js
+++ b/packages/eslint-plugin/tests/lib/rules/type-annotation-spacing.js
@@ -16,7 +16,7 @@ const rule = require('../../../lib/rules/type-annotation-spacing'),
//------------------------------------------------------------------------------
const ruleTester = new RuleTester({
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
});
ruleTester.run('type-annotation-spacing', rule, {
@@ -1034,7 +1034,7 @@ type Bar = Record
}
}
],
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
},
'let resolver: (() => PromiseLike) | PromiseLike;'
],
@@ -4219,7 +4219,7 @@ type Bar = Record
}
}
],
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
}
],
invalid: [
diff --git a/packages/eslint-plugin-typescript/tests/lib/util.js b/packages/eslint-plugin/tests/lib/util.js
similarity index 100%
rename from packages/eslint-plugin-typescript/tests/lib/util.js
rename to packages/eslint-plugin/tests/lib/util.js
diff --git a/packages/eslint-plugin-typescript/tools/update-recommended.js b/packages/eslint-plugin/tools/update-recommended.js
similarity index 97%
rename from packages/eslint-plugin-typescript/tools/update-recommended.js
rename to packages/eslint-plugin/tools/update-recommended.js
index 98c03a4451a0..ce402c3933be 100644
--- a/packages/eslint-plugin-typescript/tools/update-recommended.js
+++ b/packages/eslint-plugin/tools/update-recommended.js
@@ -49,7 +49,7 @@ function generate() {
const filePath = path.resolve(__dirname, '../lib/configs/recommended.json');
const recommendedConfig = {
- parser: 'eslint-plugin-typescript/parser',
+ parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module'
},
diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md
new file mode 100644
index 000000000000..7df65d7a587a
--- /dev/null
+++ b/packages/parser/CHANGELOG.md
@@ -0,0 +1,48 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+# [1.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.2.0...v1.3.0) (2019-02-07)
+
+### Bug Fixes
+
+- **ts-estree:** align typeArguments and typeParameters across nodes ([#223](https://github.com/typescript-eslint/typescript-eslint/issues/223)) ([3306198](https://github.com/typescript-eslint/typescript-eslint/commit/3306198))
+- **ts-estree:** convert decorators on var and fn decs ([#211](https://github.com/typescript-eslint/typescript-eslint/issues/211)) ([0a1777f](https://github.com/typescript-eslint/typescript-eslint/commit/0a1777f))
+- **ts-estree:** fix issues with typeParams in FunctionExpression ([#208](https://github.com/typescript-eslint/typescript-eslint/issues/208)) ([d4dfa3b](https://github.com/typescript-eslint/typescript-eslint/commit/d4dfa3b))
+
+### Features
+
+- change TypeScript version range to >=3.2.1 <3.4.0 ([#184](https://github.com/typescript-eslint/typescript-eslint/issues/184)) ([f513a14](https://github.com/typescript-eslint/typescript-eslint/commit/f513a14))
+- **ts-estree:** enable errors 1098 and 1099 ([#219](https://github.com/typescript-eslint/typescript-eslint/issues/219)) ([fc50167](https://github.com/typescript-eslint/typescript-eslint/commit/fc50167))
+
+# [1.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.1...v1.2.0) (2019-02-01)
+
+### Bug Fixes
+
+- **parser:** fix regression with no-unused-vars for jsx attributes ([#161](https://github.com/typescript-eslint/typescript-eslint/issues/161)) ([6147de1](https://github.com/typescript-eslint/typescript-eslint/commit/6147de1))
+
+## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29)
+
+### Bug Fixes
+
+- **eslint-plugin:** make parser services error clearer ([#132](https://github.com/typescript-eslint/typescript-eslint/issues/132)) ([aa9d1e1](https://github.com/typescript-eslint/typescript-eslint/commit/aa9d1e1))
+- **parser:** add visiting of type parameters in JSXOpeningElement ([#150](https://github.com/typescript-eslint/typescript-eslint/issues/150)) ([5e16003](https://github.com/typescript-eslint/typescript-eslint/commit/5e16003))
+- **ts-estree:** expand optional property to include question token ([#138](https://github.com/typescript-eslint/typescript-eslint/issues/138)) ([9068b62](https://github.com/typescript-eslint/typescript-eslint/commit/9068b62))
+
+# [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23)
+
+### Bug Fixes
+
+- **typescript-estree:** correct range of parameters with comments ([#128](https://github.com/typescript-eslint/typescript-eslint/issues/128)) ([91eedf2](https://github.com/typescript-eslint/typescript-eslint/commit/91eedf2))
+- **typescript-estree:** fix range of assignment in parameter ([#115](https://github.com/typescript-eslint/typescript-eslint/issues/115)) ([4e781f1](https://github.com/typescript-eslint/typescript-eslint/commit/4e781f1))
+
+# [1.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.1...v1.0.0) (2019-01-20)
+
+### Features
+
+- **parser:** support ecmaFeatures.jsx flag and tests ([#85](https://github.com/typescript-eslint/typescript-eslint/issues/85)) ([b321736](https://github.com/typescript-eslint/typescript-eslint/commit/b321736))
+
+## [0.2.1](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.0...v0.2.1) (2019-01-20)
+
+**Note:** Version bump only for package @typescript-eslint/parser
diff --git a/packages/typescript-eslint-parser/LICENSE b/packages/parser/LICENSE
similarity index 100%
rename from packages/typescript-eslint-parser/LICENSE
rename to packages/parser/LICENSE
diff --git a/packages/parser/README.md b/packages/parser/README.md
new file mode 100644
index 000000000000..78d17e6388fb
--- /dev/null
+++ b/packages/parser/README.md
@@ -0,0 +1,88 @@
+TypeScript ESLint Parser
+
+An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.
+
+
+
+
+
+
+
+
+
+## Installation:
+
+```sh
+npm install @typescript-eslint/parser --save-dev
+```
+
+## Usage
+
+In your ESLint configuration file, set the `parser` property:
+
+```json
+{
+ "parser": "@typescript-eslint/parser"
+}
+```
+
+There is sometimes an incorrect assumption that the parser itself is what does everything necessary to facilitate the use of ESLint with TypeScript. In actuality, it is the combination of the parser _and_ one or more plugins which allow you to maximize your usage of ESLint with TypeScript.
+
+For example, once this parser successfully produces an AST for the TypeScript source code, it might well contain some information which simply does not exist in a standard JavaScript context, such as the data for a TypeScript-specific construct, like an `interface`.
+
+The core rules built into ESLint, such as `indent` have no knowledge of such constructs, so it is impossible to expect them to work out of the box with them.
+
+Instead, you also need to make use of one more plugins which will add or extend rules with TypeScript-specific features.
+
+By far the most common case will be installing the [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin) plugin, but there are also other relevant options available such a [@typescript-eslint/eslint-plugin-tslint](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin-tslint).
+
+## Configuration
+
+The following additional configuration options are available by specifying them in [`parserOptions`](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) in your ESLint configuration file.
+
+- **`ecmaFeatures.jsx`** - default `false`. Enable parsing JSX when `true`. More details can be found [here](https://www.typescriptlang.org/docs/handbook/jsx.html).
+
+ - It's `false` on `*.ts` files regardless of this option.
+ - It's `true` on `*.tsx` files regardless of this option.
+ - Otherwise, it respects this option.
+
+- **`useJSXTextNode`** - default `true`. Please set `false` if you use this parser on ESLint v4. If this is `false`, the parser creates the AST of JSX texts as the legacy style.
+
+- **`project`** - default `undefined`. This option allows you to provide a path to your project's `tsconfig.json`. **This setting is required if you want to use rules which require type information**. You may want to use this setting in tandem with the `tsconfigRootDir` option below.
+
+- **`tsconfigRootDir`** - default `undefined`. This option allows you to provide the root directory for relative tsconfig paths specified in the `project` option above.
+
+- **`extraFileExtensions`** - default `undefined`. This option allows you to provide one or more additional file extensions which should be considered in the TypeScript Program compilation. E.g. a `.vue` file
+
+- **`warnOnUnsupportedTypeScriptVersion`** - default `true`. This option allows you to toggle the warning that the parser will give you if you use a version of TypeScript which is not explicitly supported
+
+### .eslintrc.json
+
+```json
+{
+ "parser": "@typescript-eslint/parser",
+ "parserOptions": {
+ "ecmaFeatures": {
+ "jsx": true
+ },
+ "useJSXTextNode": true,
+ "project": "./tsconfig.json",
+ "tsconfigRootDir": "../../",
+ "extraFileExtensions": [".vue"]
+ }
+}
+```
+
+## Supported TypeScript Version
+
+Please see https://github.com/typescript-eslint/typescript-eslint for the supported TypeScript version.
+
+**Please ensure that you are using a supported version before submitting any issues/bug reports.**
+
+## Reporting Issues
+
+Please use the @typescript-eslint/parser issue template when creating your issue and fill out the information requested as best you can. This will really help us when looking into your issue.
+
+## License
+
+TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license.
diff --git a/packages/typescript-eslint-parser/jest.config.js b/packages/parser/jest.config.js
similarity index 100%
rename from packages/typescript-eslint-parser/jest.config.js
rename to packages/parser/jest.config.js
diff --git a/packages/typescript-eslint-parser/package.json b/packages/parser/package.json
similarity index 75%
rename from packages/typescript-eslint-parser/package.json
rename to packages/parser/package.json
index 492e82e150dc..5b89a50f1eff 100644
--- a/packages/typescript-eslint-parser/package.json
+++ b/packages/parser/package.json
@@ -1,15 +1,15 @@
{
- "name": "typescript-eslint-parser",
+ "name": "@typescript-eslint/parser",
+ "version": "1.3.0",
"description": "An ESLint custom parser which leverages TypeScript ESTree",
"main": "dist/parser.js",
- "version": "21.0.2",
"files": [
"dist",
"README.md",
"LICENSE"
],
"engines": {
- "node": ">=6.14.0"
+ "node": "^6.14.0 || ^8.10.0 || >=9.10.0"
},
"repository": "typescript-eslint/typescript-eslint",
"bugs": {
@@ -32,18 +32,17 @@
"test": "jest --coverage"
},
"peerDependencies": {
- "eslint": ">=4.19.1",
+ "eslint": "^5.0.0",
"typescript": "*"
},
"dependencies": {
+ "@typescript-eslint/typescript-estree": "1.3.0",
"eslint-scope": "^4.0.0",
- "eslint-visitor-keys": "^1.0.0",
- "typescript-estree": "18.1.0"
+ "eslint-visitor-keys": "^1.0.0"
},
"devDependencies": {
"@types/eslint": "^4.16.5",
- "@types/estree": "^0.0.39",
"@types/eslint-visitor-keys": "^1.0.0",
- "@typescript-eslint/shared-fixtures": "*"
+ "@typescript-eslint/shared-fixtures": "1.3.0"
}
}
diff --git a/packages/typescript-eslint-parser/src/analyze-scope.ts b/packages/parser/src/analyze-scope.ts
similarity index 70%
rename from packages/typescript-eslint-parser/src/analyze-scope.ts
rename to packages/parser/src/analyze-scope.ts
index dc17e977683b..f3a6b5f78ac1 100644
--- a/packages/typescript-eslint-parser/src/analyze-scope.ts
+++ b/packages/parser/src/analyze-scope.ts
@@ -11,7 +11,7 @@ import {
PatternVisitorCallback,
PatternVisitorOptions
} from 'eslint-scope/lib/options';
-import { Node } from 'estree';
+import { TSESTree } from '@typescript-eslint/typescript-estree';
/**
* Define the override function of `Scope#__define` for global augmentation.
@@ -35,7 +35,7 @@ class EnumScope extends Scope {
constructor(
scopeManager: ScopeManager,
upperScope: Scope,
- block: Node | null
+ block: TSESTree.Node | null
) {
// @ts-ignore
super(scopeManager, 'enum', upperScope, block, false);
@@ -51,7 +51,7 @@ class PatternVisitor extends OriginalPatternVisitor {
super(options, rootPattern, callback);
}
- Identifier(node: any) {
+ Identifier(node: TSESTree.Identifier): void {
super.Identifier(node);
if (node.decorators) {
this.rightHandNodes.push(...node.decorators);
@@ -61,7 +61,7 @@ class PatternVisitor extends OriginalPatternVisitor {
}
}
- ArrayPattern(node: any) {
+ ArrayPattern(node: TSESTree.ArrayPattern): void {
node.elements.forEach(this.visit, this);
if (node.decorators) {
this.rightHandNodes.push(...node.decorators);
@@ -71,7 +71,7 @@ class PatternVisitor extends OriginalPatternVisitor {
}
}
- ObjectPattern(node: any) {
+ ObjectPattern(node: TSESTree.ObjectPattern): void {
node.properties.forEach(this.visit, this);
if (node.decorators) {
this.rightHandNodes.push(...node.decorators);
@@ -81,8 +81,11 @@ class PatternVisitor extends OriginalPatternVisitor {
}
}
- RestElement(node: any) {
+ RestElement(node: TSESTree.RestElement): void {
super.RestElement(node);
+ if (node.decorators) {
+ this.rightHandNodes.push(...node.decorators);
+ }
if (node.typeAnnotation) {
this.rightHandNodes.push(node.typeAnnotation);
}
@@ -99,16 +102,15 @@ class Referencer extends OriginalReferencer {
/**
* Override to use PatternVisitor we overrode.
- * @param {Identifier} node The Identifier node to visit.
- * @param {Object} [options] The flag to visit right-hand side nodes.
- * @param {Function} callback The callback function for left-hand side nodes.
- * @returns {void}
+ * @param node The Identifier node to visit.
+ * @param [options] The flag to visit right-hand side nodes.
+ * @param callback The callback function for left-hand side nodes.
*/
- visitPattern(
- node: any,
+ visitPattern(
+ node: T,
options: PatternVisitorOptions,
callback: PatternVisitorCallback
- ) {
+ ): void {
if (!node) {
return;
}
@@ -130,10 +132,14 @@ class Referencer extends OriginalReferencer {
/**
* Override.
* Visit `node.typeParameters` and `node.returnType` additionally to find `typeof` expressions.
- * @param {FunctionDeclaration|FunctionExpression|ArrowFunctionExpression} node The function node to visit.
- * @returns {void}
- */
- visitFunction(node: any) {
+ * @param node The function node to visit.
+ */
+ visitFunction(
+ node:
+ | TSESTree.FunctionDeclaration
+ | TSESTree.FunctionExpression
+ | TSESTree.ArrowFunctionExpression
+ ): void {
const { type, id, typeParameters, params, returnType, body } = node;
const scopeManager = this.scopeManager;
const upperScope = this.currentScope();
@@ -189,7 +195,7 @@ class Referencer extends OriginalReferencer {
this.visit(returnType);
// Process the body.
- if (body.type === 'BlockStatement') {
+ if (body && body.type === 'BlockStatement') {
this.visitChildren(body);
} else {
this.visit(body);
@@ -202,10 +208,9 @@ class Referencer extends OriginalReferencer {
/**
* Override.
* Visit decorators.
- * @param {ClassDeclaration|ClassExpression} node The class node to visit.
- * @returns {void}
+ * @param node The class node to visit.
*/
- visitClass(node: any) {
+ visitClass(node: TSESTree.ClassDeclaration | TSESTree.ClassExpression): void {
this.visitDecorators(node.decorators);
const upperTypeMode = this.typeMode;
@@ -214,7 +219,7 @@ class Referencer extends OriginalReferencer {
this.visit(node.superTypeParameters);
}
if (node.implements) {
- this.visit(node.implements);
+ node.implements.forEach(this.visit, this);
}
this.typeMode = upperTypeMode;
@@ -223,10 +228,13 @@ class Referencer extends OriginalReferencer {
/**
* Visit typeParameters.
- * @param {*} node The node to visit.
- * @returns {void}
+ * @param node The node to visit.
*/
- visitTypeParameters(node: any) {
+ visitTypeParameters(node: {
+ typeParameters?:
+ | TSESTree.TSTypeParameterDeclaration
+ | TSESTree.TSTypeParameterInstantiation;
+ }): void {
if (node.typeParameters) {
const upperTypeMode = this.typeMode;
this.typeMode = true;
@@ -235,13 +243,21 @@ class Referencer extends OriginalReferencer {
}
}
+ /**
+ * Override.
+ */
+ JSXOpeningElement(node: TSESTree.JSXOpeningElement): void {
+ this.visit(node.name);
+ this.visitTypeParameters(node);
+ node.attributes.forEach(this.visit, this);
+ }
+
/**
* Override.
* Don't create the reference object in the type mode.
- * @param {Identifier} node The Identifier node to visit.
- * @returns {void}
+ * @param node The Identifier node to visit.
*/
- Identifier(node: any) {
+ Identifier(node: TSESTree.Identifier): void {
this.visitDecorators(node.decorators);
if (!this.typeMode) {
@@ -254,20 +270,22 @@ class Referencer extends OriginalReferencer {
/**
* Override.
* Visit decorators.
- * @param {MethodDefinition} node The MethodDefinition node to visit.
- * @returns {void}
+ * @param node The MethodDefinition node to visit.
*/
- MethodDefinition(node: any) {
+ MethodDefinition(
+ node: TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition
+ ): void {
this.visitDecorators(node.decorators);
super.MethodDefinition(node);
}
/**
* Don't create the reference object for the key if not computed.
- * @param {ClassProperty} node The ClassProperty node to visit.
- * @returns {void}
+ * @param node The ClassProperty node to visit.
*/
- ClassProperty(node: any) {
+ ClassProperty(
+ node: TSESTree.ClassProperty | TSESTree.TSAbstractClassProperty
+ ): void {
const upperTypeMode = this.typeMode;
const { computed, decorators, key, typeAnnotation, value } = node;
@@ -286,39 +304,34 @@ class Referencer extends OriginalReferencer {
/**
* Visit new expression.
- * @param {NewExpression} node The NewExpression node to visit.
- * @returns {void}
+ * @param node The NewExpression node to visit.
*/
- NewExpression(node: any) {
+ NewExpression(node: TSESTree.NewExpression): void {
this.visitTypeParameters(node);
this.visit(node.callee);
- if (node.arguments) {
- node.arguments.forEach(this.visit, this);
- }
+
+ node.arguments.forEach(this.visit, this);
}
/**
* Override.
* Visit call expression.
- * @param {CallExpression} node The CallExpression node to visit.
- * @returns {void}
+ * @param node The CallExpression node to visit.
*/
- CallExpression(node: any) {
+ CallExpression(node: TSESTree.CallExpression): void {
this.visitTypeParameters(node);
this.visit(node.callee);
- if (node.arguments) {
- node.arguments.forEach(this.visit, this);
- }
+
+ node.arguments.forEach(this.visit, this);
}
/**
* Define the variable of this function declaration only once.
* Because to avoid confusion of `no-redeclare` rule by overloading.
- * @param {TSDeclareFunction} node The TSDeclareFunction node to visit.
- * @returns {void}
+ * @param node The TSDeclareFunction node to visit.
*/
- TSDeclareFunction(node: any) {
+ TSDeclareFunction(node: TSESTree.TSDeclareFunction): void {
const upperTypeMode = this.typeMode;
const scope = this.currentScope();
const { id, typeParameters, params, returnType } = node;
@@ -346,10 +359,9 @@ class Referencer extends OriginalReferencer {
/**
* Create reference objects for the references in parameters and return type.
- * @param {TSEmptyBodyFunctionExpression} node The TSEmptyBodyFunctionExpression node to visit.
- * @returns {void}
+ * @param node The TSEmptyBodyFunctionExpression node to visit.
*/
- TSEmptyBodyFunctionExpression(node: any) {
+ TSEmptyBodyFunctionExpression(node: TSESTree.FunctionExpression): void {
const upperTypeMode = this.typeMode;
const { typeParameters, params, returnType } = node;
@@ -363,39 +375,35 @@ class Referencer extends OriginalReferencer {
/**
* Don't make variable because it declares only types.
* Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations.
- * @param {TSInterfaceDeclaration} node The TSInterfaceDeclaration node to visit.
- * @returns {void}
+ * @param node The TSInterfaceDeclaration node to visit.
*/
- TSInterfaceDeclaration(node: any) {
+ TSInterfaceDeclaration(node: TSESTree.TSInterfaceDeclaration): void {
this.visitTypeNodes(node);
}
/**
* Don't make variable because it declares only types.
* Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations.
- * @param {TSClassImplements} node The TSClassImplements node to visit.
- * @returns {void}
+ * @param node The TSClassImplements node to visit.
*/
- TSClassImplements(node: any) {
+ TSClassImplements(node: TSESTree.TSClassImplements): void {
this.visitTypeNodes(node);
}
/**
* Don't make variable because it declares only types.
* Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations.
- * @param {TSIndexSignature} node The TSIndexSignature node to visit.
- * @returns {void}
+ * @param node The TSIndexSignature node to visit.
*/
- TSIndexSignature(node: any) {
+ TSIndexSignature(node: TSESTree.TSIndexSignature): void {
this.visitTypeNodes(node);
}
/**
* Visit type assertion.
- * @param {TSTypeAssertion} node The TSTypeAssertion node to visit.
- * @returns {void}
+ * @param node The TSTypeAssertion node to visit.
*/
- TSTypeAssertion(node: any) {
+ TSTypeAssertion(node: TSESTree.TSTypeAssertion): void {
if (this.typeMode) {
this.visit(node.typeAnnotation);
} else {
@@ -409,10 +417,9 @@ class Referencer extends OriginalReferencer {
/**
* Visit as expression.
- * @param {TSAsExpression} node The TSAsExpression node to visit.
- * @returns {void}
+ * @param node The TSAsExpression node to visit.
*/
- TSAsExpression(node: any) {
+ TSAsExpression(node: TSESTree.TSAsExpression): void {
this.visit(node.expression);
if (this.typeMode) {
@@ -426,28 +433,25 @@ class Referencer extends OriginalReferencer {
/**
* Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations.
- * @param {TSTypeAnnotation} node The TSTypeAnnotation node to visit.
- * @returns {void}
+ * @param node The TSTypeAnnotation node to visit.
*/
- TSTypeAnnotation(node: any) {
+ TSTypeAnnotation(node: TSESTree.TSTypeAnnotation): void {
this.visitTypeNodes(node);
}
/**
* Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations.
- * @param {TSTypeParameterDeclaration} node The TSTypeParameterDeclaration node to visit.
- * @returns {void}
+ * @param node The TSTypeParameterDeclaration node to visit.
*/
- TSTypeParameterDeclaration(node: any) {
+ TSTypeParameterDeclaration(node: TSESTree.TSTypeParameterDeclaration): void {
this.visitTypeNodes(node);
}
/**
* Create reference objects for the references in `typeof` expression.
- * @param {TSTypeQuery} node The TSTypeQuery node to visit.
- * @returns {void}
+ * @param node The TSTypeQuery node to visit.
*/
- TSTypeQuery(node: any) {
+ TSTypeQuery(node: TSESTree.TSTypeQuery): void {
if (this.typeMode) {
this.typeMode = false;
this.visitChildren(node);
@@ -458,124 +462,109 @@ class Referencer extends OriginalReferencer {
}
/**
- * @param {TSTypeParameter} node The TSTypeParameter node to visit.
- * @returns {void}
+ * @param node The TSTypeParameter node to visit.
*/
- TSTypeParameter(node: any) {
+ TSTypeParameter(node: TSESTree.TSTypeParameter): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSInferType} node The TSInferType node to visit.
- * @returns {void}
+ * @param node The TSInferType node to visit.
*/
- TSInferType(node: any) {
+ TSInferType(node: TSESTree.TSInferType): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSTypeReference} node The TSTypeReference node to visit.
- * @returns {void}
+ * @param node The TSTypeReference node to visit.
*/
- TSTypeReference(node: any) {
+ TSTypeReference(node: TSESTree.TSTypeReference): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSTypeLiteral} node The TSTypeLiteral node to visit.
- * @returns {void}
+ * @param node The TSTypeLiteral node to visit.
*/
- TSTypeLiteral(node: any) {
+ TSTypeLiteral(node: TSESTree.TSTypeLiteral): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSLiteralType} node The TSLiteralType node to visit.
- * @returns {void}
+ * @param node The TSLiteralType node to visit.
*/
- TSLiteralType(node: any) {
+ TSLiteralType(node: TSESTree.TSLiteralType): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSIntersectionType} node The TSIntersectionType node to visit.
- * @returns {void}
+ * @param node The TSIntersectionType node to visit.
*/
- TSIntersectionType(node: any) {
+ TSIntersectionType(node: TSESTree.TSIntersectionType): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSConditionalType} node The TSConditionalType node to visit.
- * @returns {void}
+ * @param node The TSConditionalType node to visit.
*/
- TSConditionalType(node: any) {
+ TSConditionalType(node: TSESTree.TSConditionalType): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSIndexedAccessType} node The TSIndexedAccessType node to visit.
- * @returns {void}
+ * @param node The TSIndexedAccessType node to visit.
*/
- TSIndexedAccessType(node: any) {
+ TSIndexedAccessType(node: TSESTree.TSIndexedAccessType): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSMappedType} node The TSMappedType node to visit.
- * @returns {void}
+ * @param node The TSMappedType node to visit.
*/
- TSMappedType(node: any) {
+ TSMappedType(node: TSESTree.TSMappedType): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSOptionalType} node The TSOptionalType node to visit.
- * @returns {void}
+ * @param node The TSOptionalType node to visit.
*/
- TSOptionalType(node: any) {
+ TSOptionalType(node: TSESTree.TSOptionalType): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSParenthesizedType} node The TSParenthesizedType node to visit.
- * @returns {void}
+ * @param node The TSParenthesizedType node to visit.
*/
- TSParenthesizedType(node: any) {
+ TSParenthesizedType(node: TSESTree.TSParenthesizedType): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSRestType} node The TSRestType node to visit.
- * @returns {void}
+ * @param node The TSRestType node to visit.
*/
- TSRestType(node: any) {
+ TSRestType(node: TSESTree.TSRestType): void {
this.visitTypeNodes(node);
}
/**
- * @param {TSTupleType} node The TSTupleType node to visit.
- * @returns {void}
+ * @param node The TSTupleType node to visit.
*/
- TSTupleType(node: any) {
+ TSTupleType(node: TSESTree.TSTupleType): void {
this.visitTypeNodes(node);
}
/**
* Create reference objects for the object part. (This is `obj.prop`)
- * @param {TSQualifiedName} node The TSQualifiedName node to visit.
- * @returns {void}
+ * @param node The TSQualifiedName node to visit.
*/
- TSQualifiedName(node: any) {
+ TSQualifiedName(node: TSESTree.TSQualifiedName): void {
this.visit(node.left);
}
/**
* Create reference objects for the references in computed keys.
- * @param {TSPropertySignature} node The TSPropertySignature node to visit.
- * @returns {void}
+ * @param node The TSPropertySignature node to visit.
*/
- TSPropertySignature(node: any) {
+ TSPropertySignature(node: TSESTree.TSPropertySignature): void {
const upperTypeMode = this.typeMode;
const { computed, key, typeAnnotation, initializer } = node;
@@ -595,10 +584,9 @@ class Referencer extends OriginalReferencer {
/**
* Create reference objects for the references in computed keys.
- * @param {TSMethodSignature} node The TSMethodSignature node to visit.
- * @returns {void}
+ * @param node The TSMethodSignature node to visit.
*/
- TSMethodSignature(node: any) {
+ TSMethodSignature(node: TSESTree.TSMethodSignature): void {
const upperTypeMode = this.typeMode;
const { computed, key, typeParameters, params, returnType } = node;
@@ -632,10 +620,9 @@ class Referencer extends OriginalReferencer {
* A = a // a is above constant.
* }
*
- * @param {TSEnumDeclaration} node The TSEnumDeclaration node to visit.
- * @returns {void}
+ * @param node The TSEnumDeclaration node to visit.
*/
- TSEnumDeclaration(node: any) {
+ TSEnumDeclaration(node: TSESTree.TSEnumDeclaration): void {
const { id, members } = node;
const scopeManager = this.scopeManager;
const scope = this.currentScope();
@@ -655,10 +642,9 @@ class Referencer extends OriginalReferencer {
* Create variable object for the enum member and create reference object for the initializer.
* And visit the initializer.
*
- * @param {TSEnumMember} node The TSEnumMember node to visit.
- * @returns {void}
+ * @param node The TSEnumMember node to visit.
*/
- TSEnumMember(node: any) {
+ TSEnumMember(node: TSESTree.TSEnumMember): void {
const { id, initializer } = node;
const scope = this.currentScope();
@@ -671,10 +657,9 @@ class Referencer extends OriginalReferencer {
/**
* Create the variable object for the module name, and visit children.
- * @param {TSModuleDeclaration} node The TSModuleDeclaration node to visit.
- * @returns {void}
+ * @param node The TSModuleDeclaration node to visit.
*/
- TSModuleDeclaration(node: any) {
+ TSModuleDeclaration(node: TSESTree.TSModuleDeclaration): void {
const scope = this.currentScope();
const { id, body } = node;
@@ -692,7 +677,7 @@ class Referencer extends OriginalReferencer {
this.visit(body);
}
- TSTypeAliasDeclaration(node: any) {
+ TSTypeAliasDeclaration(node: TSESTree.TSTypeAliasDeclaration): void {
this.typeMode = true;
this.visitChildren(node);
this.typeMode = false;
@@ -700,28 +685,26 @@ class Referencer extends OriginalReferencer {
/**
* Process the module block.
- * @param {TSModuleBlock} node The TSModuleBlock node to visit.
- * @returns {void}
+ * @param node The TSModuleBlock node to visit.
*/
- TSModuleBlock(node: any) {
+ TSModuleBlock(node: TSESTree.TSModuleBlock): void {
this.scopeManager.__nestBlockScope(node);
this.visitChildren(node);
this.close(node);
}
- TSAbstractClassProperty(node: any) {
+ TSAbstractClassProperty(node: TSESTree.TSAbstractClassProperty): void {
this.ClassProperty(node);
}
- TSAbstractMethodDefinition(node: any) {
+ TSAbstractMethodDefinition(node: TSESTree.TSAbstractMethodDefinition): void {
this.MethodDefinition(node);
}
/**
* Process import equal declaration
- * @param {TSImportEqualsDeclaration} node The TSImportEqualsDeclaration node to visit.
- * @returns {void}
+ * @param node The TSImportEqualsDeclaration node to visit.
*/
- TSImportEqualsDeclaration(node: any) {
+ TSImportEqualsDeclaration(node: TSESTree.TSImportEqualsDeclaration): void {
const { id, moduleReference } = node;
if (id && id.type === 'Identifier') {
this.currentScope().__define(
@@ -736,10 +719,9 @@ class Referencer extends OriginalReferencer {
* Process the global augmentation.
* 1. Set the global scope as the current scope.
* 2. Configure the global scope to set `variable.eslintUsed = true` for all defined variables. This means `no-unused-vars` doesn't warn those.
- * @param {TSModuleDeclaration} node The TSModuleDeclaration node to visit.
- * @returns {void}
+ * @param node The TSModuleDeclaration node to visit.
*/
- visitGlobalAugmentation(node: any) {
+ visitGlobalAugmentation(node: TSESTree.TSModuleDeclaration): void {
const scopeManager = this.scopeManager;
const currentScope = this.currentScope();
const globalScope = scopeManager.globalScope;
@@ -749,8 +731,8 @@ class Referencer extends OriginalReferencer {
scopeManager.__currentScope = globalScope;
// Skip TSModuleBlock to avoid to create that block scope.
- for (const moduleItem of node.body.body) {
- this.visit(moduleItem);
+ if (node.body && node.body.type === 'TSModuleBlock') {
+ node.body.body.forEach(this.visit, this);
}
scopeManager.__currentScope = currentScope;
@@ -759,10 +741,9 @@ class Referencer extends OriginalReferencer {
/**
* Process decorators.
- * @param {Decorator[]|undefined} decorators The decorator nodes to visit.
- * @returns {void}
+ * @param decorators The decorator nodes to visit.
*/
- visitDecorators(decorators?: any[]) {
+ visitDecorators(decorators?: TSESTree.Decorator[]): void {
if (decorators) {
decorators.forEach(this.visit, this);
}
@@ -770,10 +751,9 @@ class Referencer extends OriginalReferencer {
/**
* Process all child of type nodes
- * @param {any} node node to be processed
- * @returns {void}
+ * @param node node to be processed
*/
- visitTypeNodes(node: any) {
+ visitTypeNodes(node: TSESTree.Node): void {
if (this.typeMode) {
this.visitChildren(node);
} else {
diff --git a/packages/typescript-eslint-parser/src/typings.d.ts b/packages/parser/src/eslint-scope.d.ts
similarity index 57%
rename from packages/typescript-eslint-parser/src/typings.d.ts
rename to packages/parser/src/eslint-scope.d.ts
index 08f92526c823..28de7f8c759e 100644
--- a/packages/typescript-eslint-parser/src/typings.d.ts
+++ b/packages/parser/src/eslint-scope.d.ts
@@ -2,6 +2,7 @@
// Project: http://github.com/eslint/eslint-scope
// Definitions by: Armano
declare module 'eslint-scope/lib/options' {
+ import { TSESTree } from '@typescript-eslint/typescript-estree';
export type PatternVisitorCallback = (pattern: any, info: any) => void;
export interface PatternVisitorOptions {
@@ -9,76 +10,75 @@ declare module 'eslint-scope/lib/options' {
}
export abstract class Visitor {
- visitChildren(node: Node): void;
- visit(node: Node): void;
+ visitChildren(
+ node?: T
+ ): void;
+ visit(node?: T): void;
}
}
declare module 'eslint-scope/lib/variable' {
- import * as eslint from 'eslint';
- import { Identifier } from 'estree';
+ import { TSESTree } from '@typescript-eslint/typescript-estree';
import Reference from 'eslint-scope/lib/reference';
+ import { Definition } from 'eslint-scope/lib/definition';
- class Variable implements eslint.Scope.Variable {
+ export default class Variable {
name: string;
- identifiers: Identifier[];
+ identifiers: TSESTree.Identifier[];
references: Reference[];
- defs: eslint.Scope.Definition[];
+ defs: Definition[];
}
- export default Variable;
}
declare module 'eslint-scope/lib/definition' {
- import { Identifier, Node } from 'estree';
+ import { TSESTree } from '@typescript-eslint/typescript-estree';
- class Definition {
+ export class Definition {
type: string;
- name: Identifier;
- node: Node;
- parent?: Node | null;
+ name: TSESTree.BindingName;
+ node: TSESTree.Node;
+ parent?: TSESTree.Node | null;
index?: number | null;
kind?: string | null;
constructor(
type: string,
- name: Identifier,
- node: Node,
- parent?: Node | null,
+ name: TSESTree.BindingName | TSESTree.PropertyName,
+ node: TSESTree.Node,
+ parent?: TSESTree.Node | null,
index?: number | null,
kind?: string | null
);
}
- class ParameterDefinition extends Definition {
+ export class ParameterDefinition extends Definition {
rest?: boolean;
constructor(
- name: Identifier,
- node: Node,
+ name: TSESTree.BindingName | TSESTree.PropertyName,
+ node: TSESTree.Node,
index?: number | null,
rest?: boolean
);
}
-
- export { ParameterDefinition, Definition };
}
declare module 'eslint-scope/lib/pattern-visitor' {
import ScopeManager from 'eslint-scope/lib/scope-manager';
- import { Node } from 'estree';
+ import { TSESTree } from '@typescript-eslint/typescript-estree';
import {
PatternVisitorCallback,
PatternVisitorOptions,
Visitor
} from 'eslint-scope/lib/options';
- class PatternVisitor extends Visitor {
+ export default class PatternVisitor extends Visitor {
protected options: any;
protected scopeManager: ScopeManager;
- protected parent?: Node;
- public rightHandNodes: Node[];
+ protected parent?: TSESTree.Node;
+ public rightHandNodes: TSESTree.Node[];
- static isPattern(node: Node): boolean;
+ static isPattern(node: TSESTree.Node): boolean;
constructor(
options: PatternVisitorOptions,
@@ -86,41 +86,39 @@ declare module 'eslint-scope/lib/pattern-visitor' {
callback: PatternVisitorCallback
);
- Identifier(pattern: Node): void;
- Property(property: Node): void;
- ArrayPattern(pattern: Node): void;
- AssignmentPattern(pattern: Node): void;
- RestElement(pattern: Node): void;
- MemberExpression(node: Node): void;
- SpreadElement(node: Node): void;
- ArrayExpression(node: Node): void;
- AssignmentExpression(node: Node): void;
- CallExpression(node: Node): void;
+ Identifier(pattern: TSESTree.Node): void;
+ Property(property: TSESTree.Node): void;
+ ArrayPattern(pattern: TSESTree.Node): void;
+ AssignmentPattern(pattern: TSESTree.Node): void;
+ RestElement(pattern: TSESTree.Node): void;
+ MemberExpression(node: TSESTree.Node): void;
+ SpreadElement(node: TSESTree.Node): void;
+ ArrayExpression(node: TSESTree.Node): void;
+ AssignmentExpression(node: TSESTree.Node): void;
+ CallExpression(node: TSESTree.Node): void;
}
-
- export default PatternVisitor;
}
declare module 'eslint-scope/lib/referencer' {
import { Scope } from 'eslint-scope/lib/scope';
import ScopeManager from 'eslint-scope/lib/scope-manager';
- import { Node } from 'estree';
+ import { TSESTree } from '@typescript-eslint/typescript-estree';
import {
PatternVisitorCallback,
PatternVisitorOptions,
Visitor
} from 'eslint-scope/lib/options';
- class Referencer extends Visitor {
+ export default class Referencer extends Visitor {
protected isInnerMethodDefinition: boolean;
protected options: any;
protected scopeManager: ScopeManager;
- protected parent?: Node;
+ protected parent?: TSESTree.Node;
constructor(options: any, scopeManager: ScopeManager);
currentScope(): Scope;
- close(node: Node): void;
+ close(node: TSESTree.Node): void;
pushInnerMethodDefinition(isInnerMethodDefinition: boolean): boolean;
popInnerMethodDefinition(isInnerMethodDefinition: boolean): void;
@@ -131,66 +129,63 @@ declare module 'eslint-scope/lib/referencer' {
init: boolean
): void;
visitPattern(
- node: Node,
+ node: TSESTree.Node,
options: PatternVisitorOptions,
callback: PatternVisitorCallback
): void;
- visitFunction(node: Node): void;
- visitClass(node: Node): void;
- visitProperty(node: Node): void;
- visitForIn(node: Node): void;
+ visitFunction(node: TSESTree.Node): void;
+ visitClass(node: TSESTree.Node): void;
+ visitProperty(node: TSESTree.Node): void;
+ visitForIn(node: TSESTree.Node): void;
visitVariableDeclaration(
variableTargetScope: any,
type: any,
- node: Node,
+ node: TSESTree.Node,
index: any
): void;
- AssignmentExpression(node: Node): void;
- CatchClause(node: Node): void;
- Program(node: Node): void;
- Identifier(node: Node): void;
- UpdateExpression(node: Node): void;
- MemberExpression(node: Node): void;
- Property(node: Node): void;
- MethodDefinition(node: Node): void;
+ AssignmentExpression(node: TSESTree.Node): void;
+ CatchClause(node: TSESTree.Node): void;
+ Program(node: TSESTree.Node): void;
+ Identifier(node: TSESTree.Node): void;
+ UpdateExpression(node: TSESTree.Node): void;
+ MemberExpression(node: TSESTree.Node): void;
+ Property(node: TSESTree.Node): void;
+ MethodDefinition(node: TSESTree.Node): void;
BreakStatement(): void;
ContinueStatement(): void;
- LabeledStatement(node: Node): void;
- ForStatement(node: Node): void;
- ClassExpression(node: Node): void;
- ClassDeclaration(node: Node): void;
- CallExpression(node: Node): void;
- BlockStatement(node: Node): void;
+ LabeledStatement(node: TSESTree.Node): void;
+ ForStatement(node: TSESTree.Node): void;
+ ClassExpression(node: TSESTree.Node): void;
+ ClassDeclaration(node: TSESTree.Node): void;
+ CallExpression(node: TSESTree.Node): void;
+ BlockStatement(node: TSESTree.Node): void;
ThisExpression(): void;
- WithStatement(node: Node): void;
- VariableDeclaration(node: Node): void;
- SwitchStatement(node: Node): void;
- FunctionDeclaration(node: Node): void;
- FunctionExpression(node: Node): void;
- ForOfStatement(node: Node): void;
- ForInStatement(node: Node): void;
- ArrowFunctionExpression(node: Node): void;
- ImportDeclaration(node: Node): void;
- visitExportDeclaration(node: Node): void;
- ExportDeclaration(node: Node): void;
- ExportNamedDeclaration(node: Node): void;
- ExportSpecifier(node: Node): void;
+ WithStatement(node: TSESTree.Node): void;
+ VariableDeclaration(node: TSESTree.Node): void;
+ SwitchStatement(node: TSESTree.Node): void;
+ FunctionDeclaration(node: TSESTree.Node): void;
+ FunctionExpression(node: TSESTree.Node): void;
+ ForOfStatement(node: TSESTree.Node): void;
+ ForInStatement(node: TSESTree.Node): void;
+ ArrowFunctionExpression(node: TSESTree.Node): void;
+ ImportDeclaration(node: TSESTree.Node): void;
+ visitExportDeclaration(node: TSESTree.Node): void;
+ ExportDeclaration(node: TSESTree.Node): void;
+ ExportNamedDeclaration(node: TSESTree.Node): void;
+ ExportSpecifier(node: TSESTree.Node): void;
MetaProperty(): void;
}
-
- export default Referencer;
}
declare module 'eslint-scope/lib/scope' {
- import * as eslint from 'eslint';
- import { Node } from 'estree';
+ import { TSESTree } from '@typescript-eslint/typescript-estree';
import Reference from 'eslint-scope/lib/reference';
import Variable from 'eslint-scope/lib/variable';
import ScopeManager from 'eslint-scope/lib/scope-manager';
import { Definition } from 'eslint-scope/lib/definition';
- type ScopeType =
+ export type ScopeType =
| 'block'
| 'catch'
| 'class'
@@ -203,13 +198,13 @@ declare module 'eslint-scope/lib/scope' {
| 'with'
| 'TDZ';
- class Scope implements eslint.Scope.Scope {
+ export class Scope {
type: ScopeType;
isStrict: boolean;
upper: Scope | null;
childScopes: Scope[];
variableScope: Scope;
- block: Node;
+ block: TSESTree.Node;
variables: Variable[];
set: Map;
references: Reference[];
@@ -221,7 +216,7 @@ declare module 'eslint-scope/lib/scope' {
scopeManager: ScopeManager,
type: ScopeType,
upperScope: Scope | null,
- block: Node | null,
+ block: TSESTree.Node | null,
isMethodDefinition: boolean
);
@@ -234,7 +229,7 @@ declare module 'eslint-scope/lib/scope' {
__isValidResolution(ref: any, variable: any): boolean;
__resolve(ref: any): boolean;
__delegateToUpperScope(ref: any): void;
- __addDeclaredVariablesOfNode(variable: any, node: Node): void;
+ __addDeclaredVariablesOfNode(variable: any, node: TSESTree.Node): void;
__defineGeneric(
name: any,
set: any,
@@ -243,12 +238,12 @@ declare module 'eslint-scope/lib/scope' {
def: Definition
): void;
- __define(node: Node, def: Definition): void;
+ __define(node: TSESTree.Node, def: Definition): void;
__referencing(
- node: Node,
+ node: TSESTree.Node,
assign: number,
- writeExpr: Node,
+ writeExpr: TSESTree.Node,
maybeImplicitGlobal: any,
partial: any,
init: any
@@ -263,7 +258,7 @@ declare module 'eslint-scope/lib/scope' {
* @param {Espree.Identifier} ident - identifier to be resolved.
* @returns {Reference} reference
*/
- resolve(ident: Node): Reference;
+ resolve(ident: TSESTree.Node): Reference;
/**
* returns this scope is static
@@ -289,109 +284,94 @@ declare module 'eslint-scope/lib/scope' {
isUsedName(name: any): boolean;
}
- class GlobalScope extends Scope {
- constructor(scopeManager: ScopeManager, block: Node | null);
+ export class GlobalScope extends Scope {
+ constructor(scopeManager: ScopeManager, block: TSESTree.Node | null);
}
- class ModuleScope extends Scope {
+ export class ModuleScope extends Scope {
constructor(
scopeManager: ScopeManager,
upperScope: Scope,
- block: Node | null
+ block: TSESTree.Node | null
);
}
- class FunctionExpressionNameScope extends Scope {
+ export class FunctionExpressionNameScope extends Scope {
constructor(
scopeManager: ScopeManager,
upperScope: Scope,
- block: Node | null
+ block: TSESTree.Node | null
);
}
- class CatchScope extends Scope {
+ export class CatchScope extends Scope {
constructor(
scopeManager: ScopeManager,
upperScope: Scope,
- block: Node | null
+ block: TSESTree.Node | null
);
}
- class WithScope extends Scope {
+ export class WithScope extends Scope {
constructor(
scopeManager: ScopeManager,
upperScope: Scope,
- block: Node | null
+ block: TSESTree.Node | null
);
}
- class BlockScope extends Scope {
+ export class BlockScope extends Scope {
constructor(
scopeManager: ScopeManager,
upperScope: Scope,
- block: Node | null
+ block: TSESTree.Node | null
);
}
- class SwitchScope extends Scope {
+ export class SwitchScope extends Scope {
constructor(
scopeManager: ScopeManager,
upperScope: Scope,
- block: Node | null
+ block: TSESTree.Node | null
);
}
- class FunctionScope extends Scope {
+ export class FunctionScope extends Scope {
constructor(
scopeManager: ScopeManager,
upperScope: Scope,
- block: Node | null,
+ block: TSESTree.Node | null,
isMethodDefinition: boolean
);
}
- class ForScope extends Scope {
+ export class ForScope extends Scope {
constructor(
scopeManager: ScopeManager,
upperScope: Scope,
- block: Node | null
+ block: TSESTree.Node | null
);
}
- class ClassScope extends Scope {
+ export class ClassScope extends Scope {
constructor(
scopeManager: ScopeManager,
upperScope: Scope,
- block: Node | null
+ block: TSESTree.Node | null
);
}
-
- export {
- Scope,
- GlobalScope,
- ModuleScope,
- FunctionExpressionNameScope,
- CatchScope,
- WithScope,
- BlockScope,
- SwitchScope,
- FunctionScope,
- ForScope,
- ClassScope
- };
}
declare module 'eslint-scope/lib/reference' {
- import * as eslint from 'eslint';
- import { Identifier, Node } from 'estree';
+ import { TSESTree } from '@typescript-eslint/typescript-estree';
import { Scope } from 'eslint-scope/lib/scope';
import Variable from 'eslint-scope/lib/variable';
- class Reference implements eslint.Scope.Reference {
- identifier: Identifier;
+ export default class Reference {
+ identifier: TSESTree.Identifier;
from: Scope;
resolved: Variable | null;
- writeExpr: Node | null;
+ writeExpr: TSESTree.Node | null;
init: boolean;
isWrite(): boolean;
@@ -404,15 +384,14 @@ declare module 'eslint-scope/lib/reference' {
static WRITE: 0x2;
static RW: 0x3;
}
- export default Reference;
}
declare module 'eslint-scope/lib/scope-manager' {
- import * as eslint from 'eslint';
+ import { TSESTree } from '@typescript-eslint/typescript-estree';
import { Scope } from 'eslint-scope/lib/scope';
import Variable from 'eslint-scope/lib/variable';
- interface ScopeManagerOptions {
+ export interface ScopeManagerOptions {
directive?: boolean;
optimistic?: boolean;
ignoreEval?: boolean;
@@ -422,7 +401,7 @@ declare module 'eslint-scope/lib/scope-manager' {
ecmaVersion?: number;
}
- class ScopeManager implements eslint.Scope.ScopeManager {
+ export default class ScopeManager {
__options: ScopeManagerOptions;
__currentScope: Scope;
scopes: Scope[];
@@ -439,29 +418,31 @@ declare module 'eslint-scope/lib/scope-manager' {
isStrictModeSupported(): boolean;
// Returns appropriate scope for this node.
- __get(node: Node): Scope;
- getDeclaredVariables(node: {}): Variable[];
- acquire(node: {}, inner?: boolean): Scope | null;
- acquireAll(node: Node): Scope | null;
- release(node: Node, inner?: boolean): Scope | null;
+ __get(node: TSESTree.Node): Scope;
+ getDeclaredVariables(node: TSESTree.Node): Variable[];
+ acquire(node: TSESTree.Node, inner?: boolean): Scope | null;
+ acquireAll(node: TSESTree.Node): Scope | null;
+ release(node: TSESTree.Node, inner?: boolean): Scope | null;
attach(): void;
detach(): void;
__nestScope(scope: Scope): Scope;
- __nestGlobalScope(node: Node): Scope;
- __nestBlockScope(node: Node): Scope;
- __nestFunctionScope(node: Node, isMethodDefinition: boolean): Scope;
- __nestForScope(node: Node): Scope;
- __nestCatchScope(node: Node): Scope;
- __nestWithScope(node: Node): Scope;
- __nestClassScope(node: Node): Scope;
- __nestSwitchScope(node: Node): Scope;
- __nestModuleScope(node: Node): Scope;
- __nestFunctionExpressionNameScope(node: Node): Scope;
+ __nestGlobalScope(node: TSESTree.Node): Scope;
+ __nestBlockScope(node: TSESTree.Node): Scope;
+ __nestFunctionScope(
+ node: TSESTree.Node,
+ isMethodDefinition: boolean
+ ): Scope;
+ __nestForScope(node: TSESTree.Node): Scope;
+ __nestCatchScope(node: TSESTree.Node): Scope;
+ __nestWithScope(node: TSESTree.Node): Scope;
+ __nestClassScope(node: TSESTree.Node): Scope;
+ __nestSwitchScope(node: TSESTree.Node): Scope;
+ __nestModuleScope(node: TSESTree.Node): Scope;
+ __nestFunctionExpressionNameScope(node: TSESTree.Node): Scope;
__isES6(): boolean;
}
- export default ScopeManager;
}
declare module 'eslint-scope' {
diff --git a/packages/parser/src/parser-options.ts b/packages/parser/src/parser-options.ts
new file mode 100644
index 000000000000..d374ac57b912
--- /dev/null
+++ b/packages/parser/src/parser-options.ts
@@ -0,0 +1,21 @@
+export interface ParserOptions {
+ loc?: boolean;
+ comment?: boolean;
+ range?: boolean;
+ tokens?: boolean;
+ sourceType?: 'script' | 'module';
+ ecmaVersion?: number;
+ ecmaFeatures?: {
+ globalReturn?: boolean;
+ jsx?: boolean;
+ };
+ // ts-estree specific
+ filePath?: string;
+ project?: string | string[];
+ useJSXTextNode?: boolean;
+ errorOnUnknownASTType?: boolean;
+ errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
+ tsconfigRootDir?: string;
+ extraFileExtensions?: string[];
+ warnOnUnsupportedTypeScriptVersion?: boolean;
+}
diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts
new file mode 100644
index 000000000000..78d71197e9f9
--- /dev/null
+++ b/packages/parser/src/parser.ts
@@ -0,0 +1,103 @@
+import traverser from 'eslint/lib/util/traverser';
+import {
+ AST_NODE_TYPES,
+ parseAndGenerateServices,
+ ParserOptions as ParserOptionsTsESTree,
+ ParserServices
+} from '@typescript-eslint/typescript-estree';
+import { analyzeScope } from './analyze-scope';
+import { ParserOptions } from './parser-options';
+import { visitorKeys } from './visitor-keys';
+
+const packageJSON = require('../package.json');
+
+interface ParseForESLintResult {
+ ast: any;
+ services: ParserServices;
+ visitorKeys: typeof visitorKeys;
+ scopeManager: ReturnType;
+}
+
+function validateBoolean(
+ value: boolean | undefined,
+ fallback: boolean = false
+): boolean {
+ if (typeof value !== 'boolean') {
+ return fallback;
+ }
+ return value;
+}
+
+//------------------------------------------------------------------------------
+// Public
+//------------------------------------------------------------------------------
+
+export const version = packageJSON.version;
+
+export const Syntax = Object.freeze(AST_NODE_TYPES);
+
+export function parse(code: string, options?: ParserOptions) {
+ return parseForESLint(code, options).ast;
+}
+
+export function parseForESLint(
+ code: string,
+ options?: ParserOptions | null
+): ParseForESLintResult {
+ if (!options || typeof options !== 'object') {
+ options = {};
+ }
+ // https://eslint.org/docs/user-guide/configuring#specifying-parser-options
+ // if sourceType is not provided by default eslint expect that it will be set to "script"
+ if (options.sourceType !== 'module' && options.sourceType !== 'script') {
+ options.sourceType = 'script';
+ }
+ if (typeof options.ecmaFeatures !== 'object') {
+ options.ecmaFeatures = {};
+ }
+
+ const parserOptions: ParserOptionsTsESTree = {};
+ Object.assign(parserOptions, options, {
+ useJSXTextNode: validateBoolean(options.useJSXTextNode, true),
+ jsx: validateBoolean(options.ecmaFeatures.jsx)
+ });
+
+ if (typeof options.filePath === 'string') {
+ const tsx = options.filePath.endsWith('.tsx');
+ if (tsx || options.filePath.endsWith('.ts')) {
+ parserOptions.jsx = tsx;
+ }
+ }
+
+ /**
+ * Allow the user to suppress the warning from typescript-estree if they are using an unsupported
+ * version of TypeScript
+ */
+ const warnOnUnsupportedTypeScriptVersion = validateBoolean(
+ options.warnOnUnsupportedTypeScriptVersion,
+ true
+ );
+ if (!warnOnUnsupportedTypeScriptVersion) {
+ parserOptions.loggerFn = false;
+ }
+
+ const { ast, services } = parseAndGenerateServices(code, parserOptions);
+ ast.sourceType = options.sourceType;
+
+ traverser.traverse(ast, {
+ enter(node: any) {
+ switch (node.type) {
+ // Function#body cannot be null in ESTree spec.
+ case 'FunctionExpression':
+ if (!node.body) {
+ node.type = `TSEmptyBody${node.type}` as AST_NODE_TYPES;
+ }
+ break;
+ // no default
+ }
+ }
+ });
+
+ const scopeManager = analyzeScope(ast, options);
+ return { ast, services, scopeManager, visitorKeys };
+}
diff --git a/packages/typescript-eslint-parser/src/visitor-keys.ts b/packages/parser/src/visitor-keys.ts
similarity index 95%
rename from packages/typescript-eslint-parser/src/visitor-keys.ts
rename to packages/parser/src/visitor-keys.ts
index d1dd5e616aeb..d3938529e820 100644
--- a/packages/typescript-eslint-parser/src/visitor-keys.ts
+++ b/packages/parser/src/visitor-keys.ts
@@ -1,6 +1,8 @@
import eslintVisitorKeys from 'eslint-visitor-keys';
export const visitorKeys = eslintVisitorKeys.unionWith({
+ // Additional estree nodes.
+ Import: [],
// Additional Properties.
ArrayPattern: ['elements', 'typeAnnotation'],
ArrowFunctionExpression: ['typeParameters', 'params', 'returnType', 'body'],
@@ -30,6 +32,11 @@ export const visitorKeys = eslintVisitorKeys.unionWith({
RestElement: ['argument', 'typeAnnotation'],
NewExpression: ['callee', 'typeParameters', 'arguments'],
CallExpression: ['callee', 'typeParameters', 'arguments'],
+ // JSX
+ JSXOpeningElement: ['name', 'typeParameters', 'attributes'],
+ JSXClosingFragment: [],
+ JSXOpeningFragment: [],
+ JSXSpreadChild: ['expression'],
// Additional Nodes.
BigIntLiteral: [],
diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.src.js b/packages/parser/tests/fixtures/basics/delete-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.src.js
rename to packages/parser/tests/fixtures/basics/delete-expression.src.js
diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.src.js b/packages/parser/tests/fixtures/basics/do-while-statements.src.js
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.src.js
rename to packages/parser/tests/fixtures/basics/do-while-statements.src.js
diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.src.js b/packages/parser/tests/fixtures/basics/identifiers-double-underscore.src.js
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.src.js
rename to packages/parser/tests/fixtures/basics/identifiers-double-underscore.src.js
diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.src.js b/packages/parser/tests/fixtures/basics/instanceof.src.js
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.src.js
rename to packages/parser/tests/fixtures/basics/instanceof.src.js
diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.src.js b/packages/parser/tests/fixtures/basics/new-with-member-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.src.js
rename to packages/parser/tests/fixtures/basics/new-with-member-expression.src.js
diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.src.js b/packages/parser/tests/fixtures/basics/new-without-parens.src.js
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.src.js
rename to packages/parser/tests/fixtures/basics/new-without-parens.src.js
diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.src.js b/packages/parser/tests/fixtures/basics/typeof-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.src.js
rename to packages/parser/tests/fixtures/basics/typeof-expression.src.js
diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.src.js b/packages/parser/tests/fixtures/basics/update-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.src.js
rename to packages/parser/tests/fixtures/basics/update-expression.src.js
diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.src.js b/packages/parser/tests/fixtures/basics/void-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.src.js
rename to packages/parser/tests/fixtures/basics/void-expression.src.js
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/535.ts b/packages/parser/tests/fixtures/scope-analysis/535.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/535.ts
rename to packages/parser/tests/fixtures/scope-analysis/535.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/abstract-class.ts b/packages/parser/tests/fixtures/scope-analysis/abstract-class.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/abstract-class.ts
rename to packages/parser/tests/fixtures/scope-analysis/abstract-class.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-implements.ts b/packages/parser/tests/fixtures/scope-analysis/class-implements.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-implements.ts
rename to packages/parser/tests/fixtures/scope-analysis/class-implements.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-properties.ts b/packages/parser/tests/fixtures/scope-analysis/class-properties.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-properties.ts
rename to packages/parser/tests/fixtures/scope-analysis/class-properties.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-supper-type.ts b/packages/parser/tests/fixtures/scope-analysis/class-supper-type.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-supper-type.ts
rename to packages/parser/tests/fixtures/scope-analysis/class-supper-type.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts b/packages/parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts
rename to packages/parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts b/packages/parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts
rename to packages/parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-function.ts b/packages/parser/tests/fixtures/scope-analysis/declare-function.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-function.ts
rename to packages/parser/tests/fixtures/scope-analysis/declare-function.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-global.ts b/packages/parser/tests/fixtures/scope-analysis/declare-global.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-global.ts
rename to packages/parser/tests/fixtures/scope-analysis/declare-global.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-module.ts b/packages/parser/tests/fixtures/scope-analysis/declare-module.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-module.ts
rename to packages/parser/tests/fixtures/scope-analysis/declare-module.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/decorators.ts b/packages/parser/tests/fixtures/scope-analysis/decorators.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/decorators.ts
rename to packages/parser/tests/fixtures/scope-analysis/decorators.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum-string.ts b/packages/parser/tests/fixtures/scope-analysis/enum-string.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum-string.ts
rename to packages/parser/tests/fixtures/scope-analysis/enum-string.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum.ts b/packages/parser/tests/fixtures/scope-analysis/enum.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum.ts
rename to packages/parser/tests/fixtures/scope-analysis/enum.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/export-as-namespace.ts b/packages/parser/tests/fixtures/scope-analysis/export-as-namespace.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/export-as-namespace.ts
rename to packages/parser/tests/fixtures/scope-analysis/export-as-namespace.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-as.ts b/packages/parser/tests/fixtures/scope-analysis/expression-as.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-as.ts
rename to packages/parser/tests/fixtures/scope-analysis/expression-as.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-type-parameters.ts b/packages/parser/tests/fixtures/scope-analysis/expression-type-parameters.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-type-parameters.ts
rename to packages/parser/tests/fixtures/scope-analysis/expression-type-parameters.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload-2.ts b/packages/parser/tests/fixtures/scope-analysis/function-overload-2.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload-2.ts
rename to packages/parser/tests/fixtures/scope-analysis/function-overload-2.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload.ts b/packages/parser/tests/fixtures/scope-analysis/function-overload.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload.ts
rename to packages/parser/tests/fixtures/scope-analysis/function-overload.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/identifier-decorators.ts b/packages/parser/tests/fixtures/scope-analysis/identifier-decorators.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/identifier-decorators.ts
rename to packages/parser/tests/fixtures/scope-analysis/identifier-decorators.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts b/packages/parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts
rename to packages/parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/import-equals.ts b/packages/parser/tests/fixtures/scope-analysis/import-equals.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/import-equals.ts
rename to packages/parser/tests/fixtures/scope-analysis/import-equals.ts
diff --git a/packages/parser/tests/fixtures/scope-analysis/import-keyword.ts b/packages/parser/tests/fixtures/scope-analysis/import-keyword.ts
new file mode 100644
index 000000000000..3beea868f04b
--- /dev/null
+++ b/packages/parser/tests/fixtures/scope-analysis/import-keyword.ts
@@ -0,0 +1 @@
+import('test');
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/interface-type.ts b/packages/parser/tests/fixtures/scope-analysis/interface-type.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/interface-type.ts
rename to packages/parser/tests/fixtures/scope-analysis/interface-type.ts
diff --git a/packages/parser/tests/fixtures/scope-analysis/jsx-attributes.tsx b/packages/parser/tests/fixtures/scope-analysis/jsx-attributes.tsx
new file mode 100644
index 000000000000..04bb4b42ac80
--- /dev/null
+++ b/packages/parser/tests/fixtures/scope-analysis/jsx-attributes.tsx
@@ -0,0 +1,8 @@
+const text = 'text';
+export function Foo() {
+ return (
+
+
+
+ );
+}
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/method-overload.ts b/packages/parser/tests/fixtures/scope-analysis/method-overload.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/method-overload.ts
rename to packages/parser/tests/fixtures/scope-analysis/method-overload.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/namespace.ts b/packages/parser/tests/fixtures/scope-analysis/namespace.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/namespace.ts
rename to packages/parser/tests/fixtures/scope-analysis/namespace.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/rest-element.ts b/packages/parser/tests/fixtures/scope-analysis/rest-element.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/rest-element.ts
rename to packages/parser/tests/fixtures/scope-analysis/rest-element.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-alias.ts b/packages/parser/tests/fixtures/scope-analysis/type-alias.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-alias.ts
rename to packages/parser/tests/fixtures/scope-analysis/type-alias.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-annotations.ts b/packages/parser/tests/fixtures/scope-analysis/type-annotations.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-annotations.ts
rename to packages/parser/tests/fixtures/scope-analysis/type-annotations.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-assertions.ts b/packages/parser/tests/fixtures/scope-analysis/type-assertions.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-assertions.ts
rename to packages/parser/tests/fixtures/scope-analysis/type-assertions.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-parameter.ts b/packages/parser/tests/fixtures/scope-analysis/type-parameter.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-parameter.ts
rename to packages/parser/tests/fixtures/scope-analysis/type-parameter.ts
diff --git a/packages/parser/tests/fixtures/scope-analysis/typed-jsx-element.tsx b/packages/parser/tests/fixtures/scope-analysis/typed-jsx-element.tsx
new file mode 100644
index 000000000000..29158b30c8dc
--- /dev/null
+++ b/packages/parser/tests/fixtures/scope-analysis/typed-jsx-element.tsx
@@ -0,0 +1 @@
+const a = />;
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts
rename to packages/parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts
rename to packages/parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts
rename to packages/parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts
rename to packages/parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-var.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-var.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-var.ts
rename to packages/parser/tests/fixtures/scope-analysis/typeof-in-var.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof.ts b/packages/parser/tests/fixtures/scope-analysis/typeof.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof.ts
rename to packages/parser/tests/fixtures/scope-analysis/typeof.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-array-type.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-array-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-array-type.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-array-type.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional-with-null.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-conditional-with-null.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional-with-null.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-conditional-with-null.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-conditional.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-conditional.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-indexed.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-indexed.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-indexed.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-indexed.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-infer.ts b/packages/parser/tests/fixtures/scope-analysis/types-infer.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-infer.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-infer.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-intersection-type.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-intersection-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-intersection-type.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-intersection-type.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-mapped.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-mapped.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-nested-types.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-nested-types.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-nested-types.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-nested-types.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-reference-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-reference-generic.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-reference.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-reference.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-empty.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-tuple-empty.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-empty.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-tuple-empty.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-tuple.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-tuple.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-literal.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-type-literal.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-literal.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-type-literal.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-operator.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-type-operator.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-operator.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-type-operator.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-typeof.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-typeof.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-typeof.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-typeof.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-type.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-union-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-type.src.ts
rename to packages/parser/tests/fixtures/scope-analysis/types-union-type.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/services/isolated-file.src.ts b/packages/parser/tests/fixtures/services/isolated-file.src.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/services/isolated-file.src.ts
rename to packages/parser/tests/fixtures/services/isolated-file.src.ts
diff --git a/packages/typescript-eslint-parser/tests/fixtures/services/tsconfig.json b/packages/parser/tests/fixtures/services/tsconfig.json
similarity index 100%
rename from packages/typescript-eslint-parser/tests/fixtures/services/tsconfig.json
rename to packages/parser/tests/fixtures/services/tsconfig.json
diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.ts.snap b/packages/parser/tests/lib/__snapshots__/basics.ts.snap
similarity index 100%
rename from packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.ts.snap
rename to packages/parser/tests/lib/__snapshots__/basics.ts.snap
diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.ts.snap b/packages/parser/tests/lib/__snapshots__/comments.ts.snap
similarity index 100%
rename from packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.ts.snap
rename to packages/parser/tests/lib/__snapshots__/comments.ts.snap
diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/javascript.ts.snap b/packages/parser/tests/lib/__snapshots__/javascript.ts.snap
similarity index 98%
rename from packages/typescript-eslint-parser/tests/lib/__snapshots__/javascript.ts.snap
rename to packages/parser/tests/lib/__snapshots__/javascript.ts.snap
index fcbb463e5ee9..6a51ccfcd4de 100644
--- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/javascript.ts.snap
+++ b/packages/parser/tests/lib/__snapshots__/javascript.ts.snap
@@ -30326,6 +30326,8 @@ Object {
}
`;
+exports[`javascript fixtures/classes/class-with-no-body.src 1`] = `"'{' expected."`;
+
exports[`javascript fixtures/classes/derived-class-assign-to-var.src 1`] = `
Object {
"body": Array [
@@ -99360,126 +99362,218 @@ Object {
}
`;
-exports[`javascript fixtures/generators/anonymous-generator.src 1`] = `
+exports[`javascript fixtures/function/return-multiline-sequence.src 1`] = `
Object {
"body": Array [
Object {
- "expression": Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "expression": Object {
- "argument": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
+ "expressions": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 1,
+ "column": 5,
+ "line": 3,
},
"start": Object {
- "column": 22,
- "line": 1,
+ "column": 4,
+ "line": 3,
},
},
- "name": "v",
+ "name": "x",
"range": Array [
- 22,
- 23,
+ 40,
+ 41,
],
"type": "Identifier",
},
- "delegate": false,
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 1,
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 4,
+ },
},
- "start": Object {
- "column": 16,
- "line": 1,
+ "name": "y",
+ "range": Array [
+ 47,
+ 48,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 5,
+ },
},
+ "name": "z",
+ "range": Array [
+ 54,
+ 55,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 16,
- 23,
- ],
- "type": "YieldExpression",
- },
+ ],
"loc": Object {
"end": Object {
- "column": 23,
- "line": 1,
+ "column": 5,
+ "line": 5,
},
"start": Object {
- "column": 16,
- "line": 1,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 16,
- 23,
+ 40,
+ 55,
],
- "type": "ExpressionStatement",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
+ "type": "SequenceExpression",
},
- "start": Object {
- "column": 14,
- "line": 1,
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
},
+ "range": Array [
+ 27,
+ 60,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 1,
},
- "range": Array [
- 14,
- 25,
- ],
- "type": "BlockStatement",
},
- "expression": false,
- "generator": true,
- "id": null,
+ "range": Array [
+ 23,
+ 62,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 1,
+ "column": 9,
"line": 1,
},
},
- "params": Array [],
+ "name": "foo",
"range": Array [
- 1,
- 25,
+ 9,
+ 12,
],
- "type": "FunctionExpression",
+ "type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 27,
- "line": 1,
+ "column": 1,
+ "line": 7,
},
"start": Object {
"column": 0,
"line": 1,
},
},
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "name": "y",
+ "range": Array [
+ 17,
+ 18,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
+ },
+ },
+ "name": "z",
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Identifier",
+ },
+ ],
"range": Array [
0,
- 27,
+ 62,
],
- "type": "ExpressionStatement",
+ "type": "FunctionDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 27,
- "line": 1,
+ "column": 0,
+ "line": 8,
},
"start": Object {
"column": 0,
@@ -99488,14 +99582,14 @@ Object {
},
"range": Array [
0,
- 27,
+ 63,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -99505,25 +99599,7 @@ Object {
},
"range": Array [
0,
- 1,
- ],
- "type": "Punctuator",
- "value": "(",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 1,
- },
- "start": Object {
- "column": 1,
- "line": 1,
- },
- },
- "range": Array [
- 1,
- 9,
+ 8,
],
"type": "Keyword",
"value": "function",
@@ -99531,7 +99607,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 12,
"line": 1,
},
"start": Object {
@@ -99541,25 +99617,25 @@ Object {
},
"range": Array [
9,
- 10,
+ 12,
],
- "type": "Punctuator",
- "value": "*",
+ "type": "Identifier",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 11,
- 12,
+ 13,
+ 14,
],
"type": "Punctuator",
"value": "(",
@@ -99567,107 +99643,107 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 14,
+ 15,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "x",
},
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": 21,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 16,
- 21,
+ 17,
+ 18,
],
- "type": "Keyword",
- "value": "yield",
+ "type": "Identifier",
+ "value": "y",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 19,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 22,
- 23,
+ 18,
+ 19,
],
- "type": "Identifier",
- "value": "v",
+ "type": "Punctuator",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 20,
+ 21,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "z",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 25,
- 26,
+ 21,
+ 22,
],
"type": "Punctuator",
"value": ")",
@@ -99675,235 +99751,1339 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 26,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 23,
+ 24,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`javascript fixtures/generators/async-generator-function.src 1`] = `
-Object {
- "body": Array [
Object {
- "async": true,
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 4,
- },
- "start": Object {
- "column": 22,
- "line": 2,
- },
- },
- "range": Array [
- 23,
- 27,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": true,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "name": "foo",
- "range": Array [
- 17,
- 20,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 8,
+ "line": 2,
},
"start": Object {
- "column": 0,
+ "column": 2,
"line": 2,
},
},
- "params": Array [],
"range": Array [
- 1,
27,
+ 33,
],
- "type": "FunctionDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 5,
- },
- "start": Object {
- "column": 0,
- "line": 2,
+ "type": "Keyword",
+ "value": "return",
},
- },
- "range": Array [
- 1,
- 28,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 10,
"line": 2,
},
"start": Object {
- "column": 0,
+ "column": 9,
"line": 2,
},
},
"range": Array [
- 1,
- 6,
+ 34,
+ 35,
],
- "type": "Identifier",
- "value": "async",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 2,
+ "column": 5,
+ "line": 3,
},
"start": Object {
- "column": 6,
- "line": 2,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 7,
- 15,
+ 40,
+ 41,
],
- "type": "Keyword",
- "value": "function",
+ "type": "Identifier",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 2,
+ "column": 6,
+ "line": 3,
},
"start": Object {
- "column": 15,
- "line": 2,
+ "column": 5,
+ "line": 3,
},
},
"range": Array [
- 16,
- 17,
+ 41,
+ 42,
],
"type": "Punctuator",
- "value": "*",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 2,
+ "column": 5,
+ "line": 4,
},
"start": Object {
- "column": 16,
- "line": 2,
+ "column": 4,
+ "line": 4,
},
},
"range": Array [
- 17,
- 20,
+ 47,
+ 48,
],
"type": "Identifier",
- "value": "foo",
+ "value": "y",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 2,
+ "column": 6,
+ "line": 4,
},
"start": Object {
- "column": 19,
- "line": 2,
+ "column": 5,
+ "line": 4,
},
},
"range": Array [
- 20,
- 21,
+ 48,
+ 49,
],
"type": "Punctuator",
- "value": "(",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 2,
+ "column": 5,
+ "line": 5,
},
"start": Object {
- "column": 20,
- "line": 2,
+ "column": 4,
+ "line": 5,
},
},
"range": Array [
- 21,
- 22,
+ 54,
+ 55,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "z",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 2,
+ "column": 3,
+ "line": 6,
},
"start": Object {
- "column": 22,
- "line": 2,
+ "column": 2,
+ "line": 6,
},
},
"range": Array [
- 23,
- 24,
+ 58,
+ 59,
],
"type": "Punctuator",
- "value": "{",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 4,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 59,
+ 60,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 61,
+ 62,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`javascript fixtures/function/return-sequence.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
+ "expressions": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 2,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 35,
+ 36,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 2,
+ },
+ },
+ "name": "y",
+ "range": Array [
+ 38,
+ 39,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "name": "z",
+ "range": Array [
+ 41,
+ 42,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 35,
+ 42,
+ ],
+ "type": "SequenceExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 27,
+ 44,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 23,
+ 46,
+ ],
+ "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": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "name": "y",
+ "range": Array [
+ 17,
+ 18,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
+ },
+ },
+ "name": "z",
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "range": Array [
+ 0,
+ 46,
+ ],
+ "type": "FunctionDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 47,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 8,
+ ],
+ "type": "Keyword",
+ "value": "function",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 12,
+ ],
+ "type": "Identifier",
+ "value": "foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Identifier",
+ "value": "x",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 16,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 18,
+ ],
+ "type": "Identifier",
+ "value": "y",
+ },
+ 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": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Identifier",
+ "value": "z",
+ },
+ 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": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 23,
+ 24,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 27,
+ 33,
+ ],
+ "type": "Keyword",
+ "value": "return",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 34,
+ 35,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 35,
+ 36,
+ ],
+ "type": "Identifier",
+ "value": "x",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 36,
+ 37,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 38,
+ 39,
+ ],
+ "type": "Identifier",
+ "value": "y",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 39,
+ 40,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 41,
+ 42,
+ ],
+ "type": "Identifier",
+ "value": "z",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 42,
+ 43,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 43,
+ 44,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 45,
+ 46,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`javascript fixtures/generators/anonymous-generator.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "expression": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "expression": Object {
+ "argument": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "name": "v",
+ "range": Array [
+ 22,
+ 23,
+ ],
+ "type": "Identifier",
+ },
+ "delegate": false,
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 16,
+ 23,
+ ],
+ "type": "YieldExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 16,
+ 23,
+ ],
+ "type": "ExpressionStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 25,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": true,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 1,
+ 25,
+ ],
+ "type": "FunctionExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 27,
+ ],
+ "type": "ExpressionStatement",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 27,
+ ],
+ "sourceType": "module",
+ "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": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 1,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "function",
+ },
+ 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": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 12,
+ 13,
+ ],
+ "type": "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": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 16,
+ 21,
+ ],
+ "type": "Keyword",
+ "value": "yield",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 23,
+ ],
+ "type": "Identifier",
+ "value": "v",
+ },
+ 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,
+ ],
+ "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": ";",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`javascript fixtures/generators/async-generator-function.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "async": true,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 23,
+ 27,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": true,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 17,
+ 20,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 2,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 1,
+ 27,
+ ],
+ "type": "FunctionDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 1,
+ 28,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 1,
+ 6,
+ ],
+ "type": "Identifier",
+ "value": "async",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 7,
+ 15,
+ ],
+ "type": "Keyword",
+ "value": "function",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 16,
+ 17,
+ ],
+ "type": "Punctuator",
+ "value": "*",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 17,
+ 20,
+ ],
+ "type": "Identifier",
+ "value": "foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 21,
+ 22,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 23,
+ 24,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -105240,60 +106420,486 @@ Object {
],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 5,
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 41,
+ 64,
+ ],
+ "type": "BlockStatement",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 3,
+ },
+ },
+ "name": "house",
+ "range": Array [
+ 34,
+ 39,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 28,
+ 64,
+ ],
+ "type": "WithStatement",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 65,
+ ],
+ "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": "import",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 12,
+ ],
+ "type": "Identifier",
+ "value": "house",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 17,
+ ],
+ "type": "Identifier",
+ "value": "from",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 25,
+ ],
+ "type": "String",
+ "value": "\\"house\\"",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 26,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 28,
+ 32,
+ ],
+ "type": "Keyword",
+ "value": "with",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 33,
+ 34,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 34,
+ 39,
+ ],
+ "type": "Identifier",
+ "value": "house",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 39,
+ 40,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 41,
+ 42,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 44,
+ 51,
+ ],
+ "type": "Identifier",
+ "value": "console",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 51,
+ 52,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 52,
+ 55,
+ ],
+ "type": "Identifier",
+ "value": "log",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 55,
+ 56,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 56,
+ 60,
+ ],
+ "type": "Identifier",
+ "value": "roof",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 60,
+ 61,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 61,
+ 62,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 63,
+ 64,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`javascript fixtures/modules/export-async-named-function.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "declaration": Object {
+ "async": true,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 30,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 22,
+ 25,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
},
"start": Object {
- "column": 13,
- "line": 3,
+ "column": 7,
+ "line": 1,
},
},
+ "params": Array [],
"range": Array [
- 41,
- 64,
+ 7,
+ 30,
],
- "type": "BlockStatement",
+ "type": "FunctionDeclaration",
},
"loc": Object {
"end": Object {
- "column": 1,
- "line": 5,
+ "column": 30,
+ "line": 1,
},
"start": Object {
"column": 0,
- "line": 3,
- },
- },
- "object": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 3,
- },
- "start": Object {
- "column": 6,
- "line": 3,
- },
+ "line": 1,
},
- "name": "house",
- "range": Array [
- 34,
- 39,
- ],
- "type": "Identifier",
},
"range": Array [
- 28,
- 64,
+ 0,
+ 30,
],
- "type": "WithStatement",
+ "source": null,
+ "specifiers": Array [],
+ "type": "ExportNamedDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 6,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -105302,7 +106908,7 @@ Object {
},
"range": Array [
0,
- 65,
+ 31,
],
"sourceType": "module",
"tokens": Array [
@@ -105322,7 +106928,7 @@ Object {
6,
],
"type": "Keyword",
- "value": "import",
+ "value": "export",
},
Object {
"loc": Object {
@@ -105340,12 +106946,12 @@ Object {
12,
],
"type": "Identifier",
- "value": "house",
+ "value": "async",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 21,
"line": 1,
},
"start": Object {
@@ -105355,10 +106961,10 @@ Object {
},
"range": Array [
13,
- 17,
+ 21,
],
- "type": "Identifier",
- "value": "from",
+ "type": "Keyword",
+ "value": "function",
},
Object {
"loc": Object {
@@ -105367,16 +106973,16 @@ Object {
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 18,
+ 22,
25,
],
- "type": "String",
- "value": "\\"house\\"",
+ "type": "Identifier",
+ "value": "foo",
},
Object {
"loc": Object {
@@ -105394,256 +107000,492 @@ Object {
26,
],
"type": "Punctuator",
- "value": ";",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 3,
+ "column": 27,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 27,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
},
},
"range": Array [
28,
- 32,
+ 29,
],
- "type": "Keyword",
- "value": "with",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
- "line": 3,
+ "column": 30,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 3,
+ "column": 29,
+ "line": 1,
},
},
"range": Array [
- 33,
- 34,
+ 29,
+ 30,
],
"type": "Punctuator",
- "value": "(",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`javascript fixtures/modules/export-const.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "declaration": Object {
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 13,
+ 16,
+ ],
+ "type": "Identifier",
+ },
+ "init": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 19,
+ 20,
+ ],
+ "raw": "2",
+ "type": "Literal",
+ "value": 2,
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 20,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "kind": "const",
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 21,
+ ],
+ "type": "VariableDeclaration",
+ },
"loc": Object {
"end": Object {
- "column": 11,
- "line": 3,
+ "column": 21,
+ "line": 1,
},
"start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 21,
+ ],
+ "source": null,
+ "specifiers": Array [],
+ "type": "ExportNamedDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 22,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
"column": 6,
- "line": 3,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 34,
- 39,
+ 0,
+ 6,
],
- "type": "Identifier",
- "value": "house",
+ "type": "Keyword",
+ "value": "export",
},
Object {
"loc": Object {
"end": Object {
"column": 12,
- "line": 3,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 3,
+ "column": 7,
+ "line": 1,
},
},
"range": Array [
- 39,
- 40,
+ 7,
+ 12,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Keyword",
+ "value": "const",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 3,
+ "column": 16,
+ "line": 1,
},
"start": Object {
"column": 13,
- "line": 3,
+ "line": 1,
},
},
"range": Array [
- 41,
- 42,
+ 13,
+ 16,
+ ],
+ "type": "Identifier",
+ "value": "foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 18,
],
"type": "Punctuator",
- "value": "{",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 4,
+ "column": 20,
+ "line": 1,
},
"start": Object {
- "column": 1,
- "line": 4,
+ "column": 19,
+ "line": 1,
},
},
"range": Array [
- 44,
- 51,
+ 19,
+ 20,
],
- "type": "Identifier",
- "value": "console",
+ "type": "Numeric",
+ "value": "2",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 4,
+ "column": 21,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 4,
+ "column": 20,
+ "line": 1,
},
},
"range": Array [
- 51,
- 52,
+ 20,
+ 21,
],
"type": "Punctuator",
- "value": ".",
+ "value": ";",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`javascript fixtures/modules/export-default-array.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "declaration": Object {
+ "elements": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 17,
+ ],
+ "type": "ArrayExpression",
+ },
"loc": Object {
"end": Object {
- "column": 12,
- "line": 4,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 52,
- 55,
+ 0,
+ 18,
],
- "type": "Identifier",
- "value": "log",
+ "type": "ExportDefaultDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 19,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 4,
+ "column": 6,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 55,
- 56,
+ 0,
+ 6,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Keyword",
+ "value": "export",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 4,
+ "column": 14,
+ "line": 1,
},
"start": Object {
- "column": 13,
- "line": 4,
+ "column": 7,
+ "line": 1,
},
},
"range": Array [
- 56,
- 60,
+ 7,
+ 14,
],
- "type": "Identifier",
- "value": "roof",
+ "type": "Keyword",
+ "value": "default",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 4,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 4,
+ "column": 15,
+ "line": 1,
},
},
"range": Array [
- 60,
- 61,
+ 15,
+ 16,
],
"type": "Punctuator",
- "value": ")",
+ "value": "[",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 4,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 4,
+ "column": 16,
+ "line": 1,
},
},
"range": Array [
- 61,
- 62,
+ 16,
+ 17,
],
"type": "Punctuator",
- "value": ";",
+ "value": "]",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 5,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 5,
+ "column": 17,
+ "line": 1,
},
},
"range": Array [
- 63,
- 64,
+ 17,
+ 18,
],
"type": "Punctuator",
- "value": "}",
+ "value": ";",
},
],
"type": "Program",
}
`;
-exports[`javascript fixtures/modules/export-default-array.src 1`] = `
+exports[`javascript fixtures/modules/export-default-async-named-function.src 1`] = `
Object {
"body": Array [
Object {
"declaration": Object {
- "elements": Array [],
+ "async": true,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 36,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 36,
+ 38,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 30,
+ 33,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 38,
"line": 1,
},
"start": Object {
@@ -105651,15 +107493,16 @@ Object {
"line": 1,
},
},
+ "params": Array [],
"range": Array [
15,
- 17,
+ 38,
],
- "type": "ArrayExpression",
+ "type": "FunctionDeclaration",
},
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 38,
"line": 1,
},
"start": Object {
@@ -105669,7 +107512,7 @@ Object {
},
"range": Array [
0,
- 18,
+ 38,
],
"type": "ExportDefaultDeclaration",
},
@@ -105687,7 +107530,7 @@ Object {
},
"range": Array [
0,
- 19,
+ 39,
],
"sourceType": "module",
"tokens": Array [
@@ -105730,7 +107573,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 20,
"line": 1,
},
"start": Object {
@@ -105740,46 +107583,118 @@ Object {
},
"range": Array [
15,
- 16,
+ 20,
+ ],
+ "type": "Identifier",
+ "value": "async",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 21,
+ 29,
+ ],
+ "type": "Keyword",
+ "value": "function",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 33,
+ ],
+ "type": "Identifier",
+ "value": "foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 33,
+ 34,
],
"type": "Punctuator",
- "value": "[",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 35,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 34,
"line": 1,
},
},
"range": Array [
- 16,
- 17,
+ 34,
+ 35,
],
"type": "Punctuator",
- "value": "]",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 37,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 36,
"line": 1,
},
},
"range": Array [
- 17,
- 18,
+ 36,
+ 37,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 37,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 37,
+ 38,
+ ],
+ "type": "Punctuator",
+ "value": "}",
},
],
"type": "Program",
@@ -109518,6 +111433,233 @@ Object {
}
`;
+exports[`javascript fixtures/modules/export-let.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "declaration": Object {
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 11,
+ 14,
+ ],
+ "type": "Identifier",
+ },
+ "init": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 18,
+ ],
+ "raw": "2",
+ "type": "Literal",
+ "value": 2,
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 18,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "kind": "let",
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 19,
+ ],
+ "type": "VariableDeclaration",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 19,
+ ],
+ "source": null,
+ "specifiers": Array [],
+ "type": "ExportNamedDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 20,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 6,
+ ],
+ "type": "Keyword",
+ "value": "export",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 10,
+ ],
+ "type": "Keyword",
+ "value": "let",
+ },
+ 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": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 18,
+ ],
+ "type": "Numeric",
+ "value": "2",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 19,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
exports[`javascript fixtures/modules/export-named-as-default.src 1`] = `
Object {
"body": Array [
diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.ts.snap b/packages/parser/tests/lib/__snapshots__/jsx.ts.snap
similarity index 85%
rename from packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.ts.snap
rename to packages/parser/tests/lib/__snapshots__/jsx.ts.snap
index 8a6365ac56b6..a9b76778c344 100644
--- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.ts.snap
+++ b/packages/parser/tests/lib/__snapshots__/jsx.ts.snap
@@ -9463,6 +9463,1716 @@ Object {
}
`;
+exports[`JSX useJSXTextNode: false fixtures/tag-names-with-multi-dots-multi.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "expression": Object {
+ "children": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 2,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 16,
+ ],
+ "raw": "
+ ",
+ "type": "Literal",
+ "value": "
+ ",
+ },
+ Object {
+ "children": Array [],
+ "closingElement": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 57,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 2,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 56,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 2,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 49,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 2,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 41,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 2,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 35,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 2,
+ },
+ },
+ "name": "this",
+ "range": Array [
+ 45,
+ 49,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 41,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 36,
+ "line": 2,
+ },
+ },
+ "name": "const",
+ "range": Array [
+ 50,
+ 55,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 45,
+ 55,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 49,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 42,
+ "line": 2,
+ },
+ },
+ "name": "declare",
+ "range": Array [
+ 56,
+ 63,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 45,
+ 63,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 56,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 50,
+ "line": 2,
+ },
+ },
+ "name": "static",
+ "range": Array [
+ 64,
+ 70,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 45,
+ 70,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "range": Array [
+ 43,
+ 71,
+ ],
+ "type": "JSXClosingElement",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 57,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "openingElement": Object {
+ "attributes": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 2,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 2,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 2,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 2,
+ },
+ },
+ "name": "this",
+ "range": Array [
+ 17,
+ 21,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 2,
+ },
+ },
+ "name": "const",
+ "range": Array [
+ 22,
+ 27,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 17,
+ 27,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 2,
+ },
+ },
+ "name": "declare",
+ "range": Array [
+ 28,
+ 35,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 17,
+ 35,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 2,
+ },
+ },
+ "name": "static",
+ "range": Array [
+ 36,
+ 42,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 17,
+ 42,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "range": Array [
+ 16,
+ 43,
+ ],
+ "selfClosing": false,
+ "type": "JSXOpeningElement",
+ },
+ "range": Array [
+ 16,
+ 71,
+ ],
+ "type": "JSXElement",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 57,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 71,
+ 72,
+ ],
+ "raw": "
+",
+ "type": "Literal",
+ "value": "
+",
+ },
+ ],
+ "closingElement": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 3,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 3,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 3,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 3,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 3,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 3,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 74,
+ 75,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "name": "b",
+ "range": Array [
+ 76,
+ 77,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 74,
+ 77,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 3,
+ },
+ },
+ "name": "c",
+ "range": Array [
+ 78,
+ 79,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 74,
+ 79,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 3,
+ },
+ },
+ "name": "d",
+ "range": Array [
+ 80,
+ 81,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 74,
+ 81,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 3,
+ },
+ },
+ "name": "e",
+ "range": Array [
+ 82,
+ 83,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 74,
+ 83,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 3,
+ },
+ },
+ "name": "f",
+ "range": Array [
+ 84,
+ 85,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 74,
+ 85,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "range": Array [
+ 72,
+ 86,
+ ],
+ "type": "JSXClosingElement",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "openingElement": Object {
+ "attributes": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 2,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 1,
+ 2,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 1,
+ },
+ },
+ "name": "b",
+ "range": Array [
+ 3,
+ 4,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 1,
+ 4,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "c",
+ "range": Array [
+ 5,
+ 6,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 1,
+ 6,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "name": "d",
+ "range": Array [
+ 7,
+ 8,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 1,
+ 8,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "name": "e",
+ "range": Array [
+ 9,
+ 10,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 1,
+ 10,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "name": "f",
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 1,
+ 12,
+ ],
+ "type": "JSXMemberExpression",
+ },
+ "range": Array [
+ 0,
+ 13,
+ ],
+ "selfClosing": false,
+ "type": "JSXOpeningElement",
+ },
+ "range": Array [
+ 0,
+ 86,
+ ],
+ "type": "JSXElement",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 87,
+ ],
+ "type": "ExpressionStatement",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 88,
+ ],
+ "sourceType": "module",
+ "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": "JSXIdentifier",
+ "value": "a",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 2,
+ 3,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 3,
+ 4,
+ ],
+ "type": "JSXIdentifier",
+ "value": "b",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 4,
+ 5,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 5,
+ 6,
+ ],
+ "type": "JSXIdentifier",
+ "value": "c",
+ },
+ 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": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 8,
+ ],
+ "type": "JSXIdentifier",
+ "value": "d",
+ },
+ 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": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 10,
+ ],
+ "type": "JSXIdentifier",
+ "value": "e",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 11,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "JSXIdentifier",
+ "value": "f",
+ },
+ 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": 2,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 16,
+ ],
+ "type": "JSXText",
+ "value": "
+ ",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 16,
+ 17,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 17,
+ 21,
+ ],
+ "type": "Keyword",
+ "value": "this",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 21,
+ 22,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 22,
+ 27,
+ ],
+ "type": "Keyword",
+ "value": "const",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 27,
+ 28,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 28,
+ 35,
+ ],
+ "type": "Keyword",
+ "value": "declare",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 35,
+ 36,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 36,
+ 42,
+ ],
+ "type": "Keyword",
+ "value": "static",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 42,
+ 43,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 43,
+ 44,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 44,
+ 45,
+ ],
+ "type": "Punctuator",
+ "value": "/",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 35,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 45,
+ 49,
+ ],
+ "type": "Keyword",
+ "value": "this",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 49,
+ 50,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 41,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 36,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 50,
+ 55,
+ ],
+ "type": "Keyword",
+ "value": "const",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 55,
+ 56,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 49,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 42,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 56,
+ 63,
+ ],
+ "type": "Keyword",
+ "value": "declare",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 50,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 49,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 63,
+ 64,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 56,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 50,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 64,
+ 70,
+ ],
+ "type": "Keyword",
+ "value": "static",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 57,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 56,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 70,
+ 71,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 57,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 71,
+ 72,
+ ],
+ "type": "JSXText",
+ "value": "
+",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 72,
+ 73,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 2,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 73,
+ 74,
+ ],
+ "type": "Punctuator",
+ "value": "/",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 74,
+ 75,
+ ],
+ "type": "JSXIdentifier",
+ "value": "a",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 75,
+ 76,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 76,
+ 77,
+ ],
+ "type": "JSXIdentifier",
+ "value": "b",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 77,
+ 78,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 78,
+ 79,
+ ],
+ "type": "JSXIdentifier",
+ "value": "c",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 79,
+ 80,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 80,
+ 81,
+ ],
+ "type": "JSXIdentifier",
+ "value": "d",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 81,
+ 82,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 82,
+ 83,
+ ],
+ "type": "JSXIdentifier",
+ "value": "e",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 83,
+ 84,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 84,
+ 85,
+ ],
+ "type": "JSXIdentifier",
+ "value": "f",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 85,
+ 86,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 86,
+ 87,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
exports[`JSX useJSXTextNode: false fixtures/test-content.src 1`] = `
Object {
"body": Array [
diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.ts.snap b/packages/parser/tests/lib/__snapshots__/scope-analysis.ts.snap
similarity index 96%
rename from packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.ts.snap
rename to packages/parser/tests/lib/__snapshots__/scope-analysis.ts.snap
index 0644b066632e..39fedcb8277b 100644
--- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.ts.snap
+++ b/packages/parser/tests/lib/__snapshots__/scope-analysis.ts.snap
@@ -5225,6 +5225,56 @@ Object {
}
`;
+exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/import-keyword.ts 1`] = `
+Object {
+ "$id": 1,
+ "block": Object {
+ "range": Array [
+ 0,
+ 16,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [
+ Object {
+ "$id": 0,
+ "block": Object {
+ "range": Array [
+ 0,
+ 16,
+ ],
+ "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": false,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {},
+ "variableScope": Object {
+ "$ref": 1,
+ },
+ "variables": Array [],
+}
+`;
+
exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/interface-type.ts 1`] = `
Object {
"$id": 1,
@@ -5275,134 +5325,50 @@ Object {
}
`;
-exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/method-overload.ts 1`] = `
+exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/jsx-attributes.tsx 1`] = `
Object {
- "$id": 11,
+ "$id": 7,
"block": Object {
"range": Array [
0,
- 124,
+ 143,
],
"type": "Program",
},
"childScopes": Array [
Object {
- "$id": 10,
+ "$id": 6,
"block": Object {
"range": Array [
0,
- 124,
+ 143,
],
"type": "Program",
},
"childScopes": Array [
Object {
- "$id": 9,
+ "$id": 5,
"block": Object {
"range": Array [
- 19,
- 123,
+ 28,
+ 142,
],
- "type": "ClassDeclaration",
+ "type": "FunctionDeclaration",
},
- "childScopes": Array [
- Object {
- "$id": 8,
- "block": Object {
- "range": Array [
- 73,
- 121,
- ],
- "type": "FunctionExpression",
- },
- "childScopes": Array [],
- "functionExpressionScope": false,
- "isStrict": true,
- "references": Array [],
- "throughReferences": Array [],
- "type": "function",
- "upperScope": Object {
- "$ref": 9,
- },
- "variableMap": Object {
- "a": Object {
- "$ref": 7,
- },
- "arguments": Object {
- "$ref": 6,
- },
- },
- "variableScope": Object {
- "$ref": 8,
- },
- "variables": Array [
- Object {
- "$id": 6,
- "defs": Array [],
- "eslintUsed": undefined,
- "identifiers": Array [],
- "name": "arguments",
- "references": Array [],
- "scope": Object {
- "$ref": 8,
- },
- },
- Object {
- "$id": 7,
- "defs": Array [
- Object {
- "name": Object {
- "name": "a",
- "range": Array [
- 74,
- 81,
- ],
- "type": "Identifier",
- },
- "node": Object {
- "range": Array [
- 73,
- 121,
- ],
- "type": "FunctionExpression",
- },
- "parent": null,
- "type": "Parameter",
- },
- ],
- "eslintUsed": undefined,
- "identifiers": Array [
- Object {
- "name": "a",
- "range": Array [
- 74,
- 81,
- ],
- "type": "Identifier",
- },
- ],
- "name": "a",
- "references": Array [],
- "scope": Object {
- "$ref": 8,
- },
- },
- ],
- },
- ],
+ "childScopes": Array [],
"functionExpressionScope": false,
"isStrict": true,
"references": Array [
Object {
- "$id": 5,
+ "$id": 4,
"from": Object {
- "$ref": 9,
+ "$ref": 5,
},
"identifier": Object {
- "name": "s",
+ "name": "text",
"range": Array [
- 59,
- 60,
+ 116,
+ 120,
],
"type": "Identifier",
},
@@ -5415,60 +5381,31 @@ Object {
],
"throughReferences": Array [
Object {
- "$ref": 5,
+ "$ref": 4,
},
],
- "type": "class",
+ "type": "function",
"upperScope": Object {
- "$ref": 10,
+ "$ref": 6,
},
"variableMap": Object {
- "A": Object {
- "$ref": 4,
+ "arguments": Object {
+ "$ref": 3,
},
},
"variableScope": Object {
- "$ref": 10,
+ "$ref": 5,
},
"variables": Array [
Object {
- "$id": 4,
- "defs": Array [
- Object {
- "name": Object {
- "name": "A",
- "range": Array [
- 25,
- 26,
- ],
- "type": "Identifier",
- },
- "node": Object {
- "range": Array [
- 19,
- 123,
- ],
- "type": "ClassDeclaration",
- },
- "parent": undefined,
- "type": "ClassName",
- },
- ],
+ "$id": 3,
+ "defs": Array [],
"eslintUsed": undefined,
- "identifiers": Array [
- Object {
- "name": "A",
- "range": Array [
- 25,
- 26,
- ],
- "type": "Identifier",
- },
- ],
- "name": "A",
+ "identifiers": Array [],
+ "name": "arguments",
"references": Array [],
"scope": Object {
- "$ref": 9,
+ "$ref": 5,
},
},
],
@@ -5480,13 +5417,13 @@ Object {
Object {
"$id": 2,
"from": Object {
- "$ref": 10,
+ "$ref": 6,
},
"identifier": Object {
- "name": "s",
+ "name": "text",
"range": Array [
6,
- 7,
+ 10,
],
"type": "Identifier",
},
@@ -5496,49 +5433,28 @@ Object {
},
"writeExpr": Object {
"range": Array [
- 10,
- 18,
- ],
- "type": "CallExpression",
- },
- },
- Object {
- "$id": 3,
- "from": Object {
- "$ref": 10,
- },
- "identifier": Object {
- "name": "Symbol",
- "range": Array [
- 10,
- 16,
+ 13,
+ 19,
],
- "type": "Identifier",
+ "type": "Literal",
},
- "kind": "r",
- "resolved": null,
- "writeExpr": undefined,
- },
- ],
- "throughReferences": Array [
- Object {
- "$ref": 3,
},
],
+ "throughReferences": Array [],
"type": "module",
"upperScope": Object {
- "$ref": 11,
+ "$ref": 7,
},
"variableMap": Object {
- "A": Object {
+ "Foo": Object {
"$ref": 1,
},
- "s": Object {
+ "text": Object {
"$ref": 0,
},
},
"variableScope": Object {
- "$ref": 10,
+ "$ref": 6,
},
"variables": Array [
Object {
@@ -5546,24 +5462,24 @@ Object {
"defs": Array [
Object {
"name": Object {
- "name": "s",
+ "name": "text",
"range": Array [
6,
- 7,
+ 10,
],
"type": "Identifier",
},
"node": Object {
"range": Array [
6,
- 18,
+ 19,
],
"type": "VariableDeclarator",
},
"parent": Object {
"range": Array [
0,
- 18,
+ 20,
],
"type": "VariableDeclaration",
},
@@ -5573,25 +5489,25 @@ Object {
"eslintUsed": undefined,
"identifiers": Array [
Object {
- "name": "s",
+ "name": "text",
"range": Array [
6,
- 7,
+ 10,
],
"type": "Identifier",
},
],
- "name": "s",
+ "name": "text",
"references": Array [
Object {
"$ref": 2,
},
Object {
- "$ref": 5,
+ "$ref": 4,
},
],
"scope": Object {
- "$ref": 10,
+ "$ref": 6,
},
},
Object {
@@ -5599,39 +5515,39 @@ Object {
"defs": Array [
Object {
"name": Object {
- "name": "A",
+ "name": "Foo",
"range": Array [
- 25,
- 26,
+ 37,
+ 40,
],
"type": "Identifier",
},
"node": Object {
"range": Array [
- 19,
- 123,
+ 28,
+ 142,
],
- "type": "ClassDeclaration",
+ "type": "FunctionDeclaration",
},
"parent": null,
- "type": "ClassName",
+ "type": "FunctionName",
},
],
"eslintUsed": undefined,
"identifiers": Array [
Object {
- "name": "A",
+ "name": "Foo",
"range": Array [
- 25,
- 26,
+ 37,
+ 40,
],
"type": "Identifier",
},
],
- "name": "A",
+ "name": "Foo",
"references": Array [],
"scope": Object {
- "$ref": 10,
+ "$ref": 6,
},
},
],
@@ -5640,165 +5556,211 @@ Object {
"functionExpressionScope": false,
"isStrict": false,
"references": Array [],
- "throughReferences": Array [
- Object {
- "$ref": 3,
- },
- ],
+ "throughReferences": Array [],
"type": "global",
"upperScope": null,
"variableMap": Object {},
"variableScope": Object {
- "$ref": 11,
+ "$ref": 7,
},
"variables": Array [],
}
`;
-exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/namespace.ts 1`] = `
+exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/method-overload.ts 1`] = `
Object {
- "$id": 10,
+ "$id": 11,
"block": Object {
"range": Array [
0,
- 63,
+ 124,
],
"type": "Program",
},
"childScopes": Array [
Object {
- "$id": 9,
+ "$id": 10,
"block": Object {
"range": Array [
0,
- 63,
+ 124,
],
"type": "Program",
},
"childScopes": Array [
Object {
- "$id": 8,
+ "$id": 9,
"block": Object {
"range": Array [
- 24,
- 56,
+ 19,
+ 123,
],
- "type": "TSModuleBlock",
+ "type": "ClassDeclaration",
},
- "childScopes": Array [],
- "functionExpressionScope": false,
- "isStrict": true,
- "references": Array [
+ "childScopes": Array [
Object {
- "$id": 6,
- "from": Object {
- "$ref": 8,
- },
- "identifier": Object {
- "name": "a",
+ "$id": 8,
+ "block": Object {
"range": Array [
- 43,
- 44,
+ 73,
+ 121,
],
- "type": "Identifier",
+ "type": "FunctionExpression",
},
- "kind": "w",
- "resolved": Object {
- "$ref": 5,
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": true,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "function",
+ "upperScope": Object {
+ "$ref": 9,
},
- "writeExpr": Object {
- "range": Array [
- 47,
- 48,
- ],
- "type": "Literal",
+ "variableMap": Object {
+ "a": Object {
+ "$ref": 7,
+ },
+ "arguments": Object {
+ "$ref": 6,
+ },
+ },
+ "variableScope": Object {
+ "$ref": 8,
},
+ "variables": Array [
+ Object {
+ "$id": 6,
+ "defs": Array [],
+ "eslintUsed": undefined,
+ "identifiers": Array [],
+ "name": "arguments",
+ "references": Array [],
+ "scope": Object {
+ "$ref": 8,
+ },
+ },
+ Object {
+ "$id": 7,
+ "defs": Array [
+ Object {
+ "name": Object {
+ "name": "a",
+ "range": Array [
+ 74,
+ 81,
+ ],
+ "type": "Identifier",
+ },
+ "node": Object {
+ "range": Array [
+ 73,
+ 121,
+ ],
+ "type": "FunctionExpression",
+ },
+ "parent": null,
+ "type": "Parameter",
+ },
+ ],
+ "eslintUsed": undefined,
+ "identifiers": Array [
+ Object {
+ "name": "a",
+ "range": Array [
+ 74,
+ 81,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "name": "a",
+ "references": Array [],
+ "scope": Object {
+ "$ref": 8,
+ },
+ },
+ ],
},
+ ],
+ "functionExpressionScope": false,
+ "isStrict": true,
+ "references": Array [
Object {
- "$id": 7,
+ "$id": 5,
"from": Object {
- "$ref": 8,
+ "$ref": 9,
},
"identifier": Object {
- "name": "a",
+ "name": "s",
"range": Array [
- 53,
- 54,
+ 59,
+ 60,
],
"type": "Identifier",
},
"kind": "r",
"resolved": Object {
- "$ref": 5,
+ "$ref": 0,
},
"writeExpr": undefined,
},
],
- "throughReferences": Array [],
- "type": "block",
+ "throughReferences": Array [
+ Object {
+ "$ref": 5,
+ },
+ ],
+ "type": "class",
"upperScope": Object {
- "$ref": 9,
+ "$ref": 10,
},
"variableMap": Object {
- "a": Object {
- "$ref": 5,
+ "A": Object {
+ "$ref": 4,
},
},
"variableScope": Object {
- "$ref": 9,
+ "$ref": 10,
},
"variables": Array [
Object {
- "$id": 5,
+ "$id": 4,
"defs": Array [
Object {
"name": Object {
- "name": "a",
+ "name": "A",
"range": Array [
- 43,
- 44,
+ 25,
+ 26,
],
"type": "Identifier",
},
"node": Object {
"range": Array [
- 43,
- 48,
- ],
- "type": "VariableDeclarator",
- },
- "parent": Object {
- "range": Array [
- 37,
- 48,
+ 19,
+ 123,
],
- "type": "VariableDeclaration",
+ "type": "ClassDeclaration",
},
- "type": "Variable",
+ "parent": undefined,
+ "type": "ClassName",
},
],
"eslintUsed": undefined,
"identifiers": Array [
Object {
- "name": "a",
+ "name": "A",
"range": Array [
- 43,
- 44,
+ 25,
+ 26,
],
"type": "Identifier",
},
],
- "name": "a",
- "references": Array [
- Object {
- "$ref": 6,
- },
- Object {
- "$ref": 7,
- },
- ],
+ "name": "A",
+ "references": Array [],
"scope": Object {
- "$ref": 8,
+ "$ref": 9,
},
},
],
@@ -5810,10 +5772,10 @@ Object {
Object {
"$id": 2,
"from": Object {
- "$ref": 9,
+ "$ref": 10,
},
"identifier": Object {
- "name": "a",
+ "name": "s",
"range": Array [
6,
7,
@@ -5827,65 +5789,48 @@ Object {
"writeExpr": Object {
"range": Array [
10,
- 11,
+ 18,
],
- "type": "Literal",
+ "type": "CallExpression",
},
},
Object {
"$id": 3,
"from": Object {
- "$ref": 9,
+ "$ref": 10,
},
"identifier": Object {
- "name": "a",
+ "name": "Symbol",
"range": Array [
- 57,
- 58,
+ 10,
+ 16,
],
"type": "Identifier",
},
"kind": "r",
- "resolved": Object {
- "$ref": 0,
- },
+ "resolved": null,
"writeExpr": undefined,
},
+ ],
+ "throughReferences": Array [
Object {
- "$id": 4,
- "from": Object {
- "$ref": 9,
- },
- "identifier": Object {
- "name": "N",
- "range": Array [
- 59,
- 60,
- ],
- "type": "Identifier",
- },
- "kind": "r",
- "resolved": Object {
- "$ref": 1,
- },
- "writeExpr": undefined,
+ "$ref": 3,
},
],
- "throughReferences": Array [],
"type": "module",
"upperScope": Object {
- "$ref": 10,
+ "$ref": 11,
},
"variableMap": Object {
- "N": Object {
+ "A": Object {
"$ref": 1,
},
- "a": Object {
+ "s": Object {
"$ref": 0,
},
},
"variableScope": Object {
- "$ref": 9,
+ "$ref": 10,
},
"variables": Array [
Object {
@@ -5893,7 +5838,7 @@ Object {
"defs": Array [
Object {
"name": Object {
- "name": "a",
+ "name": "s",
"range": Array [
6,
7,
@@ -5903,14 +5848,14 @@ Object {
"node": Object {
"range": Array [
6,
- 11,
+ 18,
],
"type": "VariableDeclarator",
},
"parent": Object {
"range": Array [
0,
- 11,
+ 18,
],
"type": "VariableDeclaration",
},
@@ -5920,7 +5865,7 @@ Object {
"eslintUsed": undefined,
"identifiers": Array [
Object {
- "name": "a",
+ "name": "s",
"range": Array [
6,
7,
@@ -5928,17 +5873,17 @@ Object {
"type": "Identifier",
},
],
- "name": "a",
+ "name": "s",
"references": Array [
Object {
"$ref": 2,
},
Object {
- "$ref": 3,
+ "$ref": 5,
},
],
"scope": Object {
- "$ref": 9,
+ "$ref": 10,
},
},
Object {
@@ -5946,43 +5891,39 @@ Object {
"defs": Array [
Object {
"name": Object {
- "name": "N",
+ "name": "A",
"range": Array [
- 22,
- 23,
+ 25,
+ 26,
],
"type": "Identifier",
},
"node": Object {
"range": Array [
- 12,
- 56,
+ 19,
+ 123,
],
- "type": "TSModuleDeclaration",
+ "type": "ClassDeclaration",
},
"parent": null,
- "type": "NamespaceName",
+ "type": "ClassName",
},
],
"eslintUsed": undefined,
"identifiers": Array [
Object {
- "name": "N",
+ "name": "A",
"range": Array [
- 22,
- 23,
+ 25,
+ 26,
],
"type": "Identifier",
},
],
- "name": "N",
- "references": Array [
- Object {
- "$ref": 4,
- },
- ],
+ "name": "A",
+ "references": Array [],
"scope": Object {
- "$ref": 9,
+ "$ref": 10,
},
},
],
@@ -5991,117 +5932,165 @@ Object {
"functionExpressionScope": false,
"isStrict": false,
"references": Array [],
- "throughReferences": Array [],
+ "throughReferences": Array [
+ Object {
+ "$ref": 3,
+ },
+ ],
"type": "global",
"upperScope": null,
"variableMap": Object {},
"variableScope": Object {
- "$ref": 10,
+ "$ref": 11,
},
"variables": Array [],
}
`;
-exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/rest-element.ts 1`] = `
+exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/namespace.ts 1`] = `
Object {
- "$id": 5,
+ "$id": 10,
"block": Object {
"range": Array [
0,
- 35,
+ 63,
],
"type": "Program",
},
"childScopes": Array [
Object {
- "$id": 4,
+ "$id": 9,
"block": Object {
"range": Array [
0,
- 35,
+ 63,
],
"type": "Program",
},
"childScopes": Array [
Object {
- "$id": 3,
+ "$id": 8,
"block": Object {
"range": Array [
- 0,
- 34,
+ 24,
+ 56,
],
- "type": "FunctionDeclaration",
+ "type": "TSModuleBlock",
},
"childScopes": Array [],
"functionExpressionScope": false,
"isStrict": true,
- "references": Array [],
+ "references": Array [
+ Object {
+ "$id": 6,
+ "from": Object {
+ "$ref": 8,
+ },
+ "identifier": Object {
+ "name": "a",
+ "range": Array [
+ 43,
+ 44,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "w",
+ "resolved": Object {
+ "$ref": 5,
+ },
+ "writeExpr": Object {
+ "range": Array [
+ 47,
+ 48,
+ ],
+ "type": "Literal",
+ },
+ },
+ Object {
+ "$id": 7,
+ "from": Object {
+ "$ref": 8,
+ },
+ "identifier": Object {
+ "name": "a",
+ "range": Array [
+ 53,
+ 54,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "r",
+ "resolved": Object {
+ "$ref": 5,
+ },
+ "writeExpr": undefined,
+ },
+ ],
"throughReferences": Array [],
- "type": "function",
+ "type": "block",
"upperScope": Object {
- "$ref": 4,
+ "$ref": 9,
},
"variableMap": Object {
- "args": Object {
- "$ref": 2,
- },
- "arguments": Object {
- "$ref": 1,
+ "a": Object {
+ "$ref": 5,
},
},
"variableScope": Object {
- "$ref": 3,
+ "$ref": 9,
},
"variables": Array [
Object {
- "$id": 1,
- "defs": Array [],
- "eslintUsed": undefined,
- "identifiers": Array [],
- "name": "arguments",
- "references": Array [],
- "scope": Object {
- "$ref": 3,
- },
- },
- Object {
- "$id": 2,
+ "$id": 5,
"defs": Array [
Object {
"name": Object {
- "name": "args",
+ "name": "a",
"range": Array [
- 16,
- 20,
+ 43,
+ 44,
],
"type": "Identifier",
},
"node": Object {
"range": Array [
- 0,
- 34,
+ 43,
+ 48,
],
- "type": "FunctionDeclaration",
+ "type": "VariableDeclarator",
},
- "parent": null,
- "type": "Parameter",
+ "parent": Object {
+ "range": Array [
+ 37,
+ 48,
+ ],
+ "type": "VariableDeclaration",
+ },
+ "type": "Variable",
},
],
"eslintUsed": undefined,
"identifiers": Array [
Object {
- "name": "args",
+ "name": "a",
"range": Array [
- 16,
- 20,
+ 43,
+ 44,
],
"type": "Identifier",
},
],
- "name": "args",
- "references": Array [],
+ "name": "a",
+ "references": Array [
+ Object {
+ "$ref": 6,
+ },
+ Object {
+ "$ref": 7,
+ },
+ ],
"scope": Object {
- "$ref": 3,
+ "$ref": 8,
},
},
],
@@ -6109,59 +6098,183 @@ Object {
],
"functionExpressionScope": false,
"isStrict": true,
- "references": Array [],
- "throughReferences": Array [],
- "type": "module",
- "upperScope": Object {
- "$ref": 5,
- },
- "variableMap": Object {
- "foo": Object {
- "$ref": 0,
+ "references": Array [
+ Object {
+ "$id": 2,
+ "from": Object {
+ "$ref": 9,
+ },
+ "identifier": Object {
+ "name": "a",
+ "range": Array [
+ 6,
+ 7,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "w",
+ "resolved": Object {
+ "$ref": 0,
+ },
+ "writeExpr": Object {
+ "range": Array [
+ 10,
+ 11,
+ ],
+ "type": "Literal",
+ },
},
- },
- "variableScope": Object {
- "$ref": 4,
- },
- "variables": Array [
Object {
- "$id": 0,
- "defs": Array [
- Object {
- "name": Object {
- "name": "foo",
- "range": Array [
- 9,
- 12,
- ],
- "type": "Identifier",
- },
+ "$id": 3,
+ "from": Object {
+ "$ref": 9,
+ },
+ "identifier": Object {
+ "name": "a",
+ "range": Array [
+ 57,
+ 58,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "r",
+ "resolved": Object {
+ "$ref": 0,
+ },
+ "writeExpr": undefined,
+ },
+ Object {
+ "$id": 4,
+ "from": Object {
+ "$ref": 9,
+ },
+ "identifier": Object {
+ "name": "N",
+ "range": Array [
+ 59,
+ 60,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "r",
+ "resolved": Object {
+ "$ref": 1,
+ },
+ "writeExpr": undefined,
+ },
+ ],
+ "throughReferences": Array [],
+ "type": "module",
+ "upperScope": Object {
+ "$ref": 10,
+ },
+ "variableMap": Object {
+ "N": Object {
+ "$ref": 1,
+ },
+ "a": Object {
+ "$ref": 0,
+ },
+ },
+ "variableScope": Object {
+ "$ref": 9,
+ },
+ "variables": Array [
+ Object {
+ "$id": 0,
+ "defs": Array [
+ Object {
+ "name": Object {
+ "name": "a",
+ "range": Array [
+ 6,
+ 7,
+ ],
+ "type": "Identifier",
+ },
"node": Object {
+ "range": Array [
+ 6,
+ 11,
+ ],
+ "type": "VariableDeclarator",
+ },
+ "parent": Object {
"range": Array [
0,
- 34,
+ 11,
],
- "type": "FunctionDeclaration",
+ "type": "VariableDeclaration",
+ },
+ "type": "Variable",
+ },
+ ],
+ "eslintUsed": undefined,
+ "identifiers": Array [
+ Object {
+ "name": "a",
+ "range": Array [
+ 6,
+ 7,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "name": "a",
+ "references": Array [
+ Object {
+ "$ref": 2,
+ },
+ Object {
+ "$ref": 3,
+ },
+ ],
+ "scope": Object {
+ "$ref": 9,
+ },
+ },
+ Object {
+ "$id": 1,
+ "defs": Array [
+ Object {
+ "name": Object {
+ "name": "N",
+ "range": Array [
+ 22,
+ 23,
+ ],
+ "type": "Identifier",
+ },
+ "node": Object {
+ "range": Array [
+ 12,
+ 56,
+ ],
+ "type": "TSModuleDeclaration",
},
"parent": null,
- "type": "FunctionName",
+ "type": "NamespaceName",
},
],
"eslintUsed": undefined,
"identifiers": Array [
Object {
- "name": "foo",
+ "name": "N",
"range": Array [
- 9,
- 12,
+ 22,
+ 23,
],
"type": "Identifier",
},
],
- "name": "foo",
- "references": Array [],
+ "name": "N",
+ "references": Array [
+ Object {
+ "$ref": 4,
+ },
+ ],
"scope": Object {
- "$ref": 4,
+ "$ref": 9,
},
},
],
@@ -6175,110 +6288,289 @@ Object {
"upperScope": null,
"variableMap": Object {},
"variableScope": Object {
- "$ref": 5,
- },
- "variables": Array [],
-}
-`;
-
-exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-alias.ts 1`] = `
-Object {
- "$id": 1,
- "block": Object {
- "range": Array [
- 0,
- 18,
- ],
- "type": "Program",
- },
- "childScopes": Array [
- Object {
- "$id": 0,
- "block": Object {
- "range": Array [
- 0,
- 18,
- ],
- "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": false,
- "references": Array [],
- "throughReferences": Array [],
- "type": "global",
- "upperScope": null,
- "variableMap": Object {},
- "variableScope": Object {
- "$ref": 1,
+ "$ref": 10,
},
"variables": Array [],
}
`;
-exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-annotations.ts 1`] = `
+exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/rest-element.ts 1`] = `
Object {
- "$id": 8,
+ "$id": 5,
"block": Object {
"range": Array [
0,
- 103,
+ 35,
],
"type": "Program",
},
"childScopes": Array [
Object {
- "$id": 7,
+ "$id": 4,
"block": Object {
"range": Array [
0,
- 103,
+ 35,
],
"type": "Program",
},
"childScopes": Array [
Object {
- "$id": 6,
+ "$id": 3,
"block": Object {
"range": Array [
- 32,
- 102,
+ 0,
+ 34,
],
- "type": "ClassDeclaration",
+ "type": "FunctionDeclaration",
},
- "childScopes": Array [
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": true,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "function",
+ "upperScope": Object {
+ "$ref": 4,
+ },
+ "variableMap": Object {
+ "args": Object {
+ "$ref": 2,
+ },
+ "arguments": Object {
+ "$ref": 1,
+ },
+ },
+ "variableScope": Object {
+ "$ref": 3,
+ },
+ "variables": Array [
Object {
- "$id": 5,
- "block": Object {
- "range": Array [
- 47,
- 100,
- ],
- "type": "FunctionExpression",
- },
- "childScopes": Array [],
- "functionExpressionScope": false,
- "isStrict": true,
+ "$id": 1,
+ "defs": Array [],
+ "eslintUsed": undefined,
+ "identifiers": Array [],
+ "name": "arguments",
"references": Array [],
- "throughReferences": Array [],
- "type": "function",
- "upperScope": Object {
- "$ref": 6,
+ "scope": Object {
+ "$ref": 3,
+ },
+ },
+ Object {
+ "$id": 2,
+ "defs": Array [
+ Object {
+ "name": Object {
+ "name": "args",
+ "range": Array [
+ 16,
+ 20,
+ ],
+ "type": "Identifier",
+ },
+ "node": Object {
+ "range": Array [
+ 0,
+ 34,
+ ],
+ "type": "FunctionDeclaration",
+ },
+ "parent": null,
+ "type": "Parameter",
+ },
+ ],
+ "eslintUsed": undefined,
+ "identifiers": Array [
+ Object {
+ "name": "args",
+ "range": Array [
+ 16,
+ 20,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "name": "args",
+ "references": Array [],
+ "scope": Object {
+ "$ref": 3,
+ },
+ },
+ ],
+ },
+ ],
+ "functionExpressionScope": false,
+ "isStrict": true,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "module",
+ "upperScope": Object {
+ "$ref": 5,
+ },
+ "variableMap": Object {
+ "foo": Object {
+ "$ref": 0,
+ },
+ },
+ "variableScope": Object {
+ "$ref": 4,
+ },
+ "variables": Array [
+ Object {
+ "$id": 0,
+ "defs": Array [
+ Object {
+ "name": Object {
+ "name": "foo",
+ "range": Array [
+ 9,
+ 12,
+ ],
+ "type": "Identifier",
+ },
+ "node": Object {
+ "range": Array [
+ 0,
+ 34,
+ ],
+ "type": "FunctionDeclaration",
+ },
+ "parent": null,
+ "type": "FunctionName",
+ },
+ ],
+ "eslintUsed": undefined,
+ "identifiers": Array [
+ Object {
+ "name": "foo",
+ "range": Array [
+ 9,
+ 12,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "name": "foo",
+ "references": Array [],
+ "scope": Object {
+ "$ref": 4,
+ },
+ },
+ ],
+ },
+ ],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {},
+ "variableScope": Object {
+ "$ref": 5,
+ },
+ "variables": Array [],
+}
+`;
+
+exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-alias.ts 1`] = `
+Object {
+ "$id": 1,
+ "block": Object {
+ "range": Array [
+ 0,
+ 18,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [
+ Object {
+ "$id": 0,
+ "block": Object {
+ "range": Array [
+ 0,
+ 18,
+ ],
+ "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": false,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {},
+ "variableScope": Object {
+ "$ref": 1,
+ },
+ "variables": Array [],
+}
+`;
+
+exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-annotations.ts 1`] = `
+Object {
+ "$id": 8,
+ "block": Object {
+ "range": Array [
+ 0,
+ 103,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [
+ Object {
+ "$id": 7,
+ "block": Object {
+ "range": Array [
+ 0,
+ 103,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [
+ Object {
+ "$id": 6,
+ "block": Object {
+ "range": Array [
+ 32,
+ 102,
+ ],
+ "type": "ClassDeclaration",
+ },
+ "childScopes": Array [
+ Object {
+ "$id": 5,
+ "block": Object {
+ "range": Array [
+ 47,
+ 100,
+ ],
+ "type": "FunctionExpression",
+ },
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": true,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "function",
+ "upperScope": Object {
+ "$ref": 6,
},
"variableMap": Object {
"a": Object {
@@ -6822,23 +7114,23 @@ Object {
}
`;
-exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof.ts 1`] = `
+exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typed-jsx-element.tsx 1`] = `
Object {
- "$id": 4,
+ "$id": 3,
"block": Object {
"range": Array [
0,
- 43,
+ 39,
],
"type": "Program",
},
"childScopes": Array [
Object {
- "$id": 3,
+ "$id": 2,
"block": Object {
"range": Array [
0,
- 43,
+ 39,
],
"type": "Program",
},
@@ -6849,12 +7141,12 @@ Object {
Object {
"$id": 1,
"from": Object {
- "$ref": 3,
+ "$ref": 2,
},
"identifier": Object {
- "name": "obj",
+ "name": "a",
"range": Array [
- 4,
+ 6,
7,
],
"type": "Identifier",
@@ -6866,38 +7158,169 @@ Object {
"writeExpr": Object {
"range": Array [
10,
- 22,
- ],
- "type": "ObjectExpression",
- },
- },
- Object {
- "$id": 2,
- "from": Object {
- "$ref": 3,
- },
- "identifier": Object {
- "name": "obj",
- "range": Array [
- 39,
- 42,
+ 37,
],
- "type": "Identifier",
+ "type": "JSXElement",
},
- "kind": "r",
- "resolved": Object {
- "$ref": 0,
- },
- "writeExpr": undefined,
},
],
"throughReferences": Array [],
"type": "module",
"upperScope": Object {
- "$ref": 4,
+ "$ref": 3,
},
"variableMap": Object {
- "obj": Object {
+ "a": Object {
+ "$ref": 0,
+ },
+ },
+ "variableScope": Object {
+ "$ref": 2,
+ },
+ "variables": Array [
+ Object {
+ "$id": 0,
+ "defs": Array [
+ Object {
+ "name": Object {
+ "name": "a",
+ "range": Array [
+ 6,
+ 7,
+ ],
+ "type": "Identifier",
+ },
+ "node": Object {
+ "range": Array [
+ 6,
+ 37,
+ ],
+ "type": "VariableDeclarator",
+ },
+ "parent": Object {
+ "range": Array [
+ 0,
+ 38,
+ ],
+ "type": "VariableDeclaration",
+ },
+ "type": "Variable",
+ },
+ ],
+ "eslintUsed": undefined,
+ "identifiers": Array [
+ Object {
+ "name": "a",
+ "range": Array [
+ 6,
+ 7,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "name": "a",
+ "references": Array [
+ Object {
+ "$ref": 1,
+ },
+ ],
+ "scope": Object {
+ "$ref": 2,
+ },
+ },
+ ],
+ },
+ ],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {},
+ "variableScope": Object {
+ "$ref": 3,
+ },
+ "variables": Array [],
+}
+`;
+
+exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof.ts 1`] = `
+Object {
+ "$id": 4,
+ "block": Object {
+ "range": Array [
+ 0,
+ 43,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [
+ Object {
+ "$id": 3,
+ "block": Object {
+ "range": Array [
+ 0,
+ 43,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": true,
+ "references": Array [
+ Object {
+ "$id": 1,
+ "from": Object {
+ "$ref": 3,
+ },
+ "identifier": Object {
+ "name": "obj",
+ "range": Array [
+ 4,
+ 7,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "w",
+ "resolved": Object {
+ "$ref": 0,
+ },
+ "writeExpr": Object {
+ "range": Array [
+ 10,
+ 22,
+ ],
+ "type": "ObjectExpression",
+ },
+ },
+ Object {
+ "$id": 2,
+ "from": Object {
+ "$ref": 3,
+ },
+ "identifier": Object {
+ "name": "obj",
+ "range": Array [
+ 39,
+ 42,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "r",
+ "resolved": Object {
+ "$ref": 0,
+ },
+ "writeExpr": undefined,
+ },
+ ],
+ "throughReferences": Array [],
+ "type": "module",
+ "upperScope": Object {
+ "$ref": 4,
+ },
+ "variableMap": Object {
+ "obj": Object {
"$ref": 0,
},
},
@@ -15246,33 +15669,323 @@ Object {
},
},
],
-}
-`;
-
-exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = `
-Object {
- "$id": 1,
- "block": Object {
- "range": Array [
- 0,
- 115,
- ],
- "type": "Program",
- },
- "childScopes": Array [],
- "functionExpressionScope": false,
- "isStrict": false,
- "references": Array [],
+}
+`;
+
+exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = `
+Object {
+ "$id": 1,
+ "block": Object {
+ "range": Array [
+ 0,
+ 115,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {
+ "a": Object {
+ "$ref": 0,
+ },
+ },
+ "variableScope": Object {
+ "$ref": 1,
+ },
+ "variables": Array [
+ Object {
+ "$id": 0,
+ "defs": Array [
+ Object {
+ "name": Object {
+ "name": "a",
+ "range": Array [
+ 110,
+ 114,
+ ],
+ "type": "Identifier",
+ },
+ "node": Object {
+ "range": Array [
+ 110,
+ 114,
+ ],
+ "type": "VariableDeclarator",
+ },
+ "parent": Object {
+ "range": Array [
+ 106,
+ 114,
+ ],
+ "type": "VariableDeclaration",
+ },
+ "type": "Variable",
+ },
+ ],
+ "eslintUsed": undefined,
+ "identifiers": Array [
+ Object {
+ "name": "a",
+ "range": Array [
+ 110,
+ 114,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "name": "a",
+ "references": Array [],
+ "scope": Object {
+ "$ref": 1,
+ },
+ },
+ ],
+}
+`;
+
+exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/import-equals.ts 1`] = `
+Object {
+ "$id": 1,
+ "block": Object {
+ "range": Array [
+ 0,
+ 28,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {
+ "foo": Object {
+ "$ref": 0,
+ },
+ },
+ "variableScope": Object {
+ "$ref": 1,
+ },
+ "variables": Array [
+ Object {
+ "$id": 0,
+ "defs": Array [
+ Object {
+ "name": Object {
+ "name": "foo",
+ "range": Array [
+ 7,
+ 10,
+ ],
+ "type": "Identifier",
+ },
+ "node": Object {
+ "range": Array [
+ 0,
+ 27,
+ ],
+ "type": "TSImportEqualsDeclaration",
+ },
+ "parent": null,
+ "type": "ImportBinding",
+ },
+ ],
+ "eslintUsed": undefined,
+ "identifiers": Array [
+ Object {
+ "name": "foo",
+ "range": Array [
+ 7,
+ 10,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "name": "foo",
+ "references": Array [],
+ "scope": Object {
+ "$ref": 1,
+ },
+ },
+ ],
+}
+`;
+
+exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/import-keyword.ts 1`] = `
+Object {
+ "$id": 0,
+ "block": Object {
+ "range": Array [
+ 0,
+ 16,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {},
+ "variableScope": Object {
+ "$ref": 0,
+ },
+ "variables": Array [],
+}
+`;
+
+exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/interface-type.ts 1`] = `
+Object {
+ "$id": 0,
+ "block": Object {
+ "range": Array [
+ 0,
+ 67,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {},
+ "variableScope": Object {
+ "$ref": 0,
+ },
+ "variables": Array [],
+}
+`;
+
+exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/jsx-attributes.tsx 1`] = `
+Object {
+ "$id": 6,
+ "block": Object {
+ "range": Array [
+ 0,
+ 143,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [
+ Object {
+ "$id": 5,
+ "block": Object {
+ "range": Array [
+ 28,
+ 142,
+ ],
+ "type": "FunctionDeclaration",
+ },
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [
+ Object {
+ "$id": 4,
+ "from": Object {
+ "$ref": 5,
+ },
+ "identifier": Object {
+ "name": "text",
+ "range": Array [
+ 116,
+ 120,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "r",
+ "resolved": Object {
+ "$ref": 0,
+ },
+ "writeExpr": undefined,
+ },
+ ],
+ "throughReferences": Array [
+ Object {
+ "$ref": 4,
+ },
+ ],
+ "type": "function",
+ "upperScope": Object {
+ "$ref": 6,
+ },
+ "variableMap": Object {
+ "arguments": Object {
+ "$ref": 3,
+ },
+ },
+ "variableScope": Object {
+ "$ref": 5,
+ },
+ "variables": Array [
+ Object {
+ "$id": 3,
+ "defs": Array [],
+ "eslintUsed": undefined,
+ "identifiers": Array [],
+ "name": "arguments",
+ "references": Array [],
+ "scope": Object {
+ "$ref": 5,
+ },
+ },
+ ],
+ },
+ ],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [
+ Object {
+ "$id": 2,
+ "from": Object {
+ "$ref": 6,
+ },
+ "identifier": Object {
+ "name": "text",
+ "range": Array [
+ 6,
+ 10,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "w",
+ "resolved": Object {
+ "$ref": 0,
+ },
+ "writeExpr": Object {
+ "range": Array [
+ 13,
+ 19,
+ ],
+ "type": "Literal",
+ },
+ },
+ ],
"throughReferences": Array [],
"type": "global",
"upperScope": null,
"variableMap": Object {
- "a": Object {
+ "Foo": Object {
+ "$ref": 1,
+ },
+ "text": Object {
"$ref": 0,
},
},
"variableScope": Object {
- "$ref": 1,
+ "$ref": 6,
},
"variables": Array [
Object {
@@ -15280,24 +15993,24 @@ Object {
"defs": Array [
Object {
"name": Object {
- "name": "a",
+ "name": "text",
"range": Array [
- 110,
- 114,
+ 6,
+ 10,
],
"type": "Identifier",
},
"node": Object {
"range": Array [
- 110,
- 114,
+ 6,
+ 19,
],
"type": "VariableDeclarator",
},
"parent": Object {
"range": Array [
- 106,
- 114,
+ 0,
+ 20,
],
"type": "VariableDeclaration",
},
@@ -15307,119 +16020,71 @@ Object {
"eslintUsed": undefined,
"identifiers": Array [
Object {
- "name": "a",
+ "name": "text",
"range": Array [
- 110,
- 114,
+ 6,
+ 10,
],
"type": "Identifier",
},
],
- "name": "a",
- "references": Array [],
+ "name": "text",
+ "references": Array [
+ Object {
+ "$ref": 2,
+ },
+ Object {
+ "$ref": 4,
+ },
+ ],
"scope": Object {
- "$ref": 1,
+ "$ref": 6,
},
},
- ],
-}
-`;
-
-exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/import-equals.ts 1`] = `
-Object {
- "$id": 1,
- "block": Object {
- "range": Array [
- 0,
- 28,
- ],
- "type": "Program",
- },
- "childScopes": Array [],
- "functionExpressionScope": false,
- "isStrict": false,
- "references": Array [],
- "throughReferences": Array [],
- "type": "global",
- "upperScope": null,
- "variableMap": Object {
- "foo": Object {
- "$ref": 0,
- },
- },
- "variableScope": Object {
- "$ref": 1,
- },
- "variables": Array [
Object {
- "$id": 0,
+ "$id": 1,
"defs": Array [
Object {
"name": Object {
- "name": "foo",
+ "name": "Foo",
"range": Array [
- 7,
- 10,
+ 37,
+ 40,
],
"type": "Identifier",
},
"node": Object {
"range": Array [
- 0,
- 27,
+ 28,
+ 142,
],
- "type": "TSImportEqualsDeclaration",
+ "type": "FunctionDeclaration",
},
"parent": null,
- "type": "ImportBinding",
+ "type": "FunctionName",
},
],
"eslintUsed": undefined,
"identifiers": Array [
Object {
- "name": "foo",
+ "name": "Foo",
"range": Array [
- 7,
- 10,
+ 37,
+ 40,
],
"type": "Identifier",
},
],
- "name": "foo",
+ "name": "Foo",
"references": Array [],
"scope": Object {
- "$ref": 1,
+ "$ref": 6,
},
},
],
}
`;
-exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/interface-type.ts 1`] = `
-Object {
- "$id": 0,
- "block": Object {
- "range": Array [
- 0,
- 67,
- ],
- "type": "Program",
- },
- "childScopes": Array [],
- "functionExpressionScope": false,
- "isStrict": false,
- "references": Array [],
- "throughReferences": Array [],
- "type": "global",
- "upperScope": null,
- "variableMap": Object {},
- "variableScope": Object {
- "$ref": 0,
- },
- "variables": Array [],
-}
-`;
-
exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/method-overload.ts 1`] = `
Object {
"$id": 10,
@@ -16775,6 +17440,112 @@ Object {
}
`;
+exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typed-jsx-element.tsx 1`] = `
+Object {
+ "$id": 2,
+ "block": Object {
+ "range": Array [
+ 0,
+ 39,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [
+ Object {
+ "$id": 1,
+ "from": Object {
+ "$ref": 2,
+ },
+ "identifier": Object {
+ "name": "a",
+ "range": Array [
+ 6,
+ 7,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "w",
+ "resolved": Object {
+ "$ref": 0,
+ },
+ "writeExpr": Object {
+ "range": Array [
+ 10,
+ 37,
+ ],
+ "type": "JSXElement",
+ },
+ },
+ ],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {
+ "a": Object {
+ "$ref": 0,
+ },
+ },
+ "variableScope": Object {
+ "$ref": 2,
+ },
+ "variables": Array [
+ Object {
+ "$id": 0,
+ "defs": Array [
+ Object {
+ "name": Object {
+ "name": "a",
+ "range": Array [
+ 6,
+ 7,
+ ],
+ "type": "Identifier",
+ },
+ "node": Object {
+ "range": Array [
+ 6,
+ 37,
+ ],
+ "type": "VariableDeclarator",
+ },
+ "parent": Object {
+ "range": Array [
+ 0,
+ 38,
+ ],
+ "type": "VariableDeclaration",
+ },
+ "type": "Variable",
+ },
+ ],
+ "eslintUsed": undefined,
+ "identifiers": Array [
+ Object {
+ "name": "a",
+ "range": Array [
+ 6,
+ 7,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "name": "a",
+ "references": Array [
+ Object {
+ "$ref": 1,
+ },
+ ],
+ "scope": Object {
+ "$ref": 2,
+ },
+ },
+ ],
+}
+`;
+
exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof.ts 1`] = `
Object {
"$id": 3,
diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/services.ts.snap b/packages/parser/tests/lib/__snapshots__/services.ts.snap
similarity index 100%
rename from packages/typescript-eslint-parser/tests/lib/__snapshots__/services.ts.snap
rename to packages/parser/tests/lib/__snapshots__/services.ts.snap
diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.ts.snap b/packages/parser/tests/lib/__snapshots__/tsx.ts.snap
similarity index 100%
rename from packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.ts.snap
rename to packages/parser/tests/lib/__snapshots__/tsx.ts.snap
diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap
similarity index 93%
rename from packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.ts.snap
rename to packages/parser/tests/lib/__snapshots__/typescript.ts.snap
index b1013b958c11..876c8b3b43b1 100644
--- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.ts.snap
+++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap
@@ -814,12 +814,12 @@ Object {
"line": 3,
},
"start": Object {
- "column": 16,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 16,
+ 7,
68,
],
"superClass": null,
@@ -1262,12 +1262,12 @@ Object {
"line": 3,
},
"start": Object {
- "column": 16,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 16,
+ 7,
86,
],
"superClass": null,
@@ -2567,12 +2567,12 @@ Object {
"line": 3,
},
"start": Object {
- "column": 16,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 16,
+ 7,
78,
],
"superClass": null,
@@ -2955,12 +2955,12 @@ Object {
"line": 2,
},
"start": Object {
- "column": 16,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 16,
+ 7,
31,
],
"type": "TSInterfaceDeclaration",
@@ -3114,6 +3114,398 @@ Object {
}
`;
+exports[`typescript fixtures/basics/arrow-function-with-optional-parameter.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [],
+ "callee": Object {
+ "async": false,
+ "body": Object {
+ "left": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "name": "k",
+ "range": Array [
+ 9,
+ 10,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "operator": "+",
+ "range": Array [
+ 9,
+ 14,
+ ],
+ "right": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "raw": "1",
+ "type": "Literal",
+ "value": 1,
+ },
+ "type": "BinaryExpression",
+ },
+ "expression": true,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 1,
+ },
+ },
+ "name": "k",
+ "optional": true,
+ "range": Array [
+ 2,
+ 4,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "range": Array [
+ 1,
+ 14,
+ ],
+ "type": "ArrowFunctionExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 17,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 18,
+ ],
+ "type": "ExpressionStatement",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 19,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 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": 3,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 2,
+ 3,
+ ],
+ "type": "Identifier",
+ "value": "k",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 3,
+ 4,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 4,
+ 5,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 6,
+ 8,
+ ],
+ "type": "Punctuator",
+ "value": "=>",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 10,
+ ],
+ "type": "Identifier",
+ "value": "k",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "Punctuator",
+ "value": "+",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "type": "Numeric",
+ "value": "1",
+ },
+ 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": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 16,
+ 17,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 18,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
exports[`typescript fixtures/basics/arrow-function-with-type-parameters.src 1`] = `
Object {
"body": Array [
@@ -10655,13 +11047,13 @@ Object {
"line": 2,
},
"start": Object {
- "column": 16,
+ "column": 13,
"line": 2,
},
},
"params": Array [],
"range": Array [
- 26,
+ 23,
32,
],
"type": "FunctionExpression",
@@ -10788,13 +11180,13 @@ Object {
"line": 4,
},
"start": Object {
- "column": 20,
+ "column": 17,
"line": 4,
},
},
"params": Array [],
"range": Array [
- 54,
+ 51,
60,
],
"type": "FunctionExpression",
@@ -13439,13 +13831,13 @@ Object {
"line": 2,
},
"start": Object {
- "column": 11,
+ "column": 8,
"line": 2,
},
},
"params": Array [],
"range": Array [
- 23,
+ 20,
28,
],
"type": "FunctionExpression",
@@ -13868,13 +14260,13 @@ Object {
"line": 2,
},
"start": Object {
- "column": 17,
+ "column": 8,
"line": 2,
},
},
"params": Array [],
"range": Array [
- 29,
+ 20,
34,
],
"type": "FunctionExpression",
@@ -15720,13 +16112,13 @@ Object {
"line": 3,
},
"start": Object {
- "column": 8,
+ "column": 5,
"line": 3,
},
},
"params": Array [],
"range": Array [
- 38,
+ 35,
44,
],
"type": "FunctionExpression",
@@ -21333,12 +21725,12 @@ Object {
"line": 4,
},
"start": Object {
- "column": 14,
+ "column": 22,
"line": 4,
},
},
"range": Array [
- 116,
+ 124,
140,
],
"right": Object {
@@ -21439,12 +21831,12 @@ Object {
"line": 5,
},
"start": Object {
- "column": 14,
+ "column": 31,
"line": 5,
},
},
"range": Array [
- 156,
+ 173,
197,
],
"right": Object {
@@ -24453,12 +24845,12 @@ Object {
"line": 4,
},
"start": Object {
- "column": 14,
+ "column": 24,
"line": 4,
},
},
"range": Array [
- 120,
+ 130,
146,
],
"right": Object {
@@ -24559,12 +24951,12 @@ Object {
"line": 5,
},
"start": Object {
- "column": 14,
+ "column": 33,
"line": 5,
},
},
"range": Array [
- 162,
+ 181,
205,
],
"right": Object {
@@ -25579,12 +25971,12 @@ Object {
"line": 4,
},
"start": Object {
- "column": 14,
+ "column": 21,
"line": 4,
},
},
"range": Array [
- 114,
+ 121,
137,
],
"right": Object {
@@ -25685,12 +26077,12 @@ Object {
"line": 5,
},
"start": Object {
- "column": 14,
+ "column": 30,
"line": 5,
},
},
"range": Array [
- 153,
+ 169,
193,
],
"right": Object {
@@ -26633,12 +27025,12 @@ Object {
"line": 3,
},
"start": Object {
- "column": 14,
+ "column": 23,
"line": 3,
},
},
"range": Array [
- 68,
+ 77,
103,
],
"right": Object {
@@ -27968,13 +28360,13 @@ Object {
"line": 3,
},
"start": Object {
- "column": 18,
+ "column": 15,
"line": 2,
},
},
"params": Array [],
"range": Array [
- 28,
+ 25,
44,
],
"returnType": Object {
@@ -28135,13 +28527,13 @@ Object {
"line": 6,
},
"start": Object {
- "column": 20,
+ "column": 17,
"line": 5,
},
},
"params": Array [],
"range": Array [
- 66,
+ 63,
82,
],
"returnType": Object {
@@ -35463,7 +35855,7 @@ Object {
"line": 4,
},
"start": Object {
- "column": 21,
+ "column": 7,
"line": 1,
},
},
@@ -35559,7 +35951,7 @@ Object {
},
],
"range": Array [
- 21,
+ 7,
54,
],
"type": "TSEnumDeclaration",
@@ -35851,7 +36243,7 @@ Object {
"line": 4,
},
"start": Object {
- "column": 15,
+ "column": 7,
"line": 1,
},
},
@@ -35947,7 +36339,7 @@ Object {
},
],
"range": Array [
- 15,
+ 7,
48,
],
"type": "TSEnumDeclaration",
@@ -38861,139 +39253,269 @@ Object {
}
`;
-exports[`typescript fixtures/basics/function-overloads.src 1`] = `
+exports[`typescript fixtures/basics/function-anonymus-with-type-parameters.src 1`] = `
Object {
"body": Array [
Object {
- "declaration": Object {
- "async": false,
- "expression": false,
- "generator": false,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 16,
- "line": 1,
- },
- },
- "name": "f",
- "range": Array [
- 16,
- 17,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
- },
- "params": Array [
- Object {
+ "declarations": Array [
+ Object {
+ "id": Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 7,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 4,
"line": 1,
},
},
- "name": "x",
+ "name": "obj",
"range": Array [
- 18,
- 27,
+ 4,
+ 7,
],
"type": "Identifier",
- "typeAnnotation": Object {
+ },
+ "init": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 45,
+ 46,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 38,
+ 47,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 27,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 19,
+ "column": 34,
"line": 1,
},
},
"range": Array [
- 19,
- 27,
+ 34,
+ 49,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 32,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 23,
"line": 1,
},
},
+ "name": "a",
"range": Array [
- 21,
- 27,
+ 23,
+ 32,
],
- "type": "TSNumberKeyword",
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 24,
+ 32,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 32,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 10,
+ 49,
+ ],
+ "type": "FunctionExpression",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
},
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 19,
+ 22,
+ ],
+ "type": "TSTypeParameterDeclaration",
},
},
- ],
- "range": Array [
- 7,
- 37,
- ],
- "returnType": Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 28,
+ "column": 4,
"line": 1,
},
},
"range": Array [
- 28,
- 36,
+ 4,
+ 49,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 1,
- },
- "start": Object {
- "column": 30,
- "line": 1,
- },
- },
- "range": Array [
- 30,
- 36,
- ],
- "type": "TSNumberKeyword",
- },
+ "type": "VariableDeclarator",
+ },
+ ],
+ "kind": "var",
+ "loc": Object {
+ "end": Object {
+ "column": 2,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
- "type": "TSDeclareFunction",
},
+ "range": Array [
+ 0,
+ 50,
+ ],
+ "type": "VariableDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 51,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 37,
+ "column": 3,
"line": 1,
},
"start": Object {
@@ -39003,652 +39525,235 @@ Object {
},
"range": Array [
0,
- 37,
+ 3,
],
- "source": null,
- "specifiers": Array [],
- "type": "ExportNamedDeclaration",
+ "type": "Keyword",
+ "value": "var",
},
Object {
- "declaration": Object {
- "async": false,
- "expression": false,
- "generator": false,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "name": "f",
- "range": Array [
- 54,
- 55,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 2,
- },
- "start": Object {
- "column": 7,
- "line": 2,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 2,
- },
- "start": Object {
- "column": 18,
- "line": 2,
- },
- },
- "name": "x",
- "range": Array [
- 56,
- 65,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 2,
- },
- "start": Object {
- "column": 19,
- "line": 2,
- },
- },
- "range": Array [
- 57,
- 65,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 2,
- },
- "start": Object {
- "column": 21,
- "line": 2,
- },
- },
- "range": Array [
- 59,
- 65,
- ],
- "type": "TSStringKeyword",
- },
- },
- },
- ],
- "range": Array [
- 45,
- 75,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 2,
- },
- "start": Object {
- "column": 28,
- "line": 2,
- },
- },
- "range": Array [
- 66,
- 74,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 2,
- },
- "start": Object {
- "column": 30,
- "line": 2,
- },
- },
- "range": Array [
- 68,
- 74,
- ],
- "type": "TSStringKeyword",
- },
+ "start": Object {
+ "column": 4,
+ "line": 1,
},
- "type": "TSDeclareFunction",
},
+ "range": Array [
+ 4,
+ 7,
+ ],
+ "type": "Identifier",
+ "value": "obj",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 2,
+ "column": 9,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 2,
+ "column": 8,
+ "line": 1,
},
},
"range": Array [
- 38,
- 75,
+ 8,
+ 9,
],
- "source": null,
- "specifiers": Array [],
- "type": "ExportNamedDeclaration",
+ "type": "Punctuator",
+ "value": "=",
},
- Object {
- "declaration": Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 4,
- },
- "start": Object {
- "column": 9,
- "line": 4,
- },
- },
- "name": "x",
- "range": Array [
- 142,
- 143,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 4,
- },
- "start": Object {
- "column": 2,
- "line": 4,
- },
- },
- "range": Array [
- 135,
- 144,
- ],
- "type": "ReturnStatement",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 5,
- },
- "start": Object {
- "column": 55,
- "line": 3,
- },
- },
- "range": Array [
- 131,
- 146,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 3,
- },
- "start": Object {
- "column": 16,
- "line": 3,
- },
- },
- "name": "f",
- "range": Array [
- 92,
- 93,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 5,
- },
- "start": Object {
- "column": 7,
- "line": 3,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 3,
- },
- "start": Object {
- "column": 18,
- "line": 3,
- },
- },
- "name": "x",
- "range": Array [
- 94,
- 112,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 3,
- },
- "start": Object {
- "column": 19,
- "line": 3,
- },
- },
- "range": Array [
- 95,
- 112,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 3,
- },
- "start": Object {
- "column": 21,
- "line": 3,
- },
- },
- "range": Array [
- 97,
- 112,
- ],
- "type": "TSUnionType",
- "types": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 3,
- },
- "start": Object {
- "column": 21,
- "line": 3,
- },
- },
- "range": Array [
- 97,
- 103,
- ],
- "type": "TSStringKeyword",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 3,
- },
- "start": Object {
- "column": 30,
- "line": 3,
- },
- },
- "range": Array [
- 106,
- 112,
- ],
- "type": "TSNumberKeyword",
- },
- ],
- },
- },
- },
- ],
- "range": Array [
- 83,
- 146,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 54,
- "line": 3,
- },
- "start": Object {
- "column": 37,
- "line": 3,
- },
- },
- "range": Array [
- 113,
- 130,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 54,
- "line": 3,
- },
- "start": Object {
- "column": 39,
- "line": 3,
- },
- },
- "range": Array [
- 115,
- 130,
- ],
- "type": "TSUnionType",
- "types": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 45,
- "line": 3,
- },
- "start": Object {
- "column": 39,
- "line": 3,
- },
- },
- "range": Array [
- 115,
- 121,
- ],
- "type": "TSStringKeyword",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 54,
- "line": 3,
- },
- "start": Object {
- "column": 48,
- "line": 3,
- },
- },
- "range": Array [
- 124,
- 130,
- ],
- "type": "TSNumberKeyword",
- },
- ],
- },
- },
- "type": "FunctionDeclaration",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 5,
- },
- "start": Object {
- "column": 0,
- "line": 3,
- },
- },
- "range": Array [
- 76,
- 146,
- ],
- "source": null,
- "specifiers": Array [],
- "type": "ExportNamedDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 6,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 147,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 0,
- 6,
+ 10,
+ 18,
],
"type": "Keyword",
- "value": "export",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 19,
"line": 1,
},
},
"range": Array [
- 7,
- 15,
+ 19,
+ 20,
],
- "type": "Keyword",
- "value": "function",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 16,
- 17,
+ 20,
+ 21,
],
"type": "Identifier",
- "value": "f",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 17,
- 18,
+ 21,
+ 22,
],
"type": "Punctuator",
- "value": "(",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
- },
- "range": Array [
- 18,
- 19,
- ],
- "type": "Identifier",
- "value": "x",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 19,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 19,
- 20,
+ 22,
+ 23,
],
"type": "Punctuator",
- "value": ":",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 21,
- 27,
+ 23,
+ 24,
],
"type": "Identifier",
- "value": "number",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 25,
"line": 1,
},
"start": Object {
- "column": 27,
+ "column": 24,
"line": 1,
},
},
"range": Array [
- 27,
- 28,
+ 24,
+ 25,
],
"type": "Punctuator",
- "value": ")",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 32,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 28,
- 29,
+ 26,
+ 32,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 36,
+ "column": 33,
"line": 1,
},
"start": Object {
- "column": 30,
+ "column": 32,
"line": 1,
},
},
"range": Array [
- 30,
- 36,
+ 32,
+ 33,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
+ "column": 35,
"line": 1,
},
"start": Object {
- "column": 36,
+ "column": 34,
"line": 1,
},
},
"range": Array [
- 36,
- 37,
+ 34,
+ 35,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 8,
"line": 2,
},
"start": Object {
- "column": 0,
+ "column": 2,
"line": 2,
},
},
@@ -39657,364 +39762,339 @@ Object {
44,
],
"type": "Keyword",
- "value": "export",
+ "value": "return",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 10,
"line": 2,
},
"start": Object {
- "column": 7,
+ "column": 9,
"line": 2,
},
},
"range": Array [
45,
- 53,
- ],
- "type": "Keyword",
- "value": "function",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "range": Array [
- 54,
- 55,
+ 46,
],
"type": "Identifier",
- "value": "f",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 11,
"line": 2,
},
"start": Object {
- "column": 17,
+ "column": 10,
"line": 2,
},
},
"range": Array [
- 55,
- 56,
+ 46,
+ 47,
],
"type": "Punctuator",
- "value": "(",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 18,
- "line": 2,
- },
- },
- "range": Array [
- 56,
- 57,
- ],
- "type": "Identifier",
- "value": "x",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 2,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 19,
- "line": 2,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 57,
- 58,
+ 48,
+ 49,
],
"type": "Punctuator",
- "value": ":",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 2,
+ "column": 2,
+ "line": 3,
},
"start": Object {
- "column": 21,
- "line": 2,
+ "column": 1,
+ "line": 3,
},
},
"range": Array [
- 59,
- 65,
+ 49,
+ 50,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Punctuator",
+ "value": ";",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/function-anynomus-with-return-type.src 1`] = `
+Object {
+ "body": Array [
Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 2,
- },
- "start": Object {
- "column": 27,
- "line": 2,
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "name": "obj",
+ "range": Array [
+ 4,
+ 7,
+ ],
+ "type": "Identifier",
+ },
+ "init": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 31,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 10,
+ 31,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 21,
+ 27,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 23,
+ 27,
+ ],
+ "type": "TSVoidKeyword",
+ },
+ },
+ "type": "FunctionExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 4,
+ 31,
+ ],
+ "type": "VariableDeclarator",
},
- },
- "range": Array [
- 65,
- 66,
],
- "type": "Punctuator",
- "value": ")",
- },
- Object {
+ "kind": "var",
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 2,
"line": 2,
},
"start": Object {
- "column": 28,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 66,
- 67,
+ 0,
+ 32,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "VariableDeclaration",
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 2,
- },
- "start": Object {
- "column": 30,
- "line": 2,
- },
- },
- "range": Array [
- 68,
- 74,
- ],
- "type": "Identifier",
- "value": "string",
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 3,
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 2,
- },
- "start": Object {
- "column": 36,
- "line": 2,
- },
- },
- "range": Array [
- 74,
- 75,
- ],
- "type": "Punctuator",
- "value": ";",
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 33,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 6,
- "line": 3,
+ "column": 3,
+ "line": 1,
},
"start": Object {
"column": 0,
- "line": 3,
+ "line": 1,
},
},
"range": Array [
- 76,
- 82,
+ 0,
+ 3,
],
"type": "Keyword",
- "value": "export",
+ "value": "var",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 3,
- },
- "start": Object {
"column": 7,
- "line": 3,
- },
- },
- "range": Array [
- 83,
- 91,
- ],
- "type": "Keyword",
- "value": "function",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 3,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 3,
+ "column": 4,
+ "line": 1,
},
},
"range": Array [
- 92,
- 93,
+ 4,
+ 7,
],
"type": "Identifier",
- "value": "f",
+ "value": "obj",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 3,
+ "column": 9,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 3,
+ "column": 8,
+ "line": 1,
},
},
"range": Array [
- 93,
- 94,
+ 8,
+ 9,
],
"type": "Punctuator",
- "value": "(",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 3,
+ "column": 10,
+ "line": 1,
},
},
"range": Array [
- 94,
- 95,
+ 10,
+ 18,
],
- "type": "Identifier",
- "value": "x",
+ "type": "Keyword",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
"column": 20,
- "line": 3,
+ "line": 1,
},
"start": Object {
"column": 19,
- "line": 3,
+ "line": 1,
},
},
"range": Array [
- 95,
- 96,
+ 19,
+ 20,
],
"type": "Punctuator",
- "value": ":",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 3,
- },
- "start": Object {
"column": 21,
- "line": 3,
- },
- },
- "range": Array [
- 97,
- 103,
- ],
- "type": "Identifier",
- "value": "string",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 3,
- },
- "start": Object {
- "column": 28,
- "line": 3,
- },
- },
- "range": Array [
- 104,
- 105,
- ],
- "type": "Punctuator",
- "value": "|",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 3,
- },
- "start": Object {
- "column": 30,
- "line": 3,
- },
- },
- "range": Array [
- 106,
- 112,
- ],
- "type": "Identifier",
- "value": "number",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 3,
+ "line": 1,
},
"start": Object {
- "column": 36,
- "line": 3,
+ "column": 20,
+ "line": 1,
},
},
"range": Array [
- 112,
- 113,
+ 20,
+ 21,
],
"type": "Punctuator",
"value": ")",
@@ -40022,17 +40102,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 3,
+ "column": 22,
+ "line": 1,
},
"start": Object {
- "column": 37,
- "line": 3,
+ "column": 21,
+ "line": 1,
},
},
"range": Array [
- 113,
- 114,
+ 21,
+ 22,
],
"type": "Punctuator",
"value": ":",
@@ -40040,306 +40120,213 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 45,
- "line": 3,
+ "column": 27,
+ "line": 1,
},
"start": Object {
- "column": 39,
- "line": 3,
+ "column": 23,
+ "line": 1,
},
},
"range": Array [
- 115,
- 121,
+ 23,
+ 27,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Keyword",
+ "value": "void",
},
Object {
"loc": Object {
"end": Object {
- "column": 47,
- "line": 3,
+ "column": 29,
+ "line": 1,
},
"start": Object {
- "column": 46,
- "line": 3,
+ "column": 28,
+ "line": 1,
},
},
"range": Array [
- 122,
- 123,
+ 28,
+ 29,
],
"type": "Punctuator",
- "value": "|",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 54,
- "line": 3,
- },
- "start": Object {
- "column": 48,
- "line": 3,
- },
- },
- "range": Array [
- 124,
- 130,
- ],
- "type": "Identifier",
- "value": "number",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 56,
- "line": 3,
+ "column": 1,
+ "line": 2,
},
"start": Object {
- "column": 55,
- "line": 3,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 131,
- 132,
+ 30,
+ 31,
],
"type": "Punctuator",
- "value": "{",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 4,
- },
- "start": Object {
"column": 2,
- "line": 4,
- },
- },
- "range": Array [
- 135,
- 141,
- ],
- "type": "Keyword",
- "value": "return",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 4,
- },
- "start": Object {
- "column": 9,
- "line": 4,
- },
- },
- "range": Array [
- 142,
- 143,
- ],
- "type": "Identifier",
- "value": "x",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 4,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 4,
- },
- },
- "range": Array [
- 143,
- 144,
- ],
- "type": "Punctuator",
- "value": ";",
- },
- Object {
- "loc": Object {
- "end": Object {
"column": 1,
- "line": 5,
- },
- "start": Object {
- "column": 0,
- "line": 5,
+ "line": 2,
},
},
"range": Array [
- 145,
- 146,
+ 31,
+ 32,
],
"type": "Punctuator",
- "value": "}",
+ "value": ";",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/function-with-await.src 1`] = `
+exports[`typescript fixtures/basics/function-overloads.src 1`] = `
Object {
"body": Array [
Object {
- "async": true,
- "body": Object {
- "body": Array [
+ "declaration": Object {
+ "async": false,
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 1,
+ },
+ },
+ "name": "f",
+ "range": Array [
+ 16,
+ 17,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "params": Array [
Object {
- "expression": Object {
- "argument": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 2,
- },
- "start": Object {
- "column": 10,
- "line": 2,
- },
- },
- "name": "future",
- "range": Array [
- 40,
- 46,
- ],
- "type": "Identifier",
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
},
+ },
+ "name": "x",
+ "range": Array [
+ 18,
+ 27,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 2,
+ "column": 27,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 19,
+ "line": 1,
},
},
"range": Array [
- 34,
- 46,
+ 19,
+ 27,
],
- "type": "AwaitExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 21,
+ 27,
+ ],
+ "type": "TSNumberKeyword",
},
},
- "range": Array [
- 34,
- 47,
- ],
- "type": "ExpressionStatement",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 28,
- "line": 1,
},
- },
- "range": Array [
- 28,
- 49,
],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 1,
- },
- "start": Object {
- "column": 15,
- "line": 1,
- },
- },
- "name": "hope",
"range": Array [
- 15,
- 19,
+ 7,
+ 37,
],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "params": Array [
- Object {
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 36,
"line": 1,
},
"start": Object {
- "column": 20,
+ "column": 28,
"line": 1,
},
},
- "name": "future",
"range": Array [
- 20,
- 26,
+ 28,
+ 36,
],
- "type": "Identifier",
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 36,
+ ],
+ "type": "TSNumberKeyword",
+ },
},
- ],
- "range": Array [
- 0,
- 49,
- ],
- "type": "FunctionDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 50,
- ],
- "sourceType": "module",
- "tokens": Array [
- Object {
+ "type": "TSDeclareFunction",
+ },
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 37,
"line": 1,
},
"start": Object {
@@ -40349,540 +40336,434 @@ Object {
},
"range": Array [
0,
- 5,
- ],
- "type": "Identifier",
- "value": "async",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
- },
- "range": Array [
- 6,
- 14,
- ],
- "type": "Keyword",
- "value": "function",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 1,
- },
- "start": Object {
- "column": 15,
- "line": 1,
- },
- },
- "range": Array [
- 15,
- 19,
- ],
- "type": "Identifier",
- "value": "hope",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 19,
- "line": 1,
- },
- },
- "range": Array [
- 19,
- 20,
- ],
- "type": "Punctuator",
- "value": "(",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 1,
- },
- "start": Object {
- "column": 20,
- "line": 1,
- },
- },
- "range": Array [
- 20,
- 26,
- ],
- "type": "Identifier",
- "value": "future",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 1,
- },
- "start": Object {
- "column": 26,
- "line": 1,
- },
- },
- "range": Array [
- 26,
- 27,
- ],
- "type": "Punctuator",
- "value": ")",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 28,
- "line": 1,
- },
- },
- "range": Array [
- 28,
- 29,
- ],
- "type": "Punctuator",
- "value": "{",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 34,
- 39,
- ],
- "type": "Identifier",
- "value": "await",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 2,
- },
- "start": Object {
- "column": 10,
- "line": 2,
- },
- },
- "range": Array [
- 40,
- 46,
- ],
- "type": "Identifier",
- "value": "future",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "range": Array [
- 46,
- 47,
- ],
- "type": "Punctuator",
- "value": ";",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 0,
- "line": 3,
- },
- },
- "range": Array [
- 48,
- 49,
+ 37,
],
- "type": "Punctuator",
- "value": "}",
+ "source": null,
+ "specifiers": Array [],
+ "type": "ExportNamedDeclaration",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = `
-Object {
- "body": Array [
Object {
- "async": false,
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 47,
- "line": 1,
+ "declaration": Object {
+ "async": false,
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
},
+ "name": "f",
+ "range": Array [
+ 54,
+ 55,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 47,
- 51,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 1,
+ "column": 37,
+ "line": 2,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 7,
+ "line": 2,
},
},
- "name": "foo",
- "range": Array [
- 9,
- 12,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 45,
- "line": 1,
- },
- "start": Object {
- "column": 13,
- "line": 1,
- },
- },
- "properties": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "name": "bar",
- "range": Array [
- 14,
- 17,
- ],
- "type": "Identifier",
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 2,
},
- "kind": "init",
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 56,
+ 65,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 27,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
},
- "method": false,
"range": Array [
- 14,
- 17,
+ 57,
+ 65,
],
- "shorthand": true,
- "type": "Property",
- "value": Object {
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
- },
+ "column": 27,
+ "line": 2,
+ },
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 21,
+ "line": 2,
},
},
- "name": "bar",
"range": Array [
- 14,
- 17,
+ 59,
+ 65,
],
- "type": "Identifier",
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ ],
+ "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 {
- "computed": false,
- "key": Object {
+ "argument": Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 10,
+ "line": 4,
},
"start": Object {
- "column": 19,
- "line": 1,
+ "column": 9,
+ "line": 4,
},
},
- "name": "baz",
+ "name": "x",
"range": Array [
- 19,
- 22,
+ 142,
+ 143,
],
"type": "Identifier",
},
- "kind": "init",
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 11,
+ "line": 4,
},
"start": Object {
- "column": 19,
- "line": 1,
+ "column": 2,
+ "line": 4,
},
},
- "method": false,
"range": Array [
- 19,
- 22,
+ 135,
+ 144,
],
- "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",
- },
+ "type": "ReturnStatement",
},
],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 55,
+ "line": 3,
+ },
+ },
"range": Array [
- 13,
- 45,
+ 131,
+ 146,
],
- "type": "ObjectPattern",
- "typeAnnotation": Object {
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 3,
+ },
+ },
+ "name": "f",
+ "range": Array [
+ 92,
+ 93,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 3,
+ },
+ },
+ "params": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 45,
- "line": 1,
+ "column": 36,
+ "line": 3,
},
"start": Object {
- "column": 23,
- "line": 1,
+ "column": 18,
+ "line": 3,
},
},
+ "name": "x",
"range": Array [
- 23,
- 45,
+ 94,
+ 112,
],
- "type": "TSTypeAnnotation",
+ "type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 45,
- "line": 1,
+ "column": 36,
+ "line": 3,
},
"start": Object {
- "column": 25,
- "line": 1,
+ "column": 19,
+ "line": 3,
},
},
- "members": Array [
- Object {
- "computed": false,
- "key": Object {
+ "range": Array [
+ 95,
+ 112,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 97,
+ 112,
+ ],
+ "type": "TSUnionType",
+ "types": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 1,
+ "column": 27,
+ "line": 3,
},
"start": Object {
- "column": 26,
- "line": 1,
+ "column": 21,
+ "line": 3,
},
},
- "name": "bar",
"range": Array [
- 26,
- 29,
+ 97,
+ 103,
],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 39,
- "line": 1,
- },
- "start": Object {
- "column": 26,
- "line": 1,
- },
+ "type": "TSStringKeyword",
},
- "optional": true,
- "range": Array [
- 26,
- 39,
- ],
- "type": "TSPropertySignature",
- "typeAnnotation": Object {
+ Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 1,
+ "column": 36,
+ "line": 3,
},
"start": Object {
"column": 30,
- "line": 1,
+ "line": 3,
},
},
"range": Array [
- 30,
- 38,
+ 106,
+ 112,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 32,
- "line": 1,
- },
- },
- "range": Array [
- 32,
- 38,
- ],
- "type": "TSStringKeyword",
- },
+ "type": "TSNumberKeyword",
+ },
+ ],
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 83,
+ 146,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 54,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 37,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 113,
+ 130,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 54,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 39,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 115,
+ 130,
+ ],
+ "type": "TSUnionType",
+ "types": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 45,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 39,
+ "line": 3,
},
},
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 43,
- "line": 1,
- },
- "start": Object {
- "column": 40,
- "line": 1,
- },
- },
- "name": "baz",
- "range": Array [
- 40,
- 43,
- ],
- "type": "Identifier",
+ "range": Array [
+ 115,
+ 121,
+ ],
+ "type": "TSStringKeyword",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 54,
+ "line": 3,
},
- "loc": Object {
- "end": Object {
- "column": 44,
- "line": 1,
- },
- "start": Object {
- "column": 40,
- "line": 1,
- },
+ "start": Object {
+ "column": 48,
+ "line": 3,
},
- "optional": true,
- "range": Array [
- 40,
- 44,
- ],
- "type": "TSPropertySignature",
},
- ],
- "range": Array [
- 25,
- 45,
- ],
- "type": "TSTypeLiteral",
- },
+ "range": Array [
+ 124,
+ 130,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ ],
},
},
- ],
+ "type": "FunctionDeclaration",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
"range": Array [
- 0,
- 51,
+ 76,
+ 146,
],
- "type": "FunctionDeclaration",
+ "source": null,
+ "specifiers": Array [],
+ "type": "ExportNamedDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 4,
+ "line": 6,
},
"start": Object {
"column": 0,
@@ -40891,14 +40772,14 @@ Object {
},
"range": Array [
0,
- 52,
+ 147,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 6,
"line": 1,
},
"start": Object {
@@ -40908,151 +40789,151 @@ Object {
},
"range": Array [
0,
- 8,
+ 6,
],
"type": "Keyword",
- "value": "function",
+ "value": "export",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 9,
- 12,
+ 7,
+ 15,
],
- "type": "Identifier",
- "value": "foo",
+ "type": "Keyword",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 16,
+ 17,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "f",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 13,
- 14,
+ 17,
+ 18,
],
"type": "Punctuator",
- "value": "{",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 19,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 14,
- 17,
+ 18,
+ 19,
],
"type": "Identifier",
- "value": "bar",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 19,
"line": 1,
},
},
"range": Array [
- 17,
- 18,
+ 19,
+ 20,
],
"type": "Punctuator",
- "value": ",",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 19,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 19,
- 22,
+ 21,
+ 27,
],
"type": "Identifier",
- "value": "baz",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 27,
"line": 1,
},
},
"range": Array [
- 22,
- 23,
+ 27,
+ 28,
],
"type": "Punctuator",
- "value": "}",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 23,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 23,
- 24,
+ 28,
+ 29,
],
"type": "Punctuator",
"value": ":",
@@ -41060,71 +40941,143 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 36,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 30,
"line": 1,
},
},
"range": Array [
- 25,
- 26,
+ 30,
+ 36,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 37,
"line": 1,
},
"start": Object {
- "column": 26,
+ "column": 36,
"line": 1,
},
},
"range": Array [
- 26,
- 29,
+ 36,
+ 37,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 38,
+ 44,
+ ],
+ "type": "Keyword",
+ "value": "export",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 45,
+ 53,
+ ],
+ "type": "Keyword",
+ "value": "function",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 54,
+ 55,
],
"type": "Identifier",
- "value": "bar",
+ "value": "f",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
- "line": 1,
+ "column": 18,
+ "line": 2,
},
"start": Object {
- "column": 29,
- "line": 1,
+ "column": 17,
+ "line": 2,
},
},
"range": Array [
- 29,
- 30,
+ 55,
+ 56,
],
"type": "Punctuator",
- "value": "?",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
"start": Object {
- "column": 30,
- "line": 1,
+ "column": 18,
+ "line": 2,
},
},
"range": Array [
- 30,
- 31,
+ 56,
+ 57,
+ ],
+ "type": "Identifier",
+ "value": "x",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 57,
+ 58,
],
"type": "Punctuator",
"value": ":",
@@ -41132,17 +41085,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 1,
+ "column": 27,
+ "line": 2,
},
"start": Object {
- "column": 32,
- "line": 1,
+ "column": 21,
+ "line": 2,
},
},
"range": Array [
- 32,
- 38,
+ 59,
+ 65,
],
"type": "Identifier",
"value": "string",
@@ -41150,462 +41103,546 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 39,
- "line": 1,
+ "column": 28,
+ "line": 2,
},
"start": Object {
- "column": 38,
- "line": 1,
+ "column": 27,
+ "line": 2,
},
},
"range": Array [
- 38,
- 39,
+ 65,
+ 66,
],
"type": "Punctuator",
- "value": ",",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 43,
- "line": 1,
+ "column": 29,
+ "line": 2,
},
"start": Object {
- "column": 40,
- "line": 1,
+ "column": 28,
+ "line": 2,
},
},
"range": Array [
- 40,
- 43,
+ 66,
+ 67,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 68,
+ 74,
],
"type": "Identifier",
- "value": "baz",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 44,
- "line": 1,
+ "column": 37,
+ "line": 2,
},
"start": Object {
- "column": 43,
- "line": 1,
+ "column": 36,
+ "line": 2,
},
},
"range": Array [
- 43,
- 44,
+ 74,
+ 75,
],
"type": "Punctuator",
- "value": "?",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 45,
- "line": 1,
+ "column": 6,
+ "line": 3,
},
"start": Object {
- "column": 44,
- "line": 1,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 44,
- 45,
+ 76,
+ 82,
+ ],
+ "type": "Keyword",
+ "value": "export",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 83,
+ 91,
+ ],
+ "type": "Keyword",
+ "value": "function",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 92,
+ 93,
+ ],
+ "type": "Identifier",
+ "value": "f",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 93,
+ 94,
],
"type": "Punctuator",
- "value": "}",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 46,
- "line": 1,
+ "column": 19,
+ "line": 3,
},
"start": Object {
- "column": 45,
- "line": 1,
+ "column": 18,
+ "line": 3,
},
},
"range": Array [
- 45,
- 46,
+ 94,
+ 95,
+ ],
+ "type": "Identifier",
+ "value": "x",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 95,
+ 96,
],
"type": "Punctuator",
- "value": ")",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 48,
- "line": 1,
+ "column": 27,
+ "line": 3,
},
"start": Object {
- "column": 47,
- "line": 1,
+ "column": 21,
+ "line": 3,
},
},
"range": Array [
- 47,
- 48,
+ 97,
+ 103,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 104,
+ 105,
],
"type": "Punctuator",
- "value": "{",
+ "value": "|",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 36,
"line": 3,
},
"start": Object {
- "column": 0,
+ "column": 30,
"line": 3,
},
},
"range": Array [
- 50,
- 51,
+ 106,
+ 112,
+ ],
+ "type": "Identifier",
+ "value": "number",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 36,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 112,
+ 113,
],
"type": "Punctuator",
- "value": "}",
+ "value": ")",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = `
-Object {
- "body": Array [
Object {
- "async": false,
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 45,
- "line": 1,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 37,
+ "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,
- },
+ "range": Array [
+ 113,
+ 114,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 45,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 39,
+ "line": 3,
},
- "name": "foo",
- "range": Array [
- 9,
- 12,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 115,
+ 121,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 47,
"line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 46,
+ "line": 3,
},
},
- "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 {
+ "range": Array [
+ 122,
+ 123,
+ ],
+ "type": "Punctuator",
+ "value": "|",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 54,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 48,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 124,
+ 130,
+ ],
+ "type": "Identifier",
+ "value": "number",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 56,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 55,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 131,
+ 132,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 135,
+ 141,
+ ],
+ "type": "Keyword",
+ "value": "return",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 142,
+ 143,
+ ],
+ "type": "Identifier",
+ "value": "x",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 143,
+ 144,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 145,
+ 146,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/function-with-await.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "async": true,
+ "body": Object {
+ "body": Array [
+ Object {
+ "expression": Object {
+ "argument": Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 19,
- "line": 1,
+ "column": 10,
+ "line": 2,
},
},
- "name": "baz",
+ "name": "future",
"range": Array [
- 19,
- 22,
+ 40,
+ 46,
],
"type": "Identifier",
},
- "kind": "init",
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 19,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
- "method": false,
"range": Array [
- 19,
- 22,
+ 34,
+ 46,
],
- "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",
- },
+ "type": "AwaitExpression",
},
- ],
- "range": Array [
- 13,
- 43,
- ],
- "type": "ObjectPattern",
- "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 43,
- "line": 1,
+ "column": 17,
+ "line": 2,
},
"start": Object {
- "column": 23,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 23,
- 43,
+ 34,
+ 47,
],
- "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",
+ "type": "ExpressionStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 49,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "name": "hope",
+ "range": Array [
+ 15,
+ 19,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
},
},
+ "name": "future",
+ "range": Array [
+ 20,
+ 26,
+ ],
+ "type": "Identifier",
},
],
"range": Array [
@@ -41635,7 +41672,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 5,
"line": 1,
},
"start": Object {
@@ -41645,316 +41682,172 @@ Object {
},
"range": Array [
0,
- 8,
+ 5,
],
- "type": "Keyword",
- "value": "function",
+ "type": "Identifier",
+ "value": "async",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 9,
- 12,
+ 6,
+ 14,
],
- "type": "Identifier",
- "value": "foo",
+ "type": "Keyword",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 19,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 15,
+ 19,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "hope",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 19,
"line": 1,
},
},
"range": Array [
- 13,
- 14,
+ 19,
+ 20,
],
"type": "Punctuator",
- "value": "{",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 14,
- 17,
+ 20,
+ 26,
],
"type": "Identifier",
- "value": "bar",
+ "value": "future",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 17,
- 18,
+ 26,
+ 27,
],
"type": "Punctuator",
- "value": ",",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 19,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 19,
- 22,
+ 28,
+ 29,
],
- "type": "Identifier",
- "value": "baz",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 1,
+ "column": 9,
+ "line": 2,
},
"start": Object {
- "column": 22,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 22,
- 23,
+ 34,
+ 39,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "await",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 1,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 23,
- "line": 1,
+ "column": 10,
+ "line": 2,
},
},
"range": Array [
- 23,
- 24,
+ 40,
+ 46,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "future",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 1,
+ "column": 17,
+ "line": 2,
},
"start": Object {
- "column": 25,
- "line": 1,
+ "column": 16,
+ "line": 2,
},
},
"range": Array [
- 25,
- 26,
+ 46,
+ 47,
],
"type": "Punctuator",
- "value": "{",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 26,
- "line": 1,
- },
- },
- "range": Array [
- 26,
- 29,
- ],
- "type": "Identifier",
- "value": "bar",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 1,
- },
- "start": Object {
- "column": 29,
- "line": 1,
- },
- },
- "range": Array [
- 29,
- 30,
- ],
- "type": "Punctuator",
- "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,
- "line": 1,
- },
- },
- "range": Array [
- 42,
- 43,
- ],
- "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": "{",
+ "value": ";",
},
Object {
"loc": Object {
@@ -41979,62 +41872,26 @@ Object {
}
`;
-exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = `
+exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = `
Object {
"body": Array [
Object {
"async": false,
"body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "name": "b",
- "range": Array [
- 36,
- 37,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 29,
- 38,
- ],
- "type": "ReturnStatement",
- },
- ],
+ "body": Array [],
"loc": Object {
"end": Object {
"column": 1,
"line": 3,
},
"start": Object {
- "column": 23,
+ "column": 47,
"line": 1,
},
},
"range": Array [
- 23,
- 40,
+ 47,
+ 51,
],
"type": "BlockStatement",
},
@@ -42043,7 +41900,7 @@ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 12,
"line": 1,
},
"start": Object {
@@ -42051,10 +41908,10 @@ Object {
"line": 1,
},
},
- "name": "a",
+ "name": "foo",
"range": Array [
9,
- 10,
+ 12,
],
"type": "Identifier",
},
@@ -42072,388 +41929,417 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 45,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 13,
"line": 1,
},
},
- "name": "b",
- "range": Array [
- 14,
- 18,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 1,
- },
- "start": Object {
- "column": 15,
- "line": 1,
+ "properties": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 14,
+ 17,
+ ],
+ "type": "Identifier",
},
- },
- "range": Array [
- 15,
- 18,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "kind": "init",
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 14,
"line": 1,
},
},
+ "method": false,
"range": Array [
+ 14,
17,
- 18,
],
- "type": "TSTypeReference",
- "typeName": Object {
+ "shorthand": true,
+ "type": "Property",
+ "value": Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 14,
"line": 1,
},
},
- "name": "X",
+ "name": "bar",
"range": Array [
+ 14,
17,
- 18,
],
"type": "Identifier",
},
},
- },
- },
- ],
- "range": Array [
- 0,
- 40,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 1,
- },
- "start": Object {
- "column": 19,
- "line": 1,
- },
- },
- "range": Array [
- 19,
- 22,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 1,
- },
- "start": Object {
- "column": 21,
- "line": 1,
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 19,
+ 22,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "init",
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "method": false,
+ "range": Array [
+ 19,
+ 22,
+ ],
+ "shorthand": true,
+ "type": "Property",
+ "value": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 19,
+ 22,
+ ],
+ "type": "Identifier",
+ },
},
- },
+ ],
"range": Array [
- 21,
- 22,
+ 13,
+ 45,
],
- "type": "TSTypeReference",
- "typeName": Object {
+ "type": "ObjectPattern",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 45,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 23,
"line": 1,
},
},
- "name": "X",
"range": Array [
- 21,
- 22,
+ 23,
+ 45,
],
- "type": "Identifier",
- },
- },
- },
- "type": "FunctionDeclaration",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "name": Object {
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 45,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 25,
"line": 1,
},
},
- "name": "X",
- "range": Array [
- 11,
- 12,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 11,
- 12,
- ],
- "type": "TSTypeParameter",
- },
- ],
- "range": Array [
- 10,
- 13,
- ],
- "type": "TSTypeParameterDeclaration",
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 41,
- ],
- "sourceType": "module",
- "tokens": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 8,
- ],
- "type": "Keyword",
- "value": "function",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "range": Array [
- 9,
- 10,
- ],
- "type": "Identifier",
- "value": "a",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "range": Array [
- 10,
- 11,
- ],
- "type": "Punctuator",
- "value": "<",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 12,
- ],
- "type": "Identifier",
- "value": "X",
+ "members": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 26,
+ 29,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 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",
+ },
+ ],
+ "range": Array [
+ 25,
+ 45,
+ ],
+ "type": "TSTypeLiteral",
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 0,
+ 51,
+ ],
+ "type": "FunctionDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 52,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 0,
+ 8,
],
- "type": "Punctuator",
- "value": ">",
+ "type": "Keyword",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 13,
- 14,
+ 9,
+ 12,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 14,
- 15,
+ 12,
+ 13,
],
- "type": "Identifier",
- "value": "b",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 15,
- 16,
+ 13,
+ 14,
],
"type": "Punctuator",
- "value": ":",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 14,
"line": 1,
},
},
"range": Array [
+ 14,
17,
- 18,
],
"type": "Identifier",
- "value": "X",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 17,
"line": 1,
},
},
"range": Array [
+ 17,
18,
- 19,
],
"type": "Punctuator",
- "value": ")",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 22,
"line": 1,
},
"start": Object {
@@ -42463,28 +42349,28 @@ Object {
},
"range": Array [
19,
- 20,
+ 22,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "baz",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 21,
22,
+ 23,
],
- "type": "Identifier",
- "value": "X",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
@@ -42502,459 +42388,249 @@ Object {
24,
],
"type": "Punctuator",
- "value": "{",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 2,
+ "column": 26,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 25,
+ "line": 1,
},
},
"range": Array [
- 29,
- 35,
+ 25,
+ 26,
],
- "type": "Keyword",
- "value": "return",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 2,
+ "column": 29,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 2,
+ "column": 26,
+ "line": 1,
},
},
"range": Array [
- 36,
- 37,
+ 26,
+ 29,
],
"type": "Identifier",
- "value": "b",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 2,
- },
- "start": Object {
- "column": 12,
- "line": 2,
- },
- },
- "range": Array [
- 37,
- 38,
- ],
- "type": "Punctuator",
- "value": ";",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 30,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 29,
+ "line": 1,
},
},
"range": Array [
- 39,
- 40,
+ 29,
+ 30,
],
"type": "Punctuator",
- "value": "}",
+ "value": "?",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = `
-Object {
- "body": Array [
Object {
- "async": false,
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 35,
- "line": 1,
- },
- "start": Object {
- "column": 33,
- "line": 1,
- },
- },
- "range": Array [
- 33,
- 35,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "name": "compare",
- "range": Array [
- 9,
- 16,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 31,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 30,
"line": 1,
},
},
- "params": Array [],
"range": Array [
- 0,
- 35,
+ 30,
+ 31,
],
- "type": "FunctionDeclaration",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 1,
- },
- "start": Object {
- "column": 16,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 28,
- "line": 1,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 28,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 28,
- 29,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 28,
- 29,
- ],
- "type": "TSTypeParameter",
- },
- ],
- "range": Array [
- 16,
- 30,
- ],
- "type": "TSTypeParameterDeclaration",
- },
+ "type": "Punctuator",
+ "value": ":",
},
- ],
- "comments": Array [
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 38,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 32,
"line": 1,
},
},
"range": Array [
- 17,
- 28,
+ 32,
+ 38,
],
- "type": "Block",
- "value": "comment",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 35,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Identifier",
+ "value": "string",
},
- },
- "range": Array [
- 0,
- 35,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 39,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 38,
"line": 1,
},
},
"range": Array [
- 0,
- 8,
+ 38,
+ 39,
],
- "type": "Keyword",
- "value": "function",
+ "type": "Punctuator",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 43,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 40,
"line": 1,
},
},
"range": Array [
- 9,
- 16,
+ 40,
+ 43,
],
"type": "Identifier",
- "value": "compare",
+ "value": "baz",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 44,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 43,
"line": 1,
},
},
"range": Array [
- 16,
- 17,
+ 43,
+ 44,
],
"type": "Punctuator",
- "value": "<",
+ "value": "?",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 45,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 44,
"line": 1,
},
},
"range": Array [
- 28,
- 29,
+ 44,
+ 45,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 46,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 45,
"line": 1,
},
},
"range": Array [
- 29,
- 30,
+ 45,
+ 46,
],
"type": "Punctuator",
- "value": ">",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 48,
"line": 1,
},
"start": Object {
- "column": 30,
+ "column": 47,
"line": 1,
},
},
"range": Array [
- 30,
- 31,
+ 47,
+ 48,
],
"type": "Punctuator",
- "value": "(",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 32,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 31,
- "line": 1,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 31,
- 32,
+ 50,
+ 51,
],
"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": "Punctuator",
- "value": "}",
+ "value": "}",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = `
+exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = `
Object {
"body": Array [
Object {
"async": false,
"body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "name": "b",
- "range": Array [
- 47,
- 48,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 40,
- 49,
- ],
- "type": "ReturnStatement",
- },
- ],
+ "body": Array [],
"loc": Object {
"end": Object {
"column": 1,
"line": 3,
},
"start": Object {
- "column": 34,
+ "column": 45,
"line": 1,
},
},
"range": Array [
- 34,
- 51,
+ 45,
+ 49,
],
"type": "BlockStatement",
},
@@ -42963,7 +42639,7 @@ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 12,
"line": 1,
},
"start": Object {
@@ -42971,10 +42647,10 @@ Object {
"line": 1,
},
},
- "name": "a",
+ "name": "foo",
"range": Array [
9,
- 10,
+ 12,
],
"type": "Identifier",
},
@@ -42992,203 +42668,284 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 43,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 13,
"line": 1,
},
},
- "name": "b",
- "range": Array [
- 25,
- 29,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 26,
- "line": 1,
+ "properties": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 14,
+ 17,
+ ],
+ "type": "Identifier",
},
- },
- "range": Array [
- 26,
- 29,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "kind": "init",
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 14,
"line": 1,
},
},
+ "method": false,
"range": Array [
- 28,
- 29,
+ 14,
+ 17,
],
- "type": "TSTypeReference",
- "typeName": Object {
+ "shorthand": true,
+ "type": "Property",
+ "value": Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 14,
"line": 1,
},
},
- "name": "X",
+ "name": "bar",
"range": Array [
- 28,
- 29,
+ 14,
+ 17,
],
"type": "Identifier",
},
},
- },
- },
- ],
- "range": Array [
- 0,
- 51,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 1,
- },
- "start": Object {
- "column": 30,
- "line": 1,
- },
- },
- "range": Array [
- 30,
- 33,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 1,
- },
- "start": Object {
- "column": 32,
- "line": 1,
- },
- },
- "range": Array [
- 32,
- 33,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 1,
- },
- "start": Object {
- "column": 32,
- "line": 1,
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 19,
+ 22,
+ ],
+ "type": "Identifier",
},
- },
- "name": "X",
- "range": Array [
- 32,
- 33,
- ],
- "type": "Identifier",
- },
- },
- },
- "type": "FunctionDeclaration",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "constraint": Object {
+ "kind": "init",
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 19,
"line": 1,
},
},
- "members": Array [],
+ "method": false,
"range": Array [
- 21,
- 23,
+ 19,
+ 22,
],
- "type": "TSTypeLiteral",
+ "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": 23,
+ "column": 43,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 23,
"line": 1,
},
},
- "name": Object {
+ "range": Array [
+ 23,
+ 43,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 43,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 25,
"line": 1,
},
},
- "name": "X",
+ "members": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 26,
+ 29,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 38,
+ ],
+ "type": "TSPropertySignature",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 29,
+ 37,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 31,
+ 37,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 39,
+ "line": 1,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 39,
+ 42,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 39,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 39,
+ 42,
+ ],
+ "type": "TSPropertySignature",
+ },
+ ],
"range": Array [
- 11,
- 12,
+ 25,
+ 43,
],
- "type": "Identifier",
+ "type": "TSTypeLiteral",
},
- "range": Array [
- 11,
- 23,
- ],
- "type": "TSTypeParameter",
},
- ],
- "range": Array [
- 10,
- 24,
- ],
- "type": "TSTypeParameterDeclaration",
- },
+ },
+ ],
+ "range": Array [
+ 0,
+ 49,
+ ],
+ "type": "FunctionDeclaration",
},
],
"comments": Array [],
@@ -43204,7 +42961,7 @@ Object {
},
"range": Array [
0,
- 52,
+ 50,
],
"sourceType": "module",
"tokens": Array [
@@ -43229,7 +42986,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 12,
"line": 1,
},
"start": Object {
@@ -43239,64 +42996,82 @@ Object {
},
"range": Array [
9,
- 10,
+ 12,
],
"type": "Identifier",
- "value": "a",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 10,
- 11,
+ 12,
+ 13,
],
"type": "Punctuator",
- "value": "<",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 11,
- 12,
+ 13,
+ 14,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 17,
],
"type": "Identifier",
- "value": "X",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 13,
- 20,
+ 17,
+ 18,
],
- "type": "Keyword",
- "value": "extends",
+ "type": "Punctuator",
+ "value": ",",
},
Object {
"loc": Object {
@@ -43305,16 +43080,16 @@ Object {
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 19,
"line": 1,
},
},
"range": Array [
- 21,
+ 19,
22,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "baz",
},
Object {
"loc": Object {
@@ -43350,58 +43125,58 @@ Object {
24,
],
"type": "Punctuator",
- "value": ">",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 25,
"line": 1,
},
},
"range": Array [
- 24,
25,
+ 26,
],
"type": "Punctuator",
- "value": "(",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 25,
26,
+ 29,
],
"type": "Identifier",
- "value": "b",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 30,
"line": 1,
},
"start": Object {
- "column": 26,
+ "column": 29,
"line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 29,
+ 30,
],
"type": "Punctuator",
"value": ":",
@@ -43409,146 +43184,110 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 37,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 31,
"line": 1,
},
},
"range": Array [
- 28,
- 29,
+ 31,
+ 37,
],
"type": "Identifier",
- "value": "X",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 38,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 37,
"line": 1,
},
},
"range": Array [
- 29,
- 30,
+ 37,
+ 38,
],
"type": "Punctuator",
- "value": ")",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 42,
"line": 1,
},
"start": Object {
- "column": 30,
+ "column": 39,
"line": 1,
},
},
"range": Array [
- 30,
- 31,
+ 39,
+ 42,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "baz",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
+ "column": 43,
"line": 1,
},
"start": Object {
- "column": 32,
+ "column": 42,
"line": 1,
},
},
"range": Array [
- 32,
- 33,
+ 42,
+ 43,
],
- "type": "Identifier",
- "value": "X",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 44,
"line": 1,
},
"start": Object {
- "column": 34,
+ "column": 43,
"line": 1,
},
},
"range": Array [
- 34,
- 35,
+ 43,
+ 44,
],
"type": "Punctuator",
- "value": "{",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 2,
+ "column": 46,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 45,
+ "line": 1,
},
},
"range": Array [
- 40,
+ 45,
46,
],
- "type": "Keyword",
- "value": "return",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "range": Array [
- 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 {
@@ -43562,8 +43301,8 @@ Object {
},
},
"range": Array [
- 50,
- 51,
+ 48,
+ 49,
],
"type": "Punctuator",
"value": "}",
@@ -43573,7 +43312,7 @@ Object {
}
`;
-exports[`typescript fixtures/basics/function-with-types.src 1`] = `
+exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = `
Object {
"body": Array [
Object {
@@ -43584,7 +43323,7 @@ Object {
"argument": Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 12,
"line": 2,
},
"start": Object {
@@ -43592,16 +43331,16 @@ Object {
"line": 2,
},
},
- "name": "name",
+ "name": "b",
"range": Array [
- 50,
- 54,
+ 36,
+ 37,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 13,
"line": 2,
},
"start": Object {
@@ -43610,8 +43349,8 @@ Object {
},
},
"range": Array [
- 43,
- 55,
+ 29,
+ 38,
],
"type": "ReturnStatement",
},
@@ -43622,13 +43361,13 @@ Object {
"line": 3,
},
"start": Object {
- "column": 37,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 37,
- 57,
+ 23,
+ 40,
],
"type": "BlockStatement",
},
@@ -43637,7 +43376,7 @@ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 10,
"line": 1,
},
"start": Object {
@@ -43645,10 +43384,10 @@ Object {
"line": 1,
},
},
- "name": "message",
+ "name": "a",
"range": Array [
9,
- 16,
+ 10,
],
"type": "Identifier",
},
@@ -43666,95 +43405,185 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 14,
"line": 1,
},
},
- "name": "name",
+ "name": "b",
"range": Array [
- 17,
- 28,
+ 14,
+ 18,
],
"type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 21,
- 28,
+ 15,
+ 18,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 22,
- 28,
+ 17,
+ 18,
],
- "type": "TSStringKeyword",
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "name": "X",
+ "range": Array [
+ 17,
+ 18,
+ ],
+ "type": "Identifier",
+ },
},
},
},
],
"range": Array [
0,
- 57,
+ 40,
],
"returnType": Object {
"loc": Object {
"end": Object {
- "column": 36,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 19,
"line": 1,
},
},
"range": Array [
- 29,
- 36,
+ 19,
+ 22,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 36,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 30,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 30,
- 36,
+ 21,
+ 22,
],
- "type": "TSStringKeyword",
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "name": "X",
+ "range": Array [
+ 21,
+ 22,
+ ],
+ "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": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "name": "X",
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
},
],
"comments": Array [],
@@ -43770,7 +43599,7 @@ Object {
},
"range": Array [
0,
- 58,
+ 41,
],
"sourceType": "module",
"tokens": Array [
@@ -43795,7 +43624,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 10,
"line": 1,
},
"start": Object {
@@ -43805,25 +43634,79 @@ Object {
},
"range": Array [
9,
- 16,
+ 10,
],
"type": "Identifier",
- "value": "message",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 16,
- 17,
+ 10,
+ 11,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "Identifier",
+ "value": "X",
+ },
+ 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": "(",
@@ -43831,35 +43714,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 17,
- 21,
+ 14,
+ 15,
],
"type": "Identifier",
- "value": "name",
+ "value": "b",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 21,
- 22,
+ 15,
+ 16,
],
"type": "Punctuator",
"value": ":",
@@ -43867,35 +43750,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 22,
- 28,
+ 17,
+ 18,
],
"type": "Identifier",
- "value": "string",
+ "value": "X",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 19,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 28,
- 29,
+ 18,
+ 19,
],
"type": "Punctuator",
"value": ")",
@@ -43903,17 +43786,17 @@ Object {
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": ":",
@@ -43921,35 +43804,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 36,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 30,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 30,
- 36,
+ 21,
+ 22,
],
"type": "Identifier",
- "value": "string",
+ "value": "X",
},
Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 37,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 37,
- 38,
+ 23,
+ 24,
],
"type": "Punctuator",
"value": "{",
@@ -43966,8 +43849,8 @@ Object {
},
},
"range": Array [
- 43,
- 49,
+ 29,
+ 35,
],
"type": "Keyword",
"value": "return",
@@ -43975,7 +43858,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 12,
"line": 2,
},
"start": Object {
@@ -43984,26 +43867,26 @@ Object {
},
},
"range": Array [
- 50,
- 54,
+ 36,
+ 37,
],
"type": "Identifier",
- "value": "name",
+ "value": "b",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 13,
"line": 2,
},
"start": Object {
- "column": 15,
+ "column": 12,
"line": 2,
},
},
"range": Array [
- 54,
- 55,
+ 37,
+ 38,
],
"type": "Punctuator",
"value": ";",
@@ -44020,8 +43903,8 @@ Object {
},
},
"range": Array [
- 56,
- 57,
+ 39,
+ 40,
],
"type": "Punctuator",
"value": "}",
@@ -44031,62 +43914,26 @@ Object {
}
`;
-exports[`typescript fixtures/basics/function-with-types-assignation.src 1`] = `
+exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = `
Object {
"body": Array [
Object {
"async": false,
"body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "name": "name",
- "range": Array [
- 89,
- 93,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 2,
- "line": 2,
- },
- },
- "range": Array [
- 82,
- 94,
- ],
- "type": "ReturnStatement",
- },
- ],
+ "body": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 35,
+ "line": 1,
},
"start": Object {
- "column": 78,
+ "column": 33,
"line": 1,
},
},
"range": Array [
- 78,
- 96,
+ 33,
+ 35,
],
"type": "BlockStatement",
},
@@ -44103,7 +43950,7 @@ Object {
"line": 1,
},
},
- "name": "message",
+ "name": "compare",
"range": Array [
9,
16,
@@ -44112,325 +43959,100 @@ Object {
},
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 35,
+ "line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 17,
- "line": 1,
- },
- },
- "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",
- },
+ "params": Array [],
+ "range": Array [
+ 0,
+ 35,
+ ],
+ "type": "FunctionDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 1,
},
},
- Object {
- "left": Object {
+ "params": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 40,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 30,
+ "column": 28,
"line": 1,
},
},
- "name": "age",
- "range": Array [
- 30,
- 40,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
+ "name": Object {
"loc": Object {
"end": Object {
- "column": 40,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 33,
+ "column": 28,
"line": 1,
},
},
+ "name": "T",
"range": Array [
- 33,
- 40,
+ 28,
+ 29,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 40,
- "line": 1,
- },
- "start": Object {
- "column": 34,
- "line": 1,
- },
- },
- "range": Array [
- 34,
- 40,
- ],
- "type": "TSNumberKeyword",
- },
- },
- },
- "loc": Object {
- "end": Object {
- "column": 46,
- "line": 1,
- },
- "start": Object {
- "column": 30,
- "line": 1,
- },
- },
- "range": Array [
- 30,
- 46,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 46,
- "line": 1,
- },
- "start": Object {
- "column": 43,
- "line": 1,
- },
- },
- "range": Array [
- 43,
- 46,
- ],
- "raw": "100",
- "type": "Literal",
- "value": 100,
- },
- "type": "AssignmentPattern",
- },
- Object {
- "argument": Object {
- "loc": Object {
- "end": Object {
- "column": 55,
- "line": 1,
- },
- "start": Object {
- "column": 51,
- "line": 1,
- },
- },
- "name": "args",
- "range": Array [
- 51,
- 55,
- ],
- "type": "Identifier",
- },
- "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": 69,
- "line": 1,
- },
- "start": Object {
- "column": 55,
- "line": 1,
- },
+ "type": "Identifier",
},
"range": Array [
- 55,
- 69,
+ 28,
+ 29,
],
- "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",
- },
- "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 [
- 0,
- 96,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 77,
- "line": 1,
- },
- "start": Object {
- "column": 70,
- "line": 1,
+ "type": "TSTypeParameter",
},
- },
+ ],
"range": Array [
- 70,
- 77,
+ 16,
+ 30,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 77,
- "line": 1,
- },
- "start": Object {
- "column": 71,
- "line": 1,
- },
- },
- "range": Array [
- 71,
- 77,
- ],
- "type": "TSStringKeyword",
+ "type": "TSTypeParameterDeclaration",
+ },
+ },
+ ],
+ "comments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
},
},
- "type": "FunctionDeclaration",
+ "range": Array [
+ 17,
+ 28,
+ ],
+ "type": "Block",
+ "value": "comment",
},
],
- "comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 4,
+ "column": 35,
+ "line": 1,
},
"start": Object {
"column": 0,
@@ -44439,7 +44061,7 @@ Object {
},
"range": Array [
0,
- 97,
+ 35,
],
"sourceType": "module",
"tokens": Array [
@@ -44477,7 +44099,7 @@ Object {
16,
],
"type": "Identifier",
- "value": "message",
+ "value": "compare",
},
Object {
"loc": Object {
@@ -44495,97 +44117,79 @@ Object {
17,
],
"type": "Punctuator",
- "value": "(",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 17,
- 21,
+ 28,
+ 29,
],
"type": "Identifier",
- "value": "name",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 30,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 29,
"line": 1,
},
},
"range": Array [
- 21,
- 22,
+ 29,
+ 30,
],
"type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "range": Array [
- 22,
- 28,
- ],
- "type": "Identifier",
- "value": "string",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 31,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 30,
"line": 1,
},
},
"range": Array [
- 28,
- 29,
+ 30,
+ 31,
],
"type": "Punctuator",
- "value": ",",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
+ "column": 32,
"line": 1,
},
"start": Object {
- "column": 30,
+ "column": 31,
"line": 1,
},
},
"range": Array [
- 30,
- 33,
+ 31,
+ 32,
],
- "type": "Identifier",
- "value": "age",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
@@ -44603,12 +44207,12 @@ Object {
34,
],
"type": "Punctuator",
- "value": ":",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 40,
+ "column": 35,
"line": 1,
},
"start": Object {
@@ -44618,205 +44222,555 @@ Object {
},
"range": Array [
34,
- 40,
+ 35,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Punctuator",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = `
+Object {
+ "body": Array [
Object {
- "loc": Object {
- "end": Object {
- "column": 42,
- "line": 1,
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "name": "b",
+ "range": Array [
+ 47,
+ 48,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 40,
+ 49,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 34,
+ "line": 1,
+ },
},
- "start": Object {
- "column": 41,
- "line": 1,
+ "range": Array [
+ 34,
+ 51,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
},
+ "name": "a",
+ "range": Array [
+ 9,
+ 10,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 41,
- 42,
- ],
- "type": "Punctuator",
- "value": "=",
- },
- Object {
"loc": Object {
"end": Object {
- "column": 46,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 43,
+ "column": 0,
"line": 1,
},
},
- "range": Array [
- 43,
- 46,
- ],
- "type": "Numeric",
- "value": "100",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 47,
- "line": 1,
- },
- "start": Object {
- "column": 46,
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "name": "b",
+ "range": Array [
+ 25,
+ 29,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 29,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 29,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "name": "X",
+ "range": Array [
+ 28,
+ 29,
+ ],
+ "type": "Identifier",
+ },
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 0,
+ 51,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 33,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 32,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 32,
+ 33,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 32,
+ "line": 1,
+ },
+ },
+ "name": "X",
+ "range": Array [
+ 32,
+ 33,
+ ],
+ "type": "Identifier",
+ },
+ },
+ },
+ "type": "FunctionDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "constraint": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "members": Array [],
+ "range": Array [
+ 21,
+ 23,
+ ],
+ "type": "TSTypeLiteral",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "name": "X",
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 11,
+ 23,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 10,
+ 24,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 52,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 46,
- 47,
+ 0,
+ 8,
],
- "type": "Punctuator",
- "value": ",",
+ "type": "Keyword",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 51,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 48,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 48,
- 51,
+ 9,
+ 10,
+ ],
+ "type": "Identifier",
+ "value": "a",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 11,
],
"type": "Punctuator",
- "value": "...",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 55,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 51,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 51,
- 55,
+ 11,
+ 12,
],
"type": "Identifier",
- "value": "args",
+ "value": "X",
},
Object {
"loc": Object {
"end": Object {
- "column": 56,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 55,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 55,
- 56,
+ 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": ":",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 61,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 56,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 56,
- 61,
+ 22,
+ 23,
],
- "type": "Identifier",
- "value": "Array",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 62,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 61,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 61,
- 62,
+ 23,
+ 24,
],
"type": "Punctuator",
- "value": "<",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 68,
+ "column": 25,
"line": 1,
},
"start": Object {
- "column": 62,
+ "column": 24,
"line": 1,
},
},
"range": Array [
- 62,
- 68,
+ 24,
+ 25,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 26,
],
"type": "Identifier",
- "value": "string",
+ "value": "b",
},
Object {
"loc": Object {
"end": Object {
- "column": 69,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 68,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 68,
- 69,
+ 26,
+ 27,
],
"type": "Punctuator",
- "value": ">",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 70,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 69,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 69,
- 70,
+ 28,
+ 29,
+ ],
+ "type": "Identifier",
+ "value": "X",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 29,
+ 30,
],
"type": "Punctuator",
"value": ")",
@@ -44824,17 +44778,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 71,
+ "column": 31,
"line": 1,
},
"start": Object {
- "column": 70,
+ "column": 30,
"line": 1,
},
},
"range": Array [
- 70,
- 71,
+ 30,
+ 31,
],
"type": "Punctuator",
"value": ":",
@@ -44842,35 +44796,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 77,
+ "column": 33,
"line": 1,
},
"start": Object {
- "column": 71,
+ "column": 32,
"line": 1,
},
},
"range": Array [
- 71,
- 77,
+ 32,
+ 33,
],
"type": "Identifier",
- "value": "string",
+ "value": "X",
},
Object {
"loc": Object {
"end": Object {
- "column": 79,
+ "column": 35,
"line": 1,
},
"start": Object {
- "column": 78,
+ "column": 34,
"line": 1,
},
},
"range": Array [
- 78,
- 79,
+ 34,
+ 35,
],
"type": "Punctuator",
"value": "{",
@@ -44878,17 +44832,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 10,
"line": 2,
},
"start": Object {
- "column": 2,
+ "column": 4,
"line": 2,
},
},
"range": Array [
- 82,
- 88,
+ 40,
+ 46,
],
"type": "Keyword",
"value": "return",
@@ -44896,35 +44850,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 12,
"line": 2,
},
"start": Object {
- "column": 9,
+ "column": 11,
"line": 2,
},
},
"range": Array [
- 89,
- 93,
+ 47,
+ 48,
],
"type": "Identifier",
- "value": "name",
+ "value": "b",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 13,
"line": 2,
},
"start": Object {
- "column": 13,
+ "column": 12,
"line": 2,
},
},
"range": Array [
- 93,
- 94,
+ 48,
+ 49,
],
"type": "Punctuator",
"value": ";",
@@ -44941,8 +44895,8 @@ Object {
},
},
"range": Array [
- 95,
- 96,
+ 50,
+ 51,
],
"type": "Punctuator",
"value": "}",
@@ -44952,87 +44906,195 @@ Object {
}
`;
-exports[`typescript fixtures/basics/import-equal-declaration.src 1`] = `
+exports[`typescript fixtures/basics/function-with-types.src 1`] = `
Object {
"body": Array [
Object {
- "id": 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": 10,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 7,
+ "column": 37,
"line": 1,
},
},
- "name": "foo",
"range": Array [
- 7,
- 10,
+ 37,
+ 57,
],
- "type": "Identifier",
- },
- "isExport": false,
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
+ "type": "BlockStatement",
},
- "moduleReference": Object {
- "expression": Object {
+ "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": 26,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 17,
"line": 1,
},
},
+ "name": "name",
"range": Array [
- 21,
- 26,
+ 17,
+ 28,
],
- "raw": "'bar'",
- "type": "Literal",
- "value": "bar",
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 21,
+ 28,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 28,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
},
+ ],
+ "range": Array [
+ 0,
+ 57,
+ ],
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 36,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 29,
"line": 1,
},
},
"range": Array [
- 13,
- 27,
+ 29,
+ 36,
],
- "type": "TSExternalModuleReference",
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 36,
+ ],
+ "type": "TSStringKeyword",
+ },
},
- "range": Array [
- 0,
- 28,
- ],
- "type": "TSImportEqualsDeclaration",
+ "type": "FunctionDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 2,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -45041,14 +45103,14 @@ Object {
},
"range": Array [
0,
- 29,
+ 58,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -45058,64 +45120,46 @@ Object {
},
"range": Array [
0,
- 6,
+ 8,
],
"type": "Keyword",
- "value": "import",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 7,
- 10,
+ 9,
+ 16,
],
"type": "Identifier",
- "value": "foo",
+ "value": "message",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 11,
- 12,
+ 16,
+ 17,
],
"type": "Punctuator",
- "value": "=",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 13,
- "line": 1,
- },
- },
- "range": Array [
- 13,
- 20,
- ],
- "type": "Identifier",
- "value": "require",
+ "value": "(",
},
Object {
"loc": Object {
@@ -45124,21 +45168,21 @@ Object {
"line": 1,
},
"start": Object {
- "column": 20,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 20,
+ 17,
21,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "name",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 22,
"line": 1,
},
"start": Object {
@@ -45148,28 +45192,10 @@ Object {
},
"range": Array [
21,
- 26,
- ],
- "type": "String",
- "value": "'bar'",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 1,
- },
- "start": Object {
- "column": 26,
- "line": 1,
- },
- },
- "range": Array [
- 26,
- 27,
+ 22,
],
"type": "Punctuator",
- "value": ")",
+ "value": ":",
},
Object {
"loc": Object {
@@ -45178,543 +45204,566 @@ Object {
"line": 1,
},
"start": Object {
- "column": 27,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 27,
+ 22,
28,
],
- "type": "Punctuator",
- "value": ";",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/import-export-equal-declaration.src 1`] = `
-Object {
- "body": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "name": "foo",
- "range": Array [
- 14,
- 17,
- ],
- "type": "Identifier",
- },
- "isExport": true,
- "loc": Object {
- "end": Object {
- "column": 35,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "moduleReference": Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 1,
- },
- "start": Object {
- "column": 28,
- "line": 1,
- },
- },
- "range": Array [
- 28,
- 33,
- ],
- "raw": "'bar'",
- "type": "Literal",
- "value": "bar",
- },
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 1,
- },
- "start": Object {
- "column": 20,
- "line": 1,
- },
- },
- "range": Array [
- 20,
- 34,
- ],
- "type": "TSExternalModuleReference",
- },
- "range": Array [
- 0,
- 35,
- ],
- "type": "TSImportEqualsDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Identifier",
+ "value": "string",
},
- },
- "range": Array [
- 0,
- 36,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 0,
- 6,
+ 28,
+ 29,
],
- "type": "Keyword",
- "value": "export",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 30,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 29,
"line": 1,
},
},
"range": Array [
- 7,
- 13,
+ 29,
+ 30,
],
- "type": "Keyword",
- "value": "import",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 36,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 30,
"line": 1,
},
},
"range": Array [
- 14,
- 17,
+ 30,
+ 36,
],
"type": "Identifier",
- "value": "foo",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 38,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 37,
"line": 1,
},
},
"range": Array [
- 18,
- 19,
+ 37,
+ 38,
],
"type": "Punctuator",
- "value": "=",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 1,
- },
- "start": Object {
- "column": 20,
- "line": 1,
- },
- },
- "range": Array [
- 20,
- 27,
- ],
- "type": "Identifier",
- "value": "require",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 1,
+ "column": 10,
+ "line": 2,
},
"start": Object {
- "column": 27,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 27,
- 28,
+ 43,
+ 49,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Keyword",
+ "value": "return",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
- "line": 1,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 28,
- "line": 1,
+ "column": 11,
+ "line": 2,
},
},
"range": Array [
- 28,
- 33,
+ 50,
+ 54,
],
- "type": "String",
- "value": "'bar'",
+ "type": "Identifier",
+ "value": "name",
},
Object {
"loc": Object {
"end": Object {
- "column": 34,
- "line": 1,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 33,
- "line": 1,
+ "column": 15,
+ "line": 2,
},
},
"range": Array [
- 33,
- 34,
+ 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": ";",
+ "value": "}",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/import-type.src 1`] = `
+exports[`typescript fixtures/basics/function-with-types-assignation.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,
+ },
+ },
+ "name": "name",
+ "range": Array [
+ 89,
+ 93,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 82,
+ 94,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 78,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 78,
+ 96,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
"id": Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 9,
"line": 1,
},
},
- "name": "A",
+ "name": "message",
"range": Array [
- 5,
- 6,
+ 9,
+ 16,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 28,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
"line": 1,
},
},
- "range": Array [
- 0,
- 28,
- ],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "isTypeOf": true,
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "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",
+ },
},
},
- "parameter": Object {
- "literal": Object {
+ Object {
+ "left": Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 40,
"line": 1,
},
"start": Object {
- "column": 23,
+ "column": 30,
"line": 1,
},
},
+ "name": "age",
"range": Array [
- 23,
- 26,
+ 30,
+ 40,
],
- "raw": "'A'",
- "type": "Literal",
- "value": "A",
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 40,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 33,
+ 40,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 40,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 34,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 34,
+ 40,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ },
},
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 46,
"line": 1,
},
"start": Object {
- "column": 23,
+ "column": 30,
"line": 1,
},
},
"range": Array [
- 23,
- 26,
+ 30,
+ 46,
],
- "type": "TSLiteralType",
- },
- "qualifier": null,
- "range": Array [
- 9,
- 27,
- ],
- "type": "TSImportType",
- "typeParameters": null,
- },
- },
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 6,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "B",
- "range": Array [
- 34,
- 35,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 2,
- },
- },
- "range": Array [
- 29,
- 55,
- ],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "isTypeOf": false,
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "parameter": Object {
- "literal": Object {
+ "right": Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 2,
+ "column": 46,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 2,
+ "column": 43,
+ "line": 1,
},
},
"range": Array [
- 45,
- 48,
+ 43,
+ 46,
],
- "raw": "\\"B\\"",
+ "raw": "100",
"type": "Literal",
- "value": "B",
+ "value": 100,
},
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
+ "type": "AssignmentPattern",
+ },
+ Object {
+ "argument": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 55,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 51,
+ "line": 1,
+ },
},
+ "name": "args",
+ "range": Array [
+ 51,
+ 55,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 45,
- 48,
- ],
- "type": "TSLiteralType",
- },
- "qualifier": Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 2,
+ "column": 69,
+ "line": 1,
},
"start": Object {
- "column": 21,
- "line": 2,
+ "column": 48,
+ "line": 1,
},
},
- "name": "X",
"range": Array [
- 50,
- 51,
+ 48,
+ 69,
],
- "type": "Identifier",
- },
- "range": Array [
- 38,
- 54,
- ],
- "type": "TSImportType",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 2,
- },
- "start": Object {
- "column": 22,
- "line": 2,
+ "type": "RestElement",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 69,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 55,
+ "line": 1,
+ },
},
- },
- "params": Array [
- Object {
+ "range": Array [
+ 55,
+ 69,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 2,
+ "column": 69,
+ "line": 1,
},
"start": Object {
- "column": 23,
- "line": 2,
+ "column": 56,
+ "line": 1,
},
},
"range": Array [
- 52,
- 53,
+ 56,
+ 69,
],
"type": "TSTypeReference",
"typeName": Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 2,
+ "column": 61,
+ "line": 1,
},
"start": Object {
- "column": 23,
- "line": 2,
+ "column": 56,
+ "line": 1,
},
},
- "name": "Y",
+ "name": "Array",
"range": Array [
- 52,
- 53,
+ 56,
+ 61,
],
"type": "Identifier",
},
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 69,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 61,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 68,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 62,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 62,
+ 68,
+ ],
+ "type": "TSStringKeyword",
+ },
+ ],
+ "range": Array [
+ 61,
+ 69,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
},
- ],
+ },
+ },
+ ],
+ "range": Array [
+ 0,
+ 96,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 77,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 70,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 70,
+ 77,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 77,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 71,
+ "line": 1,
+ },
+ },
"range": Array [
- 51,
- 54,
+ 71,
+ 77,
],
- "type": "TSTypeParameterInstantiation",
+ "type": "TSStringKeyword",
},
},
+ "type": "FunctionDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 3,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -45723,14 +45772,14 @@ Object {
},
"range": Array [
0,
- 56,
+ 97,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -45740,64 +45789,64 @@ Object {
},
"range": Array [
0,
- 4,
+ 8,
],
- "type": "Identifier",
- "value": "type",
+ "type": "Keyword",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 5,
- 6,
+ 9,
+ 16,
],
"type": "Identifier",
- "value": "A",
+ "value": "message",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 7,
- 8,
+ 16,
+ 17,
],
"type": "Punctuator",
- "value": "=",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 9,
- 15,
+ 17,
+ 21,
],
- "type": "Keyword",
- "value": "typeof",
+ "type": "Identifier",
+ "value": "name",
},
Object {
"loc": Object {
@@ -45806,21 +45855,21 @@ Object {
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 16,
+ 21,
22,
],
- "type": "Keyword",
- "value": "import",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 28,
"line": 1,
},
"start": Object {
@@ -45830,187 +45879,277 @@ Object {
},
"range": Array [
22,
- 23,
+ 28,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 23,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 23,
- 26,
+ 28,
+ 29,
],
- "type": "String",
- "value": "'A'",
+ "type": "Punctuator",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 33,
"line": 1,
},
"start": Object {
- "column": 26,
+ "column": 30,
"line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 30,
+ 33,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "age",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 34,
"line": 1,
},
"start": Object {
- "column": 27,
+ "column": 33,
"line": 1,
},
},
"range": Array [
- 27,
- 28,
+ 33,
+ 34,
],
"type": "Punctuator",
- "value": ";",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 2,
+ "column": 40,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 2,
+ "column": 34,
+ "line": 1,
},
},
"range": Array [
- 29,
- 33,
+ 34,
+ 40,
],
"type": "Identifier",
- "value": "type",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
- "line": 2,
+ "column": 42,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 2,
+ "column": 41,
+ "line": 1,
},
},
"range": Array [
- 34,
- 35,
+ 41,
+ 42,
],
- "type": "Identifier",
- "value": "B",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 2,
+ "column": 46,
+ "line": 1,
},
"start": Object {
- "column": 7,
- "line": 2,
+ "column": 43,
+ "line": 1,
},
},
"range": Array [
- 36,
- 37,
+ 43,
+ 46,
+ ],
+ "type": "Numeric",
+ "value": "100",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 47,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 46,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 46,
+ 47,
],
"type": "Punctuator",
- "value": "=",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 2,
+ "column": 51,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 2,
+ "column": 48,
+ "line": 1,
},
},
"range": Array [
- 38,
- 44,
+ 48,
+ 51,
],
- "type": "Keyword",
- "value": "import",
+ "type": "Punctuator",
+ "value": "...",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 2,
+ "column": 55,
+ "line": 1,
},
"start": Object {
- "column": 15,
- "line": 2,
+ "column": 51,
+ "line": 1,
},
},
"range": Array [
- 44,
- 45,
+ 51,
+ 55,
+ ],
+ "type": "Identifier",
+ "value": "args",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 56,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 55,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 55,
+ 56,
],
"type": "Punctuator",
- "value": "(",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 2,
+ "column": 61,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 2,
+ "column": 56,
+ "line": 1,
},
},
"range": Array [
- 45,
- 48,
+ 56,
+ 61,
],
- "type": "String",
- "value": "\\"B\\"",
+ "type": "Identifier",
+ "value": "Array",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 2,
+ "column": 62,
+ "line": 1,
},
"start": Object {
- "column": 19,
- "line": 2,
+ "column": 61,
+ "line": 1,
},
},
"range": Array [
- 48,
- 49,
+ 61,
+ 62,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 68,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 62,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 62,
+ 68,
+ ],
+ "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": ")",
@@ -46018,141 +46157,160 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 2,
+ "column": 71,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 2,
+ "column": 70,
+ "line": 1,
},
},
"range": Array [
- 49,
- 50,
+ 70,
+ 71,
],
"type": "Punctuator",
- "value": ".",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 2,
+ "column": 77,
+ "line": 1,
},
"start": Object {
- "column": 21,
- "line": 2,
+ "column": 71,
+ "line": 1,
},
},
"range": Array [
- 50,
- 51,
+ 71,
+ 77,
],
"type": "Identifier",
- "value": "X",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 2,
+ "column": 79,
+ "line": 1,
},
"start": Object {
- "column": 22,
- "line": 2,
+ "column": 78,
+ "line": 1,
},
},
"range": Array [
- 51,
- 52,
+ 78,
+ 79,
],
"type": "Punctuator",
- "value": "<",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 8,
"line": 2,
},
"start": Object {
- "column": 23,
+ "column": 2,
"line": 2,
},
},
"range": Array [
- 52,
- 53,
+ 82,
+ 88,
],
- "type": "Identifier",
- "value": "Y",
+ "type": "Keyword",
+ "value": "return",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 13,
"line": 2,
},
"start": Object {
- "column": 24,
+ "column": 9,
"line": 2,
},
},
"range": Array [
- 53,
- 54,
+ 89,
+ 93,
],
- "type": "Punctuator",
- "value": ">",
+ "type": "Identifier",
+ "value": "name",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 14,
"line": 2,
},
"start": Object {
- "column": 25,
+ "column": 13,
"line": 2,
},
},
"range": Array [
- 54,
- 55,
+ 93,
+ 94,
],
"type": "Punctuator",
"value": ";",
},
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 95,
+ 96,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/import-type-with-type-parameters-in-type-reference.src 1`] = `
+exports[`typescript fixtures/basics/import-equal-declaration.src 1`] = `
Object {
"body": Array [
Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 7,
"line": 1,
},
},
- "name": "X",
+ "name": "foo",
"range": Array [
- 5,
- 6,
+ 7,
+ 10,
],
"type": "Identifier",
},
+ "isExport": false,
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 28,
"line": 1,
},
"start": Object {
@@ -46160,173 +46318,47 @@ Object {
"line": 1,
},
},
- "range": Array [
- 0,
- 30,
- ],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "range": Array [
- 9,
- 29,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
+ "moduleReference": Object {
+ "expression": Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 21,
"line": 1,
},
},
- "name": "A",
"range": Array [
- 9,
- 10,
+ 21,
+ 26,
],
- "type": "Identifier",
+ "raw": "'bar'",
+ "type": "Literal",
+ "value": "bar",
},
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
},
- "params": Array [
- Object {
- "isTypeOf": false,
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "parameter": Object {
- "literal": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
- },
- "range": Array [
- 18,
- 20,
- ],
- "raw": "\\"\\"",
- "type": "Literal",
- "value": "",
- },
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
- },
- "range": Array [
- 18,
- 20,
- ],
- "type": "TSLiteralType",
- },
- "qualifier": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "name": "B",
- "range": Array [
- 22,
- 23,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 11,
- 28,
- ],
- "type": "TSImportType",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 23,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 1,
- },
- "start": Object {
- "column": 24,
- "line": 1,
- },
- },
- "range": Array [
- 24,
- 27,
- ],
- "type": "TSAnyKeyword",
- },
- ],
- "range": Array [
- 23,
- 28,
- ],
- "type": "TSTypeParameterInstantiation",
- },
- },
- ],
- "range": Array [
- 10,
- 29,
- ],
- "type": "TSTypeParameterInstantiation",
},
+ "range": Array [
+ 13,
+ 27,
+ ],
+ "type": "TSExternalModuleReference",
},
+ "range": Array [
+ 0,
+ 28,
+ ],
+ "type": "TSImportEqualsDeclaration",
},
],
"comments": Array [],
@@ -46342,14 +46374,14 @@ Object {
},
"range": Array [
0,
- 31,
+ 29,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 6,
"line": 1,
},
"start": Object {
@@ -46359,43 +46391,43 @@ Object {
},
"range": Array [
0,
- 4,
+ 6,
],
- "type": "Identifier",
- "value": "type",
+ "type": "Keyword",
+ "value": "import",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 5,
- 6,
+ 7,
+ 10,
],
"type": "Identifier",
- "value": "X",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 7,
- 8,
+ 11,
+ 12,
],
"type": "Punctuator",
"value": "=",
@@ -46403,164 +46435,262 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 13,
+ 20,
],
"type": "Identifier",
- "value": "A",
+ "value": "require",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 10,
- 11,
+ 20,
+ 21,
],
"type": "Punctuator",
- "value": "<",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 11,
- 17,
+ 21,
+ 26,
],
- "type": "Keyword",
- "value": "import",
+ "type": "String",
+ "value": "'bar'",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 17,
- 18,
+ 26,
+ 27,
],
"type": "Punctuator",
- "value": "(",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 27,
"line": 1,
},
},
"range": Array [
- 18,
- 20,
+ 27,
+ 28,
],
- "type": "String",
- "value": "\\"\\"",
+ "type": "Punctuator",
+ "value": ";",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/import-export-equal-declaration.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 14,
+ 17,
+ ],
+ "type": "Identifier",
+ },
+ "isExport": true,
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 35,
"line": 1,
},
"start": Object {
- "column": 20,
+ "column": 0,
"line": 1,
},
},
+ "moduleReference": Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 33,
+ ],
+ "raw": "'bar'",
+ "type": "Literal",
+ "value": "bar",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 20,
+ 34,
+ ],
+ "type": "TSExternalModuleReference",
+ },
"range": Array [
- 20,
- 21,
+ 0,
+ 35,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "TSImportEqualsDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
},
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 36,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 6,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 21,
- 22,
+ 0,
+ 6,
],
- "type": "Punctuator",
- "value": ".",
+ "type": "Keyword",
+ "value": "export",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 22,
- 23,
+ 7,
+ 13,
+ ],
+ "type": "Keyword",
+ "value": "import",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 17,
],
"type": "Identifier",
- "value": "B",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 19,
"line": 1,
},
"start": Object {
- "column": 23,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 23,
- 24,
+ 18,
+ 19,
],
"type": "Punctuator",
- "value": "<",
+ "value": "=",
},
Object {
"loc": Object {
@@ -46569,16 +46699,16 @@ Object {
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 24,
+ 20,
27,
],
"type": "Identifier",
- "value": "any",
+ "value": "require",
},
Object {
"loc": Object {
@@ -46596,12 +46726,12 @@ Object {
28,
],
"type": "Punctuator",
- "value": ">",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 33,
"line": 1,
},
"start": Object {
@@ -46611,25 +46741,43 @@ Object {
},
"range": Array [
28,
- 29,
+ 33,
+ ],
+ "type": "String",
+ "value": "'bar'",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 33,
+ 34,
],
"type": "Punctuator",
- "value": ">",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 35,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 34,
"line": 1,
},
},
"range": Array [
- 29,
- 30,
+ 34,
+ 35,
],
"type": "Punctuator",
"value": ";",
@@ -46639,105 +46787,267 @@ Object {
}
`;
-exports[`typescript fixtures/basics/interface-extends.src 1`] = `
+exports[`typescript fixtures/basics/import-type.src 1`] = `
Object {
"body": Array [
Object {
- "body": Object {
- "body": Array [],
+ "id": Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 6,
+ "line": 1,
},
"start": Object {
- "column": 26,
+ "column": 5,
"line": 1,
},
},
+ "name": "A",
"range": Array [
- 26,
- 30,
+ 5,
+ 6,
],
- "type": "TSInterfaceBody",
+ "type": "Identifier",
},
- "extends": Array [
- Object {
- "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 28,
+ ],
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "isTypeOf": true,
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "parameter": Object {
+ "literal": Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 23,
"line": 1,
},
},
- "name": "Bar",
"range": Array [
- 22,
- 25,
+ 23,
+ 26,
],
- "type": "Identifier",
+ "raw": "'A'",
+ "type": "Literal",
+ "value": "A",
},
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 22,
- 25,
+ 23,
+ 26,
],
- "type": "TSInterfaceHeritage",
+ "type": "TSLiteralType",
},
- ],
+ "qualifier": null,
+ "range": Array [
+ 9,
+ 27,
+ ],
+ "type": "TSImportType",
+ "typeParameters": null,
+ },
+ },
+ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 1,
+ "column": 6,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
},
- "name": "Foo",
+ "name": "B",
"range": Array [
- 10,
- 13,
+ 34,
+ 35,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 26,
+ "line": 2,
},
"start": Object {
"column": 0,
- "line": 1,
+ "line": 2,
},
},
"range": Array [
- 0,
- 30,
+ 29,
+ 55,
],
- "type": "TSInterfaceDeclaration",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "isTypeOf": false,
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "parameter": Object {
+ "literal": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 45,
+ 48,
+ ],
+ "raw": "\\"B\\"",
+ "type": "Literal",
+ "value": "B",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 45,
+ 48,
+ ],
+ "type": "TSLiteralType",
+ },
+ "qualifier": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 2,
+ },
+ },
+ "name": "X",
+ "range": Array [
+ 50,
+ 51,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 38,
+ 54,
+ ],
+ "type": "TSImportType",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 52,
+ 53,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "name": "Y",
+ "range": Array [
+ 52,
+ 53,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
+ "range": Array [
+ 51,
+ 54,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 4,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -46746,14 +47056,14 @@ Object {
},
"range": Array [
0,
- 31,
+ 56,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 4,
"line": 1,
},
"start": Object {
@@ -46763,579 +47073,331 @@ Object {
},
"range": Array [
0,
- 9,
+ 4,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 6,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 10,
- 13,
+ 5,
+ 6,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 14,
- 21,
+ 7,
+ 8,
],
- "type": "Keyword",
- "value": "extends",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 15,
"line": 1,
},
"start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 15,
+ ],
+ "type": "Keyword",
+ "value": "typeof",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
"column": 22,
"line": 1,
},
+ "start": Object {
+ "column": 16,
+ "line": 1,
+ },
},
"range": Array [
+ 16,
22,
- 25,
],
- "type": "Identifier",
- "value": "Bar",
+ "type": "Keyword",
+ "value": "import",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 26,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 22,
+ 23,
],
"type": "Punctuator",
- "value": "{",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 26,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 23,
+ "line": 1,
},
},
"range": Array [
- 29,
- 30,
+ 23,
+ 26,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "String",
+ "value": "'A'",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/interface-extends-multiple.src 1`] = `
-Object {
- "body": Array [
- Object {
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 30,
- "line": 1,
- },
- },
- "range": Array [
- 30,
- 34,
- ],
- "type": "TSInterfaceBody",
- },
- "extends": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "name": "Bar",
- "range": Array [
- 22,
- 25,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "range": Array [
- 22,
- 25,
- ],
- "type": "TSInterfaceHeritage",
- },
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 26,
- "line": 1,
- },
- },
- "name": "Baz",
- "range": Array [
- 26,
- 29,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 26,
- "line": 1,
- },
- },
- "range": Array [
- 26,
- 29,
- ],
- "type": "TSInterfaceHeritage",
- },
- ],
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 10,
- 13,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 34,
- ],
- "type": "TSInterfaceDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 35,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 0,
- 9,
+ 26,
+ 27,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 27,
"line": 1,
},
},
"range": Array [
- 10,
- 13,
+ 27,
+ 28,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Punctuator",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 14,
- 21,
+ 29,
+ 33,
],
- "type": "Keyword",
- "value": "extends",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 1,
+ "column": 6,
+ "line": 2,
},
"start": Object {
- "column": 22,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
},
"range": Array [
- 22,
- 25,
+ 34,
+ 35,
],
"type": "Identifier",
- "value": "Bar",
+ "value": "B",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 1,
+ "column": 8,
+ "line": 2,
},
"start": Object {
- "column": 25,
- "line": 1,
+ "column": 7,
+ "line": 2,
},
},
"range": Array [
- 25,
- 26,
+ 36,
+ 37,
],
"type": "Punctuator",
- "value": ",",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 1,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 26,
- "line": 1,
+ "column": 9,
+ "line": 2,
},
},
"range": Array [
- 26,
- 29,
+ 38,
+ 44,
],
- "type": "Identifier",
- "value": "Baz",
+ "type": "Keyword",
+ "value": "import",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 1,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 30,
- "line": 1,
+ "column": 15,
+ "line": 2,
},
},
"range": Array [
- 30,
- 31,
+ 44,
+ 45,
],
"type": "Punctuator",
- "value": "{",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 19,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 16,
+ "line": 2,
},
},
"range": Array [
- 33,
- 34,
+ 45,
+ 48,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "String",
+ "value": "\\"B\\"",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/interface-type-parameters.src 1`] = `
-Object {
- "body": Array [
Object {
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 17,
- "line": 1,
- },
- },
- "range": Array [
- 17,
- 21,
- ],
- "type": "TSInterfaceBody",
- },
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 10,
- 13,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
},
"range": Array [
- 0,
- 21,
+ 48,
+ 49,
],
- "type": "TSInterfaceDeclaration",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 13,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 14,
- 15,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 14,
- 15,
- ],
- "type": "TSTypeParameter",
- },
- ],
- "range": Array [
- 13,
- 16,
- ],
- "type": "TSTypeParameterDeclaration",
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": ")",
},
- },
- "range": Array [
- 0,
- 22,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 1,
+ "column": 21,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
},
"range": Array [
- 0,
- 9,
+ 49,
+ 50,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "Punctuator",
+ "value": ".",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 1,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 1,
+ "column": 21,
+ "line": 2,
},
},
"range": Array [
- 10,
- 13,
+ 50,
+ 51,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "X",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 1,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 13,
- "line": 1,
+ "column": 22,
+ "line": 2,
},
},
"range": Array [
- 13,
- 14,
+ 51,
+ 52,
],
"type": "Punctuator",
"value": "<",
@@ -47343,35 +47405,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 1,
+ "column": 24,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 23,
+ "line": 2,
},
},
"range": Array [
- 14,
- 15,
+ 52,
+ 53,
],
"type": "Identifier",
- "value": "T",
+ "value": "Y",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 25,
+ "line": 2,
},
"start": Object {
- "column": 15,
- "line": 1,
+ "column": 24,
+ "line": 2,
},
},
"range": Array [
- 15,
- 16,
+ 53,
+ 54,
],
"type": "Punctuator",
"value": ">",
@@ -47379,613 +47441,7273 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 1,
+ "column": 26,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 1,
+ "column": 25,
+ "line": 2,
},
},
"range": Array [
- 17,
- 18,
+ 54,
+ 55,
],
"type": "Punctuator",
- "value": "{",
+ "value": ";",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/import-type-with-type-parameters-in-type-reference.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": 1,
- "line": 3,
+ "column": 30,
+ "line": 1,
},
"start": Object {
"column": 0,
- "line": 3,
+ "line": 1,
},
},
"range": Array [
- 20,
- 21,
- ],
- "type": "Punctuator",
- "value": "}",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/interface-with-all-property-types.src 1`] = `
-Object {
- "body": Array [
- Object {
- "body": Object {
- "body": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "name": "baa",
- "range": Array [
- 20,
- 23,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
+ 0,
+ 30,
+ ],
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 29,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
},
- "range": Array [
- 20,
- 32,
- ],
- "type": "TSPropertySignature",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 7,
- "line": 2,
- },
- },
- "range": Array [
- 23,
- 31,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "range": Array [
- 25,
- 31,
- ],
- "type": "TSNumberKeyword",
- },
+ "start": Object {
+ "column": 9,
+ "line": 1,
},
},
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "name": "bar",
- "range": Array [
- 37,
- 40,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
+ "name": "A",
+ "range": Array [
+ 9,
+ 10,
+ ],
+ "type": "Identifier",
+ },
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
},
- "optional": true,
- "range": Array [
- 37,
- 50,
- ],
- "type": "TSPropertySignature",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "range": Array [
- 41,
- 49,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 3,
- },
- "start": Object {
- "column": 10,
- "line": 3,
- },
- },
- "range": Array [
- 43,
- 49,
- ],
- "type": "TSNumberKeyword",
- },
+ "start": Object {
+ "column": 10,
+ "line": 1,
},
},
- Object {
- "computed": true,
- "key": Object {
+ "params": Array [
+ Object {
+ "isTypeOf": false,
"loc": Object {
"end": Object {
- "column": 8,
- "line": 4,
+ "column": 28,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 4,
+ "column": 11,
+ "line": 1,
},
},
- "name": "bax",
- "range": Array [
- 56,
- 59,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 4,
- },
- "start": Object {
- "column": 4,
- "line": 4,
- },
- },
- "range": Array [
- 55,
- 69,
- ],
- "type": "TSPropertySignature",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 4,
- },
- "start": Object {
- "column": 9,
- "line": 4,
+ "parameter": Object {
+ "literal": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 20,
+ ],
+ "raw": "\\"\\"",
+ "type": "Literal",
+ "value": "",
},
- },
- "range": Array [
- 60,
- 68,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 4,
+ "column": 20,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 4,
+ "column": 18,
+ "line": 1,
},
},
"range": Array [
- 62,
- 68,
+ 18,
+ 20,
],
- "type": "TSStringKeyword",
- },
- },
- },
- Object {
- "computed": true,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 5,
- },
- "start": Object {
- "column": 5,
- "line": 5,
- },
- },
- "name": "baz",
- "range": Array [
- 75,
- 78,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 5,
- },
- "start": Object {
- "column": 4,
- "line": 5,
- },
- },
- "optional": true,
- "range": Array [
- 74,
- 89,
- ],
- "type": "TSPropertySignature",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 5,
- },
- "start": Object {
- "column": 10,
- "line": 5,
- },
+ "type": "TSLiteralType",
},
- "range": Array [
- 80,
- 88,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "qualifier": Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 5,
+ "column": 23,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 5,
+ "column": 22,
+ "line": 1,
},
},
+ "name": "B",
"range": Array [
- 82,
- 88,
+ 22,
+ 23,
],
- "type": "TSStringKeyword",
- },
- },
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 6,
- },
- "start": Object {
- "column": 4,
- "line": 6,
+ "type": "Identifier",
},
- },
- "parameters": Array [
- Object {
+ "range": Array [
+ 11,
+ 28,
+ ],
+ "type": "TSImportType",
+ "typeParameters": Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 6,
+ "column": 28,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 6,
+ "column": 23,
+ "line": 1,
},
},
- "name": "eee",
- "range": Array [
- 95,
- 106,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 6,
- },
- "start": Object {
- "column": 8,
- "line": 6,
- },
- },
- "range": Array [
- 98,
- 106,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "params": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 6,
+ "column": 27,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 6,
+ "column": 24,
+ "line": 1,
},
},
"range": Array [
- 100,
- 106,
+ 24,
+ 27,
],
- "type": "TSNumberKeyword",
- },
- },
- },
- ],
- "range": Array [
- 94,
- 116,
- ],
- "type": "TSIndexSignature",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 6,
- },
- "start": Object {
- "column": 17,
- "line": 6,
- },
- },
- "range": Array [
- 107,
- 115,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 6,
- },
- "start": Object {
- "column": 19,
- "line": 6,
+ "type": "TSAnyKeyword",
},
- },
+ ],
"range": Array [
- 109,
- 115,
+ 23,
+ 28,
],
- "type": "TSStringKeyword",
- },
- },
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 7,
- },
- "start": Object {
- "column": 4,
- "line": 7,
+ "type": "TSTypeParameterInstantiation",
},
},
- "parameters": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 7,
- },
- "start": Object {
- "column": 5,
- "line": 7,
- },
- },
- "name": "fff",
- "optional": true,
- "range": Array [
- 122,
- 134,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 7,
- },
- "start": Object {
- "column": 9,
- "line": 7,
- },
- },
- "range": Array [
- 126,
- 134,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 7,
- },
- "start": Object {
+ ],
+ "range": Array [
+ 10,
+ 29,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 31,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 4,
+ ],
+ "type": "Identifier",
+ "value": "type",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 5,
+ 6,
+ ],
+ "type": "Identifier",
+ "value": "X",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 8,
+ ],
+ "type": "Punctuator",
+ "value": "=",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 10,
+ ],
+ "type": "Identifier",
+ "value": "A",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 11,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 17,
+ ],
+ "type": "Keyword",
+ "value": "import",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 18,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 20,
+ ],
+ "type": "String",
+ "value": "\\"\\"",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 21,
+ 22,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 23,
+ ],
+ "type": "Identifier",
+ "value": "B",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 23,
+ 24,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 24,
+ 27,
+ ],
+ "type": "Identifier",
+ "value": "any",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 27,
+ 28,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 29,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 29,
+ 30,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-extends.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 30,
+ ],
+ "type": "TSInterfaceBody",
+ },
+ "extends": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "name": "Bar",
+ "range": Array [
+ 22,
+ 25,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 25,
+ ],
+ "type": "TSInterfaceHeritage",
+ },
+ ],
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 30,
+ ],
+ "type": "TSInterfaceDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 31,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 21,
+ ],
+ "type": "Keyword",
+ "value": "extends",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 25,
+ ],
+ "type": "Identifier",
+ "value": "Bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 27,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 29,
+ 30,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-extends-multiple.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 34,
+ ],
+ "type": "TSInterfaceBody",
+ },
+ "extends": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "name": "Bar",
+ "range": Array [
+ 22,
+ 25,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 25,
+ ],
+ "type": "TSInterfaceHeritage",
+ },
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "name": "Baz",
+ "range": Array [
+ 26,
+ 29,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 29,
+ ],
+ "type": "TSInterfaceHeritage",
+ },
+ ],
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 34,
+ ],
+ "type": "TSInterfaceDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 35,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 21,
+ ],
+ "type": "Keyword",
+ "value": "extends",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 25,
+ ],
+ "type": "Identifier",
+ "value": "Bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 26,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 29,
+ ],
+ "type": "Identifier",
+ "value": "Baz",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 31,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 33,
+ 34,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-type-parameters.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 21,
+ ],
+ "type": "TSInterfaceBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 21,
+ ],
+ "type": "TSInterfaceDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 13,
+ 16,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 22,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Identifier",
+ "value": "T",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 16,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 18,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-with-all-property-types.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "name": "baa",
+ "range": Array [
+ 20,
+ 23,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 20,
+ 32,
+ ],
+ "type": "TSPropertySignature",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 23,
+ 31,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 25,
+ 31,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ },
+ },
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 37,
+ 40,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "optional": true,
+ "range": Array [
+ 37,
+ 50,
+ ],
+ "type": "TSPropertySignature",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 41,
+ 49,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 43,
+ 49,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ },
+ },
+ Object {
+ "computed": true,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 4,
+ },
+ },
+ "name": "bax",
+ "range": Array [
+ 56,
+ 59,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 55,
+ 69,
+ ],
+ "type": "TSPropertySignature",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 60,
+ 68,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 62,
+ 68,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ Object {
+ "computed": true,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 5,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 75,
+ 78,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 5,
+ },
+ },
+ "optional": true,
+ "range": Array [
+ 74,
+ 89,
+ ],
+ "type": "TSPropertySignature",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 80,
+ 88,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 82,
+ 88,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 6,
+ },
+ },
+ "parameters": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 6,
+ },
+ },
+ "name": "eee",
+ "range": Array [
+ 95,
+ 106,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 98,
+ 106,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 100,
+ 106,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 94,
+ 116,
+ ],
+ "type": "TSIndexSignature",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 107,
+ 115,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 109,
+ 115,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 7,
+ },
+ },
+ "parameters": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 7,
+ },
+ },
+ "name": "fff",
+ "optional": true,
+ "range": Array [
+ 122,
+ 134,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 126,
+ 134,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 7,
+ },
+ "start": Object {
"column": 11,
"line": 7,
},
},
"range": Array [
- 128,
- 134,
+ 128,
+ 134,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 121,
+ 144,
+ ],
+ "type": "TSIndexSignature",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 135,
+ 143,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 137,
+ 143,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 8,
+ },
+ },
+ "name": "doo",
+ "range": Array [
+ 149,
+ 152,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 8,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 149,
+ 161,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 154,
+ 160,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 156,
+ 160,
+ ],
+ "type": "TSVoidKeyword",
+ },
+ },
+ "type": "TSMethodSignature",
+ },
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 9,
+ },
+ },
+ "name": "doo",
+ "range": Array [
+ 166,
+ 169,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 9,
+ },
+ },
+ "optional": true,
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 9,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 171,
+ 172,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 9,
+ },
+ },
+ "name": "b",
+ "range": Array [
+ 174,
+ 175,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 9,
+ },
+ },
+ "name": "c",
+ "range": Array [
+ 177,
+ 178,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "range": Array [
+ 166,
+ 186,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 179,
+ 185,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 181,
+ 185,
+ ],
+ "type": "TSVoidKeyword",
+ },
+ },
+ "type": "TSMethodSignature",
+ },
+ Object {
+ "computed": true,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 10,
+ },
+ },
+ "name": "loo",
+ "range": Array [
+ 192,
+ 195,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 10,
+ },
+ },
+ "optional": true,
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 10,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 198,
+ 199,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 10,
+ },
+ },
+ "name": "b",
+ "range": Array [
+ 201,
+ 202,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 10,
+ },
+ },
+ "name": "c",
+ "range": Array [
+ 204,
+ 205,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "range": Array [
+ 191,
+ 213,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 206,
+ 212,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 208,
+ 212,
+ ],
+ "type": "TSVoidKeyword",
+ },
+ },
+ "type": "TSMethodSignature",
+ },
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 11,
+ },
+ },
+ "name": "boo",
+ "range": Array [
+ 218,
+ 221,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 11,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 11,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 225,
+ 226,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 11,
+ },
+ },
+ "name": "b",
+ "range": Array [
+ 228,
+ 229,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 11,
+ },
+ },
+ "name": "c",
+ "range": Array [
+ 231,
+ 232,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "range": Array [
+ 218,
+ 240,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 233,
+ 239,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 235,
+ 239,
+ ],
+ "type": "TSVoidKeyword",
+ },
+ },
+ "type": "TSMethodSignature",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 11,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 11,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 11,
+ },
+ },
+ "name": "J",
+ "range": Array [
+ 222,
+ 223,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 222,
+ 223,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 221,
+ 224,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 12,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 12,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 250,
+ 251,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 12,
+ },
+ },
+ "name": "b",
+ "optional": true,
+ "range": Array [
+ 253,
+ 255,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "range": Array [
+ 245,
+ 265,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 256,
+ 264,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 258,
+ 264,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ "type": "TSConstructSignatureDeclaration",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 13,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 13,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 278,
+ 279,
+ ],
+ "type": "Identifier",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 13,
+ },
+ },
+ "name": "b",
+ "optional": true,
+ "range": Array [
+ 281,
+ 283,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "range": Array [
+ 270,
+ 293,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 284,
+ 292,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 286,
+ 292,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ "type": "TSConstructSignatureDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 13,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 13,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 13,
+ },
+ },
+ "name": "F",
+ "range": Array [
+ 275,
+ 276,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 275,
+ 276,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 274,
+ 277,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 14,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 295,
+ ],
+ "type": "TSInterfaceBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 14,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 295,
+ ],
+ "type": "TSInterfaceDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 16,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 297,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 20,
+ 23,
+ ],
+ "type": "Identifier",
+ "value": "baa",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 23,
+ 24,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 25,
+ 31,
+ ],
+ "type": "Identifier",
+ "value": "number",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 31,
+ 32,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 37,
+ 40,
+ ],
+ "type": "Identifier",
+ "value": "bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 40,
+ 41,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 41,
+ 42,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 43,
+ 49,
+ ],
+ "type": "Identifier",
+ "value": "number",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 49,
+ 50,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 55,
+ 56,
+ ],
+ "type": "Punctuator",
+ "value": "[",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 56,
+ 59,
+ ],
+ "type": "Identifier",
+ "value": "bax",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 59,
+ 60,
+ ],
+ "type": "Punctuator",
+ "value": "]",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 60,
+ 61,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 62,
+ 68,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 68,
+ 69,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 74,
+ 75,
+ ],
+ "type": "Punctuator",
+ "value": "[",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 75,
+ 78,
+ ],
+ "type": "Identifier",
+ "value": "baz",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 78,
+ 79,
+ ],
+ "type": "Punctuator",
+ "value": "]",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 79,
+ 80,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 80,
+ 81,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 82,
+ 88,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 88,
+ 89,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 94,
+ 95,
+ ],
+ "type": "Punctuator",
+ "value": "[",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 95,
+ 98,
+ ],
+ "type": "Identifier",
+ "value": "eee",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 98,
+ 99,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 100,
+ 106,
+ ],
+ "type": "Identifier",
+ "value": "number",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 106,
+ 107,
+ ],
+ "type": "Punctuator",
+ "value": "]",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 107,
+ 108,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 109,
+ 115,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 115,
+ 116,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 121,
+ 122,
+ ],
+ "type": "Punctuator",
+ "value": "[",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 122,
+ 125,
+ ],
+ "type": "Identifier",
+ "value": "fff",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 125,
+ 126,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 126,
+ 127,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 128,
+ 134,
+ ],
+ "type": "Identifier",
+ "value": "number",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 134,
+ 135,
+ ],
+ "type": "Punctuator",
+ "value": "]",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 135,
+ 136,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 137,
+ 143,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 143,
+ 144,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 149,
+ 152,
+ ],
+ "type": "Identifier",
+ "value": "doo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 152,
+ 153,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 153,
+ 154,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 154,
+ 155,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 156,
+ 160,
+ ],
+ "type": "Keyword",
+ "value": "void",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 160,
+ 161,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 166,
+ 169,
+ ],
+ "type": "Identifier",
+ "value": "doo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 169,
+ 170,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 170,
+ 171,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 171,
+ 172,
+ ],
+ "type": "Identifier",
+ "value": "a",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 172,
+ 173,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 174,
+ 175,
+ ],
+ "type": "Identifier",
+ "value": "b",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 175,
+ 176,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 177,
+ 178,
+ ],
+ "type": "Identifier",
+ "value": "c",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 178,
+ 179,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 179,
+ 180,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 181,
+ 185,
+ ],
+ "type": "Keyword",
+ "value": "void",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 185,
+ 186,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 191,
+ 192,
+ ],
+ "type": "Punctuator",
+ "value": "[",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 192,
+ 195,
+ ],
+ "type": "Identifier",
+ "value": "loo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 195,
+ 196,
+ ],
+ "type": "Punctuator",
+ "value": "]",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 196,
+ 197,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 197,
+ 198,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 198,
+ 199,
+ ],
+ "type": "Identifier",
+ "value": "a",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 199,
+ 200,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 201,
+ 202,
+ ],
+ "type": "Identifier",
+ "value": "b",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 202,
+ 203,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 204,
+ 205,
+ ],
+ "type": "Identifier",
+ "value": "c",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 205,
+ 206,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 206,
+ 207,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 208,
+ 212,
+ ],
+ "type": "Keyword",
+ "value": "void",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 10,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 10,
+ },
+ },
+ "range": Array [
+ 212,
+ 213,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 218,
+ 221,
+ ],
+ "type": "Identifier",
+ "value": "boo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 221,
+ 222,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 222,
+ 223,
+ ],
+ "type": "Identifier",
+ "value": "J",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 223,
+ 224,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 224,
+ 225,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 225,
+ 226,
+ ],
+ "type": "Identifier",
+ "value": "a",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 226,
+ 227,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 228,
+ 229,
+ ],
+ "type": "Identifier",
+ "value": "b",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 229,
+ 230,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 231,
+ 232,
+ ],
+ "type": "Identifier",
+ "value": "c",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 232,
+ 233,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 233,
+ 234,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 235,
+ 239,
+ ],
+ "type": "Keyword",
+ "value": "void",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 239,
+ 240,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 245,
+ 248,
+ ],
+ "type": "Keyword",
+ "value": "new",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 249,
+ 250,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 250,
+ 251,
+ ],
+ "type": "Identifier",
+ "value": "a",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 251,
+ 252,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 253,
+ 254,
+ ],
+ "type": "Identifier",
+ "value": "b",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 254,
+ 255,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 255,
+ 256,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 256,
+ 257,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 258,
+ 264,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 264,
+ 265,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 270,
+ 273,
+ ],
+ "type": "Keyword",
+ "value": "new",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 274,
+ 275,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 275,
+ 276,
+ ],
+ "type": "Identifier",
+ "value": "F",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 276,
+ 277,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 277,
+ 278,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 278,
+ 279,
+ ],
+ "type": "Identifier",
+ "value": "a",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 279,
+ 280,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 281,
+ 282,
+ ],
+ "type": "Identifier",
+ "value": "b",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 282,
+ 283,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 283,
+ 284,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 284,
+ 285,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 286,
+ 292,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 292,
+ 293,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 14,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 14,
+ },
+ },
+ "range": Array [
+ 294,
+ 295,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-with-construct-signature-with-parameter-accessibility.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "accessibility": "public",
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "parameter": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 33,
+ 34,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 26,
+ 34,
+ ],
+ "type": "TSParameterProperty",
+ },
+ Object {
+ "accessibility": "private",
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 2,
+ },
+ },
+ "parameter": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 2,
+ },
+ },
+ "name": "y",
+ "range": Array [
+ 44,
+ 45,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 36,
+ 45,
+ ],
+ "type": "TSParameterProperty",
+ },
+ ],
+ "range": Array [
+ 21,
+ 47,
+ ],
+ "type": "TSConstructSignatureDeclaration",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 49,
+ ],
+ "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,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 49,
+ ],
+ "type": "TSInterfaceDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 50,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 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": "Keyword",
+ "value": "new",
+ },
+ 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": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 26,
+ 32,
+ ],
+ "type": "Keyword",
+ "value": "public",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 33,
+ 34,
+ ],
+ "type": "Identifier",
+ "value": "x",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 34,
+ 35,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 36,
+ 43,
+ ],
+ "type": "Keyword",
+ "value": "private",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 44,
+ 45,
+ ],
+ "type": "Identifier",
+ "value": "y",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 45,
+ 46,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 46,
+ 47,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 48,
+ 49,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-with-extends-member-expression.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 33,
+ ],
+ "type": "TSInterfaceBody",
+ },
+ "extends": Array [
+ Object {
+ "expression": Object {
+ "computed": false,
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 22,
+ 25,
+ ],
+ "type": "Identifier",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 26,
+ 29,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 22,
+ 29,
+ ],
+ "type": "MemberExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 29,
+ ],
+ "type": "TSInterfaceHeritage",
+ },
+ ],
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 33,
+ ],
+ "type": "TSInterfaceDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 34,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ "value": "foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 21,
+ ],
+ "type": "Keyword",
+ "value": "extends",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 25,
+ ],
+ "type": "Identifier",
+ "value": "bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 26,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 29,
+ ],
+ "type": "Identifier",
+ "value": "baz",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 31,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 32,
+ 33,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-with-extends-type-parameters.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 32,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 32,
+ 36,
+ ],
+ "type": "TSInterfaceBody",
+ },
+ "extends": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "name": "Bar",
+ "range": Array [
+ 25,
+ 28,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 31,
+ ],
+ "type": "TSInterfaceHeritage",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 29,
+ 30,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
+ },
+ "name": "J",
+ "range": Array [
+ 29,
+ 30,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
+ "range": Array [
+ 28,
+ 31,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
+ ],
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 36,
+ ],
+ "type": "TSInterfaceDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 13,
+ 16,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 37,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Identifier",
+ "value": "T",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 16,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 24,
+ ],
+ "type": "Keyword",
+ "value": "extends",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 28,
+ ],
+ "type": "Identifier",
+ "value": "Bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 29,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 29,
+ 30,
+ ],
+ "type": "Identifier",
+ "value": "J",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 31,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 32,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 32,
+ 33,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 35,
+ 36,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-with-generic.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "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",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 22,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 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": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 87,
+ ],
+ "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": 7,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 87,
+ ],
+ "type": "TSInterfaceDeclaration",
+ },
+ ],
+ "comments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 21,
+ 71,
+ ],
+ "type": "Block",
+ "value": "*
+ * Comment Line 1
+ * @baz bar
+ ",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 88,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 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": 6,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 76,
+ 79,
+ ],
+ "type": "Identifier",
+ "value": "foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 79,
+ 80,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 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": ")",
+ },
+ 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": 7,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 86,
+ 87,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-with-method.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "name": "h",
+ "range": Array [
+ 19,
+ 20,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 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": "TSNumberKeyword",
+ "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 [
+ 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",
},
},
- ],
- "range": Array [
- 121,
- 144,
- ],
- "type": "TSIndexSignature",
- "typeAnnotation": Object {
+ },
+ "type": "TSMethodSignature",
+ "typeParameters": Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 7,
+ "column": 6,
+ "line": 3,
},
"start": Object {
- "column": 18,
- "line": 7,
+ "column": 3,
+ "line": 3,
},
},
- "range": Array [
- 135,
- 143,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 7,
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
},
- "start": Object {
- "column": 20,
- "line": 7,
+ "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 [
- 137,
- 143,
- ],
- "type": "TSStringKeyword",
- },
+ ],
+ "range": Array [
+ 44,
+ 47,
+ ],
+ "type": "TSTypeParameterDeclaration",
},
},
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 61,
+ ],
+ "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": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 61,
+ ],
+ "type": "TSInterfaceDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 62,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 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": 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": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 21,
+ 24,
+ ],
+ "type": "Identifier",
+ "value": "bar",
+ },
+ 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": 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": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 48,
+ 51,
+ ],
+ "type": "Identifier",
+ "value": "bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 51,
+ 52,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 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": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 60,
+ 61,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-with-optional-properties.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [
Object {
"computed": false,
"key": Object {
"loc": Object {
"end": Object {
"column": 7,
- "line": 8,
+ "line": 2,
},
"start": Object {
"column": 4,
- "line": 8,
+ "line": 2,
},
},
- "name": "doo",
+ "name": "foo",
"range": Array [
- 149,
- 152,
+ 21,
+ 24,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 16,
- "line": 8,
+ "column": 9,
+ "line": 2,
},
"start": Object {
"column": 4,
- "line": 8,
+ "line": 2,
},
},
- "params": Array [],
+ "optional": true,
"range": Array [
- 149,
- 161,
+ 21,
+ 26,
],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 8,
- },
- "start": Object {
- "column": 9,
- "line": 8,
- },
- },
- "range": Array [
- 154,
- 160,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 8,
- },
- "start": Object {
- "column": 11,
- "line": 8,
- },
- },
- "range": Array [
- 156,
- 160,
- ],
- "type": "TSVoidKeyword",
- },
- },
- "type": "TSMethodSignature",
+ "type": "TSPropertySignature",
},
Object {
"computed": false,
@@ -47993,253 +54715,70 @@ Object {
"loc": Object {
"end": Object {
"column": 7,
- "line": 9,
+ "line": 3,
},
"start": Object {
"column": 4,
- "line": 9,
+ "line": 3,
},
},
- "name": "doo",
+ "name": "bar",
"range": Array [
- 166,
- 169,
+ 31,
+ 34,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 24,
- "line": 9,
+ "column": 17,
+ "line": 3,
},
"start": Object {
"column": 4,
- "line": 9,
+ "line": 3,
},
},
"optional": true,
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 9,
- },
- "start": Object {
- "column": 9,
- "line": 9,
- },
- },
- "name": "a",
- "range": Array [
- 171,
- 172,
- ],
- "type": "Identifier",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 9,
- },
- "start": Object {
- "column": 12,
- "line": 9,
- },
- },
- "name": "b",
- "range": Array [
- 174,
- 175,
- ],
- "type": "Identifier",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 9,
- },
- "start": Object {
- "column": 15,
- "line": 9,
- },
- },
- "name": "c",
- "range": Array [
- 177,
- 178,
- ],
- "type": "Identifier",
- },
- ],
"range": Array [
- 166,
- 186,
+ 31,
+ 44,
],
- "returnType": Object {
+ "type": "TSPropertySignature",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 9,
+ "column": 16,
+ "line": 3,
},
"start": Object {
- "column": 17,
- "line": 9,
- },
- },
- "range": Array [
- 179,
- 185,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 9,
- },
- "start": Object {
- "column": 19,
- "line": 9,
- },
- },
- "range": Array [
- 181,
- 185,
- ],
- "type": "TSVoidKeyword",
- },
- },
- "type": "TSMethodSignature",
- },
- Object {
- "computed": true,
- "key": Object {
- "loc": Object {
- "end": Object {
"column": 8,
- "line": 10,
- },
- "start": Object {
- "column": 5,
- "line": 10,
- },
- },
- "name": "loo",
- "range": Array [
- 192,
- 195,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 10,
- },
- "start": Object {
- "column": 4,
- "line": 10,
- },
- },
- "optional": true,
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 10,
- },
- "start": Object {
- "column": 11,
- "line": 10,
- },
- },
- "name": "a",
- "range": Array [
- 198,
- 199,
- ],
- "type": "Identifier",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 10,
- },
- "start": Object {
- "column": 14,
- "line": 10,
- },
- },
- "name": "b",
- "range": Array [
- 201,
- 202,
- ],
- "type": "Identifier",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 10,
- },
- "start": Object {
- "column": 17,
- "line": 10,
- },
- },
- "name": "c",
- "range": Array [
- 204,
- 205,
- ],
- "type": "Identifier",
- },
- ],
- "range": Array [
- 191,
- 213,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 10,
- },
- "start": Object {
- "column": 19,
- "line": 10,
+ "line": 3,
},
},
"range": Array [
- 206,
- 212,
+ 35,
+ 43,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 10,
+ "column": 16,
+ "line": 3,
},
"start": Object {
- "column": 21,
- "line": 10,
+ "column": 10,
+ "line": 3,
},
},
"range": Array [
- 208,
- 212,
+ 37,
+ 43,
],
- "type": "TSVoidKeyword",
+ "type": "TSStringKeyword",
},
},
- "type": "TSMethodSignature",
},
Object {
"computed": false,
@@ -48247,435 +54786,734 @@ Object {
"loc": Object {
"end": Object {
"column": 7,
- "line": 11,
+ "line": 4,
},
"start": Object {
"column": 4,
- "line": 11,
+ "line": 4,
},
},
- "name": "boo",
+ "name": "baz",
"range": Array [
- 218,
- 221,
+ 49,
+ 52,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 26,
- "line": 11,
+ "column": 34,
+ "line": 4,
},
"start": Object {
"column": 4,
- "line": 11,
+ "line": 4,
},
},
+ "optional": true,
"params": Array [
Object {
"loc": Object {
"end": Object {
"column": 12,
- "line": 11,
+ "line": 4,
},
"start": Object {
- "column": 11,
- "line": 11,
+ "column": 9,
+ "line": 4,
},
},
- "name": "a",
+ "name": "foo",
"range": Array [
- 225,
- 226,
+ 54,
+ 57,
],
"type": "Identifier",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 11,
+ "column": 26,
+ "line": 4,
},
"start": Object {
"column": 14,
- "line": 11,
- },
- },
- "name": "b",
- "range": Array [
- 228,
- 229,
- ],
- "type": "Identifier",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 11,
- },
- "start": Object {
- "column": 17,
- "line": 11,
+ "line": 4,
},
},
- "name": "c",
+ "name": "bar",
+ "optional": true,
"range": Array [
- 231,
- 232,
+ 59,
+ 71,
],
"type": "Identifier",
- },
- ],
- "range": Array [
- 218,
- 240,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 11,
- },
- "start": Object {
- "column": 19,
- "line": 11,
- },
- },
- "range": Array [
- 233,
- 239,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 11,
- },
- "start": Object {
- "column": 21,
- "line": 11,
- },
- },
- "range": Array [
- 235,
- 239,
- ],
- "type": "TSVoidKeyword",
- },
- },
- "type": "TSMethodSignature",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 11,
- },
- "start": Object {
- "column": 7,
- "line": 11,
- },
- },
- "params": Array [
- Object {
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 11,
+ "column": 26,
+ "line": 4,
},
"start": Object {
- "column": 8,
- "line": 11,
+ "column": 18,
+ "line": 4,
},
},
- "name": Object {
+ "range": Array [
+ 63,
+ 71,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 11,
+ "column": 26,
+ "line": 4,
},
"start": Object {
- "column": 8,
- "line": 11,
+ "column": 20,
+ "line": 4,
},
},
- "name": "J",
"range": Array [
- 222,
- 223,
+ 65,
+ 71,
],
- "type": "Identifier",
+ "type": "TSStringKeyword",
},
- "range": Array [
- 222,
- 223,
- ],
- "type": "TSTypeParameter",
},
- ],
- "range": Array [
- 221,
- 224,
- ],
- "type": "TSTypeParameterDeclaration",
- },
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 4,
+ },
+ },
+ "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,
},
+ },
+ "name": "test",
+ "range": Array [
+ 10,
+ 14,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 81,
+ ],
+ "type": "TSInterfaceDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 82,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 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": 14,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 59,
+ 62,
+ ],
+ "type": "Identifier",
+ "value": "bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 62,
+ 63,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 63,
+ 64,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 65,
+ 71,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 71,
+ 72,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 73,
+ 76,
+ ],
+ "type": "Identifier",
+ "value": "baz",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 76,
+ 77,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 32,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 77,
+ 78,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 78,
+ 79,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 80,
+ 81,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/interface-without-type-annotation.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [
Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 12,
- },
- "start": Object {
- "column": 4,
- "line": 12,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 12,
- },
- "start": Object {
- "column": 9,
- "line": 12,
- },
- },
- "name": "a",
- "range": Array [
- 250,
- 251,
- ],
- "type": "Identifier",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 12,
- },
- "start": Object {
- "column": 12,
- "line": 12,
- },
- },
- "name": "b",
- "optional": true,
- "range": Array [
- 253,
- 254,
- ],
- "type": "Identifier",
- },
- ],
- "range": Array [
- 245,
- 265,
- ],
- "returnType": Object {
+ "computed": false,
+ "key": Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 12,
+ "column": 7,
+ "line": 2,
},
"start": Object {
- "column": 15,
- "line": 12,
+ "column": 4,
+ "line": 2,
},
},
+ "name": "foo",
"range": Array [
- 256,
- 264,
+ 21,
+ 24,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 12,
- },
- "start": Object {
- "column": 17,
- "line": 12,
- },
- },
- "range": Array [
- 258,
- 264,
- ],
- "type": "TSStringKeyword",
- },
+ "type": "Identifier",
},
- "type": "TSConstructSignatureDeclaration",
- },
- Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 13,
+ "column": 8,
+ "line": 2,
},
"start": Object {
"column": 4,
- "line": 13,
+ "line": 2,
},
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 13,
- },
- "start": Object {
- "column": 12,
- "line": 13,
- },
- },
- "name": "a",
- "range": Array [
- 278,
- 279,
- ],
- "type": "Identifier",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 13,
- },
- "start": Object {
- "column": 15,
- "line": 13,
- },
- },
- "name": "b",
- "optional": true,
- "range": Array [
- 281,
- 282,
- ],
- "type": "Identifier",
- },
- ],
"range": Array [
- 270,
- 293,
+ 21,
+ 25,
],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 13,
- },
- "start": Object {
- "column": 18,
- "line": 13,
- },
- },
- "range": Array [
- 284,
- 292,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 13,
- },
- "start": Object {
- "column": 20,
- "line": 13,
- },
- },
- "range": Array [
- 286,
- 292,
- ],
- "type": "TSStringKeyword",
- },
- },
- "type": "TSConstructSignatureDeclaration",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 13,
- },
- "start": Object {
- "column": 8,
- "line": 13,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 13,
- },
- "start": Object {
- "column": 9,
- "line": 13,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 13,
- },
- "start": Object {
- "column": 9,
- "line": 13,
- },
- },
- "name": "F",
- "range": Array [
- 275,
- 276,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 275,
- 276,
- ],
- "type": "TSTypeParameter",
- },
- ],
- "range": Array [
- 274,
- 277,
- ],
- "type": "TSTypeParameterDeclaration",
- },
+ "type": "TSPropertySignature",
},
],
"loc": Object {
"end": Object {
"column": 1,
- "line": 14,
+ "line": 3,
},
"start": Object {
- "column": 14,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 14,
- 295,
+ 15,
+ 27,
],
"type": "TSInterfaceBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 14,
"line": 1,
},
"start": Object {
@@ -48683,17 +55521,17 @@ Object {
"line": 1,
},
},
- "name": "Foo",
+ "name": "test",
"range": Array [
10,
- 13,
+ 14,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 14,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -48702,7 +55540,7 @@ Object {
},
"range": Array [
0,
- 295,
+ 27,
],
"type": "TSInterfaceDeclaration",
},
@@ -48711,7 +55549,7 @@ Object {
"loc": Object {
"end": Object {
"column": 0,
- "line": 16,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -48720,7 +55558,7 @@ Object {
},
"range": Array [
0,
- 297,
+ 28,
],
"sourceType": "module",
"tokens": Array [
@@ -48745,7 +55583,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 14,
"line": 1,
},
"start": Object {
@@ -48755,25 +55593,25 @@ Object {
},
"range": Array [
10,
- 13,
+ 14,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "test",
},
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": "{",
@@ -48790,11 +55628,11 @@ Object {
},
},
"range": Array [
- 20,
- 23,
+ 21,
+ 24,
],
"type": "Identifier",
- "value": "baa",
+ "value": "foo",
},
Object {
"loc": Object {
@@ -48808,44 +55646,8 @@ Object {
},
},
"range": Array [
- 23,
24,
- ],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "range": Array [
25,
- 31,
- ],
- "type": "Identifier",
- "value": "number",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 2,
- },
- "start": Object {
- "column": 15,
- "line": 2,
- },
- },
- "range": Array [
- 31,
- 32,
],
"type": "Punctuator",
"value": ";",
@@ -48853,449 +55655,697 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "range": Array [
- 37,
- 40,
- ],
- "type": "Identifier",
- "value": "bar",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 3,
- },
- "start": Object {
- "column": 7,
- "line": 3,
- },
- },
- "range": Array [
- 40,
- 41,
- ],
- "type": "Punctuator",
- "value": "?",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "range": Array [
- 41,
- 42,
- ],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 3,
- },
- "start": Object {
- "column": 10,
- "line": 3,
- },
- },
- "range": Array [
- 43,
- 49,
- ],
- "type": "Identifier",
- "value": "number",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 17,
+ "column": 1,
"line": 3,
},
"start": Object {
- "column": 16,
+ "column": 0,
"line": 3,
},
},
"range": Array [
- 49,
- 50,
+ 26,
+ 27,
],
"type": "Punctuator",
- "value": ";",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/keyof-operator.src 1`] = `
+Object {
+ "body": Array [
Object {
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 4,
- },
- "start": Object {
- "column": 4,
- "line": 4,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
},
+ "name": "x",
+ "range": Array [
+ 5,
+ 6,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 55,
- 56,
- ],
- "type": "Punctuator",
- "value": "[",
- },
- Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 4,
+ "column": 19,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 56,
- 59,
+ 0,
+ 19,
],
- "type": "Identifier",
- "value": "bax",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 4,
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
},
- "start": Object {
- "column": 8,
- "line": 4,
+ "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 [
- 59,
- 60,
- ],
- "type": "Punctuator",
- "value": "]",
},
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 20,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 4,
+ "column": 4,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 60,
- 61,
+ 0,
+ 4,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 4,
+ "column": 6,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 4,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 62,
- 68,
+ 5,
+ 6,
],
"type": "Identifier",
- "value": "string",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 4,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 4,
+ "column": 7,
+ "line": 1,
},
},
"range": Array [
- 68,
- 69,
+ 7,
+ 8,
],
"type": "Punctuator",
- "value": ";",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 5,
+ "column": 14,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 5,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 74,
- 75,
+ 9,
+ 14,
],
- "type": "Punctuator",
- "value": "[",
+ "type": "Identifier",
+ "value": "keyof",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 5,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 5,
+ "column": 15,
+ "line": 1,
},
},
"range": Array [
- 75,
- 78,
+ 15,
+ 18,
],
"type": "Identifier",
- "value": "baz",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 5,
+ "column": 19,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 5,
+ "column": 18,
+ "line": 1,
},
},
"range": Array [
- 78,
- 79,
+ 18,
+ 19,
],
"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",
+ },
+ ],
+ "kind": "var",
"loc": Object {
"end": Object {
- "column": 10,
- "line": 5,
+ "column": 44,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 5,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 79,
- 80,
+ 0,
+ 44,
],
- "type": "Punctuator",
- "value": "?",
+ "type": "VariableDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 44,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 44,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 5,
+ "column": 3,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 5,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 80,
- 81,
+ 0,
+ 3,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Keyword",
+ "value": "var",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 5,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 5,
+ "column": 4,
+ "line": 1,
},
},
"range": Array [
- 82,
- 88,
+ 4,
+ 15,
],
"type": "Identifier",
- "value": "string",
+ "value": "nestedArray",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 5,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 5,
+ "column": 15,
+ "line": 1,
},
},
"range": Array [
- 88,
- 89,
+ 15,
+ 16,
],
"type": "Punctuator",
- "value": ";",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 6,
+ "column": 22,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 6,
+ "column": 17,
+ "line": 1,
},
},
"range": Array [
- 94,
- 95,
+ 17,
+ 22,
],
- "type": "Punctuator",
- "value": "[",
+ "type": "Identifier",
+ "value": "Array",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 6,
+ "column": 23,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 6,
+ "column": 22,
+ "line": 1,
},
},
"range": Array [
- 95,
- 98,
+ 22,
+ 23,
],
- "type": "Identifier",
- "value": "eee",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 6,
+ "column": 28,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 6,
+ "column": 23,
+ "line": 1,
},
},
"range": Array [
- 98,
- 99,
+ 23,
+ 28,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "Array",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 6,
+ "column": 29,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 6,
+ "column": 28,
+ "line": 1,
},
},
"range": Array [
- 100,
- 106,
+ 28,
+ 29,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 6,
+ "column": 34,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 6,
+ "column": 29,
+ "line": 1,
},
},
"range": Array [
- 106,
- 107,
+ 29,
+ 34,
],
- "type": "Punctuator",
- "value": "]",
+ "type": "Identifier",
+ "value": "Array",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 6,
+ "column": 35,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 6,
+ "column": 34,
+ "line": 1,
},
},
"range": Array [
- 107,
- 108,
+ 34,
+ 35,
],
"type": "Punctuator",
- "value": ":",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 6,
+ "column": 41,
+ "line": 1,
},
"start": Object {
- "column": 19,
- "line": 6,
+ "column": 35,
+ "line": 1,
},
},
"range": Array [
- 109,
- 115,
+ 35,
+ 41,
],
"type": "Identifier",
"value": "string",
@@ -49303,143 +56353,402 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 6,
+ "column": 42,
+ "line": 1,
},
"start": Object {
- "column": 25,
- "line": 6,
+ "column": 41,
+ "line": 1,
},
},
"range": Array [
- 115,
- 116,
+ 41,
+ 42,
],
"type": "Punctuator",
- "value": ";",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 7,
+ "column": 43,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 7,
+ "column": 42,
+ "line": 1,
},
},
"range": Array [
- 121,
- 122,
+ 42,
+ 43,
],
"type": "Punctuator",
- "value": "[",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 7,
+ "column": 44,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 7,
+ "column": 43,
+ "line": 1,
},
},
"range": Array [
- 122,
- 125,
+ 43,
+ 44,
],
- "type": "Identifier",
- "value": "fff",
+ "type": "Punctuator",
+ "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": 7,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 7,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 125,
- 126,
+ 0,
+ 18,
],
- "type": "Punctuator",
- "value": "?",
+ "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 {
+ "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",
+ },
+ "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",
+ },
+ },
"loc": Object {
"end": Object {
- "column": 10,
- "line": 7,
+ "column": 26,
+ "line": 2,
},
"start": Object {
- "column": 9,
- "line": 7,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 126,
- 127,
+ 19,
+ 45,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "ExpressionStatement",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 46,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 7,
+ "column": 5,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 7,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 128,
- 134,
+ 0,
+ 5,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Keyword",
+ "value": "const",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 7,
+ "column": 7,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 7,
+ "column": 6,
+ "line": 1,
},
},
"range": Array [
- 134,
- 135,
+ 6,
+ 7,
],
- "type": "Punctuator",
- "value": "]",
+ "type": "Identifier",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 7,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 7,
+ "column": 7,
+ "line": 1,
},
},
"range": Array [
- 135,
- 136,
+ 7,
+ 8,
],
"type": "Punctuator",
"value": ":",
@@ -49447,431 +56756,695 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 7,
+ "column": 10,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 7,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 137,
- 143,
+ 9,
+ 10,
],
"type": "Identifier",
- "value": "string",
+ "value": "X",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 7,
+ "column": 11,
+ "line": 1,
},
- "start": Object {
- "column": 26,
- "line": 7,
+ "start": Object {
+ "column": 10,
+ "line": 1,
},
},
"range": Array [
- 143,
- 144,
+ 10,
+ 11,
],
"type": "Punctuator",
- "value": ";",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 8,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 8,
+ "column": 11,
+ "line": 1,
},
},
"range": Array [
- 149,
- 152,
+ 11,
+ 16,
],
"type": "Identifier",
- "value": "doo",
+ "value": "never",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 8,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 7,
- "line": 8,
+ "column": 16,
+ "line": 1,
},
},
"range": Array [
- 152,
- 153,
+ 16,
+ 17,
],
"type": "Punctuator",
- "value": "(",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 8,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 8,
+ "column": 17,
+ "line": 1,
},
},
"range": Array [
- 153,
- 154,
+ 17,
+ 18,
],
"type": "Punctuator",
- "value": ")",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
"column": 10,
- "line": 8,
+ "line": 2,
},
"start": Object {
- "column": 9,
- "line": 8,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 154,
- 155,
+ 19,
+ 29,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "Observable",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 8,
+ "column": 11,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 8,
+ "column": 10,
+ "line": 2,
},
},
"range": Array [
- 156,
- 160,
+ 29,
+ 30,
],
- "type": "Keyword",
- "value": "void",
+ "type": "Punctuator",
+ "value": ".",
},
Object {
"loc": Object {
"end": Object {
"column": 16,
- "line": 8,
+ "line": 2,
},
"start": Object {
- "column": 15,
- "line": 8,
+ "column": 11,
+ "line": 2,
},
},
"range": Array [
- 160,
- 161,
+ 30,
+ 35,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "empty",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 9,
+ "column": 17,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 9,
+ "column": 16,
+ "line": 2,
},
},
"range": Array [
- 166,
- 169,
+ 35,
+ 36,
],
- "type": "Identifier",
- "value": "doo",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 9,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 7,
- "line": 9,
+ "column": 17,
+ "line": 2,
},
},
"range": Array [
- 169,
- 170,
+ 36,
+ 41,
],
- "type": "Punctuator",
- "value": "?",
+ "type": "Identifier",
+ "value": "never",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 9,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 9,
+ "column": 22,
+ "line": 2,
},
},
"range": Array [
- 170,
- 171,
+ 41,
+ 42,
],
"type": "Punctuator",
- "value": "(",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 9,
+ "column": 24,
+ "line": 2,
},
"start": Object {
- "column": 9,
- "line": 9,
+ "column": 23,
+ "line": 2,
},
},
"range": Array [
- 171,
- 172,
+ 42,
+ 43,
],
- "type": "Identifier",
- "value": "a",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 9,
+ "column": 25,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 9,
+ "column": 24,
+ "line": 2,
},
},
"range": Array [
- 172,
- 173,
+ 43,
+ 44,
],
"type": "Punctuator",
- "value": ",",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 9,
+ "column": 26,
+ "line": 2,
},
"start": Object {
- "column": 12,
- "line": 9,
+ "column": 25,
+ "line": 2,
},
},
"range": Array [
- 174,
- 175,
+ 44,
+ 45,
],
- "type": "Identifier",
- "value": "b",
+ "type": "Punctuator",
+ "value": ";",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = `
+Object {
+ "body": Array [
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": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 35,
+ 82,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "name": "processEntity",
+ "range": Array [
+ 9,
+ 22,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 14,
- "line": 9,
+ "column": 1,
+ "line": 4,
},
"start": Object {
- "column": 13,
- "line": 9,
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "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 [
- 175,
- 176,
],
- "type": "Punctuator",
- "value": ",",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 9,
- },
- "start": Object {
- "column": 15,
- "line": 9,
- },
- },
"range": Array [
- 177,
- 178,
+ 0,
+ 82,
],
- "type": "Identifier",
- "value": "c",
+ "type": "FunctionDeclaration",
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 9,
- },
- "start": Object {
- "column": 16,
- "line": 9,
- },
- },
- "range": Array [
- 178,
- 179,
- ],
- "type": "Punctuator",
- "value": ")",
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 9,
- },
- "start": Object {
- "column": 17,
- "line": 9,
- },
- },
- "range": Array [
- 179,
- 180,
- ],
- "type": "Punctuator",
- "value": ":",
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 82,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 9,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 19,
- "line": 9,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 181,
- 185,
+ 0,
+ 8,
],
"type": "Keyword",
- "value": "void",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 9,
+ "column": 22,
+ "line": 1,
},
"start": Object {
- "column": 23,
- "line": 9,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 185,
- 186,
+ 9,
+ 22,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "processEntity",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 10,
+ "column": 23,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 10,
+ "column": 22,
+ "line": 1,
},
},
"range": Array [
- 191,
- 192,
+ 22,
+ 23,
],
"type": "Punctuator",
- "value": "[",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 10,
+ "column": 24,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 10,
+ "column": 23,
+ "line": 1,
},
},
"range": Array [
- 192,
- 195,
+ 23,
+ 24,
],
"type": "Identifier",
- "value": "loo",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 10,
- },
- "start": Object {
- "column": 8,
- "line": 10,
- },
- },
- "range": Array [
- 195,
- 196,
- ],
- "type": "Punctuator",
- "value": "]",
+ "value": "e",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 10,
+ "column": 25,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 10,
+ "column": 24,
+ "line": 1,
},
},
"range": Array [
- 196,
- 197,
+ 24,
+ 25,
],
"type": "Punctuator",
"value": "?",
@@ -49879,179 +57452,161 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 10,
+ "column": 26,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 10,
+ "column": 25,
+ "line": 1,
},
},
"range": Array [
- 197,
- 198,
+ 25,
+ 26,
],
"type": "Punctuator",
- "value": "(",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 10,
+ "column": 33,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 10,
+ "column": 27,
+ "line": 1,
},
},
"range": Array [
- 198,
- 199,
+ 27,
+ 33,
],
"type": "Identifier",
- "value": "a",
+ "value": "Entity",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 10,
+ "column": 34,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 10,
+ "column": 33,
+ "line": 1,
},
},
"range": Array [
- 199,
- 200,
+ 33,
+ 34,
],
"type": "Punctuator",
- "value": ",",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 10,
- },
- "start": Object {
- "column": 14,
- "line": 10,
- },
- },
- "range": Array [
- 201,
- 202,
- ],
- "type": "Identifier",
- "value": "b",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 10,
+ "column": 36,
+ "line": 1,
},
"start": Object {
- "column": 15,
- "line": 10,
+ "column": 35,
+ "line": 1,
},
},
"range": Array [
- 202,
- 203,
+ 35,
+ 36,
],
"type": "Punctuator",
- "value": ",",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
"column": 18,
- "line": 10,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 10,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 204,
- 205,
+ 41,
+ 55,
],
"type": "Identifier",
- "value": "c",
+ "value": "validateEntity",
},
Object {
"loc": Object {
"end": Object {
"column": 19,
- "line": 10,
+ "line": 2,
},
"start": Object {
"column": 18,
- "line": 10,
+ "line": 2,
},
},
"range": Array [
- 205,
- 206,
+ 55,
+ 56,
],
"type": "Punctuator",
- "value": ")",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
"column": 20,
- "line": 10,
+ "line": 2,
},
"start": Object {
"column": 19,
- "line": 10,
+ "line": 2,
},
},
"range": Array [
- 206,
- 207,
+ 56,
+ 57,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "e",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 10,
+ "column": 21,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 10,
+ "column": 20,
+ "line": 2,
},
},
"range": Array [
- 208,
- 212,
+ 57,
+ 58,
],
- "type": "Keyword",
- "value": "void",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 10,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 25,
- "line": 10,
+ "column": 21,
+ "line": 2,
},
},
"range": Array [
- 212,
- 213,
+ 58,
+ 59,
],
"type": "Punctuator",
"value": ";",
@@ -50060,394 +57615,510 @@ Object {
"loc": Object {
"end": Object {
"column": 7,
- "line": 11,
+ "line": 3,
},
"start": Object {
"column": 4,
- "line": 11,
+ "line": 3,
},
},
"range": Array [
- 218,
- 221,
+ 64,
+ 67,
],
- "type": "Identifier",
- "value": "boo",
+ "type": "Keyword",
+ "value": "let",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 11,
+ "column": 9,
+ "line": 3,
},
"start": Object {
- "column": 7,
- "line": 11,
+ "column": 8,
+ "line": 3,
},
},
"range": Array [
- 221,
- 222,
+ 68,
+ 69,
],
- "type": "Punctuator",
- "value": "<",
+ "type": "Identifier",
+ "value": "s",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 11,
+ "column": 11,
+ "line": 3,
},
"start": Object {
- "column": 8,
- "line": 11,
+ "column": 10,
+ "line": 3,
},
},
"range": Array [
- 222,
- 223,
+ 70,
+ 71,
],
- "type": "Identifier",
- "value": "J",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 11,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 11,
+ "column": 12,
+ "line": 3,
},
},
"range": Array [
- 223,
- 224,
+ 72,
+ 73,
],
- "type": "Punctuator",
- "value": ">",
+ "type": "Identifier",
+ "value": "e",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 11,
+ "column": 14,
+ "line": 3,
},
"start": Object {
- "column": 10,
- "line": 11,
+ "column": 13,
+ "line": 3,
},
},
"range": Array [
- 224,
- 225,
+ 73,
+ 74,
],
"type": "Punctuator",
- "value": "(",
+ "value": "!",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 11,
+ "column": 15,
+ "line": 3,
},
"start": Object {
- "column": 11,
- "line": 11,
+ "column": 14,
+ "line": 3,
},
},
"range": Array [
- 225,
- 226,
+ 74,
+ 75,
],
- "type": "Identifier",
- "value": "a",
+ "type": "Punctuator",
+ "value": ".",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 11,
+ "column": 19,
+ "line": 3,
},
"start": Object {
- "column": 12,
- "line": 11,
+ "column": 15,
+ "line": 3,
},
},
"range": Array [
- 226,
- 227,
+ 75,
+ 79,
],
- "type": "Punctuator",
- "value": ",",
+ "type": "Identifier",
+ "value": "name",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 11,
+ "column": 20,
+ "line": 3,
},
"start": Object {
- "column": 14,
- "line": 11,
+ "column": 19,
+ "line": 3,
},
},
"range": Array [
- 228,
- 229,
+ 79,
+ 80,
],
- "type": "Identifier",
- "value": "b",
+ "type": "Punctuator",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 11,
+ "column": 1,
+ "line": 4,
},
"start": Object {
- "column": 15,
- "line": 11,
+ "column": 0,
+ "line": 4,
},
},
"range": Array [
- 229,
- 230,
+ 81,
+ 82,
],
"type": "Punctuator",
- "value": ",",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = `
+Object {
+ "body": Array [
Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 11,
- },
- "start": Object {
- "column": 17,
- "line": 11,
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 4,
+ 11,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 5,
+ 11,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 11,
+ ],
+ "type": "TSNullKeyword",
+ },
+ },
+ },
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 4,
+ 11,
+ ],
+ "type": "VariableDeclarator",
},
- },
- "range": Array [
- 231,
- 232,
],
- "type": "Identifier",
- "value": "c",
- },
- Object {
+ "kind": "let",
"loc": Object {
"end": Object {
- "column": 19,
- "line": 11,
+ "column": 12,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 11,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 232,
- 233,
+ 0,
+ 12,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "VariableDeclaration",
},
Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 11,
- },
- "start": Object {
- "column": 19,
- "line": 11,
+ "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,
+ },
+ },
+ "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",
+ },
+ },
+ },
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 17,
+ 29,
+ ],
+ "type": "VariableDeclarator",
},
- },
- "range": Array [
- 233,
- 234,
],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
+ "kind": "let",
"loc": Object {
"end": Object {
- "column": 25,
- "line": 11,
+ "column": 17,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 11,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 235,
- 239,
+ 13,
+ 30,
],
- "type": "Keyword",
- "value": "void",
+ "type": "VariableDeclaration",
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 11,
- },
- "start": Object {
- "column": 25,
- "line": 11,
- },
- },
- "range": Array [
- 239,
- 240,
- ],
- "type": "Punctuator",
- "value": ";",
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
},
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 30,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 12,
+ "column": 3,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 12,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 245,
- 248,
+ 0,
+ 3,
],
"type": "Keyword",
- "value": "new",
+ "value": "let",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 12,
+ "column": 5,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 12,
+ "column": 4,
+ "line": 1,
},
},
"range": Array [
- 249,
- 250,
+ 4,
+ 5,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 12,
+ "column": 6,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 12,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 250,
- 251,
+ 5,
+ 6,
],
- "type": "Identifier",
- "value": "a",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
"column": 11,
- "line": 12,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 12,
+ "column": 7,
+ "line": 1,
},
},
"range": Array [
- 251,
- 252,
+ 7,
+ 11,
],
- "type": "Punctuator",
- "value": ",",
+ "type": "Keyword",
+ "value": "null",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 12,
+ "column": 12,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 12,
+ "column": 11,
+ "line": 1,
},
},
"range": Array [
- 253,
- 254,
+ 11,
+ 12,
],
- "type": "Identifier",
- "value": "b",
+ "type": "Punctuator",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 12,
+ "column": 3,
+ "line": 2,
},
"start": Object {
- "column": 13,
- "line": 12,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 254,
- 255,
+ 13,
+ 16,
],
- "type": "Punctuator",
- "value": "?",
+ "type": "Keyword",
+ "value": "let",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 12,
+ "column": 5,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 12,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 255,
- 256,
+ 17,
+ 18,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "y",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 12,
+ "column": 6,
+ "line": 2,
},
"start": Object {
- "column": 15,
- "line": 12,
+ "column": 5,
+ "line": 2,
},
},
"range": Array [
- 256,
- 257,
+ 18,
+ 19,
],
"type": "Punctuator",
"value": ":",
@@ -50455,233 +58126,551 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 12,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 12,
+ "column": 7,
+ "line": 2,
},
},
"range": Array [
- 258,
- 264,
+ 20,
+ 29,
],
"type": "Identifier",
- "value": "string",
+ "value": "undefined",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 12,
+ "column": 17,
+ "line": 2,
},
"start": Object {
- "column": 23,
- "line": 12,
+ "column": 16,
+ "line": 2,
},
},
"range": Array [
- 264,
- 265,
+ 29,
+ 30,
],
"type": "Punctuator",
"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,
+ },
+ },
+ "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",
+ },
"loc": Object {
"end": Object {
- "column": 7,
- "line": 13,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 13,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 270,
- 273,
+ 0,
+ 17,
],
- "type": "Keyword",
- "value": "new",
+ "type": "ExpressionStatement",
},
Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 13,
- },
- "start": Object {
- "column": 8,
- "line": 13,
+ "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": 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 [
- 274,
- 275,
- ],
- "type": "Punctuator",
- "value": "<",
- },
- Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 13,
+ "column": 16,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 13,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 275,
- 276,
+ 19,
+ 35,
],
- "type": "Identifier",
- "value": "F",
+ "type": "ExpressionStatement",
},
Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 13,
- },
- "start": Object {
- "column": 10,
- "line": 13,
+ "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": 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 [
- 276,
- 277,
- ],
- "type": "Punctuator",
- "value": ">",
- },
- Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 13,
+ "column": 19,
+ "line": 5,
},
"start": Object {
- "column": 11,
- "line": 13,
+ "column": 0,
+ "line": 5,
},
},
"range": Array [
- 277,
- 278,
+ 37,
+ 56,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "ExpressionStatement",
},
Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 13,
+ "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,
+ },
},
- "start": Object {
- "column": 12,
- "line": 13,
+ "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",
},
- "range": Array [
- 278,
- 279,
- ],
- "type": "Identifier",
- "value": "a",
- },
- Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 13,
+ "column": 23,
+ "line": 7,
},
"start": Object {
- "column": 13,
- "line": 13,
+ "column": 0,
+ "line": 7,
},
},
"range": Array [
- 279,
- 280,
+ 58,
+ 81,
],
- "type": "Punctuator",
- "value": ",",
+ "superClass": null,
+ "type": "ClassDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 82,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 13,
+ "column": 1,
+ "line": 1,
},
"start": Object {
- "column": 15,
- "line": 13,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 281,
- 282,
+ 0,
+ 1,
],
- "type": "Identifier",
- "value": "b",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 13,
+ "column": 2,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 13,
+ "column": 1,
+ "line": 1,
},
},
"range": Array [
- 282,
- 283,
+ 1,
+ 2,
],
"type": "Punctuator",
- "value": "?",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 13,
+ "column": 7,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 13,
+ "column": 3,
+ "line": 1,
},
},
"range": Array [
- 283,
- 284,
+ 3,
+ 7,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "String",
+ "value": "'__'",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 13,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 13,
+ "column": 7,
+ "line": 1,
},
},
"range": Array [
- 284,
- 285,
+ 7,
+ 8,
],
"type": "Punctuator",
"value": ":",
@@ -50689,194 +58678,76 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 13,
+ "column": 13,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 13,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 286,
- 292,
+ 9,
+ 13,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Keyword",
+ "value": "null",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 13,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 26,
- "line": 13,
+ "column": 14,
+ "line": 1,
},
},
"range": Array [
- 292,
- 293,
+ 14,
+ 15,
],
"type": "Punctuator",
- "value": ";",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 14,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 14,
+ "column": 15,
+ "line": 1,
},
},
"range": Array [
- 294,
- 295,
+ 15,
+ 16,
],
"type": "Punctuator",
- "value": "}",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/interface-with-construct-signature-with-parameter-accessibility.src 1`] = `
-Object {
- "body": Array [
- Object {
- "body": Object {
- "body": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "params": Array [
- Object {
- "accessibility": "public",
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "parameter": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "name": "x",
- "range": Array [
- 33,
- 34,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 26,
- 34,
- ],
- "type": "TSParameterProperty",
- },
- Object {
- "accessibility": "private",
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 2,
- },
- "start": Object {
- "column": 19,
- "line": 2,
- },
- },
- "parameter": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 2,
- },
- "start": Object {
- "column": 27,
- "line": 2,
- },
- },
- "name": "y",
- "range": Array [
- 44,
- 45,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 36,
- 45,
- ],
- "type": "TSParameterProperty",
- },
- ],
- "range": Array [
- 21,
- 47,
- ],
- "type": "TSConstructSignatureDeclaration",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 1,
- },
- },
- "range": Array [
- 15,
- 49,
- ],
- "type": "TSInterfaceBody",
- },
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 1,
},
- "name": "Test",
- "range": Array [
- 10,
- 14,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 16,
+ 17,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
"loc": Object {
"end": Object {
"column": 1,
@@ -50884,168 +58755,169 @@ Object {
},
"start": Object {
"column": 0,
- "line": 1,
+ "line": 3,
},
},
"range": Array [
- 0,
- 49,
+ 19,
+ 20,
],
- "type": "TSInterfaceDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
+ "type": "Punctuator",
+ "value": "(",
},
- "start": Object {
- "column": 0,
- "line": 1,
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 2,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Punctuator",
+ "value": "{",
},
- },
- "range": Array [
- 0,
- 50,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 1,
+ "column": 7,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 3,
+ "line": 3,
},
},
"range": Array [
- 0,
- 9,
+ 22,
+ 26,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "String",
+ "value": "'__'",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 1,
+ "column": 8,
+ "line": 3,
},
"start": Object {
- "column": 10,
- "line": 1,
+ "column": 7,
+ "line": 3,
},
},
"range": Array [
- 10,
- 14,
+ 26,
+ 27,
],
- "type": "Identifier",
- "value": "Test",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 9,
+ "line": 3,
},
"start": Object {
- "column": 15,
- "line": 1,
+ "column": 8,
+ "line": 3,
},
},
"range": Array [
- 15,
- 16,
+ 27,
+ 28,
],
"type": "Punctuator",
- "value": "{",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 2,
+ "column": 11,
+ "line": 3,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 10,
+ "line": 3,
},
},
"range": Array [
- 21,
- 24,
+ 29,
+ 30,
],
- "type": "Keyword",
- "value": "new",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 2,
+ "column": 12,
+ "line": 3,
},
"start": Object {
- "column": 8,
- "line": 2,
+ "column": 11,
+ "line": 3,
},
},
"range": Array [
- 25,
- 26,
+ 30,
+ 31,
],
"type": "Punctuator",
- "value": "(",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 2,
+ "column": 14,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 2,
+ "column": 13,
+ "line": 3,
},
},
"range": Array [
- 26,
32,
+ 33,
],
- "type": "Keyword",
- "value": "public",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 2,
+ "column": 15,
+ "line": 3,
},
"start": Object {
- "column": 16,
- "line": 2,
+ "column": 14,
+ "line": 3,
},
},
"range": Array [
33,
34,
],
- "type": "Identifier",
- "value": "x",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 2,
+ "column": 16,
+ "line": 3,
},
"start": Object {
- "column": 17,
- "line": 2,
+ "column": 15,
+ "line": 3,
},
},
"range": Array [
@@ -51053,53 +58925,89 @@ Object {
35,
],
"type": "Punctuator",
- "value": ",",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 2,
+ "column": 1,
+ "line": 5,
},
"start": Object {
- "column": 19,
- "line": 2,
+ "column": 0,
+ "line": 5,
},
},
"range": Array [
- 36,
- 43,
+ 37,
+ 38,
],
- "type": "Keyword",
- "value": "private",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 2,
+ "column": 2,
+ "line": 5,
},
"start": Object {
- "column": 27,
- "line": 2,
+ "column": 1,
+ "line": 5,
},
},
"range": Array [
- 44,
+ 38,
+ 39,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "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": 5,
+ },
+ },
+ "range": Array [
+ 41,
45,
],
- "type": "Identifier",
- "value": "y",
+ "type": "String",
+ "value": "'__'",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 2,
+ "column": 9,
+ "line": 5,
},
"start": Object {
- "column": 28,
- "line": 2,
+ "column": 8,
+ "line": 5,
},
},
"range": Array [
@@ -51107,17 +59015,17 @@ Object {
46,
],
"type": "Punctuator",
- "value": ")",
+ "value": "]",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
- "line": 2,
+ "column": 10,
+ "line": 5,
},
"start": Object {
- "column": 29,
- "line": 2,
+ "column": 9,
+ "line": 5,
},
},
"range": Array [
@@ -51125,318 +59033,202 @@ Object {
47,
],
"type": "Punctuator",
- "value": ";",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 15,
+ "line": 5,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 11,
+ "line": 5,
},
},
"range": Array [
48,
- 49,
+ 52,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Keyword",
+ "value": "null",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/interface-with-extends-member-expression.src 1`] = `
-Object {
- "body": Array [
Object {
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 2,
- },
- "start": Object {
- "column": 30,
- "line": 1,
- },
- },
- "range": Array [
- 30,
- 33,
- ],
- "type": "TSInterfaceBody",
- },
- "extends": Array [
- Object {
- "expression": Object {
- "computed": false,
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "object": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "name": "bar",
- "range": Array [
- 22,
- 25,
- ],
- "type": "Identifier",
- },
- "property": Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 26,
- "line": 1,
- },
- },
- "name": "baz",
- "range": Array [
- 26,
- 29,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 22,
- 29,
- ],
- "type": "MemberExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "range": Array [
- 22,
- 29,
- ],
- "type": "TSInterfaceHeritage",
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 5,
},
- ],
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
+ "start": Object {
+ "column": 16,
+ "line": 5,
},
- "name": "foo",
- "range": Array [
- 10,
- 13,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 53,
+ 54,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 2,
+ "column": 18,
+ "line": 5,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 17,
+ "line": 5,
},
},
"range": Array [
- 0,
- 33,
+ 54,
+ 55,
],
- "type": "TSInterfaceDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 3,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": ")",
},
- },
- "range": Array [
- 0,
- 34,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 1,
+ "column": 19,
+ "line": 5,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 18,
+ "line": 5,
},
},
"range": Array [
- 0,
- 9,
+ 55,
+ 56,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "Punctuator",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 1,
+ "column": 5,
+ "line": 7,
},
"start": Object {
- "column": 10,
- "line": 1,
+ "column": 0,
+ "line": 7,
},
},
"range": Array [
- 10,
- 13,
+ 58,
+ 63,
],
- "type": "Identifier",
- "value": "foo",
+ "type": "Keyword",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 7,
+ "line": 7,
},
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 6,
+ "line": 7,
},
},
"range": Array [
- 14,
- 21,
+ 64,
+ 65,
],
- "type": "Keyword",
- "value": "extends",
+ "type": "Identifier",
+ "value": "X",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 1,
+ "column": 9,
+ "line": 7,
},
"start": Object {
- "column": 22,
- "line": 1,
+ "column": 8,
+ "line": 7,
},
},
"range": Array [
- 22,
- 25,
+ 66,
+ 67,
],
- "type": "Identifier",
- "value": "bar",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 1,
+ "column": 14,
+ "line": 7,
},
"start": Object {
- "column": 25,
- "line": 1,
+ "column": 10,
+ "line": 7,
},
},
"range": Array [
- 25,
- 26,
+ 68,
+ 72,
],
- "type": "Punctuator",
- "value": ".",
+ "type": "String",
+ "value": "'__'",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 1,
+ "column": 16,
+ "line": 7,
},
"start": Object {
- "column": 26,
- "line": 1,
+ "column": 15,
+ "line": 7,
},
},
"range": Array [
- 26,
- 29,
+ 73,
+ 74,
],
- "type": "Identifier",
- "value": "baz",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 1,
+ "column": 21,
+ "line": 7,
},
"start": Object {
- "column": 30,
- "line": 1,
+ "column": 17,
+ "line": 7,
},
},
"range": Array [
- 30,
- 31,
+ 75,
+ 79,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Keyword",
+ "value": "null",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 2,
+ "column": 23,
+ "line": 7,
},
"start": Object {
- "column": 0,
- "line": 2,
+ "column": 22,
+ "line": 7,
},
},
"range": Array [
- 32,
- 33,
+ 80,
+ 81,
],
"type": "Punctuator",
"value": "}",
@@ -51446,419 +59238,894 @@ Object {
}
`;
-exports[`typescript fixtures/basics/interface-with-extends-type-parameters.src 1`] = `
+exports[`typescript fixtures/basics/object-with-typed-methods.src 1`] = `
Object {
"body": Array [
Object {
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 32,
- "line": 1,
- },
- },
- "range": Array [
- 32,
- 36,
- ],
- "type": "TSInterfaceBody",
- },
- "extends": Array [
+ "declarations": Array [
Object {
- "expression": Object {
+ "id": Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 6,
"line": 1,
},
},
- "name": "Bar",
+ "name": "foo",
"range": Array [
- 25,
- 28,
+ 6,
+ 9,
],
"type": "Identifier",
},
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 1,
- },
- "start": Object {
- "column": 25,
- "line": 1,
- },
- },
- "range": Array [
- 25,
- 31,
- ],
- "type": "TSInterfaceHeritage",
- "typeParameters": Object {
+ "init": Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 1,
+ "column": 1,
+ "line": 13,
},
"start": Object {
- "column": 28,
+ "column": 12,
"line": 1,
},
},
- "params": Array [
+ "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",
+ },
+ "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",
+ },
+ },
+ },
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": 30,
- "line": 1,
+ "column": 3,
+ "line": 10,
},
"start": Object {
- "column": 29,
- "line": 1,
+ "column": 2,
+ "line": 8,
},
},
+ "method": false,
"range": Array [
- 29,
- 30,
+ 104,
+ 138,
],
- "type": "TSTypeReference",
- "typeName": Object {
+ "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": 30,
- "line": 1,
+ "column": 3,
+ "line": 10,
},
"start": Object {
- "column": 29,
- "line": 1,
+ "column": 7,
+ "line": 8,
},
},
- "name": "J",
+ "params": Array [],
"range": Array [
- 29,
- 30,
+ 109,
+ 138,
],
- "type": "Identifier",
+ "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 [
- 28,
- 31,
- ],
- "type": "TSTypeParameterInstantiation",
- },
- },
- ],
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 10,
- 13,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 36,
- ],
- "type": "TSInterfaceDeclaration",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 13,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
+ 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",
},
- "start": Object {
- "column": 14,
- "line": 1,
+ "kind": "set",
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 11,
+ },
+ },
+ "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,
+ "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",
},
},
- "name": "T",
- "range": Array [
- 14,
- 15,
- ],
- "type": "Identifier",
- },
+ ],
"range": Array [
- 14,
- 15,
+ 12,
+ 174,
],
- "type": "TSTypeParameter",
+ "type": "ObjectExpression",
},
- ],
- "range": Array [
- 13,
- 16,
- ],
- "type": "TSTypeParameterDeclaration",
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 37,
- ],
- "sourceType": "module",
- "tokens": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 9,
- ],
- "type": "Keyword",
- "value": "interface",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "range": Array [
- 10,
- 13,
- ],
- "type": "Identifier",
- "value": "Foo",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 13,
- "line": 1,
- },
- },
- "range": Array [
- 13,
- 14,
- ],
- "type": "Punctuator",
- "value": "<",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "range": Array [
- 14,
- 15,
- ],
- "type": "Identifier",
- "value": "T",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 15,
- "line": 1,
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 6,
+ 174,
+ ],
+ "type": "VariableDeclarator",
},
- },
- "range": Array [
- 15,
- 16,
],
- "type": "Punctuator",
- "value": ">",
- },
- Object {
+ "kind": "const",
"loc": Object {
"end": Object {
- "column": 24,
- "line": 1,
+ "column": 2,
+ "line": 13,
},
"start": Object {
- "column": 17,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 17,
- 24,
+ 0,
+ 175,
],
- "type": "Keyword",
- "value": "extends",
+ "type": "VariableDeclaration",
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 25,
- "line": 1,
- },
- },
- "range": Array [
- 25,
- 28,
- ],
- "type": "Identifier",
- "value": "Bar",
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 14,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 176,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 5,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 28,
- 29,
+ 0,
+ 5,
],
- "type": "Punctuator",
- "value": "<",
+ "type": "Keyword",
+ "value": "const",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 29,
- 30,
+ 6,
+ 9,
],
"type": "Identifier",
- "value": "J",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 30,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 30,
- 31,
+ 10,
+ 11,
],
"type": "Punctuator",
- "value": ">",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 32,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 32,
- 33,
+ 12,
+ 13,
],
"type": "Punctuator",
"value": "{",
@@ -51866,506 +60133,251 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 0,
- "line": 3,
- },
- },
- "range": Array [
- 35,
- 36,
- ],
- "type": "Punctuator",
- "value": "}",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/interface-with-generic.src 1`] = `
-Object {
- "body": Array [
- Object {
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "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,
+ "column": 15,
"line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
- 0,
- 21,
+ 16,
+ 29,
],
- "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",
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 3,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "String",
+ "value": "\\"constructor\\"",
},
- },
- "range": Array [
- 0,
- 22,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 1,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 15,
+ "line": 2,
},
},
"range": Array [
- 0,
- 9,
+ 29,
+ 30,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 1,
+ "column": 17,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 1,
+ "column": 16,
+ "line": 2,
},
},
"range": Array [
- 10,
- 14,
+ 30,
+ 31,
],
"type": "Identifier",
- "value": "Test",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 1,
+ "column": 18,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 17,
+ "line": 2,
},
},
"range": Array [
- 14,
- 15,
+ 31,
+ 32,
],
"type": "Punctuator",
- "value": "<",
+ "value": ">",
},
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,
+ 32,
+ 33,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 16,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
},
"range": Array [
- 16,
- 17,
+ 33,
+ 34,
],
"type": "Punctuator",
- "value": ">",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 1,
+ "column": 21,
+ "line": 2,
},
"start": Object {
- "column": 18,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
},
"range": Array [
- 18,
- 19,
+ 34,
+ 35,
],
"type": "Punctuator",
- "value": "{",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 28,
"line": 2,
},
"start": Object {
- "column": 0,
+ "column": 22,
"line": 2,
},
},
"range": Array [
- 20,
- 21,
+ 36,
+ 42,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "number",
},
- ],
- "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": 15,
- "line": 1,
- },
- },
- "range": Array [
- 15,
- 87,
- ],
- "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": 7,
+ "column": 30,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 29,
+ "line": 2,
},
},
"range": Array [
- 0,
- 87,
+ 43,
+ 44,
],
- "type": "TSInterfaceDeclaration",
+ "type": "Punctuator",
+ "value": "{",
},
- ],
- "comments": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 5,
+ "column": 10,
+ "line": 3,
},
"start": Object {
"column": 4,
- "line": 2,
+ "line": 3,
},
},
"range": Array [
- 21,
- 71,
+ 49,
+ 55,
],
- "type": "Block",
- "value": "*
- * Comment Line 1
- * @baz bar
- ",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 8,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Keyword",
+ "value": "return",
},
- },
- "range": Array [
- 0,
- 88,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 1,
+ "column": 12,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 11,
+ "line": 3,
},
},
"range": Array [
- 0,
- 9,
+ 56,
+ 57,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "Numeric",
+ "value": "1",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 1,
+ "column": 3,
+ "line": 4,
},
"start": Object {
- "column": 10,
- "line": 1,
+ "column": 2,
+ "line": 4,
},
},
"range": Array [
- 10,
- 14,
+ 60,
+ 61,
],
- "type": "Identifier",
- "value": "Test",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 4,
+ "line": 4,
},
"start": Object {
- "column": 15,
- "line": 1,
+ "column": 3,
+ "line": 4,
},
},
"range": Array [
- 15,
- 16,
+ 61,
+ 62,
],
"type": "Punctuator",
- "value": "{",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 6,
+ "column": 5,
+ "line": 5,
},
"start": Object {
- "column": 4,
- "line": 6,
+ "column": 2,
+ "line": 5,
},
},
"range": Array [
- 76,
- 79,
+ 65,
+ 68,
],
"type": "Identifier",
"value": "foo",
@@ -52373,813 +60385,467 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 6,
+ "column": 6,
+ "line": 5,
},
"start": Object {
- "column": 7,
- "line": 6,
+ "column": 5,
+ "line": 5,
},
},
"range": Array [
- 79,
- 80,
+ 68,
+ 69,
],
"type": "Punctuator",
- "value": "(",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 6,
+ "column": 7,
+ "line": 5,
},
"start": Object {
- "column": 8,
- "line": 6,
+ "column": 6,
+ "line": 5,
},
},
"range": Array [
- 80,
- 83,
+ 69,
+ 70,
],
"type": "Identifier",
- "value": "bar",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 6,
+ "column": 8,
+ "line": 5,
},
"start": Object {
- "column": 11,
- "line": 6,
+ "column": 7,
+ "line": 5,
},
},
"range": Array [
- 83,
- 84,
+ 70,
+ 71,
],
"type": "Punctuator",
- "value": ")",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 6,
+ "column": 9,
+ "line": 5,
},
"start": Object {
- "column": 12,
- "line": 6,
+ "column": 8,
+ "line": 5,
},
},
"range": Array [
- 84,
- 85,
+ 71,
+ 72,
],
"type": "Punctuator",
- "value": ";",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 7,
+ "column": 10,
+ "line": 5,
},
"start": Object {
- "column": 0,
- "line": 7,
+ "column": 9,
+ "line": 5,
},
},
"range": Array [
- 86,
- 87,
+ 72,
+ 73,
],
"type": "Punctuator",
- "value": "}",
+ "value": ")",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/interface-with-method.src 1`] = `
-Object {
- "body": Array [
Object {
- "body": Object {
- "body": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 2,
- },
- "start": Object {
- "column": 2,
- "line": 2,
- },
- },
- "name": "h",
- "range": Array [
- 19,
- 20,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 2,
- "line": 2,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "name": "bar",
- "range": Array [
- 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 [
- 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": 4,
- },
- "start": Object {
- "column": 15,
- "line": 1,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 5,
},
- "range": Array [
- 15,
- 61,
- ],
- "type": "TSInterfaceBody",
- },
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
+ "start": Object {
+ "column": 10,
+ "line": 5,
},
- "name": "test",
- "range": Array [
- 10,
- 14,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 73,
+ 74,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 18,
+ "line": 5,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 12,
+ "line": 5,
},
},
"range": Array [
- 0,
- 61,
+ 75,
+ 81,
],
- "type": "TSInterfaceDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 5,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Identifier",
+ "value": "number",
},
- },
- "range": Array [
- 0,
- 62,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 1,
+ "column": 20,
+ "line": 5,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 19,
+ "line": 5,
},
},
"range": Array [
- 0,
- 9,
+ 82,
+ 83,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 1,
+ "column": 10,
+ "line": 6,
},
"start": Object {
- "column": 10,
- "line": 1,
+ "column": 4,
+ "line": 6,
},
},
"range": Array [
- 10,
- 14,
+ 88,
+ 94,
],
- "type": "Identifier",
- "value": "test",
+ "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": 3,
- "line": 2,
+ "line": 7,
},
"start": Object {
"column": 2,
- "line": 2,
+ "line": 7,
},
},
"range": Array [
- 19,
- 20,
+ 99,
+ 100,
],
- "type": "Identifier",
- "value": "h",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
"column": 4,
- "line": 2,
+ "line": 7,
},
"start": Object {
"column": 3,
- "line": 2,
+ "line": 7,
},
},
"range": Array [
- 20,
- 21,
+ 100,
+ 101,
],
"type": "Punctuator",
- "value": "(",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 104,
+ 107,
+ ],
+ "type": "Identifier",
+ "value": "get",
},
Object {
"loc": Object {
"end": Object {
"column": 7,
- "line": 2,
+ "line": 8,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 6,
+ "line": 8,
},
},
"range": Array [
- 21,
- 24,
+ 108,
+ 109,
],
"type": "Identifier",
- "value": "bar",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
"column": 8,
- "line": 2,
+ "line": 8,
},
"start": Object {
"column": 7,
- "line": 2,
+ "line": 8,
},
},
"range": Array [
- 24,
- 25,
+ 109,
+ 110,
],
"type": "Punctuator",
- "value": ":",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 2,
+ "column": 9,
+ "line": 8,
},
"start": Object {
- "column": 9,
- "line": 2,
+ "column": 8,
+ "line": 8,
},
},
"range": Array [
- 26,
- 32,
+ 110,
+ 111,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 2,
+ "column": 10,
+ "line": 8,
},
"start": Object {
- "column": 15,
- "line": 2,
+ "column": 9,
+ "line": 8,
},
},
"range": Array [
- 32,
- 33,
+ 111,
+ 112,
],
"type": "Punctuator",
- "value": ")",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
"column": 17,
- "line": 2,
+ "line": 8,
},
"start": Object {
- "column": 16,
- "line": 2,
+ "column": 11,
+ "line": 8,
},
},
"range": Array [
- 33,
- 34,
+ 113,
+ 119,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 2,
+ "column": 19,
+ "line": 8,
},
"start": Object {
"column": 18,
- "line": 2,
+ "line": 8,
},
},
"range": Array [
- 35,
- 39,
+ 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": "void",
+ "value": "return",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 2,
+ "column": 12,
+ "line": 9,
},
"start": Object {
- "column": 22,
- "line": 2,
+ "column": 11,
+ "line": 9,
},
},
"range": Array [
- 39,
- 40,
+ 133,
+ 134,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Numeric",
+ "value": "1",
},
Object {
"loc": Object {
"end": Object {
"column": 3,
- "line": 3,
+ "line": 10,
},
"start": Object {
"column": 2,
- "line": 3,
+ "line": 10,
},
},
"range": Array [
- 43,
- 44,
+ 137,
+ 138,
],
- "type": "Identifier",
- "value": "g",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
"column": 4,
- "line": 3,
+ "line": 10,
},
"start": Object {
"column": 3,
- "line": 3,
+ "line": 10,
},
},
"range": Array [
- 44,
- 45,
+ 138,
+ 139,
],
"type": "Punctuator",
- "value": "<",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
"column": 5,
- "line": 3,
+ "line": 11,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 2,
+ "line": 11,
},
},
"range": Array [
- 45,
- 46,
+ 142,
+ 145,
],
"type": "Identifier",
- "value": "T",
+ "value": "set",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
- "line": 3,
+ "column": 7,
+ "line": 11,
},
"start": Object {
- "column": 5,
- "line": 3,
+ "column": 6,
+ "line": 11,
},
},
"range": Array [
- 46,
- 47,
+ 146,
+ 147,
],
- "type": "Punctuator",
- "value": ">",
+ "type": "Identifier",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 3,
+ "column": 8,
+ "line": 11,
},
"start": Object {
- "column": 6,
- "line": 3,
+ "column": 7,
+ "line": 11,
},
},
"range": Array [
- 47,
- 48,
+ 147,
+ 148,
],
"type": "Punctuator",
"value": "(",
@@ -53187,35 +60853,89 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 3,
+ "column": 9,
+ "line": 11,
},
"start": Object {
- "column": 7,
- "line": 3,
+ "column": 8,
+ "line": 11,
},
},
"range": Array [
- 48,
- 51,
+ 148,
+ 149,
],
"type": "Identifier",
- "value": "bar",
+ "value": "x",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 149,
+ 150,
+ ],
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
+ "column": 17,
+ "line": 11,
+ },
+ "start": Object {
"column": 11,
- "line": 3,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 151,
+ 157,
+ ],
+ "type": "Identifier",
+ "value": "number",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 11,
},
"start": Object {
- "column": 10,
- "line": 3,
+ "column": 17,
+ "line": 11,
},
},
"range": Array [
- 51,
- 52,
+ 157,
+ 158,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 11,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 158,
+ 159,
],
"type": "Punctuator",
"value": ":",
@@ -53223,84 +60943,219 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 3,
+ "column": 26,
+ "line": 11,
},
"start": Object {
- "column": 12,
- "line": 3,
+ "column": 20,
+ "line": 11,
},
},
"range": Array [
- 53,
- 54,
+ 160,
+ 166,
],
"type": "Identifier",
- "value": "T",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 3,
+ "column": 28,
+ "line": 11,
},
"start": Object {
- "column": 13,
- "line": 3,
+ "column": 27,
+ "line": 11,
+ },
+ },
+ "range": Array [
+ 167,
+ 168,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 12,
+ },
+ },
+ "range": Array [
+ 171,
+ 172,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 173,
+ 174,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 2,
+ "line": 13,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 13,
+ },
+ },
+ "range": Array [
+ 174,
+ 175,
+ ],
+ "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": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 45,
+ 60,
+ ],
+ "type": "ExpressionStatement",
+ },
+ ],
+ "comments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 44,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 54,
- 55,
+ 0,
+ 44,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Line",
+ "value": " this should not be classed as a directive",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
},
+ "start": Object {
+ "column": 0,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 45,
+ 60,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 3,
+ "column": 1,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 3,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 55,
- 56,
+ 45,
+ 46,
],
"type": "Punctuator",
- "value": ":",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 3,
+ "column": 13,
+ "line": 2,
},
"start": Object {
- "column": 16,
- "line": 3,
+ "column": 1,
+ "line": 2,
},
},
"range": Array [
- 57,
+ 46,
58,
],
- "type": "Identifier",
- "value": "T",
+ "type": "String",
+ "value": "\\"use strict\\"",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 3,
+ "column": 14,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 3,
+ "column": 13,
+ "line": 2,
},
},
"range": Array [
@@ -53308,331 +61163,221 @@ Object {
59,
],
"type": "Punctuator",
- "value": ";",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 4,
+ "column": 14,
+ "line": 2,
},
},
"range": Array [
+ 59,
60,
- 61,
],
"type": "Punctuator",
- "value": "}",
+ "value": ";",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/interface-with-optional-properties.src 1`] = `
+exports[`typescript fixtures/basics/symbol-type-param.src 1`] = `
Object {
"body": Array [
Object {
+ "async": false,
"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",
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 40,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 40,
+ 42,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "name": "test",
+ "range": Array [
+ 9,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
},
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
+ "start": Object {
+ "column": 14,
+ "line": 1,
},
- "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",
- },
+ "name": "abc",
+ "range": Array [
+ 14,
+ 38,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 3,
+ "column": 38,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 17,
+ "line": 1,
},
},
- "optional": true,
"range": Array [
- 31,
- 44,
+ 17,
+ 38,
],
- "type": "TSPropertySignature",
+ "type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "range": Array [
- 35,
- 43,
- ],
- "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,
+ "column": 38,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 4,
+ "column": 19,
+ "line": 1,
},
},
- "name": "baz",
"range": Array [
- 49,
- 52,
+ 19,
+ 38,
],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 4,
- },
- "start": Object {
- "column": 4,
- "line": 4,
- },
- },
- "optional": true,
- "params": Array [
- Object {
+ "type": "TSTypeReference",
+ "typeName": Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 4,
+ "column": 22,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 4,
+ "column": 19,
+ "line": 1,
},
},
- "name": "foo",
+ "name": "Map",
"range": Array [
- 54,
- 57,
+ 19,
+ 22,
],
"type": "Identifier",
},
- Object {
+ "typeParameters": Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 4,
+ "column": 38,
+ "line": 1,
},
"start": Object {
- "column": 14,
- "line": 4,
+ "column": 22,
+ "line": 1,
},
},
- "name": "bar",
- "optional": true,
- "range": Array [
- 59,
- 71,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 4,
- },
- "start": Object {
- "column": 18,
- "line": 4,
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 1,
+ },
},
+ "range": Array [
+ 23,
+ 29,
+ ],
+ "type": "TSSymbolKeyword",
},
- "range": Array [
- 63,
- 71,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 4,
+ "column": 37,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 4,
+ "column": 31,
+ "line": 1,
},
},
"range": Array [
- 65,
- 71,
+ 31,
+ 37,
],
"type": "TSStringKeyword",
},
- },
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 4,
- },
- "start": Object {
- "column": 28,
- "line": 4,
- },
- },
- "name": "baz",
- "optional": true,
+ ],
"range": Array [
- 73,
- 76,
+ 22,
+ 38,
],
- "type": "Identifier",
+ "type": "TSTypeParameterInstantiation",
},
- ],
- "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,
+ },
},
},
- "name": "test",
- "range": Array [
- 10,
- 14,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 5,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
+ ],
"range": Array [
0,
- 81,
+ 42,
],
- "type": "TSInterfaceDeclaration",
+ "type": "FunctionDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 6,
+ "column": 42,
+ "line": 1,
},
"start": Object {
"column": 0,
@@ -53641,14 +61386,14 @@ Object {
},
"range": Array [
0,
- 82,
+ 42,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -53658,25 +61403,25 @@ Object {
},
"range": Array [
0,
- 9,
+ 8,
],
"type": "Keyword",
- "value": "interface",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 10,
- 14,
+ 9,
+ 13,
],
"type": "Identifier",
"value": "test",
@@ -53684,539 +61429,957 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 15,
- 16,
+ 13,
+ 14,
],
"type": "Punctuator",
- "value": "{",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 2,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 14,
+ "line": 1,
},
},
"range": Array [
- 21,
- 24,
+ 14,
+ 17,
],
"type": "Identifier",
- "value": "foo",
+ "value": "abc",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 2,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 7,
- "line": 2,
+ "column": 17,
+ "line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 17,
+ 18,
],
"type": "Punctuator",
- "value": "?",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 2,
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 19,
+ 22,
+ ],
+ "type": "Identifier",
+ "value": "Map",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 2,
+ "column": 22,
+ "line": 1,
},
},
"range": Array [
- 25,
- 26,
+ 22,
+ 23,
],
"type": "Punctuator",
- "value": ";",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 3,
+ "column": 29,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 23,
+ "line": 1,
},
},
"range": Array [
- 31,
- 34,
+ 23,
+ 29,
],
"type": "Identifier",
- "value": "bar",
+ "value": "symbol",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 3,
+ "column": 30,
+ "line": 1,
},
"start": Object {
- "column": 7,
- "line": 3,
+ "column": 29,
+ "line": 1,
},
},
"range": Array [
- 34,
- 35,
+ 29,
+ 30,
],
"type": "Punctuator",
- "value": "?",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 3,
+ "column": 37,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 3,
+ "column": 31,
+ "line": 1,
},
},
"range": Array [
- 35,
- 36,
+ 31,
+ 37,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 3,
+ "column": 38,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 3,
+ "column": 37,
+ "line": 1,
},
},
"range": Array [
37,
- 43,
+ 38,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 3,
+ "column": 39,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 3,
+ "column": 38,
+ "line": 1,
},
},
"range": Array [
- 43,
- 44,
+ 38,
+ 39,
],
"type": "Punctuator",
- "value": ";",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 4,
+ "column": 41,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 4,
+ "column": 40,
+ "line": 1,
},
},
"range": Array [
- 49,
- 52,
+ 40,
+ 41,
],
- "type": "Identifier",
- "value": "baz",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 4,
+ "column": 42,
+ "line": 1,
},
"start": Object {
- "column": 7,
- "line": 4,
+ "column": 41,
+ "line": 1,
},
},
"range": Array [
- 52,
- 53,
+ 41,
+ 42,
],
"type": "Punctuator",
- "value": "?",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Result",
+ "range": Array [
+ 5,
+ 11,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 9,
- "line": 4,
+ "column": 37,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 53,
- 54,
+ 0,
+ 37,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 37,
+ ],
+ "type": "TSUnionType",
+ "types": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 27,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "name": "Success",
+ "range": Array [
+ 17,
+ 24,
+ ],
+ "type": "Identifier",
+ },
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 26,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 25,
+ 26,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
+ "range": Array [
+ 24,
+ 27,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 37,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "name": "Failure",
+ "range": Array [
+ 30,
+ 37,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
+ },
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 12,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 12,
+ 13,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 11,
+ 14,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 37,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 4,
+ "column": 4,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 54,
- 57,
+ 0,
+ 4,
],
"type": "Identifier",
- "value": "foo",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 4,
+ "column": 11,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 4,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 57,
- 58,
+ 5,
+ 11,
],
- "type": "Punctuator",
- "value": ",",
+ "type": "Identifier",
+ "value": "Result",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 4,
+ "column": 12,
+ "line": 1,
},
"start": Object {
- "column": 14,
- "line": 4,
+ "column": 11,
+ "line": 1,
},
},
"range": Array [
- 59,
- 62,
+ 11,
+ 12,
],
- "type": "Identifier",
- "value": "bar",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 4,
+ "column": 13,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 4,
+ "column": 12,
+ "line": 1,
},
},
"range": Array [
- 62,
- 63,
+ 12,
+ 13,
],
- "type": "Punctuator",
- "value": "?",
+ "type": "Identifier",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 4,
+ "column": 14,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 4,
+ "column": 13,
+ "line": 1,
},
},
"range": Array [
- 63,
- 64,
+ 13,
+ 14,
],
"type": "Punctuator",
- "value": ":",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 4,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 4,
+ "column": 15,
+ "line": 1,
},
},
"range": Array [
- 65,
- 71,
+ 15,
+ 16,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 4,
+ "column": 24,
+ "line": 1,
},
"start": Object {
- "column": 26,
- "line": 4,
+ "column": 17,
+ "line": 1,
},
},
"range": Array [
- 71,
- 72,
+ 17,
+ 24,
],
- "type": "Punctuator",
- "value": ",",
+ "type": "Identifier",
+ "value": "Success",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 4,
+ "column": 25,
+ "line": 1,
},
"start": Object {
- "column": 28,
- "line": 4,
+ "column": 24,
+ "line": 1,
},
},
"range": Array [
- 73,
- 76,
+ 24,
+ 25,
],
- "type": "Identifier",
- "value": "baz",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 32,
- "line": 4,
+ "column": 26,
+ "line": 1,
},
"start": Object {
- "column": 31,
- "line": 4,
+ "column": 25,
+ "line": 1,
},
},
"range": Array [
- 76,
- 77,
+ 25,
+ 26,
],
- "type": "Punctuator",
- "value": "?",
+ "type": "Identifier",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
- "line": 4,
+ "column": 27,
+ "line": 1,
},
"start": Object {
- "column": 32,
- "line": 4,
+ "column": 26,
+ "line": 1,
},
},
"range": Array [
- 77,
- 78,
+ 26,
+ 27,
],
"type": "Punctuator",
- "value": ")",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 34,
- "line": 4,
+ "column": 29,
+ "line": 1,
},
"start": Object {
- "column": 33,
- "line": 4,
+ "column": 28,
+ "line": 1,
},
},
"range": Array [
- 78,
- 79,
+ 28,
+ 29,
],
"type": "Punctuator",
- "value": ";",
+ "value": "|",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 5,
+ "column": 37,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 5,
+ "column": 30,
+ "line": 1,
},
},
"range": Array [
- 80,
- 81,
+ 30,
+ 37,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "Failure",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/interface-without-type-annotation.src 1`] = `
+exports[`typescript fixtures/basics/type-alias-declaration-with-constrained-type-parameter.src 1`] = `
Object {
"body": Array [
Object {
- "body": Object {
- "body": Array [
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Result",
+ "range": Array [
+ 5,
+ 11,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 48,
+ ],
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 48,
+ ],
+ "type": "TSUnionType",
+ "types": Array [
Object {
- "computed": false,
- "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 38,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 2,
+ "column": 35,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 28,
+ "line": 1,
},
},
- "name": "foo",
+ "name": "Success",
"range": Array [
- 21,
- 24,
+ 28,
+ 35,
],
"type": "Identifier",
},
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 36,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 36,
+ 37,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 36,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 36,
+ 37,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
+ "range": Array [
+ 35,
+ 38,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 2,
+ "column": 48,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 41,
+ "line": 1,
},
},
"range": Array [
- 21,
- 25,
+ 41,
+ 48,
],
- "type": "TSPropertySignature",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 1,
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 1,
+ },
+ },
+ "name": "Failure",
+ "range": Array [
+ 41,
+ 48,
+ ],
+ "type": "Identifier",
+ },
},
- },
- "range": Array [
- 15,
- 27,
],
- "type": "TSInterfaceBody",
},
- "id": Object {
+ "typeParameters": Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 25,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 11,
"line": 1,
},
},
- "name": "test",
+ "params": Array [
+ Object {
+ "constraint": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "members": Array [],
+ "range": Array [
+ 22,
+ 24,
+ ],
+ "type": "TSTypeLiteral",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 12,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 12,
+ 24,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
"range": Array [
- 10,
- 14,
+ 11,
+ 25,
],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
+ "type": "TSTypeParameterDeclaration",
},
- "range": Array [
- 0,
- 27,
- ],
- "type": "TSInterfaceDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 4,
+ "column": 48,
+ "line": 1,
},
"start": Object {
"column": 0,
@@ -54225,14 +62388,14 @@ Object {
},
"range": Array [
0,
- 28,
+ 48,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 4,
"line": 1,
},
"start": Object {
@@ -54242,355 +62405,356 @@ Object {
},
"range": Array [
0,
- 9,
+ 4,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 10,
- 14,
+ 5,
+ 11,
],
"type": "Identifier",
- "value": "test",
+ "value": "Result",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 15,
- 16,
+ 11,
+ 12,
],
"type": "Punctuator",
- "value": "{",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 2,
+ "column": 13,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 12,
+ "line": 1,
},
},
"range": Array [
- 21,
- 24,
+ 12,
+ 13,
],
"type": "Identifier",
- "value": "foo",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 2,
+ "column": 21,
+ "line": 1,
},
"start": Object {
- "column": 7,
- "line": 2,
+ "column": 14,
+ "line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 14,
+ 21,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Keyword",
+ "value": "extends",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 23,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 22,
+ "line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 22,
+ 23,
],
"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": 19,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 0,
- 19,
+ 23,
+ 24,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
},
- "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",
- },
+ "start": Object {
+ "column": 24,
+ "line": 1,
},
},
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 20,
- ],
- "sourceType": "module",
- "tokens": Array [
+ "range": Array [
+ 24,
+ 25,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 0,
- 4,
+ 26,
+ 27,
],
- "type": "Identifier",
- "value": "type",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 35,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 5,
- 6,
+ 28,
+ 35,
],
"type": "Identifier",
- "value": "x",
+ "value": "Success",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 36,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 35,
"line": 1,
},
},
"range": Array [
- 7,
- 8,
+ 35,
+ 36,
],
"type": "Punctuator",
- "value": "=",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 37,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 36,
"line": 1,
},
},
"range": Array [
- 9,
- 14,
+ 36,
+ 37,
],
"type": "Identifier",
- "value": "keyof",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 38,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 37,
"line": 1,
},
},
"range": Array [
- 15,
- 18,
+ 37,
+ 38,
],
- "type": "Identifier",
- "value": "foo",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 40,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 39,
"line": 1,
},
},
"range": Array [
- 18,
- 19,
+ 39,
+ 40,
],
"type": "Punctuator",
- "value": ";",
+ "value": "|",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 41,
+ 48,
+ ],
+ "type": "Identifier",
+ "value": "Failure",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = `
+exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = `
Object {
"body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 30,
+ ],
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "members": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 12,
+ 15,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 44,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 4,
+ "column": 12,
"line": 1,
},
},
- "name": "nestedArray",
"range": Array [
- 4,
- 44,
+ 12,
+ 24,
],
- "type": "Identifier",
+ "type": "TSPropertySignature",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 44,
+ "column": 23,
"line": 1,
},
"start": Object {
@@ -54600,13 +62764,13 @@ Object {
},
"range": Array [
15,
- 44,
+ 23,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 44,
+ "column": 23,
"line": 1,
},
"start": Object {
@@ -54616,215 +62780,62 @@ Object {
},
"range": Array [
17,
- 44,
+ 23,
],
- "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",
- },
+ "type": "TSStringKeyword",
},
},
},
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 44,
- "line": 1,
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 25,
+ 28,
+ ],
+ "type": "Identifier",
},
- "start": Object {
- "column": 4,
- "line": 1,
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
},
+ "range": Array [
+ 25,
+ 28,
+ ],
+ "type": "TSPropertySignature",
},
- "range": Array [
- 4,
- 44,
- ],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "var",
- "loc": Object {
- "end": Object {
- "column": 44,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
+ ],
+ "range": Array [
+ 11,
+ 29,
+ ],
+ "type": "TSTypeLiteral",
},
- "range": Array [
- 0,
- 44,
- ],
- "type": "VariableDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 44,
- "line": 1,
+ "column": 0,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -54833,14 +62844,14 @@ Object {
},
"range": Array [
0,
- 44,
+ 31,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 3,
+ "column": 4,
"line": 1,
},
"start": Object {
@@ -54850,233 +62861,197 @@ Object {
},
"range": Array [
0,
- 3,
- ],
- "type": "Keyword",
- "value": "var",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "range": Array [
4,
- 15,
],
"type": "Identifier",
- "value": "nestedArray",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 15,
- 16,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 17,
- 22,
+ 9,
+ 10,
],
- "type": "Identifier",
- "value": "Array",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 22,
- 23,
+ 11,
+ 12,
],
"type": "Punctuator",
- "value": "<",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 23,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 23,
- 28,
+ 12,
+ 15,
],
"type": "Identifier",
- "value": "Array",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 28,
- 29,
+ 15,
+ 16,
],
"type": "Punctuator",
- "value": "<",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 1,
- },
- "start": Object {
- "column": 29,
- "line": 1,
- },
- },
- "range": Array [
- 29,
- 34,
- ],
- "type": "Identifier",
- "value": "Array",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 34,
+ "column": 17,
"line": 1,
},
},
- "range": Array [
- 34,
- 35,
+ "range": Array [
+ 17,
+ 23,
],
- "type": "Punctuator",
- "value": "<",
+ "type": "Identifier",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 41,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 35,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 35,
- 41,
+ 23,
+ 24,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Punctuator",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 42,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 41,
+ "column": 25,
"line": 1,
},
},
"range": Array [
- 41,
- 42,
+ 25,
+ 28,
],
- "type": "Punctuator",
- "value": ">",
+ "type": "Identifier",
+ "value": "baz",
},
Object {
"loc": Object {
"end": Object {
- "column": 43,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 42,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 42,
- 43,
+ 28,
+ 29,
],
"type": "Punctuator",
- "value": ">",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 44,
+ "column": 30,
"line": 1,
},
"start": Object {
- "column": 43,
+ "column": 29,
"line": 1,
},
},
"range": Array [
- 43,
- 44,
+ 29,
+ 30,
],
"type": "Punctuator",
- "value": ">",
+ "value": ";",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/never-type-param.src 1`] = `
+exports[`typescript fixtures/basics/type-assertion.src 1`] = `
Object {
"body": Array [
Object {
@@ -55085,7 +63060,7 @@ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -55093,105 +63068,69 @@ Object {
"line": 1,
},
},
- "name": "x",
+ "name": "foo",
"range": Array [
6,
- 17,
+ 9,
],
"type": "Identifier",
- "typeAnnotation": Object {
+ },
+ "init": Object {
+ "expression": Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 7,
- 17,
+ 26,
+ 27,
],
- "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",
+ "raw": "2",
+ "type": "Literal",
+ "value": 2,
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 12,
+ 27,
+ ],
+ "type": "TSTypeAssertion",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
},
- "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",
+ "start": Object {
+ "column": 13,
+ "line": 1,
},
},
+ "range": Array [
+ 13,
+ 16,
+ ],
+ "type": "TSAnyKeyword",
},
},
- "init": null,
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 27,
"line": 1,
},
"start": Object {
@@ -55201,7 +63140,7 @@ Object {
},
"range": Array [
6,
- 17,
+ 27,
],
"type": "VariableDeclarator",
},
@@ -55209,7 +63148,7 @@ Object {
"kind": "const",
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 28,
"line": 1,
},
"start": Object {
@@ -55219,141 +63158,16 @@ Object {
},
"range": Array [
0,
- 18,
+ 28,
],
"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 {
- "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",
- },
- "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",
- },
- },
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 2,
- },
- },
- "range": Array [
- 19,
- 45,
- ],
- "type": "ExpressionStatement",
- },
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 3,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -55362,7 +63176,7 @@ Object {
},
"range": Array [
0,
- 46,
+ 29,
],
"sourceType": "module",
"tokens": Array [
@@ -55387,7 +63201,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -55397,61 +63211,43 @@ Object {
},
"range": Array [
6,
- 7,
+ 9,
],
"type": "Identifier",
- "value": "x",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 11,
"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,
+ 11,
],
- "type": "Identifier",
- "value": "X",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 10,
- 11,
+ 12,
+ 13,
],
"type": "Punctuator",
"value": "<",
@@ -55463,16 +63259,16 @@ Object {
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 11,
+ 13,
16,
],
"type": "Identifier",
- "value": "never",
+ "value": "any",
},
Object {
"loc": Object {
@@ -55495,179 +63291,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 26,
"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,
- },
- },
- "range": Array [
- 30,
- 35,
- ],
- "type": "Identifier",
- "value": "empty",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "range": Array [
- 35,
- 36,
- ],
- "type": "Punctuator",
- "value": "<",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 2,
- },
- "start": Object {
- "column": 17,
- "line": 2,
- },
- },
- "range": Array [
- 36,
- 41,
- ],
- "type": "Identifier",
- "value": "never",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 22,
- "line": 2,
- },
- },
- "range": Array [
- 41,
- 42,
- ],
- "type": "Punctuator",
- "value": ">",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 2,
- },
- "start": Object {
- "column": 23,
- "line": 2,
- },
- },
- "range": Array [
- 42,
- 43,
- ],
- "type": "Punctuator",
- "value": "(",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 2,
- },
- "start": Object {
- "column": 24,
- "line": 2,
- },
- },
- "range": Array [
- 43,
- 44,
+ 26,
+ 27,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Numeric",
+ "value": "2",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 2,
+ "column": 28,
+ "line": 1,
},
"start": Object {
- "column": 25,
- "line": 2,
+ "column": 27,
+ "line": 1,
},
},
"range": Array [
- 44,
- 45,
+ 27,
+ 28,
],
"type": "Punctuator",
"value": ";",
@@ -55677,343 +63329,199 @@ Object {
}
`;
-exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = `
+exports[`typescript fixtures/basics/type-assertion-arrow-function.src 1`] = `
Object {
"body": Array [
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",
- },
+ "declarations": Array [
+ Object {
+ "id": Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 2,
+ "column": 13,
+ "line": 1,
},
"start": Object {
"column": 4,
- "line": 2,
+ "line": 1,
},
},
+ "name": "asserted2",
"range": Array [
- 41,
- 59,
+ 4,
+ 13,
],
- "type": "ExpressionStatement",
+ "type": "Identifier",
},
- 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 {
+ "init": Object {
+ "expression": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 3,
+ "column": 39,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 3,
+ "column": 38,
+ "line": 1,
},
},
- "name": "e",
+ "name": "n",
"range": Array [
- 72,
- 73,
+ 38,
+ 39,
],
"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,
+ "column": 40,
+ "line": 1,
},
"start": Object {
- "column": 15,
- "line": 3,
+ "column": 31,
+ "line": 1,
},
},
- "name": "name",
"range": Array [
- 75,
- 79,
+ 31,
+ 40,
],
- "type": "Identifier",
+ "type": "ReturnStatement",
},
- "range": Array [
- 72,
- 79,
- ],
- "type": "MemberExpression",
- },
+ ],
"loc": Object {
"end": Object {
- "column": 19,
- "line": 3,
+ "column": 42,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 3,
+ "column": 29,
+ "line": 1,
},
},
"range": Array [
- 68,
- 79,
+ 29,
+ 42,
],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "let",
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 3,
+ "type": "BlockStatement",
},
- "start": Object {
- "column": 4,
- "line": 3,
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
},
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 1,
+ },
+ },
+ "name": "n",
+ "range": Array [
+ 23,
+ 24,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "range": Array [
+ 22,
+ 42,
+ ],
+ "type": "ArrowFunctionExpression",
},
- "range": Array [
- 64,
- 80,
- ],
- "type": "VariableDeclaration",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 4,
- },
- "start": Object {
- "column": 35,
- "line": 1,
- },
- },
- "range": Array [
- 35,
- 82,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "name": "processEntity",
- "range": Array [
- 9,
- 22,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "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,
+ "column": 43,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 25,
- 33,
+ 16,
+ 43,
],
- "type": "TSTypeAnnotation",
+ "type": "TSTypeAssertion",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 33,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 27,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 27,
- 33,
+ 17,
+ 20,
],
- "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",
- },
+ "type": "TSAnyKeyword",
+ },
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 43,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
},
},
+ "range": Array [
+ 4,
+ 43,
+ ],
+ "type": "VariableDeclarator",
},
],
+ "kind": "var",
+ "loc": Object {
+ "end": Object {
+ "column": 44,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
"range": Array [
0,
- 82,
+ 44,
],
- "type": "FunctionDeclaration",
+ "type": "VariableDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 0,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -56022,14 +63530,14 @@ Object {
},
"range": Array [
0,
- 82,
+ 45,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 3,
"line": 1,
},
"start": Object {
@@ -56039,151 +63547,205 @@ Object {
},
"range": Array [
0,
- 8,
+ 3,
],
"type": "Keyword",
- "value": "function",
+ "value": "var",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 4,
"line": 1,
},
},
"range": Array [
- 9,
- 22,
+ 4,
+ 13,
],
"type": "Identifier",
- "value": "processEntity",
+ "value": "asserted2",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 22,
- 23,
+ 14,
+ 15,
],
"type": "Punctuator",
- "value": "(",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 23,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 23,
- 24,
+ 16,
+ 17,
+ ],
+ "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": "e",
+ "value": "any",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 20,
+ 21,
],
"type": "Punctuator",
- "value": "?",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 25,
- 26,
+ 21,
+ 22,
],
"type": "Punctuator",
- "value": ":",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 27,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 27,
- 33,
+ 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": "Entity",
+ "value": "n",
+ },
+ 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": 34,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 33,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 33,
- 34,
+ 26,
+ 28,
],
"type": "Punctuator",
- "value": ")",
+ "value": "=>",
},
Object {
"loc": Object {
"end": Object {
- "column": 36,
+ "column": 30,
"line": 1,
},
"start": Object {
- "column": 35,
+ "column": 29,
"line": 1,
},
},
"range": Array [
- 35,
- 36,
+ 29,
+ 30,
],
"type": "Punctuator",
"value": "{",
@@ -56191,1073 +63753,1125 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 2,
+ "column": 37,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 31,
+ "line": 1,
},
},
"range": Array [
- 41,
- 55,
+ 31,
+ 37,
],
- "type": "Identifier",
- "value": "validateEntity",
+ "type": "Keyword",
+ "value": "return",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 2,
+ "column": 39,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 2,
+ "column": 38,
+ "line": 1,
},
},
"range": Array [
- 55,
- 56,
+ 38,
+ 39,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "n",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 2,
+ "column": 40,
+ "line": 1,
},
"start": Object {
- "column": 19,
- "line": 2,
+ "column": 39,
+ "line": 1,
},
},
"range": Array [
- 56,
- 57,
+ 39,
+ 40,
],
- "type": "Identifier",
- "value": "e",
+ "type": "Punctuator",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 2,
+ "column": 42,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 2,
+ "column": 41,
+ "line": 1,
},
},
"range": Array [
- 57,
- 58,
+ 41,
+ 42,
],
"type": "Punctuator",
- "value": ")",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 2,
+ "column": 43,
+ "line": 1,
},
"start": Object {
- "column": 21,
- "line": 2,
+ "column": 42,
+ "line": 1,
},
},
"range": Array [
- 58,
- 59,
+ 42,
+ 43,
],
"type": "Punctuator",
- "value": ";",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 3,
+ "column": 44,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 43,
+ "line": 1,
},
},
"range": Array [
- 64,
- 67,
+ 43,
+ 44,
],
- "type": "Keyword",
- "value": "let",
+ "type": "Punctuator",
+ "value": ";",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/type-guard-in-arrow-function.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "isString",
+ "range": Array [
+ 6,
+ 14,
+ ],
+ "type": "Identifier",
+ },
+ "init": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
+ "left": Object {
+ "argument": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 62,
+ 63,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "operator": "typeof",
+ "prefix": true,
+ "range": Array [
+ 55,
+ 63,
+ ],
+ "type": "UnaryExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "operator": "===",
+ "range": Array [
+ 55,
+ 76,
+ ],
+ "right": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 68,
+ 76,
+ ],
+ "raw": "'string'",
+ "type": "Literal",
+ "value": "string",
+ },
+ "type": "BinaryExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 48,
+ 76,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 42,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 42,
+ 78,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 18,
+ 24,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 19,
+ 24,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 21,
+ 24,
+ ],
+ "type": "TSAnyKeyword",
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 17,
+ 78,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 38,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 1,
+ },
+ },
+ "parameterName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 1,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 27,
+ 28,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 27,
+ 38,
+ ],
+ "type": "TSTypePredicate",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 32,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 32,
+ 38,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 32,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 32,
+ 38,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ },
+ "type": "ArrowFunctionExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 6,
+ 78,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "kind": "const",
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 1,
"line": 3,
},
"start": Object {
- "column": 8,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 68,
- 69,
+ 0,
+ 78,
],
- "type": "Identifier",
- "value": "s",
+ "type": "VariableDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 79,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 3,
+ "column": 5,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 70,
- 71,
+ 0,
+ 5,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Keyword",
+ "value": "const",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 3,
+ "column": 14,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 3,
+ "column": 6,
+ "line": 1,
},
},
"range": Array [
- 72,
- 73,
+ 6,
+ 14,
],
"type": "Identifier",
- "value": "e",
+ "value": "isString",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 3,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 13,
- "line": 3,
+ "column": 15,
+ "line": 1,
},
},
"range": Array [
- 73,
- 74,
+ 15,
+ 16,
],
"type": "Punctuator",
- "value": "!",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 14,
- "line": 3,
+ "column": 17,
+ "line": 1,
},
},
"range": Array [
- 74,
- 75,
+ 17,
+ 18,
],
"type": "Punctuator",
- "value": ".",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
"column": 19,
- "line": 3,
+ "line": 1,
},
"start": Object {
- "column": 15,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
},
"range": Array [
- 75,
- 79,
+ 18,
+ 19,
],
"type": "Identifier",
- "value": "name",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
"column": 20,
- "line": 3,
+ "line": 1,
},
"start": Object {
"column": 19,
- "line": 3,
+ "line": 1,
},
},
"range": Array [
- 79,
- 80,
+ 19,
+ 20,
],
"type": "Punctuator",
- "value": ";",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 24,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 4,
+ "column": 21,
+ "line": 1,
},
},
"range": Array [
- 81,
- 82,
+ 21,
+ 24,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "any",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = `
-Object {
- "body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "name": "x",
- "range": Array [
- 4,
- 11,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "range": Array [
- 5,
- 11,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
- },
- "range": Array [
- 7,
- 11,
- ],
- "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,
+ "column": 25,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 24,
"line": 1,
},
},
"range": Array [
- 0,
- 12,
+ 24,
+ 25,
],
- "type": "VariableDeclaration",
+ "type": "Punctuator",
+ "value": ")",
},
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,
- },
- },
- "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",
- },
- },
- },
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 17,
- 29,
- ],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "let",
"loc": Object {
"end": Object {
- "column": 17,
- "line": 2,
+ "column": 26,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 2,
+ "column": 25,
+ "line": 1,
},
},
"range": Array [
- 13,
- 30,
+ 25,
+ 26,
],
- "type": "VariableDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": ":",
},
- },
- "range": Array [
- 0,
- 30,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 3,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 27,
"line": 1,
},
},
"range": Array [
- 0,
- 3,
+ 27,
+ 28,
],
- "type": "Keyword",
- "value": "let",
+ "type": "Identifier",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 31,
"line": 1,
},
"start": Object {
- "column": 4,
+ "column": 29,
"line": 1,
},
},
"range": Array [
- 4,
- 5,
+ 29,
+ 31,
],
"type": "Identifier",
- "value": "x",
+ "value": "is",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 38,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 32,
"line": 1,
},
},
"range": Array [
- 5,
- 6,
+ 32,
+ 38,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 41,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 39,
"line": 1,
},
},
"range": Array [
- 7,
- 11,
+ 39,
+ 41,
],
- "type": "Keyword",
- "value": "null",
+ "type": "Punctuator",
+ "value": "=>",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 43,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 42,
"line": 1,
},
},
"range": Array [
- 11,
- 12,
+ 42,
+ 43,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 3,
+ "column": 10,
"line": 2,
},
"start": Object {
- "column": 0,
+ "column": 4,
"line": 2,
},
},
"range": Array [
- 13,
- 16,
+ 48,
+ 54,
],
"type": "Keyword",
- "value": "let",
+ "value": "return",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 17,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 11,
"line": 2,
},
},
"range": Array [
- 17,
- 18,
+ 55,
+ 61,
],
- "type": "Identifier",
- "value": "y",
+ "type": "Keyword",
+ "value": "typeof",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 19,
"line": 2,
},
"start": Object {
- "column": 5,
+ "column": 18,
"line": 2,
},
},
"range": Array [
- 18,
- 19,
+ 62,
+ 63,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 23,
"line": 2,
},
"start": Object {
- "column": 7,
+ "column": 20,
"line": 2,
},
},
"range": Array [
- 20,
- 29,
+ 64,
+ 67,
],
- "type": "Identifier",
- "value": "undefined",
+ "type": "Punctuator",
+ "value": "===",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 32,
"line": 2,
},
"start": Object {
- "column": 16,
+ "column": 24,
"line": 2,
},
},
"range": Array [
- 29,
- 30,
+ 68,
+ 76,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "String",
+ "value": "'string'",
},
- ],
- "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,
- },
- },
- "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",
- },
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
- "line": 1,
+ "line": 3,
},
},
"range": Array [
- 0,
- 17,
+ 77,
+ 78,
],
- "type": "ExpressionStatement",
+ "type": "Punctuator",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/type-guard-in-function.src 1`] = `
+Object {
+ "body": Array [
Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 3,
- },
- "start": Object {
- "column": 1,
- "line": 3,
- },
- },
- "properties": Array [
+ "async": false,
+ "body": Object {
+ "body": Array [
Object {
- "computed": false,
- "key": Object {
+ "argument": Object {
+ "left": Object {
+ "argument": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 59,
+ 60,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "operator": "typeof",
+ "prefix": true,
+ "range": Array [
+ 52,
+ 60,
+ ],
+ "type": "UnaryExpression",
+ },
"loc": Object {
"end": Object {
- "column": 7,
- "line": 3,
+ "column": 32,
+ "line": 2,
},
"start": Object {
- "column": 3,
- "line": 3,
+ "column": 11,
+ "line": 2,
},
},
+ "operator": "===",
"range": Array [
- 22,
- 26,
+ 52,
+ 73,
],
- "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 [],
+ "right": Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 3,
+ "column": 32,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 3,
+ "column": 24,
+ "line": 2,
},
},
"range": Array [
- 29,
- 31,
+ 65,
+ 73,
],
- "type": "BlockStatement",
+ "raw": "'string'",
+ "type": "Literal",
+ "value": "string",
},
- "expression": false,
- "generator": false,
- "id": null,
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 3,
- },
- "start": Object {
- "column": 7,
- "line": 3,
- },
+ "type": "BinaryExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
},
- "params": Array [],
- "range": Array [
- 26,
- 31,
- ],
- "type": "FunctionExpression",
},
+ "range": Array [
+ 45,
+ 73,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 39,
+ "line": 1,
},
+ },
+ "range": Array [
+ 39,
+ 75,
],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "name": "isString",
"range": Array [
- 20,
- 33,
+ 9,
+ 17,
],
- "type": "ObjectExpression",
+ "type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 1,
"line": 3,
},
"start": Object {
"column": 0,
- "line": 3,
+ "line": 1,
},
},
- "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": 5,
- },
- },
- "range": Array [
- 41,
- 45,
- ],
- "raw": "'__'",
- "type": "Literal",
- "value": "__",
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
},
- "kind": "init",
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 18,
+ 24,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 5,
+ "column": 24,
+ "line": 1,
},
"start": Object {
- "column": 3,
- "line": 5,
+ "column": 19,
+ "line": 1,
},
},
- "method": false,
"range": Array [
- 40,
- 52,
+ 19,
+ 24,
],
- "shorthand": false,
- "type": "Property",
- "value": Object {
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 5,
+ "column": 24,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 5,
+ "column": 21,
+ "line": 1,
},
},
"range": Array [
- 48,
- 52,
+ 21,
+ 24,
],
- "raw": "null",
- "type": "Literal",
- "value": null,
+ "type": "TSAnyKeyword",
},
},
- ],
- "range": Array [
- 38,
- 54,
- ],
- "type": "ObjectExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 5,
- },
- "start": Object {
- "column": 0,
- "line": 5,
},
- },
+ ],
"range": Array [
- 37,
- 56,
+ 0,
+ 75,
],
- "type": "ExpressionStatement",
- },
- Object {
- "body": Object {
- "body": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 7,
- },
- "start": Object {
- "column": 10,
- "line": 7,
- },
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 38,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 1,
+ },
+ },
+ "parameterName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 1,
},
- "range": Array [
- 68,
- 72,
- ],
- "raw": "'__'",
- "type": "Literal",
- "value": "__",
},
+ "name": "x",
+ "range": Array [
+ 27,
+ 28,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 27,
+ 38,
+ ],
+ "type": "TSTypePredicate",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 7,
+ "column": 38,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 7,
+ "column": 32,
+ "line": 1,
},
},
"range": Array [
- 68,
- 79,
+ 32,
+ 38,
],
- "static": false,
- "type": "ClassProperty",
- "value": Object {
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 7,
+ "column": 38,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 7,
+ "column": 32,
+ "line": 1,
},
},
"range": Array [
- 75,
- 79,
+ 32,
+ 38,
],
- "raw": "null",
- "type": "Literal",
- "value": null,
+ "type": "TSStringKeyword",
},
},
- ],
- "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,
- },
- "start": Object {
- "column": 0,
- "line": 7,
},
},
- "range": Array [
- 58,
- 81,
- ],
- "superClass": null,
- "type": "ClassDeclaration",
+ "type": "FunctionDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 8,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -57266,14 +64880,14 @@ Object {
},
"range": Array [
0,
- 82,
+ 75,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -57283,115 +64897,115 @@ Object {
},
"range": Array [
0,
- 1,
+ 8,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Keyword",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 2,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 1,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 1,
- 2,
+ 9,
+ 17,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "isString",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 3,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 3,
- 7,
+ 17,
+ 18,
],
- "type": "String",
- "value": "'__'",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 19,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 7,
- 8,
+ 18,
+ 19,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 19,
"line": 1,
},
},
"range": Array [
- 9,
- 13,
+ 19,
+ 20,
],
- "type": "Keyword",
- "value": "null",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 14,
- 15,
+ 21,
+ 24,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "any",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 25,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 24,
"line": 1,
},
},
"range": Array [
- 15,
- 16,
+ 24,
+ 25,
],
"type": "Punctuator",
"value": ")",
@@ -57399,503 +65013,723 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 25,
"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,
+ 25,
+ 26,
],
"type": "Punctuator",
- "value": "(",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 2,
- "line": 3,
+ "column": 28,
+ "line": 1,
},
"start": Object {
- "column": 1,
- "line": 3,
+ "column": 27,
+ "line": 1,
},
},
"range": Array [
- 20,
- 21,
+ 27,
+ 28,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 3,
+ "column": 31,
+ "line": 1,
},
"start": Object {
- "column": 3,
- "line": 3,
+ "column": 29,
+ "line": 1,
},
},
"range": Array [
- 22,
- 26,
+ 29,
+ 31,
],
- "type": "String",
- "value": "'__'",
+ "type": "Identifier",
+ "value": "is",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 3,
+ "column": 38,
+ "line": 1,
},
"start": Object {
- "column": 7,
- "line": 3,
+ "column": 32,
+ "line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 32,
+ 38,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 3,
+ "column": 40,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 3,
+ "column": 39,
+ "line": 1,
},
},
"range": Array [
- 27,
- 28,
+ 39,
+ 40,
],
"type": "Punctuator",
- "value": ")",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 3,
+ "column": 10,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 3,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 29,
- 30,
+ 45,
+ 51,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Keyword",
+ "value": "return",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 3,
+ "column": 17,
+ "line": 2,
},
"start": Object {
"column": 11,
- "line": 3,
+ "line": 2,
},
},
"range": Array [
- 30,
- 31,
+ 52,
+ 58,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Keyword",
+ "value": "typeof",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 3,
+ "column": 19,
+ "line": 2,
},
"start": Object {
- "column": 13,
- "line": 3,
+ "column": 18,
+ "line": 2,
},
},
"range": Array [
- 32,
- 33,
+ 59,
+ 60,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 3,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 3,
+ "column": 20,
+ "line": 2,
},
},
"range": Array [
- 33,
- 34,
+ 61,
+ 64,
],
"type": "Punctuator",
- "value": ")",
+ "value": "===",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 3,
+ "column": 32,
+ "line": 2,
},
"start": Object {
- "column": 15,
- "line": 3,
+ "column": 24,
+ "line": 2,
},
},
"range": Array [
- 34,
- 35,
+ 65,
+ 73,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "String",
+ "value": "'string'",
},
Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 5,
+ "line": 3,
},
"start": Object {
"column": 0,
- "line": 5,
+ "line": 3,
},
},
"range": Array [
- 37,
- 38,
+ 74,
+ 75,
],
"type": "Punctuator",
- "value": "(",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/type-guard-in-interface.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "name": "isString",
+ "range": Array [
+ 18,
+ 26,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "name": "node",
+ "range": Array [
+ 27,
+ 36,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 31,
+ 36,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 33,
+ 36,
+ ],
+ "type": "TSAnyKeyword",
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 18,
+ 54,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 37,
+ 53,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "parameterName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "name": "node",
+ "range": Array [
+ 39,
+ 43,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 39,
+ 53,
+ ],
+ "type": "TSTypePredicate",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 47,
+ 53,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 47,
+ 53,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ },
+ "type": "TSMethodSignature",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 56,
+ ],
+ "type": "TSInterfaceBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 2,
- "line": 5,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 1,
- "line": 5,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 38,
- 39,
+ 0,
+ 56,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "TSInterfaceDeclaration",
},
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 57,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 5,
+ "column": 9,
+ "line": 1,
},
"start": Object {
- "column": 3,
- "line": 5,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 40,
- 41,
+ 0,
+ 9,
],
- "type": "Punctuator",
- "value": "[",
+ "type": "Keyword",
+ "value": "interface",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 5,
+ "column": 13,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 5,
+ "column": 10,
+ "line": 1,
},
},
"range": Array [
- 41,
- 45,
+ 10,
+ 13,
],
- "type": "String",
- "value": "'__'",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 5,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 5,
+ "column": 14,
+ "line": 1,
},
},
"range": Array [
- 45,
- 46,
+ 14,
+ 15,
],
"type": "Punctuator",
- "value": "]",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
"column": 10,
- "line": 5,
+ "line": 2,
},
"start": Object {
- "column": 9,
- "line": 5,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
- 46,
- 47,
+ 18,
+ 26,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "isString",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 5,
+ "column": 11,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 5,
+ "column": 10,
+ "line": 2,
},
},
"range": Array [
- 48,
- 52,
+ 26,
+ 27,
],
- "type": "Keyword",
- "value": "null",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 5,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 16,
- "line": 5,
+ "column": 11,
+ "line": 2,
},
},
"range": Array [
- 53,
- 54,
+ 27,
+ 31,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "node",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 5,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 5,
+ "column": 15,
+ "line": 2,
},
},
"range": Array [
- 54,
- 55,
+ 31,
+ 32,
],
"type": "Punctuator",
- "value": ")",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 5,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 18,
- "line": 5,
+ "column": 17,
+ "line": 2,
},
},
"range": Array [
- 55,
- 56,
+ 33,
+ 36,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "any",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 7,
+ "column": 21,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 7,
+ "column": 20,
+ "line": 2,
},
},
"range": Array [
- 58,
- 63,
+ 36,
+ 37,
],
- "type": "Keyword",
- "value": "class",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 7,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 6,
- "line": 7,
+ "column": 21,
+ "line": 2,
},
},
"range": Array [
- 64,
- 65,
+ 37,
+ 38,
],
- "type": "Identifier",
- "value": "X",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 7,
+ "column": 27,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 7,
+ "column": 23,
+ "line": 2,
},
},
"range": Array [
- 66,
- 67,
+ 39,
+ 43,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "node",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 7,
+ "column": 30,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 7,
+ "column": 28,
+ "line": 2,
},
},
"range": Array [
- 68,
- 72,
+ 44,
+ 46,
],
- "type": "String",
- "value": "'__'",
+ "type": "Identifier",
+ "value": "is",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 7,
+ "column": 37,
+ "line": 2,
},
"start": Object {
- "column": 15,
- "line": 7,
+ "column": 31,
+ "line": 2,
},
},
"range": Array [
- 73,
- 74,
+ 47,
+ 53,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Identifier",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 7,
+ "column": 38,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 7,
+ "column": 37,
+ "line": 2,
},
},
"range": Array [
- 75,
- 79,
+ 53,
+ 54,
],
- "type": "Keyword",
- "value": "null",
+ "type": "Punctuator",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 7,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 22,
- "line": 7,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 80,
- 81,
+ 55,
+ 56,
],
"type": "Punctuator",
"value": "}",
@@ -57905,1146 +65739,1674 @@ Object {
}
`;
-exports[`typescript fixtures/basics/object-with-typed-methods.src 1`] = `
+exports[`typescript fixtures/basics/type-guard-in-method.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,
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
},
+ "name": "isBar",
+ "range": Array [
+ 14,
+ 19,
+ ],
+ "type": "Identifier",
},
- "name": "foo",
- "range": Array [
- 6,
- 9,
- ],
- "type": "Identifier",
- },
- "init": Object {
+ "kind": "method",
"loc": Object {
"end": Object {
- "column": 1,
- "line": 13,
+ "column": 3,
+ "line": 4,
},
"start": Object {
- "column": 12,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
- "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",
- },
- "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",
- "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",
- },
- "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,
- },
+ "range": Array [
+ 14,
+ 75,
+ ],
+ "static": false,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
+ "left": Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 15,
"line": 3,
},
"start": Object {
- "column": 4,
+ "column": 11,
"line": 3,
},
},
"range": Array [
- 49,
- 57,
+ 51,
+ 55,
],
- "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": 18,
- "line": 2,
- },
- },
- "params": Array [],
- "range": Array [
- 32,
- 61,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 2,
- },
- "start": Object {
- "column": 20,
- "line": 2,
+ "type": "ThisExpression",
},
- },
- "range": Array [
- 34,
- 42,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 2,
+ "column": 30,
+ "line": 3,
},
"start": Object {
- "column": 22,
- "line": 2,
+ "column": 11,
+ "line": 3,
},
},
+ "operator": "instanceof",
"range": Array [
- 36,
- 42,
+ 51,
+ 70,
],
- "type": "TSNumberKeyword",
- },
- },
- "type": "FunctionExpression",
- },
- },
- 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",
- "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 {
+ "right": Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 5,
+ "column": 30,
+ "line": 3,
},
"start": Object {
- "column": 6,
- "line": 5,
+ "column": 27,
+ "line": 3,
},
},
- "name": "T",
+ "name": "Foo",
"range": Array [
- 69,
+ 67,
70,
],
"type": "Identifier",
},
- "range": Array [
- 69,
- 70,
- ],
- "type": "TSTypeParameter",
+ "type": "BinaryExpression",
},
- ],
- "range": Array [
- 68,
- 71,
- ],
- "type": "TSTypeParameterDeclaration",
- },
- "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,
+ "column": 31,
+ "line": 3,
},
"start": Object {
- "column": 19,
- "line": 5,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 82,
- 100,
+ 44,
+ 71,
],
- "type": "BlockStatement",
+ "type": "ReturnStatement",
},
- "expression": false,
- "generator": false,
- "id": null,
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 38,
+ 75,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 19,
+ 75,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 21,
+ 37,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 7,
+ "column": 25,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 5,
+ "column": 11,
+ "line": 2,
},
},
- "params": Array [],
+ "parameterName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 23,
+ 27,
+ ],
+ "type": "TSThisType",
+ },
"range": Array [
- 71,
- 100,
+ 23,
+ 37,
],
- "returnType": Object {
+ "type": "TSTypePredicate",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 5,
+ "column": 25,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 5,
+ "column": 19,
+ "line": 2,
},
},
"range": Array [
- 73,
- 81,
+ 31,
+ 37,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 5,
+ "column": 25,
+ "line": 2,
},
"start": Object {
- "column": 12,
- "line": 5,
+ "column": 19,
+ "line": 2,
},
},
"range": Array [
- 75,
- 81,
+ 31,
+ 37,
],
- "type": "TSNumberKeyword",
+ "type": "TSStringKeyword",
},
},
- "type": "FunctionExpression",
},
},
- 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",
+ "type": "FunctionExpression",
+ },
+ },
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 5,
},
- "kind": "get",
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 10,
- },
- "start": Object {
- "column": 2,
- "line": 8,
- },
+ "start": Object {
+ "column": 2,
+ "line": 5,
},
- "method": false,
- "range": Array [
- 104,
- 138,
- ],
- "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,
- },
+ },
+ "name": "isBaz",
+ "range": Array [
+ 78,
+ 83,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 78,
+ 145,
+ ],
+ "static": false,
+ "type": "ClassProperty",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
+ "left": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 6,
},
- "range": Array [
- 133,
- 134,
- ],
- "raw": "1",
- "type": "Literal",
- "value": 1,
+ "start": Object {
+ "column": 11,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 121,
+ 125,
+ ],
+ "type": "ThisExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 6,
},
+ "start": Object {
+ "column": 11,
+ "line": 6,
+ },
+ },
+ "operator": "instanceof",
+ "range": Array [
+ 121,
+ 140,
+ ],
+ "right": Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 9,
+ "column": 30,
+ "line": 6,
},
"start": Object {
- "column": 4,
- "line": 9,
+ "column": 27,
+ "line": 6,
},
},
+ "name": "Foo",
"range": Array [
- 126,
- 134,
+ 137,
+ 140,
],
- "type": "ReturnStatement",
+ "type": "Identifier",
},
- ],
+ "type": "BinaryExpression",
+ },
"loc": Object {
"end": Object {
- "column": 3,
- "line": 10,
+ "column": 31,
+ "line": 6,
},
"start": Object {
- "column": 18,
- "line": 8,
+ "column": 4,
+ "line": 6,
},
},
"range": Array [
- 120,
- 138,
+ 114,
+ 141,
],
- "type": "BlockStatement",
+ "type": "ReturnStatement",
},
- "expression": false,
- "generator": false,
- "id": null,
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 10,
- },
- "start": Object {
- "column": 7,
- "line": 8,
- },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 7,
},
- "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",
- },
+ "start": Object {
+ "column": 32,
+ "line": 5,
},
- "type": "FunctionExpression",
},
+ "range": Array [
+ 108,
+ 145,
+ ],
+ "type": "BlockStatement",
},
- 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",
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 7,
},
- "kind": "set",
+ "start": Object {
+ "column": 10,
+ "line": 5,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 86,
+ 145,
+ ],
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 12,
+ "column": 28,
+ "line": 5,
},
"start": Object {
- "column": 2,
- "line": 11,
+ "column": 12,
+ "line": 5,
},
},
- "method": false,
"range": Array [
- 142,
- 172,
+ 88,
+ 104,
],
- "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,
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 12,
+ "column": 28,
+ "line": 5,
},
"start": Object {
- "column": 7,
- "line": 11,
+ "column": 14,
+ "line": 5,
},
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 11,
- },
- "start": Object {
- "column": 8,
- "line": 11,
- },
+ "parameterName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 5,
},
- "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",
- },
+ "start": Object {
+ "column": 14,
+ "line": 5,
},
},
- ],
+ "range": Array [
+ 90,
+ 94,
+ ],
+ "type": "TSThisType",
+ },
"range": Array [
- 147,
- 172,
+ 90,
+ 104,
],
- "returnType": Object {
+ "type": "TSTypePredicate",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 11,
+ "column": 28,
+ "line": 5,
},
"start": Object {
- "column": 18,
- "line": 11,
+ "column": 22,
+ "line": 5,
},
},
"range": Array [
- 158,
- 166,
+ 98,
+ 104,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 11,
+ "column": 28,
+ "line": 5,
},
"start": Object {
- "column": 20,
- "line": 11,
+ "column": 22,
+ "line": 5,
},
},
"range": Array [
- 160,
- 166,
+ 98,
+ 104,
],
- "type": "TSNumberKeyword",
+ "type": "TSStringKeyword",
},
},
- "type": "FunctionExpression",
},
},
- ],
- "range": Array [
- 12,
- 174,
- ],
- "type": "ObjectExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 13,
- },
- "start": Object {
- "column": 6,
- "line": 1,
+ "type": "ArrowFunctionExpression",
},
},
- "range": Array [
- 6,
- 174,
- ],
- "type": "VariableDeclarator",
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 147,
+ ],
+ "type": "ClassBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 6,
+ 9,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 8,
},
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 147,
],
- "kind": "const",
+ "superClass": null,
+ "type": "ClassDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 148,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 5,
+ ],
+ "type": "Keyword",
+ "value": "class",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 6,
+ 9,
+ ],
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 11,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 19,
+ ],
+ "type": "Identifier",
+ "value": "isBar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 19,
+ 20,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 21,
+ 22,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 23,
+ 27,
+ ],
+ "type": "Keyword",
+ "value": "this",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 28,
+ 30,
+ ],
+ "type": "Identifier",
+ "value": "is",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 31,
+ 37,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 38,
+ 39,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 44,
+ 50,
+ ],
+ "type": "Keyword",
+ "value": "return",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 51,
+ 55,
+ ],
+ "type": "Keyword",
+ "value": "this",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 56,
+ 66,
+ ],
+ "type": "Keyword",
+ "value": "instanceof",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 67,
+ 70,
+ ],
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 70,
+ 71,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 74,
+ 75,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 78,
+ 83,
+ ],
+ "type": "Identifier",
+ "value": "isBaz",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 84,
+ 85,
+ ],
+ "type": "Punctuator",
+ "value": "=",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 86,
+ 87,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 87,
+ 88,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 88,
+ 89,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 2,
- "line": 13,
+ "column": 18,
+ "line": 5,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 14,
+ "line": 5,
},
},
"range": Array [
- 0,
- 175,
+ 90,
+ 94,
],
- "type": "VariableDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 14,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Keyword",
+ "value": "this",
},
- },
- "range": Array [
- 0,
- 176,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 1,
+ "column": 21,
+ "line": 5,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 19,
+ "line": 5,
},
},
"range": Array [
- 0,
- 5,
+ 95,
+ 97,
],
- "type": "Keyword",
- "value": "const",
+ "type": "Identifier",
+ "value": "is",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 1,
+ "column": 28,
+ "line": 5,
},
"start": Object {
- "column": 6,
- "line": 1,
+ "column": 22,
+ "line": 5,
},
},
"range": Array [
- 6,
- 9,
+ 98,
+ 104,
],
"type": "Identifier",
- "value": "foo",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 1,
+ "column": 31,
+ "line": 5,
},
"start": Object {
- "column": 10,
- "line": 1,
+ "column": 29,
+ "line": 5,
},
},
"range": Array [
- 10,
- 11,
+ 105,
+ 107,
],
"type": "Punctuator",
- "value": "=",
+ "value": "=>",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 1,
+ "column": 33,
+ "line": 5,
},
"start": Object {
- "column": 12,
- "line": 1,
+ "column": 32,
+ "line": 5,
},
},
"range": Array [
- 12,
- 13,
+ 108,
+ 109,
],
"type": "Punctuator",
"value": "{",
},
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 114,
+ 120,
+ ],
+ "type": "Keyword",
+ "value": "return",
+ },
Object {
"loc": Object {
"end": Object {
"column": 15,
- "line": 2,
+ "line": 6,
},
"start": Object {
- "column": 2,
- "line": 2,
+ "column": 11,
+ "line": 6,
},
},
"range": Array [
- 16,
- 29,
+ 121,
+ 125,
],
- "type": "String",
- "value": "\\"constructor\\"",
+ "type": "Keyword",
+ "value": "this",
},
Object {
"loc": Object {
"end": Object {
+ "column": 26,
+ "line": 6,
+ },
+ "start": Object {
"column": 16,
- "line": 2,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 126,
+ 136,
+ ],
+ "type": "Keyword",
+ "value": "instanceof",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 6,
},
"start": Object {
- "column": 15,
- "line": 2,
+ "column": 27,
+ "line": 6,
},
},
"range": Array [
- 29,
- 30,
+ 137,
+ 140,
+ ],
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 140,
+ 141,
],
"type": "Punctuator",
- "value": "<",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 2,
+ "column": 3,
+ "line": 7,
},
"start": Object {
- "column": 16,
- "line": 2,
+ "column": 2,
+ "line": 7,
},
},
"range": Array [
- 30,
- 31,
+ 144,
+ 145,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 2,
+ "column": 1,
+ "line": 8,
},
"start": Object {
- "column": 17,
- "line": 2,
+ "column": 0,
+ "line": 8,
},
},
"range": Array [
- 31,
- 32,
+ 146,
+ 147,
],
"type": "Punctuator",
- "value": ">",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/type-parameters-comments.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 0,
+ 3,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 42,
+ ],
+ "type": "CallExpression",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 40,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 21,
+ 22,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 21,
+ 22,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
+ "range": Array [
+ 3,
+ 40,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 43,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 43,
+ ],
+ "type": "ExpressionStatement",
},
Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 43,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 40,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 84,
+ 87,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 53,
+ 56,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 43,
"line": 2,
},
"start": Object {
- "column": 18,
+ "column": 0,
"line": 2,
},
},
- "range": Array [
- 32,
- 33,
- ],
- "type": "Punctuator",
- "value": "(",
+ "params": Array [],
+ "range": Array [
+ 44,
+ 87,
+ ],
+ "type": "FunctionDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 2,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 2,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 68,
+ 69,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 68,
+ 69,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 56,
+ 81,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
+ },
+ Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 49,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 46,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 134,
+ 137,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 3,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 97,
+ 100,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 49,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 88,
+ 137,
+ ],
+ "type": "FunctionDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 43,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 3,
+ },
+ },
+ "params": Array [
+ Object {
+ "default": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 41,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 38,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 126,
+ 129,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 41,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 38,
+ "line": 3,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 126,
+ 129,
+ ],
+ "type": "Identifier",
+ },
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 41,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 3,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 3,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 112,
+ 113,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 112,
+ 129,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 100,
+ 131,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
},
+ ],
+ "comments": Array [
Object {
"loc": Object {
"end": Object {
"column": 20,
- "line": 2,
+ "line": 1,
},
"start": Object {
- "column": 19,
- "line": 2,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 33,
- 34,
+ 5,
+ 20,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Block",
+ "value": " comment 1 ",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 2,
+ "column": 38,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 2,
+ "column": 23,
+ "line": 1,
},
},
"range": Array [
- 34,
- 35,
+ 23,
+ 38,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Block",
+ "value": " comment 2 ",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 23,
"line": 2,
},
"start": Object {
- "column": 22,
+ "column": 14,
"line": 2,
},
},
"range": Array [
- 36,
- 42,
+ 58,
+ 67,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Block",
+ "value": " aaa ",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 35,
"line": 2,
},
"start": Object {
- "column": 29,
+ "column": 26,
"line": 2,
},
},
"range": Array [
- 43,
- 44,
+ 70,
+ 79,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Block",
+ "value": " bbb ",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 23,
"line": 3,
},
"start": Object {
- "column": 4,
+ "column": 14,
"line": 3,
},
},
"range": Array [
- 49,
- 55,
+ 102,
+ 111,
],
- "type": "Keyword",
- "value": "return",
+ "type": "Block",
+ "value": " aaa ",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 35,
"line": 3,
},
"start": Object {
- "column": 11,
+ "column": 26,
"line": 3,
},
},
"range": Array [
- 56,
- 57,
+ 114,
+ 123,
],
- "type": "Numeric",
- "value": "1",
+ "type": "Block",
+ "value": " bbb ",
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 4,
- },
- "start": Object {
- "column": 2,
- "line": 4,
- },
- },
- "range": Array [
- 60,
- 61,
- ],
- "type": "Punctuator",
- "value": "}",
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 4,
- "line": 4,
- },
- "start": Object {
- "column": 3,
- "line": 4,
- },
- },
- "range": Array [
- 61,
- 62,
- ],
- "type": "Punctuator",
- "value": ",",
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 138,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 5,
+ "column": 3,
+ "line": 1,
},
"start": Object {
- "column": 2,
- "line": 5,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 65,
- 68,
+ 0,
+ 3,
],
"type": "Identifier",
"value": "foo",
@@ -59052,17 +67414,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 6,
- "line": 5,
+ "column": 4,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 5,
+ "column": 3,
+ "line": 1,
},
},
"range": Array [
- 68,
- 69,
+ 3,
+ 4,
],
"type": "Punctuator",
"value": "<",
@@ -59070,35 +67432,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 5,
+ "column": 22,
+ "line": 1,
},
"start": Object {
- "column": 6,
- "line": 5,
+ "column": 21,
+ "line": 1,
},
},
"range": Array [
- 69,
- 70,
+ 21,
+ 22,
],
"type": "Identifier",
- "value": "T",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 5,
+ "column": 40,
+ "line": 1,
},
"start": Object {
- "column": 7,
- "line": 5,
+ "column": 39,
+ "line": 1,
},
},
"range": Array [
- 70,
- 71,
+ 39,
+ 40,
],
"type": "Punctuator",
"value": ">",
@@ -59106,17 +67468,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 5,
+ "column": 41,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 5,
+ "column": 40,
+ "line": 1,
},
},
"range": Array [
- 71,
- 72,
+ 40,
+ 41,
],
"type": "Punctuator",
"value": "(",
@@ -59124,17 +67486,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 5,
+ "column": 42,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 5,
+ "column": 41,
+ "line": 1,
},
},
"range": Array [
- 72,
- 73,
+ 41,
+ 42,
],
"type": "Punctuator",
"value": ")",
@@ -59142,179 +67504,125 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 5,
- },
- "start": Object {
- "column": 10,
- "line": 5,
- },
- },
- "range": Array [
- 73,
- 74,
- ],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 5,
- },
- "start": Object {
- "column": 12,
- "line": 5,
- },
- },
- "range": Array [
- 75,
- 81,
- ],
- "type": "Identifier",
- "value": "number",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 5,
+ "column": 43,
+ "line": 1,
},
"start": Object {
- "column": 19,
- "line": 5,
+ "column": 42,
+ "line": 1,
},
},
"range": Array [
- 82,
- 83,
+ 42,
+ 43,
],
"type": "Punctuator",
- "value": "{",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 6,
+ "column": 8,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 6,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 88,
- 94,
+ 44,
+ 52,
],
"type": "Keyword",
- "value": "return",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
"column": 12,
- "line": 6,
- },
- "start": Object {
- "column": 11,
- "line": 6,
- },
- },
- "range": Array [
- 95,
- 96,
- ],
- "type": "Numeric",
- "value": "1",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 7,
+ "line": 2,
},
"start": Object {
- "column": 2,
- "line": 7,
+ "column": 9,
+ "line": 2,
},
},
"range": Array [
- 99,
- 100,
+ 53,
+ 56,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 7,
+ "column": 13,
+ "line": 2,
},
"start": Object {
- "column": 3,
- "line": 7,
+ "column": 12,
+ "line": 2,
},
},
"range": Array [
- 100,
- 101,
+ 56,
+ 57,
],
"type": "Punctuator",
- "value": ",",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 8,
+ "column": 25,
+ "line": 2,
},
"start": Object {
- "column": 2,
- "line": 8,
+ "column": 24,
+ "line": 2,
},
},
"range": Array [
- 104,
- 107,
+ 68,
+ 69,
],
"type": "Identifier",
- "value": "get",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 8,
+ "column": 37,
+ "line": 2,
},
"start": Object {
- "column": 6,
- "line": 8,
+ "column": 36,
+ "line": 2,
},
},
"range": Array [
- 108,
- 109,
+ 80,
+ 81,
],
- "type": "Identifier",
- "value": "a",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 8,
+ "column": 38,
+ "line": 2,
},
"start": Object {
- "column": 7,
- "line": 8,
+ "column": 37,
+ "line": 2,
},
},
"range": Array [
- 109,
- 110,
+ 81,
+ 82,
],
"type": "Punctuator",
"value": "(",
@@ -59322,17 +67630,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 8,
+ "column": 39,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 8,
+ "column": 38,
+ "line": 2,
},
},
"range": Array [
- 110,
- 111,
+ 82,
+ 83,
],
"type": "Punctuator",
"value": ")",
@@ -59340,53 +67648,17 @@ 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": 8,
- },
- },
- "range": Array [
- 113,
- 119,
- ],
- "type": "Identifier",
- "value": "number",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 8,
+ "column": 41,
+ "line": 2,
},
"start": Object {
- "column": 18,
- "line": 8,
+ "column": 40,
+ "line": 2,
},
},
"range": Array [
- 120,
- 121,
+ 84,
+ 85,
],
"type": "Punctuator",
"value": "{",
@@ -59394,197 +67666,179 @@ Object {
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": 9,
+ "column": 43,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 9,
+ "column": 42,
+ "line": 2,
},
},
"range": Array [
- 133,
- 134,
+ 86,
+ 87,
],
- "type": "Numeric",
- "value": "1",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
- "end": Object {
- "column": 3,
- "line": 10,
+ "end": Object {
+ "column": 8,
+ "line": 3,
},
"start": Object {
- "column": 2,
- "line": 10,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 137,
- 138,
+ 88,
+ 96,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Keyword",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 10,
+ "column": 12,
+ "line": 3,
},
"start": Object {
- "column": 3,
- "line": 10,
+ "column": 9,
+ "line": 3,
},
},
"range": Array [
- 138,
- 139,
+ 97,
+ 100,
],
- "type": "Punctuator",
- "value": ",",
+ "type": "Identifier",
+ "value": "baz",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 11,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 2,
- "line": 11,
+ "column": 12,
+ "line": 3,
},
},
"range": Array [
- 142,
- 145,
+ 100,
+ 101,
],
- "type": "Identifier",
- "value": "set",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 11,
+ "column": 25,
+ "line": 3,
},
"start": Object {
- "column": 6,
- "line": 11,
+ "column": 24,
+ "line": 3,
},
},
"range": Array [
- 146,
- 147,
+ 112,
+ 113,
],
"type": "Identifier",
- "value": "a",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 11,
+ "column": 37,
+ "line": 3,
},
"start": Object {
- "column": 7,
- "line": 11,
+ "column": 36,
+ "line": 3,
},
},
"range": Array [
- 147,
- 148,
+ 124,
+ 125,
],
"type": "Punctuator",
- "value": "(",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 11,
+ "column": 41,
+ "line": 3,
},
"start": Object {
- "column": 8,
- "line": 11,
+ "column": 38,
+ "line": 3,
},
},
"range": Array [
- 148,
- 149,
+ 126,
+ 129,
],
"type": "Identifier",
- "value": "x",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 11,
+ "column": 43,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 11,
+ "column": 42,
+ "line": 3,
},
},
"range": Array [
- 149,
- 150,
+ 130,
+ 131,
],
"type": "Punctuator",
- "value": ":",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 11,
+ "column": 44,
+ "line": 3,
},
"start": Object {
- "column": 11,
- "line": 11,
+ "column": 43,
+ "line": 3,
},
},
"range": Array [
- 151,
- 157,
+ 131,
+ 132,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 11,
+ "column": 45,
+ "line": 3,
},
"start": Object {
- "column": 17,
- "line": 11,
+ "column": 44,
+ "line": 3,
},
},
"range": Array [
- 157,
- 158,
+ 132,
+ 133,
],
"type": "Punctuator",
"value": ")",
@@ -59592,969 +67846,1204 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 11,
+ "column": 47,
+ "line": 3,
},
"start": Object {
- "column": 18,
- "line": 11,
+ "column": 46,
+ "line": 3,
},
},
"range": Array [
- 158,
- 159,
+ 134,
+ 135,
],
"type": "Punctuator",
- "value": ":",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 11,
+ "column": 49,
+ "line": 3,
},
"start": Object {
- "column": 20,
- "line": 11,
+ "column": 48,
+ "line": 3,
},
},
"range": Array [
- 160,
- 166,
+ 136,
+ 137,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Punctuator",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/type-parameters-comments-heritage.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 74,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 72,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 72,
+ 74,
+ ],
+ "type": "ClassBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 6,
+ 9,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 28,
- "line": 11,
+ "column": 74,
+ "line": 1,
},
"start": Object {
- "column": 27,
- "line": 11,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 167,
- 168,
+ 0,
+ 74,
],
- "type": "Punctuator",
- "value": "{",
+ "superClass": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 46,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 43,
+ "line": 1,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 43,
+ 46,
+ ],
+ "type": "Identifier",
+ },
+ "superTypeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 71,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 47,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 60,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 59,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 59,
+ 60,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 60,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 59,
+ "line": 1,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 59,
+ 60,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
+ "range": Array [
+ 47,
+ 71,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ "type": "ClassDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 22,
+ 23,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 22,
+ 23,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 10,
+ 34,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
},
Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 89,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 87,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 162,
+ 164,
+ ],
+ "type": "ClassBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 2,
+ },
+ },
+ "name": "foo2",
+ "range": Array [
+ 81,
+ 85,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 3,
- "line": 12,
+ "column": 89,
+ "line": 2,
},
"start": Object {
- "column": 2,
- "line": 12,
+ "column": 0,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 75,
+ 164,
+ ],
+ "superClass": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 61,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 58,
+ "line": 2,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 133,
+ 136,
+ ],
+ "type": "Identifier",
+ },
+ "superTypeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 86,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 62,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 75,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 74,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 149,
+ 150,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 75,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 74,
+ "line": 2,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 149,
+ 150,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
+ "range": Array [
+ 137,
+ 161,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ "type": "ClassDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 49,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
},
+ "params": Array [
+ Object {
+ "default": Object {
+ "literal": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 37,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 112,
+ 113,
+ ],
+ "raw": "2",
+ "type": "Literal",
+ "value": 2,
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 37,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 112,
+ 113,
+ ],
+ "type": "TSLiteralType",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 98,
+ 99,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 98,
+ 113,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 86,
+ 124,
+ ],
+ "type": "TSTypeParameterDeclaration",
},
- "range": Array [
- 171,
- 172,
- ],
- "type": "Punctuator",
- "value": "}",
},
Object {
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 13,
- },
- "start": Object {
- "column": 0,
- "line": 13,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 79,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 77,
+ "line": 3,
+ },
},
+ "range": Array [
+ 242,
+ 244,
+ ],
+ "type": "TSInterfaceBody",
},
- "range": Array [
- 173,
- 174,
- ],
- "type": "Punctuator",
- "value": "}",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 2,
- "line": 13,
- },
- "start": Object {
- "column": 1,
- "line": 13,
+ "extends": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 51,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 47,
+ "line": 3,
+ },
+ },
+ "name": "bar2",
+ "range": Array [
+ 212,
+ 216,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 76,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 47,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 212,
+ 241,
+ ],
+ "type": "TSInterfaceHeritage",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 76,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 52,
+ "line": 3,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 65,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 64,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 229,
+ 230,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 65,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 64,
+ "line": 3,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 229,
+ 230,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
+ "range": Array [
+ 217,
+ 241,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
},
- },
- "range": Array [
- 174,
- 175,
],
- "type": "Punctuator",
- "value": ";",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/parenthesized-use-strict.src 1`] = `
-Object {
- "body": Array [
- Object {
- "expression": Object {
+ "id": Object {
"loc": Object {
"end": Object {
"column": 13,
- "line": 2,
+ "line": 3,
},
"start": Object {
- "column": 1,
- "line": 2,
+ "column": 10,
+ "line": 3,
},
},
+ "name": "bar",
"range": Array [
- 46,
- 58,
+ 175,
+ 178,
],
- "raw": "\\"use strict\\"",
- "type": "Literal",
- "value": "use strict",
- },
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 2,
- },
- },
- "range": Array [
- 45,
- 60,
- ],
- "type": "ExpressionStatement",
- },
- ],
- "comments": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 44,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
+ "type": "Identifier",
},
- "range": Array [
- 0,
- 44,
- ],
- "type": "Line",
- "value": " this should not be classed as a directive",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 2,
- },
- },
- "range": Array [
- 45,
- 60,
- ],
- "sourceType": "module",
- "tokens": Array [
- Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 2,
+ "column": 79,
+ "line": 3,
},
"start": Object {
"column": 0,
- "line": 2,
- },
- },
- "range": Array [
- 45,
- 46,
- ],
- "type": "Punctuator",
- "value": "(",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 2,
- },
- "start": Object {
- "column": 1,
- "line": 2,
- },
- },
- "range": Array [
- 46,
- 58,
- ],
- "type": "String",
- "value": "\\"use strict\\"",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 13,
- "line": 2,
+ "line": 3,
},
},
"range": Array [
- 58,
- 59,
+ 165,
+ 244,
],
- "type": "Punctuator",
- "value": ")",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 14,
- "line": 2,
+ "type": "TSInterfaceDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 3,
+ },
},
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 3,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 3,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 191,
+ 192,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 191,
+ 192,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 179,
+ 203,
+ ],
+ "type": "TSTypeParameterDeclaration",
},
- "range": Array [
- 59,
- 60,
- ],
- "type": "Punctuator",
- "value": ";",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/symbol-type-param.src 1`] = `
-Object {
- "body": Array [
Object {
- "async": false,
"body": Object {
"body": Array [],
"loc": Object {
"end": Object {
- "column": 42,
- "line": 1,
+ "column": 93,
+ "line": 4,
},
"start": Object {
- "column": 40,
- "line": 1,
+ "column": 91,
+ "line": 4,
},
},
"range": Array [
- 40,
- 42,
+ 336,
+ 338,
],
- "type": "BlockStatement",
+ "type": "TSInterfaceBody",
},
- "expression": false,
- "generator": false,
+ "extends": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 65,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 62,
+ "line": 4,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 307,
+ 310,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 90,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 62,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 307,
+ 335,
+ ],
+ "type": "TSInterfaceHeritage",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 90,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 66,
+ "line": 4,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 79,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 78,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 323,
+ 324,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 79,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 78,
+ "line": 4,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 323,
+ 324,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
+ "range": Array [
+ 311,
+ 335,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
+ ],
"id": Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 1,
+ "column": 14,
+ "line": 4,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 10,
+ "line": 4,
},
},
- "name": "test",
+ "name": "bar2",
"range": Array [
- 9,
- 13,
+ 255,
+ 259,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 42,
- "line": 1,
+ "column": 93,
+ "line": 4,
},
"start": Object {
"column": 0,
- "line": 1,
+ "line": 4,
},
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
+ "range": Array [
+ 245,
+ 338,
+ ],
+ "type": "TSInterfaceDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 53,
+ "line": 4,
},
- "name": "abc",
- "range": Array [
- 14,
- 38,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
+ "start": Object {
+ "column": 15,
+ "line": 4,
+ },
+ },
+ "params": Array [
+ Object {
+ "default": Object {
+ "literal": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 286,
+ 287,
+ ],
+ "raw": "2",
+ "type": "Literal",
+ "value": 2,
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 286,
+ 287,
+ ],
+ "type": "TSLiteralType",
+ },
"loc": Object {
"end": Object {
- "column": 38,
- "line": 1,
+ "column": 42,
+ "line": 4,
},
"start": Object {
- "column": 17,
- "line": 1,
+ "column": 27,
+ "line": 4,
},
},
- "range": Array [
- 17,
- 38,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "name": Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 1,
+ "column": 28,
+ "line": 4,
},
"start": Object {
- "column": 19,
- "line": 1,
+ "column": 27,
+ "line": 4,
},
},
+ "name": "A",
"range": Array [
- 19,
- 38,
+ 272,
+ 273,
],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 1,
- },
- "start": Object {
- "column": 19,
- "line": 1,
- },
- },
- "name": "Map",
- "range": Array [
- 19,
- 22,
- ],
- "type": "Identifier",
- },
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 23,
- "line": 1,
- },
- },
- "range": Array [
- 23,
- 29,
- ],
- "type": "TSSymbolKeyword",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 1,
- },
- "start": Object {
- "column": 31,
- "line": 1,
- },
- },
- "range": Array [
- 31,
- 37,
- ],
- "type": "TSStringKeyword",
- },
- ],
- "range": Array [
- 22,
- 38,
- ],
- "type": "TSTypeParameterInstantiation",
- },
+ "type": "Identifier",
},
+ "range": Array [
+ 272,
+ 287,
+ ],
+ "type": "TSTypeParameter",
},
- },
- ],
- "range": Array [
- 0,
- 42,
- ],
- "type": "FunctionDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 42,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ ],
+ "range": Array [
+ 260,
+ 298,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
},
- },
- "range": Array [
- 0,
- 42,
],
- "sourceType": "module",
- "tokens": Array [
+ "comments": Array [
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 0,
- 8,
+ 12,
+ 21,
],
- "type": "Keyword",
- "value": "function",
+ "type": "Block",
+ "value": " aaa ",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 33,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 24,
"line": 1,
},
},
"range": Array [
- 9,
- 13,
+ 24,
+ 33,
],
- "type": "Identifier",
- "value": "test",
+ "type": "Block",
+ "value": " bbb ",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 58,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 49,
"line": 1,
},
},
"range": Array [
- 13,
- 14,
+ 49,
+ 58,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Block",
+ "value": " aaa ",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 70,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 61,
"line": 1,
},
},
"range": Array [
- 14,
- 17,
+ 61,
+ 70,
],
- "type": "Identifier",
- "value": "abc",
+ "type": "Block",
+ "value": " bbb ",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 1,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 1,
+ "column": 13,
+ "line": 2,
},
},
"range": Array [
- 17,
- 18,
+ 88,
+ 97,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Block",
+ "value": " aaa ",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 34,
+ "line": 2,
},
"start": Object {
- "column": 19,
- "line": 1,
+ "column": 25,
+ "line": 2,
},
},
"range": Array [
- 19,
- 22,
+ 100,
+ 109,
],
- "type": "Identifier",
- "value": "Map",
+ "type": "Block",
+ "value": " bbb ",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 1,
+ "column": 48,
+ "line": 2,
},
"start": Object {
- "column": 22,
- "line": 1,
+ "column": 39,
+ "line": 2,
},
},
"range": Array [
- 22,
- 23,
+ 114,
+ 123,
],
- "type": "Punctuator",
- "value": "<",
+ "type": "Block",
+ "value": " bbb ",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 1,
+ "column": 73,
+ "line": 2,
},
"start": Object {
- "column": 23,
- "line": 1,
+ "column": 64,
+ "line": 2,
},
},
"range": Array [
- 23,
- 29,
+ 139,
+ 148,
],
- "type": "Identifier",
- "value": "symbol",
+ "type": "Block",
+ "value": " aaa ",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
- "line": 1,
+ "column": 85,
+ "line": 2,
},
"start": Object {
- "column": 29,
- "line": 1,
+ "column": 76,
+ "line": 2,
},
},
"range": Array [
- 29,
- 30,
+ 151,
+ 160,
],
- "type": "Punctuator",
- "value": ",",
+ "type": "Block",
+ "value": " bbb ",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 1,
+ "column": 25,
+ "line": 3,
},
"start": Object {
- "column": 31,
- "line": 1,
+ "column": 16,
+ "line": 3,
},
},
"range": Array [
- 31,
- 37,
+ 181,
+ 190,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Block",
+ "value": " aaa ",
},
Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 1,
+ "column": 37,
+ "line": 3,
},
"start": Object {
- "column": 37,
- "line": 1,
+ "column": 28,
+ "line": 3,
},
},
"range": Array [
- 37,
- 38,
+ 193,
+ 202,
],
- "type": "Punctuator",
- "value": ">",
+ "type": "Block",
+ "value": " bbb ",
},
Object {
"loc": Object {
"end": Object {
- "column": 39,
- "line": 1,
+ "column": 63,
+ "line": 3,
},
"start": Object {
- "column": 38,
- "line": 1,
+ "column": 54,
+ "line": 3,
},
},
"range": Array [
- 38,
- 39,
+ 219,
+ 228,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Block",
+ "value": " aaa ",
},
Object {
"loc": Object {
"end": Object {
- "column": 41,
- "line": 1,
+ "column": 75,
+ "line": 3,
},
"start": Object {
- "column": 40,
- "line": 1,
+ "column": 66,
+ "line": 3,
},
},
"range": Array [
- 40,
- 41,
+ 231,
+ 240,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Block",
+ "value": " bbb ",
},
Object {
"loc": Object {
"end": Object {
- "column": 42,
- "line": 1,
+ "column": 26,
+ "line": 4,
},
"start": Object {
- "column": 41,
- "line": 1,
+ "column": 17,
+ "line": 4,
},
},
"range": Array [
- 41,
- 42,
+ 262,
+ 271,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Block",
+ "value": " aaa ",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "name": "Result",
- "range": Array [
- 5,
- 11,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 37,
- "line": 1,
+ "column": 38,
+ "line": 4,
},
"start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 37,
- ],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 1,
- },
- "start": Object {
- "column": 17,
- "line": 1,
- },
- },
- "range": Array [
- 17,
- 37,
- ],
- "type": "TSUnionType",
- "types": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 1,
- },
- "start": Object {
- "column": 17,
- "line": 1,
- },
- },
- "range": Array [
- 17,
- 27,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 17,
- "line": 1,
- },
- },
- "name": "Success",
- "range": Array [
- 17,
- 24,
- ],
- "type": "Identifier",
- },
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 1,
- },
- "start": Object {
- "column": 24,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 1,
- },
- "start": Object {
- "column": 25,
- "line": 1,
- },
- },
- "range": Array [
- 25,
- 26,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 1,
- },
- "start": Object {
- "column": 25,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 25,
- 26,
- ],
- "type": "Identifier",
- },
- },
- ],
- "range": Array [
- 24,
- 27,
- ],
- "type": "TSTypeParameterInstantiation",
- },
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 1,
- },
- "start": Object {
- "column": 30,
- "line": 1,
- },
- },
- "range": Array [
- 30,
- 37,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 1,
- },
- "start": Object {
- "column": 30,
- "line": 1,
- },
- },
- "name": "Failure",
- "range": Array [
- 30,
- 37,
- ],
- "type": "Identifier",
- },
- },
- ],
+ "column": 29,
+ "line": 4,
+ },
},
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
+ "range": Array [
+ 274,
+ 283,
+ ],
+ "type": "Block",
+ "value": " bbb ",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 52,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 43,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 288,
+ 297,
+ ],
+ "type": "Block",
+ "value": " bbb ",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 77,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 68,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 313,
+ 322,
+ ],
+ "type": "Block",
+ "value": " aaa ",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 89,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 80,
+ "line": 4,
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 12,
- 13,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 12,
- 13,
- ],
- "type": "TSTypeParameter",
- },
- ],
- "range": Array [
- 11,
- 14,
- ],
- "type": "TSTypeParameterDeclaration",
},
+ "range": Array [
+ 325,
+ 334,
+ ],
+ "type": "Block",
+ "value": " bbb ",
},
],
- "comments": Array [],
"loc": Object {
"end": Object {
- "column": 37,
- "line": 1,
+ "column": 0,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -60563,14 +69052,14 @@ Object {
},
"range": Array [
0,
- 37,
+ 339,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 5,
"line": 1,
},
"start": Object {
@@ -60580,43 +69069,43 @@ Object {
},
"range": Array [
0,
- 4,
+ 5,
],
- "type": "Identifier",
- "value": "type",
+ "type": "Keyword",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 5,
- 11,
+ 6,
+ 9,
],
"type": "Identifier",
- "value": "Result",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 10,
"line": 1,
},
},
"range": Array [
+ 10,
11,
- 12,
],
"type": "Punctuator",
"value": "<",
@@ -60624,35 +69113,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 22,
+ 23,
],
"type": "Identifier",
- "value": "T",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 34,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 33,
"line": 1,
},
},
"range": Array [
- 13,
- 14,
+ 33,
+ 34,
],
"type": "Punctuator",
"value": ">",
@@ -60660,53 +69149,53 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 42,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 35,
"line": 1,
},
},
"range": Array [
- 15,
- 16,
+ 35,
+ 42,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Keyword",
+ "value": "extends",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 46,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 43,
"line": 1,
},
},
"range": Array [
- 17,
- 24,
+ 43,
+ 46,
],
"type": "Identifier",
- "value": "Success",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 48,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 47,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 47,
+ 48,
],
"type": "Punctuator",
"value": "<",
@@ -60714,35 +69203,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 60,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 59,
"line": 1,
},
},
"range": Array [
- 25,
- 26,
+ 59,
+ 60,
],
"type": "Identifier",
- "value": "T",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 71,
"line": 1,
},
"start": Object {
- "column": 26,
+ "column": 70,
"line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 70,
+ 71,
],
"type": "Punctuator",
"value": ">",
@@ -60750,401 +69239,179 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 73,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 72,
"line": 1,
},
},
"range": Array [
- 28,
- 29,
+ 72,
+ 73,
],
"type": "Punctuator",
- "value": "|",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
+ "column": 74,
"line": 1,
},
"start": Object {
- "column": 30,
+ "column": 73,
"line": 1,
},
},
"range": Array [
- 30,
- 37,
+ 73,
+ 74,
],
- "type": "Identifier",
- "value": "Failure",
+ "type": "Punctuator",
+ "value": "}",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/type-alias-declaration-with-constrained-type-parameter.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "name": "Result",
- "range": Array [
- 5,
- 11,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 48,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
"start": Object {
"column": 0,
- "line": 1,
+ "line": 2,
},
},
"range": Array [
- 0,
- 48,
+ 75,
+ 80,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 1,
- },
- "start": Object {
- "column": 28,
- "line": 1,
- },
+ "type": "Keyword",
+ "value": "class",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 2,
},
- "range": Array [
- 28,
- 48,
- ],
- "type": "TSUnionType",
- "types": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 28,
- "line": 1,
- },
- },
- "range": Array [
- 28,
- 38,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 35,
- "line": 1,
- },
- "start": Object {
- "column": 28,
- "line": 1,
- },
- },
- "name": "Success",
- "range": Array [
- 28,
- 35,
- ],
- "type": "Identifier",
- },
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 35,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 1,
- },
- "start": Object {
- "column": 36,
- "line": 1,
- },
- },
- "range": Array [
- 36,
- 37,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 1,
- },
- "start": Object {
- "column": 36,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 36,
- 37,
- ],
- "type": "Identifier",
- },
- },
- ],
- "range": Array [
- 35,
- 38,
- ],
- "type": "TSTypeParameterInstantiation",
- },
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 1,
- },
- "start": Object {
- "column": 41,
- "line": 1,
- },
- },
- "range": Array [
- 41,
- 48,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 1,
- },
- "start": Object {
- "column": 41,
- "line": 1,
- },
- },
- "name": "Failure",
- "range": Array [
- 41,
- 48,
- ],
- "type": "Identifier",
- },
- },
- ],
- },
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
+ "start": Object {
+ "column": 6,
+ "line": 2,
},
- "params": Array [
- Object {
- "constraint": Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "members": Array [],
- "range": Array [
- 22,
- 24,
- ],
- "type": "TSTypeLiteral",
- },
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 12,
- 13,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 12,
- 24,
- ],
- "type": "TSTypeParameter",
- },
- ],
- "range": Array [
- 11,
- 25,
- ],
- "type": "TSTypeParameterDeclaration",
},
+ "range": Array [
+ 81,
+ 85,
+ ],
+ "type": "Identifier",
+ "value": "foo2",
},
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 86,
+ 87,
+ ],
+ "type": "Punctuator",
+ "value": "<",
},
- },
- "range": Array [
- 0,
- 48,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 1,
+ "column": 24,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 23,
+ "line": 2,
},
},
"range": Array [
- 0,
- 4,
+ 98,
+ 99,
],
"type": "Identifier",
- "value": "type",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 1,
+ "column": 36,
+ "line": 2,
},
"start": Object {
- "column": 5,
- "line": 1,
+ "column": 35,
+ "line": 2,
},
},
"range": Array [
- 5,
- 11,
+ 110,
+ 111,
],
- "type": "Identifier",
- "value": "Result",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 1,
+ "column": 38,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 37,
+ "line": 2,
},
},
"range": Array [
- 11,
- 12,
+ 112,
+ 113,
],
- "type": "Punctuator",
- "value": "<",
+ "type": "Numeric",
+ "value": "2",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 1,
+ "column": 49,
+ "line": 2,
},
"start": Object {
- "column": 12,
- "line": 1,
+ "column": 48,
+ "line": 2,
},
},
"range": Array [
- 12,
- 13,
+ 123,
+ 124,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 57,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 50,
+ "line": 2,
},
},
"range": Array [
- 14,
- 21,
+ 125,
+ 132,
],
"type": "Keyword",
"value": "extends",
@@ -61152,53 +69419,71 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 1,
+ "column": 61,
+ "line": 2,
},
"start": Object {
- "column": 22,
- "line": 1,
+ "column": 58,
+ "line": 2,
},
},
"range": Array [
- 22,
- 23,
+ 133,
+ 136,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 1,
+ "column": 63,
+ "line": 2,
},
"start": Object {
- "column": 23,
- "line": 1,
+ "column": 62,
+ "line": 2,
},
},
"range": Array [
- 23,
- 24,
+ 137,
+ 138,
],
"type": "Punctuator",
- "value": "}",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 1,
+ "column": 75,
+ "line": 2,
},
"start": Object {
- "column": 24,
- "line": 1,
+ "column": 74,
+ "line": 2,
},
},
"range": Array [
- 24,
- 25,
+ 149,
+ 150,
+ ],
+ "type": "Identifier",
+ "value": "A",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 86,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 85,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 160,
+ 161,
],
"type": "Punctuator",
"value": ">",
@@ -61206,53 +69491,89 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 1,
+ "column": 88,
+ "line": 2,
},
"start": Object {
- "column": 26,
- "line": 1,
+ "column": 87,
+ "line": 2,
},
},
"range": Array [
- 26,
- 27,
+ 162,
+ 163,
],
"type": "Punctuator",
- "value": "=",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 35,
- "line": 1,
+ "column": 89,
+ "line": 2,
},
"start": Object {
- "column": 28,
- "line": 1,
+ "column": 88,
+ "line": 2,
},
},
"range": Array [
- 28,
- 35,
+ 163,
+ 164,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 165,
+ 174,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 175,
+ 178,
],
"type": "Identifier",
- "value": "Success",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 1,
+ "column": 15,
+ "line": 3,
},
"start": Object {
- "column": 35,
- "line": 1,
+ "column": 14,
+ "line": 3,
},
},
"range": Array [
- 35,
- 36,
+ 179,
+ 180,
],
"type": "Punctuator",
"value": "<",
@@ -61260,35 +69581,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 1,
+ "column": 27,
+ "line": 3,
},
"start": Object {
- "column": 36,
- "line": 1,
+ "column": 26,
+ "line": 3,
},
},
"range": Array [
- 36,
- 37,
+ 191,
+ 192,
],
"type": "Identifier",
- "value": "T",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
"column": 38,
- "line": 1,
+ "line": 3,
},
"start": Object {
"column": 37,
- "line": 1,
+ "line": 3,
},
},
"range": Array [
- 37,
- 38,
+ 202,
+ 203,
],
"type": "Punctuator",
"value": ">",
@@ -61296,275 +69617,215 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 40,
- "line": 1,
+ "column": 46,
+ "line": 3,
},
"start": Object {
"column": 39,
- "line": 1,
+ "line": 3,
},
},
"range": Array [
- 39,
- 40,
+ 204,
+ 211,
],
- "type": "Punctuator",
- "value": "|",
+ "type": "Keyword",
+ "value": "extends",
},
Object {
"loc": Object {
"end": Object {
- "column": 48,
- "line": 1,
+ "column": 51,
+ "line": 3,
},
"start": Object {
- "column": 41,
- "line": 1,
+ "column": 47,
+ "line": 3,
},
},
"range": Array [
- 41,
- 48,
+ 212,
+ 216,
],
"type": "Identifier",
- "value": "Failure",
+ "value": "bar2",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 53,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 52,
+ "line": 3,
},
- "name": "foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 217,
+ 218,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 30,
- "line": 1,
+ "column": 65,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 64,
+ "line": 3,
},
},
"range": Array [
- 0,
- 30,
+ 229,
+ 230,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
+ "type": "Identifier",
+ "value": "A",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 76,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 75,
+ "line": 3,
},
- "members": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
- },
- "name": "bar",
- "range": Array [
- 12,
- 15,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
- },
- "range": Array [
- 12,
- 24,
- ],
- "type": "TSPropertySignature",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 1,
- },
- "start": Object {
- "column": 15,
- "line": 1,
- },
- },
- "range": Array [
- 15,
- 23,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 1,
- },
- "start": Object {
- "column": 17,
- "line": 1,
- },
- },
- "range": Array [
- 17,
- 23,
- ],
- "type": "TSStringKeyword",
- },
- },
- },
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 25,
- "line": 1,
- },
- },
- "name": "baz",
- "range": Array [
- 25,
- 28,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 25,
- "line": 1,
- },
- },
- "range": Array [
- 25,
- 28,
- ],
- "type": "TSPropertySignature",
- },
- ],
- "range": Array [
- 11,
- 29,
- ],
- "type": "TSTypeLiteral",
},
+ "range": Array [
+ 240,
+ 241,
+ ],
+ "type": "Punctuator",
+ "value": ">",
},
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 78,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 77,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 242,
+ 243,
+ ],
+ "type": "Punctuator",
+ "value": "{",
},
- "start": Object {
- "column": 0,
- "line": 1,
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 79,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 78,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 243,
+ 244,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 245,
+ 254,
+ ],
+ "type": "Keyword",
+ "value": "interface",
},
- },
- "range": Array [
- 0,
- 31,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 1,
+ "column": 14,
+ "line": 4,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 10,
+ "line": 4,
},
},
"range": Array [
- 0,
- 4,
+ 255,
+ 259,
],
"type": "Identifier",
- "value": "type",
+ "value": "bar2",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 1,
+ "column": 16,
+ "line": 4,
},
"start": Object {
- "column": 5,
- "line": 1,
+ "column": 15,
+ "line": 4,
},
},
"range": Array [
- 5,
- 8,
+ 260,
+ 261,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 272,
+ 273,
],
"type": "Identifier",
- "value": "foo",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 1,
+ "column": 40,
+ "line": 4,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 39,
+ "line": 4,
},
},
"range": Array [
- 9,
- 10,
+ 284,
+ 285,
],
"type": "Punctuator",
"value": "=",
@@ -61572,251 +69833,376 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 1,
+ "column": 42,
+ "line": 4,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 41,
+ "line": 4,
},
},
"range": Array [
- 11,
- 12,
+ 286,
+ 287,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Numeric",
+ "value": "2",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 1,
+ "column": 53,
+ "line": 4,
},
"start": Object {
- "column": 12,
- "line": 1,
+ "column": 52,
+ "line": 4,
},
},
"range": Array [
- 12,
- 15,
+ 297,
+ 298,
],
- "type": "Identifier",
- "value": "bar",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 61,
+ "line": 4,
},
"start": Object {
- "column": 15,
- "line": 1,
+ "column": 54,
+ "line": 4,
},
},
"range": Array [
- 15,
- 16,
+ 299,
+ 306,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Keyword",
+ "value": "extends",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 1,
+ "column": 65,
+ "line": 4,
},
"start": Object {
- "column": 17,
- "line": 1,
+ "column": 62,
+ "line": 4,
},
},
"range": Array [
- 17,
- 23,
+ 307,
+ 310,
],
"type": "Identifier",
- "value": "string",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 1,
+ "column": 67,
+ "line": 4,
},
"start": Object {
- "column": 23,
- "line": 1,
+ "column": 66,
+ "line": 4,
},
},
"range": Array [
- 23,
- 24,
+ 311,
+ 312,
],
"type": "Punctuator",
- "value": ",",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 1,
+ "column": 79,
+ "line": 4,
},
"start": Object {
- "column": 25,
- "line": 1,
+ "column": 78,
+ "line": 4,
},
},
"range": Array [
- 25,
- 28,
+ 323,
+ 324,
],
"type": "Identifier",
- "value": "baz",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 1,
+ "column": 90,
+ "line": 4,
},
"start": Object {
- "column": 28,
- "line": 1,
+ "column": 89,
+ "line": 4,
},
},
"range": Array [
- 28,
- 29,
+ 334,
+ 335,
],
"type": "Punctuator",
- "value": "}",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
- "line": 1,
+ "column": 92,
+ "line": 4,
},
"start": Object {
- "column": 29,
- "line": 1,
+ "column": 91,
+ "line": 4,
},
},
"range": Array [
- 29,
- 30,
+ 336,
+ 337,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 93,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 92,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 337,
+ 338,
+ ],
+ "type": "Punctuator",
+ "value": "}",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/type-assertion.src 1`] = `
+exports[`typescript fixtures/basics/type-reference-comments.src 1`] = `
Object {
"body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
- },
- "name": "foo",
- "range": Array [
- 6,
- 9,
- ],
- "type": "Identifier",
- },
- "init": Object {
- "expression": Object {
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 1,
+ "column": 10,
+ "line": 2,
},
"start": Object {
- "column": 26,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
+ "name": "mBuffers",
"range": Array [
26,
- 27,
+ 34,
],
- "raw": "2",
- "type": "Literal",
- "value": 2,
+ "type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 27,
- "line": 1,
+ "column": 51,
+ "line": 2,
},
"start": Object {
- "column": 12,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
- 12,
- 27,
+ 26,
+ 75,
],
- "type": "TSTypeAssertion",
+ "static": false,
+ "type": "ClassProperty",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 50,
+ "line": 2,
},
"start": Object {
- "column": 13,
- "line": 1,
+ "column": 10,
+ "line": 2,
},
},
"range": Array [
- 13,
- 16,
+ 34,
+ 74,
],
- "type": "TSAnyKeyword",
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 50,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 36,
+ 74,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "left": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 2,
+ },
+ },
+ "name": "interop",
+ "range": Array [
+ 36,
+ 43,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 36,
+ 53,
+ ],
+ "right": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 2,
+ },
+ },
+ "name": "Reference",
+ "range": Array [
+ 44,
+ 53,
+ ],
+ "type": "Identifier",
+ },
+ "type": "TSQualifiedName",
+ },
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 50,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 54,
+ 57,
+ ],
+ "type": "TSAnyKeyword",
+ },
+ ],
+ "range": Array [
+ 53,
+ 74,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
},
+ "value": null,
},
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
},
- "range": Array [
- 6,
- 27,
- ],
- "type": "VariableDeclarator",
},
- ],
- "kind": "const",
+ "range": Array [
+ 22,
+ 77,
+ ],
+ "type": "ClassBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "AudioBufferList",
+ "range": Array [
+ 6,
+ 21,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 28,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -61825,16 +70211,36 @@ Object {
},
"range": Array [
0,
- 28,
+ 77,
],
- "type": "VariableDeclaration",
+ "superClass": null,
+ "type": "ClassDeclaration",
+ },
+ ],
+ "comments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 49,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 34,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 58,
+ 73,
+ ],
+ "type": "Block",
+ "value": "AudioBuffer",
},
],
- "comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 2,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -61843,1010 +70249,575 @@ Object {
},
"range": Array [
0,
- 29,
+ 78,
],
"sourceType": "module",
- "tokens": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 5,
- ],
- "type": "Keyword",
- "value": "const",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
- },
- "range": Array [
- 6,
- 9,
- ],
- "type": "Identifier",
- "value": "foo",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "range": Array [
- 10,
- 11,
- ],
- "type": "Punctuator",
- "value": "=",
- },
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 5,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 0,
+ 5,
],
- "type": "Punctuator",
- "value": "<",
+ "type": "Keyword",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 13,
- 16,
+ 6,
+ 21,
],
"type": "Identifier",
- "value": "any",
+ "value": "AudioBufferList",
},
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": 27,
- "line": 1,
+ "column": 10,
+ "line": 2,
},
"start": Object {
- "column": 26,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
26,
- 27,
+ 34,
],
- "type": "Numeric",
- "value": "2",
+ "type": "Identifier",
+ "value": "mBuffers",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 1,
+ "column": 11,
+ "line": 2,
},
"start": Object {
- "column": 27,
- "line": 1,
+ "column": 10,
+ "line": 2,
},
},
"range": Array [
- 27,
- 28,
+ 34,
+ 35,
],
"type": "Punctuator",
- "value": ";",
+ "value": ":",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/type-assertion-arrow-function.src 1`] = `
-Object {
- "body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "name": "asserted2",
- "range": Array [
- 4,
- 13,
- ],
- "type": "Identifier",
- },
- "init": Object {
- "expression": Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "loc": Object {
- "end": Object {
- "column": 39,
- "line": 1,
- },
- "start": Object {
- "column": 38,
- "line": 1,
- },
- },
- "name": "n",
- "range": Array [
- 38,
- 39,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 40,
- "line": 1,
- },
- "start": Object {
- "column": 31,
- "line": 1,
- },
- },
- "range": Array [
- 31,
- 40,
- ],
- "type": "ReturnStatement",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 42,
- "line": 1,
- },
- "start": Object {
- "column": 29,
- "line": 1,
- },
- },
- "range": Array [
- 29,
- 42,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": null,
- "loc": Object {
- "end": Object {
- "column": 42,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 23,
- "line": 1,
- },
- },
- "name": "n",
- "range": Array [
- 23,
- 24,
- ],
- "type": "Identifier",
- },
- ],
- "range": Array [
- 22,
- 42,
- ],
- "type": "ArrowFunctionExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 43,
- "line": 1,
- },
- "start": Object {
- "column": 16,
- "line": 1,
- },
- },
- "range": Array [
- 16,
- 43,
- ],
- "type": "TSTypeAssertion",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 17,
- "line": 1,
- },
- },
- "range": Array [
- 17,
- 20,
- ],
- "type": "TSAnyKeyword",
- },
- },
- "loc": Object {
- "end": Object {
- "column": 43,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "range": Array [
- 4,
- 43,
- ],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "var",
"loc": Object {
"end": Object {
- "column": 44,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 12,
+ "line": 2,
},
},
"range": Array [
- 0,
- 44,
+ 36,
+ 43,
],
- "type": "VariableDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Identifier",
+ "value": "interop",
},
- },
- "range": Array [
- 0,
- 45,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
},
"range": Array [
- 0,
- 3,
+ 43,
+ 44,
],
- "type": "Keyword",
- "value": "var",
+ "type": "Punctuator",
+ "value": ".",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 1,
+ "column": 29,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
},
"range": Array [
- 4,
- 13,
+ 44,
+ 53,
],
"type": "Identifier",
- "value": "asserted2",
+ "value": "Reference",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 1,
+ "column": 30,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 29,
+ "line": 2,
},
},
"range": Array [
- 14,
- 15,
+ 53,
+ 54,
],
"type": "Punctuator",
- "value": "=",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 33,
+ "line": 2,
},
"start": Object {
- "column": 16,
- "line": 1,
+ "column": 30,
+ "line": 2,
},
},
"range": Array [
- 16,
- 17,
+ 54,
+ 57,
],
- "type": "Punctuator",
- "value": "<",
+ "type": "Identifier",
+ "value": "any",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 1,
+ "column": 50,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 1,
+ "column": 49,
+ "line": 2,
},
},
"range": Array [
- 17,
- 20,
+ 73,
+ 74,
],
- "type": "Identifier",
- "value": "any",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 51,
+ "line": 2,
},
"start": Object {
- "column": 20,
- "line": 1,
+ "column": 50,
+ "line": 2,
},
},
"range": Array [
- 20,
- 21,
+ 74,
+ 75,
],
"type": "Punctuator",
- "value": ">",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 21,
- "line": 1,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 21,
- 22,
+ 76,
+ 77,
],
"type": "Punctuator",
- "value": "(",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/typed-keyword-bigint.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 22,
- 23,
+ 0,
+ 17,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 17,
+ ],
+ "type": "TSBigIntKeyword",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 18,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 4,
"line": 1,
},
"start": Object {
- "column": 23,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 23,
- 24,
+ 0,
+ 4,
],
"type": "Identifier",
- "value": "n",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 26,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 26,
- 28,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": "=>",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 29,
- 30,
+ 11,
+ 17,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "bigint",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/typed-keyword-boolean.src 1`] = `
+Object {
+ "body": Array [
Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 1,
- },
- "start": Object {
- "column": 31,
- "line": 1,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
},
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 31,
- 37,
- ],
- "type": "Keyword",
- "value": "return",
- },
- Object {
"loc": Object {
"end": Object {
- "column": 39,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 38,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 38,
- 39,
+ 0,
+ 18,
],
- "type": "Identifier",
- "value": "n",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 18,
+ ],
+ "type": "TSBooleanKeyword",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 19,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 40,
+ "column": 4,
"line": 1,
},
"start": Object {
- "column": 39,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 39,
- 40,
+ 0,
+ 4,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 42,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 41,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 41,
- 42,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 43,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 42,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 42,
- 43,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": ")",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 44,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 43,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 43,
- 44,
+ 11,
+ 18,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "boolean",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/type-guard-in-arrow-function.src 1`] = `
+exports[`typescript fixtures/basics/typed-keyword-false.src 1`] = `
Object {
"body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
- },
- "name": "isString",
- "range": Array [
- 6,
- 14,
- ],
- "type": "Identifier",
- },
- "init": Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "left": Object {
- "argument": Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 18,
- "line": 2,
- },
- },
- "name": "x",
- "range": Array [
- 62,
- 63,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "operator": "typeof",
- "prefix": true,
- "range": Array [
- 55,
- 63,
- ],
- "type": "UnaryExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "operator": "===",
- "range": Array [
- 55,
- 76,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 2,
- },
- "start": Object {
- "column": 24,
- "line": 2,
- },
- },
- "range": Array [
- 68,
- 76,
- ],
- "raw": "'string'",
- "type": "Literal",
- "value": "string",
- },
- "type": "BinaryExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 48,
- 76,
- ],
- "type": "ReturnStatement",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 42,
- "line": 1,
- },
- },
- "range": Array [
- 42,
- 78,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": null,
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 17,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
- },
- "name": "x",
- "range": Array [
- 18,
- 24,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 19,
- "line": 1,
- },
- },
- "range": Array [
- 19,
- 24,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 21,
- "line": 1,
- },
- },
- "range": Array [
- 21,
- 24,
- ],
- "type": "TSAnyKeyword",
- },
- },
- },
- ],
- "range": Array [
- 17,
- 78,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 25,
- "line": 1,
- },
- },
- "range": Array [
- 25,
- 38,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 27,
- "line": 1,
- },
- },
- "parameterName": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 27,
- "line": 1,
- },
- },
- "name": "x",
- "range": Array [
- 27,
- 28,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 27,
- 38,
- ],
- "type": "TSTypePredicate",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 32,
- "line": 1,
- },
- },
- "range": Array [
- 32,
- 38,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 32,
- "line": 1,
- },
- },
- "range": Array [
- 32,
- 38,
- ],
- "type": "TSStringKeyword",
- },
- },
- },
- },
- "type": "ArrowFunctionExpression",
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
},
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
+ "start": Object {
+ "column": 5,
+ "line": 1,
},
- "range": Array [
- 6,
- 78,
- ],
- "type": "VariableDeclarator",
},
- ],
- "kind": "const",
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 16,
+ "line": 1,
},
"start": Object {
"column": 0,
@@ -62855,16 +70826,52 @@ Object {
},
"range": Array [
0,
- 78,
+ 16,
],
- "type": "VariableDeclaration",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "literal": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 16,
+ ],
+ "raw": "false",
+ "type": "Literal",
+ "value": false,
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 16,
+ ],
+ "type": "TSLiteralType",
+ },
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 4,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -62873,14 +70880,14 @@ Object {
},
"range": Array [
0,
- 79,
+ 17,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 4,
"line": 1,
},
"start": Object {
@@ -62890,655 +70897,581 @@ Object {
},
"range": Array [
0,
- 5,
- ],
- "type": "Keyword",
- "value": "const",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
- },
- "range": Array [
- 6,
- 14,
+ 4,
],
"type": "Identifier",
- "value": "isString",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 15,
- 16,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 17,
- 18,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": "(",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 18,
- 19,
+ 11,
+ 16,
],
- "type": "Identifier",
- "value": "x",
+ "type": "Boolean",
+ "value": "false",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/typed-keyword-never.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 19,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 19,
- 20,
+ 0,
+ 16,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 16,
+ ],
+ "type": "TSNeverKeyword",
+ },
},
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 17,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 4,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 21,
- 24,
+ 0,
+ 4,
],
"type": "Identifier",
- "value": "any",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 25,
- 26,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": ":",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 27,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 27,
- 28,
+ 11,
+ 16,
],
"type": "Identifier",
- "value": "x",
+ "value": "never",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/typed-keyword-null.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 29,
- 31,
+ 0,
+ 15,
],
- "type": "Identifier",
- "value": "is",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 15,
+ ],
+ "type": "TSNullKeyword",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 16,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 4,
"line": 1,
},
"start": Object {
- "column": 32,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 32,
- 38,
+ 0,
+ 4,
],
"type": "Identifier",
- "value": "string",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 41,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 39,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 39,
- 41,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": "=>",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 43,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 42,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 42,
- 43,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": "{",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 2,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 11,
+ "line": 1,
},
},
"range": Array [
- 48,
- 54,
+ 11,
+ 15,
],
"type": "Keyword",
- "value": "return",
+ "value": "null",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/typed-keyword-number.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
"column": 17,
- "line": 2,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 55,
- 61,
+ 0,
+ 17,
],
- "type": "Keyword",
- "value": "typeof",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 17,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 18,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 2,
+ "column": 4,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 62,
- 63,
+ 0,
+ 4,
],
"type": "Identifier",
- "value": "x",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 2,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 2,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 64,
- 67,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": "===",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 32,
- "line": 2,
+ "column": 10,
+ "line": 1,
},
"start": Object {
- "column": 24,
- "line": 2,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 68,
- 76,
+ 9,
+ 10,
],
- "type": "String",
- "value": "'string'",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 11,
+ "line": 1,
},
},
"range": Array [
- 77,
- 78,
+ 11,
+ 17,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "number",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/type-guard-in-function.src 1`] = `
-Object {
- "body": Array [
- Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "left": Object {
- "argument": Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 18,
- "line": 2,
- },
- },
- "name": "x",
- "range": Array [
- 59,
- 60,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "operator": "typeof",
- "prefix": true,
- "range": Array [
- 52,
- 60,
- ],
- "type": "UnaryExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "operator": "===",
- "range": Array [
- 52,
- 73,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 2,
- },
- "start": Object {
- "column": 24,
- "line": 2,
- },
- },
- "range": Array [
- 65,
- 73,
- ],
- "raw": "'string'",
- "type": "Literal",
- "value": "string",
- },
- "type": "BinaryExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 45,
- 73,
- ],
- "type": "ReturnStatement",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 39,
- "line": 1,
- },
- },
- "range": Array [
- 39,
- 75,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
+exports[`typescript fixtures/basics/typed-keyword-object.src 1`] = `
+Object {
+ "body": Array [
+ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 5,
"line": 1,
},
},
- "name": "isString",
+ "name": "Foo",
"range": Array [
- 9,
- 17,
+ 5,
+ 8,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 17,
+ "line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
- },
- "name": "x",
- "range": Array [
- 18,
- 24,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 19,
- "line": 1,
- },
- },
- "range": Array [
- 19,
- 24,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 21,
- "line": 1,
- },
- },
- "range": Array [
- 21,
- 24,
- ],
- "type": "TSAnyKeyword",
- },
- },
- },
- ],
"range": Array [
0,
- 75,
+ 17,
],
- "returnType": Object {
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 25,
- 38,
+ 11,
+ 17,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 27,
- "line": 1,
- },
- },
- "parameterName": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 27,
- "line": 1,
- },
- },
- "name": "x",
- "range": Array [
- 27,
- 28,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 27,
- 38,
- ],
- "type": "TSTypePredicate",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 32,
- "line": 1,
- },
- },
- "range": Array [
- 32,
- 38,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 32,
- "line": 1,
- },
- },
- "range": Array [
- 32,
- 38,
- ],
- "type": "TSStringKeyword",
- },
- },
- },
+ "type": "TSObjectKeyword",
},
- "type": "FunctionDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 0,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -63547,14 +71480,14 @@ Object {
},
"range": Array [
0,
- 75,
+ 18,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 4,
"line": 1,
},
"start": Object {
@@ -63564,543 +71497,565 @@ Object {
},
"range": Array [
0,
- 8,
+ 4,
],
- "type": "Keyword",
- "value": "function",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 9,
- 17,
+ 5,
+ 8,
],
"type": "Identifier",
- "value": "isString",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 17,
- 18,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": "(",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 18,
- 19,
+ 11,
+ 17,
],
"type": "Identifier",
- "value": "x",
+ "value": "object",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/typed-keyword-string.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 19,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 19,
- 20,
+ 0,
+ 17,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 17,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 18,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 4,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 21,
- 24,
+ 0,
+ 4,
],
"type": "Identifier",
- "value": "any",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 25,
- 26,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": ":",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 27,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 27,
- 28,
+ 11,
+ 17,
],
"type": "Identifier",
- "value": "x",
+ "value": "string",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/typed-keyword-symbol.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 29,
- 31,
+ 0,
+ 17,
],
- "type": "Identifier",
- "value": "is",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 17,
+ ],
+ "type": "TSSymbolKeyword",
+ },
},
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 18,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 4,
"line": 1,
},
"start": Object {
- "column": 32,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 32,
- 38,
+ 0,
+ 4,
],
"type": "Identifier",
- "value": "string",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 40,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 39,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 39,
- 40,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
"column": 10,
- "line": 2,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 45,
- 51,
+ 9,
+ 10,
],
- "type": "Keyword",
- "value": "return",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
"column": 17,
- "line": 2,
+ "line": 1,
},
"start": Object {
"column": 11,
- "line": 2,
+ "line": 1,
},
},
"range": Array [
- 52,
- 58,
+ 11,
+ 17,
],
- "type": "Keyword",
- "value": "typeof",
+ "type": "Identifier",
+ "value": "symbol",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/typed-keyword-true.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 15,
+ ],
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "literal": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 15,
+ ],
+ "raw": "true",
+ "type": "Literal",
+ "value": true,
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 15,
+ ],
+ "type": "TSLiteralType",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
},
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 16,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 2,
+ "column": 4,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 59,
- 60,
+ 0,
+ 4,
],
"type": "Identifier",
- "value": "x",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 2,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 2,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 61,
- 64,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": "===",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 32,
- "line": 2,
+ "column": 10,
+ "line": 1,
},
"start": Object {
- "column": 24,
- "line": 2,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 65,
- 73,
+ 9,
+ 10,
],
- "type": "String",
- "value": "'string'",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 11,
+ "line": 1,
},
},
"range": Array [
- 74,
- 75,
+ 11,
+ 15,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Boolean",
+ "value": "true",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/type-guard-in-interface.src 1`] = `
+exports[`typescript fixtures/basics/typed-keyword-undefined.src 1`] = `
Object {
"body": Array [
Object {
- "body": Object {
- "body": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 2,
- },
- "start": Object {
- "column": 2,
- "line": 2,
- },
- },
- "name": "isString",
- "range": Array [
- 18,
- 26,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 2,
- },
- "start": Object {
- "column": 2,
- "line": 2,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "name": "node",
- "range": Array [
- 27,
- 36,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 15,
- "line": 2,
- },
- },
- "range": Array [
- 31,
- 36,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 17,
- "line": 2,
- },
- },
- "range": Array [
- 33,
- 36,
- ],
- "type": "TSAnyKeyword",
- },
- },
- },
- ],
- "range": Array [
- 18,
- 54,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 2,
- },
- "start": Object {
- "column": 21,
- "line": 2,
- },
- },
- "range": Array [
- 37,
- 53,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 2,
- },
- "start": Object {
- "column": 23,
- "line": 2,
- },
- },
- "parameterName": Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 2,
- },
- "start": Object {
- "column": 23,
- "line": 2,
- },
- },
- "name": "node",
- "range": Array [
- 39,
- 43,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 39,
- 53,
- ],
- "type": "TSTypePredicate",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 2,
- },
- "start": Object {
- "column": 31,
- "line": 2,
- },
- },
- "range": Array [
- 47,
- 53,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 2,
- },
- "start": Object {
- "column": 31,
- "line": 2,
- },
- },
- "range": Array [
- 47,
- 53,
- ],
- "type": "TSStringKeyword",
- },
- },
- },
- },
- "type": "TSMethodSignature",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "range": Array [
- 14,
- 56,
- ],
- "type": "TSInterfaceBody",
- },
"id": Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 5,
"line": 1,
},
},
"name": "Foo",
"range": Array [
- 10,
- 13,
+ 5,
+ 8,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 20,
+ "line": 1,
},
"start": Object {
"column": 0,
@@ -64109,16 +72064,33 @@ Object {
},
"range": Array [
0,
- 56,
+ 20,
],
- "type": "TSInterfaceDeclaration",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 20,
+ ],
+ "type": "TSUndefinedKeyword",
+ },
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 4,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -64127,14 +72099,14 @@ Object {
},
"range": Array [
0,
- 57,
+ 21,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 4,
"line": 1,
},
"start": Object {
@@ -64144,25 +72116,25 @@ Object {
},
"range": Array [
0,
- 9,
+ 4,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 10,
- 13,
+ 5,
+ 8,
],
"type": "Identifier",
"value": "Foo",
@@ -64170,254 +72142,399 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 14,
- 15,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": "{",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 2,
+ "column": 20,
+ "line": 1,
},
"start": Object {
- "column": 2,
- "line": 2,
+ "column": 11,
+ "line": 1,
},
},
"range": Array [
- 18,
- 26,
+ 11,
+ 20,
],
"type": "Identifier",
- "value": "isString",
+ "value": "undefined",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/typed-keyword-unknown.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 11,
- "line": 2,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 0,
+ 18,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 18,
+ ],
+ "type": "TSUnknownKeyword",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 19,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 2,
+ "column": 4,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 27,
- 31,
+ 0,
+ 4,
],
"type": "Identifier",
- "value": "node",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 2,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 15,
- "line": 2,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 31,
- 32,
+ 5,
+ 8,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 2,
+ "column": 10,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 2,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 33,
- 36,
+ 9,
+ 10,
],
- "type": "Identifier",
- "value": "any",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 2,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 2,
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 18,
+ ],
+ "type": "Identifier",
+ "value": "unknown",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/typed-keyword-void.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
},
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 36,
- 37,
- ],
- "type": "Punctuator",
- "value": ")",
- },
- Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 2,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 21,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 37,
- 38,
+ 0,
+ 15,
],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 2,
- },
- "start": Object {
- "column": 23,
- "line": 2,
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
},
+ "range": Array [
+ 11,
+ 15,
+ ],
+ "type": "TSVoidKeyword",
},
- "range": Array [
- 39,
- 43,
- ],
- "type": "Identifier",
- "value": "node",
},
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 16,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 30,
- "line": 2,
+ "column": 4,
+ "line": 1,
},
"start": Object {
- "column": 28,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 44,
- 46,
+ 0,
+ 4,
],
"type": "Identifier",
- "value": "is",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 2,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 31,
- "line": 2,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 47,
- 53,
+ 5,
+ 8,
],
"type": "Identifier",
- "value": "string",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 2,
+ "column": 10,
+ "line": 1,
},
"start": Object {
- "column": 37,
- "line": 2,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 53,
- 54,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": ";",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 11,
+ "line": 1,
},
},
"range": Array [
- 55,
- 56,
+ 11,
+ 15,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Keyword",
+ "value": "void",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/type-guard-in-method.src 1`] = `
+exports[`typescript fixtures/basics/typed-method-signature.src 1`] = `
Object {
"body": Array [
Object {
- "body": Object {
- "body": Array [
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 57,
+ ],
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "members": Array [
Object {
"computed": false,
"key": Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 3,
"line": 2,
},
"start": Object {
@@ -64425,518 +72542,345 @@ Object {
"line": 2,
},
},
- "name": "isBar",
+ "name": "h",
"range": Array [
- 14,
- 19,
+ 15,
+ 16,
],
"type": "Identifier",
},
- "kind": "method",
"loc": Object {
"end": Object {
- "column": 3,
- "line": 4,
+ "column": 23,
+ "line": 2,
},
"start": Object {
"column": 2,
"line": 2,
},
},
- "range": Array [
- 14,
- 75,
- ],
- "static": false,
- "type": "MethodDefinition",
- "value": Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "left": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 3,
- },
- "start": Object {
- "column": 11,
- "line": 3,
- },
- },
- "range": Array [
- 51,
- 55,
- ],
- "type": "ThisExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 3,
- },
- "start": Object {
- "column": 11,
- "line": 3,
- },
- },
- "operator": "instanceof",
- "range": Array [
- 51,
- 70,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 3,
- },
- "start": Object {
- "column": 27,
- "line": 3,
- },
- },
- "name": "Foo",
- "range": Array [
- 67,
- 70,
- ],
- "type": "Identifier",
- },
- "type": "BinaryExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "range": Array [
- 44,
- 71,
- ],
- "type": "ReturnStatement",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 4,
- },
- "start": Object {
- "column": 26,
- "line": 2,
- },
- },
- "range": Array [
- 38,
- 75,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": null,
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 4,
- },
- "start": Object {
- "column": 7,
- "line": 2,
- },
- },
- "params": Array [],
- "range": Array [
- 19,
- 75,
- ],
- "returnType": Object {
+ "params": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 15,
"line": 2,
},
"start": Object {
- "column": 9,
+ "column": 4,
"line": 2,
},
},
+ "name": "bar",
"range": Array [
- 21,
- 37,
+ 17,
+ 28,
],
- "type": "TSTypeAnnotation",
+ "type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 15,
"line": 2,
},
"start": Object {
- "column": 11,
+ "column": 7,
"line": 2,
},
},
- "parameterName": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "range": Array [
- 23,
- 27,
- ],
- "type": "TSThisType",
- },
"range": Array [
- 23,
- 37,
+ 20,
+ 28,
],
- "type": "TSTypePredicate",
+ "type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 15,
"line": 2,
},
"start": Object {
- "column": 19,
+ "column": 9,
"line": 2,
},
},
"range": Array [
- 31,
- 37,
+ 22,
+ 28,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 2,
- },
- "start": Object {
- "column": 19,
- "line": 2,
- },
- },
- "range": Array [
- 31,
- 37,
- ],
- "type": "TSStringKeyword",
- },
+ "type": "TSStringKeyword",
},
},
},
- "type": "FunctionExpression",
- },
- },
- Object {
- "computed": false,
- "key": Object {
+ ],
+ "range": Array [
+ 15,
+ 36,
+ ],
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 5,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 2,
- "line": 5,
+ "column": 16,
+ "line": 2,
},
},
- "name": "isBaz",
"range": Array [
- 78,
- 83,
+ 29,
+ 35,
],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 7,
- },
- "start": Object {
- "column": 2,
- "line": 5,
- },
- },
- "range": Array [
- 78,
- 145,
- ],
- "static": false,
- "type": "ClassProperty",
- "value": Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "left": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 6,
- },
- "start": Object {
- "column": 11,
- "line": 6,
- },
- },
- "range": Array [
- 121,
- 125,
- ],
- "type": "ThisExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 6,
- },
- "start": Object {
- "column": 11,
- "line": 6,
- },
- },
- "operator": "instanceof",
- "range": Array [
- 121,
- 140,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 6,
- },
- "start": Object {
- "column": 27,
- "line": 6,
- },
- },
- "name": "Foo",
- "range": Array [
- 137,
- 140,
- ],
- "type": "Identifier",
- },
- "type": "BinaryExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 6,
- },
- "start": Object {
- "column": 4,
- "line": 6,
- },
- },
- "range": Array [
- 114,
- 141,
- ],
- "type": "ReturnStatement",
- },
- ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 7,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 32,
- "line": 5,
+ "column": 18,
+ "line": 2,
},
},
"range": Array [
- 108,
- 145,
+ 31,
+ 35,
],
- "type": "BlockStatement",
+ "type": "TSVoidKeyword",
},
- "expression": false,
- "generator": false,
- "id": null,
+ },
+ "type": "TSMethodSignature",
+ },
+ Object {
+ "computed": false,
+ "key": Object {
"loc": Object {
"end": Object {
"column": 3,
- "line": 7,
+ "line": 3,
},
"start": Object {
- "column": 10,
- "line": 5,
+ "column": 2,
+ "line": 3,
},
},
- "params": Array [],
+ "name": "g",
"range": Array [
- 86,
- 145,
+ 39,
+ 40,
],
- "returnType": Object {
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 3,
+ },
+ },
+ "params": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 5,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 12,
- "line": 5,
+ "column": 7,
+ "line": 3,
},
},
+ "name": "bar",
"range": Array [
- 88,
- 104,
+ 44,
+ 50,
],
- "type": "TSTypeAnnotation",
+ "type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 5,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 14,
- "line": 5,
- },
- },
- "parameterName": Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 5,
- },
- "start": Object {
- "column": 14,
- "line": 5,
- },
+ "column": 10,
+ "line": 3,
},
- "range": Array [
- 90,
- 94,
- ],
- "type": "TSThisType",
},
"range": Array [
- 90,
- 104,
+ 47,
+ 50,
],
- "type": "TSTypePredicate",
+ "type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 5,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 22,
- "line": 5,
+ "column": 12,
+ "line": 3,
},
},
"range": Array [
- 98,
- 104,
+ 49,
+ 50,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "type": "TSTypeReference",
+ "typeName": Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 5,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 22,
- "line": 5,
+ "column": 12,
+ "line": 3,
},
},
+ "name": "T",
"range": Array [
- 98,
- 104,
+ 49,
+ 50,
],
- "type": "TSStringKeyword",
+ "type": "Identifier",
},
},
},
},
- "type": "ArrowFunctionExpression",
+ ],
+ "range": Array [
+ 39,
+ 55,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 51,
+ 54,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 53,
+ 54,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 3,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 53,
+ 54,
+ ],
+ "type": "Identifier",
+ },
+ },
+ },
+ "type": "TSMethodSignature",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 3,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 41,
+ 42,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 41,
+ 42,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 40,
+ 43,
+ ],
+ "type": "TSTypeParameterDeclaration",
},
},
],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 8,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "range": Array [
- 10,
- 147,
- ],
- "type": "ClassBody",
- },
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
- },
- "name": "Foo",
"range": Array [
- 6,
- 9,
+ 11,
+ 57,
],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 8,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
+ "type": "TSTypeLiteral",
},
- "range": Array [
- 0,
- 147,
- ],
- "superClass": null,
- "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 9,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -64945,14 +72889,14 @@ Object {
},
"range": Array [
0,
- 148,
+ 58,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 4,
"line": 1,
},
"start": Object {
@@ -64962,25 +72906,25 @@ Object {
},
"range": Array [
0,
- 5,
+ 4,
],
- "type": "Keyword",
- "value": "class",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 6,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 6,
- 9,
+ 5,
+ 8,
],
"type": "Identifier",
"value": "Foo",
@@ -64988,575 +72932,431 @@ Object {
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": 7,
- "line": 2,
- },
- "start": Object {
- "column": 2,
- "line": 2,
- },
- },
- "range": Array [
- 14,
- 19,
- ],
- "type": "Identifier",
- "value": "isBar",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 2,
- },
- "start": Object {
- "column": 7,
- "line": 2,
- },
- },
- "range": Array [
- 19,
- 20,
- ],
- "type": "Punctuator",
- "value": "(",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 2,
- },
- "start": Object {
- "column": 8,
- "line": 2,
- },
- },
- "range": Array [
- 20,
- 21,
- ],
- "type": "Punctuator",
- "value": ")",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 2,
- },
"start": Object {
"column": 9,
- "line": 2,
+ "line": 1,
},
},
"range": Array [
- 21,
- 22,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": ":",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 2,
+ "column": 12,
+ "line": 1,
},
"start": Object {
"column": 11,
- "line": 2,
- },
- },
- "range": Array [
- 23,
- 27,
- ],
- "type": "Keyword",
- "value": "this",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
+ "line": 1,
},
},
"range": Array [
- 28,
- 30,
+ 11,
+ 12,
],
- "type": "Identifier",
- "value": "is",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 3,
"line": 2,
},
"start": Object {
- "column": 19,
+ "column": 2,
"line": 2,
},
},
"range": Array [
- 31,
- 37,
+ 15,
+ 16,
],
"type": "Identifier",
- "value": "string",
+ "value": "h",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 4,
"line": 2,
},
"start": Object {
- "column": 26,
+ "column": 3,
"line": 2,
},
},
"range": Array [
- 38,
- 39,
+ 16,
+ 17,
],
"type": "Punctuator",
- "value": "{",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 3,
+ "column": 7,
+ "line": 2,
},
"start": Object {
"column": 4,
- "line": 3,
- },
- },
- "range": Array [
- 44,
- 50,
- ],
- "type": "Keyword",
- "value": "return",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 3,
- },
- "start": Object {
- "column": 11,
- "line": 3,
- },
- },
- "range": Array [
- 51,
- 55,
- ],
- "type": "Keyword",
- "value": "this",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 3,
- },
- "start": Object {
- "column": 16,
- "line": 3,
- },
- },
- "range": Array [
- 56,
- 66,
- ],
- "type": "Keyword",
- "value": "instanceof",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 3,
- },
- "start": Object {
- "column": 27,
- "line": 3,
- },
- },
- "range": Array [
- 67,
- 70,
- ],
- "type": "Identifier",
- "value": "Foo",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 3,
- },
- "start": Object {
- "column": 30,
- "line": 3,
+ "line": 2,
},
},
- "range": Array [
- 70,
- 71,
+ "range": Array [
+ 17,
+ 20,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 4,
+ "column": 8,
+ "line": 2,
},
"start": Object {
- "column": 2,
- "line": 4,
+ "column": 7,
+ "line": 2,
},
},
"range": Array [
- 74,
- 75,
+ 20,
+ 21,
],
"type": "Punctuator",
- "value": "}",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 5,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 2,
- "line": 5,
+ "column": 9,
+ "line": 2,
},
},
"range": Array [
- 78,
- 83,
+ 22,
+ 28,
],
"type": "Identifier",
- "value": "isBaz",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 5,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 5,
+ "column": 15,
+ "line": 2,
},
},
"range": Array [
- 84,
- 85,
+ 28,
+ 29,
],
"type": "Punctuator",
- "value": "=",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 5,
+ "column": 17,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 5,
+ "column": 16,
+ "line": 2,
},
},
"range": Array [
- 86,
- 87,
+ 29,
+ 30,
],
"type": "Punctuator",
- "value": "(",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 5,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 5,
+ "column": 18,
+ "line": 2,
},
},
"range": Array [
- 87,
- 88,
+ 31,
+ 35,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Keyword",
+ "value": "void",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 5,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 12,
- "line": 5,
+ "column": 22,
+ "line": 2,
},
},
"range": Array [
- 88,
- 89,
+ 35,
+ 36,
],
"type": "Punctuator",
- "value": ":",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 5,
+ "column": 3,
+ "line": 3,
},
"start": Object {
- "column": 14,
- "line": 5,
+ "column": 2,
+ "line": 3,
},
},
"range": Array [
- 90,
- 94,
+ 39,
+ 40,
],
- "type": "Keyword",
- "value": "this",
+ "type": "Identifier",
+ "value": "g",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 5,
+ "column": 4,
+ "line": 3,
},
"start": Object {
- "column": 19,
- "line": 5,
+ "column": 3,
+ "line": 3,
},
},
"range": Array [
- 95,
- 97,
+ 40,
+ 41,
],
- "type": "Identifier",
- "value": "is",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 5,
+ "column": 5,
+ "line": 3,
},
"start": Object {
- "column": 22,
- "line": 5,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 98,
- 104,
+ 41,
+ 42,
],
"type": "Identifier",
- "value": "string",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 5,
+ "column": 6,
+ "line": 3,
},
"start": Object {
- "column": 29,
- "line": 5,
+ "column": 5,
+ "line": 3,
},
},
"range": Array [
- 105,
- 107,
+ 42,
+ 43,
],
"type": "Punctuator",
- "value": "=>",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
- "line": 5,
+ "column": 7,
+ "line": 3,
},
"start": Object {
- "column": 32,
- "line": 5,
+ "column": 6,
+ "line": 3,
},
},
"range": Array [
- 108,
- 109,
+ 43,
+ 44,
],
"type": "Punctuator",
- "value": "{",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
"column": 10,
- "line": 6,
+ "line": 3,
},
"start": Object {
- "column": 4,
- "line": 6,
+ "column": 7,
+ "line": 3,
},
},
"range": Array [
- 114,
- 120,
+ 44,
+ 47,
],
- "type": "Keyword",
- "value": "return",
+ "type": "Identifier",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 6,
+ "column": 11,
+ "line": 3,
},
"start": Object {
- "column": 11,
- "line": 6,
+ "column": 10,
+ "line": 3,
},
},
"range": Array [
- 121,
- 125,
+ 47,
+ 48,
],
- "type": "Keyword",
- "value": "this",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 6,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 16,
- "line": 6,
+ "column": 12,
+ "line": 3,
},
},
"range": Array [
- 126,
- 136,
+ 49,
+ 50,
],
- "type": "Keyword",
- "value": "instanceof",
+ "type": "Identifier",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
- "line": 6,
+ "column": 14,
+ "line": 3,
},
"start": Object {
- "column": 27,
- "line": 6,
+ "column": 13,
+ "line": 3,
},
},
"range": Array [
- 137,
- 140,
+ 50,
+ 51,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 6,
+ "column": 15,
+ "line": 3,
},
"start": Object {
- "column": 30,
- "line": 6,
+ "column": 14,
+ "line": 3,
},
},
"range": Array [
- 140,
- 141,
+ 51,
+ 52,
],
"type": "Punctuator",
- "value": ";",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 7,
+ "column": 17,
+ "line": 3,
},
"start": Object {
- "column": 2,
- "line": 7,
+ "column": 16,
+ "line": 3,
},
},
"range": Array [
- 144,
- 145,
+ 53,
+ 54,
+ ],
+ "type": "Identifier",
+ "value": "T",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 54,
+ 55,
],
"type": "Punctuator",
- "value": "}",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 8,
+ "line": 4,
},
"start": Object {
"column": 0,
- "line": 8,
+ "line": 4,
},
},
"range": Array [
- 146,
- 147,
+ 56,
+ 57,
],
"type": "Punctuator",
"value": "}",
@@ -65566,706 +73366,713 @@ Object {
}
`;
-exports[`typescript fixtures/basics/type-parameters-comments.src 1`] = `
+exports[`typescript fixtures/basics/typed-this.src 1`] = `
Object {
"body": Array [
Object {
- "expression": Object {
- "arguments": Array [],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "name": "foo",
- "range": Array [
- 0,
- 3,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 42,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 42,
- ],
- "type": "CallExpression",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 40,
- "line": 1,
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 2,
+ },
+ },
+ "name": "addClickListener",
+ "range": Array [
+ 23,
+ 39,
+ ],
+ "type": "Identifier",
},
- "start": Object {
- "column": 3,
- "line": 1,
+ "loc": Object {
+ "end": Object {
+ "column": 65,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 2,
+ },
},
- },
- "params": Array [
- Object {
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 57,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "name": "onclick",
+ "range": Array [
+ 40,
+ 79,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 57,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 47,
+ 79,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 57,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 2,
+ },
+ },
+ "name": "this",
+ "range": Array [
+ 50,
+ 60,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 32,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 54,
+ 60,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 34,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 56,
+ 60,
+ ],
+ "type": "TSVoidKeyword",
+ },
+ },
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 40,
+ "line": 2,
+ },
+ },
+ "name": "e",
+ "range": Array [
+ 62,
+ 70,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 63,
+ 70,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 43,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 65,
+ 70,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 43,
+ "line": 2,
+ },
+ },
+ "name": "Event",
+ "range": Array [
+ 65,
+ 70,
+ ],
+ "type": "Identifier",
+ },
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 49,
+ 79,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 57,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 50,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 72,
+ 79,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 57,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 53,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 75,
+ 79,
+ ],
+ "type": "TSVoidKeyword",
+ },
+ },
+ "type": "TSFunctionType",
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 23,
+ 87,
+ ],
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 64,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 1,
+ "column": 58,
+ "line": 2,
},
},
"range": Array [
- 21,
- 22,
+ 80,
+ 86,
],
- "type": "TSTypeReference",
- "typeName": Object {
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 64,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 1,
+ "column": 60,
+ "line": 2,
},
},
- "name": "A",
"range": Array [
- 21,
- 22,
+ 82,
+ 86,
],
- "type": "Identifier",
+ "type": "TSVoidKeyword",
},
},
- ],
- "range": Array [
- 3,
- 40,
- ],
- "type": "TSTypeParameterInstantiation",
- },
- },
- "loc": Object {
- "end": Object {
- "column": 43,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 43,
- ],
- "type": "ExpressionStatement",
- },
- Object {
- "async": false,
- "body": Object {
- "body": Array [],
+ "type": "TSMethodSignature",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 43,
- "line": 2,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 40,
- "line": 2,
+ "column": 20,
+ "line": 1,
},
},
"range": Array [
- 84,
- 87,
+ 20,
+ 89,
],
- "type": "BlockStatement",
+ "type": "TSInterfaceBody",
},
- "expression": false,
- "generator": false,
"id": Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 2,
+ "column": 19,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 2,
+ "column": 10,
+ "line": 1,
},
},
- "name": "bar",
+ "name": "UIElement",
"range": Array [
- 53,
- 56,
+ 10,
+ 19,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 43,
- "line": 2,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
- "line": 2,
+ "line": 1,
},
},
- "params": Array [],
"range": Array [
- 44,
- 87,
+ 0,
+ 89,
],
- "type": "FunctionDeclaration",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 2,
- },
- "start": Object {
- "column": 12,
- "line": 2,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 2,
- },
- "start": Object {
- "column": 24,
- "line": 2,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 2,
- },
- "start": Object {
- "column": 24,
- "line": 2,
- },
- },
- "name": "A",
- "range": Array [
- 68,
- 69,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 68,
- 69,
- ],
- "type": "TSTypeParameter",
- },
- ],
- "range": Array [
- 56,
- 81,
- ],
- "type": "TSTypeParameterDeclaration",
- },
+ "type": "TSInterfaceDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
},
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 90,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
- "async": false,
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 49,
- "line": 3,
- },
- "start": Object {
- "column": 46,
- "line": 3,
- },
- },
- "range": Array [
- 134,
- 137,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 3,
- },
- "start": Object {
- "column": 9,
- "line": 3,
- },
- },
- "name": "baz",
- "range": Array [
- 97,
- 100,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 49,
- "line": 3,
+ "column": 9,
+ "line": 1,
},
"start": Object {
"column": 0,
- "line": 3,
+ "line": 1,
},
},
- "params": Array [],
"range": Array [
- 88,
- 137,
+ 0,
+ 9,
],
- "type": "FunctionDeclaration",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 43,
- "line": 3,
- },
- "start": Object {
- "column": 12,
- "line": 3,
- },
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
},
- "params": Array [
- Object {
- "default": Object {
- "loc": Object {
- "end": Object {
- "column": 41,
- "line": 3,
- },
- "start": Object {
- "column": 38,
- "line": 3,
- },
- },
- "range": Array [
- 126,
- 129,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 41,
- "line": 3,
- },
- "start": Object {
- "column": 38,
- "line": 3,
- },
- },
- "name": "Foo",
- "range": Array [
- 126,
- 129,
- ],
- "type": "Identifier",
- },
- },
- "loc": Object {
- "end": Object {
- "column": 41,
- "line": 3,
- },
- "start": Object {
- "column": 24,
- "line": 3,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 3,
- },
- "start": Object {
- "column": 24,
- "line": 3,
- },
- },
- "name": "A",
- "range": Array [
- 112,
- 113,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 112,
- 129,
- ],
- "type": "TSTypeParameter",
- },
- ],
- "range": Array [
- 100,
- 131,
- ],
- "type": "TSTypeParameterDeclaration",
},
+ "range": Array [
+ 10,
+ 19,
+ ],
+ "type": "Identifier",
+ "value": "UIElement",
},
- ],
- "comments": Array [
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 5,
20,
+ 21,
],
- "type": "Block",
- "value": " comment 1 ",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 1,
+ "column": 17,
+ "line": 2,
},
"start": Object {
- "column": 23,
- "line": 1,
+ "column": 1,
+ "line": 2,
},
},
"range": Array [
23,
- 38,
+ 39,
],
- "type": "Block",
- "value": " comment 2 ",
+ "type": "Identifier",
+ "value": "addClickListener",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 18,
"line": 2,
},
"start": Object {
- "column": 14,
+ "column": 17,
"line": 2,
},
},
"range": Array [
- 58,
- 67,
+ 39,
+ 40,
],
- "type": "Block",
- "value": " aaa ",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 25,
"line": 2,
},
"start": Object {
- "column": 26,
+ "column": 18,
"line": 2,
},
},
"range": Array [
- 70,
- 79,
+ 40,
+ 47,
],
- "type": "Block",
- "value": " bbb ",
+ "type": "Identifier",
+ "value": "onclick",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 3,
+ "column": 26,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 3,
+ "column": 25,
+ "line": 2,
},
},
"range": Array [
- 102,
- 111,
+ 47,
+ 48,
],
- "type": "Block",
- "value": " aaa ",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 35,
- "line": 3,
+ "column": 28,
+ "line": 2,
},
"start": Object {
- "column": 26,
- "line": 3,
+ "column": 27,
+ "line": 2,
},
},
"range": Array [
- 114,
- 123,
+ 49,
+ 50,
],
- "type": "Block",
- "value": " bbb ",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": "(",
},
- },
- "range": Array [
- 0,
- 138,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 1,
+ "column": 32,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 28,
+ "line": 2,
},
},
"range": Array [
- 0,
- 3,
+ 50,
+ 54,
],
- "type": "Identifier",
- "value": "foo",
+ "type": "Keyword",
+ "value": "this",
},
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 1,
+ "column": 33,
+ "line": 2,
},
"start": Object {
- "column": 3,
- "line": 1,
+ "column": 32,
+ "line": 2,
},
},
"range": Array [
- 3,
- 4,
+ 54,
+ 55,
],
"type": "Punctuator",
- "value": "<",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 38,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 1,
+ "column": 34,
+ "line": 2,
},
},
"range": Array [
- 21,
- 22,
+ 56,
+ 60,
],
- "type": "Identifier",
- "value": "A",
+ "type": "Keyword",
+ "value": "void",
},
Object {
"loc": Object {
"end": Object {
- "column": 40,
- "line": 1,
+ "column": 39,
+ "line": 2,
},
"start": Object {
- "column": 39,
- "line": 1,
+ "column": 38,
+ "line": 2,
},
},
"range": Array [
- 39,
- 40,
+ 60,
+ 61,
],
"type": "Punctuator",
- "value": ">",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
"column": 41,
- "line": 1,
+ "line": 2,
},
"start": Object {
"column": 40,
- "line": 1,
+ "line": 2,
},
},
"range": Array [
- 40,
- 41,
+ 62,
+ 63,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "e",
},
Object {
"loc": Object {
"end": Object {
"column": 42,
- "line": 1,
+ "line": 2,
},
"start": Object {
"column": 41,
- "line": 1,
+ "line": 2,
},
},
"range": Array [
- 41,
- 42,
+ 63,
+ 64,
],
"type": "Punctuator",
- "value": ")",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 43,
- "line": 1,
+ "column": 48,
+ "line": 2,
},
"start": Object {
- "column": 42,
- "line": 1,
+ "column": 43,
+ "line": 2,
},
},
"range": Array [
- 42,
- 43,
+ 65,
+ 70,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "Event",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 49,
"line": 2,
},
"start": Object {
- "column": 0,
+ "column": 48,
"line": 2,
},
},
"range": Array [
- 44,
- 52,
+ 70,
+ 71,
],
- "type": "Keyword",
- "value": "function",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 52,
"line": 2,
},
"start": Object {
- "column": 9,
+ "column": 50,
"line": 2,
},
},
"range": Array [
- 53,
- 56,
+ 72,
+ 74,
],
- "type": "Identifier",
- "value": "bar",
+ "type": "Punctuator",
+ "value": "=>",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 57,
"line": 2,
},
"start": Object {
- "column": 12,
+ "column": 53,
"line": 2,
},
},
"range": Array [
- 56,
- 57,
+ 75,
+ 79,
],
- "type": "Punctuator",
- "value": "<",
+ "type": "Keyword",
+ "value": "void",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 58,
"line": 2,
},
"start": Object {
- "column": 24,
+ "column": 57,
"line": 2,
},
},
"range": Array [
- 68,
- 69,
+ 79,
+ 80,
],
- "type": "Identifier",
- "value": "A",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
+ "column": 59,
"line": 2,
},
"start": Object {
- "column": 36,
+ "column": 58,
"line": 2,
},
},
@@ -66274,523 +74081,755 @@ Object {
81,
],
"type": "Punctuator",
- "value": ">",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 64,
"line": 2,
},
"start": Object {
- "column": 37,
+ "column": 60,
"line": 2,
},
},
"range": Array [
- 81,
82,
+ 86,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Keyword",
+ "value": "void",
},
Object {
"loc": Object {
"end": Object {
- "column": 39,
+ "column": 65,
"line": 2,
},
"start": Object {
- "column": 38,
+ "column": 64,
"line": 2,
},
},
"range": Array [
- 82,
- 83,
+ 86,
+ 87,
],
"type": "Punctuator",
- "value": ")",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 41,
- "line": 2,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 40,
- "line": 2,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 84,
- 85,
+ 88,
+ 89,
],
"type": "Punctuator",
- "value": "{",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/unique-symbol.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 5,
+ 6,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 43,
- "line": 2,
+ "column": 23,
+ "line": 1,
},
"start": Object {
- "column": 42,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 86,
- 87,
+ 0,
+ 23,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "operator": "unique",
+ "range": Array [
+ 9,
+ 22,
+ ],
+ "type": "TSTypeOperator",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 16,
+ 22,
+ ],
+ "type": "TSSymbolKeyword",
+ },
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 24,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 3,
+ "column": 4,
+ "line": 1,
},
"start": Object {
"column": 0,
- "line": 3,
+ "line": 1,
},
},
"range": Array [
- 88,
- 96,
+ 0,
+ 4,
],
- "type": "Keyword",
- "value": "function",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 3,
+ "column": 6,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 3,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 97,
- 100,
+ 5,
+ 6,
],
"type": "Identifier",
- "value": "baz",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 3,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 3,
+ "column": 7,
+ "line": 1,
},
},
"range": Array [
- 100,
- 101,
+ 7,
+ 8,
],
"type": "Punctuator",
- "value": "<",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 3,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 24,
- "line": 3,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 112,
- 113,
+ 9,
+ 15,
],
"type": "Identifier",
- "value": "A",
+ "value": "unique",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 3,
+ "column": 22,
+ "line": 1,
},
"start": Object {
- "column": 36,
- "line": 3,
+ "column": 16,
+ "line": 1,
},
},
"range": Array [
- 124,
- 125,
+ 16,
+ 22,
+ ],
+ "type": "Identifier",
+ "value": "symbol",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 23,
],
"type": "Punctuator",
- "value": "=",
+ "value": ";",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/basics/unknown-type-annotation.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 4,
+ 16,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 16,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 16,
+ ],
+ "type": "TSUnknownKeyword",
+ },
+ },
+ },
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 4,
+ 16,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "kind": "let",
"loc": Object {
"end": Object {
- "column": 41,
- "line": 3,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 38,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 126,
- 129,
+ 0,
+ 17,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "VariableDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 18,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 43,
- "line": 3,
+ "column": 3,
+ "line": 1,
},
"start": Object {
- "column": 42,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 130,
- 131,
+ 0,
+ 3,
],
- "type": "Punctuator",
- "value": ">",
+ "type": "Keyword",
+ "value": "let",
},
Object {
"loc": Object {
"end": Object {
- "column": 44,
- "line": 3,
+ "column": 7,
+ "line": 1,
},
"start": Object {
- "column": 43,
- "line": 3,
+ "column": 4,
+ "line": 1,
},
},
"range": Array [
- 131,
- 132,
+ 4,
+ 7,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 45,
- "line": 3,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 44,
- "line": 3,
+ "column": 7,
+ "line": 1,
},
},
"range": Array [
- 132,
- 133,
+ 7,
+ 8,
],
"type": "Punctuator",
- "value": ")",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 47,
- "line": 3,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 46,
- "line": 3,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 134,
- 135,
+ 9,
+ 16,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "unknown",
},
Object {
"loc": Object {
"end": Object {
- "column": 49,
- "line": 3,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 48,
- "line": 3,
+ "column": 16,
+ "line": 1,
},
},
"range": Array [
- 136,
- 137,
+ 16,
+ 17,
],
"type": "Punctuator",
- "value": "}",
+ "value": ";",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/type-reference-comments.src 1`] = `
+exports[`typescript fixtures/basics/var-with-definite-assignment.src 1`] = `
Object {
"body": Array [
Object {
- "body": Object {
- "body": Array [
- Object {
- "computed": false,
- "key": Object {
+ "declarations": Array [
+ Object {
+ "definite": true,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 6,
+ 16,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 2,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 2,
- "line": 2,
+ "column": 8,
+ "line": 1,
},
},
- "name": "mBuffers",
"range": Array [
- 26,
- 34,
+ 8,
+ 16,
],
- "type": "Identifier",
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 16,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
},
+ },
+ "range": Array [
+ 6,
+ 16,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "kind": "const",
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 17,
+ ],
+ "type": "VariableDeclaration",
+ },
+ Object {
+ "declarations": Array [
+ Object {
+ "definite": true,
+ "id": Object {
"loc": Object {
"end": Object {
- "column": 51,
+ "column": 14,
"line": 2,
},
"start": Object {
- "column": 2,
+ "column": 4,
"line": 2,
},
},
+ "name": "y",
"range": Array [
- 26,
- 75,
+ 22,
+ 32,
],
- "static": false,
- "type": "ClassProperty",
+ "type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 50,
+ "column": 14,
"line": 2,
},
"start": Object {
- "column": 10,
+ "column": 6,
"line": 2,
},
},
"range": Array [
- 34,
- 74,
+ 24,
+ 32,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 50,
+ "column": 14,
"line": 2,
},
"start": Object {
- "column": 12,
+ "column": 8,
"line": 2,
},
},
"range": Array [
- 36,
- 74,
+ 26,
+ 32,
],
- "type": "TSTypeReference",
- "typeName": Object {
- "left": Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 12,
- "line": 2,
- },
- },
- "name": "interop",
- "range": Array [
- 36,
- 43,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 2,
- },
- "start": Object {
- "column": 12,
- "line": 2,
- },
- },
- "range": Array [
- 36,
- 53,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 2,
- },
- "start": Object {
- "column": 20,
- "line": 2,
- },
- },
- "name": "Reference",
- "range": Array [
- 44,
- 53,
- ],
- "type": "Identifier",
- },
- "type": "TSQualifiedName",
- },
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 50,
- "line": 2,
- },
- "start": Object {
- "column": 29,
- "line": 2,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 2,
- },
- "start": Object {
- "column": 30,
- "line": 2,
- },
- },
- "range": Array [
- 54,
- 57,
- ],
- "type": "TSAnyKeyword",
- },
- ],
- "range": Array [
- 53,
- 74,
- ],
- "type": "TSTypeParameterInstantiation",
- },
+ "type": "TSNumberKeyword",
},
},
- "value": null,
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "range": Array [
- 22,
- 77,
- ],
- "type": "ClassBody",
- },
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
},
- "start": Object {
- "column": 6,
- "line": 1,
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
},
+ "range": Array [
+ 22,
+ 32,
+ ],
+ "type": "VariableDeclarator",
},
- "name": "AudioBufferList",
- "range": Array [
- 6,
- 21,
- ],
- "type": "Identifier",
- },
+ ],
+ "kind": "var",
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 15,
+ "line": 2,
},
"start": Object {
"column": 0,
- "line": 1,
+ "line": 2,
},
},
"range": Array [
- 0,
- 77,
+ 18,
+ 33,
],
- "superClass": null,
- "type": "ClassDeclaration",
+ "type": "VariableDeclaration",
},
- ],
- "comments": Array [
Object {
+ "declarations": Array [
+ Object {
+ "definite": true,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "name": "z",
+ "range": Array [
+ 38,
+ 48,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 40,
+ 48,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 42,
+ 48,
+ ],
+ "type": "TSObjectKeyword",
+ },
+ },
+ },
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 38,
+ 48,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "kind": "let",
"loc": Object {
"end": Object {
- "column": 49,
- "line": 2,
+ "column": 15,
+ "line": 3,
},
"start": Object {
- "column": 34,
- "line": 2,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 58,
- 73,
+ 34,
+ 49,
],
- "type": "Block",
- "value": "AudioBuffer",
+ "type": "VariableDeclaration",
},
],
+ "comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
@@ -66803,7 +74842,7 @@ Object {
},
"range": Array [
0,
- 78,
+ 50,
],
"sourceType": "module",
"tokens": Array [
@@ -66823,12 +74862,12 @@ Object {
5,
],
"type": "Keyword",
- "value": "class",
+ "value": "const",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -66838,539 +74877,472 @@ Object {
},
"range": Array [
6,
- 21,
+ 7,
],
"type": "Identifier",
- "value": "AudioBufferList",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 22,
- 23,
- ],
- "type": "Punctuator",
- "value": "{",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 2,
- },
- "start": Object {
- "column": 2,
- "line": 2,
- },
- },
- "range": Array [
- 26,
- 34,
- ],
- "type": "Identifier",
- "value": "mBuffers",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 2,
- },
- "start": Object {
- "column": 10,
- "line": 2,
- },
- },
- "range": Array [
- 34,
- 35,
- ],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 12,
- "line": 2,
- },
- },
- "range": Array [
- 36,
- 43,
- ],
- "type": "Identifier",
- "value": "interop",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 19,
- "line": 2,
- },
- },
- "range": Array [
- 43,
- 44,
- ],
- "type": "Punctuator",
- "value": ".",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 2,
- },
- "start": Object {
- "column": 20,
- "line": 2,
- },
- },
- "range": Array [
- 44,
- 53,
+ 7,
+ 8,
],
- "type": "Identifier",
- "value": "Reference",
+ "type": "Punctuator",
+ "value": "!",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
- "line": 2,
+ "column": 9,
+ "line": 1,
},
"start": Object {
- "column": 29,
- "line": 2,
+ "column": 8,
+ "line": 1,
},
},
"range": Array [
- 53,
- 54,
+ 8,
+ 9,
],
"type": "Punctuator",
- "value": "<",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
- "line": 2,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 30,
- "line": 2,
+ "column": 10,
+ "line": 1,
},
},
"range": Array [
- 54,
- 57,
+ 10,
+ 16,
],
"type": "Identifier",
- "value": "any",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 50,
- "line": 2,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 49,
- "line": 2,
+ "column": 16,
+ "line": 1,
},
},
"range": Array [
- 73,
- 74,
+ 16,
+ 17,
],
"type": "Punctuator",
- "value": ">",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 51,
+ "column": 3,
"line": 2,
},
"start": Object {
- "column": 50,
+ "column": 0,
"line": 2,
},
},
"range": Array [
- 74,
- 75,
+ 18,
+ 21,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Keyword",
+ "value": "var",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 5,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 76,
- 77,
+ 22,
+ 23,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "y",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/typed-keyword-bigint.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 6,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
},
"range": Array [
- 0,
- 17,
+ 23,
+ 24,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 17,
- ],
- "type": "TSBigIntKeyword",
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": "!",
},
- },
- "range": Array [
- 0,
- 18,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 1,
+ "column": 7,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 6,
+ "line": 2,
},
},
"range": Array [
- 0,
- 4,
+ 24,
+ 25,
],
- "type": "Identifier",
- "value": "type",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 1,
+ "column": 14,
+ "line": 2,
},
"start": Object {
- "column": 5,
- "line": 1,
+ "column": 8,
+ "line": 2,
},
},
"range": Array [
- 5,
- 8,
+ 26,
+ 32,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "number",
},
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,
+ 32,
+ 33,
],
"type": "Punctuator",
- "value": "=",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 3,
+ "line": 3,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 11,
- 17,
+ 34,
+ 37,
],
- "type": "Identifier",
- "value": "bigint",
+ "type": "Keyword",
+ "value": "let",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/typed-keyword-boolean.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 18,
- "line": 1,
+ "column": 5,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 0,
- 18,
+ 38,
+ 39,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 18,
- ],
- "type": "TSBooleanKeyword",
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Identifier",
+ "value": "z",
},
- },
- "range": Array [
- 0,
- 19,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 1,
+ "column": 6,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 5,
+ "line": 3,
},
},
"range": Array [
- 0,
- 4,
+ 39,
+ 40,
],
- "type": "Identifier",
- "value": "type",
+ "type": "Punctuator",
+ "value": "!",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 1,
+ "column": 7,
+ "line": 3,
},
"start": Object {
- "column": 5,
- "line": 1,
+ "column": 6,
+ "line": 3,
},
},
"range": Array [
- 5,
- 8,
+ 40,
+ 41,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 1,
+ "column": 14,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 8,
+ "line": 3,
},
},
"range": Array [
- 9,
- 10,
+ 42,
+ 48,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Identifier",
+ "value": "object",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 1,
+ "column": 15,
+ "line": 3,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 14,
+ "line": 3,
},
},
"range": Array [
- 11,
- 18,
+ 48,
+ 49,
],
- "type": "Identifier",
- "value": "boolean",
+ "type": "Punctuator",
+ "value": ";",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/typed-keyword-false.src 1`] = `
+exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = `
Object {
"body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 4,
+ 14,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 14,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 14,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "left": Object {
+ "left": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 9,
+ 10,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 12,
+ ],
+ "right": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "name": "B",
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "Identifier",
+ },
+ "type": "TSQualifiedName",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 14,
+ ],
+ "right": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "name": "C",
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "type": "Identifier",
+ },
+ "type": "TSQualifiedName",
+ },
+ },
+ },
},
- "start": Object {
- "column": 5,
- "line": 1,
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
},
+ "range": Array [
+ 4,
+ 14,
+ ],
+ "type": "VariableDeclarator",
},
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- },
+ ],
+ "kind": "var",
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 15,
"line": 1,
},
"start": Object {
@@ -67380,45 +75352,9 @@ Object {
},
"range": Array [
0,
- 16,
+ 15,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "literal": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 16,
- ],
- "raw": "false",
- "type": "Literal",
- "value": false,
- },
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 16,
- ],
- "type": "TSLiteralType",
- },
+ "type": "VariableDeclaration",
},
],
"comments": Array [],
@@ -67434,14 +75370,14 @@ Object {
},
"range": Array [
0,
- 17,
+ 16,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 3,
"line": 1,
},
"start": Object {
@@ -67451,297 +75387,258 @@ Object {
},
"range": Array [
0,
- 4,
+ 3,
],
- "type": "Identifier",
- "value": "type",
+ "type": "Keyword",
+ "value": "var",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 7,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 4,
"line": 1,
},
},
"range": Array [
- 5,
- 8,
+ 4,
+ 7,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 7,
+ 8,
],
"type": "Punctuator",
- "value": "=",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 11,
- 16,
+ 9,
+ 10,
],
- "type": "Boolean",
- "value": "false",
+ "type": "Identifier",
+ "value": "A",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/typed-keyword-never.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 0,
- 16,
+ 10,
+ 11,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 16,
- ],
- "type": "TSNeverKeyword",
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": ".",
},
- },
- "range": Array [
- 0,
- 17,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 0,
- 4,
+ 11,
+ 12,
],
"type": "Identifier",
- "value": "type",
+ "value": "B",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 5,
- 8,
+ 12,
+ 13,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Punctuator",
+ "value": ".",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 13,
+ 14,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Identifier",
+ "value": "C",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 11,
- 16,
+ 14,
+ 15,
],
- "type": "Identifier",
- "value": "never",
+ "type": "Punctuator",
+ "value": ";",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/typed-keyword-null.src 1`] = `
+exports[`typescript fixtures/basics/var-with-type.src 1`] = `
Object {
"body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "name": "name",
+ "range": Array [
+ 4,
+ 15,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 8,
+ 15,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 15,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
},
- },
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 15,
- ],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
+ "init": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 28,
+ ],
+ "raw": "\\"Nicholas\\"",
+ "type": "Literal",
+ "value": "Nicholas",
},
- "start": Object {
- "column": 11,
- "line": 1,
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
},
+ "range": Array [
+ 4,
+ 28,
+ ],
+ "type": "VariableDeclarator",
},
- "range": Array [
- 11,
- 15,
- ],
- "type": "TSNullKeyword",
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 16,
- ],
- "sourceType": "module",
- "tokens": Array [
- Object {
+ ],
+ "kind": "var",
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 29,
"line": 1,
},
"start": Object {
@@ -67751,131 +75648,124 @@ Object {
},
"range": Array [
0,
- 4,
- ],
- "type": "Identifier",
- "value": "type",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- "value": "Foo",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "range": Array [
- 9,
- 10,
- ],
- "type": "Punctuator",
- "value": "=",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 15,
+ 29,
],
- "type": "Keyword",
- "value": "null",
+ "type": "VariableDeclaration",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/typed-keyword-number.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 34,
+ 45,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 37,
+ 45,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 39,
+ 45,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ "init": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 48,
+ 53,
+ ],
+ "raw": "\\"Bar\\"",
+ "type": "Literal",
+ "value": "Bar",
},
- "start": Object {
- "column": 5,
- "line": 1,
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
},
+ "range": Array [
+ 34,
+ 53,
+ ],
+ "type": "VariableDeclarator",
},
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- },
+ ],
+ "kind": "var",
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 24,
+ "line": 2,
},
"start": Object {
"column": 0,
- "line": 1,
+ "line": 2,
},
},
"range": Array [
- 0,
- 17,
+ 30,
+ 54,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 17,
- ],
- "type": "TSNumberKeyword",
- },
+ "type": "VariableDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 2,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -67884,14 +75774,14 @@ Object {
},
"range": Array [
0,
- 18,
+ 55,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 3,
"line": 1,
},
"start": Object {
@@ -67901,10 +75791,10 @@ Object {
},
"range": Array [
0,
- 4,
+ 3,
],
- "type": "Identifier",
- "value": "type",
+ "type": "Keyword",
+ "value": "var",
},
Object {
"loc": Object {
@@ -67913,383 +75803,318 @@ Object {
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 4,
"line": 1,
},
},
"range": Array [
- 5,
+ 4,
8,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "name",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 8,
"line": 1,
},
},
"range": Array [
+ 8,
9,
- 10,
],
"type": "Punctuator",
- "value": "=",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 11,
- 17,
+ 9,
+ 15,
],
"type": "Identifier",
- "value": "number",
+ "value": "string",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/typed-keyword-object.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
"column": 17,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 0,
+ 16,
17,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 17,
- ],
- "type": "TSObjectKeyword",
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": "=",
},
- },
- "range": Array [
- 0,
- 18,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 0,
- 4,
+ 18,
+ 28,
],
- "type": "Identifier",
- "value": "type",
+ "type": "String",
+ "value": "\\"Nicholas\\"",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 5,
- 8,
+ 28,
+ 29,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Punctuator",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 1,
+ "column": 3,
+ "line": 2,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 9,
- 10,
+ 30,
+ 33,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Keyword",
+ "value": "var",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 7,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 11,
- 17,
+ 34,
+ 37,
],
"type": "Identifier",
- "value": "object",
+ "value": "foo",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/typed-keyword-string.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 8,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 7,
+ "line": 2,
},
},
"range": Array [
- 0,
- 17,
+ 37,
+ 38,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 17,
- ],
- "type": "TSStringKeyword",
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": ":",
},
- },
- "range": Array [
- 0,
- 18,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 1,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 9,
+ "line": 2,
},
},
"range": Array [
- 0,
- 4,
+ 39,
+ 45,
],
"type": "Identifier",
- "value": "type",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 1,
+ "column": 17,
+ "line": 2,
},
"start": Object {
- "column": 5,
- "line": 1,
+ "column": 16,
+ "line": 2,
},
},
"range": Array [
- 5,
- 8,
+ 46,
+ 47,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 1,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 18,
+ "line": 2,
},
},
"range": Array [
- 9,
- 10,
+ 48,
+ 53,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "String",
+ "value": "\\"Bar\\"",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 24,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 23,
+ "line": 2,
},
},
"range": Array [
- 11,
- 17,
+ 53,
+ 54,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Punctuator",
+ "value": ";",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/typed-keyword-symbol.src 1`] = `
+exports[`typescript fixtures/basics/variable-declaration-type-annotation-spacing.src 1`] = `
Object {
"body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 4,
+ 21,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 8,
+ 21,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 21,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
},
- "start": Object {
- "column": 5,
- "line": 1,
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
},
+ "range": Array [
+ 4,
+ 21,
+ ],
+ "type": "VariableDeclarator",
},
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- },
+ ],
+ "kind": "let",
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 22,
"line": 1,
},
"start": Object {
@@ -68299,33 +76124,16 @@ Object {
},
"range": Array [
0,
- 17,
+ 22,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 17,
- ],
- "type": "TSSymbolKeyword",
- },
+ "type": "VariableDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 2,
+ "column": 22,
+ "line": 1,
},
"start": Object {
"column": 0,
@@ -68334,14 +76142,14 @@ Object {
},
"range": Array [
0,
- 18,
+ 22,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 3,
"line": 1,
},
"start": Object {
@@ -68351,96 +76159,134 @@ Object {
},
"range": Array [
0,
- 4,
+ 3,
],
- "type": "Identifier",
- "value": "type",
+ "type": "Keyword",
+ "value": "let",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 5,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 4,
"line": 1,
},
},
"range": Array [
+ 4,
5,
- 8,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 8,
"line": 1,
},
},
"range": Array [
+ 8,
9,
- 10,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 21,
+ ],
+ "type": "Identifier",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 11,
- 17,
+ 21,
+ 22,
],
- "type": "Identifier",
- "value": "symbol",
+ "type": "Punctuator",
+ "value": ";",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/typed-keyword-true.src 1`] = `
+exports[`typescript fixtures/declare/abstract-class.src 1`] = `
Object {
"body": Array [
Object {
+ "abstract": true,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 27,
+ 31,
+ ],
+ "type": "ClassBody",
+ },
+ "declare": true,
"id": Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 23,
"line": 1,
},
},
"name": "Foo",
"range": Array [
- 5,
- 8,
+ 23,
+ 26,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 15,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -68449,52 +76295,17 @@ Object {
},
"range": Array [
0,
- 15,
+ 31,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "literal": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 15,
- ],
- "raw": "true",
- "type": "Literal",
- "value": true,
- },
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 15,
- ],
- "type": "TSLiteralType",
- },
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 2,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -68503,14 +76314,14 @@ Object {
},
"range": Array [
0,
- 16,
+ 32,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -68520,96 +76331,151 @@ Object {
},
"range": Array [
0,
- 4,
+ 7,
],
"type": "Identifier",
- "value": "type",
+ "value": "declare",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 5,
8,
+ 16,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "abstract",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 17,
+ 22,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Keyword",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 11,
- 15,
+ 23,
+ 26,
],
- "type": "Boolean",
- "value": "true",
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 27,
+ 28,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 30,
+ 31,
+ ],
+ "type": "Punctuator",
+ "value": "}",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/typed-keyword-undefined.src 1`] = `
+exports[`typescript fixtures/declare/class.src 1`] = `
Object {
"body": Array [
Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 22,
+ ],
+ "type": "ClassBody",
+ },
+ "declare": true,
"id": Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 14,
"line": 1,
},
},
"name": "Foo",
"range": Array [
- 5,
- 8,
+ 14,
+ 17,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 20,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -68618,33 +76484,17 @@ Object {
},
"range": Array [
0,
- 20,
+ 22,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 20,
- ],
- "type": "TSUndefinedKeyword",
- },
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 2,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -68653,14 +76503,14 @@ Object {
},
"range": Array [
0,
- 21,
+ 23,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -68670,25 +76520,43 @@ Object {
},
"range": Array [
0,
- 4,
+ 7,
],
"type": "Identifier",
- "value": "type",
+ "value": "declare",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 5,
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",
@@ -68696,105 +76564,161 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 19,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 18,
+ 19,
],
"type": "Punctuator",
- "value": "=",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 11,
- 20,
+ 21,
+ 22,
],
- "type": "Identifier",
- "value": "undefined",
+ "type": "Punctuator",
+ "value": "}",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/typed-keyword-unknown.src 1`] = `
+exports[`typescript fixtures/declare/enum.src 1`] = `
Object {
"body": Array [
Object {
+ "declare": true,
"id": Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 13,
"line": 1,
},
},
"name": "Foo",
"range": Array [
- 5,
- 8,
+ 13,
+ 16,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 18,
- "line": 1,
+ "column": 1,
+ "line": 4,
},
"start": Object {
"column": 0,
"line": 1,
},
},
- "range": Array [
- 0,
- 18,
- ],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 1,
+ "members": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "name": "Bar",
+ "range": Array [
+ 23,
+ 26,
+ ],
+ "type": "Identifier",
},
- "start": Object {
- "column": 11,
- "line": 1,
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
},
+ "range": Array [
+ 23,
+ 26,
+ ],
+ "type": "TSEnumMember",
},
- "range": Array [
- 11,
- 18,
- ],
- "type": "TSUnknownKeyword",
- },
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "name": "Baz",
+ "range": Array [
+ 32,
+ 35,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 32,
+ 35,
+ ],
+ "type": "TSEnumMember",
+ },
+ ],
+ "range": Array [
+ 0,
+ 37,
+ ],
+ "type": "TSEnumDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 2,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -68803,14 +76727,14 @@ Object {
},
"range": Array [
0,
- 19,
+ 38,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -68820,46 +76744,46 @@ Object {
},
"range": Array [
0,
- 4,
+ 7,
],
"type": "Identifier",
- "value": "type",
+ "value": "declare",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 5,
8,
+ 12,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Keyword",
+ "value": "enum",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 13,
+ 16,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
@@ -68868,47 +76792,123 @@ Object {
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 11,
+ 17,
18,
],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 23,
+ 26,
+ ],
"type": "Identifier",
- "value": "unknown",
+ "value": "Bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 26,
+ 27,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 32,
+ 35,
+ ],
+ "type": "Identifier",
+ "value": "Baz",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 36,
+ 37,
+ ],
+ "type": "Punctuator",
+ "value": "}",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/typed-keyword-void.src 1`] = `
+exports[`typescript fixtures/declare/function.src 1`] = `
Object {
"body": Array [
Object {
+ "async": false,
+ "declare": true,
+ "expression": false,
+ "generator": false,
"id": Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 17,
"line": 1,
},
},
- "name": "Foo",
+ "name": "foo",
"range": Array [
- 5,
- 8,
+ 17,
+ 20,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 28,
"line": 1,
},
"start": Object {
@@ -68916,28 +76916,46 @@ Object {
"line": 1,
},
},
+ "params": Array [],
"range": Array [
0,
- 15,
+ 28,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 11,
- 15,
+ 22,
+ 28,
],
- "type": "TSVoidKeyword",
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 24,
+ 28,
+ ],
+ "type": "TSVoidKeyword",
+ },
},
+ "type": "TSDeclareFunction",
},
],
"comments": Array [],
@@ -68953,14 +76971,14 @@ Object {
},
"range": Array [
0,
- 16,
+ 29,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -68970,471 +76988,187 @@ Object {
},
"range": Array [
0,
- 4,
+ 7,
],
"type": "Identifier",
- "value": "type",
+ "value": "declare",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 5,
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",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 20,
+ 21,
],
"type": "Punctuator",
- "value": "=",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 11,
- 15,
+ 21,
+ 22,
],
- "type": "Keyword",
- "value": "void",
+ "type": "Punctuator",
+ "value": ")",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/typed-method-signature.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
},
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 22,
+ 23,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 28,
+ "line": 1,
},
"start": Object {
- "column": 0,
+ "column": 24,
"line": 1,
},
},
"range": Array [
- 0,
- 57,
+ 24,
+ 28,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
+ "type": "Keyword",
+ "value": "void",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/declare/interface.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 3,
},
"start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "members": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 2,
- },
- "start": Object {
- "column": 2,
- "line": 2,
- },
- },
- "name": "h",
- "range": Array [
- 15,
- 16,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 2,
- "line": 2,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "name": "bar",
- "range": Array [
- 17,
- 28,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 7,
- "line": 2,
- },
- },
- "range": Array [
- 20,
- 28,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "range": Array [
- 22,
- 28,
- ],
- "type": "TSStringKeyword",
- },
- },
- },
- ],
- "range": Array [
- 15,
- 36,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "range": Array [
- 29,
- 35,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 2,
- },
- "start": Object {
- "column": 18,
- "line": 2,
- },
- },
- "range": Array [
- 31,
- 35,
- ],
- "type": "TSVoidKeyword",
- },
- },
- "type": "TSMethodSignature",
- },
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 3,
- "line": 3,
- },
- "start": Object {
- "column": 2,
- "line": 3,
- },
- },
- "name": "g",
- "range": Array [
- 39,
- 40,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 3,
- },
- "start": Object {
- "column": 2,
- "line": 3,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 3,
- },
- "start": Object {
- "column": 7,
- "line": 3,
- },
- },
- "name": "bar",
- "range": Array [
- 44,
- 50,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 3,
- },
- "start": Object {
- "column": 10,
- "line": 3,
- },
- },
- "range": Array [
- 47,
- 50,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 3,
- },
- "start": Object {
- "column": 12,
- "line": 3,
- },
- },
- "range": Array [
- 49,
- 50,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 3,
- },
- "start": Object {
- "column": 12,
- "line": 3,
- },
- },
- "name": "T",
- "range": Array [
- 49,
- 50,
- ],
- "type": "Identifier",
- },
- },
- },
- },
- ],
- "range": Array [
- 39,
- 55,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 3,
- },
- "start": Object {
- "column": 14,
- "line": 3,
- },
- },
- "range": Array [
- 51,
- 54,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 3,
- },
- "start": Object {
- "column": 16,
- "line": 3,
- },
- },
- "range": Array [
- 53,
- 54,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 3,
- },
- "start": Object {
- "column": 16,
- "line": 3,
- },
- },
- "name": "T",
- "range": Array [
- 53,
- 54,
- ],
- "type": "Identifier",
- },
- },
- },
- "type": "TSMethodSignature",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 6,
- "line": 3,
- },
- "start": Object {
- "column": 3,
- "line": 3,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "name": "T",
- "range": Array [
- 41,
- 42,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 41,
- 42,
- ],
- "type": "TSTypeParameter",
- },
- ],
- "range": Array [
- 40,
- 43,
- ],
- "type": "TSTypeParameterDeclaration",
- },
+ "column": 22,
+ "line": 1,
},
+ },
+ "range": Array [
+ 22,
+ 26,
],
+ "type": "TSInterfaceBody",
+ },
+ "declare": true,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
"range": Array [
- 11,
- 57,
+ 18,
+ 21,
],
- "type": "TSTypeLiteral",
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
},
+ "range": Array [
+ 0,
+ 26,
+ ],
+ "type": "TSInterfaceDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 5,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -69443,14 +77177,14 @@ Object {
},
"range": Array [
0,
- 58,
+ 27,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -69460,61 +77194,61 @@ Object {
},
"range": Array [
0,
- 4,
+ 7,
],
"type": "Identifier",
- "value": "type",
+ "value": "declare",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 5,
8,
+ 17,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Keyword",
+ "value": "interface",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 18,
+ 21,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 11,
- 12,
+ 22,
+ 23,
],
"type": "Punctuator",
"value": "{",
@@ -69522,405 +77256,761 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 2,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 2,
- "line": 2,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 15,
- 16,
+ 25,
+ 26,
],
- "type": "Identifier",
- "value": "h",
+ "type": "Punctuator",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/declare/module.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 19,
+ 23,
+ ],
+ "type": "TSModuleBlock",
+ },
+ "declare": true,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 15,
+ 18,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 4,
- "line": 2,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 3,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 16,
- 17,
+ 0,
+ 23,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "TSModuleDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 24,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
"column": 7,
- "line": 2,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 17,
- 20,
+ 0,
+ 7,
],
"type": "Identifier",
- "value": "bar",
+ "value": "declare",
},
Object {
"loc": Object {
"end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
"column": 8,
- "line": 2,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 8,
+ 14,
+ ],
+ "type": "Identifier",
+ "value": "module",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 7,
- "line": 2,
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 18,
+ ],
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
},
},
"range": Array [
+ 19,
20,
- 21,
],
"type": "Punctuator",
- "value": ":",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 2,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 2,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
22,
- 28,
+ 23,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/declare/namespace.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 26,
+ ],
+ "type": "TSModuleBlock",
+ },
+ "declare": true,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 18,
+ 21,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 26,
+ ],
+ "type": "TSModuleDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 27,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 2,
+ "column": 7,
+ "line": 1,
},
"start": Object {
- "column": 15,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 28,
- 29,
+ 0,
+ 7,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "declare",
},
Object {
"loc": Object {
"end": Object {
"column": 17,
- "line": 2,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 2,
+ "column": 8,
+ "line": 1,
},
},
"range": Array [
- 29,
- 30,
+ 8,
+ 17,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "namespace",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 2,
+ "column": 21,
+ "line": 1,
},
"start": Object {
"column": 18,
- "line": 2,
+ "line": 1,
},
},
"range": Array [
- 31,
- 35,
+ 18,
+ 21,
],
- "type": "Keyword",
- "value": "void",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
"column": 23,
- "line": 2,
+ "line": 1,
},
"start": Object {
"column": 22,
- "line": 2,
+ "line": 1,
},
},
"range": Array [
- 35,
- 36,
+ 22,
+ 23,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 3,
+ "column": 1,
"line": 3,
},
"start": Object {
- "column": 2,
+ "column": 0,
"line": 3,
},
},
"range": Array [
- 39,
- 40,
+ 25,
+ 26,
],
- "type": "Identifier",
- "value": "g",
+ "type": "Punctuator",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/declare/type-alias.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "declare": true,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 13,
+ 16,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 4,
- "line": 3,
+ "column": 25,
+ "line": 1,
},
"start": Object {
- "column": 3,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 40,
- 41,
+ 0,
+ 25,
],
- "type": "Punctuator",
- "value": "<",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 19,
+ 25,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 26,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 3,
+ "column": 7,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 41,
- 42,
+ 0,
+ 7,
],
"type": "Identifier",
- "value": "T",
+ "value": "declare",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
- "line": 3,
+ "column": 12,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 3,
+ "column": 8,
+ "line": 1,
},
},
"range": Array [
- 42,
- 43,
+ 8,
+ 12,
+ ],
+ "type": "Identifier",
+ "value": "type",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 16,
],
- "type": "Punctuator",
- "value": ">",
+ "type": "Identifier",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 6,
- "line": 3,
+ "column": 17,
+ "line": 1,
},
},
"range": Array [
- 43,
- 44,
+ 17,
+ 18,
],
"type": "Punctuator",
- "value": "(",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 3,
+ "column": 25,
+ "line": 1,
},
"start": Object {
- "column": 7,
- "line": 3,
+ "column": 19,
+ "line": 1,
},
},
"range": Array [
- 44,
- 47,
+ 19,
+ 25,
],
"type": "Identifier",
- "value": "bar",
+ "value": "string",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/declare/variable.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 12,
+ 20,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 20,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 17,
+ 20,
+ ],
+ "type": "TSAnyKeyword",
+ },
+ },
+ },
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 12,
+ 20,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "declare": true,
+ "kind": "var",
"loc": Object {
"end": Object {
- "column": 11,
- "line": 3,
+ "column": 21,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 47,
- 48,
+ 0,
+ 21,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "VariableDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 22,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 3,
+ "column": 7,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 49,
- 50,
+ 0,
+ 7,
],
"type": "Identifier",
- "value": "T",
+ "value": "declare",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 3,
+ "column": 11,
+ "line": 1,
},
"start": Object {
- "column": 13,
- "line": 3,
+ "column": 8,
+ "line": 1,
},
},
"range": Array [
- 50,
- 51,
+ 8,
+ 11,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Keyword",
+ "value": "var",
},
Object {
"loc": Object {
"end": Object {
"column": 15,
- "line": 3,
+ "line": 1,
},
"start": Object {
- "column": 14,
- "line": 3,
+ "column": 12,
+ "line": 1,
},
},
"range": Array [
- 51,
- 52,
+ 12,
+ 15,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 3,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 3,
+ "column": 15,
+ "line": 1,
},
},
"range": Array [
- 53,
- 54,
+ 15,
+ 16,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 3,
+ "column": 20,
+ "line": 1,
},
"start": Object {
"column": 17,
- "line": 3,
+ "line": 1,
},
},
"range": Array [
- 54,
- 55,
+ 17,
+ 20,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "any",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 21,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 4,
+ "column": 20,
+ "line": 1,
},
},
"range": Array [
- 56,
- 57,
+ 20,
+ 21,
],
"type": "Punctuator",
- "value": "}",
+ "value": ";",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/typed-this.src 1`] = `
+exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src 1`] = `
Object {
"body": Array [
Object {
@@ -69928,325 +78018,267 @@ Object {
"body": Array [
Object {
"computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 32,
+ 37,
+ ],
+ "raw": "false",
+ "type": "Literal",
+ "value": false,
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "name": "configurable",
+ "range": Array [
+ 19,
+ 31,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 19,
+ 38,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 18,
+ 38,
+ ],
+ "type": "Decorator",
+ },
+ ],
"key": Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 2,
+ "column": 9,
+ "line": 3,
},
"start": Object {
- "column": 1,
- "line": 2,
+ "column": 8,
+ "line": 3,
},
},
- "name": "addClickListener",
+ "name": "x",
"range": Array [
- 23,
- 39,
+ 47,
+ 48,
],
"type": "Identifier",
},
+ "kind": "get",
"loc": Object {
"end": Object {
- "column": 65,
- "line": 2,
+ "column": 31,
+ "line": 3,
},
"start": Object {
- "column": 1,
- "line": 2,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 57,
- "line": 2,
- },
- "start": Object {
- "column": 18,
- "line": 2,
- },
- },
- "name": "onclick",
- "range": Array [
- 40,
- 79,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 57,
- "line": 2,
- },
- "start": Object {
- "column": 25,
- "line": 2,
- },
- },
- "range": Array [
- 47,
- 79,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 57,
- "line": 2,
- },
- "start": Object {
- "column": 27,
- "line": 2,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 2,
- },
- "start": Object {
- "column": 28,
- "line": 2,
- },
- },
- "name": "this",
- "range": Array [
- 50,
- 60,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 2,
- },
- "start": Object {
- "column": 32,
- "line": 2,
- },
- },
- "range": Array [
- 54,
- 60,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 2,
- },
- "start": Object {
- "column": 34,
- "line": 2,
- },
- },
- "range": Array [
- 56,
- 60,
- ],
- "type": "TSVoidKeyword",
- },
- },
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 2,
- },
- "start": Object {
- "column": 40,
- "line": 2,
- },
- },
- "name": "e",
- "range": Array [
- 62,
- 70,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 2,
- },
- "start": Object {
- "column": 41,
- "line": 2,
- },
- },
- "range": Array [
- 63,
- 70,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 2,
- },
- "start": Object {
- "column": 43,
- "line": 2,
- },
- },
- "range": Array [
- 65,
- 70,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 2,
- },
- "start": Object {
- "column": 43,
- "line": 2,
- },
- },
- "name": "Event",
- "range": Array [
- 65,
- 70,
- ],
- "type": "Identifier",
- },
- },
- },
- },
- ],
- "range": Array [
- 49,
- 79,
- ],
- "returnType": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 18,
+ 70,
+ ],
+ "static": false,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
+ "computed": false,
"loc": Object {
"end": Object {
- "column": 57,
- "line": 2,
+ "column": 28,
+ "line": 3,
},
"start": Object {
- "column": 50,
- "line": 2,
+ "column": 21,
+ "line": 3,
},
},
- "range": Array [
- 72,
- 79,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "object": Object {
"loc": Object {
"end": Object {
- "column": 57,
- "line": 2,
+ "column": 25,
+ "line": 3,
},
"start": Object {
- "column": 53,
- "line": 2,
+ "column": 21,
+ "line": 3,
},
},
"range": Array [
- 75,
- 79,
+ 60,
+ 64,
],
- "type": "TSVoidKeyword",
+ "type": "ThisExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 3,
+ },
+ },
+ "name": "_x",
+ "range": Array [
+ 65,
+ 67,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 60,
+ 67,
+ ],
+ "type": "MemberExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 3,
},
},
- "type": "TSFunctionType",
+ "range": Array [
+ 53,
+ 68,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 3,
},
},
+ "range": Array [
+ 51,
+ 70,
+ ],
+ "type": "BlockStatement",
},
- ],
- "range": Array [
- 23,
- 87,
- ],
- "returnType": Object {
+ "expression": false,
+ "generator": false,
+ "id": null,
"loc": Object {
"end": Object {
- "column": 64,
- "line": 2,
+ "column": 31,
+ "line": 3,
},
"start": Object {
- "column": 58,
- "line": 2,
+ "column": 9,
+ "line": 3,
},
},
+ "params": Array [],
"range": Array [
- 80,
- 86,
+ 48,
+ 70,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 64,
- "line": 2,
- },
- "start": Object {
- "column": 60,
- "line": 2,
- },
- },
- "range": Array [
- 82,
- 86,
- ],
- "type": "TSVoidKeyword",
- },
+ "type": "FunctionExpression",
},
- "type": "TSMethodSignature",
},
],
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 4,
},
"start": Object {
- "column": 20,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 20,
- 89,
+ 12,
+ 72,
],
- "type": "TSInterfaceBody",
+ "type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 6,
"line": 1,
},
},
- "name": "UIElement",
+ "name": "Point",
"range": Array [
- 10,
- 19,
+ 6,
+ 11,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -70255,15 +78287,16 @@ Object {
},
"range": Array [
0,
- 89,
+ 72,
],
- "type": "TSInterfaceDeclaration",
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
+ "column": 1,
"line": 4,
},
"start": Object {
@@ -70273,14 +78306,14 @@ Object {
},
"range": Array [
0,
- 90,
+ 72,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 5,
"line": 1,
},
"start": Object {
@@ -70290,43 +78323,43 @@ Object {
},
"range": Array [
0,
- 9,
+ 5,
],
"type": "Keyword",
- "value": "interface",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 10,
- 19,
+ 6,
+ 11,
],
"type": "Identifier",
- "value": "UIElement",
+ "value": "Point",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 20,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 20,
- 21,
+ 12,
+ 13,
],
"type": "Punctuator",
"value": "{",
@@ -70334,89 +78367,53 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 1,
- "line": 2,
- },
- },
- "range": Array [
- 23,
- 39,
- ],
- "type": "Identifier",
- "value": "addClickListener",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
+ "column": 5,
"line": 2,
},
"start": Object {
- "column": 17,
+ "column": 4,
"line": 2,
},
},
"range": Array [
- 39,
- 40,
+ 18,
+ 19,
],
"type": "Punctuator",
- "value": "(",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 17,
"line": 2,
},
"start": Object {
- "column": 18,
+ "column": 5,
"line": 2,
},
},
"range": Array [
- 40,
- 47,
+ 19,
+ 31,
],
"type": "Identifier",
- "value": "onclick",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 2,
- },
- "start": Object {
- "column": 25,
- "line": 2,
- },
- },
- "range": Array [
- 47,
- 48,
- ],
- "type": "Punctuator",
- "value": ":",
+ "value": "configurable",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 18,
"line": 2,
},
"start": Object {
- "column": 27,
+ "column": 17,
"line": 2,
},
},
"range": Array [
- 49,
- 50,
+ 31,
+ 32,
],
"type": "Punctuator",
"value": "(",
@@ -70424,969 +78421,605 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 32,
- "line": 2,
- },
- "start": Object {
- "column": 28,
- "line": 2,
- },
- },
- "range": Array [
- 50,
- 54,
- ],
- "type": "Keyword",
- "value": "this",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 2,
- },
- "start": Object {
- "column": 32,
- "line": 2,
- },
- },
- "range": Array [
- 54,
- 55,
- ],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 2,
- },
- "start": Object {
- "column": 34,
- "line": 2,
- },
- },
- "range": Array [
- 56,
- 60,
- ],
- "type": "Keyword",
- "value": "void",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 39,
- "line": 2,
- },
- "start": Object {
- "column": 38,
- "line": 2,
- },
- },
- "range": Array [
- 60,
- 61,
- ],
- "type": "Punctuator",
- "value": ",",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 41,
- "line": 2,
- },
- "start": Object {
- "column": 40,
- "line": 2,
- },
- },
- "range": Array [
- 62,
- 63,
- ],
- "type": "Identifier",
- "value": "e",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 42,
- "line": 2,
- },
- "start": Object {
- "column": 41,
- "line": 2,
- },
- },
- "range": Array [
- 63,
- 64,
- ],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 2,
- },
- "start": Object {
- "column": 43,
- "line": 2,
- },
- },
- "range": Array [
- 65,
- 70,
- ],
- "type": "Identifier",
- "value": "Event",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 49,
- "line": 2,
- },
- "start": Object {
- "column": 48,
- "line": 2,
- },
- },
- "range": Array [
- 70,
- 71,
- ],
- "type": "Punctuator",
- "value": ")",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 52,
- "line": 2,
- },
- "start": Object {
- "column": 50,
- "line": 2,
- },
- },
- "range": Array [
- 72,
- 74,
- ],
- "type": "Punctuator",
- "value": "=>",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 57,
- "line": 2,
- },
- "start": Object {
- "column": 53,
- "line": 2,
- },
- },
- "range": Array [
- 75,
- 79,
- ],
- "type": "Keyword",
- "value": "void",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 58,
- "line": 2,
- },
- "start": Object {
- "column": 57,
- "line": 2,
- },
- },
- "range": Array [
- 79,
- 80,
- ],
- "type": "Punctuator",
- "value": ")",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 59,
- "line": 2,
- },
- "start": Object {
- "column": 58,
- "line": 2,
- },
- },
- "range": Array [
- 80,
- 81,
- ],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 64,
- "line": 2,
- },
- "start": Object {
- "column": 60,
- "line": 2,
- },
- },
- "range": Array [
- 82,
- 86,
- ],
- "type": "Keyword",
- "value": "void",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 65,
- "line": 2,
- },
- "start": Object {
- "column": 64,
- "line": 2,
- },
- },
- "range": Array [
- 86,
- 87,
- ],
- "type": "Punctuator",
- "value": ";",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 18,
+ "line": 2,
},
},
"range": Array [
- 88,
- 89,
+ 32,
+ 37,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Boolean",
+ "value": "false",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/unique-symbol.src 1`] = `
-Object {
- "body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 6,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "name": "A",
- "range": Array [
- 5,
- 6,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 23,
- "line": 1,
+ "column": 24,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 23,
+ "line": 2,
},
},
"range": Array [
- 0,
- 23,
+ 37,
+ 38,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "operator": "unique",
- "range": Array [
- 9,
- 22,
- ],
- "type": "TSTypeOperator",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 1,
- },
- "start": Object {
- "column": 16,
- "line": 1,
- },
- },
- "range": Array [
- 16,
- 22,
- ],
- "type": "TSSymbolKeyword",
- },
- },
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": ")",
},
- },
- "range": Array [
- 0,
- 24,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
- "line": 1,
+ "column": 7,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 0,
- 4,
+ 43,
+ 46,
],
"type": "Identifier",
- "value": "type",
+ "value": "get",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
- "line": 1,
+ "column": 9,
+ "line": 3,
},
"start": Object {
- "column": 5,
- "line": 1,
+ "column": 8,
+ "line": 3,
},
},
"range": Array [
- 5,
- 6,
+ 47,
+ 48,
],
"type": "Identifier",
- "value": "A",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 1,
+ "column": 10,
+ "line": 3,
},
"start": Object {
- "column": 7,
- "line": 1,
+ "column": 9,
+ "line": 3,
},
},
"range": Array [
- 7,
- 8,
+ 48,
+ 49,
],
"type": "Punctuator",
- "value": "=",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 1,
+ "column": 11,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 10,
+ "line": 3,
},
},
"range": Array [
- 9,
- 15,
+ 49,
+ 50,
],
- "type": "Identifier",
- "value": "unique",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 16,
- "line": 1,
+ "column": 12,
+ "line": 3,
},
},
"range": Array [
- 16,
- 22,
+ 51,
+ 52,
],
- "type": "Identifier",
- "value": "symbol",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 1,
+ "column": 20,
+ "line": 3,
},
"start": Object {
- "column": 22,
- "line": 1,
+ "column": 14,
+ "line": 3,
},
},
"range": Array [
- 22,
- 23,
+ 53,
+ 59,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Keyword",
+ "value": "return",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/unknown-type-annotation.src 1`] = `
-Object {
- "body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "name": "foo",
- "range": Array [
- 4,
- 16,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
- },
- "range": Array [
- 7,
- 16,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "range": Array [
- 9,
- 16,
- ],
- "type": "TSUnknownKeyword",
- },
- },
- },
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "range": Array [
- 4,
- 16,
- ],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "let",
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 25,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 21,
+ "line": 3,
},
},
"range": Array [
- 0,
- 17,
+ 60,
+ 64,
],
- "type": "VariableDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Keyword",
+ "value": "this",
},
- },
- "range": Array [
- 0,
- 18,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 1,
+ "column": 26,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 25,
+ "line": 3,
},
},
"range": Array [
- 0,
- 3,
+ 64,
+ 65,
],
- "type": "Keyword",
- "value": "let",
+ "type": "Punctuator",
+ "value": ".",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 28,
+ "line": 3,
},
"start": Object {
- "column": 4,
- "line": 1,
+ "column": 26,
+ "line": 3,
},
},
"range": Array [
- 4,
- 7,
+ 65,
+ 67,
],
"type": "Identifier",
- "value": "foo",
+ "value": "_x",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 1,
+ "column": 29,
+ "line": 3,
},
"start": Object {
- "column": 7,
- "line": 1,
+ "column": 28,
+ "line": 3,
},
},
"range": Array [
- 7,
- 8,
+ 67,
+ 68,
],
"type": "Punctuator",
- "value": ":",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 31,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 30,
+ "line": 3,
},
},
"range": Array [
- 9,
- 16,
+ 69,
+ 70,
],
- "type": "Identifier",
- "value": "unknown",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 1,
+ "line": 4,
},
"start": Object {
- "column": 16,
- "line": 1,
+ "column": 0,
+ "line": 4,
},
},
"range": Array [
- 16,
- 17,
+ 71,
+ 72,
],
"type": "Punctuator",
- "value": ";",
+ "value": "}",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/var-with-definite-assignment.src 1`] = `
+exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = `
Object {
"body": Array [
Object {
- "declarations": Array [
- Object {
- "definite": true,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
- },
- "name": "x",
- "range": Array [
- 6,
- 16,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 8,
- "line": 1,
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "properties": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 25,
+ 28,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "init",
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "method": false,
+ "range": Array [
+ 25,
+ 34,
+ ],
+ "shorthand": false,
+ "type": "Property",
+ "value": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 30,
+ 34,
+ ],
+ "raw": "true",
+ "type": "Literal",
+ "value": true,
+ },
+ },
+ ],
+ "range": Array [
+ 23,
+ 36,
+ ],
+ "type": "ObjectExpression",
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 19,
+ 22,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 19,
+ 37,
+ ],
+ "type": "CallExpression",
},
- },
- "range": Array [
- 8,
- 16,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 10,
- 16,
+ 18,
+ 37,
],
- "type": "TSStringKeyword",
- },
- },
- },
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
- },
- "range": Array [
- 6,
- 16,
- ],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "const",
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 17,
- ],
- "type": "VariableDeclaration",
- },
- Object {
- "declarations": Array [
- Object {
- "definite": true,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
+ "type": "Decorator",
},
- },
- "name": "y",
- "range": Array [
- 22,
- 32,
],
- "type": "Identifier",
- "typeAnnotation": Object {
+ "key": Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 2,
+ "column": 18,
+ "line": 3,
},
"start": Object {
- "column": 6,
- "line": 2,
+ "column": 15,
+ "line": 3,
},
},
+ "name": "bar",
"range": Array [
- 24,
- 32,
+ 53,
+ 56,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 8,
- "line": 2,
- },
- },
- "range": Array [
- 26,
- 32,
- ],
- "type": "TSNumberKeyword",
- },
- },
- },
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
+ "type": "Identifier",
},
- },
- "range": Array [
- 22,
- 32,
- ],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "var",
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 2,
- },
- },
- "range": Array [
- 18,
- 33,
- ],
- "type": "VariableDeclaration",
- },
- Object {
- "declarations": Array [
- Object {
- "definite": true,
- "id": Object {
+ "kind": "get",
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 42,
"line": 3,
},
"start": Object {
"column": 4,
- "line": 3,
+ "line": 2,
},
},
- "name": "z",
"range": Array [
- 38,
- 48,
+ 18,
+ 80,
],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 3,
- },
- "start": Object {
- "column": 6,
- "line": 3,
- },
- },
- "range": Array [
- 40,
- 48,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "static": true,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
+ "computed": false,
+ "loc": Object {
+ "end": Object {
+ "column": 39,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 3,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 68,
+ 72,
+ ],
+ "type": "ThisExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 39,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 3,
+ },
+ },
+ "name": "_bar",
+ "range": Array [
+ 73,
+ 77,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 68,
+ 77,
+ ],
+ "type": "MemberExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 40,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 61,
+ 78,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 42,
"line": 3,
},
"start": Object {
- "column": 8,
+ "column": 21,
"line": 3,
},
},
"range": Array [
- 42,
- 48,
+ 59,
+ 80,
],
- "type": "TSObjectKeyword",
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 3,
+ },
},
+ "params": Array [],
+ "range": Array [
+ 56,
+ 80,
+ ],
+ "type": "FunctionExpression",
},
},
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
},
- "range": Array [
- 38,
- 48,
- ],
- "type": "VariableDeclarator",
},
- ],
- "kind": "let",
+ "range": Array [
+ 12,
+ 82,
+ ],
+ "type": "ClassBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "Other",
+ "range": Array [
+ 6,
+ 11,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 15,
- "line": 3,
+ "column": 1,
+ "line": 4,
},
"start": Object {
"column": 0,
- "line": 3,
+ "line": 1,
},
},
"range": Array [
- 34,
- 49,
+ 0,
+ 82,
],
- "type": "VariableDeclaration",
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
+ "column": 1,
"line": 4,
},
"start": Object {
@@ -71396,7 +79029,7 @@ Object {
},
"range": Array [
0,
- 50,
+ 82,
],
"sourceType": "module",
"tokens": Array [
@@ -71416,12 +79049,12 @@ Object {
5,
],
"type": "Keyword",
- "value": "const",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 11,
"line": 1,
},
"start": Object {
@@ -71431,154 +79064,100 @@ Object {
},
"range": Array [
6,
- 7,
- ],
- "type": "Identifier",
- "value": "x",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
- },
- "range": Array [
- 7,
- 8,
- ],
- "type": "Punctuator",
- "value": "!",
- },
- 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": 16,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "range": Array [
- 10,
- 16,
+ 11,
],
"type": "Identifier",
- "value": "string",
+ "value": "Other",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 16,
- 17,
+ 12,
+ 13,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 3,
+ "column": 5,
"line": 2,
},
"start": Object {
- "column": 0,
+ "column": 4,
"line": 2,
},
},
"range": Array [
18,
- 21,
+ 19,
],
- "type": "Keyword",
- "value": "var",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 8,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 5,
"line": 2,
},
},
"range": Array [
+ 19,
22,
- 23,
],
"type": "Identifier",
- "value": "y",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 9,
"line": 2,
},
"start": Object {
- "column": 5,
+ "column": 8,
"line": 2,
},
},
"range": Array [
+ 22,
23,
- 24,
],
"type": "Punctuator",
- "value": "!",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 10,
"line": 2,
},
"start": Object {
- "column": 6,
+ "column": 9,
"line": 2,
},
},
"range": Array [
+ 23,
24,
- 25,
],
"type": "Punctuator",
- "value": ":",
+ "value": "{",
},
Object {
"loc": Object {
@@ -71587,115 +79166,97 @@ Object {
"line": 2,
},
"start": Object {
- "column": 8,
+ "column": 11,
"line": 2,
},
},
"range": Array [
- 26,
- 32,
+ 25,
+ 28,
],
"type": "Identifier",
- "value": "number",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 14,
- "line": 2,
- },
- },
- "range": Array [
- 32,
- 33,
- ],
- "type": "Punctuator",
- "value": ";",
+ "value": "baz",
},
Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 3,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 14,
+ "line": 2,
},
},
"range": Array [
- 34,
- 37,
+ 28,
+ 29,
],
- "type": "Keyword",
- "value": "let",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 3,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 16,
+ "line": 2,
},
},
"range": Array [
- 38,
- 39,
+ 30,
+ 34,
],
- "type": "Identifier",
- "value": "z",
+ "type": "Boolean",
+ "value": "true",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
- "line": 3,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 5,
- "line": 3,
+ "column": 21,
+ "line": 2,
},
},
"range": Array [
- 39,
- 40,
+ 35,
+ 36,
],
"type": "Punctuator",
- "value": "!",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 3,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 6,
- "line": 3,
+ "column": 22,
+ "line": 2,
},
},
"range": Array [
- 40,
- 41,
+ 36,
+ 37,
],
"type": "Punctuator",
- "value": ":",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 10,
"line": 3,
},
"start": Object {
- "column": 8,
+ "column": 4,
"line": 3,
},
},
@@ -71703,353 +79264,149 @@ Object {
42,
48,
],
- "type": "Identifier",
- "value": "object",
+ "type": "Keyword",
+ "value": "static",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 14,
"line": 3,
},
"start": Object {
- "column": 14,
+ "column": 11,
"line": 3,
},
},
"range": Array [
- 48,
49,
+ 52,
],
- "type": "Punctuator",
- "value": ";",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = `
-Object {
- "body": Array [
- Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "name": "foo",
- "range": Array [
- 4,
- 14,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
- },
- "range": Array [
- 7,
- 14,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "range": Array [
- 9,
- 14,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "left": Object {
- "left": Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "name": "A",
- "range": Array [
- 9,
- 10,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "range": Array [
- 9,
- 12,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "name": "B",
- "range": Array [
- 11,
- 12,
- ],
- "type": "Identifier",
- },
- "type": "TSQualifiedName",
- },
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "range": Array [
- 9,
- 14,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 13,
- "line": 1,
- },
- },
- "name": "C",
- "range": Array [
- 13,
- 14,
- ],
- "type": "Identifier",
- },
- "type": "TSQualifiedName",
- },
- },
- },
- },
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "range": Array [
- 4,
- 14,
- ],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "var",
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 15,
- ],
- "type": "VariableDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Identifier",
+ "value": "get",
},
- },
- "range": Array [
- 0,
- 16,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 1,
+ "column": 18,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 15,
+ "line": 3,
},
},
"range": Array [
- 0,
- 3,
+ 53,
+ 56,
],
- "type": "Keyword",
- "value": "var",
+ "type": "Identifier",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 19,
+ "line": 3,
},
"start": Object {
- "column": 4,
- "line": 1,
+ "column": 18,
+ "line": 3,
},
},
"range": Array [
- 4,
- 7,
+ 56,
+ 57,
],
- "type": "Identifier",
- "value": "foo",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 1,
+ "column": 20,
+ "line": 3,
},
"start": Object {
- "column": 7,
- "line": 1,
+ "column": 19,
+ "line": 3,
},
},
"range": Array [
- 7,
- 8,
+ 57,
+ 58,
],
"type": "Punctuator",
- "value": ":",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 1,
+ "column": 22,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 21,
+ "line": 3,
},
},
"range": Array [
- 9,
- 10,
+ 59,
+ 60,
],
- "type": "Identifier",
- "value": "A",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 1,
+ "column": 29,
+ "line": 3,
},
"start": Object {
- "column": 10,
- "line": 1,
+ "column": 23,
+ "line": 3,
},
},
"range": Array [
- 10,
- 11,
+ 61,
+ 67,
],
- "type": "Punctuator",
- "value": ".",
+ "type": "Keyword",
+ "value": "return",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 1,
+ "column": 34,
+ "line": 3,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 30,
+ "line": 3,
},
},
"range": Array [
- 11,
- 12,
+ 68,
+ 72,
],
- "type": "Identifier",
- "value": "B",
+ "type": "Keyword",
+ "value": "this",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 1,
+ "column": 35,
+ "line": 3,
},
"start": Object {
- "column": 12,
- "line": 1,
+ "column": 34,
+ "line": 3,
},
},
"range": Array [
- 12,
- 13,
+ 72,
+ 73,
],
"type": "Punctuator",
"value": ".",
@@ -72057,269 +79414,330 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 1,
+ "column": 39,
+ "line": 3,
},
"start": Object {
- "column": 13,
- "line": 1,
+ "column": 35,
+ "line": 3,
},
},
"range": Array [
- 13,
- 14,
+ 73,
+ 77,
],
"type": "Identifier",
- "value": "C",
+ "value": "_bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 1,
+ "column": 40,
+ "line": 3,
},
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 39,
+ "line": 3,
},
},
"range": Array [
- 14,
- 15,
+ 77,
+ 78,
],
"type": "Punctuator",
"value": ";",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/basics/var-with-type.src 1`] = `
-Object {
- "body": Array [
- Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "name": "name",
- "range": Array [
- 4,
- 15,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 8,
- "line": 1,
- },
- },
- "range": Array [
- 8,
- 15,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "range": Array [
- 9,
- 15,
- ],
- "type": "TSStringKeyword",
- },
- },
- },
- "init": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
- },
- "range": Array [
- 18,
- 28,
- ],
- "raw": "\\"Nicholas\\"",
- "type": "Literal",
- "value": "Nicholas",
- },
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "range": Array [
- 4,
- 28,
- ],
- "type": "VariableDeclarator",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 3,
},
+ },
+ "range": Array [
+ 79,
+ 80,
],
- "kind": "var",
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 1,
+ "column": 1,
+ "line": 4,
},
"start": Object {
"column": 0,
- "line": 1,
+ "line": 4,
},
},
"range": Array [
- 0,
- 29,
+ 81,
+ 82,
],
- "type": "VariableDeclaration",
+ "type": "Punctuator",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = `
+Object {
+ "body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "name": "foo",
- "range": Array [
- 34,
- 45,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 7,
- "line": 2,
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "name": "hidden",
+ "range": Array [
+ 15,
+ 21,
+ ],
+ "type": "Identifier",
},
- },
- "range": Array [
- 37,
- 45,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 11,
"line": 2,
},
"start": Object {
- "column": 9,
+ "column": 4,
"line": 2,
},
},
"range": Array [
- 39,
- 45,
+ 14,
+ 21,
],
- "type": "TSStringKeyword",
+ "type": "Decorator",
+ },
+ ],
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 3,
+ },
},
+ "name": "z",
+ "range": Array [
+ 30,
+ 31,
+ ],
+ "type": "Identifier",
},
- },
- "init": Object {
+ "kind": "get",
"loc": Object {
"end": Object {
- "column": 23,
- "line": 2,
+ "column": 31,
+ "line": 3,
},
"start": Object {
- "column": 18,
+ "column": 4,
"line": 2,
},
},
"range": Array [
- 48,
+ 14,
53,
],
- "raw": "\\"Bar\\"",
- "type": "Literal",
- "value": "Bar",
- },
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
+ "static": false,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "argument": Object {
+ "computed": false,
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 3,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 43,
+ 47,
+ ],
+ "type": "ThisExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 3,
+ },
+ },
+ "name": "_z",
+ "range": Array [
+ 48,
+ 50,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 43,
+ 50,
+ ],
+ "type": "MemberExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 36,
+ 51,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 34,
+ 53,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 3,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 31,
+ 53,
+ ],
+ "type": "FunctionExpression",
},
},
- "range": Array [
- 34,
- 53,
- ],
- "type": "VariableDeclarator",
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 1,
+ },
},
- ],
- "kind": "var",
+ "range": Array [
+ 8,
+ 55,
+ ],
+ "type": "ClassBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "P",
+ "range": Array [
+ 6,
+ 7,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 24,
- "line": 2,
+ "column": 1,
+ "line": 4,
},
"start": Object {
"column": 0,
- "line": 2,
+ "line": 1,
},
},
"range": Array [
- 30,
- 54,
+ 0,
+ 55,
],
- "type": "VariableDeclaration",
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 3,
+ "column": 1,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -72335,7 +79753,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 3,
+ "column": 5,
"line": 1,
},
"start": Object {
@@ -72345,28 +79763,28 @@ Object {
},
"range": Array [
0,
- 3,
+ 5,
],
"type": "Keyword",
- "value": "var",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 7,
"line": 1,
},
"start": Object {
- "column": 4,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 4,
- 8,
+ 6,
+ 7,
],
"type": "Identifier",
- "value": "name",
+ "value": "P",
},
Object {
"loc": Object {
@@ -72384,292 +79802,551 @@ Object {
9,
],
"type": "Punctuator",
- "value": ":",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Punctuator",
+ "value": "@",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
},
},
"range": Array [
- 9,
15,
+ 21,
],
"type": "Identifier",
- "value": "string",
+ "value": "hidden",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 7,
+ "line": 3,
},
"start": Object {
- "column": 16,
- "line": 1,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 16,
- 17,
+ 26,
+ 29,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Identifier",
+ "value": "get",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 1,
+ "column": 9,
+ "line": 3,
},
"start": Object {
- "column": 18,
- "line": 1,
+ "column": 8,
+ "line": 3,
},
},
"range": Array [
- 18,
- 28,
+ 30,
+ 31,
],
- "type": "String",
- "value": "\\"Nicholas\\"",
+ "type": "Identifier",
+ "value": "z",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 1,
+ "column": 10,
+ "line": 3,
},
"start": Object {
- "column": 28,
- "line": 1,
+ "column": 9,
+ "line": 3,
},
},
"range": Array [
- 28,
- 29,
+ 31,
+ 32,
],
"type": "Punctuator",
- "value": ";",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 2,
+ "column": 11,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 2,
+ "column": 10,
+ "line": 3,
},
},
"range": Array [
- 30,
+ 32,
33,
],
- "type": "Keyword",
- "value": "var",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 2,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 12,
+ "line": 3,
},
},
"range": Array [
34,
- 37,
+ 35,
],
- "type": "Identifier",
- "value": "foo",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 2,
+ "column": 20,
+ "line": 3,
},
"start": Object {
- "column": 7,
- "line": 2,
+ "column": 14,
+ "line": 3,
},
},
"range": Array [
- 37,
- 38,
+ 36,
+ 42,
+ ],
+ "type": "Keyword",
+ "value": "return",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 43,
+ 47,
+ ],
+ "type": "Keyword",
+ "value": "this",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 47,
+ 48,
],
"type": "Punctuator",
- "value": ":",
+ "value": ".",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 2,
+ "column": 28,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 2,
+ "column": 26,
+ "line": 3,
},
},
"range": Array [
- 39,
- 45,
+ 48,
+ 50,
],
"type": "Identifier",
- "value": "string",
+ "value": "_z",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 2,
+ "column": 29,
+ "line": 3,
},
- "start": Object {
- "column": 16,
- "line": 2,
+ "start": Object {
+ "column": 28,
+ "line": 3,
},
},
"range": Array [
- 46,
- 47,
+ 50,
+ 51,
],
"type": "Punctuator",
- "value": "=",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 2,
+ "column": 31,
+ "line": 3,
},
"start": Object {
- "column": 18,
- "line": 2,
+ "column": 30,
+ "line": 3,
},
},
"range": Array [
- 48,
+ 52,
53,
],
- "type": "String",
- "value": "\\"Bar\\"",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 2,
+ "column": 1,
+ "line": 4,
},
"start": Object {
- "column": 23,
- "line": 2,
+ "column": 0,
+ "line": 4,
},
},
"range": Array [
- 53,
54,
+ 55,
],
"type": "Punctuator",
- "value": ";",
+ "value": "}",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/basics/variable-declaration-type-annotation-spacing.src 1`] = `
+exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = `
Object {
"body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "name": "adminonly",
+ "range": Array [
+ 18,
+ 27,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 17,
+ 27,
+ ],
+ "type": "Decorator",
},
- },
- "name": "x",
- "range": Array [
- 4,
- 21,
],
- "type": "Identifier",
- "typeAnnotation": Object {
+ "key": Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 16,
+ "line": 3,
},
"start": Object {
- "column": 8,
- "line": 1,
+ "column": 15,
+ "line": 3,
},
},
+ "name": "y",
"range": Array [
- 8,
- 21,
+ 43,
+ 44,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "type": "Identifier",
+ },
+ "kind": "set",
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 17,
+ 76,
+ ],
+ "static": true,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [
+ Object {
+ "expression": Object {
+ "left": Object {
+ "computed": false,
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 4,
+ },
+ },
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 58,
+ 62,
+ ],
+ "type": "ThisExpression",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 4,
+ },
+ },
+ "name": "_y",
+ "range": Array [
+ 63,
+ 65,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 58,
+ 65,
+ ],
+ "type": "MemberExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 4,
+ },
+ },
+ "operator": "=",
+ "range": Array [
+ 58,
+ 69,
+ ],
+ "right": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 4,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 68,
+ 69,
+ ],
+ "type": "Identifier",
+ },
+ "type": "AssignmentExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 58,
+ 70,
+ ],
+ "type": "ExpressionStatement",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 5,
+ "line": 5,
},
"start": Object {
- "column": 15,
- "line": 1,
+ "column": 20,
+ "line": 3,
},
},
"range": Array [
- 15,
- 21,
+ 48,
+ 76,
],
- "type": "TSStringKeyword",
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 3,
+ },
},
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 3,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 45,
+ 46,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "range": Array [
+ 44,
+ 76,
+ ],
+ "type": "FunctionExpression",
},
},
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
},
- "range": Array [
- 4,
- 21,
- ],
- "type": "VariableDeclarator",
},
- ],
- "kind": "let",
+ "range": Array [
+ 11,
+ 78,
+ ],
+ "type": "ClassBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "User",
+ "range": Array [
+ 6,
+ 10,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 1,
+ "line": 6,
},
"start": Object {
"column": 0,
@@ -72678,16 +80355,17 @@ Object {
},
"range": Array [
0,
- 22,
+ 78,
],
- "type": "VariableDeclaration",
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 1,
+ "line": 6,
},
"start": Object {
"column": 0,
@@ -72696,14 +80374,14 @@ Object {
},
"range": Array [
0,
- 22,
+ 78,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 3,
+ "column": 5,
"line": 1,
},
"start": Object {
@@ -72713,440 +80391,349 @@ Object {
},
"range": Array [
0,
- 3,
+ 5,
],
"type": "Keyword",
- "value": "let",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 4,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 4,
- 5,
+ 6,
+ 10,
],
"type": "Identifier",
- "value": "x",
+ "value": "User",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 8,
- 9,
+ 11,
+ 12,
],
"type": "Punctuator",
- "value": ":",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
"start": Object {
- "column": 15,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 15,
- 21,
+ 17,
+ 18,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 14,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
},
"range": Array [
- 21,
- 22,
+ 18,
+ 27,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "adminonly",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/declare/abstract-class.src 1`] = `
-Object {
- "body": Array [
Object {
- "abstract": true,
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 27,
- "line": 1,
- },
- },
- "range": Array [
- 27,
- 31,
- ],
- "type": "ClassBody",
- },
- "declare": true,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 1,
- },
- "start": Object {
- "column": 23,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 23,
- 26,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 10,
"line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 0,
- 31,
+ 32,
+ 38,
],
- "superClass": null,
- "type": "ClassDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Keyword",
+ "value": "static",
},
- },
- "range": Array [
- 0,
- 32,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 14,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 11,
+ "line": 3,
},
},
"range": Array [
- 0,
- 7,
+ 39,
+ 42,
],
"type": "Identifier",
- "value": "declare",
+ "value": "set",
},
Object {
"loc": Object {
"end": Object {
"column": 16,
- "line": 1,
+ "line": 3,
},
- "start": Object {
- "column": 8,
- "line": 1,
+ "start": Object {
+ "column": 15,
+ "line": 3,
},
},
"range": Array [
- 8,
- 16,
+ 43,
+ 44,
],
"type": "Identifier",
- "value": "abstract",
+ "value": "y",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 17,
+ "line": 3,
},
"start": Object {
- "column": 17,
- "line": 1,
+ "column": 16,
+ "line": 3,
},
},
"range": Array [
- 17,
- 22,
+ 44,
+ 45,
],
- "type": "Keyword",
- "value": "class",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 1,
+ "column": 18,
+ "line": 3,
},
"start": Object {
- "column": 23,
- "line": 1,
+ "column": 17,
+ "line": 3,
},
},
"range": Array [
- 23,
- 26,
+ 45,
+ 46,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 1,
+ "column": 19,
+ "line": 3,
},
"start": Object {
- "column": 27,
- "line": 1,
+ "column": 18,
+ "line": 3,
},
},
"range": Array [
- 27,
- 28,
+ 46,
+ 47,
],
"type": "Punctuator",
- "value": "{",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 21,
"line": 3,
},
"start": Object {
- "column": 0,
+ "column": 20,
"line": 3,
},
},
"range": Array [
- 30,
- 31,
+ 48,
+ 49,
],
"type": "Punctuator",
- "value": "}",
+ "value": "{",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/declare/class.src 1`] = `
-Object {
- "body": Array [
Object {
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 4,
},
- "range": Array [
- 18,
- 22,
- ],
- "type": "ClassBody",
- },
- "declare": true,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
+ "start": Object {
+ "column": 8,
+ "line": 4,
},
- "name": "Foo",
- "range": Array [
- 14,
- 17,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 58,
+ 62,
+ ],
+ "type": "Keyword",
+ "value": "this",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 13,
+ "line": 4,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 12,
+ "line": 4,
},
},
"range": Array [
- 0,
- 22,
+ 62,
+ 63,
],
- "superClass": null,
- "type": "ClassDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": ".",
},
- },
- "range": Array [
- 0,
- 23,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 15,
+ "line": 4,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 13,
+ "line": 4,
},
},
"range": Array [
- 0,
- 7,
+ 63,
+ 65,
],
"type": "Identifier",
- "value": "declare",
+ "value": "_y",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 1,
+ "column": 17,
+ "line": 4,
},
"start": Object {
- "column": 8,
- "line": 1,
+ "column": 16,
+ "line": 4,
},
},
"range": Array [
- 8,
- 13,
+ 66,
+ 67,
],
- "type": "Keyword",
- "value": "class",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 19,
+ "line": 4,
},
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 18,
+ "line": 4,
},
},
"range": Array [
- 14,
- 17,
+ 68,
+ 69,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
+ "column": 20,
+ "line": 4,
+ },
+ "start": Object {
"column": 19,
- "line": 1,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 69,
+ 70,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 5,
},
"start": Object {
- "column": 18,
- "line": 1,
+ "column": 4,
+ "line": 5,
},
},
"range": Array [
- 18,
- 19,
+ 75,
+ 76,
],
"type": "Punctuator",
- "value": "{",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 6,
},
"start": Object {
"column": 0,
- "line": 3,
+ "line": 6,
},
},
"range": Array [
- 21,
- 22,
+ 77,
+ 78,
],
"type": "Punctuator",
"value": "}",
@@ -73156,123 +80743,106 @@ Object {
}
`;
-exports[`typescript fixtures/declare/enum.src 1`] = `
+exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = `
Object {
"body": Array [
Object {
- "declare": true,
- "id": Object {
+ "body": Object {
+ "body": Array [],
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 12,
+ "line": 2,
},
"start": Object {
- "column": 13,
- "line": 1,
+ "column": 10,
+ "line": 2,
},
},
- "name": "Foo",
"range": Array [
- 13,
- 16,
+ 18,
+ 20,
],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
+ "type": "ClassBody",
},
- "members": Array [
+ "decorators": Array [
Object {
- "id": Object {
+ "expression": Object {
"loc": Object {
"end": Object {
"column": 7,
- "line": 2,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 1,
+ "line": 1,
},
},
- "name": "Bar",
+ "name": "sealed",
"range": Array [
- 23,
- 26,
+ 1,
+ 7,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 7,
- "line": 2,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 23,
- 26,
+ 0,
+ 7,
],
- "type": "TSEnumMember",
+ "type": "Decorator",
},
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "name": "Baz",
- "range": Array [
- 32,
- 35,
- ],
- "type": "Identifier",
+ ],
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 2,
},
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
+ "start": Object {
+ "column": 6,
+ "line": 2,
},
- "range": Array [
- 32,
- 35,
- ],
- "type": "TSEnumMember",
},
- ],
+ "name": "Qux",
+ "range": Array [
+ 14,
+ 17,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
"range": Array [
0,
- 37,
+ 20,
],
- "type": "TSEnumDeclaration",
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 5,
+ "column": 12,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -73281,14 +80851,14 @@ Object {
},
"range": Array [
0,
- 38,
+ 20,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 1,
"line": 1,
},
"start": Object {
@@ -73298,225 +80868,302 @@ Object {
},
"range": Array [
0,
- 7,
+ 1,
],
- "type": "Identifier",
- "value": "declare",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 7,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 1,
"line": 1,
},
},
"range": Array [
- 8,
- 12,
+ 1,
+ 7,
],
- "type": "Keyword",
- "value": "enum",
+ "type": "Identifier",
+ "value": "sealed",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
"start": Object {
- "column": 13,
- "line": 1,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
+ 8,
13,
- 16,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Keyword",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 1,
+ "column": 9,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 1,
+ "column": 6,
+ "line": 2,
},
},
"range": Array [
+ 14,
17,
- 18,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "Qux",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 11,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 10,
"line": 2,
},
},
"range": Array [
- 23,
- 26,
+ 18,
+ 19,
],
- "type": "Identifier",
- "value": "Bar",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 12,
"line": 2,
},
"start": Object {
- "column": 7,
+ "column": 11,
"line": 2,
},
},
"range": Array [
- 26,
- 27,
+ 19,
+ 20,
],
"type": "Punctuator",
- "value": ",",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = `
+Object {
+ "body": Array [
Object {
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 4,
+ },
},
+ "range": Array [
+ 56,
+ 58,
+ ],
+ "type": "ClassBody",
},
- "range": Array [
- 32,
- 35,
- ],
- "type": "Identifier",
- "value": "Baz",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 4,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "properties": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "name": "selector",
+ "range": Array [
+ 17,
+ 25,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "init",
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "method": false,
+ "range": Array [
+ 17,
+ 32,
+ ],
+ "shorthand": false,
+ "type": "Property",
+ "value": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 27,
+ 32,
+ ],
+ "raw": "'foo'",
+ "type": "Literal",
+ "value": "foo",
+ },
+ },
+ ],
+ "range": Array [
+ 11,
+ 35,
+ ],
+ "type": "ObjectExpression",
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "name": "Component",
+ "range": Array [
+ 1,
+ 10,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 2,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 1,
+ 36,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 2,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 36,
+ ],
+ "type": "Decorator",
},
- },
- "range": Array [
- 36,
- 37,
],
- "type": "Punctuator",
- "value": "}",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/declare/function.src 1`] = `
-Object {
- "body": Array [
- Object {
- "async": false,
- "declare": true,
- "expression": false,
- "generator": false,
"id": Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 1,
+ "column": 18,
+ "line": 4,
},
"start": Object {
- "column": 17,
- "line": 1,
+ "column": 6,
+ "line": 4,
},
},
- "name": "foo",
+ "name": "FooComponent",
"range": Array [
- 17,
- 20,
+ 43,
+ 55,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 28,
- "line": 1,
+ "column": 21,
+ "line": 4,
},
"start": Object {
"column": 0,
"line": 1,
},
},
- "params": Array [],
"range": Array [
0,
- 28,
+ 58,
],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "range": Array [
- 22,
- 28,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 24,
- "line": 1,
- },
- },
- "range": Array [
- 24,
- 28,
- ],
- "type": "TSVoidKeyword",
- },
- },
- "type": "TSDeclareFunction",
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 2,
+ "column": 21,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -73525,14 +81172,14 @@ Object {
},
"range": Array [
0,
- 29,
+ 58,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 1,
"line": 1,
},
"start": Object {
@@ -73542,97 +81189,97 @@ Object {
},
"range": Array [
0,
- 7,
+ 1,
],
- "type": "Identifier",
- "value": "declare",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 1,
"line": 1,
},
},
"range": Array [
- 8,
- 16,
+ 1,
+ 10,
],
- "type": "Keyword",
- "value": "function",
+ "type": "Identifier",
+ "value": "Component",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 17,
- 20,
+ 10,
+ 11,
],
- "type": "Identifier",
- "value": "foo",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 20,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 20,
- 21,
+ 11,
+ 12,
],
"type": "Punctuator",
- "value": "(",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 1,
+ "column": 12,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 21,
- 22,
+ 17,
+ 25,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "selector",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 1,
+ "column": 13,
+ "line": 2,
},
"start": Object {
- "column": 22,
- "line": 1,
+ "column": 12,
+ "line": 2,
},
},
"range": Array [
- 22,
- 23,
+ 25,
+ 26,
],
"type": "Punctuator",
"value": ":",
@@ -73640,67 +81287,40 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
"start": Object {
- "column": 24,
- "line": 1,
+ "column": 14,
+ "line": 2,
},
},
"range": Array [
- 24,
- 28,
+ 27,
+ 32,
],
- "type": "Keyword",
- "value": "void",
+ "type": "String",
+ "value": "'foo'",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/declare/interface.src 1`] = `
-Object {
- "body": Array [
Object {
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
},
- "range": Array [
- 22,
- 26,
- ],
- "type": "TSInterfaceBody",
- },
- "declare": true,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
+ "start": Object {
+ "column": 19,
+ "line": 2,
},
- "name": "Foo",
- "range": Array [
- 18,
- 21,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 32,
+ 33,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
"loc": Object {
"end": Object {
"column": 1,
@@ -73708,101 +81328,84 @@ Object {
},
"start": Object {
"column": 0,
- "line": 1,
+ "line": 3,
},
},
"range": Array [
- 0,
- 26,
+ 34,
+ 35,
],
- "type": "TSInterfaceDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Punctuator",
+ "value": "}",
},
- },
- "range": Array [
- 0,
- 27,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 2,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
},
"range": Array [
- 0,
- 7,
+ 35,
+ 36,
],
- "type": "Identifier",
- "value": "declare",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 5,
+ "line": 4,
},
"start": Object {
- "column": 8,
- "line": 1,
+ "column": 0,
+ "line": 4,
},
},
"range": Array [
- 8,
- 17,
+ 37,
+ 42,
],
"type": "Keyword",
- "value": "interface",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 18,
+ "line": 4,
},
"start": Object {
- "column": 18,
- "line": 1,
+ "column": 6,
+ "line": 4,
},
},
"range": Array [
- 18,
- 21,
+ 43,
+ 55,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "FooComponent",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 1,
+ "column": 20,
+ "line": 4,
},
"start": Object {
- "column": 22,
- "line": 1,
+ "column": 19,
+ "line": 4,
},
},
"range": Array [
- 22,
- 23,
+ 56,
+ 57,
],
"type": "Punctuator",
"value": "{",
@@ -73810,17 +81413,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 21,
+ "line": 4,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 20,
+ "line": 4,
},
},
"range": Array [
- 25,
- 26,
+ 57,
+ 58,
],
"type": "Punctuator",
"value": "}",
@@ -73830,51 +81433,204 @@ Object {
}
`;
-exports[`typescript fixtures/declare/module.src 1`] = `
+exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = `
Object {
"body": Array [
Object {
"body": Object {
- "body": Array [],
+ "body": Array [
+ Object {
+ "computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 24,
+ 29,
+ ],
+ "raw": "false",
+ "type": "Literal",
+ "value": false,
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "name": "onlyRead",
+ "range": Array [
+ 15,
+ 23,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 15,
+ 30,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 30,
+ ],
+ "type": "Decorator",
+ },
+ ],
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "name": "instanceMethod",
+ "range": Array [
+ 35,
+ 49,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "method",
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 54,
+ ],
+ "static": false,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 52,
+ 54,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 3,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 49,
+ 54,
+ ],
+ "type": "FunctionExpression",
+ },
+ },
+ ],
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 4,
},
"start": Object {
- "column": 19,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 19,
- 23,
+ 8,
+ 56,
],
- "type": "TSModuleBlock",
+ "type": "ClassBody",
},
- "declare": true,
"id": Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 7,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 6,
"line": 1,
},
},
- "name": "Foo",
+ "name": "B",
"range": Array [
- 15,
- 18,
+ 6,
+ 7,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -73883,16 +81639,17 @@ Object {
},
"range": Array [
0,
- 23,
+ 56,
],
- "type": "TSModuleDeclaration",
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 4,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -73901,14 +81658,14 @@ Object {
},
"range": Array [
0,
- 24,
+ 57,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 5,
"line": 1,
},
"start": Object {
@@ -73918,15 +81675,33 @@ Object {
},
"range": Array [
0,
+ 5,
+ ],
+ "type": "Keyword",
+ "value": "class",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 6,
7,
],
"type": "Identifier",
- "value": "declare",
+ "value": "B",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -73936,231 +81711,205 @@ Object {
},
"range": Array [
8,
- 14,
+ 9,
],
- "type": "Identifier",
- "value": "module",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
"start": Object {
- "column": 15,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
+ 14,
15,
- 18,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 1,
+ "column": 13,
+ "line": 2,
},
"start": Object {
- "column": 19,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
},
"range": Array [
- 19,
- 20,
+ 15,
+ 23,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "onlyRead",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 14,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 13,
+ "line": 2,
},
},
"range": Array [
- 22,
23,
+ 24,
],
"type": "Punctuator",
- "value": "}",
+ "value": "(",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/declare/namespace.src 1`] = `
-Object {
- "body": Array [
Object {
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 2,
},
- "range": Array [
- 22,
- 26,
- ],
- "type": "TSModuleBlock",
},
- "declare": true,
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
+ "range": Array [
+ 24,
+ 29,
+ ],
+ "type": "Boolean",
+ "value": "false",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 2,
},
- "name": "Foo",
- "range": Array [
- 18,
- 21,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 29,
+ 30,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 18,
"line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 0,
- 26,
+ 35,
+ 49,
],
- "type": "TSModuleDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 4,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Identifier",
+ "value": "instanceMethod",
},
- },
- "range": Array [
- 0,
- 27,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 19,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 18,
+ "line": 3,
},
},
"range": Array [
- 0,
- 7,
+ 49,
+ 50,
],
- "type": "Identifier",
- "value": "declare",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 1,
+ "column": 20,
+ "line": 3,
},
"start": Object {
- "column": 8,
- "line": 1,
+ "column": 19,
+ "line": 3,
},
},
"range": Array [
- 8,
- 17,
+ 50,
+ 51,
],
- "type": "Identifier",
- "value": "namespace",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 22,
+ "line": 3,
},
"start": Object {
- "column": 18,
- "line": 1,
+ "column": 21,
+ "line": 3,
},
},
"range": Array [
- 18,
- 21,
+ 52,
+ 53,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
"column": 23,
- "line": 1,
+ "line": 3,
},
"start": Object {
"column": 22,
- "line": 1,
+ "line": 3,
},
},
"range": Array [
- 22,
- 23,
+ 53,
+ 54,
],
"type": "Punctuator",
- "value": "{",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 4,
},
"start": Object {
"column": 0,
- "line": 3,
+ "line": 4,
},
},
"range": Array [
- 25,
- 26,
+ 55,
+ 56,
],
"type": "Punctuator",
"value": "}",
@@ -74170,33 +81919,204 @@ Object {
}
`;
-exports[`typescript fixtures/declare/type-alias.src 1`] = `
+exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = `
Object {
"body": Array [
Object {
- "declare": true,
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 19,
+ 24,
+ ],
+ "raw": "false",
+ "type": "Literal",
+ "value": false,
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 15,
+ 18,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 15,
+ 25,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 25,
+ ],
+ "type": "Decorator",
+ },
+ ],
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 3,
+ },
+ },
+ "name": "staticMethod",
+ "range": Array [
+ 37,
+ 49,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "method",
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 54,
+ ],
+ "static": true,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 52,
+ 54,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 3,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 49,
+ 54,
+ ],
+ "type": "FunctionExpression",
+ },
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 8,
+ 56,
+ ],
+ "type": "ClassBody",
+ },
"id": Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 7,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 6,
"line": 1,
},
},
- "name": "Foo",
+ "name": "C",
"range": Array [
- 13,
- 16,
+ 6,
+ 7,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 25,
- "line": 1,
+ "column": 1,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -74205,33 +82125,17 @@ Object {
},
"range": Array [
0,
- 25,
+ 56,
],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
- },
- "start": Object {
- "column": 19,
- "line": 1,
- },
- },
- "range": Array [
- 19,
- 25,
- ],
- "type": "TSStringKeyword",
- },
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 2,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -74240,14 +82144,14 @@ Object {
},
"range": Array [
0,
- 26,
+ 57,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 5,
"line": 1,
},
"start": Object {
@@ -74257,15 +82161,33 @@ Object {
},
"range": Array [
0,
+ 5,
+ ],
+ "type": "Keyword",
+ "value": "class",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 6,
7,
],
"type": "Identifier",
- "value": "declare",
+ "value": "C",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -74275,25 +82197,43 @@ Object {
},
"range": Array [
8,
- 12,
+ 9,
],
- "type": "Identifier",
- "value": "type",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
"start": Object {
- "column": 13,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 13,
- 16,
+ 14,
+ 15,
+ ],
+ "type": "Punctuator",
+ "value": "@",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 15,
+ 18,
],
"type": "Identifier",
"value": "Foo",
@@ -74301,270 +82241,189 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 1,
+ "column": 9,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 1,
+ "column": 8,
+ "line": 2,
},
},
"range": Array [
- 17,
18,
+ 19,
],
"type": "Punctuator",
- "value": "=",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 1,
+ "column": 14,
+ "line": 2,
},
"start": Object {
- "column": 19,
- "line": 1,
+ "column": 9,
+ "line": 2,
},
},
"range": Array [
19,
- 25,
+ 24,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Boolean",
+ "value": "false",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/declare/variable.src 1`] = `
-Object {
- "body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
- },
- "name": "foo",
- "range": Array [
- 12,
- 20,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 15,
- "line": 1,
- },
- },
- "range": Array [
- 15,
- 20,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 17,
- "line": 1,
- },
- },
- "range": Array [
- 17,
- 20,
- ],
- "type": "TSAnyKeyword",
- },
- },
- },
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
- },
- "range": Array [
- 12,
- 20,
- ],
- "type": "VariableDeclarator",
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 2,
},
+ },
+ "range": Array [
+ 24,
+ 25,
],
- "declare": true,
- "kind": "var",
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 10,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 0,
- 21,
+ 30,
+ 36,
],
- "type": "VariableDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Keyword",
+ "value": "static",
},
- },
- "range": Array [
- 0,
- 22,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 23,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 11,
+ "line": 3,
},
},
"range": Array [
- 0,
- 7,
+ 37,
+ 49,
],
"type": "Identifier",
- "value": "declare",
+ "value": "staticMethod",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 1,
+ "column": 24,
+ "line": 3,
},
"start": Object {
- "column": 8,
- "line": 1,
+ "column": 23,
+ "line": 3,
},
},
"range": Array [
- 8,
- 11,
+ 49,
+ 50,
],
- "type": "Keyword",
- "value": "var",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 1,
+ "column": 25,
+ "line": 3,
},
"start": Object {
- "column": 12,
- "line": 1,
+ "column": 24,
+ "line": 3,
},
},
"range": Array [
- 12,
- 15,
+ 50,
+ 51,
],
- "type": "Identifier",
- "value": "foo",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 27,
+ "line": 3,
},
"start": Object {
- "column": 15,
- "line": 1,
+ "column": 26,
+ "line": 3,
},
},
"range": Array [
- 15,
- 16,
+ 52,
+ 53,
],
"type": "Punctuator",
- "value": ":",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 1,
+ "column": 28,
+ "line": 3,
},
"start": Object {
- "column": 17,
- "line": 1,
+ "column": 27,
+ "line": 3,
},
},
"range": Array [
- 17,
- 20,
+ 53,
+ 54,
],
- "type": "Identifier",
- "value": "any",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 1,
+ "column": 1,
+ "line": 4,
},
"start": Object {
- "column": 20,
- "line": 1,
+ "column": 0,
+ "line": 4,
},
},
"range": Array [
- 20,
- 21,
+ 55,
+ 56,
],
"type": "Punctuator",
- "value": ";",
+ "value": "}",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src 1`] = `
+exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = `
Object {
"body": Array [
Object {
@@ -74575,48 +82434,9 @@ Object {
"decorators": Array [
Object {
"expression": Object {
- "arguments": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 18,
- "line": 2,
- },
- },
- "range": Array [
- 32,
- 37,
- ],
- "raw": "false",
- "type": "Literal",
- "value": false,
- },
- ],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "configurable",
- "range": Array [
- 19,
- 31,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 13,
"line": 2,
},
"start": Object {
@@ -74624,15 +82444,16 @@ Object {
"line": 2,
},
},
+ "name": "onlyRead",
"range": Array [
- 19,
- 38,
+ 15,
+ 23,
],
- "type": "CallExpression",
+ "type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 13,
"line": 2,
},
"start": Object {
@@ -74641,8 +82462,8 @@ Object {
},
},
"range": Array [
- 18,
- 38,
+ 14,
+ 23,
],
"type": "Decorator",
},
@@ -74650,126 +82471,55 @@ Object {
"key": Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 18,
"line": 3,
},
"start": Object {
- "column": 8,
+ "column": 4,
"line": 3,
},
},
- "name": "x",
- "range": Array [
- 47,
- 48,
- ],
- "type": "Identifier",
- },
- "kind": "get",
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 18,
- 70,
- ],
- "static": false,
- "type": "MethodDefinition",
- "value": Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "computed": false,
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 3,
- },
- "start": Object {
- "column": 21,
- "line": 3,
- },
- },
- "object": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 3,
- },
- "start": Object {
- "column": 21,
- "line": 3,
- },
- },
- "range": Array [
- 60,
- 64,
- ],
- "type": "ThisExpression",
- },
- "property": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 3,
- },
- "start": Object {
- "column": 26,
- "line": 3,
- },
- },
- "name": "_x",
- "range": Array [
- 65,
- 67,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 60,
- 67,
- ],
- "type": "MemberExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 3,
- },
- "start": Object {
- "column": 14,
- "line": 3,
- },
- },
- "range": Array [
- 53,
- 68,
- ],
- "type": "ReturnStatement",
- },
- ],
+ "name": "instanceMethod",
+ "range": Array [
+ 28,
+ 42,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "method",
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 47,
+ ],
+ "static": false,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 23,
"line": 3,
},
"start": Object {
- "column": 12,
+ "column": 21,
"line": 3,
},
},
"range": Array [
- 51,
- 70,
+ 45,
+ 47,
],
"type": "BlockStatement",
},
@@ -74778,18 +82528,18 @@ Object {
"id": null,
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 23,
"line": 3,
},
"start": Object {
- "column": 9,
+ "column": 18,
"line": 3,
},
},
"params": Array [],
"range": Array [
- 48,
- 70,
+ 42,
+ 47,
],
"type": "FunctionExpression",
},
@@ -74801,20 +82551,20 @@ Object {
"line": 4,
},
"start": Object {
- "column": 12,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 12,
- 72,
+ 8,
+ 49,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -74822,10 +82572,10 @@ Object {
"line": 1,
},
},
- "name": "Point",
+ "name": "A",
"range": Array [
6,
- 11,
+ 7,
],
"type": "Identifier",
},
@@ -74841,7 +82591,7 @@ Object {
},
"range": Array [
0,
- 72,
+ 49,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -74850,8 +82600,8 @@ Object {
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 0,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -74860,7 +82610,7 @@ Object {
},
"range": Array [
0,
- 72,
+ 50,
],
"sourceType": "module",
"tokens": Array [
@@ -74885,7 +82635,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -74895,25 +82645,25 @@ Object {
},
"range": Array [
6,
- 11,
+ 7,
],
"type": "Identifier",
- "value": "Point",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 8,
+ 9,
],
"type": "Punctuator",
"value": "{",
@@ -74930,8 +82680,8 @@ Object {
},
},
"range": Array [
- 18,
- 19,
+ 14,
+ 15,
],
"type": "Punctuator",
"value": "@",
@@ -74939,7 +82689,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 13,
"line": 2,
},
"start": Object {
@@ -74948,70 +82698,16 @@ Object {
},
},
"range": Array [
- 19,
- 31,
+ 15,
+ 23,
],
"type": "Identifier",
- "value": "configurable",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 2,
- },
- "start": Object {
- "column": 17,
- "line": 2,
- },
- },
- "range": Array [
- 31,
- 32,
- ],
- "type": "Punctuator",
- "value": "(",
+ "value": "onlyRead",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
"column": 18,
- "line": 2,
- },
- },
- "range": Array [
- 32,
- 37,
- ],
- "type": "Boolean",
- "value": "false",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 2,
- },
- "start": Object {
- "column": 23,
- "line": 2,
- },
- },
- "range": Array [
- 37,
- 38,
- ],
- "type": "Punctuator",
- "value": ")",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 7,
"line": 3,
},
"start": Object {
@@ -75020,44 +82716,26 @@ Object {
},
},
"range": Array [
- 43,
- 46,
- ],
- "type": "Identifier",
- "value": "get",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "range": Array [
- 47,
- 48,
+ 28,
+ 42,
],
"type": "Identifier",
- "value": "x",
+ "value": "instanceMethod",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 19,
"line": 3,
},
"start": Object {
- "column": 9,
+ "column": 18,
"line": 3,
},
},
"range": Array [
- 48,
- 49,
+ 42,
+ 43,
],
"type": "Punctuator",
"value": "(",
@@ -75065,17 +82743,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 20,
"line": 3,
},
"start": Object {
- "column": 10,
+ "column": 19,
"line": 3,
},
},
"range": Array [
- 49,
- 50,
+ 43,
+ 44,
],
"type": "Punctuator",
"value": ")",
@@ -75083,43 +82761,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 3,
- },
- "start": Object {
- "column": 12,
- "line": 3,
- },
- },
- "range": Array [
- 51,
- 52,
- ],
- "type": "Punctuator",
- "value": "{",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 3,
- },
- "start": Object {
- "column": 14,
- "line": 3,
- },
- },
- "range": Array [
- 53,
- 59,
- ],
- "type": "Keyword",
- "value": "return",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 25,
+ "column": 22,
"line": 3,
},
"start": Object {
@@ -75128,80 +82770,26 @@ Object {
},
},
"range": Array [
- 60,
- 64,
- ],
- "type": "Keyword",
- "value": "this",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 3,
- },
- "start": Object {
- "column": 25,
- "line": 3,
- },
- },
- "range": Array [
- 64,
- 65,
- ],
- "type": "Punctuator",
- "value": ".",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 3,
- },
- "start": Object {
- "column": 26,
- "line": 3,
- },
- },
- "range": Array [
- 65,
- 67,
- ],
- "type": "Identifier",
- "value": "_x",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 3,
- },
- "start": Object {
- "column": 28,
- "line": 3,
- },
- },
- "range": Array [
- 67,
- 68,
+ 45,
+ 46,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 23,
"line": 3,
},
"start": Object {
- "column": 30,
+ "column": 22,
"line": 3,
},
},
"range": Array [
- 69,
- 70,
+ 46,
+ 47,
],
"type": "Punctuator",
"value": "}",
@@ -75218,8 +82806,8 @@ Object {
},
},
"range": Array [
- 71,
- 72,
+ 48,
+ 49,
],
"type": "Punctuator",
"value": "}",
@@ -75229,7 +82817,7 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = `
+exports[`typescript fixtures/decorators/method-decorators/method-decorator-static-member.src 1`] = `
Object {
"body": Array [
Object {
@@ -75240,106 +82828,9 @@ Object {
"decorators": Array [
Object {
"expression": Object {
- "arguments": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "properties": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "name": "baz",
- "range": Array [
- 25,
- 28,
- ],
- "type": "Identifier",
- },
- "kind": "init",
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "method": false,
- "range": Array [
- 25,
- 34,
- ],
- "shorthand": false,
- "type": "Property",
- "value": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "range": Array [
- 30,
- 34,
- ],
- "raw": "true",
- "type": "Literal",
- "value": true,
- },
- },
- ],
- "range": Array [
- 23,
- 36,
- ],
- "type": "ObjectExpression",
- },
- ],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "foo",
- "range": Array [
- 19,
- 22,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 8,
"line": 2,
},
"start": Object {
@@ -75347,15 +82838,16 @@ Object {
"line": 2,
},
},
+ "name": "Foo",
"range": Array [
- 19,
- 37,
+ 15,
+ 18,
],
- "type": "CallExpression",
+ "type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 8,
"line": 2,
},
"start": Object {
@@ -75364,8 +82856,8 @@ Object {
},
},
"range": Array [
+ 14,
18,
- 37,
],
"type": "Decorator",
},
@@ -75373,25 +82865,25 @@ Object {
"key": Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 23,
"line": 3,
},
"start": Object {
- "column": 15,
+ "column": 11,
"line": 3,
},
},
- "name": "bar",
+ "name": "staticMethod",
"range": Array [
- 53,
- 56,
+ 30,
+ 42,
],
"type": "Identifier",
},
- "kind": "get",
+ "kind": "method",
"loc": Object {
"end": Object {
- "column": 42,
+ "column": 28,
"line": 3,
},
"start": Object {
@@ -75400,99 +82892,28 @@ Object {
},
},
"range": Array [
- 18,
- 80,
+ 14,
+ 47,
],
"static": true,
"type": "MethodDefinition",
"value": Object {
"async": false,
"body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "computed": false,
- "loc": Object {
- "end": Object {
- "column": 39,
- "line": 3,
- },
- "start": Object {
- "column": 30,
- "line": 3,
- },
- },
- "object": Object {
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 3,
- },
- "start": Object {
- "column": 30,
- "line": 3,
- },
- },
- "range": Array [
- 68,
- 72,
- ],
- "type": "ThisExpression",
- },
- "property": Object {
- "loc": Object {
- "end": Object {
- "column": 39,
- "line": 3,
- },
- "start": Object {
- "column": 35,
- "line": 3,
- },
- },
- "name": "_bar",
- "range": Array [
- 73,
- 77,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 68,
- 77,
- ],
- "type": "MemberExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 40,
- "line": 3,
- },
- "start": Object {
- "column": 23,
- "line": 3,
- },
- },
- "range": Array [
- 61,
- 78,
- ],
- "type": "ReturnStatement",
- },
- ],
+ "body": Array [],
"loc": Object {
"end": Object {
- "column": 42,
+ "column": 28,
"line": 3,
},
"start": Object {
- "column": 21,
+ "column": 26,
"line": 3,
},
},
"range": Array [
- 59,
- 80,
+ 45,
+ 47,
],
"type": "BlockStatement",
},
@@ -75501,18 +82922,18 @@ Object {
"id": null,
"loc": Object {
"end": Object {
- "column": 42,
+ "column": 28,
"line": 3,
},
"start": Object {
- "column": 18,
+ "column": 23,
"line": 3,
},
},
"params": Array [],
"range": Array [
- 56,
- 80,
+ 42,
+ 47,
],
"type": "FunctionExpression",
},
@@ -75524,20 +82945,20 @@ Object {
"line": 4,
},
"start": Object {
- "column": 12,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 12,
- 82,
+ 8,
+ 49,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -75545,10 +82966,10 @@ Object {
"line": 1,
},
},
- "name": "Other",
+ "name": "D",
"range": Array [
6,
- 11,
+ 7,
],
"type": "Identifier",
},
@@ -75564,7 +82985,7 @@ Object {
},
"range": Array [
0,
- 82,
+ 49,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -75573,8 +82994,8 @@ Object {
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 0,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -75583,7 +83004,7 @@ Object {
},
"range": Array [
0,
- 82,
+ 50,
],
"sourceType": "module",
"tokens": Array [
@@ -75608,7 +83029,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -75618,25 +83039,25 @@ Object {
},
"range": Array [
6,
- 11,
+ 7,
],
"type": "Identifier",
- "value": "Other",
+ "value": "D",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 8,
+ 9,
],
"type": "Punctuator",
"value": "{",
@@ -75653,8 +83074,8 @@ Object {
},
},
"range": Array [
- 18,
- 19,
+ 14,
+ 15,
],
"type": "Punctuator",
"value": "@",
@@ -75671,137 +83092,11 @@ Object {
},
},
"range": Array [
- 19,
- 22,
- ],
- "type": "Identifier",
- "value": "foo",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 2,
- },
- "start": Object {
- "column": 8,
- "line": 2,
- },
- },
- "range": Array [
- 22,
- 23,
- ],
- "type": "Punctuator",
- "value": "(",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "range": Array [
- 23,
- 24,
- ],
- "type": "Punctuator",
- "value": "{",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "range": Array [
- 25,
- 28,
+ 15,
+ 18,
],
"type": "Identifier",
- "value": "baz",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 14,
- "line": 2,
- },
- },
- "range": Array [
- 28,
- 29,
- ],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "range": Array [
- 30,
- 34,
- ],
- "type": "Boolean",
- "value": "true",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 2,
- },
- "start": Object {
- "column": 21,
- "line": 2,
- },
- },
- "range": Array [
- 35,
- 36,
- ],
- "type": "Punctuator",
- "value": "}",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 22,
- "line": 2,
- },
- },
- "range": Array [
- 36,
- 37,
- ],
- "type": "Punctuator",
- "value": ")",
+ "value": "Foo",
},
Object {
"loc": Object {
@@ -75815,8 +83110,8 @@ Object {
},
},
"range": Array [
- 42,
- 48,
+ 23,
+ 29,
],
"type": "Keyword",
"value": "static",
@@ -75824,7 +83119,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 23,
"line": 3,
},
"start": Object {
@@ -75833,44 +83128,26 @@ Object {
},
},
"range": Array [
- 49,
- 52,
- ],
- "type": "Identifier",
- "value": "get",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 3,
- },
- },
- "range": Array [
- 53,
- 56,
+ 30,
+ 42,
],
"type": "Identifier",
- "value": "bar",
+ "value": "staticMethod",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 24,
"line": 3,
},
"start": Object {
- "column": 18,
+ "column": 23,
"line": 3,
},
},
"range": Array [
- 56,
- 57,
+ 42,
+ 43,
],
"type": "Punctuator",
"value": "(",
@@ -75878,17 +83155,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 25,
"line": 3,
},
"start": Object {
- "column": 19,
+ "column": 24,
"line": 3,
},
},
"range": Array [
- 57,
- 58,
+ 43,
+ 44,
],
"type": "Punctuator",
"value": ")",
@@ -75896,17 +83173,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 27,
"line": 3,
},
"start": Object {
- "column": 21,
+ "column": 26,
"line": 3,
},
},
"range": Array [
- 59,
- 60,
+ 45,
+ 46,
],
"type": "Punctuator",
"value": "{",
@@ -75914,107 +83191,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 3,
- },
- "start": Object {
- "column": 23,
- "line": 3,
- },
- },
- "range": Array [
- 61,
- 67,
- ],
- "type": "Keyword",
- "value": "return",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 3,
- },
- "start": Object {
- "column": 30,
- "line": 3,
- },
- },
- "range": Array [
- 68,
- 72,
- ],
- "type": "Keyword",
- "value": "this",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 35,
- "line": 3,
- },
- "start": Object {
- "column": 34,
- "line": 3,
- },
- },
- "range": Array [
- 72,
- 73,
- ],
- "type": "Punctuator",
- "value": ".",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 39,
- "line": 3,
- },
- "start": Object {
- "column": 35,
- "line": 3,
- },
- },
- "range": Array [
- 73,
- 77,
- ],
- "type": "Identifier",
- "value": "_bar",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 40,
- "line": 3,
- },
- "start": Object {
- "column": 39,
- "line": 3,
- },
- },
- "range": Array [
- 77,
- 78,
- ],
- "type": "Punctuator",
- "value": ";",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 42,
+ "column": 28,
"line": 3,
},
"start": Object {
- "column": 41,
+ "column": 27,
"line": 3,
},
},
"range": Array [
- 79,
- 80,
+ 46,
+ 47,
],
"type": "Punctuator",
"value": "}",
@@ -76031,8 +83218,8 @@ Object {
},
},
"range": Array [
- 81,
- 82,
+ 48,
+ 49,
],
"type": "Punctuator",
"value": "}",
@@ -76042,7 +83229,7 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = `
+exports[`typescript fixtures/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = `
Object {
"body": Array [
Object {
@@ -76050,186 +83237,225 @@ Object {
"body": Array [
Object {
"computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "hidden",
- "range": Array [
- 15,
- 21,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 14,
- 21,
- ],
- "type": "Decorator",
- },
- ],
"key": Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 3,
+ "column": 5,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 3,
+ "column": 2,
+ "line": 2,
},
},
- "name": "z",
+ "name": "bar",
"range": Array [
- 30,
- 31,
+ 14,
+ 17,
],
"type": "Identifier",
},
- "kind": "get",
+ "kind": "method",
"loc": Object {
"end": Object {
- "column": 31,
- "line": 3,
+ "column": 37,
+ "line": 2,
},
"start": Object {
- "column": 4,
+ "column": 2,
"line": 2,
},
},
"range": Array [
14,
- 53,
+ 49,
],
"static": false,
"type": "MethodDefinition",
"value": Object {
"async": false,
"body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "computed": false,
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 3,
- },
- "start": Object {
- "column": 21,
- "line": 3,
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 47,
+ 49,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 27,
+ 31,
+ ],
+ "raw": "true",
+ "type": "Literal",
+ "value": true,
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "name": "special",
+ "range": Array [
+ 19,
+ 26,
+ ],
+ "type": "Identifier",
},
- },
- "object": Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 3,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 3,
+ "column": 7,
+ "line": 2,
},
},
"range": Array [
- 43,
- 47,
+ 19,
+ 32,
],
- "type": "ThisExpression",
+ "type": "CallExpression",
},
- "property": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 3,
- },
- "start": Object {
- "column": 26,
- "line": 3,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 18,
+ 32,
+ ],
+ "type": "Decorator",
+ },
+ ],
+ "elements": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
},
- "name": "_z",
- "range": Array [
- 48,
- 50,
- ],
- "type": "Identifier",
},
+ "name": "bar",
"range": Array [
- 43,
- 50,
+ 35,
+ 38,
],
- "type": "MemberExpression",
+ "type": "Identifier",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 2,
},
+ },
+ "range": Array [
+ 33,
+ 45,
+ ],
+ "type": "ArrayPattern",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 3,
+ "column": 33,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 3,
+ "column": 28,
+ "line": 2,
},
},
"range": Array [
- 36,
- 51,
+ 40,
+ 45,
],
- "type": "ReturnStatement",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 3,
- },
- "start": Object {
- "column": 12,
- "line": 3,
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 42,
+ 45,
+ ],
+ "type": "TSAnyKeyword",
+ },
},
},
- "range": Array [
- 34,
- 53,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": null,
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 3,
- },
- "start": Object {
- "column": 9,
- "line": 3,
- },
- },
- "params": Array [],
+ ],
"range": Array [
- 31,
- 53,
+ 17,
+ 49,
],
"type": "FunctionExpression",
},
@@ -76238,23 +83464,23 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 3,
},
"start": Object {
- "column": 8,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 8,
- 55,
+ 10,
+ 51,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -76262,17 +83488,17 @@ Object {
"line": 1,
},
},
- "name": "P",
+ "name": "Foo",
"range": Array [
6,
- 7,
+ 9,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -76281,7 +83507,7 @@ Object {
},
"range": Array [
0,
- 55,
+ 51,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -76290,7 +83516,7 @@ Object {
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 0,
"line": 4,
},
"start": Object {
@@ -76300,7 +83526,7 @@ Object {
},
"range": Array [
0,
- 55,
+ 52,
],
"sourceType": "module",
"tokens": Array [
@@ -76325,7 +83551,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -76335,25 +83561,25 @@ Object {
},
"range": Array [
6,
- 7,
+ 9,
],
"type": "Identifier",
- "value": "P",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 8,
- 9,
+ 10,
+ 11,
],
"type": "Punctuator",
"value": "{",
@@ -76365,21 +83591,21 @@ Object {
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 2,
"line": 2,
},
},
"range": Array [
14,
- 15,
+ 17,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Identifier",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 6,
"line": 2,
},
"start": Object {
@@ -76388,62 +83614,62 @@ Object {
},
},
"range": Array [
- 15,
- 21,
+ 17,
+ 18,
],
- "type": "Identifier",
- "value": "hidden",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
"column": 7,
- "line": 3,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 6,
+ "line": 2,
},
},
"range": Array [
- 26,
- 29,
+ 18,
+ 19,
],
- "type": "Identifier",
- "value": "get",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 3,
+ "column": 14,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 3,
+ "column": 7,
+ "line": 2,
},
},
"range": Array [
- 30,
- 31,
+ 19,
+ 26,
],
"type": "Identifier",
- "value": "z",
+ "value": "special",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 3,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 9,
- "line": 3,
+ "column": 14,
+ "line": 2,
},
},
"range": Array [
- 31,
- 32,
+ 26,
+ 27,
],
"type": "Punctuator",
"value": "(",
@@ -76451,17 +83677,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 3,
+ "column": 19,
+ "line": 2,
},
"start": Object {
- "column": 10,
- "line": 3,
+ "column": 15,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 27,
+ 31,
+ ],
+ "type": "Boolean",
+ "value": "true",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 2,
},
},
"range": Array [
+ 31,
32,
- 33,
],
"type": "Punctuator",
"value": ")",
@@ -76469,125 +83713,143 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 3,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 12,
- "line": 3,
+ "column": 21,
+ "line": 2,
},
},
"range": Array [
+ 33,
34,
- 35,
],
"type": "Punctuator",
- "value": "{",
+ "value": "[",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 3,
+ "column": 26,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 3,
+ "column": 23,
+ "line": 2,
},
},
"range": Array [
- 36,
- 42,
+ 35,
+ 38,
],
- "type": "Keyword",
- "value": "return",
+ "type": "Identifier",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 3,
+ "column": 28,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 3,
+ "column": 27,
+ "line": 2,
},
},
"range": Array [
- 43,
- 47,
+ 39,
+ 40,
],
- "type": "Keyword",
- "value": "this",
+ "type": "Punctuator",
+ "value": "]",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 3,
+ "column": 29,
+ "line": 2,
},
"start": Object {
- "column": 25,
- "line": 3,
+ "column": 28,
+ "line": 2,
},
},
"range": Array [
- 47,
- 48,
+ 40,
+ 41,
],
"type": "Punctuator",
- "value": ".",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 3,
+ "column": 33,
+ "line": 2,
},
"start": Object {
- "column": 26,
- "line": 3,
+ "column": 30,
+ "line": 2,
},
},
"range": Array [
- 48,
- 50,
+ 42,
+ 45,
],
"type": "Identifier",
- "value": "_z",
+ "value": "any",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 3,
+ "column": 34,
+ "line": 2,
},
"start": Object {
- "column": 28,
- "line": 3,
+ "column": 33,
+ "line": 2,
},
},
"range": Array [
- 50,
- 51,
+ 45,
+ 46,
],
"type": "Punctuator",
- "value": ";",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 3,
+ "column": 36,
+ "line": 2,
},
"start": Object {
- "column": 30,
- "line": 3,
+ "column": 35,
+ "line": 2,
},
},
"range": Array [
- 52,
- 53,
+ 47,
+ 48,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 36,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 48,
+ 49,
],
"type": "Punctuator",
"value": "}",
@@ -76596,16 +83858,16 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 3,
},
"start": Object {
"column": 0,
- "line": 4,
+ "line": 3,
},
},
"range": Array [
- 54,
- 55,
+ 50,
+ 51,
],
"type": "Punctuator",
"value": "}",
@@ -76615,7 +83877,7 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = `
+exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = `
Object {
"body": Array [
Object {
@@ -76623,66 +83885,29 @@ Object {
"body": Array [
Object {
"computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "adminonly",
- "range": Array [
- 18,
- 27,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 17,
- 27,
- ],
- "type": "Decorator",
- },
- ],
"key": Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 3,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 15,
- "line": 3,
+ "column": 4,
+ "line": 2,
},
},
- "name": "y",
+ "name": "constructor",
"range": Array [
- 43,
- 44,
+ 20,
+ 31,
],
"type": "Identifier",
},
- "kind": "set",
+ "kind": "constructor",
"loc": Object {
"end": Object {
"column": 5,
- "line": 5,
+ "line": 4,
},
"start": Object {
"column": 4,
@@ -76690,10 +83915,10 @@ Object {
},
},
"range": Array [
- 17,
- 76,
+ 20,
+ 113,
],
- "static": true,
+ "static": false,
"type": "MethodDefinition",
"value": Object {
"async": false,
@@ -76705,103 +83930,139 @@ Object {
"computed": false,
"loc": Object {
"end": Object {
- "column": 15,
- "line": 4,
+ "column": 18,
+ "line": 3,
},
"start": Object {
"column": 8,
- "line": 4,
+ "line": 3,
},
},
"object": Object {
"loc": Object {
"end": Object {
"column": 12,
- "line": 4,
+ "line": 3,
},
"start": Object {
"column": 8,
- "line": 4,
+ "line": 3,
},
},
"range": Array [
- 58,
- 62,
+ 81,
+ 85,
],
"type": "ThisExpression",
},
"property": Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 4,
+ "column": 18,
+ "line": 3,
},
"start": Object {
"column": 13,
- "line": 4,
+ "line": 3,
},
},
- "name": "_y",
+ "name": "title",
"range": Array [
- 63,
- 65,
+ 86,
+ 91,
],
"type": "Identifier",
},
"range": Array [
- 58,
- 65,
+ 81,
+ 91,
],
"type": "MemberExpression",
},
"loc": Object {
"end": Object {
- "column": 19,
- "line": 4,
+ "column": 33,
+ "line": 3,
},
"start": Object {
"column": 8,
- "line": 4,
+ "line": 3,
},
},
"operator": "=",
"range": Array [
- 58,
- 69,
+ 81,
+ 106,
],
"right": Object {
+ "computed": false,
"loc": Object {
"end": Object {
- "column": 19,
- "line": 4,
+ "column": 33,
+ "line": 3,
},
"start": Object {
- "column": 18,
- "line": 4,
+ "column": 21,
+ "line": 3,
},
},
- "name": "a",
+ "object": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 3,
+ },
+ },
+ "name": "config",
+ "range": Array [
+ 94,
+ 100,
+ ],
+ "type": "Identifier",
+ },
+ "property": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 3,
+ },
+ },
+ "name": "title",
+ "range": Array [
+ 101,
+ 106,
+ ],
+ "type": "Identifier",
+ },
"range": Array [
- 68,
- 69,
+ 94,
+ 106,
],
- "type": "Identifier",
+ "type": "MemberExpression",
},
"type": "AssignmentExpression",
},
"loc": Object {
"end": Object {
- "column": 20,
- "line": 4,
+ "column": 34,
+ "line": 3,
},
"start": Object {
"column": 8,
- "line": 4,
+ "line": 3,
},
},
- "range": Array [
- 58,
- 70,
+ "range": Array [
+ 81,
+ 107,
],
"type": "ExpressionStatement",
},
@@ -76809,16 +84070,16 @@ Object {
"loc": Object {
"end": Object {
"column": 5,
- "line": 5,
+ "line": 4,
},
"start": Object {
- "column": 20,
- "line": 3,
+ "column": 55,
+ "line": 2,
},
},
"range": Array [
- 48,
- 76,
+ 71,
+ 113,
],
"type": "BlockStatement",
},
@@ -76828,36 +84089,162 @@ Object {
"loc": Object {
"end": Object {
"column": 5,
- "line": 5,
+ "line": 4,
},
"start": Object {
- "column": 16,
- "line": 3,
+ "column": 15,
+ "line": 2,
},
},
"params": Array [
Object {
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 2,
+ },
+ },
+ "name": "APP_CONFIG",
+ "range": Array [
+ 40,
+ 50,
+ ],
+ "type": "Identifier",
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 2,
+ },
+ },
+ "name": "Inject",
+ "range": Array [
+ 33,
+ 39,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 35,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 33,
+ 51,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 35,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 32,
+ 51,
+ ],
+ "type": "Decorator",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 18,
- "line": 3,
+ "column": 53,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 3,
+ "column": 36,
+ "line": 2,
},
},
- "name": "a",
+ "name": "config",
"range": Array [
- 45,
- 46,
+ 52,
+ 69,
],
"type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 53,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 42,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 58,
+ 69,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 53,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 44,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 60,
+ 69,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 53,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 44,
+ "line": 2,
+ },
+ },
+ "name": "AppConfig",
+ "range": Array [
+ 60,
+ 69,
+ ],
+ "type": "Identifier",
+ },
+ },
+ },
},
],
"range": Array [
- 44,
- 76,
+ 31,
+ 113,
],
"type": "FunctionExpression",
},
@@ -76866,23 +84253,23 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 6,
+ "line": 5,
},
"start": Object {
- "column": 11,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 11,
- 78,
+ 14,
+ 115,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 13,
"line": 1,
},
"start": Object {
@@ -76890,17 +84277,17 @@ Object {
"line": 1,
},
},
- "name": "User",
+ "name": "Service",
"range": Array [
6,
- 10,
+ 13,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 6,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -76909,7 +84296,7 @@ Object {
},
"range": Array [
0,
- 78,
+ 115,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -76918,7 +84305,7 @@ Object {
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 0,
"line": 6,
},
"start": Object {
@@ -76928,7 +84315,7 @@ Object {
},
"range": Array [
0,
- 78,
+ 116,
],
"sourceType": "module",
"tokens": Array [
@@ -76953,7 +84340,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 13,
"line": 1,
},
"start": Object {
@@ -76963,25 +84350,25 @@ Object {
},
"range": Array [
6,
- 10,
+ 13,
],
"type": "Identifier",
- "value": "User",
+ "value": "Service",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 11,
- 12,
+ 14,
+ 15,
],
"type": "Punctuator",
"value": "{",
@@ -76989,7 +84376,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 15,
"line": 2,
},
"start": Object {
@@ -76998,98 +84385,80 @@ Object {
},
},
"range": Array [
- 17,
- 18,
+ 20,
+ 31,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Identifier",
+ "value": "constructor",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 16,
"line": 2,
},
"start": Object {
- "column": 5,
+ "column": 15,
"line": 2,
},
},
"range": Array [
- 18,
- 27,
+ 31,
+ 32,
],
- "type": "Identifier",
- "value": "adminonly",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 3,
+ "column": 17,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 16,
+ "line": 2,
},
},
"range": Array [
32,
- 38,
+ 33,
],
- "type": "Keyword",
- "value": "static",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 3,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 3,
+ "column": 17,
+ "line": 2,
},
},
"range": Array [
+ 33,
39,
- 42,
- ],
- "type": "Identifier",
- "value": "set",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 3,
- },
- },
- "range": Array [
- 43,
- 44,
],
"type": "Identifier",
- "value": "y",
+ "value": "Inject",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 3,
+ "column": 24,
+ "line": 2,
},
"start": Object {
- "column": 16,
- "line": 3,
+ "column": 23,
+ "line": 2,
},
},
"range": Array [
- 44,
- 45,
+ 39,
+ 40,
],
"type": "Punctuator",
"value": "(",
@@ -77097,35 +84466,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 3,
+ "column": 34,
+ "line": 2,
},
"start": Object {
- "column": 17,
- "line": 3,
+ "column": 24,
+ "line": 2,
},
},
"range": Array [
- 45,
- 46,
+ 40,
+ 50,
],
"type": "Identifier",
- "value": "a",
+ "value": "APP_CONFIG",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 3,
+ "column": 35,
+ "line": 2,
},
"start": Object {
- "column": 18,
- "line": 3,
+ "column": 34,
+ "line": 2,
},
},
"range": Array [
- 46,
- 47,
+ 50,
+ 51,
],
"type": "Punctuator",
"value": ")",
@@ -77133,120 +84502,66 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 3,
- },
- "start": Object {
- "column": 20,
- "line": 3,
- },
- },
- "range": Array [
- 48,
- 49,
- ],
- "type": "Punctuator",
- "value": "{",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 4,
+ "column": 42,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 4,
+ "column": 36,
+ "line": 2,
},
},
"range": Array [
+ 52,
58,
- 62,
- ],
- "type": "Keyword",
- "value": "this",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 4,
- },
- "start": Object {
- "column": 12,
- "line": 4,
- },
- },
- "range": Array [
- 62,
- 63,
- ],
- "type": "Punctuator",
- "value": ".",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 4,
- },
- "start": Object {
- "column": 13,
- "line": 4,
- },
- },
- "range": Array [
- 63,
- 65,
],
"type": "Identifier",
- "value": "_y",
+ "value": "config",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 4,
+ "column": 43,
+ "line": 2,
},
"start": Object {
- "column": 16,
- "line": 4,
+ "column": 42,
+ "line": 2,
},
},
"range": Array [
- 66,
- 67,
+ 58,
+ 59,
],
"type": "Punctuator",
- "value": "=",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 4,
+ "column": 53,
+ "line": 2,
},
"start": Object {
- "column": 18,
- "line": 4,
+ "column": 44,
+ "line": 2,
},
},
"range": Array [
- 68,
+ 60,
69,
],
"type": "Identifier",
- "value": "a",
+ "value": "AppConfig",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 4,
+ "column": 54,
+ "line": 2,
},
"start": Object {
- "column": 19,
- "line": 4,
+ "column": 53,
+ "line": 2,
},
},
"range": Array [
@@ -77254,265 +84569,202 @@ Object {
70,
],
"type": "Punctuator",
- "value": ";",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 5,
+ "column": 56,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 5,
+ "column": 55,
+ "line": 2,
},
},
"range": Array [
- 75,
- 76,
+ 71,
+ 72,
],
"type": "Punctuator",
- "value": "}",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 6,
+ "column": 12,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 6,
+ "column": 8,
+ "line": 3,
},
},
"range": Array [
- 77,
- 78,
+ 81,
+ 85,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Keyword",
+ "value": "this",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = `
-Object {
- "body": Array [
Object {
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 2,
- },
- "start": Object {
- "column": 10,
- "line": 2,
- },
- },
- "range": Array [
- 18,
- 20,
- ],
- "type": "ClassBody",
- },
- "decorators": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 1,
- },
- "start": Object {
- "column": 1,
- "line": 1,
- },
- },
- "name": "sealed",
- "range": Array [
- 1,
- 7,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 7,
- ],
- "type": "Decorator",
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 3,
},
- ],
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 2,
- },
- "start": Object {
- "column": 6,
- "line": 2,
- },
+ "start": Object {
+ "column": 12,
+ "line": 3,
},
- "name": "Qux",
- "range": Array [
- 14,
- 17,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 85,
+ 86,
+ ],
+ "type": "Punctuator",
+ "value": ".",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 2,
+ "column": 18,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 13,
+ "line": 3,
},
},
"range": Array [
- 0,
- 20,
+ 86,
+ 91,
],
- "superClass": null,
- "type": "ClassDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Identifier",
+ "value": "title",
},
- },
- "range": Array [
- 0,
- 20,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 1,
+ "column": 20,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 19,
+ "line": 3,
},
},
"range": Array [
- 0,
- 1,
+ 92,
+ 93,
],
"type": "Punctuator",
- "value": "@",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 27,
+ "line": 3,
},
"start": Object {
- "column": 1,
- "line": 1,
+ "column": 21,
+ "line": 3,
},
},
"range": Array [
- 1,
- 7,
+ 94,
+ 100,
],
"type": "Identifier",
- "value": "sealed",
+ "value": "config",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 2,
+ "column": 28,
+ "line": 3,
},
"start": Object {
- "column": 0,
- "line": 2,
+ "column": 27,
+ "line": 3,
},
},
"range": Array [
- 8,
- 13,
+ 100,
+ 101,
],
- "type": "Keyword",
- "value": "class",
+ "type": "Punctuator",
+ "value": ".",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 2,
+ "column": 33,
+ "line": 3,
},
"start": Object {
- "column": 6,
- "line": 2,
+ "column": 28,
+ "line": 3,
},
},
"range": Array [
- 14,
- 17,
+ 101,
+ 106,
],
"type": "Identifier",
- "value": "Qux",
+ "value": "title",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 2,
+ "column": 34,
+ "line": 3,
},
"start": Object {
- "column": 10,
- "line": 2,
+ "column": 33,
+ "line": 3,
},
},
"range": Array [
- 18,
- 19,
+ 106,
+ 107,
],
"type": "Punctuator",
- "value": "{",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 2,
+ "column": 5,
+ "line": 4,
},
"start": Object {
- "column": 11,
- "line": 2,
+ "column": 4,
+ "line": 4,
},
},
"range": Array [
- 19,
- 20,
+ 112,
+ 113,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 114,
+ 115,
],
"type": "Punctuator",
"value": "}",
@@ -77522,183 +84774,257 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = `
+exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = `
Object {
"body": Array [
Object {
"body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 4,
- },
- "start": Object {
- "column": 19,
- "line": 4,
- },
- },
- "range": Array [
- 56,
- 58,
- ],
- "type": "ClassBody",
- },
- "decorators": Array [
- Object {
- "expression": Object {
- "arguments": Array [
- Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 16,
+ 19,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "method",
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 16,
+ 50,
+ ],
+ "static": false,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 38,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 36,
+ "line": 2,
},
},
- "properties": Array [
- Object {
- "computed": false,
- "key": Object {
+ "range": Array [
+ 48,
+ 50,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 29,
+ 33,
+ ],
+ "raw": "true",
+ "type": "Literal",
+ "value": true,
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "name": "special",
+ "range": Array [
+ 21,
+ 28,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 21,
+ 34,
+ ],
+ "type": "CallExpression",
+ },
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 22,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 8,
"line": 2,
},
},
- "name": "selector",
"range": Array [
- 17,
- 25,
+ 20,
+ 34,
],
- "type": "Identifier",
+ "type": "Decorator",
},
- "kind": "init",
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 35,
+ 46,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 34,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 26,
"line": 2,
},
},
- "method": false,
"range": Array [
- 17,
- 32,
+ 38,
+ 46,
],
- "shorthand": false,
- "type": "Property",
- "value": Object {
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 34,
"line": 2,
},
"start": Object {
- "column": 14,
+ "column": 28,
"line": 2,
},
},
"range": Array [
- 27,
- 32,
+ 40,
+ 46,
],
- "raw": "'foo'",
- "type": "Literal",
- "value": "foo",
+ "type": "TSNumberKeyword",
},
},
- ],
- "range": Array [
- 11,
- 35,
- ],
- "type": "ObjectExpression",
- },
- ],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 1,
- },
- "start": Object {
- "column": 1,
- "line": 1,
},
- },
- "name": "Component",
+ ],
"range": Array [
- 1,
- 10,
+ 19,
+ 50,
],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 2,
- "line": 3,
- },
- "start": Object {
- "column": 1,
- "line": 1,
- },
+ "type": "FunctionExpression",
},
- "range": Array [
- 1,
- 36,
- ],
- "type": "CallExpression",
},
- "loc": Object {
- "end": Object {
- "column": 2,
- "line": 3,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
},
- "range": Array [
- 0,
- 36,
- ],
- "type": "Decorator",
},
- ],
+ "range": Array [
+ 10,
+ 52,
+ ],
+ "type": "ClassBody",
+ },
"id": Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 4,
+ "column": 9,
+ "line": 1,
},
"start": Object {
"column": 6,
- "line": 4,
+ "line": 1,
},
},
- "name": "FooComponent",
+ "name": "Foo",
"range": Array [
- 43,
- 55,
+ 6,
+ 9,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 21,
- "line": 4,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -77707,7 +85033,7 @@ Object {
},
"range": Array [
0,
- 58,
+ 52,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -77716,7 +85042,7 @@ Object {
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 0,
"line": 4,
},
"start": Object {
@@ -77726,14 +85052,14 @@ Object {
},
"range": Array [
0,
- 58,
+ 53,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 5,
"line": 1,
},
"start": Object {
@@ -77743,28 +85069,28 @@ Object {
},
"range": Array [
0,
- 1,
+ 5,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Keyword",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 1,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 1,
- 10,
+ 6,
+ 9,
],
"type": "Identifier",
- "value": "Component",
+ "value": "Foo",
},
Object {
"loc": Object {
@@ -77778,8 +85104,44 @@ Object {
},
},
"range": Array [
- 10,
- 11,
+ 10,
+ 11,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 16,
+ 19,
+ ],
+ "type": "Identifier",
+ "value": "bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 19,
+ 20,
],
"type": "Punctuator",
"value": "(",
@@ -77787,179 +85149,179 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 1,
+ "column": 9,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 8,
+ "line": 2,
},
},
"range": Array [
- 11,
- 12,
+ 20,
+ 21,
],
"type": "Punctuator",
- "value": "{",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 16,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 9,
"line": 2,
},
},
"range": Array [
- 17,
- 25,
+ 21,
+ 28,
],
"type": "Identifier",
- "value": "selector",
+ "value": "special",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 17,
"line": 2,
},
"start": Object {
- "column": 12,
+ "column": 16,
"line": 2,
},
},
"range": Array [
- 25,
- 26,
+ 28,
+ 29,
],
"type": "Punctuator",
- "value": ":",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 21,
"line": 2,
},
"start": Object {
- "column": 14,
+ "column": 17,
"line": 2,
},
},
"range": Array [
- 27,
- 32,
+ 29,
+ 33,
],
- "type": "String",
- "value": "'foo'",
+ "type": "Boolean",
+ "value": "true",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 22,
"line": 2,
},
"start": Object {
- "column": 19,
+ "column": 21,
"line": 2,
},
},
"range": Array [
- 32,
33,
+ 34,
],
"type": "Punctuator",
- "value": ",",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 26,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 23,
+ "line": 2,
},
},
"range": Array [
- 34,
35,
+ 38,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Identifier",
+ "value": "baz",
},
Object {
"loc": Object {
"end": Object {
- "column": 2,
- "line": 3,
+ "column": 27,
+ "line": 2,
},
"start": Object {
- "column": 1,
- "line": 3,
+ "column": 26,
+ "line": 2,
},
},
"range": Array [
- 35,
- 36,
+ 38,
+ 39,
],
"type": "Punctuator",
- "value": ")",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 4,
+ "column": 34,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 4,
+ "column": 28,
+ "line": 2,
},
},
"range": Array [
- 37,
- 42,
+ 40,
+ 46,
],
- "type": "Keyword",
- "value": "class",
+ "type": "Identifier",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 4,
+ "column": 35,
+ "line": 2,
},
"start": Object {
- "column": 6,
- "line": 4,
+ "column": 34,
+ "line": 2,
},
},
"range": Array [
- 43,
- 55,
+ 46,
+ 47,
],
- "type": "Identifier",
- "value": "FooComponent",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 4,
+ "column": 37,
+ "line": 2,
},
"start": Object {
- "column": 19,
- "line": 4,
+ "column": 36,
+ "line": 2,
},
},
"range": Array [
- 56,
- 57,
+ 48,
+ 49,
],
"type": "Punctuator",
"value": "{",
@@ -77967,17 +85329,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 4,
+ "column": 38,
+ "line": 2,
},
"start": Object {
- "column": 20,
- "line": 4,
+ "column": 37,
+ "line": 2,
},
},
"range": Array [
- 57,
- 58,
+ 49,
+ 50,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 51,
+ 52,
],
"type": "Punctuator",
"value": "}",
@@ -77987,7 +85367,7 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = `
+exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = `
Object {
"body": Array [
Object {
@@ -77995,104 +85375,29 @@ Object {
"body": Array [
Object {
"computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "arguments": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 14,
- "line": 2,
- },
- },
- "range": Array [
- 24,
- 29,
- ],
- "raw": "false",
- "type": "Literal",
- "value": false,
- },
- ],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "onlyRead",
- "range": Array [
- 15,
- 23,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "range": Array [
- 15,
- 30,
- ],
- "type": "CallExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 14,
- 30,
- ],
- "type": "Decorator",
- },
- ],
"key": Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 3,
+ "column": 14,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 11,
+ "line": 2,
},
},
- "name": "instanceMethod",
+ "name": "bar",
"range": Array [
- 35,
- 49,
+ 29,
+ 32,
],
"type": "Identifier",
},
"kind": "method",
"loc": Object {
"end": Object {
- "column": 23,
- "line": 3,
+ "column": 45,
+ "line": 2,
},
"start": Object {
"column": 4,
@@ -78100,10 +85405,10 @@ Object {
},
},
"range": Array [
- 14,
- 54,
+ 22,
+ 63,
],
- "static": false,
+ "static": true,
"type": "MethodDefinition",
"value": Object {
"async": false,
@@ -78111,17 +85416,17 @@ Object {
"body": Array [],
"loc": Object {
"end": Object {
- "column": 23,
- "line": 3,
+ "column": 45,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 3,
+ "column": 43,
+ "line": 2,
},
},
"range": Array [
- 52,
- 54,
+ 61,
+ 63,
],
"type": "BlockStatement",
},
@@ -78130,18 +85435,146 @@ Object {
"id": null,
"loc": Object {
"end": Object {
- "column": 23,
- "line": 3,
+ "column": 45,
+ "line": 2,
},
"start": Object {
- "column": 18,
- "line": 3,
+ "column": 14,
+ "line": 2,
},
},
- "params": Array [],
+ "params": Array [
+ Object {
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 42,
+ 46,
+ ],
+ "raw": "true",
+ "type": "Literal",
+ "value": true,
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "name": "special",
+ "range": Array [
+ 34,
+ 41,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 34,
+ 47,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 33,
+ 47,
+ ],
+ "type": "Decorator",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 41,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 2,
+ },
+ },
+ "name": "baz",
+ "range": Array [
+ 48,
+ 59,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 41,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 51,
+ 59,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 41,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 53,
+ 59,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ },
+ },
+ ],
"range": Array [
- 49,
- 54,
+ 32,
+ 63,
],
"type": "FunctionExpression",
},
@@ -78150,23 +85583,23 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 3,
},
"start": Object {
- "column": 8,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 8,
- 56,
+ 16,
+ 65,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 15,
"line": 1,
},
"start": Object {
@@ -78174,17 +85607,17 @@ Object {
"line": 1,
},
},
- "name": "B",
+ "name": "StaticFoo",
"range": Array [
6,
- 7,
+ 15,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -78193,7 +85626,7 @@ Object {
},
"range": Array [
0,
- 56,
+ 65,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -78203,7 +85636,7 @@ Object {
"loc": Object {
"end": Object {
"column": 0,
- "line": 5,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -78212,7 +85645,7 @@ Object {
},
"range": Array [
0,
- 57,
+ 66,
],
"sourceType": "module",
"tokens": Array [
@@ -78237,7 +85670,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 15,
"line": 1,
},
"start": Object {
@@ -78247,25 +85680,25 @@ Object {
},
"range": Array [
6,
- 7,
+ 15,
],
"type": "Identifier",
- "value": "B",
+ "value": "StaticFoo",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 8,
- 9,
+ 16,
+ 17,
],
"type": "Punctuator",
"value": "{",
@@ -78273,7 +85706,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 10,
"line": 2,
},
"start": Object {
@@ -78282,8 +85715,62 @@ Object {
},
},
"range": Array [
- 14,
- 15,
+ 22,
+ 28,
+ ],
+ "type": "Keyword",
+ "value": "static",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 29,
+ 32,
+ ],
+ "type": "Identifier",
+ "value": "bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 32,
+ 33,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 33,
+ 34,
],
"type": "Punctuator",
"value": "@",
@@ -78291,35 +85778,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 23,
"line": 2,
},
"start": Object {
- "column": 5,
+ "column": 16,
"line": 2,
},
},
"range": Array [
- 15,
- 23,
+ 34,
+ 41,
],
"type": "Identifier",
- "value": "onlyRead",
+ "value": "special",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 24,
"line": 2,
},
"start": Object {
- "column": 13,
+ "column": 23,
"line": 2,
},
},
"range": Array [
- 23,
- 24,
+ 41,
+ 42,
],
"type": "Punctuator",
"value": "(",
@@ -78327,35 +85814,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 28,
"line": 2,
},
"start": Object {
- "column": 14,
+ "column": 24,
"line": 2,
},
},
"range": Array [
- 24,
- 29,
+ 42,
+ 46,
],
"type": "Boolean",
- "value": "false",
+ "value": "true",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 29,
"line": 2,
},
"start": Object {
- "column": 19,
+ "column": 28,
"line": 2,
},
},
"range": Array [
- 29,
- 30,
+ 46,
+ 47,
],
"type": "Punctuator",
"value": ")",
@@ -78363,53 +85850,71 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 3,
+ "column": 33,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 30,
+ "line": 2,
},
},
"range": Array [
- 35,
- 49,
+ 48,
+ 51,
],
"type": "Identifier",
- "value": "instanceMethod",
+ "value": "baz",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 3,
+ "column": 34,
+ "line": 2,
},
"start": Object {
- "column": 18,
- "line": 3,
+ "column": 33,
+ "line": 2,
},
},
"range": Array [
- 49,
- 50,
+ 51,
+ 52,
],
"type": "Punctuator",
- "value": "(",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 3,
+ "column": 41,
+ "line": 2,
},
"start": Object {
- "column": 19,
- "line": 3,
+ "column": 35,
+ "line": 2,
},
},
"range": Array [
- 50,
- 51,
+ 53,
+ 59,
+ ],
+ "type": "Identifier",
+ "value": "number",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 59,
+ 60,
],
"type": "Punctuator",
"value": ")",
@@ -78417,17 +85922,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 3,
+ "column": 44,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 3,
+ "column": 43,
+ "line": 2,
},
},
"range": Array [
- 52,
- 53,
+ 61,
+ 62,
],
"type": "Punctuator",
"value": "{",
@@ -78435,17 +85940,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 3,
+ "column": 45,
+ "line": 2,
},
"start": Object {
- "column": 22,
- "line": 3,
+ "column": 44,
+ "line": 2,
},
},
"range": Array [
- 53,
- 54,
+ 62,
+ 63,
],
"type": "Punctuator",
"value": "}",
@@ -78454,16 +85959,16 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 3,
},
"start": Object {
"column": 0,
- "line": 4,
+ "line": 3,
},
},
"range": Array [
- 55,
- 56,
+ 64,
+ 65,
],
"type": "Punctuator",
"value": "}",
@@ -78473,7 +85978,7 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = `
+exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = `
Object {
"body": Array [
Object {
@@ -78481,104 +85986,29 @@ Object {
"body": Array [
Object {
"computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "arguments": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "range": Array [
- 19,
- 24,
- ],
- "raw": "false",
- "type": "Literal",
- "value": false,
- },
- ],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "Foo",
- "range": Array [
- 15,
- 18,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "range": Array [
- 15,
- 25,
- ],
- "type": "CallExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 14,
- 25,
- ],
- "type": "Decorator",
- },
- ],
"key": Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 3,
+ "column": 9,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 3,
+ "column": 4,
+ "line": 2,
},
},
- "name": "staticMethod",
+ "name": "greet",
"range": Array [
- 37,
- 49,
+ 20,
+ 25,
],
"type": "Identifier",
},
"kind": "method",
"loc": Object {
"end": Object {
- "column": 28,
- "line": 3,
+ "column": 5,
+ "line": 4,
},
"start": Object {
"column": 4,
@@ -78586,28 +86016,138 @@ Object {
},
},
"range": Array [
- 14,
- 54,
+ 20,
+ 95,
],
- "static": true,
+ "static": false,
"type": "MethodDefinition",
"value": Object {
"async": false,
"body": Object {
- "body": Array [],
+ "body": Array [
+ Object {
+ "argument": Object {
+ "left": Object {
+ "left": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 67,
+ 75,
+ ],
+ "raw": "\\"Hello \\"",
+ "type": "Literal",
+ "value": "Hello ",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 3,
+ },
+ },
+ "operator": "+",
+ "range": Array [
+ 67,
+ 82,
+ ],
+ "right": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 3,
+ },
+ },
+ "name": "name",
+ "range": Array [
+ 78,
+ 82,
+ ],
+ "type": "Identifier",
+ },
+ "type": "BinaryExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 3,
+ },
+ },
+ "operator": "+",
+ "range": Array [
+ 67,
+ 88,
+ ],
+ "right": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 85,
+ 88,
+ ],
+ "raw": "\\"!\\"",
+ "type": "Literal",
+ "value": "!",
+ },
+ "type": "BinaryExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 60,
+ 89,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 28,
- "line": 3,
+ "column": 5,
+ "line": 4,
},
"start": Object {
- "column": 26,
- "line": 3,
+ "column": 34,
+ "line": 2,
},
},
"range": Array [
- 52,
- 54,
+ 50,
+ 95,
],
"type": "BlockStatement",
},
@@ -78616,18 +86156,108 @@ Object {
"id": null,
"loc": Object {
"end": Object {
- "column": 28,
- "line": 3,
+ "column": 5,
+ "line": 4,
},
"start": Object {
- "column": 23,
- "line": 3,
+ "column": 9,
+ "line": 2,
},
},
- "params": Array [],
+ "params": Array [
+ Object {
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "name": "required",
+ "range": Array [
+ 27,
+ 35,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 26,
+ 35,
+ ],
+ "type": "Decorator",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 2,
+ },
+ },
+ "name": "name",
+ "range": Array [
+ 36,
+ 48,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 40,
+ 48,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 42,
+ 48,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ ],
"range": Array [
- 49,
- 54,
+ 25,
+ 95,
],
"type": "FunctionExpression",
},
@@ -78636,23 +86266,23 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 5,
},
"start": Object {
- "column": 8,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 8,
- 56,
+ 14,
+ 97,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 13,
"line": 1,
},
"start": Object {
@@ -78660,17 +86290,17 @@ Object {
"line": 1,
},
},
- "name": "C",
+ "name": "Greeter",
"range": Array [
6,
- 7,
+ 13,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -78679,7 +86309,7 @@ Object {
},
"range": Array [
0,
- 56,
+ 97,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -78689,7 +86319,7 @@ Object {
"loc": Object {
"end": Object {
"column": 0,
- "line": 5,
+ "line": 6,
},
"start": Object {
"column": 0,
@@ -78698,7 +86328,7 @@ Object {
},
"range": Array [
0,
- 57,
+ 98,
],
"sourceType": "module",
"tokens": Array [
@@ -78709,67 +86339,103 @@ Object {
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 5,
+ ],
+ "type": "Keyword",
+ "value": "class",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 6,
+ 13,
+ ],
+ "type": "Identifier",
+ "value": "Greeter",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 0,
- 5,
+ 14,
+ 15,
],
- "type": "Keyword",
- "value": "class",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 9,
+ "line": 2,
},
"start": Object {
- "column": 6,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 6,
- 7,
+ 20,
+ 25,
],
"type": "Identifier",
- "value": "C",
+ "value": "greet",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 1,
+ "column": 10,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 1,
+ "column": 9,
+ "line": 2,
},
},
"range": Array [
- 8,
- 9,
+ 25,
+ 26,
],
"type": "Punctuator",
- "value": "{",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 11,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 10,
"line": 2,
},
},
"range": Array [
- 14,
- 15,
+ 26,
+ 27,
],
"type": "Punctuator",
"value": "@",
@@ -78777,71 +86443,89 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 19,
"line": 2,
},
"start": Object {
- "column": 5,
+ "column": 11,
"line": 2,
},
},
"range": Array [
- 15,
- 18,
+ 27,
+ 35,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "required",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 24,
"line": 2,
},
"start": Object {
- "column": 8,
+ "column": 20,
"line": 2,
},
},
"range": Array [
- 18,
- 19,
+ 36,
+ 40,
+ ],
+ "type": "Identifier",
+ "value": "name",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 40,
+ 41,
],
"type": "Punctuator",
- "value": "(",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 32,
"line": 2,
},
"start": Object {
- "column": 9,
+ "column": 26,
"line": 2,
},
},
"range": Array [
- 19,
- 24,
+ 42,
+ 48,
],
- "type": "Boolean",
- "value": "false",
+ "type": "Identifier",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 33,
"line": 2,
},
"start": Object {
- "column": 14,
+ "column": 32,
"line": 2,
},
},
"range": Array [
- 24,
- 25,
+ 48,
+ 49,
],
"type": "Punctuator",
"value": ")",
@@ -78849,20 +86533,38 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 35,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 34,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 50,
+ 51,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
"line": 3,
},
"start": Object {
- "column": 4,
+ "column": 8,
"line": 3,
},
},
"range": Array [
- 30,
- 36,
+ 60,
+ 66,
],
"type": "Keyword",
- "value": "static",
+ "value": "return",
},
Object {
"loc": Object {
@@ -78871,85 +86573,121 @@ Object {
"line": 3,
},
"start": Object {
- "column": 11,
+ "column": 15,
"line": 3,
},
},
"range": Array [
- 37,
- 49,
+ 67,
+ 75,
],
- "type": "Identifier",
- "value": "staticMethod",
+ "type": "String",
+ "value": "\\"Hello \\"",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 25,
"line": 3,
},
"start": Object {
- "column": 23,
+ "column": 24,
"line": 3,
},
},
"range": Array [
- 49,
- 50,
+ 76,
+ 77,
],
"type": "Punctuator",
- "value": "(",
+ "value": "+",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 30,
"line": 3,
},
"start": Object {
- "column": 24,
+ "column": 26,
"line": 3,
},
},
"range": Array [
- 50,
- 51,
+ 78,
+ 82,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "name",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 32,
"line": 3,
},
"start": Object {
- "column": 26,
+ "column": 31,
"line": 3,
},
},
"range": Array [
- 52,
- 53,
+ 83,
+ 84,
],
"type": "Punctuator",
- "value": "{",
+ "value": "+",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 36,
"line": 3,
},
"start": Object {
- "column": 27,
+ "column": 33,
"line": 3,
},
},
"range": Array [
- 53,
- 54,
+ 85,
+ 88,
+ ],
+ "type": "String",
+ "value": "\\"!\\"",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 36,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 88,
+ 89,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 94,
+ 95,
],
"type": "Punctuator",
"value": "}",
@@ -78958,16 +86696,16 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 5,
},
"start": Object {
"column": 0,
- "line": 4,
+ "line": 5,
},
},
"range": Array [
- 55,
- 56,
+ 96,
+ 97,
],
"type": "Punctuator",
"value": "}",
@@ -78977,7 +86715,7 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = `
+exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = `
Object {
"body": Array [
Object {
@@ -78985,66 +86723,29 @@ Object {
"body": Array [
Object {
"computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "onlyRead",
- "range": Array [
- 15,
- 23,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 14,
- 23,
- ],
- "type": "Decorator",
- },
- ],
"key": Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 3,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 11,
+ "line": 2,
},
},
- "name": "instanceMethod",
+ "name": "greet",
"range": Array [
- 28,
- 42,
+ 33,
+ 38,
],
"type": "Identifier",
},
"kind": "method",
"loc": Object {
"end": Object {
- "column": 23,
- "line": 3,
+ "column": 5,
+ "line": 4,
},
"start": Object {
"column": 4,
@@ -79052,28 +86753,138 @@ Object {
},
},
"range": Array [
- 14,
- 47,
+ 26,
+ 108,
],
- "static": false,
+ "static": true,
"type": "MethodDefinition",
"value": Object {
"async": false,
"body": Object {
- "body": Array [],
+ "body": Array [
+ Object {
+ "argument": Object {
+ "left": Object {
+ "left": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 80,
+ 88,
+ ],
+ "raw": "\\"Hello \\"",
+ "type": "Literal",
+ "value": "Hello ",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 3,
+ },
+ },
+ "operator": "+",
+ "range": Array [
+ 80,
+ 95,
+ ],
+ "right": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 3,
+ },
+ },
+ "name": "name",
+ "range": Array [
+ 91,
+ 95,
+ ],
+ "type": "Identifier",
+ },
+ "type": "BinaryExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 3,
+ },
+ },
+ "operator": "+",
+ "range": Array [
+ 80,
+ 101,
+ ],
+ "right": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 98,
+ 101,
+ ],
+ "raw": "\\"!\\"",
+ "type": "Literal",
+ "value": "!",
+ },
+ "type": "BinaryExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 73,
+ 102,
+ ],
+ "type": "ReturnStatement",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 23,
- "line": 3,
+ "column": 5,
+ "line": 4,
},
"start": Object {
- "column": 21,
- "line": 3,
+ "column": 41,
+ "line": 2,
},
},
"range": Array [
- 45,
- 47,
+ 63,
+ 108,
],
"type": "BlockStatement",
},
@@ -79082,18 +86893,108 @@ Object {
"id": null,
"loc": Object {
"end": Object {
- "column": 23,
- "line": 3,
+ "column": 5,
+ "line": 4,
},
"start": Object {
- "column": 18,
- "line": 3,
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "name": "required",
+ "range": Array [
+ 40,
+ 48,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 39,
+ 48,
+ ],
+ "type": "Decorator",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 39,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 2,
+ },
+ },
+ "name": "name",
+ "range": Array [
+ 49,
+ 61,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 39,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 53,
+ 61,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 39,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 55,
+ 61,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
},
- },
- "params": Array [],
+ ],
"range": Array [
- 42,
- 47,
+ 38,
+ 108,
],
"type": "FunctionExpression",
},
@@ -79102,23 +87003,23 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 5,
},
"start": Object {
- "column": 8,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 8,
- 49,
+ 20,
+ 110,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 19,
"line": 1,
},
"start": Object {
@@ -79126,17 +87027,17 @@ Object {
"line": 1,
},
},
- "name": "A",
+ "name": "StaticGreeter",
"range": Array [
6,
- 7,
+ 19,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -79145,7 +87046,7 @@ Object {
},
"range": Array [
0,
- 49,
+ 110,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -79155,7 +87056,7 @@ Object {
"loc": Object {
"end": Object {
"column": 0,
- "line": 5,
+ "line": 6,
},
"start": Object {
"column": 0,
@@ -79164,7 +87065,7 @@ Object {
},
"range": Array [
0,
- 50,
+ 111,
],
"sourceType": "module",
"tokens": Array [
@@ -79189,7 +87090,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 19,
"line": 1,
},
"start": Object {
@@ -79199,25 +87100,25 @@ Object {
},
"range": Array [
6,
- 7,
+ 19,
],
"type": "Identifier",
- "value": "A",
+ "value": "StaticGreeter",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 8,
- 9,
+ 20,
+ 21,
],
"type": "Punctuator",
"value": "{",
@@ -79225,7 +87126,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 10,
"line": 2,
},
"start": Object {
@@ -79234,8 +87135,62 @@ Object {
},
},
"range": Array [
- 14,
- 15,
+ 26,
+ 32,
+ ],
+ "type": "Keyword",
+ "value": "static",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 33,
+ 38,
+ ],
+ "type": "Identifier",
+ "value": "greet",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 38,
+ 39,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 39,
+ 40,
],
"type": "Punctuator",
"value": "@",
@@ -79243,107 +87198,251 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 26,
"line": 2,
},
"start": Object {
- "column": 5,
+ "column": 18,
"line": 2,
},
},
"range": Array [
- 15,
- 23,
+ 40,
+ 48,
],
"type": "Identifier",
- "value": "onlyRead",
+ "value": "required",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 31,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 49,
+ 53,
+ ],
+ "type": "Identifier",
+ "value": "name",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 53,
+ 54,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 39,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 55,
+ 61,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 40,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 39,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 61,
+ 62,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 63,
+ 64,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
"line": 3,
},
"start": Object {
- "column": 4,
+ "column": 8,
"line": 3,
},
},
"range": Array [
- 28,
- 42,
+ 73,
+ 79,
],
- "type": "Identifier",
- "value": "instanceMethod",
+ "type": "Keyword",
+ "value": "return",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 23,
"line": 3,
},
"start": Object {
- "column": 18,
+ "column": 15,
"line": 3,
},
},
"range": Array [
- 42,
- 43,
+ 80,
+ 88,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "String",
+ "value": "\\"Hello \\"",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 25,
"line": 3,
},
"start": Object {
- "column": 19,
+ "column": 24,
"line": 3,
},
},
"range": Array [
- 43,
- 44,
+ 89,
+ 90,
],
"type": "Punctuator",
- "value": ")",
+ "value": "+",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 30,
"line": 3,
},
"start": Object {
- "column": 21,
+ "column": 26,
"line": 3,
},
},
"range": Array [
- 45,
- 46,
+ 91,
+ 95,
+ ],
+ "type": "Identifier",
+ "value": "name",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 96,
+ 97,
],
"type": "Punctuator",
- "value": "{",
+ "value": "+",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 36,
"line": 3,
},
"start": Object {
- "column": 22,
+ "column": 33,
"line": 3,
},
},
"range": Array [
- 46,
- 47,
+ 98,
+ 101,
+ ],
+ "type": "String",
+ "value": "\\"!\\"",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 36,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 101,
+ 102,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 107,
+ 108,
],
"type": "Punctuator",
"value": "}",
@@ -79352,16 +87451,16 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 5,
},
"start": Object {
"column": 0,
- "line": 4,
+ "line": 5,
},
},
"range": Array [
- 48,
- 49,
+ 109,
+ 110,
],
"type": "Punctuator",
"value": "}",
@@ -79371,7 +87470,7 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/method-decorators/method-decorator-static-member.src 1`] = `
+exports[`typescript fixtures/decorators/parameter-decorators/parameter-object-pattern-decorator.src 1`] = `
Object {
"body": Array [
Object {
@@ -79379,115 +87478,264 @@ Object {
"body": Array [
Object {
"computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 14,
+ 17,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "method",
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 49,
+ ],
+ "static": false,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 47,
+ 49,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 27,
+ 31,
+ ],
+ "raw": "true",
+ "type": "Literal",
+ "value": true,
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "name": "special",
+ "range": Array [
+ 19,
+ 26,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 19,
+ 32,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 18,
+ 32,
+ ],
+ "type": "Decorator",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 33,
"line": 2,
},
"start": Object {
- "column": 5,
+ "column": 21,
"line": 2,
},
- },
- "name": "Foo",
+ },
+ "properties": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 35,
+ 38,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "init",
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "method": false,
+ "range": Array [
+ 35,
+ 38,
+ ],
+ "shorthand": true,
+ "type": "Property",
+ "value": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 35,
+ 38,
+ ],
+ "type": "Identifier",
+ },
+ },
+ ],
"range": Array [
- 15,
- 18,
+ 33,
+ 45,
],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
+ "type": "ObjectPattern",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 40,
+ 45,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 42,
+ 45,
+ ],
+ "type": "TSAnyKeyword",
+ },
},
},
- "range": Array [
- 14,
- 18,
- ],
- "type": "Decorator",
- },
- ],
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 3,
- },
- "start": Object {
- "column": 11,
- "line": 3,
- },
- },
- "name": "staticMethod",
- "range": Array [
- 30,
- 42,
],
- "type": "Identifier",
- },
- "kind": "method",
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 14,
- 47,
- ],
- "static": true,
- "type": "MethodDefinition",
- "value": Object {
- "async": false,
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 3,
- },
- "start": Object {
- "column": 26,
- "line": 3,
- },
- },
- "range": Array [
- 45,
- 47,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": null,
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 3,
- },
- "start": Object {
- "column": 23,
- "line": 3,
- },
- },
- "params": Array [],
"range": Array [
- 42,
- 47,
+ 17,
+ 49,
],
"type": "FunctionExpression",
},
@@ -79496,23 +87744,23 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 3,
},
"start": Object {
- "column": 8,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 8,
- 49,
+ 10,
+ 51,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -79520,17 +87768,17 @@ Object {
"line": 1,
},
},
- "name": "D",
+ "name": "Foo",
"range": Array [
6,
- 7,
+ 9,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 4,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -79539,7 +87787,7 @@ Object {
},
"range": Array [
0,
- 49,
+ 51,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -79549,7 +87797,7 @@ Object {
"loc": Object {
"end": Object {
"column": 0,
- "line": 5,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -79558,7 +87806,7 @@ Object {
},
"range": Array [
0,
- 50,
+ 52,
],
"sourceType": "module",
"tokens": Array [
@@ -79583,7 +87831,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -79593,25 +87841,25 @@ Object {
},
"range": Array [
6,
- 7,
+ 9,
],
"type": "Identifier",
- "value": "D",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 8,
- 9,
+ 10,
+ 11,
],
"type": "Punctuator",
"value": "{",
@@ -79623,21 +87871,21 @@ Object {
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 2,
"line": 2,
},
},
"range": Array [
14,
- 15,
+ 17,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Identifier",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 6,
"line": 2,
},
"start": Object {
@@ -79646,62 +87894,62 @@ Object {
},
},
"range": Array [
- 15,
+ 17,
18,
],
- "type": "Identifier",
- "value": "Foo",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 3,
+ "column": 7,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 6,
+ "line": 2,
},
},
"range": Array [
- 23,
- 29,
+ 18,
+ 19,
],
- "type": "Keyword",
- "value": "static",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 3,
+ "column": 14,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 3,
+ "column": 7,
+ "line": 2,
},
},
"range": Array [
- 30,
- 42,
+ 19,
+ 26,
],
"type": "Identifier",
- "value": "staticMethod",
+ "value": "special",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 3,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 23,
- "line": 3,
+ "column": 14,
+ "line": 2,
},
},
"range": Array [
- 42,
- 43,
+ 26,
+ 27,
],
"type": "Punctuator",
"value": "(",
@@ -79709,17 +87957,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 3,
+ "column": 19,
+ "line": 2,
},
"start": Object {
- "column": 24,
- "line": 3,
+ "column": 15,
+ "line": 2,
},
},
"range": Array [
- 43,
- 44,
+ 27,
+ 31,
+ ],
+ "type": "Boolean",
+ "value": "true",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 31,
+ 32,
],
"type": "Punctuator",
"value": ")",
@@ -79727,35 +87993,53 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 3,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 26,
- "line": 3,
+ "column": 21,
+ "line": 2,
},
},
"range": Array [
- 45,
- 46,
+ 33,
+ 34,
],
"type": "Punctuator",
"value": "{",
},
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 35,
+ 38,
+ ],
+ "type": "Identifier",
+ "value": "bar",
+ },
Object {
"loc": Object {
"end": Object {
"column": 28,
- "line": 3,
+ "line": 2,
},
"start": Object {
"column": 27,
- "line": 3,
+ "line": 2,
},
},
"range": Array [
- 46,
- 47,
+ 39,
+ 40,
],
"type": "Punctuator",
"value": "}",
@@ -79763,229 +88047,176 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 4,
+ "column": 29,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 4,
+ "column": 28,
+ "line": 2,
},
},
"range": Array [
- 48,
- 49,
+ 40,
+ 41,
],
"type": "Punctuator",
- "value": "}",
+ "value": ":",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = `
-Object {
- "body": Array [
Object {
- "body": Object {
- "body": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "name": "constructor",
- "range": Array [
- 20,
- 31,
- ],
- "type": "Identifier",
- },
- "kind": "constructor",
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 4,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 20,
- 113,
- ],
- "static": false,
- "type": "MethodDefinition",
- "value": Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "expression": Object {
- "left": Object {
- "computed": false,
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "object": Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "range": Array [
- 81,
- 85,
- ],
- "type": "ThisExpression",
- },
- "property": Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 3,
- },
- "start": Object {
- "column": 13,
- "line": 3,
- },
- },
- "name": "title",
- "range": Array [
- 86,
- 91,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 81,
- 91,
- ],
- "type": "MemberExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "operator": "=",
- "range": Array [
- 81,
- 106,
- ],
- "right": Object {
- "computed": false,
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 3,
- },
- "start": Object {
- "column": 21,
- "line": 3,
- },
- },
- "object": Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 3,
- },
- "start": Object {
- "column": 21,
- "line": 3,
- },
- },
- "name": "config",
- "range": Array [
- 94,
- 100,
- ],
- "type": "Identifier",
- },
- "property": Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 3,
- },
- "start": Object {
- "column": 28,
- "line": 3,
- },
- },
- "name": "title",
- "range": Array [
- 101,
- 106,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 94,
- 106,
- ],
- "type": "MemberExpression",
- },
- "type": "AssignmentExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "range": Array [
- 81,
- 107,
- ],
- "type": "ExpressionStatement",
- },
- ],
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 42,
+ 45,
+ ],
+ "type": "Identifier",
+ "value": "any",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 45,
+ 46,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 47,
+ 48,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 36,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 48,
+ 49,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 50,
+ 51,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 14,
+ 17,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "method",
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 48,
+ ],
+ "static": false,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
"loc": Object {
"end": Object {
- "column": 5,
- "line": 4,
+ "column": 36,
+ "line": 2,
},
"start": Object {
- "column": 55,
+ "column": 34,
"line": 2,
},
},
"range": Array [
- 71,
- 113,
+ 46,
+ 48,
],
"type": "BlockStatement",
},
@@ -79994,16 +88225,34 @@ Object {
"id": null,
"loc": Object {
"end": Object {
- "column": 5,
- "line": 4,
+ "column": 36,
+ "line": 2,
},
"start": Object {
- "column": 15,
+ "column": 5,
"line": 2,
},
},
"params": Array [
Object {
+ "argument": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 2,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 36,
+ 39,
+ ],
+ "type": "Identifier",
+ },
"decorators": Array [
Object {
"expression": Object {
@@ -80011,146 +88260,128 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 34,
+ "column": 19,
"line": 2,
},
"start": Object {
- "column": 24,
+ "column": 15,
"line": 2,
},
},
- "name": "APP_CONFIG",
"range": Array [
- 40,
- 50,
+ 27,
+ 31,
],
- "type": "Identifier",
+ "raw": "true",
+ "type": "Literal",
+ "value": true,
},
],
"callee": Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 14,
"line": 2,
},
"start": Object {
- "column": 17,
+ "column": 7,
"line": 2,
},
},
- "name": "Inject",
+ "name": "special",
"range": Array [
- 33,
- 39,
+ 19,
+ 26,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 20,
"line": 2,
},
"start": Object {
- "column": 17,
+ "column": 7,
"line": 2,
},
},
"range": Array [
- 33,
- 51,
+ 19,
+ 32,
],
"type": "CallExpression",
},
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 20,
"line": 2,
},
"start": Object {
- "column": 16,
+ "column": 6,
"line": 2,
},
},
"range": Array [
+ 18,
32,
- 51,
],
"type": "Decorator",
},
],
"loc": Object {
"end": Object {
- "column": 53,
+ "column": 32,
"line": 2,
},
"start": Object {
- "column": 36,
+ "column": 6,
"line": 2,
},
},
- "name": "config",
"range": Array [
- 52,
- 69,
+ 18,
+ 44,
],
- "type": "Identifier",
+ "type": "RestElement",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 53,
+ "column": 32,
"line": 2,
},
"start": Object {
- "column": 42,
+ "column": 27,
"line": 2,
},
},
"range": Array [
- 58,
- 69,
+ 39,
+ 44,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 53,
+ "column": 32,
"line": 2,
},
"start": Object {
- "column": 44,
+ "column": 29,
"line": 2,
},
},
"range": Array [
- 60,
- 69,
+ 41,
+ 44,
],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 53,
- "line": 2,
- },
- "start": Object {
- "column": 44,
- "line": 2,
- },
- },
- "name": "AppConfig",
- "range": Array [
- 60,
- 69,
- ],
- "type": "Identifier",
- },
+ "type": "TSAnyKeyword",
},
},
},
],
"range": Array [
- 31,
- 113,
+ 17,
+ 48,
],
"type": "FunctionExpression",
},
@@ -80159,23 +88390,23 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 5,
+ "line": 3,
},
"start": Object {
- "column": 14,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 14,
- 115,
+ 10,
+ 50,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -80183,17 +88414,17 @@ Object {
"line": 1,
},
},
- "name": "Service",
+ "name": "Foo",
"range": Array [
6,
- 13,
+ 9,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 5,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -80202,7 +88433,7 @@ Object {
},
"range": Array [
0,
- 115,
+ 50,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -80212,7 +88443,7 @@ Object {
"loc": Object {
"end": Object {
"column": 0,
- "line": 6,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -80221,7 +88452,7 @@ Object {
},
"range": Array [
0,
- 116,
+ 51,
],
"sourceType": "module",
"tokens": Array [
@@ -80246,7 +88477,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -80256,25 +88487,25 @@ Object {
},
"range": Array [
6,
- 13,
+ 9,
],
"type": "Identifier",
- "value": "Service",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 14,
- 15,
+ 10,
+ 11,
],
"type": "Punctuator",
"value": "{",
@@ -80282,35 +88513,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 5,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 2,
"line": 2,
},
},
"range": Array [
- 20,
- 31,
+ 14,
+ 17,
],
"type": "Identifier",
- "value": "constructor",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 6,
"line": 2,
},
"start": Object {
- "column": 15,
+ "column": 5,
"line": 2,
},
},
"range": Array [
- 31,
- 32,
+ 17,
+ 18,
],
"type": "Punctuator",
"value": "(",
@@ -80318,17 +88549,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 7,
"line": 2,
},
"start": Object {
- "column": 16,
+ "column": 6,
"line": 2,
},
},
"range": Array [
- 32,
- 33,
+ 18,
+ 19,
],
"type": "Punctuator",
"value": "@",
@@ -80336,35 +88567,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 14,
"line": 2,
},
"start": Object {
- "column": 17,
+ "column": 7,
"line": 2,
},
},
"range": Array [
- 33,
- 39,
+ 19,
+ 26,
],
"type": "Identifier",
- "value": "Inject",
+ "value": "special",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 15,
"line": 2,
},
"start": Object {
- "column": 23,
+ "column": 14,
"line": 2,
},
},
"range": Array [
- 39,
- 40,
+ 26,
+ 27,
],
"type": "Punctuator",
"value": "(",
@@ -80372,35 +88603,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 34,
+ "column": 19,
"line": 2,
},
"start": Object {
- "column": 24,
+ "column": 15,
"line": 2,
},
},
"range": Array [
- 40,
- 50,
+ 27,
+ 31,
],
- "type": "Identifier",
- "value": "APP_CONFIG",
+ "type": "Boolean",
+ "value": "true",
},
Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 20,
"line": 2,
},
"start": Object {
- "column": 34,
+ "column": 19,
"line": 2,
},
},
"range": Array [
- 50,
- 51,
+ 31,
+ 32,
],
"type": "Punctuator",
"value": ")",
@@ -80408,251 +88639,125 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 42,
- "line": 2,
- },
- "start": Object {
- "column": 36,
- "line": 2,
- },
- },
- "range": Array [
- 52,
- 58,
- ],
- "type": "Identifier",
- "value": "config",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 43,
+ "column": 24,
"line": 2,
},
"start": Object {
- "column": 42,
+ "column": 21,
"line": 2,
},
},
"range": Array [
- 58,
- 59,
+ 33,
+ 36,
],
"type": "Punctuator",
- "value": ":",
+ "value": "...",
},
Object {
"loc": Object {
"end": Object {
- "column": 53,
+ "column": 27,
"line": 2,
},
"start": Object {
- "column": 44,
+ "column": 24,
"line": 2,
},
},
"range": Array [
- 60,
- 69,
+ 36,
+ 39,
],
"type": "Identifier",
- "value": "AppConfig",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 54,
+ "column": 28,
"line": 2,
},
"start": Object {
- "column": 53,
+ "column": 27,
"line": 2,
},
},
"range": Array [
- 69,
- 70,
+ 39,
+ 40,
],
"type": "Punctuator",
- "value": ")",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 56,
+ "column": 32,
"line": 2,
},
"start": Object {
- "column": 55,
+ "column": 29,
"line": 2,
},
},
"range": Array [
- 71,
- 72,
- ],
- "type": "Punctuator",
- "value": "{",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "range": Array [
- 81,
- 85,
- ],
- "type": "Keyword",
- "value": "this",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 3,
- },
- "start": Object {
- "column": 12,
- "line": 3,
- },
- },
- "range": Array [
- 85,
- 86,
- ],
- "type": "Punctuator",
- "value": ".",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 3,
- },
- "start": Object {
- "column": 13,
- "line": 3,
- },
- },
- "range": Array [
- 86,
- 91,
- ],
- "type": "Identifier",
- "value": "title",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 3,
- },
- "start": Object {
- "column": 19,
- "line": 3,
- },
- },
- "range": Array [
- 92,
- 93,
- ],
- "type": "Punctuator",
- "value": "=",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 3,
- },
- "start": Object {
- "column": 21,
- "line": 3,
- },
- },
- "range": Array [
- 94,
- 100,
- ],
- "type": "Identifier",
- "value": "config",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 3,
- },
- "start": Object {
- "column": 27,
- "line": 3,
- },
- },
- "range": Array [
- 100,
- 101,
+ 41,
+ 44,
],
- "type": "Punctuator",
- "value": ".",
+ "type": "Identifier",
+ "value": "any",
},
Object {
"loc": Object {
"end": Object {
"column": 33,
- "line": 3,
+ "line": 2,
},
"start": Object {
- "column": 28,
- "line": 3,
+ "column": 32,
+ "line": 2,
},
},
"range": Array [
- 101,
- 106,
+ 44,
+ 45,
],
- "type": "Identifier",
- "value": "title",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 34,
- "line": 3,
+ "column": 35,
+ "line": 2,
},
"start": Object {
- "column": 33,
- "line": 3,
+ "column": 34,
+ "line": 2,
},
},
"range": Array [
- 106,
- 107,
+ 46,
+ 47,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 4,
+ "column": 36,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 4,
+ "column": 35,
+ "line": 2,
},
},
"range": Array [
- 112,
- 113,
+ 47,
+ 48,
],
"type": "Punctuator",
"value": "}",
@@ -80661,16 +88766,16 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 5,
+ "line": 3,
},
"start": Object {
"column": 0,
- "line": 5,
+ "line": 3,
},
},
"range": Array [
- 114,
- 115,
+ 49,
+ 50,
],
"type": "Punctuator",
"value": "}",
@@ -80680,7 +88785,7 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = `
+exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = `
Object {
"body": Array [
Object {
@@ -80688,28 +88793,82 @@ Object {
"body": Array [
Object {
"computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "name": "Input",
+ "range": Array [
+ 27,
+ 32,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 27,
+ 34,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 26,
+ 34,
+ ],
+ "type": "Decorator",
+ },
+ ],
"key": Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 17,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 13,
"line": 2,
},
},
- "name": "bar",
+ "name": "data",
"range": Array [
- 16,
- 19,
+ 35,
+ 39,
],
"type": "Identifier",
},
- "kind": "method",
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 18,
"line": 2,
},
"start": Object {
@@ -80718,201 +88877,162 @@ Object {
},
},
"range": Array [
- 16,
- 50,
+ 26,
+ 40,
],
"static": false,
- "type": "MethodDefinition",
- "value": Object {
- "async": false,
- "body": Object {
- "body": Array [],
+ "type": "ClassProperty",
+ "value": null,
+ },
+ Object {
+ "computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 3,
+ },
+ },
+ "name": "Output",
+ "range": Array [
+ 46,
+ 52,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 46,
+ 54,
+ ],
+ "type": "CallExpression",
+ },
"loc": Object {
"end": Object {
- "column": 38,
- "line": 2,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 36,
- "line": 2,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 48,
- 50,
+ 45,
+ 54,
],
- "type": "BlockStatement",
+ "type": "Decorator",
},
- "expression": false,
- "generator": false,
- "id": null,
+ ],
+ "key": Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 2,
+ "column": 9,
+ "line": 4,
},
"start": Object {
- "column": 7,
- "line": 2,
+ "column": 4,
+ "line": 4,
},
},
- "params": Array [
- Object {
- "decorators": Array [
- Object {
- "expression": Object {
- "arguments": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 2,
- },
- "start": Object {
- "column": 17,
- "line": 2,
- },
- },
- "range": Array [
- 29,
- 33,
- ],
- "raw": "true",
- "type": "Literal",
- "value": true,
- },
- ],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "name": "special",
- "range": Array [
- 21,
- 28,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "range": Array [
- 21,
- 34,
- ],
- "type": "CallExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 2,
- },
- "start": Object {
- "column": 8,
- "line": 2,
- },
- },
- "range": Array [
- 20,
- 34,
- ],
- "type": "Decorator",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 2,
- },
- "start": Object {
- "column": 23,
- "line": 2,
- },
+ "name": "click",
+ "range": Array [
+ 59,
+ 64,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 45,
+ 86,
+ ],
+ "static": false,
+ "type": "ClassProperty",
+ "value": Object {
+ "arguments": Array [],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 4,
},
- "name": "baz",
- "range": Array [
- 35,
- 46,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 2,
- },
- "start": Object {
- "column": 26,
- "line": 2,
- },
- },
- "range": Array [
- 38,
- 46,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 2,
- },
- "start": Object {
- "column": 28,
- "line": 2,
- },
- },
- "range": Array [
- 40,
- 46,
- ],
- "type": "TSNumberKeyword",
- },
+ "start": Object {
+ "column": 16,
+ "line": 4,
},
},
- ],
+ "name": "EventEmitter",
+ "range": Array [
+ 71,
+ 83,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 4,
+ },
+ },
"range": Array [
- 19,
- 50,
+ 67,
+ 85,
],
- "type": "FunctionExpression",
+ "type": "NewExpression",
},
},
],
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 5,
},
"start": Object {
- "column": 10,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 10,
- 52,
+ 20,
+ 88,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 19,
"line": 1,
},
"start": Object {
@@ -80920,17 +89040,17 @@ Object {
"line": 1,
},
},
- "name": "Foo",
+ "name": "SomeComponent",
"range": Array [
6,
- 9,
+ 19,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -80939,7 +89059,7 @@ Object {
},
"range": Array [
0,
- 52,
+ 88,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -80948,8 +89068,8 @@ Object {
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 4,
+ "column": 1,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -80958,7 +89078,7 @@ Object {
},
"range": Array [
0,
- 53,
+ 88,
],
"sourceType": "module",
"tokens": Array [
@@ -80983,7 +89103,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 19,
"line": 1,
},
"start": Object {
@@ -80993,25 +89113,25 @@ Object {
},
"range": Array [
6,
- 9,
+ 19,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "SomeComponent",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 10,
- 11,
+ 20,
+ 21,
],
"type": "Punctuator",
"value": "{",
@@ -81019,7 +89139,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 5,
"line": 2,
},
"start": Object {
@@ -81028,26 +89148,44 @@ Object {
},
},
"range": Array [
- 16,
- 19,
+ 26,
+ 27,
+ ],
+ "type": "Punctuator",
+ "value": "@",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 27,
+ 32,
],
"type": "Identifier",
- "value": "bar",
+ "value": "Input",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 11,
"line": 2,
},
"start": Object {
- "column": 7,
+ "column": 10,
"line": 2,
},
},
"range": Array [
- 19,
- 20,
+ 32,
+ 33,
],
"type": "Punctuator",
"value": "(",
@@ -81055,17 +89193,71 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 12,
"line": 2,
},
"start": Object {
- "column": 8,
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 33,
+ 34,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 35,
+ 39,
+ ],
+ "type": "Identifier",
+ "value": "data",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 17,
"line": 2,
},
},
"range": Array [
- 20,
- 21,
+ 39,
+ 40,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 45,
+ 46,
],
"type": "Punctuator",
"value": "@",
@@ -81073,35 +89265,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 2,
+ "column": 11,
+ "line": 3,
},
"start": Object {
- "column": 9,
- "line": 2,
+ "column": 5,
+ "line": 3,
},
},
"range": Array [
- 21,
- 28,
+ 46,
+ 52,
],
"type": "Identifier",
- "value": "special",
+ "value": "Output",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 2,
+ "column": 12,
+ "line": 3,
},
"start": Object {
- "column": 16,
- "line": 2,
+ "column": 11,
+ "line": 3,
},
},
"range": Array [
- 28,
- 29,
+ 52,
+ 53,
],
"type": "Punctuator",
"value": "(",
@@ -81109,161 +89301,161 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 2,
+ "column": 13,
+ "line": 3,
},
"start": Object {
- "column": 17,
- "line": 2,
+ "column": 12,
+ "line": 3,
},
},
"range": Array [
- 29,
- 33,
+ 53,
+ 54,
],
- "type": "Boolean",
- "value": "true",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
- "line": 2,
+ "column": 9,
+ "line": 4,
},
"start": Object {
- "column": 21,
- "line": 2,
+ "column": 4,
+ "line": 4,
},
},
"range": Array [
- 33,
- 34,
+ 59,
+ 64,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "click",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 2,
+ "column": 11,
+ "line": 4,
},
"start": Object {
- "column": 23,
- "line": 2,
+ "column": 10,
+ "line": 4,
},
},
"range": Array [
- 35,
- 38,
+ 65,
+ 66,
],
- "type": "Identifier",
- "value": "baz",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 2,
+ "column": 15,
+ "line": 4,
},
"start": Object {
- "column": 26,
- "line": 2,
+ "column": 12,
+ "line": 4,
},
},
"range": Array [
- 38,
- 39,
+ 67,
+ 70,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Keyword",
+ "value": "new",
},
Object {
"loc": Object {
"end": Object {
- "column": 34,
- "line": 2,
+ "column": 28,
+ "line": 4,
},
"start": Object {
- "column": 28,
- "line": 2,
+ "column": 16,
+ "line": 4,
},
},
"range": Array [
- 40,
- 46,
+ 71,
+ 83,
],
"type": "Identifier",
- "value": "number",
+ "value": "EventEmitter",
},
Object {
"loc": Object {
"end": Object {
- "column": 35,
- "line": 2,
+ "column": 29,
+ "line": 4,
},
"start": Object {
- "column": 34,
- "line": 2,
+ "column": 28,
+ "line": 4,
},
},
"range": Array [
- 46,
- 47,
+ 83,
+ 84,
],
"type": "Punctuator",
- "value": ")",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 2,
+ "column": 30,
+ "line": 4,
},
"start": Object {
- "column": 36,
- "line": 2,
+ "column": 29,
+ "line": 4,
},
},
"range": Array [
- 48,
- 49,
+ 84,
+ 85,
],
"type": "Punctuator",
- "value": "{",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 2,
+ "column": 31,
+ "line": 4,
},
"start": Object {
- "column": 37,
- "line": 2,
+ "column": 30,
+ "line": 4,
},
},
"range": Array [
- 49,
- 50,
+ 85,
+ 86,
],
"type": "Punctuator",
- "value": "}",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 5,
},
"start": Object {
"column": 0,
- "line": 3,
+ "line": 5,
},
},
"range": Array [
- 51,
- 52,
+ 87,
+ 88,
],
"type": "Punctuator",
"value": "}",
@@ -81273,7 +89465,7 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = `
+exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = `
Object {
"body": Array [
Object {
@@ -81281,28 +89473,102 @@ Object {
"body": Array [
Object {
"computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 28,
+ 32,
+ ],
+ "raw": "true",
+ "type": "Literal",
+ "value": true,
+ },
+ ],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "name": "configurable",
+ "range": Array [
+ 15,
+ 27,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 15,
+ 33,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 33,
+ ],
+ "type": "Decorator",
+ },
+ ],
"key": Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 36,
"line": 2,
},
"start": Object {
- "column": 11,
+ "column": 31,
"line": 2,
},
},
- "name": "bar",
+ "name": "prop1",
"range": Array [
- 29,
- 32,
+ 41,
+ 46,
],
"type": "Identifier",
},
- "kind": "method",
"loc": Object {
"end": Object {
- "column": 45,
+ "column": 37,
"line": 2,
},
"start": Object {
@@ -81311,201 +89577,147 @@ Object {
},
},
"range": Array [
- 22,
- 63,
+ 14,
+ 47,
],
"static": true,
- "type": "MethodDefinition",
- "value": Object {
- "async": false,
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 45,
- "line": 2,
- },
- "start": Object {
- "column": 43,
- "line": 2,
- },
- },
- "range": Array [
- 61,
- 63,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": null,
- "loc": Object {
- "end": Object {
- "column": 45,
- "line": 2,
- },
- "start": Object {
- "column": 14,
- "line": 2,
- },
- },
- "params": Array [
- Object {
- "decorators": Array [
+ "type": "ClassProperty",
+ "value": null,
+ },
+ Object {
+ "computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [
Object {
- "expression": Object {
- "arguments": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 2,
- },
- "start": Object {
- "column": 24,
- "line": 2,
- },
- },
- "range": Array [
- 42,
- 46,
- ],
- "raw": "true",
- "type": "Literal",
- "value": true,
- },
- ],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "name": "special",
- "range": Array [
- 34,
- 41,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "range": Array [
- 34,
- 47,
- ],
- "type": "CallExpression",
- },
"loc": Object {
"end": Object {
- "column": 29,
- "line": 2,
+ "column": 23,
+ "line": 4,
},
"start": Object {
- "column": 15,
- "line": 2,
+ "column": 18,
+ "line": 4,
},
},
"range": Array [
- 33,
- 47,
+ 67,
+ 72,
],
- "type": "Decorator",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 41,
- "line": 2,
- },
- "start": Object {
- "column": 30,
- "line": 2,
+ "raw": "false",
+ "type": "Literal",
+ "value": false,
},
- },
- "name": "baz",
- "range": Array [
- 48,
- 59,
],
- "type": "Identifier",
- "typeAnnotation": Object {
+ "callee": Object {
"loc": Object {
"end": Object {
- "column": 41,
- "line": 2,
+ "column": 17,
+ "line": 4,
},
"start": Object {
- "column": 33,
- "line": 2,
+ "column": 5,
+ "line": 4,
},
},
+ "name": "configurable",
"range": Array [
- 51,
- 59,
+ 54,
+ 66,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 41,
- "line": 2,
- },
- "start": Object {
- "column": 35,
- "line": 2,
- },
- },
- "range": Array [
- 53,
- 59,
- ],
- "type": "TSNumberKeyword",
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 4,
},
},
+ "range": Array [
+ 54,
+ 73,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 4,
+ },
},
- ],
+ "range": Array [
+ 53,
+ 73,
+ ],
+ "type": "Decorator",
+ },
+ ],
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 5,
+ },
+ },
+ "name": "prop2",
"range": Array [
- 32,
- 63,
+ 85,
+ 90,
],
- "type": "FunctionExpression",
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 4,
+ },
},
+ "range": Array [
+ 53,
+ 91,
+ ],
+ "static": true,
+ "type": "ClassProperty",
+ "value": null,
},
],
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 6,
},
"start": Object {
- "column": 16,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 16,
- 65,
+ 8,
+ 93,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -81513,17 +89725,17 @@ Object {
"line": 1,
},
},
- "name": "StaticFoo",
+ "name": "A",
"range": Array [
6,
- 15,
+ 7,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 6,
},
"start": Object {
"column": 0,
@@ -81532,7 +89744,7 @@ Object {
},
"range": Array [
0,
- 65,
+ 93,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -81541,8 +89753,8 @@ Object {
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 4,
+ "column": 1,
+ "line": 6,
},
"start": Object {
"column": 0,
@@ -81551,7 +89763,7 @@ Object {
},
"range": Array [
0,
- 66,
+ 93,
],
"sourceType": "module",
"tokens": Array [
@@ -81576,7 +89788,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -81586,25 +89798,25 @@ Object {
},
"range": Array [
6,
- 15,
+ 7,
],
"type": "Identifier",
- "value": "StaticFoo",
+ "value": "A",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 16,
- 17,
+ 8,
+ 9,
],
"type": "Punctuator",
"value": "{",
@@ -81612,7 +89824,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 5,
"line": 2,
},
"start": Object {
@@ -81621,44 +89833,44 @@ Object {
},
},
"range": Array [
- 22,
- 28,
+ 14,
+ 15,
],
- "type": "Keyword",
- "value": "static",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 17,
"line": 2,
},
"start": Object {
- "column": 11,
+ "column": 5,
"line": 2,
},
},
"range": Array [
- 29,
- 32,
+ 15,
+ 27,
],
"type": "Identifier",
- "value": "bar",
+ "value": "configurable",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 18,
"line": 2,
},
"start": Object {
- "column": 14,
+ "column": 17,
"line": 2,
},
},
"range": Array [
- 32,
- 33,
+ 27,
+ 28,
],
"type": "Punctuator",
"value": "(",
@@ -81666,20 +89878,20 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 22,
"line": 2,
},
"start": Object {
- "column": 15,
+ "column": 18,
"line": 2,
},
},
"range": Array [
- 33,
- 34,
+ 28,
+ 32,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Boolean",
+ "value": "true",
},
Object {
"loc": Object {
@@ -81688,61 +89900,61 @@ Object {
"line": 2,
},
"start": Object {
- "column": 16,
+ "column": 22,
"line": 2,
},
},
"range": Array [
- 34,
- 41,
+ 32,
+ 33,
],
- "type": "Identifier",
- "value": "special",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 30,
"line": 2,
},
"start": Object {
- "column": 23,
+ "column": 24,
"line": 2,
},
},
"range": Array [
- 41,
- 42,
+ 34,
+ 40,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Keyword",
+ "value": "static",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 36,
"line": 2,
},
"start": Object {
- "column": 24,
+ "column": 31,
"line": 2,
},
},
"range": Array [
- 42,
+ 41,
46,
],
- "type": "Boolean",
- "value": "true",
+ "type": "Identifier",
+ "value": "prop1",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 37,
"line": 2,
},
"start": Object {
- "column": 28,
+ "column": 36,
"line": 2,
},
},
@@ -81751,76 +89963,94 @@ Object {
47,
],
"type": "Punctuator",
- "value": ")",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
- "line": 2,
+ "column": 5,
+ "line": 4,
},
"start": Object {
- "column": 30,
- "line": 2,
+ "column": 4,
+ "line": 4,
},
},
"range": Array [
- 48,
- 51,
+ 53,
+ 54,
+ ],
+ "type": "Punctuator",
+ "value": "@",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 54,
+ 66,
],
"type": "Identifier",
- "value": "baz",
+ "value": "configurable",
},
Object {
"loc": Object {
"end": Object {
- "column": 34,
- "line": 2,
+ "column": 18,
+ "line": 4,
},
"start": Object {
- "column": 33,
- "line": 2,
+ "column": 17,
+ "line": 4,
},
},
"range": Array [
- 51,
- 52,
+ 66,
+ 67,
],
"type": "Punctuator",
- "value": ":",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 41,
- "line": 2,
+ "column": 23,
+ "line": 4,
},
"start": Object {
- "column": 35,
- "line": 2,
+ "column": 18,
+ "line": 4,
},
},
"range": Array [
- 53,
- 59,
+ 67,
+ 72,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Boolean",
+ "value": "false",
},
Object {
"loc": Object {
"end": Object {
- "column": 42,
- "line": 2,
+ "column": 24,
+ "line": 4,
},
"start": Object {
- "column": 41,
- "line": 2,
+ "column": 23,
+ "line": 4,
},
},
"range": Array [
- 59,
- 60,
+ 72,
+ 73,
],
"type": "Punctuator",
"value": ")",
@@ -81828,53 +90058,71 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 44,
- "line": 2,
+ "column": 10,
+ "line": 5,
},
"start": Object {
- "column": 43,
- "line": 2,
+ "column": 4,
+ "line": 5,
},
},
"range": Array [
- 61,
- 62,
+ 78,
+ 84,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Keyword",
+ "value": "static",
},
Object {
"loc": Object {
"end": Object {
- "column": 45,
- "line": 2,
+ "column": 16,
+ "line": 5,
},
"start": Object {
- "column": 44,
- "line": 2,
+ "column": 11,
+ "line": 5,
},
},
"range": Array [
- 62,
- 63,
+ 85,
+ 90,
+ ],
+ "type": "Identifier",
+ "value": "prop2",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 90,
+ 91,
],
"type": "Punctuator",
- "value": "}",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 3,
+ "line": 6,
},
"start": Object {
"column": 0,
- "line": 3,
+ "line": 6,
},
},
"range": Array [
- 64,
- 65,
+ 92,
+ 93,
],
"type": "Punctuator",
"value": "}",
@@ -81884,7 +90132,7 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = `
+exports[`typescript fixtures/decorators/property-decorators/property-decorator-instance-member.src 1`] = `
Object {
"body": Array [
Object {
@@ -81892,29 +90140,65 @@ Object {
"body": Array [
Object {
"computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 2,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 15,
+ 18,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 18,
+ ],
+ "type": "Decorator",
+ },
+ ],
"key": Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 10,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 9,
"line": 2,
},
},
- "name": "greet",
+ "name": "x",
"range": Array [
+ 19,
20,
- 25,
],
"type": "Identifier",
},
- "kind": "method",
"loc": Object {
"end": Object {
- "column": 5,
- "line": 4,
+ "column": 11,
+ "line": 2,
},
"start": Object {
"column": 4,
@@ -81922,251 +90206,87 @@ Object {
},
},
"range": Array [
- 20,
- 95,
- ],
- "static": false,
- "type": "MethodDefinition",
- "value": Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "left": Object {
- "left": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 3,
- },
- },
- "range": Array [
- 67,
- 75,
- ],
- "raw": "\\"Hello \\"",
- "type": "Literal",
- "value": "Hello ",
- },
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 3,
- },
- },
- "operator": "+",
- "range": Array [
- 67,
- 82,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 3,
- },
- "start": Object {
- "column": 26,
- "line": 3,
- },
- },
- "name": "name",
- "range": Array [
- 78,
- 82,
- ],
- "type": "Identifier",
- },
- "type": "BinaryExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 3,
- },
- },
- "operator": "+",
- "range": Array [
- 67,
- 88,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 3,
- },
- "start": Object {
- "column": 33,
- "line": 3,
- },
- },
- "range": Array [
- 85,
- 88,
- ],
- "raw": "\\"!\\"",
- "type": "Literal",
- "value": "!",
- },
- "type": "BinaryExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "range": Array [
- 60,
- 89,
- ],
- "type": "ReturnStatement",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 4,
- },
- "start": Object {
- "column": 34,
- "line": 2,
- },
- },
- "range": Array [
- 50,
- 95,
- ],
- "type": "BlockStatement",
- },
- "expression": false,
- "generator": false,
- "id": null,
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 4,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "params": Array [
- Object {
- "decorators": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "name": "required",
- "range": Array [
- 27,
- 35,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 10,
- "line": 2,
- },
- },
- "range": Array [
- 26,
- 35,
- ],
- "type": "Decorator",
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 2,
- },
- "start": Object {
- "column": 20,
- "line": 2,
- },
- },
- "name": "name",
- "range": Array [
- 36,
- 48,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 2,
- },
- "start": Object {
- "column": 24,
- "line": 2,
- },
- },
- "range": Array [
- 40,
- 48,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 2,
- },
- "start": Object {
- "column": 26,
- "line": 2,
- },
- },
- "range": Array [
- 42,
- 48,
- ],
- "type": "TSStringKeyword",
+ 14,
+ 21,
+ ],
+ "static": false,
+ "type": "ClassProperty",
+ "value": null,
+ },
+ Object {
+ "computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 3,
},
},
+ "name": "bar",
+ "range": Array [
+ 27,
+ 30,
+ ],
+ "type": "Identifier",
},
- ],
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 26,
+ 30,
+ ],
+ "type": "Decorator",
+ },
+ ],
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 4,
+ },
+ },
+ "name": "y",
"range": Array [
- 25,
- 95,
+ 35,
+ 36,
],
- "type": "FunctionExpression",
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
},
+ "range": Array [
+ 26,
+ 37,
+ ],
+ "static": false,
+ "type": "ClassProperty",
+ "value": null,
},
],
"loc": Object {
@@ -82175,20 +90295,20 @@ Object {
"line": 5,
},
"start": Object {
- "column": 14,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 14,
- 97,
+ 8,
+ 39,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -82196,10 +90316,10 @@ Object {
"line": 1,
},
},
- "name": "Greeter",
+ "name": "B",
"range": Array [
6,
- 13,
+ 7,
],
"type": "Identifier",
},
@@ -82215,7 +90335,7 @@ Object {
},
"range": Array [
0,
- 97,
+ 39,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -82224,8 +90344,8 @@ Object {
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 0,
- "line": 6,
+ "column": 1,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -82234,7 +90354,7 @@ Object {
},
"range": Array [
0,
- 98,
+ 39,
],
"sourceType": "module",
"tokens": Array [
@@ -82259,7 +90379,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -82269,25 +90389,25 @@ Object {
},
"range": Array [
6,
- 13,
+ 7,
],
"type": "Identifier",
- "value": "Greeter",
+ "value": "B",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 14,
- 15,
+ 8,
+ 9,
],
"type": "Punctuator",
"value": "{",
@@ -82295,7 +90415,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 5,
"line": 2,
},
"start": Object {
@@ -82304,44 +90424,8 @@ Object {
},
},
"range": Array [
- 20,
- 25,
- ],
- "type": "Identifier",
- "value": "greet",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "range": Array [
- 25,
- 26,
- ],
- "type": "Punctuator",
- "value": "(",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 2,
- },
- "start": Object {
- "column": 10,
- "line": 2,
- },
- },
- "range": Array [
- 26,
- 27,
+ 14,
+ 15,
],
"type": "Punctuator",
"value": "@",
@@ -82349,561 +90433,307 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "range": Array [
- 27,
- 35,
- ],
- "type": "Identifier",
- "value": "required",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 24,
+ "column": 8,
"line": 2,
},
"start": Object {
- "column": 20,
+ "column": 5,
"line": 2,
},
},
"range": Array [
- 36,
- 40,
+ 15,
+ 18,
],
"type": "Identifier",
- "value": "name",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 2,
- },
- "start": Object {
- "column": 24,
- "line": 2,
- },
- },
- "range": Array [
- 40,
- 41,
- ],
- "type": "Punctuator",
- "value": ":",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 32,
+ "column": 10,
"line": 2,
},
"start": Object {
- "column": 26,
+ "column": 9,
"line": 2,
},
},
"range": Array [
- 42,
- 48,
+ 19,
+ 20,
],
"type": "Identifier",
- "value": "string",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 2,
- },
- "start": Object {
- "column": 32,
- "line": 2,
- },
- },
- "range": Array [
- 48,
- 49,
- ],
- "type": "Punctuator",
- "value": ")",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 11,
"line": 2,
},
"start": Object {
- "column": 34,
+ "column": 10,
"line": 2,
},
},
"range": Array [
- 50,
- 51,
+ 20,
+ 21,
],
"type": "Punctuator",
- "value": "{",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
- },
- "range": Array [
- 60,
- 66,
- ],
- "type": "Keyword",
- "value": "return",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 3,
- },
- },
- "range": Array [
- 67,
- 75,
- ],
- "type": "String",
- "value": "\\"Hello \\"",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 5,
"line": 3,
},
"start": Object {
- "column": 24,
+ "column": 4,
"line": 3,
},
},
"range": Array [
- 76,
- 77,
+ 26,
+ 27,
],
"type": "Punctuator",
- "value": "+",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 8,
"line": 3,
},
"start": Object {
- "column": 26,
+ "column": 5,
"line": 3,
},
},
"range": Array [
- 78,
- 82,
+ 27,
+ 30,
],
"type": "Identifier",
- "value": "name",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 3,
- },
- "start": Object {
- "column": 31,
- "line": 3,
- },
- },
- "range": Array [
- 83,
- 84,
- ],
- "type": "Punctuator",
- "value": "+",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 3,
- },
- "start": Object {
- "column": 33,
- "line": 3,
- },
- },
- "range": Array [
- 85,
- 88,
- ],
- "type": "String",
- "value": "\\"!\\"",
+ "value": "bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 3,
+ "column": 5,
+ "line": 4,
},
"start": Object {
- "column": 36,
- "line": 3,
+ "column": 4,
+ "line": 4,
},
},
"range": Array [
- 88,
- 89,
+ 35,
+ 36,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "y",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 6,
"line": 4,
},
"start": Object {
- "column": 4,
+ "column": 5,
"line": 4,
},
},
"range": Array [
- 94,
- 95,
+ 36,
+ 37,
],
"type": "Punctuator",
- "value": "}",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
"column": 1,
"line": 5,
- },
- "start": Object {
- "column": 0,
- "line": 5,
- },
- },
- "range": Array [
- 96,
- 97,
- ],
- "type": "Punctuator",
- "value": "}",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = `
-Object {
- "body": Array [
- Object {
- "body": Object {
- "body": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 2,
- },
- "start": Object {
- "column": 11,
- "line": 2,
- },
- },
- "name": "greet",
- "range": Array [
- 33,
- 38,
- ],
- "type": "Identifier",
- },
- "kind": "method",
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 4,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 26,
- 108,
- ],
- "static": true,
- "type": "MethodDefinition",
- "value": Object {
- "async": false,
- "body": Object {
- "body": Array [
- Object {
- "argument": Object {
- "left": Object {
- "left": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 3,
- },
- },
- "range": Array [
- 80,
- 88,
- ],
- "raw": "\\"Hello \\"",
- "type": "Literal",
- "value": "Hello ",
- },
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 3,
- },
- },
- "operator": "+",
- "range": Array [
- 80,
- 95,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 3,
- },
- "start": Object {
- "column": 26,
- "line": 3,
- },
- },
- "name": "name",
- "range": Array [
- 91,
- 95,
- ],
- "type": "Identifier",
- },
- "type": "BinaryExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 3,
- },
- "start": Object {
- "column": 15,
- "line": 3,
- },
- },
- "operator": "+",
- "range": Array [
- 80,
- 101,
- ],
- "right": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 3,
- },
- "start": Object {
- "column": 33,
- "line": 3,
- },
- },
- "range": Array [
- 98,
- 101,
- ],
- "raw": "\\"!\\"",
- "type": "Literal",
- "value": "!",
- },
- "type": "BinaryExpression",
+ },
+ "start": Object {
+ "column": 0,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 38,
+ 39,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/decorators/property-decorators/property-decorator-static-member.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
},
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 3,
- },
- "start": Object {
- "column": 8,
- "line": 3,
- },
+ "start": Object {
+ "column": 5,
+ "line": 2,
},
- "range": Array [
- 73,
- 102,
- ],
- "type": "ReturnStatement",
},
- ],
+ "name": "baz",
+ "range": Array [
+ 15,
+ 18,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 5,
- "line": 4,
+ "column": 8,
+ "line": 2,
},
"start": Object {
- "column": 41,
+ "column": 4,
"line": 2,
},
},
"range": Array [
- 63,
- 108,
+ 14,
+ 18,
],
- "type": "BlockStatement",
+ "type": "Decorator",
},
- "expression": false,
- "generator": false,
- "id": null,
+ ],
+ "key": Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 4,
+ "column": 17,
+ "line": 2,
},
"start": Object {
"column": 16,
"line": 2,
},
},
- "params": Array [
- Object {
- "decorators": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 2,
- },
- "start": Object {
- "column": 18,
- "line": 2,
- },
- },
- "name": "required",
- "range": Array [
- 40,
- 48,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 2,
- },
- "start": Object {
- "column": 17,
- "line": 2,
- },
- },
- "range": Array [
- 39,
- 48,
- ],
- "type": "Decorator",
- },
- ],
+ "name": "a",
+ "range": Array [
+ 26,
+ 27,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 28,
+ ],
+ "static": true,
+ "type": "ClassProperty",
+ "value": null,
+ },
+ Object {
+ "computed": false,
+ "decorators": Array [
+ Object {
+ "expression": Object {
"loc": Object {
"end": Object {
- "column": 39,
- "line": 2,
+ "column": 8,
+ "line": 3,
},
"start": Object {
- "column": 27,
- "line": 2,
+ "column": 5,
+ "line": 3,
},
},
- "name": "name",
+ "name": "qux",
"range": Array [
- 49,
- 61,
+ 34,
+ 37,
],
"type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 39,
- "line": 2,
- },
- "start": Object {
- "column": 31,
- "line": 2,
- },
- },
- "range": Array [
- 53,
- 61,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 39,
- "line": 2,
- },
- "start": Object {
- "column": 33,
- "line": 2,
- },
- },
- "range": Array [
- 55,
- 61,
- ],
- "type": "TSStringKeyword",
- },
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
},
},
- ],
+ "range": Array [
+ 33,
+ 37,
+ ],
+ "type": "Decorator",
+ },
+ ],
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 4,
+ },
+ },
+ "name": "b",
"range": Array [
- 38,
- 108,
+ 49,
+ 50,
],
- "type": "FunctionExpression",
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
},
+ "range": Array [
+ 33,
+ 51,
+ ],
+ "static": true,
+ "type": "ClassProperty",
+ "value": null,
},
],
"loc": Object {
@@ -82912,20 +90742,20 @@ Object {
"line": 5,
},
"start": Object {
- "column": 20,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 20,
- 110,
+ 8,
+ 53,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -82933,10 +90763,10 @@ Object {
"line": 1,
},
},
- "name": "StaticGreeter",
+ "name": "C",
"range": Array [
6,
- 19,
+ 7,
],
"type": "Identifier",
},
@@ -82952,7 +90782,7 @@ Object {
},
"range": Array [
0,
- 110,
+ 53,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -82971,7 +90801,7 @@ Object {
},
"range": Array [
0,
- 111,
+ 54,
],
"sourceType": "module",
"tokens": Array [
@@ -82996,7 +90826,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 7,
"line": 1,
},
"start": Object {
@@ -83006,25 +90836,25 @@ Object {
},
"range": Array [
6,
- 19,
+ 7,
],
"type": "Identifier",
- "value": "StaticGreeter",
+ "value": "C",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 20,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 20,
- 21,
+ 8,
+ 9,
],
"type": "Punctuator",
"value": "{",
@@ -83032,7 +90862,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 5,
"line": 2,
},
"start": Object {
@@ -83041,29 +90871,47 @@ Object {
},
},
"range": Array [
- 26,
- 32,
+ 14,
+ 15,
],
- "type": "Keyword",
- "value": "static",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 8,
"line": 2,
},
"start": Object {
- "column": 11,
+ "column": 5,
"line": 2,
},
},
"range": Array [
- 33,
- 38,
+ 15,
+ 18,
],
"type": "Identifier",
- "value": "greet",
+ "value": "baz",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 19,
+ 25,
+ ],
+ "type": "Keyword",
+ "value": "static",
},
Object {
"loc": Object {
@@ -83077,11 +90925,11 @@ Object {
},
},
"range": Array [
- 38,
- 39,
+ 26,
+ 27,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "a",
},
Object {
"loc": Object {
@@ -83095,8 +90943,26 @@ Object {
},
},
"range": Array [
- 39,
- 40,
+ 27,
+ 28,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 33,
+ 34,
],
"type": "Punctuator",
"value": "@",
@@ -83104,107 +90970,241 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 2,
+ "column": 8,
+ "line": 3,
},
"start": Object {
- "column": 18,
- "line": 2,
+ "column": 5,
+ "line": 3,
},
},
"range": Array [
- 40,
- 48,
+ 34,
+ 37,
],
"type": "Identifier",
- "value": "required",
+ "value": "qux",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 2,
+ "column": 10,
+ "line": 4,
},
"start": Object {
- "column": 27,
- "line": 2,
+ "column": 4,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 42,
+ 48,
+ ],
+ "type": "Keyword",
+ "value": "static",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 4,
},
},
"range": Array [
49,
- 53,
+ 50,
],
"type": "Identifier",
- "value": "name",
+ "value": "b",
},
Object {
"loc": Object {
"end": Object {
- "column": 32,
- "line": 2,
+ "column": 13,
+ "line": 4,
},
"start": Object {
- "column": 31,
- "line": 2,
+ "column": 12,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 50,
+ 51,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 52,
+ 53,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/errorRecovery/class-empty-extends.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 22,
+ ],
+ "type": "ClassBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 6,
+ 9,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 22,
+ ],
+ "superClass": null,
+ "type": "ClassDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 23,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 53,
- 54,
+ 0,
+ 5,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Keyword",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 39,
- "line": 2,
+ "column": 9,
+ "line": 1,
},
"start": Object {
- "column": 33,
- "line": 2,
+ "column": 6,
+ "line": 1,
},
},
"range": Array [
- 55,
- 61,
+ 6,
+ 9,
],
"type": "Identifier",
- "value": "string",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 40,
- "line": 2,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 39,
- "line": 2,
+ "column": 10,
+ "line": 1,
},
},
"range": Array [
- 61,
- 62,
+ 10,
+ 17,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Keyword",
+ "value": "extends",
},
Object {
"loc": Object {
"end": Object {
- "column": 42,
- "line": 2,
+ "column": 19,
+ "line": 1,
},
"start": Object {
- "column": 41,
- "line": 2,
+ "column": 18,
+ "line": 1,
},
},
"range": Array [
- 63,
- 64,
+ 18,
+ 19,
],
"type": "Punctuator",
"value": "{",
@@ -83212,418 +91212,295 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 1,
"line": 3,
},
"start": Object {
- "column": 8,
+ "column": 0,
"line": 3,
},
},
"range": Array [
- 73,
- 79,
+ 21,
+ 22,
],
- "type": "Keyword",
- "value": "return",
+ "type": "Punctuator",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/errorRecovery/class-empty-extends-implements.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 33,
+ 37,
+ ],
+ "type": "ClassBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 6,
+ 9,
+ ],
+ "type": "Identifier",
+ },
+ "implements": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
+ },
+ "name": "Bar",
+ "range": Array [
+ 29,
+ 32,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 29,
+ 32,
+ ],
+ "type": "TSClassImplements",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 1,
"line": 3,
},
"start": Object {
- "column": 15,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 80,
- 88,
+ 0,
+ 37,
],
- "type": "String",
- "value": "\\"Hello \\"",
+ "superClass": null,
+ "type": "ClassDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 38,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 3,
+ "column": 5,
+ "line": 1,
},
"start": Object {
- "column": 24,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 89,
- 90,
+ 0,
+ 5,
],
- "type": "Punctuator",
- "value": "+",
+ "type": "Keyword",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
- "line": 3,
+ "column": 9,
+ "line": 1,
},
"start": Object {
- "column": 26,
- "line": 3,
+ "column": 6,
+ "line": 1,
},
},
"range": Array [
- 91,
- 95,
+ 6,
+ 9,
],
"type": "Identifier",
- "value": "name",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 32,
- "line": 3,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 31,
- "line": 3,
+ "column": 10,
+ "line": 1,
},
},
"range": Array [
- 96,
- 97,
+ 10,
+ 17,
],
- "type": "Punctuator",
- "value": "+",
+ "type": "Keyword",
+ "value": "extends",
},
Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 3,
+ "column": 28,
+ "line": 1,
},
"start": Object {
- "column": 33,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
},
"range": Array [
- 98,
- 101,
+ 18,
+ 28,
],
- "type": "String",
- "value": "\\"!\\"",
+ "type": "Keyword",
+ "value": "implements",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 3,
+ "column": 32,
+ "line": 1,
},
"start": Object {
- "column": 36,
- "line": 3,
+ "column": 29,
+ "line": 1,
},
},
"range": Array [
- 101,
- 102,
+ 29,
+ 32,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "Bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 4,
+ "column": 34,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 4,
+ "column": 33,
+ "line": 1,
},
},
"range": Array [
- 107,
- 108,
+ 33,
+ 34,
],
"type": "Punctuator",
- "value": "}",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
"column": 1,
- "line": 5,
+ "line": 3,
},
"start": Object {
"column": 0,
- "line": 5,
+ "line": 3,
},
},
- "range": Array [
- 109,
- 110,
- ],
- "type": "Punctuator",
- "value": "}",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = `
-Object {
- "body": Array [
- Object {
- "body": Object {
- "body": Array [
- Object {
- "computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "arguments": Array [],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "Input",
- "range": Array [
- 27,
- 32,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "range": Array [
- 27,
- 34,
- ],
- "type": "CallExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 26,
- 34,
- ],
- "type": "Decorator",
- },
- ],
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 13,
- "line": 2,
- },
- },
- "name": "data",
- "range": Array [
- 35,
- 39,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 26,
- 40,
- ],
- "static": false,
- "type": "ClassProperty",
- "value": null,
- },
- Object {
- "computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "arguments": Array [],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 3,
- },
- "start": Object {
- "column": 5,
- "line": 3,
- },
- },
- "name": "Output",
- "range": Array [
- 46,
- 52,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 3,
- },
- "start": Object {
- "column": 5,
- "line": 3,
- },
- },
- "range": Array [
- 46,
- 54,
- ],
- "type": "CallExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "range": Array [
- 45,
- 54,
- ],
- "type": "Decorator",
- },
- ],
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 4,
- },
- "start": Object {
- "column": 4,
- "line": 4,
- },
- },
- "name": "click",
- "range": Array [
- 59,
- 64,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 4,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "range": Array [
- 45,
- 86,
- ],
- "static": false,
- "type": "ClassProperty",
- "value": Object {
- "arguments": Array [],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 4,
- },
- "start": Object {
- "column": 16,
- "line": 4,
- },
- },
- "name": "EventEmitter",
- "range": Array [
- 71,
- 83,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 4,
- },
- "start": Object {
- "column": 12,
- "line": 4,
- },
- },
- "range": Array [
- 67,
- 85,
- ],
- "type": "NewExpression",
- },
- },
- ],
+ "range": Array [
+ 36,
+ 37,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/errorRecovery/class-extends-empty-implements.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
"loc": Object {
"end": Object {
"column": 1,
- "line": 5,
+ "line": 3,
},
"start": Object {
- "column": 20,
+ "column": 33,
"line": 1,
},
},
"range": Array [
- 20,
- 88,
+ 33,
+ 37,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -83631,17 +91508,18 @@ Object {
"line": 1,
},
},
- "name": "SomeComponent",
+ "name": "Foo",
"range": Array [
6,
- 19,
+ 9,
],
"type": "Identifier",
},
+ "implements": Array [],
"loc": Object {
"end": Object {
"column": 1,
- "line": 5,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -83650,17 +91528,34 @@ Object {
},
"range": Array [
0,
- 88,
+ 37,
],
- "superClass": null,
+ "superClass": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "name": "Bar",
+ "range": Array [
+ 18,
+ 21,
+ ],
+ "type": "Identifier",
+ },
"type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 5,
+ "column": 0,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -83669,7 +91564,7 @@ Object {
},
"range": Array [
0,
- 88,
+ 38,
],
"sourceType": "module",
"tokens": Array [
@@ -83694,7 +91589,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -83704,349 +91599,565 @@ Object {
},
"range": Array [
6,
- 19,
+ 9,
],
"type": "Identifier",
- "value": "SomeComponent",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 20,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 20,
- 21,
+ 10,
+ 17,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Keyword",
+ "value": "extends",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 2,
+ "column": 21,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 18,
+ "line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 18,
+ 21,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Identifier",
+ "value": "Bar",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 2,
+ "column": 32,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 2,
+ "column": 22,
+ "line": 1,
},
},
"range": Array [
- 27,
+ 22,
32,
],
- "type": "Identifier",
- "value": "Input",
+ "type": "Keyword",
+ "value": "implements",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 2,
+ "column": 34,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 2,
+ "column": 33,
+ "line": 1,
},
},
"range": Array [
- 32,
33,
+ 34,
],
"type": "Punctuator",
- "value": "(",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 2,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 11,
- "line": 2,
+ "column": 0,
+ "line": 3,
},
},
"range": Array [
- 33,
- 34,
+ 36,
+ 37,
],
"type": "Punctuator",
- "value": ")",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/errorRecovery/class-multiple-implements.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 34,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 34,
+ 36,
+ ],
+ "type": "ClassBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 6,
+ 7,
+ ],
+ "type": "Identifier",
+ },
+ "implements": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "name": "b",
+ "range": Array [
+ 19,
+ 20,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 19,
+ 20,
+ ],
+ "type": "TSClassImplements",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 17,
- "line": 2,
+ "column": 36,
+ "line": 1,
},
"start": Object {
- "column": 13,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 35,
- 39,
+ 0,
+ 36,
+ ],
+ "superClass": null,
+ "type": "ClassDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 37,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 5,
+ ],
+ "type": "Keyword",
+ "value": "class",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 6,
+ 7,
],
"type": "Identifier",
- "value": "data",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
"column": 18,
- "line": 2,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 2,
+ "column": 8,
+ "line": 1,
},
},
"range": Array [
- 39,
- 40,
+ 8,
+ 18,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Keyword",
+ "value": "implements",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 3,
+ "column": 20,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 19,
+ "line": 1,
},
},
"range": Array [
- 45,
- 46,
+ 19,
+ 20,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Identifier",
+ "value": "b",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 3,
+ "column": 31,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 3,
+ "column": 21,
+ "line": 1,
},
},
"range": Array [
- 46,
- 52,
+ 21,
+ 31,
],
- "type": "Identifier",
- "value": "Output",
+ "type": "Keyword",
+ "value": "implements",
},
Object {
"loc": Object {
"end": Object {
- "column": 12,
- "line": 3,
+ "column": 33,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 3,
+ "column": 32,
+ "line": 1,
},
},
"range": Array [
- 52,
- 53,
+ 32,
+ 33,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "c",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
- "line": 3,
+ "column": 35,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 3,
+ "column": 34,
+ "line": 1,
},
},
"range": Array [
- 53,
- 54,
+ 34,
+ 35,
],
"type": "Punctuator",
- "value": ")",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 4,
+ "column": 36,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 4,
+ "column": 35,
+ "line": 1,
},
},
"range": Array [
- 59,
- 64,
+ 35,
+ 36,
],
- "type": "Identifier",
- "value": "click",
+ "type": "Punctuator",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/errorRecovery/decorator-on-enum-declaration.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "name": "dec",
+ "range": Array [
+ 1,
+ 4,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 4,
+ ],
+ "type": "Decorator",
+ },
+ ],
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "name": "E",
+ "range": Array [
+ 10,
+ 11,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 11,
- "line": 4,
+ "column": 14,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
+ "members": Array [],
"range": Array [
- 65,
- 66,
+ 0,
+ 14,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "TSEnumDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 14,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 4,
+ "column": 1,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 67,
- 70,
+ 0,
+ 1,
],
- "type": "Keyword",
- "value": "new",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
- "line": 4,
+ "column": 4,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 4,
+ "column": 1,
+ "line": 1,
},
},
"range": Array [
- 71,
- 83,
+ 1,
+ 4,
],
"type": "Identifier",
- "value": "EventEmitter",
+ "value": "dec",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 4,
+ "column": 9,
+ "line": 1,
},
"start": Object {
- "column": 28,
- "line": 4,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 83,
- 84,
+ 5,
+ 9,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Keyword",
+ "value": "enum",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
- "line": 4,
+ "column": 11,
+ "line": 1,
},
"start": Object {
- "column": 29,
- "line": 4,
+ "column": 10,
+ "line": 1,
},
},
"range": Array [
- 84,
- 85,
+ 10,
+ 11,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "E",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 4,
+ "column": 13,
+ "line": 1,
},
"start": Object {
- "column": 30,
- "line": 4,
+ "column": 12,
+ "line": 1,
},
},
"range": Array [
- 85,
- 86,
+ 12,
+ 13,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 5,
+ "column": 14,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 5,
+ "column": 13,
+ "line": 1,
},
},
"range": Array [
- 87,
- 88,
+ 13,
+ 14,
],
"type": "Punctuator",
"value": "}",
@@ -84056,296 +92167,109 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = `
+exports[`typescript fixtures/errorRecovery/decorator-on-function.src 1`] = `
Object {
"body": Array [
Object {
+ "async": false,
"body": Object {
- "body": Array [
- Object {
- "computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "arguments": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 2,
- },
- "start": Object {
- "column": 18,
- "line": 2,
- },
- },
- "range": Array [
- 28,
- 32,
- ],
- "raw": "true",
- "type": "Literal",
- "value": true,
- },
- ],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "configurable",
- "range": Array [
- 15,
- 27,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "range": Array [
- 15,
- 33,
- ],
- "type": "CallExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 14,
- 33,
- ],
- "type": "Decorator",
- },
- ],
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 2,
- },
- "start": Object {
- "column": 31,
- "line": 2,
- },
- },
- "name": "prop1",
- "range": Array [
- 41,
- 46,
- ],
- "type": "Identifier",
- },
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 17,
+ 19,
+ ],
+ "type": "BlockStatement",
+ },
+ "decorators": Array [
+ Object {
+ "expression": Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 2,
+ "column": 4,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 1,
+ "line": 1,
},
},
+ "name": "dec",
"range": Array [
- 14,
- 47,
+ 1,
+ 4,
],
- "static": true,
- "type": "ClassProperty",
- "value": null,
+ "type": "Identifier",
},
- Object {
- "computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "arguments": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 4,
- },
- "start": Object {
- "column": 18,
- "line": 4,
- },
- },
- "range": Array [
- 67,
- 72,
- ],
- "raw": "false",
- "type": "Literal",
- "value": false,
- },
- ],
- "callee": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 4,
- },
- "start": Object {
- "column": 5,
- "line": 4,
- },
- },
- "name": "configurable",
- "range": Array [
- 54,
- 66,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 4,
- },
- "start": Object {
- "column": 5,
- "line": 4,
- },
- },
- "range": Array [
- 54,
- 73,
- ],
- "type": "CallExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 4,
- },
- "start": Object {
- "column": 4,
- "line": 4,
- },
- },
- "range": Array [
- 53,
- 73,
- ],
- "type": "Decorator",
- },
- ],
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 5,
- },
- "start": Object {
- "column": 11,
- "line": 5,
- },
- },
- "name": "prop2",
- "range": Array [
- 85,
- 90,
- ],
- "type": "Identifier",
+ "loc": Object {
+ "end": Object {
+ "column": 4,
+ "line": 1,
},
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 5,
- },
- "start": Object {
- "column": 4,
- "line": 4,
- },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
- "range": Array [
- 53,
- 91,
- ],
- "static": true,
- "type": "ClassProperty",
- "value": null,
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 6,
- },
- "start": Object {
- "column": 8,
- "line": 1,
},
+ "range": Array [
+ 0,
+ 4,
+ ],
+ "type": "Decorator",
},
- "range": Array [
- 8,
- 93,
- ],
- "type": "ClassBody",
- },
+ ],
+ "expression": false,
+ "generator": false,
"id": Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 10,
+ "line": 2,
},
"start": Object {
- "column": 6,
- "line": 1,
+ "column": 9,
+ "line": 2,
},
},
- "name": "A",
+ "name": "b",
"range": Array [
- 6,
- 7,
+ 14,
+ 15,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 1,
- "line": 6,
+ "column": 14,
+ "line": 2,
},
"start": Object {
"column": 0,
"line": 1,
},
},
+ "params": Array [],
"range": Array [
0,
- 93,
+ 19,
],
- "superClass": null,
- "type": "ClassDeclaration",
+ "type": "FunctionDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 6,
+ "column": 0,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -84354,14 +92278,14 @@ Object {
},
"range": Array [
0,
- 93,
+ 20,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 1,
"line": 1,
},
"start": Object {
@@ -84371,55 +92295,55 @@ Object {
},
"range": Array [
0,
- 5,
+ 1,
],
- "type": "Keyword",
- "value": "class",
+ "type": "Punctuator",
+ "value": "@",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 4,
"line": 1,
},
"start": Object {
- "column": 6,
+ "column": 1,
"line": 1,
},
},
"range": Array [
- 6,
- 7,
+ 1,
+ 4,
],
"type": "Identifier",
- "value": "A",
+ "value": "dec",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 1,
+ "column": 8,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 1,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 8,
- 9,
+ 5,
+ 13,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Keyword",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 10,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 9,
"line": 2,
},
},
@@ -84427,149 +92351,229 @@ Object {
14,
15,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Identifier",
+ "value": "b",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 11,
"line": 2,
},
"start": Object {
- "column": 5,
+ "column": 10,
"line": 2,
},
},
"range": Array [
15,
- 27,
+ 16,
],
- "type": "Identifier",
- "value": "configurable",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 12,
"line": 2,
},
"start": Object {
- "column": 17,
+ "column": 11,
"line": 2,
},
},
"range": Array [
- 27,
- 28,
+ 16,
+ 17,
],
"type": "Punctuator",
- "value": "(",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 13,
"line": 2,
},
"start": Object {
- "column": 18,
+ "column": 12,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 17,
+ 18,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
"line": 2,
},
- },
- "range": Array [
- 28,
- 32,
+ },
+ "range": Array [
+ 18,
+ 19,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 20,
+ 22,
+ ],
+ "type": "TSInterfaceBody",
+ },
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "name": "deco",
+ "range": Array [
+ 1,
+ 5,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 1,
+ 7,
+ ],
+ "type": "CallExpression",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 7,
+ ],
+ "type": "Decorator",
+ },
],
- "type": "Boolean",
- "value": "true",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 22,
- "line": 2,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 2,
+ },
},
+ "name": "M",
+ "range": Array [
+ 18,
+ 19,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 32,
- 33,
- ],
- "type": "Punctuator",
- "value": ")",
- },
- Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 14,
"line": 2,
},
"start": Object {
- "column": 24,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 34,
- 40,
+ 0,
+ 22,
],
- "type": "Keyword",
- "value": "static",
+ "type": "TSInterfaceDeclaration",
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 2,
- },
- "start": Object {
- "column": 31,
- "line": 2,
- },
- },
- "range": Array [
- 41,
- 46,
- ],
- "type": "Identifier",
- "value": "prop1",
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 2,
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 2,
- },
- "start": Object {
- "column": 36,
- "line": 2,
- },
- },
- "range": Array [
- 46,
- 47,
- ],
- "type": "Punctuator",
- "value": ";",
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 22,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 4,
+ "column": 1,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 53,
- 54,
+ 0,
+ 1,
],
"type": "Punctuator",
"value": "@",
@@ -84577,35 +92581,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 4,
+ "column": 5,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 4,
+ "column": 1,
+ "line": 1,
},
},
"range": Array [
- 54,
- 66,
+ 1,
+ 5,
],
"type": "Identifier",
- "value": "configurable",
+ "value": "deco",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 4,
+ "column": 6,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 4,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 66,
- 67,
+ 5,
+ 6,
],
"type": "Punctuator",
"value": "(",
@@ -84613,35 +92617,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 4,
- },
- "start": Object {
- "column": 18,
- "line": 4,
- },
- },
- "range": Array [
- 67,
- 72,
- ],
- "type": "Boolean",
- "value": "false",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 4,
+ "column": 7,
+ "line": 1,
},
"start": Object {
- "column": 23,
- "line": 4,
+ "column": 6,
+ "line": 1,
},
},
"range": Array [
- 72,
- 73,
+ 6,
+ 7,
],
"type": "Punctuator",
"value": ")",
@@ -84649,71 +92635,71 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 5,
+ "column": 9,
+ "line": 2,
},
"start": Object {
- "column": 4,
- "line": 5,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
- 78,
- 84,
+ 8,
+ 17,
],
"type": "Keyword",
- "value": "static",
+ "value": "interface",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 5,
+ "column": 11,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 5,
+ "column": 10,
+ "line": 2,
},
},
"range": Array [
- 85,
- 90,
+ 18,
+ 19,
],
"type": "Identifier",
- "value": "prop2",
+ "value": "M",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 5,
+ "column": 13,
+ "line": 2,
},
"start": Object {
- "column": 16,
- "line": 5,
+ "column": 12,
+ "line": 2,
},
},
"range": Array [
- 90,
- 91,
+ 20,
+ 21,
],
"type": "Punctuator",
- "value": ";",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 6,
+ "column": 14,
+ "line": 2,
},
"start": Object {
- "column": 0,
- "line": 6,
+ "column": 13,
+ "line": 2,
},
},
"range": Array [
- 92,
- 93,
+ 21,
+ 22,
],
"type": "Punctuator",
"value": "}",
@@ -84723,201 +92709,126 @@ Object {
}
`;
-exports[`typescript fixtures/decorators/property-decorators/property-decorator-instance-member.src 1`] = `
+exports[`typescript fixtures/errorRecovery/decorator-on-variable.src 1`] = `
Object {
"body": Array [
Object {
- "body": Object {
- "body": Array [
- Object {
- "computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "foo",
- "range": Array [
- 15,
- 18,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 14,
- 18,
- ],
- "type": "Decorator",
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 2,
},
- ],
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
+ "start": Object {
+ "column": 6,
+ "line": 2,
},
- "name": "x",
- "range": Array [
- 19,
- 20,
- ],
- "type": "Identifier",
},
+ "name": "a",
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Identifier",
+ },
+ "init": Object {
"loc": Object {
"end": Object {
"column": 11,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 10,
"line": 2,
},
},
"range": Array [
- 14,
- 21,
+ 18,
+ 19,
],
- "static": false,
- "type": "ClassProperty",
- "value": null,
+ "raw": "1",
+ "type": "Literal",
+ "value": 1,
},
- Object {
- "computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 3,
- },
- "start": Object {
- "column": 5,
- "line": 3,
- },
- },
- "name": "bar",
- "range": Array [
- 27,
- 30,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "range": Array [
- 26,
- 30,
- ],
- "type": "Decorator",
- },
- ],
- "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 19,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "decorators": Array [
+ Object {
+ "expression": Object {
+ "arguments": Array [],
+ "callee": Object {
"loc": Object {
"end": Object {
"column": 5,
- "line": 4,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 4,
+ "column": 1,
+ "line": 1,
},
},
- "name": "y",
+ "name": "deco",
"range": Array [
- 35,
- 36,
+ 1,
+ 5,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 6,
- "line": 4,
+ "column": 7,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 1,
+ "line": 1,
},
},
"range": Array [
- 26,
- 37,
+ 1,
+ 7,
],
- "static": false,
- "type": "ClassProperty",
- "value": null,
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 5,
- },
- "start": Object {
- "column": 8,
- "line": 1,
- },
- },
- "range": Array [
- 8,
- 39,
- ],
- "type": "ClassBody",
- },
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 1,
+ "type": "CallExpression",
},
- "start": Object {
- "column": 6,
- "line": 1,
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
},
+ "range": Array [
+ 0,
+ 7,
+ ],
+ "type": "Decorator",
},
- "name": "B",
- "range": Array [
- 6,
- 7,
- ],
- "type": "Identifier",
- },
+ ],
+ "kind": "const",
"loc": Object {
"end": Object {
- "column": 1,
- "line": 5,
+ "column": 11,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -84926,17 +92837,16 @@ Object {
},
"range": Array [
0,
- 39,
+ 19,
],
- "superClass": null,
- "type": "ClassDeclaration",
+ "type": "VariableDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 5,
+ "column": 0,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -84945,27 +92855,63 @@ Object {
},
"range": Array [
0,
- 39,
+ 20,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 1,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 1,
+ ],
+ "type": "Punctuator",
+ "value": "@",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 1,
+ 5,
+ ],
+ "type": "Identifier",
+ "value": "deco",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 0,
5,
+ 6,
],
- "type": "Keyword",
- "value": "class",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
@@ -84982,35 +92928,35 @@ Object {
6,
7,
],
- "type": "Identifier",
- "value": "B",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 1,
+ "column": 5,
+ "line": 2,
},
"start": Object {
- "column": 8,
- "line": 1,
+ "column": 0,
+ "line": 2,
},
},
"range": Array [
8,
- 9,
+ 13,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Keyword",
+ "value": "const",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 7,
"line": 2,
},
"start": Object {
- "column": 4,
+ "column": 6,
"line": 2,
},
},
@@ -85018,353 +92964,372 @@ Object {
14,
15,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Identifier",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 9,
"line": 2,
},
"start": Object {
- "column": 5,
+ "column": 8,
"line": 2,
},
},
"range": Array [
- 15,
- 18,
+ 16,
+ 17,
],
- "type": "Identifier",
- "value": "foo",
+ "type": "Punctuator",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 11,
"line": 2,
},
"start": Object {
- "column": 9,
+ "column": 10,
"line": 2,
},
},
"range": Array [
+ 18,
19,
- 20,
],
- "type": "Identifier",
- "value": "x",
+ "type": "Numeric",
+ "value": "1",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/errorRecovery/empty-type-arguments.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 6,
+ 16,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 16,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 16,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 11,
+ 14,
+ ],
+ "type": "Identifier",
+ },
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 14,
+ 16,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
+ },
+ },
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 6,
+ 16,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "kind": "const",
"loc": Object {
"end": Object {
- "column": 11,
- "line": 2,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 2,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 20,
- 21,
+ 0,
+ 16,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "VariableDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 16,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
"column": 5,
- "line": 3,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 0,
+ 5,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Keyword",
+ "value": "const",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 3,
+ "column": 9,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 3,
+ "column": 6,
+ "line": 1,
},
},
"range": Array [
- 27,
- 30,
+ 6,
+ 9,
],
"type": "Identifier",
- "value": "bar",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 4,
+ "column": 10,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 4,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 35,
- 36,
+ 9,
+ 10,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 14,
],
"type": "Identifier",
- "value": "y",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
- "line": 4,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 5,
- "line": 4,
+ "column": 14,
+ "line": 1,
},
},
"range": Array [
- 36,
- 37,
+ 14,
+ 15,
],
"type": "Punctuator",
- "value": ";",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 5,
+ "column": 16,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 5,
+ "column": 15,
+ "line": 1,
},
},
"range": Array [
- 38,
- 39,
+ 15,
+ 16,
],
"type": "Punctuator",
- "value": "}",
+ "value": ">",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/decorators/property-decorators/property-decorator-static-member.src 1`] = `
+exports[`typescript fixtures/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = `
Object {
"body": Array [
Object {
- "body": Object {
- "body": Array [
- Object {
- "computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 2,
- },
- "start": Object {
- "column": 5,
- "line": 2,
- },
- },
- "name": "baz",
- "range": Array [
- 15,
- 18,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 14,
- 18,
- ],
- "type": "Decorator",
- },
- ],
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "name": "a",
- "range": Array [
- 26,
- 27,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 2,
- },
- "start": Object {
- "column": 4,
- "line": 2,
- },
- },
- "range": Array [
- 14,
- 28,
- ],
- "static": true,
- "type": "ClassProperty",
- "value": null,
- },
- Object {
- "computed": false,
- "decorators": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 3,
- },
- "start": Object {
- "column": 5,
- "line": 3,
- },
- },
- "name": "qux",
- "range": Array [
- 34,
- 37,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "range": Array [
- 33,
- 37,
- ],
- "type": "Decorator",
- },
- ],
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 4,
- },
- "start": Object {
- "column": 11,
- "line": 4,
- },
- },
- "name": "b",
- "range": Array [
- 49,
- 50,
- ],
- "type": "Identifier",
+ "expression": Object {
+ "arguments": Array [],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 3,
+ "line": 1,
},
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 4,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
- "range": Array [
- 33,
- 51,
- ],
- "static": true,
- "type": "ClassProperty",
- "value": null,
- },
- ],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 5,
- },
- "start": Object {
- "column": 8,
- "line": 1,
},
+ "name": "foo",
+ "range": Array [
+ 0,
+ 3,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 8,
- 53,
- ],
- "type": "ClassBody",
- },
- "id": Object {
"loc": Object {
"end": Object {
"column": 7,
"line": 1,
},
"start": Object {
- "column": 6,
+ "column": 0,
"line": 1,
},
},
- "name": "C",
"range": Array [
- 6,
+ 0,
7,
],
- "type": "Identifier",
+ "type": "CallExpression",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 3,
+ "line": 1,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 3,
+ 5,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
},
"loc": Object {
"end": Object {
- "column": 1,
- "line": 5,
+ "column": 8,
+ "line": 1,
},
"start": Object {
"column": 0,
@@ -85373,17 +93338,16 @@ Object {
},
"range": Array [
0,
- 53,
+ 8,
],
- "superClass": null,
- "type": "ClassDeclaration",
+ "type": "ExpressionStatement",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 6,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -85392,14 +93356,14 @@ Object {
},
"range": Array [
0,
- 54,
+ 9,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 3,
"line": 1,
},
"start": Object {
@@ -85409,294 +93373,168 @@ Object {
},
"range": Array [
0,
- 5,
- ],
- "type": "Keyword",
- "value": "class",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
- },
- "range": Array [
- 6,
- 7,
+ 3,
],
"type": "Identifier",
- "value": "C",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 4,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 3,
"line": 1,
},
},
"range": Array [
- 8,
- 9,
+ 3,
+ 4,
],
"type": "Punctuator",
- "value": "{",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
"column": 5,
- "line": 2,
+ "line": 1,
},
"start": Object {
"column": 4,
- "line": 2,
+ "line": 1,
},
},
"range": Array [
- 14,
- 15,
+ 4,
+ 5,
],
"type": "Punctuator",
- "value": "@",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 2,
+ "column": 6,
+ "line": 1,
},
"start": Object {
"column": 5,
- "line": 2,
- },
- },
- "range": Array [
- 15,
- 18,
- ],
- "type": "Identifier",
- "value": "baz",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 2,
- },
- "start": Object {
- "column": 9,
- "line": 2,
- },
- },
- "range": Array [
- 19,
- 25,
- ],
- "type": "Keyword",
- "value": "static",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 2,
- },
- "start": Object {
- "column": 16,
- "line": 2,
- },
- },
- "range": Array [
- 26,
- 27,
- ],
- "type": "Identifier",
- "value": "a",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 2,
- },
- "start": Object {
- "column": 17,
- "line": 2,
+ "line": 1,
},
},
"range": Array [
- 27,
- 28,
+ 5,
+ 6,
],
"type": "Punctuator",
- "value": ";",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 3,
+ "column": 7,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 6,
+ "line": 1,
},
},
"range": Array [
- 33,
- 34,
+ 6,
+ 7,
],
"type": "Punctuator",
- "value": "@",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
"column": 8,
- "line": 3,
- },
- "start": Object {
- "column": 5,
- "line": 3,
- },
- },
- "range": Array [
- 34,
- 37,
- ],
- "type": "Identifier",
- "value": "qux",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 4,
- },
- "start": Object {
- "column": 4,
- "line": 4,
- },
- },
- "range": Array [
- 42,
- 48,
- ],
- "type": "Keyword",
- "value": "static",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 4,
- },
- "start": Object {
- "column": 11,
- "line": 4,
- },
- },
- "range": Array [
- 49,
- 50,
- ],
- "type": "Identifier",
- "value": "b",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 4,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 4,
+ "column": 7,
+ "line": 1,
},
},
"range": Array [
- 50,
- 51,
+ 7,
+ 8,
],
"type": "Punctuator",
"value": ";",
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 5,
- },
- "start": Object {
- "column": 0,
- "line": 5,
- },
- },
- "range": Array [
- 52,
- 53,
- ],
- "type": "Punctuator",
- "value": "}",
- },
],
"type": "Program",
}
`;
-exports[`typescript fixtures/errorRecovery/class-empty-extends.src 1`] = `
+exports[`typescript fixtures/errorRecovery/empty-type-arguments-in-new-expression.src 1`] = `
Object {
"body": Array [
Object {
- "body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 3,
- },
- "start": Object {
- "column": 18,
- "line": 1,
+ "expression": Object {
+ "arguments": Array [],
+ "callee": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
},
+ "name": "Foo",
+ "range": Array [
+ 4,
+ 7,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 18,
- 22,
- ],
- "type": "ClassBody",
- },
- "id": Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 6,
+ "column": 0,
"line": 1,
},
},
- "name": "Foo",
"range": Array [
- 6,
- 9,
+ 0,
+ 11,
],
- "type": "Identifier",
+ "type": "NewExpression",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 7,
+ 9,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
},
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 11,
+ "line": 1,
},
"start": Object {
"column": 0,
@@ -85705,17 +93543,16 @@ Object {
},
"range": Array [
0,
- 22,
+ 11,
],
- "superClass": null,
- "type": "ClassDeclaration",
+ "type": "ExpressionStatement",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 4,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -85724,14 +93561,14 @@ Object {
},
"range": Array [
0,
- 23,
+ 12,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 3,
"line": 1,
},
"start": Object {
@@ -85741,25 +93578,25 @@ Object {
},
"range": Array [
0,
- 5,
+ 3,
],
"type": "Keyword",
- "value": "class",
+ "value": "new",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 7,
"line": 1,
},
"start": Object {
- "column": 6,
+ "column": 4,
"line": 1,
},
},
"range": Array [
- 6,
- 9,
+ 4,
+ 7,
],
"type": "Identifier",
"value": "Foo",
@@ -85767,162 +93604,164 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 10,
- 17,
+ 7,
+ 8,
],
- "type": "Keyword",
- "value": "extends",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 18,
- 19,
+ 8,
+ 9,
],
"type": "Punctuator",
- "value": "{",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 10,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 21,
- 22,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": "}",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 11,
+ ],
+ "type": "Punctuator",
+ "value": ")",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/errorRecovery/class-empty-extends-implements.src 1`] = `
+exports[`typescript fixtures/errorRecovery/empty-type-parameters.src 1`] = `
Object {
"body": Array [
Object {
+ "async": false,
"body": Object {
"body": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 33,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 33,
- 37,
+ 16,
+ 18,
],
- "type": "ClassBody",
+ "type": "BlockStatement",
},
+ "expression": false,
+ "generator": false,
"id": Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 6,
+ "column": 9,
"line": 1,
},
},
- "name": "Foo",
+ "name": "f1",
"range": Array [
- 6,
9,
+ 11,
],
"type": "Identifier",
},
- "implements": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 1,
- },
- "start": Object {
- "column": 29,
- "line": 1,
- },
- },
- "name": "Bar",
- "range": Array [
- 29,
- 32,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 1,
- },
- "start": Object {
- "column": 29,
- "line": 1,
- },
- },
- "range": Array [
- 29,
- 32,
- ],
- "type": "TSClassImplements",
- },
- ],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
+ "params": Array [],
"range": Array [
0,
- 37,
+ 18,
],
- "superClass": null,
- "type": "ClassDeclaration",
+ "type": "FunctionDeclaration",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 11,
+ 13,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 4,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -85931,14 +93770,14 @@ Object {
},
"range": Array [
0,
- 38,
+ 19,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -85948,97 +93787,115 @@ Object {
},
"range": Array [
0,
- 5,
+ 8,
],
"type": "Keyword",
- "value": "class",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 6,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 6,
9,
+ 11,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "f1",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 10,
- 17,
+ 11,
+ 12,
],
- "type": "Keyword",
- "value": "extends",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 18,
- 28,
+ 12,
+ 13,
],
- "type": "Keyword",
- "value": "implements",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 32,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 29,
- 32,
+ 13,
+ 14,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 15,
],
- "type": "Identifier",
- "value": "Bar",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 34,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 33,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 33,
- 34,
+ 16,
+ 17,
],
"type": "Punctuator",
"value": "{",
@@ -86046,17 +93903,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 17,
+ "line": 1,
},
},
"range": Array [
- 36,
- 37,
+ 17,
+ 18,
],
"type": "Punctuator",
"value": "}",
@@ -86066,87 +93923,90 @@ Object {
}
`;
-exports[`typescript fixtures/errorRecovery/class-extends-empty-implements.src 1`] = `
+exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-arrow-function.src 1`] = `
Object {
"body": Array [
Object {
+ "async": false,
"body": Object {
"body": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 33,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 33,
- 37,
+ 16,
+ 18,
],
- "type": "ClassBody",
+ "type": "BlockStatement",
},
+ "expression": false,
+ "generator": false,
"id": Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 6,
+ "column": 9,
"line": 1,
},
},
- "name": "Foo",
+ "name": "f1",
"range": Array [
- 6,
9,
+ 11,
],
"type": "Identifier",
},
- "implements": Array [],
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
+ "params": Array [],
"range": Array [
0,
- 37,
+ 18,
],
- "superClass": Object {
+ "type": "FunctionDeclaration",
+ "typeParameters": Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 11,
"line": 1,
},
},
- "name": "Bar",
+ "params": Array [],
"range": Array [
- 18,
- 21,
+ 11,
+ 13,
],
- "type": "Identifier",
+ "type": "TSTypeParameterDeclaration",
},
- "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
- "line": 4,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -86155,14 +94015,14 @@ Object {
},
"range": Array [
0,
- 38,
+ 19,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -86172,97 +94032,115 @@ Object {
},
"range": Array [
0,
- 5,
+ 8,
],
"type": "Keyword",
- "value": "class",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 6,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 6,
9,
+ 11,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "f1",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 10,
- 17,
+ 11,
+ 12,
],
- "type": "Keyword",
- "value": "extends",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 18,
- 21,
+ 12,
+ 13,
],
- "type": "Identifier",
- "value": "Bar",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 32,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 22,
- 32,
+ 13,
+ 14,
],
- "type": "Keyword",
- "value": "implements",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 34,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 33,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 33,
- 34,
+ 14,
+ 15,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 16,
+ 17,
],
"type": "Punctuator",
"value": "{",
@@ -86270,17 +94148,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 3,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 0,
- "line": 3,
+ "column": 17,
+ "line": 1,
},
},
"range": Array [
- 36,
- 37,
+ 17,
+ 18,
],
"type": "Punctuator",
"value": "}",
@@ -86290,32 +94168,129 @@ Object {
}
`;
-exports[`typescript fixtures/errorRecovery/class-multiple-implements.src 1`] = `
+exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-constructor.src 1`] = `
Object {
"body": Array [
Object {
"body": Object {
- "body": Array [],
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "name": "constructor",
+ "range": Array [
+ 14,
+ 25,
+ ],
+ "type": "Identifier",
+ },
+ "kind": "constructor",
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 14,
+ 32,
+ ],
+ "static": false,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 30,
+ 32,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 2,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 25,
+ 32,
+ ],
+ "type": "FunctionExpression",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 2,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 25,
+ 27,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
+ },
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 36,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
- "column": 34,
+ "column": 10,
"line": 1,
},
},
"range": Array [
+ 10,
34,
- 36,
],
"type": "ClassBody",
},
"id": Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -86323,54 +94298,17 @@ Object {
"line": 1,
},
},
- "name": "a",
+ "name": "foo",
"range": Array [
6,
- 7,
+ 9,
],
"type": "Identifier",
},
- "implements": Array [
- Object {
- "expression": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 19,
- "line": 1,
- },
- },
- "name": "b",
- "range": Array [
- 19,
- 20,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- },
- "start": Object {
- "column": 19,
- "line": 1,
- },
- },
- "range": Array [
- 19,
- 20,
- ],
- "type": "TSClassImplements",
- },
- ],
"loc": Object {
"end": Object {
- "column": 36,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -86379,7 +94317,7 @@ Object {
},
"range": Array [
0,
- 36,
+ 34,
],
"superClass": null,
"type": "ClassDeclaration",
@@ -86389,7 +94327,7 @@ Object {
"loc": Object {
"end": Object {
"column": 0,
- "line": 2,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -86398,7 +94336,7 @@ Object {
},
"range": Array [
0,
- 37,
+ 35,
],
"sourceType": "module",
"tokens": Array [
@@ -86423,7 +94361,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -86433,97 +94371,133 @@ Object {
},
"range": Array [
6,
- 7,
+ 9,
],
"type": "Identifier",
- "value": "a",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 8,
- 18,
+ 10,
+ 11,
],
- "type": "Keyword",
- "value": "implements",
+ "type": "Punctuator",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 1,
+ "column": 13,
+ "line": 2,
},
"start": Object {
- "column": 19,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
- 19,
- 20,
+ 14,
+ 25,
],
"type": "Identifier",
- "value": "b",
+ "value": "constructor",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 1,
+ "column": 14,
+ "line": 2,
},
"start": Object {
- "column": 21,
- "line": 1,
+ "column": 13,
+ "line": 2,
},
},
"range": Array [
- 21,
- 31,
+ 25,
+ 26,
],
- "type": "Keyword",
- "value": "implements",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
- "line": 1,
+ "column": 15,
+ "line": 2,
},
"start": Object {
- "column": 32,
- "line": 1,
+ "column": 14,
+ "line": 2,
},
},
"range": Array [
- 32,
- 33,
+ 26,
+ 27,
],
- "type": "Identifier",
- "value": "c",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 35,
- "line": 1,
+ "column": 16,
+ "line": 2,
},
"start": Object {
- "column": 34,
- "line": 1,
+ "column": 15,
+ "line": 2,
},
},
"range": Array [
- 34,
- 35,
+ 27,
+ 28,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 28,
+ 29,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 30,
+ 31,
],
"type": "Punctuator",
"value": "{",
@@ -86531,17 +94505,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 35,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
},
"range": Array [
- 35,
- 36,
+ 31,
+ 32,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 33,
+ 34,
],
"type": "Punctuator",
"value": "}",
@@ -86551,68 +94543,109 @@ Object {
}
`;
-exports[`typescript fixtures/errorRecovery/decorator-on-enum-declaration.src 1`] = `
+exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = `
Object {
"body": Array [
Object {
- "decorators": Array [
+ "declarations": Array [
Object {
- "expression": Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 6,
+ 9,
+ ],
+ "type": "Identifier",
+ },
+ "init": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 27,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 1,
+ "column": 12,
"line": 1,
},
},
- "name": "dec",
+ "params": Array [],
"range": Array [
- 1,
- 4,
+ 12,
+ 27,
],
- "type": "Identifier",
+ "type": "FunctionExpression",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 20,
+ 22,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
},
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 0,
- 4,
+ 6,
+ 27,
],
- "type": "Decorator",
+ "type": "VariableDeclarator",
},
],
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 1,
- },
- "start": Object {
- "column": 10,
- "line": 1,
- },
- },
- "name": "E",
- "range": Array [
- 10,
- 11,
- ],
- "type": "Identifier",
- },
+ "kind": "const",
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 27,
"line": 1,
},
"start": Object {
@@ -86620,19 +94653,18 @@ Object {
"line": 1,
},
},
- "members": Array [],
"range": Array [
0,
- 14,
+ 27,
],
- "type": "TSEnumDeclaration",
+ "type": "VariableDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 14,
- "line": 1,
+ "column": 0,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -86641,14 +94673,14 @@ Object {
},
"range": Array [
0,
- 14,
+ 28,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 5,
"line": 1,
},
"start": Object {
@@ -86658,79 +94690,151 @@ Object {
},
"range": Array [
0,
- 1,
+ 5,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Keyword",
+ "value": "const",
},
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 1,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 1,
- 4,
+ 6,
+ 9,
],
"type": "Identifier",
- "value": "dec",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 5,
- 9,
+ 10,
+ 11,
+ ],
+ "type": "Punctuator",
+ "value": "=",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 12,
+ 20,
],
"type": "Keyword",
- "value": "enum",
+ "value": "function",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 10,
- 11,
+ 20,
+ 21,
],
- "type": "Identifier",
- "value": "E",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 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": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 26,
],
"type": "Punctuator",
"value": "{",
@@ -86738,17 +94842,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 13,
- 14,
+ 26,
+ 27,
],
"type": "Punctuator",
"value": "}",
@@ -86758,105 +94862,147 @@ Object {
}
`;
-exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.src 1`] = `
+exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-method.src 1`] = `
Object {
"body": Array [
Object {
"body": Object {
- "body": Array [],
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 2,
- },
- "start": Object {
- "column": 12,
- "line": 2,
- },
- },
- "range": Array [
- 20,
- 22,
- ],
- "type": "TSInterfaceBody",
- },
- "decorators": Array [
- Object {
- "expression": Object {
- "arguments": Array [],
- "callee": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 1,
+ "column": 6,
+ "line": 2,
},
"start": Object {
- "column": 1,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
- "name": "deco",
+ "name": "test",
"range": Array [
- 1,
- 5,
+ 14,
+ 18,
],
"type": "Identifier",
},
+ "kind": "method",
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 13,
+ "line": 2,
},
"start": Object {
- "column": 1,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
- 1,
- 7,
+ 14,
+ 25,
],
- "type": "CallExpression",
- },
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "static": false,
+ "type": "MethodDefinition",
+ "value": Object {
+ "async": false,
+ "body": Object {
+ "body": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 23,
+ 25,
+ ],
+ "type": "BlockStatement",
+ },
+ "expression": false,
+ "generator": false,
+ "id": null,
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 2,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 18,
+ 25,
+ ],
+ "type": "FunctionExpression",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 2,
+ },
+ },
+ "params": Array [],
+ "range": Array [
+ 18,
+ 20,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
},
},
- "range": Array [
- 0,
- 7,
- ],
- "type": "Decorator",
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
},
- ],
+ "range": Array [
+ 10,
+ 27,
+ ],
+ "type": "ClassBody",
+ },
"id": Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 2,
+ "column": 9,
+ "line": 1,
},
"start": Object {
- "column": 10,
- "line": 2,
+ "column": 6,
+ "line": 1,
},
},
- "name": "M",
+ "name": "foo",
"range": Array [
- 18,
- 19,
+ 6,
+ 9,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 14,
- "line": 2,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -86865,16 +95011,17 @@ Object {
},
"range": Array [
0,
- 22,
+ 27,
],
- "type": "TSInterfaceDeclaration",
+ "superClass": null,
+ "type": "ClassDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 14,
- "line": 2,
+ "column": 0,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -86883,14 +95030,14 @@ Object {
},
"range": Array [
0,
- 22,
+ 28,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 1,
+ "column": 5,
"line": 1,
},
"start": Object {
@@ -86900,109 +95047,109 @@ Object {
},
"range": Array [
0,
- 1,
+ 5,
],
- "type": "Punctuator",
- "value": "@",
+ "type": "Keyword",
+ "value": "class",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 1,
+ "column": 6,
"line": 1,
},
},
"range": Array [
- 1,
- 5,
+ 6,
+ 9,
],
"type": "Identifier",
- "value": "deco",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 5,
- 6,
+ 10,
+ 11,
],
"type": "Punctuator",
- "value": "(",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 1,
+ "column": 6,
+ "line": 2,
},
"start": Object {
- "column": 6,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
- 6,
- 7,
+ 14,
+ 18,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "test",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 7,
"line": 2,
},
"start": Object {
- "column": 0,
+ "column": 6,
"line": 2,
},
},
"range": Array [
- 8,
- 17,
+ 18,
+ 19,
],
- "type": "Keyword",
- "value": "interface",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 8,
"line": 2,
},
"start": Object {
- "column": 10,
+ "column": 7,
"line": 2,
},
},
"range": Array [
- 18,
19,
+ 20,
],
- "type": "Identifier",
- "value": "M",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 9,
"line": 2,
},
"start": Object {
- "column": 12,
+ "column": 8,
"line": 2,
},
},
@@ -87011,16 +95158,16 @@ Object {
21,
],
"type": "Punctuator",
- "value": "{",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 10,
"line": 2,
},
"start": Object {
- "column": 13,
+ "column": 9,
"line": 2,
},
},
@@ -87029,6 +95176,60 @@ Object {
22,
],
"type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 23,
+ 24,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 24,
+ 25,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 26,
+ 27,
+ ],
+ "type": "Punctuator",
"value": "}",
},
],
@@ -87036,123 +95237,106 @@ Object {
}
`;
-exports[`typescript fixtures/errorRecovery/empty-type-arguments.src 1`] = `
+exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-method-signature.src 1`] = `
Object {
"body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "name": "test",
+ "range": Array [
+ 18,
+ 22,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 11,
+ "line": 2,
},
"start": Object {
- "column": 6,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
- "name": "foo",
+ "params": Array [],
"range": Array [
- 6,
- 16,
+ 18,
+ 27,
],
- "type": "Identifier",
- "typeAnnotation": Object {
+ "type": "TSMethodSignature",
+ "typeParameters": Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 8,
+ "line": 2,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 6,
+ "line": 2,
},
},
+ "params": Array [],
"range": Array [
- 9,
- 16,
+ 22,
+ 24,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 16,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 11,
- 14,
- ],
- "type": "Identifier",
- },
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "params": Array [],
- "range": Array [
- 14,
- 16,
- ],
- "type": "TSTypeParameterInstantiation",
- },
- },
+ "type": "TSTypeParameterDeclaration",
},
},
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 6,
- "line": 1,
- },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
},
- "range": Array [
- 6,
- 16,
- ],
- "type": "VariableDeclarator",
},
- ],
- "kind": "const",
+ "range": Array [
+ 14,
+ 29,
+ ],
+ "type": "TSInterfaceBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 1,
+ "line": 3,
},
"start": Object {
"column": 0,
@@ -87161,16 +95345,16 @@ Object {
},
"range": Array [
0,
- 16,
+ 29,
],
- "type": "VariableDeclaration",
+ "type": "TSInterfaceDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 0,
+ "line": 4,
},
"start": Object {
"column": 0,
@@ -87179,14 +95363,14 @@ Object {
},
"range": Array [
0,
- 16,
+ 30,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 9,
"line": 1,
},
"start": Object {
@@ -87196,25 +95380,25 @@ Object {
},
"range": Array [
0,
- 5,
+ 9,
],
"type": "Keyword",
- "value": "const",
+ "value": "interface",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 6,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 6,
- 9,
+ 10,
+ 13,
],
"type": "Identifier",
"value": "foo",
@@ -87222,53 +95406,53 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 14,
+ 15,
],
"type": "Punctuator",
- "value": ":",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 1,
+ "column": 6,
+ "line": 2,
},
"start": Object {
- "column": 11,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
- 11,
- 14,
+ 18,
+ 22,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "test",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
- "line": 1,
+ "column": 7,
+ "line": 2,
},
"start": Object {
- "column": 14,
- "line": 1,
+ "column": 6,
+ "line": 2,
},
},
"range": Array [
- 14,
- 15,
+ 22,
+ 23,
],
"type": "Punctuator",
"value": "<",
@@ -87276,21 +95460,93 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 1,
+ "column": 8,
+ "line": 2,
},
"start": Object {
- "column": 15,
- "line": 1,
+ "column": 7,
+ "line": 2,
},
},
"range": Array [
- 15,
- 16,
+ 23,
+ 24,
],
"type": "Punctuator",
"value": ">",
},
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 24,
+ 25,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 25,
+ 26,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 11,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 26,
+ 27,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 28,
+ 29,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
],
"type": "Program",
}
@@ -87325,7 +95581,7 @@ Object {
"line": 1,
},
"start": Object {
- "column": 63,
+ "column": 7,
"line": 1,
},
},
@@ -87452,7 +95708,7 @@ Object {
},
],
"range": Array [
- 63,
+ 7,
72,
],
"type": "TSEnumDeclaration",
@@ -95244,6 +103500,8 @@ Object {
}
`;
+exports[`typescript fixtures/errorRecovery/interface-with-no-body.src 1`] = `"'{' expected."`;
+
exports[`typescript fixtures/errorRecovery/object-assertion-not-allowed.src 1`] = `
Object {
"body": Array [
@@ -99909,132 +108167,564 @@ Object {
"line": 1,
},
},
- "range": Array [
- 9,
- 231,
- ],
- "type": "TSModuleBlock",
+ "range": Array [
+ 9,
+ 231,
+ ],
+ "type": "TSModuleBlock",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "name": "A",
+ "range": Array [
+ 7,
+ 8,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 231,
+ ],
+ "type": "TSModuleDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 12,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 231,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 6,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 6,
+ ],
+ "type": "Identifier",
+ "value": "module",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 8,
+ ],
+ "type": "Identifier",
+ "value": "A",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 10,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 16,
+ 22,
+ ],
+ "type": "Keyword",
+ "value": "export",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 23,
+ 26,
+ ],
+ "type": "Keyword",
+ "value": "var",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 27,
+ 28,
+ ],
+ "type": "Identifier",
+ "value": "x",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 29,
+ 30,
+ ],
+ "type": "Punctuator",
+ "value": "=",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 31,
+ 44,
+ ],
+ "type": "String",
+ "value": "'hello world'",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 4,
+ },
},
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
+ "range": Array [
+ 49,
+ 55,
+ ],
+ "type": "Keyword",
+ "value": "export",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 4,
},
- "name": "A",
- "range": Array [
- 7,
- 8,
- ],
- "type": "Identifier",
},
+ "range": Array [
+ 56,
+ 61,
+ ],
+ "type": "Keyword",
+ "value": "class",
+ },
+ Object {
"loc": Object {
"end": Object {
- "column": 1,
- "line": 12,
+ "column": 22,
+ "line": 4,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 17,
+ "line": 4,
},
},
"range": Array [
- 0,
- 231,
+ 62,
+ 67,
],
- "type": "TSModuleDeclaration",
+ "type": "Identifier",
+ "value": "Point",
},
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 12,
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 68,
+ 69,
+ ],
+ "type": "Punctuator",
+ "value": "{",
},
- "start": Object {
- "column": 0,
- "line": 1,
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 78,
+ 89,
+ ],
+ "type": "Identifier",
+ "value": "constructor",
},
- },
- "range": Array [
- 0,
- 231,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 6,
- "line": 1,
+ "column": 20,
+ "line": 5,
},
"start": Object {
- "column": 0,
- "line": 1,
+ "column": 19,
+ "line": 5,
},
},
"range": Array [
- 0,
- 6,
+ 89,
+ 90,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 90,
+ 96,
+ ],
+ "type": "Keyword",
+ "value": "public",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 97,
+ 98,
],
"type": "Identifier",
- "value": "module",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
- "line": 1,
+ "column": 29,
+ "line": 5,
},
"start": Object {
- "column": 7,
- "line": 1,
+ "column": 28,
+ "line": 5,
},
},
"range": Array [
- 7,
- 8,
+ 98,
+ 99,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 100,
+ 106,
],
"type": "Identifier",
- "value": "A",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 1,
+ "column": 37,
+ "line": 5,
},
"start": Object {
- "column": 9,
- "line": 1,
+ "column": 36,
+ "line": 5,
},
},
"range": Array [
- 9,
- 10,
+ 106,
+ 107,
+ ],
+ "type": "Punctuator",
+ "value": ",",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 44,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 38,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 108,
+ 114,
+ ],
+ "type": "Keyword",
+ "value": "public",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 46,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 45,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 115,
+ 116,
+ ],
+ "type": "Identifier",
+ "value": "y",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 47,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 46,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 116,
+ 117,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 54,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 48,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 118,
+ 124,
+ ],
+ "type": "Identifier",
+ "value": "number",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 55,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 54,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 124,
+ 125,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 57,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 56,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 126,
+ 127,
],
"type": "Punctuator",
"value": "{",
},
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 59,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 58,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 128,
+ 129,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 6,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 6,
+ },
+ },
+ "range": Array [
+ 134,
+ 135,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
Object {
"loc": Object {
"end": Object {
"column": 10,
- "line": 3,
+ "line": 7,
},
"start": Object {
"column": 4,
- "line": 3,
+ "line": 7,
},
},
"range": Array [
- 16,
- 22,
+ 140,
+ 146,
],
"type": "Keyword",
"value": "export",
@@ -100042,593 +108732,935 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 14,
- "line": 3,
+ "column": 17,
+ "line": 7,
},
"start": Object {
"column": 11,
- "line": 3,
+ "line": 7,
},
},
"range": Array [
- 23,
- 26,
+ 147,
+ 153,
+ ],
+ "type": "Identifier",
+ "value": "module",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 154,
+ 155,
+ ],
+ "type": "Identifier",
+ "value": "B",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 7,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 7,
+ },
+ },
+ "range": Array [
+ 156,
+ 157,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 166,
+ 172,
],
"type": "Keyword",
- "value": "var",
+ "value": "export",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 173,
+ 182,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 183,
+ 185,
+ ],
+ "type": "Identifier",
+ "value": "Id",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 8,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 8,
+ },
+ },
+ "range": Array [
+ 186,
+ 187,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 200,
+ 204,
+ ],
+ "type": "Identifier",
+ "value": "name",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 9,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 9,
+ },
+ },
+ "range": Array [
+ 204,
+ 205,
+ ],
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 3,
+ "column": 24,
+ "line": 9,
},
"start": Object {
- "column": 15,
- "line": 3,
+ "column": 18,
+ "line": 9,
},
},
"range": Array [
- 27,
- 28,
+ 206,
+ 212,
],
"type": "Identifier",
- "value": "x",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
- "line": 3,
+ "column": 25,
+ "line": 9,
},
"start": Object {
- "column": 17,
- "line": 3,
+ "column": 24,
+ "line": 9,
},
},
"range": Array [
- 29,
- 30,
+ 212,
+ 213,
],
"type": "Punctuator",
- "value": "=",
+ "value": ";",
},
Object {
"loc": Object {
"end": Object {
- "column": 32,
- "line": 3,
+ "column": 9,
+ "line": 10,
},
"start": Object {
- "column": 19,
- "line": 3,
+ "column": 8,
+ "line": 10,
},
},
"range": Array [
- 31,
- 44,
+ 222,
+ 223,
],
- "type": "String",
- "value": "'hello world'",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 4,
+ "column": 5,
+ "line": 11,
},
"start": Object {
"column": 4,
- "line": 4,
+ "line": 11,
},
},
"range": Array [
- 49,
- 55,
+ 228,
+ 229,
],
- "type": "Keyword",
- "value": "export",
+ "type": "Punctuator",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 4,
+ "column": 1,
+ "line": 12,
},
"start": Object {
- "column": 11,
- "line": 4,
+ "column": 0,
+ "line": 12,
},
},
"range": Array [
- 56,
- 61,
+ 230,
+ 231,
],
- "type": "Keyword",
- "value": "class",
+ "type": "Punctuator",
+ "value": "}",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "declare": true,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 31,
+ ],
+ "raw": "\\"hot-new-module\\"",
+ "type": "Literal",
+ "value": "hot-new-module",
+ },
"loc": Object {
"end": Object {
- "column": 22,
- "line": 4,
+ "column": 32,
+ "line": 1,
},
"start": Object {
- "column": 17,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 62,
- 67,
+ 0,
+ 32,
],
- "type": "Identifier",
- "value": "Point",
+ "type": "TSModuleDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 33,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 4,
+ "column": 7,
+ "line": 1,
},
"start": Object {
- "column": 23,
- "line": 4,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 68,
- 69,
+ 0,
+ 7,
],
- "type": "Punctuator",
- "value": "{",
+ "type": "Identifier",
+ "value": "declare",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 5,
+ "column": 14,
+ "line": 1,
},
"start": Object {
"column": 8,
- "line": 5,
+ "line": 1,
},
},
"range": Array [
- 78,
- 89,
+ 8,
+ 14,
],
"type": "Identifier",
- "value": "constructor",
+ "value": "module",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
- "line": 5,
+ "column": 31,
+ "line": 1,
},
"start": Object {
- "column": 19,
- "line": 5,
+ "column": 15,
+ "line": 1,
},
},
"range": Array [
- 89,
- 90,
+ 15,
+ 31,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "String",
+ "value": "\\"hot-new-module\\"",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
- "line": 5,
+ "column": 32,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 5,
+ "column": 31,
+ "line": 1,
},
},
"range": Array [
- 90,
- 96,
+ 31,
+ 32,
],
- "type": "Keyword",
- "value": "public",
+ "type": "Punctuator",
+ "value": ";",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/types/array-type.src 1`] = `
+Object {
+ "body": Array [
Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
"loc": Object {
"end": Object {
- "column": 28,
- "line": 5,
+ "column": 19,
+ "line": 1,
},
"start": Object {
- "column": 27,
- "line": 5,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 97,
- 98,
+ 0,
+ 19,
],
- "type": "Identifier",
- "value": "x",
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "elementType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 17,
+ ],
+ "type": "TSStringKeyword",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 19,
+ ],
+ "type": "TSArrayType",
+ },
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
},
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 20,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 5,
+ "column": 4,
+ "line": 1,
},
"start": Object {
- "column": 28,
- "line": 5,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 98,
- 99,
+ 0,
+ 4,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 5,
+ "column": 8,
+ "line": 1,
},
"start": Object {
- "column": 30,
- "line": 5,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 100,
- 106,
+ 5,
+ 8,
],
"type": "Identifier",
- "value": "number",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 5,
+ "column": 10,
+ "line": 1,
},
"start": Object {
- "column": 36,
- "line": 5,
+ "column": 9,
+ "line": 1,
},
},
"range": Array [
- 106,
- 107,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": ",",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 44,
- "line": 5,
+ "column": 17,
+ "line": 1,
},
"start": Object {
- "column": 38,
- "line": 5,
+ "column": 11,
+ "line": 1,
},
},
"range": Array [
- 108,
- 114,
+ 11,
+ 17,
],
- "type": "Keyword",
- "value": "public",
+ "type": "Identifier",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 46,
- "line": 5,
+ "column": 18,
+ "line": 1,
},
"start": Object {
- "column": 45,
- "line": 5,
+ "column": 17,
+ "line": 1,
},
},
"range": Array [
- 115,
- 116,
+ 17,
+ 18,
],
- "type": "Identifier",
- "value": "y",
+ "type": "Punctuator",
+ "value": "[",
},
Object {
"loc": Object {
"end": Object {
- "column": 47,
- "line": 5,
+ "column": 19,
+ "line": 1,
},
"start": Object {
- "column": 46,
- "line": 5,
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 19,
+ ],
+ "type": "Punctuator",
+ "value": "]",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/types/conditional.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 47,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "name": "x",
+ "range": Array [
+ 4,
+ 47,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 47,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 5,
+ 47,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "checkType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 13,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ "extendsType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 22,
+ 28,
+ ],
+ "type": "TSStringKeyword",
+ },
+ "falseType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 47,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 41,
+ 47,
+ ],
+ "type": "TSStringKeyword",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 47,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 47,
+ ],
+ "trueType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 31,
+ 38,
+ ],
+ "type": "TSBooleanKeyword",
+ },
+ "type": "TSConditionalType",
+ },
+ },
+ },
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 47,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 4,
+ 47,
+ ],
+ "type": "VariableDeclarator",
},
- },
- "range": Array [
- 116,
- 117,
],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
+ "kind": "let",
"loc": Object {
"end": Object {
- "column": 54,
- "line": 5,
- },
- "start": Object {
"column": 48,
- "line": 5,
- },
- },
- "range": Array [
- 118,
- 124,
- ],
- "type": "Identifier",
- "value": "number",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 55,
- "line": 5,
+ "line": 1,
},
"start": Object {
- "column": 54,
- "line": 5,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 124,
- 125,
+ 0,
+ 48,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "VariableDeclaration",
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 57,
- "line": 5,
- },
- "start": Object {
- "column": 56,
- "line": 5,
- },
- },
- "range": Array [
- 126,
- 127,
- ],
- "type": "Punctuator",
- "value": "{",
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 59,
- "line": 5,
- },
- "start": Object {
- "column": 58,
- "line": 5,
- },
- },
- "range": Array [
- 128,
- 129,
- ],
- "type": "Punctuator",
- "value": "}",
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 49,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 6,
+ "column": 3,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 6,
+ "column": 0,
+ "line": 1,
},
},
"range": Array [
- 134,
- 135,
+ 0,
+ 3,
],
- "type": "Punctuator",
- "value": "}",
+ "type": "Keyword",
+ "value": "let",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 7,
+ "column": 5,
+ "line": 1,
},
"start": Object {
"column": 4,
- "line": 7,
+ "line": 1,
},
},
"range": Array [
- 140,
- 146,
+ 4,
+ 5,
],
- "type": "Keyword",
- "value": "export",
+ "type": "Identifier",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 7,
+ "column": 6,
+ "line": 1,
},
"start": Object {
- "column": 11,
- "line": 7,
+ "column": 5,
+ "line": 1,
},
},
"range": Array [
- 147,
- 153,
+ 5,
+ 6,
],
- "type": "Identifier",
- "value": "module",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 7,
+ "column": 13,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 7,
+ "column": 7,
+ "line": 1,
},
},
"range": Array [
- 154,
- 155,
+ 7,
+ 13,
],
"type": "Identifier",
- "value": "B",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
"column": 21,
- "line": 7,
+ "line": 1,
},
"start": Object {
- "column": 20,
- "line": 7,
- },
- },
- "range": Array [
- 156,
- 157,
- ],
- "type": "Punctuator",
- "value": "{",
- },
- Object {
- "loc": Object {
- "end": Object {
"column": 14,
- "line": 8,
- },
- "start": Object {
- "column": 8,
- "line": 8,
- },
- },
- "range": Array [
- 166,
- 172,
- ],
- "type": "Keyword",
- "value": "export",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 8,
- },
- "start": Object {
- "column": 15,
- "line": 8,
+ "line": 1,
},
},
"range": Array [
- 173,
- 182,
+ 14,
+ 21,
],
"type": "Keyword",
- "value": "interface",
+ "value": "extends",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 8,
+ "column": 28,
+ "line": 1,
},
"start": Object {
- "column": 25,
- "line": 8,
+ "column": 22,
+ "line": 1,
},
},
"range": Array [
- 183,
- 185,
+ 22,
+ 28,
],
"type": "Identifier",
- "value": "Id",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 8,
+ "column": 30,
+ "line": 1,
},
"start": Object {
- "column": 28,
- "line": 8,
+ "column": 29,
+ "line": 1,
},
},
"range": Array [
- 186,
- 187,
+ 29,
+ 30,
],
"type": "Punctuator",
- "value": "{",
+ "value": "?",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
- "line": 9,
+ "column": 38,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 9,
+ "column": 31,
+ "line": 1,
},
},
"range": Array [
- 200,
- 204,
+ 31,
+ 38,
],
"type": "Identifier",
- "value": "name",
+ "value": "boolean",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
- "line": 9,
+ "column": 40,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 9,
+ "column": 39,
+ "line": 1,
},
},
"range": Array [
- 204,
- 205,
+ 39,
+ 40,
],
"type": "Punctuator",
"value": ":",
@@ -100636,17 +109668,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 9,
+ "column": 47,
+ "line": 1,
},
"start": Object {
- "column": 18,
- "line": 9,
+ "column": 41,
+ "line": 1,
},
},
"range": Array [
- 206,
- 212,
+ 41,
+ 47,
],
"type": "Identifier",
"value": "string",
@@ -100654,142 +109686,51 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 25,
- "line": 9,
+ "column": 48,
+ "line": 1,
},
"start": Object {
- "column": 24,
- "line": 9,
+ "column": 47,
+ "line": 1,
},
},
"range": Array [
- 212,
- 213,
+ 47,
+ 48,
],
"type": "Punctuator",
"value": ";",
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 10,
- },
- "start": Object {
- "column": 8,
- "line": 10,
- },
- },
- "range": Array [
- 222,
- 223,
- ],
- "type": "Punctuator",
- "value": "}",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 11,
- },
- "start": Object {
- "column": 4,
- "line": 11,
- },
- },
- "range": Array [
- 228,
- 229,
- ],
- "type": "Punctuator",
- "value": "}",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 1,
- "line": 12,
- },
- "start": Object {
- "column": 0,
- "line": 12,
- },
- },
- "range": Array [
- 230,
- 231,
- ],
- "type": "Punctuator",
- "value": "}",
- },
],
"type": "Program",
}
`;
-exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = `
+exports[`typescript fixtures/types/conditional-infer.src 1`] = `
Object {
"body": Array [
Object {
- "declare": true,
"id": Object {
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 5,
"line": 1,
},
},
+ "name": "Element",
"range": Array [
- 15,
- 31,
+ 5,
+ 12,
],
- "raw": "\\"hot-new-module\\"",
- "type": "Literal",
- "value": "hot-new-module",
- },
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
+ "type": "Identifier",
},
- "range": Array [
- 0,
- 32,
- ],
- "type": "TSModuleDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 33,
- ],
- "sourceType": "module",
- "tokens": Array [
- Object {
"loc": Object {
"end": Object {
- "column": 7,
+ "column": 48,
"line": 1,
},
"start": Object {
@@ -100799,140 +109740,270 @@ Object {
},
"range": Array [
0,
- 7,
- ],
- "type": "Identifier",
- "value": "declare",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 8,
- "line": 1,
- },
- },
- "range": Array [
- 8,
- 14,
+ 48,
],
- "type": "Identifier",
- "value": "module",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 1,
- },
- "start": Object {
- "column": 15,
- "line": 1,
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "checkType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 19,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 18,
+ 19,
+ ],
+ "type": "Identifier",
+ },
},
- },
- "range": Array [
- 15,
- 31,
- ],
- "type": "String",
- "value": "\\"hot-new-module\\"",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 1,
+ "extendsType": Object {
+ "elementType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 37,
+ ],
+ "type": "TSParenthesizedType",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 29,
+ 36,
+ ],
+ "type": "TSInferType",
+ "typeParameter": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 1,
+ },
+ },
+ "name": "U",
+ "range": Array [
+ 35,
+ 36,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 35,
+ 36,
+ ],
+ "type": "TSTypeParameter",
+ },
+ },
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 39,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 28,
+ 39,
+ ],
+ "type": "TSArrayType",
},
- "start": Object {
- "column": 31,
- "line": 1,
+ "falseType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 47,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 46,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 46,
+ 47,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 47,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 46,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 46,
+ 47,
+ ],
+ "type": "Identifier",
+ },
},
- },
- "range": Array [
- 31,
- 32,
- ],
- "type": "Punctuator",
- "value": ";",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/types/array-type.src 1`] = `
-Object {
- "body": Array [
- Object {
- "id": Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 47,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 18,
"line": 1,
},
},
- "name": "Foo",
"range": Array [
- 5,
- 8,
+ 18,
+ 47,
],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 19,
- ],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "elementType": Object {
+ "trueType": Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 43,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 42,
"line": 1,
},
},
"range": Array [
- 11,
- 17,
+ 42,
+ 43,
],
- "type": "TSStringKeyword",
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 43,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 42,
+ "line": 1,
+ },
+ },
+ "name": "U",
+ "range": Array [
+ 42,
+ 43,
+ ],
+ "type": "Identifier",
+ },
},
+ "type": "TSConditionalType",
+ },
+ "typeParameters": Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 12,
"line": 1,
},
},
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
"range": Array [
- 11,
- 19,
+ 12,
+ 15,
],
- "type": "TSArrayType",
+ "type": "TSTypeParameterDeclaration",
},
},
],
@@ -100949,7 +110020,7 @@ Object {
},
"range": Array [
0,
- 20,
+ 49,
],
"sourceType": "module",
"tokens": Array [
@@ -100974,7 +110045,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 12,
"line": 1,
},
"start": Object {
@@ -100984,64 +110055,82 @@ Object {
},
"range": Array [
5,
- 8,
+ 12,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "Element",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 12,
+ 13,
],
"type": "Punctuator",
- "value": "=",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 11,
- 17,
+ 13,
+ 14,
],
"type": "Identifier",
- "value": "string",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 15,
"line": 1,
},
"start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
"column": 17,
"line": 1,
},
+ "start": Object {
+ "column": 16,
+ "line": 1,
+ },
},
"range": Array [
+ 16,
17,
- 18,
],
"type": "Punctuator",
- "value": "[",
+ "value": "=",
},
Object {
"loc": Object {
@@ -101058,315 +110147,149 @@ Object {
18,
19,
],
- "type": "Punctuator",
- "value": "]",
+ "type": "Identifier",
+ "value": "T",
},
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/types/conditional.src 1`] = `
-Object {
- "body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 47,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "name": "x",
- "range": Array [
- 4,
- 47,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 47,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "range": Array [
- 5,
- 47,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "checkType": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
- },
- "range": Array [
- 7,
- 13,
- ],
- "type": "TSNumberKeyword",
- },
- "extendsType": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- },
- "start": Object {
- "column": 22,
- "line": 1,
- },
- },
- "range": Array [
- 22,
- 28,
- ],
- "type": "TSStringKeyword",
- },
- "falseType": Object {
- "loc": Object {
- "end": Object {
- "column": 47,
- "line": 1,
- },
- "start": Object {
- "column": 41,
- "line": 1,
- },
- },
- "range": Array [
- 41,
- 47,
- ],
- "type": "TSStringKeyword",
- },
- "loc": Object {
- "end": Object {
- "column": 47,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
- },
- "range": Array [
- 7,
- 47,
- ],
- "trueType": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 31,
- "line": 1,
- },
- },
- "range": Array [
- 31,
- 38,
- ],
- "type": "TSBooleanKeyword",
- },
- "type": "TSConditionalType",
- },
- },
- },
- "init": null,
- "loc": Object {
- "end": Object {
- "column": 47,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "range": Array [
- 4,
- 47,
- ],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "let",
"loc": Object {
"end": Object {
- "column": 48,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 0,
- 48,
+ 20,
+ 27,
],
- "type": "VariableDeclaration",
- },
- ],
- "comments": Array [],
- "loc": Object {
- "end": Object {
- "column": 0,
- "line": 2,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "Keyword",
+ "value": "extends",
},
- },
- "range": Array [
- 0,
- 49,
- ],
- "sourceType": "module",
- "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 3,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 0,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 0,
- 3,
+ 28,
+ 29,
],
- "type": "Keyword",
- "value": "let",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 34,
"line": 1,
},
"start": Object {
- "column": 4,
+ "column": 29,
"line": 1,
},
},
"range": Array [
- 4,
- 5,
+ 29,
+ 34,
],
"type": "Identifier",
- "value": "x",
+ "value": "infer",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 36,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 35,
"line": 1,
},
},
"range": Array [
- 5,
- 6,
+ 35,
+ 36,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "U",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 37,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 36,
"line": 1,
},
},
"range": Array [
- 7,
- 13,
+ 36,
+ 37,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 38,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 37,
"line": 1,
},
},
"range": Array [
- 14,
- 21,
+ 37,
+ 38,
],
- "type": "Keyword",
- "value": "extends",
+ "type": "Punctuator",
+ "value": "[",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 39,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 38,
"line": 1,
},
},
"range": Array [
- 22,
- 28,
+ 38,
+ 39,
],
- "type": "Identifier",
- "value": "string",
+ "type": "Punctuator",
+ "value": "]",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 41,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 40,
"line": 1,
},
},
"range": Array [
- 29,
- 30,
+ 40,
+ 41,
],
"type": "Punctuator",
"value": "?",
@@ -101374,35 +110297,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 43,
"line": 1,
},
"start": Object {
- "column": 31,
+ "column": 42,
"line": 1,
},
},
"range": Array [
- 31,
- 38,
+ 42,
+ 43,
],
"type": "Identifier",
- "value": "boolean",
+ "value": "U",
},
Object {
"loc": Object {
"end": Object {
- "column": 40,
+ "column": 45,
"line": 1,
},
"start": Object {
- "column": 39,
+ "column": 44,
"line": 1,
},
},
"range": Array [
- 39,
- 40,
+ 44,
+ 45,
],
"type": "Punctuator",
"value": ":",
@@ -101414,16 +110337,16 @@ Object {
"line": 1,
},
"start": Object {
- "column": 41,
+ "column": 46,
"line": 1,
},
},
"range": Array [
- 41,
+ 46,
47,
],
"type": "Identifier",
- "value": "string",
+ "value": "T",
},
Object {
"loc": Object {
@@ -101448,14 +110371,14 @@ Object {
}
`;
-exports[`typescript fixtures/types/conditional-infer.src 1`] = `
+exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = `
Object {
"body": Array [
Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 13,
"line": 1,
},
"start": Object {
@@ -101463,17 +110386,17 @@ Object {
"line": 1,
},
},
- "name": "Element",
+ "name": "Unpacked",
"range": Array [
5,
- 12,
+ 13,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 48,
- "line": 1,
+ "column": 10,
+ "line": 5,
},
"start": Object {
"column": 0,
@@ -101482,41 +110405,41 @@ Object {
},
"range": Array [
0,
- 48,
+ 126,
],
"type": "TSTypeAliasDeclaration",
"typeAnnotation": Object {
"checkType": Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 1,
+ "column": 3,
+ "line": 2,
},
"start": Object {
- "column": 18,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
- 18,
- 19,
+ 21,
+ 22,
],
"type": "TSTypeReference",
"typeName": Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 1,
+ "column": 3,
+ "line": 2,
},
"start": Object {
- "column": 18,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"name": "T",
"range": Array [
- 18,
- 19,
+ 21,
+ 22,
],
"type": "Identifier",
},
@@ -101525,67 +110448,67 @@ Object {
"elementType": Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 1,
+ "column": 21,
+ "line": 2,
},
"start": Object {
- "column": 28,
- "line": 1,
+ "column": 12,
+ "line": 2,
},
},
"range": Array [
- 28,
- 37,
+ 31,
+ 40,
],
"type": "TSParenthesizedType",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 29,
- "line": 1,
+ "column": 13,
+ "line": 2,
},
},
"range": Array [
- 29,
- 36,
+ 32,
+ 39,
],
"type": "TSInferType",
"typeParameter": Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 35,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
},
"name": Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 35,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
},
"name": "U",
"range": Array [
- 35,
- 36,
+ 38,
+ 39,
],
"type": "Identifier",
},
"range": Array [
- 35,
- 36,
+ 38,
+ 39,
],
"type": "TSTypeParameter",
},
@@ -101593,100 +110516,432 @@ Object {
},
"loc": Object {
"end": Object {
- "column": 39,
- "line": 1,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 28,
- "line": 1,
+ "column": 12,
+ "line": 2,
},
},
"range": Array [
- 28,
- 39,
+ 31,
+ 42,
],
"type": "TSArrayType",
},
"falseType": Object {
+ "checkType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 53,
+ 54,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 53,
+ 54,
+ ],
+ "type": "Identifier",
+ },
+ },
+ "extendsType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 63,
+ 70,
+ ],
+ "type": "TSInferType",
+ "typeParameter": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 3,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 3,
+ },
+ },
+ "name": "U",
+ "range": Array [
+ 69,
+ 70,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 69,
+ 70,
+ ],
+ "type": "TSTypeParameter",
+ },
+ },
+ "falseType": Object {
+ "checkType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 83,
+ 84,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 4,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 83,
+ 84,
+ ],
+ "type": "Identifier",
+ },
+ },
+ "extendsType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 93,
+ 109,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 4,
+ },
+ },
+ "name": "Promise",
+ "range": Array [
+ 93,
+ 100,
+ ],
+ "type": "Identifier",
+ },
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 4,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 101,
+ 108,
+ ],
+ "type": "TSInferType",
+ "typeParameter": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 4,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 4,
+ },
+ },
+ "name": "U",
+ "range": Array [
+ 107,
+ 108,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 107,
+ 108,
+ ],
+ "type": "TSTypeParameter",
+ },
+ },
+ ],
+ "range": Array [
+ 100,
+ 109,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
+ "falseType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 5,
+ },
+ },
+ "range": Array [
+ 124,
+ 125,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 5,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 124,
+ 125,
+ ],
+ "type": "Identifier",
+ },
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 5,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 83,
+ 125,
+ ],
+ "trueType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 112,
+ 113,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 4,
+ },
+ },
+ "name": "U",
+ "range": Array [
+ 112,
+ 113,
+ ],
+ "type": "Identifier",
+ },
+ },
+ "type": "TSConditionalType",
+ },
"loc": Object {
"end": Object {
- "column": 47,
- "line": 1,
+ "column": 9,
+ "line": 5,
},
"start": Object {
- "column": 46,
- "line": 1,
+ "column": 4,
+ "line": 3,
},
},
"range": Array [
- 46,
- 47,
+ 53,
+ 125,
],
- "type": "TSTypeReference",
- "typeName": Object {
+ "trueType": Object {
"loc": Object {
"end": Object {
- "column": 47,
- "line": 1,
+ "column": 25,
+ "line": 3,
},
"start": Object {
- "column": 46,
- "line": 1,
+ "column": 24,
+ "line": 3,
},
},
- "name": "T",
"range": Array [
- 46,
- 47,
+ 73,
+ 74,
],
- "type": "Identifier",
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 3,
+ },
+ },
+ "name": "U",
+ "range": Array [
+ 73,
+ 74,
+ ],
+ "type": "Identifier",
+ },
},
+ "type": "TSConditionalType",
},
"loc": Object {
"end": Object {
- "column": 47,
- "line": 1,
+ "column": 9,
+ "line": 5,
},
"start": Object {
- "column": 18,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
- 18,
- 47,
+ 21,
+ 125,
],
"trueType": Object {
"loc": Object {
"end": Object {
- "column": 43,
- "line": 1,
+ "column": 27,
+ "line": 2,
},
"start": Object {
- "column": 42,
- "line": 1,
+ "column": 26,
+ "line": 2,
},
},
"range": Array [
- 42,
- 43,
+ 45,
+ 46,
],
"type": "TSTypeReference",
"typeName": Object {
"loc": Object {
"end": Object {
- "column": 43,
- "line": 1,
+ "column": 27,
+ "line": 2,
},
"start": Object {
- "column": 42,
- "line": 1,
+ "column": 26,
+ "line": 2,
},
},
"name": "U",
"range": Array [
- 42,
- 43,
+ 45,
+ 46,
],
"type": "Identifier",
},
@@ -101696,11 +110951,11 @@ Object {
"typeParameters": Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 13,
"line": 1,
},
},
@@ -101708,42 +110963,42 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 14,
"line": 1,
},
},
"name": Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 14,
"line": 1,
},
},
"name": "T",
"range": Array [
- 13,
14,
+ 15,
],
"type": "Identifier",
},
"range": Array [
- 13,
14,
+ 15,
],
"type": "TSTypeParameter",
},
],
"range": Array [
- 12,
- 15,
+ 13,
+ 16,
],
"type": "TSTypeParameterDeclaration",
},
@@ -101753,7 +111008,7 @@ Object {
"loc": Object {
"end": Object {
"column": 0,
- "line": 2,
+ "line": 6,
},
"start": Object {
"column": 0,
@@ -101762,7 +111017,7 @@ Object {
},
"range": Array [
0,
- 49,
+ 127,
],
"sourceType": "module",
"tokens": Array [
@@ -101787,7 +111042,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 13,
"line": 1,
},
"start": Object {
@@ -101797,25 +111052,25 @@ Object {
},
"range": Array [
5,
- 12,
+ 13,
],
"type": "Identifier",
- "value": "Element",
+ "value": "Unpacked",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 12,
13,
+ 14,
],
"type": "Punctuator",
"value": "<",
@@ -101823,17 +111078,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 13,
14,
+ 15,
],
"type": "Identifier",
"value": "T",
@@ -101841,17 +111096,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 14,
15,
+ 16,
],
"type": "Punctuator",
"value": ">",
@@ -101859,17 +111114,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 16,
17,
+ 18,
],
"type": "Punctuator",
"value": "=",
@@ -101877,17 +111132,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 19,
- "line": 1,
+ "column": 3,
+ "line": 2,
},
"start": Object {
- "column": 18,
- "line": 1,
+ "column": 2,
+ "line": 2,
},
},
"range": Array [
- 18,
- 19,
+ 21,
+ 22,
],
"type": "Identifier",
"value": "T",
@@ -101895,17 +111150,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 1,
+ "column": 11,
+ "line": 2,
},
"start": Object {
- "column": 20,
- "line": 1,
+ "column": 4,
+ "line": 2,
},
},
"range": Array [
- 20,
- 27,
+ 23,
+ 30,
],
"type": "Keyword",
"value": "extends",
@@ -101913,17 +111168,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 1,
+ "column": 13,
+ "line": 2,
},
"start": Object {
- "column": 28,
- "line": 1,
+ "column": 12,
+ "line": 2,
},
},
"range": Array [
- 28,
- 29,
+ 31,
+ 32,
],
"type": "Punctuator",
"value": "(",
@@ -101931,17 +111186,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 34,
- "line": 1,
+ "column": 18,
+ "line": 2,
},
"start": Object {
- "column": 29,
- "line": 1,
+ "column": 13,
+ "line": 2,
},
},
"range": Array [
- 29,
- 34,
+ 32,
+ 37,
],
"type": "Identifier",
"value": "infer",
@@ -101949,17 +111204,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
"start": Object {
- "column": 35,
- "line": 1,
+ "column": 19,
+ "line": 2,
},
},
"range": Array [
- 35,
- 36,
+ 38,
+ 39,
],
"type": "Identifier",
"value": "U",
@@ -101967,17 +111222,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 37,
- "line": 1,
+ "column": 21,
+ "line": 2,
},
"start": Object {
- "column": 36,
- "line": 1,
+ "column": 20,
+ "line": 2,
},
},
"range": Array [
- 36,
- 37,
+ 39,
+ 40,
],
"type": "Punctuator",
"value": ")",
@@ -101985,17 +111240,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 1,
+ "column": 22,
+ "line": 2,
},
"start": Object {
- "column": 37,
- "line": 1,
+ "column": 21,
+ "line": 2,
},
},
"range": Array [
- 37,
- 38,
+ 40,
+ 41,
],
"type": "Punctuator",
"value": "[",
@@ -102003,17 +111258,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 39,
- "line": 1,
+ "column": 23,
+ "line": 2,
},
"start": Object {
- "column": 38,
- "line": 1,
+ "column": 22,
+ "line": 2,
},
},
"range": Array [
- 38,
- 39,
+ 41,
+ 42,
],
"type": "Punctuator",
"value": "]",
@@ -102021,17 +111276,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 41,
- "line": 1,
+ "column": 25,
+ "line": 2,
},
"start": Object {
- "column": 40,
- "line": 1,
+ "column": 24,
+ "line": 2,
},
},
"range": Array [
- 40,
- 41,
+ 43,
+ 44,
],
"type": "Punctuator",
"value": "?",
@@ -102039,17 +111294,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 43,
- "line": 1,
+ "column": 27,
+ "line": 2,
},
"start": Object {
- "column": 42,
- "line": 1,
+ "column": 26,
+ "line": 2,
},
},
"range": Array [
- 42,
- 43,
+ 45,
+ 46,
],
"type": "Identifier",
"value": "U",
@@ -102057,17 +111312,323 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 45,
- "line": 1,
+ "column": 29,
+ "line": 2,
},
"start": Object {
- "column": 44,
- "line": 1,
+ "column": 28,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 47,
+ 48,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 53,
+ 54,
+ ],
+ "type": "Identifier",
+ "value": "T",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 55,
+ 62,
+ ],
+ "type": "Keyword",
+ "value": "extends",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 63,
+ 68,
+ ],
+ "type": "Identifier",
+ "value": "infer",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 69,
+ 70,
+ ],
+ "type": "Identifier",
+ "value": "U",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 22,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 71,
+ 72,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 73,
+ 74,
+ ],
+ "type": "Identifier",
+ "value": "U",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 75,
+ 76,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 6,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 83,
+ 84,
+ ],
+ "type": "Identifier",
+ "value": "T",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 85,
+ 92,
+ ],
+ "type": "Keyword",
+ "value": "extends",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 93,
+ 100,
+ ],
+ "type": "Identifier",
+ "value": "Promise",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 100,
+ 101,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 101,
+ 106,
+ ],
+ "type": "Identifier",
+ "value": "infer",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 107,
+ 108,
+ ],
+ "type": "Identifier",
+ "value": "U",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 108,
+ 109,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 110,
+ 111,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 4,
+ },
+ },
+ "range": Array [
+ 112,
+ 113,
+ ],
+ "type": "Identifier",
+ "value": "U",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 37,
+ "line": 4,
},
},
"range": Array [
- 44,
- 45,
+ 114,
+ 115,
],
"type": "Punctuator",
"value": ":",
@@ -102075,17 +111636,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 47,
- "line": 1,
+ "column": 9,
+ "line": 5,
},
"start": Object {
- "column": 46,
- "line": 1,
+ "column": 8,
+ "line": 5,
},
},
"range": Array [
- 46,
- 47,
+ 124,
+ 125,
],
"type": "Identifier",
"value": "T",
@@ -102093,17 +111654,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 48,
- "line": 1,
+ "column": 10,
+ "line": 5,
},
"start": Object {
- "column": 47,
- "line": 1,
+ "column": 9,
+ "line": 5,
},
},
"range": Array [
- 47,
- 48,
+ 125,
+ 126,
],
"type": "Punctuator",
"value": ";",
@@ -102113,14 +111674,14 @@ Object {
}
`;
-exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = `
+exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = `
Object {
"body": Array [
Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -102128,17 +111689,17 @@ Object {
"line": 1,
},
},
- "name": "Unpacked",
+ "name": "Foo",
"range": Array [
5,
- 13,
+ 8,
],
"type": "Identifier",
},
"loc": Object {
"end": Object {
- "column": 10,
- "line": 5,
+ "column": 63,
+ "line": 1,
},
"start": Object {
"column": 0,
@@ -102147,543 +111708,336 @@ Object {
},
"range": Array [
0,
- 126,
+ 63,
],
"type": "TSTypeAliasDeclaration",
"typeAnnotation": Object {
"checkType": Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 2,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 2,
- "line": 2,
+ "column": 14,
+ "line": 1,
},
},
"range": Array [
- 21,
- 22,
+ 14,
+ 15,
],
"type": "TSTypeReference",
"typeName": Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 2,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 2,
- "line": 2,
+ "column": 14,
+ "line": 1,
},
},
"name": "T",
"range": Array [
- 21,
- 22,
+ 14,
+ 15,
],
"type": "Identifier",
},
},
"extendsType": Object {
- "elementType": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 2,
- },
- "start": Object {
- "column": 12,
- "line": 2,
- },
- },
- "range": Array [
- 31,
- 40,
- ],
- "type": "TSParenthesizedType",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 13,
- "line": 2,
- },
- },
- "range": Array [
- 32,
- 39,
- ],
- "type": "TSInferType",
- "typeParameter": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 19,
- "line": 2,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 19,
- "line": 2,
- },
- },
- "name": "U",
- "range": Array [
- 38,
- 39,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 38,
- 39,
- ],
- "type": "TSTypeParameter",
- },
- },
- },
"loc": Object {
"end": Object {
- "column": 23,
- "line": 2,
+ "column": 50,
+ "line": 1,
},
"start": Object {
- "column": 12,
- "line": 2,
- },
- },
- "range": Array [
- 31,
- 42,
- ],
- "type": "TSArrayType",
- },
- "falseType": Object {
- "checkType": Object {
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "range": Array [
- 53,
- 54,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "name": "T",
- "range": Array [
- 53,
- 54,
- ],
- "type": "Identifier",
- },
- },
- "extendsType": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 3,
- },
- "start": Object {
- "column": 14,
- "line": 3,
- },
- },
- "range": Array [
- 63,
- 70,
- ],
- "type": "TSInferType",
- "typeParameter": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 3,
- },
- "start": Object {
- "column": 20,
- "line": 3,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 3,
- },
- "start": Object {
- "column": 20,
- "line": 3,
- },
- },
- "name": "U",
- "range": Array [
- 69,
- 70,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 69,
- 70,
- ],
- "type": "TSTypeParameter",
+ "column": 24,
+ "line": 1,
},
},
- "falseType": Object {
- "checkType": Object {
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 4,
- },
- "start": Object {
- "column": 6,
- "line": 4,
- },
- },
- "range": Array [
- 83,
- 84,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
+ "members": Array [
+ Object {
+ "computed": false,
+ "key": Object {
"loc": Object {
"end": Object {
- "column": 7,
- "line": 4,
+ "column": 27,
+ "line": 1,
},
"start": Object {
- "column": 6,
- "line": 4,
+ "column": 26,
+ "line": 1,
},
},
- "name": "T",
+ "name": "a",
"range": Array [
- 83,
- 84,
+ 26,
+ 27,
],
"type": "Identifier",
},
- },
- "extendsType": Object {
"loc": Object {
"end": Object {
- "column": 32,
- "line": 4,
+ "column": 37,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 4,
+ "column": 26,
+ "line": 1,
},
},
"range": Array [
- 93,
- 109,
+ 26,
+ 37,
],
- "type": "TSTypeReference",
- "typeName": Object {
+ "type": "TSPropertySignature",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 4,
+ "column": 36,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 4,
+ "column": 27,
+ "line": 1,
},
},
- "name": "Promise",
"range": Array [
- 93,
- 100,
+ 27,
+ 36,
],
- "type": "Identifier",
- },
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 32,
- "line": 4,
- },
- "start": Object {
- "column": 23,
- "line": 4,
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
},
- },
- "params": Array [
- Object {
+ "range": Array [
+ 29,
+ 36,
+ ],
+ "type": "TSInferType",
+ "typeParameter": Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 4,
+ "column": 36,
+ "line": 1,
},
"start": Object {
- "column": 24,
- "line": 4,
+ "column": 35,
+ "line": 1,
},
},
- "range": Array [
- 101,
- 108,
- ],
- "type": "TSInferType",
- "typeParameter": Object {
+ "name": Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 4,
+ "column": 36,
+ "line": 1,
},
"start": Object {
- "column": 30,
- "line": 4,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 4,
- },
- "start": Object {
- "column": 30,
- "line": 4,
- },
+ "column": 35,
+ "line": 1,
},
- "name": "U",
- "range": Array [
- 107,
- 108,
- ],
- "type": "Identifier",
},
+ "name": "U",
"range": Array [
- 107,
- 108,
+ 35,
+ 36,
],
- "type": "TSTypeParameter",
+ "type": "Identifier",
},
+ "range": Array [
+ 35,
+ 36,
+ ],
+ "type": "TSTypeParameter",
},
- ],
- "range": Array [
- 100,
- 109,
- ],
- "type": "TSTypeParameterInstantiation",
- },
- },
- "falseType": Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 5,
- },
- "start": Object {
- "column": 8,
- "line": 5,
},
},
- "range": Array [
- 124,
- 125,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
+ },
+ Object {
+ "computed": false,
+ "key": Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 5,
+ "column": 39,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 5,
+ "column": 38,
+ "line": 1,
},
},
- "name": "T",
+ "name": "b",
"range": Array [
- 124,
- 125,
+ 38,
+ 39,
],
"type": "Identifier",
},
- },
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 5,
- },
- "start": Object {
- "column": 6,
- "line": 4,
- },
- },
- "range": Array [
- 83,
- 125,
- ],
- "trueType": Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 4,
+ "column": 48,
+ "line": 1,
},
"start": Object {
- "column": 35,
- "line": 4,
+ "column": 38,
+ "line": 1,
},
},
"range": Array [
- 112,
- 113,
+ 38,
+ 48,
],
- "type": "TSTypeReference",
- "typeName": Object {
+ "type": "TSPropertySignature",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 4,
+ "column": 48,
+ "line": 1,
},
"start": Object {
- "column": 35,
- "line": 4,
+ "column": 39,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 39,
+ 48,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 41,
+ 48,
+ ],
+ "type": "TSInferType",
+ "typeParameter": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 47,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 47,
+ "line": 1,
+ },
+ },
+ "name": "U",
+ "range": Array [
+ 47,
+ 48,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 47,
+ 48,
+ ],
+ "type": "TSTypeParameter",
},
},
- "name": "U",
- "range": Array [
- 112,
- 113,
- ],
- "type": "Identifier",
},
},
- "type": "TSConditionalType",
- },
+ ],
+ "range": Array [
+ 24,
+ 50,
+ ],
+ "type": "TSTypeLiteral",
+ },
+ "falseType": Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 5,
+ "column": 62,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 3,
+ "column": 57,
+ "line": 1,
},
},
"range": Array [
- 53,
- 125,
+ 57,
+ 62,
],
- "trueType": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 3,
- },
- "start": Object {
- "column": 24,
- "line": 3,
- },
- },
- "range": Array [
- 73,
- 74,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 3,
- },
- "start": Object {
- "column": 24,
- "line": 3,
- },
- },
- "name": "U",
- "range": Array [
- 73,
- 74,
- ],
- "type": "Identifier",
- },
- },
- "type": "TSConditionalType",
+ "type": "TSNeverKeyword",
},
"loc": Object {
"end": Object {
- "column": 9,
- "line": 5,
+ "column": 62,
+ "line": 1,
},
"start": Object {
- "column": 2,
- "line": 2,
+ "column": 14,
+ "line": 1,
},
},
"range": Array [
- 21,
- 125,
+ 14,
+ 62,
],
"trueType": Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 2,
+ "column": 54,
+ "line": 1,
},
"start": Object {
- "column": 26,
- "line": 2,
+ "column": 53,
+ "line": 1,
},
},
"range": Array [
- 45,
- 46,
+ 53,
+ 54,
],
"type": "TSTypeReference",
"typeName": Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 2,
+ "column": 54,
+ "line": 1,
},
"start": Object {
- "column": 26,
- "line": 2,
+ "column": 53,
+ "line": 1,
},
},
"name": "U",
"range": Array [
- 45,
- 46,
+ 53,
+ 54,
],
"type": "Identifier",
},
@@ -102693,11 +112047,11 @@ Object {
"typeParameters": Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 8,
"line": 1,
},
},
@@ -102705,42 +112059,42 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 9,
"line": 1,
},
},
"name": Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 9,
"line": 1,
},
},
"name": "T",
"range": Array [
- 14,
- 15,
+ 9,
+ 10,
],
"type": "Identifier",
},
"range": Array [
- 14,
- 15,
+ 9,
+ 10,
],
"type": "TSTypeParameter",
},
],
"range": Array [
- 13,
- 16,
+ 8,
+ 11,
],
"type": "TSTypeParameterDeclaration",
},
@@ -102750,7 +112104,7 @@ Object {
"loc": Object {
"end": Object {
"column": 0,
- "line": 6,
+ "line": 2,
},
"start": Object {
"column": 0,
@@ -102759,7 +112113,7 @@ Object {
},
"range": Array [
0,
- 127,
+ 64,
],
"sourceType": "module",
"tokens": Array [
@@ -102784,7 +112138,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -102794,25 +112148,25 @@ Object {
},
"range": Array [
5,
- 13,
+ 8,
],
"type": "Identifier",
- "value": "Unpacked",
+ "value": "Foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 13,
- 14,
+ 8,
+ 9,
],
"type": "Punctuator",
"value": "<",
@@ -102820,17 +112174,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 14,
- 15,
+ 9,
+ 10,
],
"type": "Identifier",
"value": "T",
@@ -102838,17 +112192,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 15,
- 16,
+ 10,
+ 11,
],
"type": "Punctuator",
"value": ">",
@@ -102856,17 +112210,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 17,
- 18,
+ 12,
+ 13,
],
"type": "Punctuator",
"value": "=",
@@ -102874,17 +112228,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 3,
- "line": 2,
+ "column": 15,
+ "line": 1,
},
"start": Object {
- "column": 2,
- "line": 2,
+ "column": 14,
+ "line": 1,
},
},
"range": Array [
- 21,
- 22,
+ 14,
+ 15,
],
"type": "Identifier",
"value": "T",
@@ -102892,179 +112246,71 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 11,
- "line": 2,
+ "column": 23,
+ "line": 1,
},
"start": Object {
- "column": 4,
- "line": 2,
+ "column": 16,
+ "line": 1,
},
},
"range": Array [
+ 16,
23,
- 30,
],
"type": "Keyword",
"value": "extends",
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 2,
- },
- "start": Object {
- "column": 12,
- "line": 2,
- },
- },
- "range": Array [
- 31,
- 32,
- ],
- "type": "Punctuator",
- "value": "(",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 2,
- },
- "start": Object {
- "column": 13,
- "line": 2,
- },
- },
- "range": Array [
- 32,
- 37,
- ],
- "type": "Identifier",
- "value": "infer",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 2,
- },
- "start": Object {
- "column": 19,
- "line": 2,
- },
- },
- "range": Array [
- 38,
- 39,
- ],
- "type": "Identifier",
- "value": "U",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 2,
- },
- "start": Object {
- "column": 20,
- "line": 2,
- },
- },
- "range": Array [
- 39,
- 40,
- ],
- "type": "Punctuator",
- "value": ")",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 2,
- },
- "start": Object {
- "column": 21,
- "line": 2,
- },
- },
- "range": Array [
- 40,
- 41,
- ],
- "type": "Punctuator",
- "value": "[",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 2,
- },
- "start": Object {
- "column": 22,
- "line": 2,
- },
- },
- "range": Array [
- 41,
- 42,
- ],
- "type": "Punctuator",
- "value": "]",
- },
Object {
"loc": Object {
"end": Object {
"column": 25,
- "line": 2,
+ "line": 1,
},
"start": Object {
"column": 24,
- "line": 2,
+ "line": 1,
},
},
"range": Array [
- 43,
- 44,
+ 24,
+ 25,
],
"type": "Punctuator",
- "value": "?",
+ "value": "{",
},
Object {
"loc": Object {
"end": Object {
"column": 27,
- "line": 2,
+ "line": 1,
},
"start": Object {
"column": 26,
- "line": 2,
+ "line": 1,
},
},
"range": Array [
- 45,
- 46,
+ 26,
+ 27,
],
"type": "Identifier",
- "value": "U",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 2,
+ "column": 28,
+ "line": 1,
},
"start": Object {
- "column": 28,
- "line": 2,
+ "column": 27,
+ "line": 1,
},
},
"range": Array [
- 47,
- 48,
+ 27,
+ 28,
],
"type": "Punctuator",
"value": ":",
@@ -103072,53 +112318,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 5,
- "line": 3,
- },
- "start": Object {
- "column": 4,
- "line": 3,
- },
- },
- "range": Array [
- 53,
- 54,
- ],
- "type": "Identifier",
- "value": "T",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 3,
- },
- "start": Object {
- "column": 6,
- "line": 3,
- },
- },
- "range": Array [
- 55,
- 62,
- ],
- "type": "Keyword",
- "value": "extends",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 3,
+ "column": 34,
+ "line": 1,
},
"start": Object {
- "column": 14,
- "line": 3,
+ "column": 29,
+ "line": 1,
},
},
"range": Array [
- 63,
- 68,
+ 29,
+ 34,
],
"type": "Identifier",
"value": "infer",
@@ -103126,53 +112336,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 21,
- "line": 3,
- },
- "start": Object {
- "column": 20,
- "line": 3,
- },
- },
- "range": Array [
- 69,
- 70,
- ],
- "type": "Identifier",
- "value": "U",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 3,
- },
- "start": Object {
- "column": 22,
- "line": 3,
- },
- },
- "range": Array [
- 71,
- 72,
- ],
- "type": "Punctuator",
- "value": "?",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 3,
+ "column": 36,
+ "line": 1,
},
"start": Object {
- "column": 24,
- "line": 3,
+ "column": 35,
+ "line": 1,
},
},
"range": Array [
- 73,
- 74,
+ 35,
+ 36,
],
"type": "Identifier",
"value": "U",
@@ -103180,107 +112354,71 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 27,
- "line": 3,
+ "column": 37,
+ "line": 1,
},
"start": Object {
- "column": 26,
- "line": 3,
+ "column": 36,
+ "line": 1,
},
},
"range": Array [
- 75,
- 76,
+ 36,
+ 37,
],
"type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 4,
- },
- "start": Object {
- "column": 6,
- "line": 4,
- },
- },
- "range": Array [
- 83,
- 84,
- ],
- "type": "Identifier",
- "value": "T",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 4,
- },
- "start": Object {
- "column": 8,
- "line": 4,
- },
- },
- "range": Array [
- 85,
- 92,
- ],
- "type": "Keyword",
- "value": "extends",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
- "line": 4,
+ "column": 39,
+ "line": 1,
},
"start": Object {
- "column": 16,
- "line": 4,
+ "column": 38,
+ "line": 1,
},
},
"range": Array [
- 93,
- 100,
+ 38,
+ 39,
],
"type": "Identifier",
- "value": "Promise",
+ "value": "b",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
- "line": 4,
+ "column": 40,
+ "line": 1,
},
- "start": Object {
- "column": 23,
- "line": 4,
+ "start": Object {
+ "column": 39,
+ "line": 1,
},
},
"range": Array [
- 100,
- 101,
+ 39,
+ 40,
],
"type": "Punctuator",
- "value": "<",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
- "line": 4,
+ "column": 46,
+ "line": 1,
},
"start": Object {
- "column": 24,
- "line": 4,
+ "column": 41,
+ "line": 1,
},
},
"range": Array [
- 101,
- 106,
+ 41,
+ 46,
],
"type": "Identifier",
"value": "infer",
@@ -103288,17 +112426,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 31,
- "line": 4,
+ "column": 48,
+ "line": 1,
},
"start": Object {
- "column": 30,
- "line": 4,
+ "column": 47,
+ "line": 1,
},
},
"range": Array [
- 107,
- 108,
+ 47,
+ 48,
],
"type": "Identifier",
"value": "U",
@@ -103306,35 +112444,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 32,
- "line": 4,
+ "column": 50,
+ "line": 1,
},
"start": Object {
- "column": 31,
- "line": 4,
+ "column": 49,
+ "line": 1,
},
},
"range": Array [
- 108,
- 109,
+ 49,
+ 50,
],
"type": "Punctuator",
- "value": ">",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 34,
- "line": 4,
+ "column": 52,
+ "line": 1,
},
"start": Object {
- "column": 33,
- "line": 4,
+ "column": 51,
+ "line": 1,
},
},
"range": Array [
- 110,
- 111,
+ 51,
+ 52,
],
"type": "Punctuator",
"value": "?",
@@ -103342,17 +112480,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 36,
- "line": 4,
+ "column": 54,
+ "line": 1,
},
"start": Object {
- "column": 35,
- "line": 4,
+ "column": 53,
+ "line": 1,
},
},
"range": Array [
- 112,
- 113,
+ 53,
+ 54,
],
"type": "Identifier",
"value": "U",
@@ -103360,17 +112498,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 38,
- "line": 4,
+ "column": 56,
+ "line": 1,
},
"start": Object {
- "column": 37,
- "line": 4,
+ "column": 55,
+ "line": 1,
},
},
"range": Array [
- 114,
- 115,
+ 55,
+ 56,
],
"type": "Punctuator",
"value": ":",
@@ -103378,35 +112516,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 9,
- "line": 5,
+ "column": 62,
+ "line": 1,
},
"start": Object {
- "column": 8,
- "line": 5,
+ "column": 57,
+ "line": 1,
},
},
"range": Array [
- 124,
- 125,
+ 57,
+ 62,
],
"type": "Identifier",
- "value": "T",
+ "value": "never",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
- "line": 5,
+ "column": 63,
+ "line": 1,
},
"start": Object {
- "column": 9,
- "line": 5,
+ "column": 62,
+ "line": 1,
},
},
"range": Array [
- 125,
- 126,
+ 62,
+ 63,
],
"type": "Punctuator",
"value": ";",
@@ -103416,430 +112554,166 @@ Object {
}
`;
-exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = `
+exports[`typescript fixtures/types/conditional-with-null.src 1`] = `
Object {
"body": Array [
Object {
- "id": Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
- },
- },
- "name": "Foo",
- "range": Array [
- 5,
- 8,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 63,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 63,
- ],
- "type": "TSTypeAliasDeclaration",
- "typeAnnotation": Object {
- "checkType": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "range": Array [
- 14,
- 15,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
+ "declarations": Array [
+ Object {
+ "id": Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 45,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 4,
"line": 1,
},
},
- "name": "T",
+ "name": "x",
"range": Array [
- 14,
- 15,
+ 4,
+ 45,
],
"type": "Identifier",
- },
- },
- "extendsType": Object {
- "loc": Object {
- "end": Object {
- "column": 50,
- "line": 1,
- },
- "start": Object {
- "column": 24,
- "line": 1,
- },
- },
- "members": Array [
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 1,
- },
- "start": Object {
- "column": 26,
- "line": 1,
- },
- },
- "name": "a",
- "range": Array [
- 26,
- 27,
- ],
- "type": "Identifier",
- },
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 37,
+ "column": 45,
"line": 1,
},
"start": Object {
- "column": 26,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 26,
- 37,
+ 5,
+ 45,
],
- "type": "TSPropertySignature",
+ "type": "TSTypeAnnotation",
"typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 1,
- },
- "start": Object {
- "column": 27,
- "line": 1,
- },
- },
- "range": Array [
- 27,
- 36,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "checkType": Object {
"loc": Object {
"end": Object {
- "column": 36,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 29,
- 36,
+ 7,
+ 13,
],
- "type": "TSInferType",
- "typeParameter": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 1,
- },
- "start": Object {
- "column": 35,
- "line": 1,
- },
+ "type": "TSNumberKeyword",
+ },
+ "extendsType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
},
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 1,
- },
- "start": Object {
- "column": 35,
- "line": 1,
- },
- },
- "name": "U",
- "range": Array [
- 35,
- 36,
- ],
- "type": "Identifier",
+ "start": Object {
+ "column": 22,
+ "line": 1,
},
- "range": Array [
- 35,
- 36,
- ],
- "type": "TSTypeParameter",
},
+ "range": Array [
+ 22,
+ 28,
+ ],
+ "type": "TSStringKeyword",
},
- },
- },
- Object {
- "computed": false,
- "key": Object {
- "loc": Object {
- "end": Object {
- "column": 39,
- "line": 1,
- },
- "start": Object {
- "column": 38,
- "line": 1,
+ "falseType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 45,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 41,
+ "line": 1,
+ },
},
+ "range": Array [
+ 41,
+ 45,
+ ],
+ "type": "TSNullKeyword",
},
- "name": "b",
- "range": Array [
- 38,
- 39,
- ],
- "type": "Identifier",
- },
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 1,
- },
- "start": Object {
- "column": 38,
- "line": 1,
- },
- },
- "range": Array [
- 38,
- 48,
- ],
- "type": "TSPropertySignature",
- "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 48,
+ "column": 45,
"line": 1,
},
"start": Object {
- "column": 39,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 39,
- 48,
+ 7,
+ 45,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "trueType": Object {
"loc": Object {
"end": Object {
- "column": 48,
- "line": 1,
- },
- "start": Object {
- "column": 41,
+ "column": 38,
"line": 1,
},
- },
- "range": Array [
- 41,
- 48,
- ],
- "type": "TSInferType",
- "typeParameter": Object {
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 1,
- },
- "start": Object {
- "column": 47,
- "line": 1,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 48,
- "line": 1,
- },
- "start": Object {
- "column": 47,
- "line": 1,
- },
- },
- "name": "U",
- "range": Array [
- 47,
- 48,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 47,
- 48,
- ],
- "type": "TSTypeParameter",
- },
- },
- },
- },
- ],
- "range": Array [
- 24,
- 50,
- ],
- "type": "TSTypeLiteral",
- },
- "falseType": Object {
- "loc": Object {
- "end": Object {
- "column": 62,
- "line": 1,
- },
- "start": Object {
- "column": 57,
- "line": 1,
- },
- },
- "range": Array [
- 57,
- 62,
- ],
- "type": "TSNeverKeyword",
- },
- "loc": Object {
- "end": Object {
- "column": 62,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "range": Array [
- 14,
- 62,
- ],
- "trueType": Object {
- "loc": Object {
- "end": Object {
- "column": 54,
- "line": 1,
- },
- "start": Object {
- "column": 53,
- "line": 1,
- },
- },
- "range": Array [
- 53,
- 54,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 54,
- "line": 1,
- },
- "start": Object {
- "column": 53,
- "line": 1,
- },
- },
- "name": "U",
- "range": Array [
- 53,
- 54,
- ],
- "type": "Identifier",
- },
- },
- "type": "TSConditionalType",
- },
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 11,
- "line": 1,
- },
- "start": Object {
- "column": 8,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
+ "start": Object {
+ "column": 31,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 31,
+ 38,
+ ],
+ "type": "TSBooleanKeyword",
},
+ "type": "TSConditionalType",
},
- "name": "T",
- "range": Array [
- 9,
- 10,
- ],
- "type": "Identifier",
},
- "range": Array [
- 9,
- 10,
- ],
- "type": "TSTypeParameter",
},
- ],
- "range": Array [
- 8,
- 11,
- ],
- "type": "TSTypeParameterDeclaration",
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 45,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 4,
+ 45,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "kind": "let",
+ "loc": Object {
+ "end": Object {
+ "column": 46,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
},
+ "range": Array [
+ 0,
+ 46,
+ ],
+ "type": "VariableDeclaration",
},
],
"comments": Array [],
@@ -103855,14 +112729,14 @@ Object {
},
"range": Array [
0,
- 64,
+ 47,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 4,
+ "column": 3,
"line": 1,
},
"start": Object {
@@ -103872,15 +112746,33 @@ Object {
},
"range": Array [
0,
+ 3,
+ ],
+ "type": "Keyword",
+ "value": "let",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "range": Array [
4,
+ 5,
],
"type": "Identifier",
- "value": "type",
+ "value": "x",
},
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 6,
"line": 1,
},
"start": Object {
@@ -103890,169 +112782,462 @@ Object {
},
"range": Array [
5,
- 8,
+ 6,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 7,
+ 13,
],
"type": "Identifier",
- "value": "Foo",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 8,
- 9,
+ 14,
+ 21,
],
- "type": "Punctuator",
- "value": "<",
+ "type": "Keyword",
+ "value": "extends",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 22,
+ 28,
],
"type": "Identifier",
- "value": "T",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 30,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 29,
"line": 1,
},
},
"range": Array [
- 10,
- 11,
+ 29,
+ 30,
],
"type": "Punctuator",
- "value": ">",
+ "value": "?",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 38,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 31,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 31,
+ 38,
],
- "type": "Punctuator",
- "value": "=",
+ "type": "Identifier",
+ "value": "boolean",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 40,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 39,
"line": 1,
},
},
"range": Array [
- 14,
- 15,
+ 39,
+ 40,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Punctuator",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 45,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 41,
"line": 1,
},
},
"range": Array [
- 16,
- 23,
+ 41,
+ 45,
],
"type": "Keyword",
- "value": "extends",
+ "value": "null",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 46,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 45,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 45,
+ 46,
],
"type": "Punctuator",
- "value": "{",
+ "value": ";",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/types/constructor.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "declarations": Array [
+ Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "name": "f",
+ "range": Array [
+ 4,
+ 42,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 5,
+ 42,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 12,
+ 21,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 21,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 21,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ },
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 1,
+ },
+ },
+ "name": "b",
+ "optional": true,
+ "range": Array [
+ 23,
+ 33,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 33,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 27,
+ 33,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 7,
+ 42,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 35,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 35,
+ 42,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 38,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 38,
+ 42,
+ ],
+ "type": "TSVoidKeyword",
+ },
+ },
+ "type": "TSConstructorType",
+ },
+ },
+ },
+ "init": null,
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 4,
+ 42,
+ ],
+ "type": "VariableDeclarator",
+ },
+ ],
+ "kind": "let",
+ "loc": Object {
+ "end": Object {
+ "column": 43,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 43,
+ ],
+ "type": "VariableDeclaration",
+ },
+ ],
+ "comments": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
},
+ },
+ "range": Array [
+ 0,
+ 44,
+ ],
+ "sourceType": "module",
+ "tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 3,
"line": 1,
},
"start": Object {
- "column": 26,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 0,
+ 3,
+ ],
+ "type": "Keyword",
+ "value": "let",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 5,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 4,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 4,
+ 5,
],
"type": "Identifier",
- "value": "a",
+ "value": "f",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 6,
"line": 1,
},
"start": Object {
- "column": 27,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 27,
- 28,
+ 5,
+ 6,
],
"type": "Punctuator",
"value": ":",
@@ -104060,233 +113245,251 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 34,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 7,
"line": 1,
},
},
"range": Array [
- 29,
- 34,
+ 7,
+ 10,
],
- "type": "Identifier",
- "value": "infer",
+ "type": "Keyword",
+ "value": "new",
},
Object {
"loc": Object {
"end": Object {
- "column": 36,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 35,
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 35,
- 36,
+ 12,
+ 13,
],
"type": "Identifier",
- "value": "U",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 36,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 36,
- 37,
+ 13,
+ 14,
],
"type": "Punctuator",
- "value": ",",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 39,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 38,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 38,
- 39,
+ 15,
+ 21,
],
"type": "Identifier",
- "value": "b",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 40,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 39,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 39,
- 40,
+ 21,
+ 22,
],
"type": "Punctuator",
- "value": ":",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 46,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 41,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 41,
- 46,
+ 23,
+ 24,
],
"type": "Identifier",
- "value": "infer",
+ "value": "b",
},
Object {
"loc": Object {
"end": Object {
- "column": 48,
+ "column": 25,
"line": 1,
},
"start": Object {
- "column": 47,
+ "column": 24,
"line": 1,
},
},
"range": Array [
- 47,
- 48,
+ 24,
+ 25,
],
- "type": "Identifier",
- "value": "U",
+ "type": "Punctuator",
+ "value": "?",
},
Object {
"loc": Object {
"end": Object {
- "column": 50,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 49,
+ "column": 25,
"line": 1,
},
},
"range": Array [
- 49,
- 50,
+ 25,
+ 26,
],
"type": "Punctuator",
- "value": "}",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 52,
+ "column": 33,
"line": 1,
},
"start": Object {
- "column": 51,
+ "column": 27,
"line": 1,
},
},
"range": Array [
- 51,
- 52,
+ 27,
+ 33,
],
- "type": "Punctuator",
- "value": "?",
+ "type": "Identifier",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 54,
+ "column": 34,
"line": 1,
},
"start": Object {
- "column": 53,
+ "column": 33,
"line": 1,
},
},
"range": Array [
- 53,
- 54,
+ 33,
+ 34,
],
- "type": "Identifier",
- "value": "U",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 56,
+ "column": 37,
"line": 1,
},
"start": Object {
- "column": 55,
+ "column": 35,
"line": 1,
},
},
"range": Array [
- 55,
- 56,
+ 35,
+ 37,
],
"type": "Punctuator",
- "value": ":",
+ "value": "=>",
},
Object {
"loc": Object {
"end": Object {
- "column": 62,
+ "column": 42,
"line": 1,
},
"start": Object {
- "column": 57,
+ "column": 38,
"line": 1,
},
},
"range": Array [
- 57,
- 62,
+ 38,
+ 42,
],
- "type": "Identifier",
- "value": "never",
+ "type": "Keyword",
+ "value": "void",
},
Object {
"loc": Object {
"end": Object {
- "column": 63,
+ "column": 43,
"line": 1,
},
"start": Object {
- "column": 62,
+ "column": 42,
"line": 1,
},
},
"range": Array [
- 62,
- 63,
+ 42,
+ 43,
],
"type": "Punctuator",
"value": ";",
@@ -104296,7 +113499,7 @@ Object {
}
`;
-exports[`typescript fixtures/types/conditional-with-null.src 1`] = `
+exports[`typescript fixtures/types/constructor-generic.src 1`] = `
Object {
"body": Array [
Object {
@@ -104305,7 +113508,7 @@ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 45,
+ "column": 25,
"line": 1,
},
"start": Object {
@@ -104313,16 +113516,16 @@ Object {
"line": 1,
},
},
- "name": "x",
+ "name": "f",
"range": Array [
4,
- 45,
+ 25,
],
"type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 45,
+ "column": 25,
"line": 1,
},
"start": Object {
@@ -104332,100 +113535,210 @@ Object {
},
"range": Array [
5,
- 45,
+ 25,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
- "checkType": Object {
- "loc": Object {
- "end": Object {
- "column": 13,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
},
- "range": Array [
- 7,
- 13,
- ],
- "type": "TSNumberKeyword",
},
- "extendsType": Object {
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
},
- "start": Object {
- "column": 22,
- "line": 1,
+ "name": "a",
+ "range": Array [
+ 15,
+ 19,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 16,
+ 19,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 19,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 18,
+ 19,
+ ],
+ "type": "Identifier",
+ },
+ },
},
},
- "range": Array [
- 22,
- 28,
- ],
- "type": "TSStringKeyword",
- },
- "falseType": Object {
+ ],
+ "range": Array [
+ 7,
+ 25,
+ ],
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 45,
+ "column": 25,
"line": 1,
},
"start": Object {
- "column": 41,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 41,
- 45,
+ 21,
+ 25,
],
- "type": "TSNullKeyword",
- },
- "loc": Object {
- "end": Object {
- "column": 45,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 24,
+ 25,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 24,
+ 25,
+ ],
+ "type": "Identifier",
+ },
},
},
- "range": Array [
- 7,
- 45,
- ],
- "trueType": Object {
+ "type": "TSConstructorType",
+ "typeParameters": Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 31,
+ "column": 11,
"line": 1,
},
},
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 12,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 12,
+ 13,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
"range": Array [
- 31,
- 38,
+ 11,
+ 14,
],
- "type": "TSBooleanKeyword",
+ "type": "TSTypeParameterDeclaration",
},
- "type": "TSConditionalType",
},
},
},
"init": null,
"loc": Object {
"end": Object {
- "column": 45,
+ "column": 25,
"line": 1,
},
"start": Object {
@@ -104435,7 +113748,7 @@ Object {
},
"range": Array [
4,
- 45,
+ 25,
],
"type": "VariableDeclarator",
},
@@ -104443,7 +113756,7 @@ Object {
"kind": "let",
"loc": Object {
"end": Object {
- "column": 46,
+ "column": 26,
"line": 1,
},
"start": Object {
@@ -104453,7 +113766,7 @@ Object {
},
"range": Array [
0,
- 46,
+ 26,
],
"type": "VariableDeclaration",
},
@@ -104471,7 +113784,7 @@ Object {
},
"range": Array [
0,
- 47,
+ 27,
],
"sourceType": "module",
"tokens": Array [
@@ -104509,7 +113822,7 @@ Object {
5,
],
"type": "Identifier",
- "value": "x",
+ "value": "f",
},
Object {
"loc": Object {
@@ -104532,7 +113845,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 10,
"line": 1,
},
"start": Object {
@@ -104542,15 +113855,69 @@ Object {
},
"range": Array [
7,
+ 10,
+ ],
+ "type": "Keyword",
+ "value": "new",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 12,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 12,
13,
],
"type": "Identifier",
- "value": "number",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
"line": 1,
},
"start": Object {
@@ -104560,115 +113927,133 @@ Object {
},
"range": Array [
14,
- 21,
+ 15,
],
- "type": "Keyword",
- "value": "extends",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 28,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 22,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 22,
- 28,
+ 15,
+ 16,
],
"type": "Identifier",
- "value": "string",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 29,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 29,
- 30,
+ 16,
+ 17,
],
"type": "Punctuator",
- "value": "?",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 19,
"line": 1,
},
"start": Object {
- "column": 31,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 31,
- 38,
+ 18,
+ 19,
],
"type": "Identifier",
- "value": "boolean",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 40,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 39,
+ "column": 19,
"line": 1,
},
},
"range": Array [
- 39,
- 40,
+ 19,
+ 20,
],
"type": "Punctuator",
- "value": ":",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 45,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 41,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 41,
- 45,
+ 21,
+ 23,
],
- "type": "Keyword",
- "value": "null",
+ "type": "Punctuator",
+ "value": "=>",
},
Object {
"loc": Object {
"end": Object {
- "column": 46,
+ "column": 25,
"line": 1,
},
"start": Object {
- "column": 45,
+ "column": 24,
"line": 1,
},
},
"range": Array [
- 45,
- 46,
+ 24,
+ 25,
+ ],
+ "type": "Identifier",
+ "value": "T",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 26,
],
"type": "Punctuator",
"value": ";",
@@ -104678,7 +114063,7 @@ Object {
}
`;
-exports[`typescript fixtures/types/constructor.src 1`] = `
+exports[`typescript fixtures/types/constructor-in-generic.src 1`] = `
Object {
"body": Array [
Object {
@@ -104687,7 +114072,7 @@ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 42,
+ "column": 30,
"line": 1,
},
"start": Object {
@@ -104695,16 +114080,16 @@ Object {
"line": 1,
},
},
- "name": "f",
+ "name": "x",
"range": Array [
4,
- 42,
+ 30,
],
"type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 42,
+ "column": 30,
"line": 1,
},
"start": Object {
@@ -104714,13 +114099,13 @@ Object {
},
"range": Array [
5,
- 42,
+ 30,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 42,
+ "column": 30,
"line": 1,
},
"start": Object {
@@ -104728,28 +114113,45 @@ Object {
"line": 1,
},
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
+ "range": Array [
+ 7,
+ 30,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
},
- "name": "a",
- "range": Array [
- 12,
- 21,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "name": "Array",
+ "range": Array [
+ 7,
+ 12,
+ ],
+ "type": "Identifier",
+ },
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 29,
"line": 1,
},
"start": Object {
@@ -104757,130 +114159,61 @@ Object {
"line": 1,
},
},
+ "params": Array [],
"range": Array [
13,
- 21,
+ 29,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 15,
- 21,
+ 20,
+ 29,
],
- "type": "TSNumberKeyword",
- },
- },
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 1,
- },
- "start": Object {
- "column": 23,
- "line": 1,
- },
- },
- "name": "b",
- "optional": true,
- "range": Array [
- 23,
- 33,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 1,
- },
- "start": Object {
- "column": 25,
- "line": 1,
- },
- },
- "range": Array [
- 25,
- 33,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 33,
- "line": 1,
- },
- "start": Object {
- "column": 27,
- "line": 1,
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 23,
+ "line": 1,
+ },
},
+ "range": Array [
+ 23,
+ 29,
+ ],
+ "type": "TSStringKeyword",
},
- "range": Array [
- 27,
- 33,
- ],
- "type": "TSNumberKeyword",
},
+ "type": "TSConstructorType",
},
- },
- ],
- "range": Array [
- 7,
- 42,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 42,
- "line": 1,
- },
- "start": Object {
- "column": 35,
- "line": 1,
- },
- },
+ ],
"range": Array [
- 35,
- 42,
+ 12,
+ 30,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 42,
- "line": 1,
- },
- "start": Object {
- "column": 38,
- "line": 1,
- },
- },
- "range": Array [
- 38,
- 42,
- ],
- "type": "TSVoidKeyword",
- },
+ "type": "TSTypeParameterInstantiation",
},
- "type": "TSConstructorType",
},
},
},
"init": null,
"loc": Object {
"end": Object {
- "column": 42,
+ "column": 30,
"line": 1,
},
"start": Object {
@@ -104890,7 +114223,7 @@ Object {
},
"range": Array [
4,
- 42,
+ 30,
],
"type": "VariableDeclarator",
},
@@ -104898,7 +114231,7 @@ Object {
"kind": "let",
"loc": Object {
"end": Object {
- "column": 43,
+ "column": 31,
"line": 1,
},
"start": Object {
@@ -104908,7 +114241,7 @@ Object {
},
"range": Array [
0,
- 43,
+ 31,
],
"type": "VariableDeclaration",
},
@@ -104926,7 +114259,7 @@ Object {
},
"range": Array [
0,
- 44,
+ 32,
],
"sourceType": "module",
"tokens": Array [
@@ -104964,7 +114297,7 @@ Object {
5,
],
"type": "Identifier",
- "value": "f",
+ "value": "x",
},
Object {
"loc": Object {
@@ -104987,7 +114320,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 12,
"line": 1,
},
"start": Object {
@@ -104997,28 +114330,10 @@ Object {
},
"range": Array [
7,
- 10,
- ],
- "type": "Keyword",
- "value": "new",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
12,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "Array",
},
Object {
"loc": Object {
@@ -105035,13 +114350,13 @@ Object {
12,
13,
],
- "type": "Identifier",
- "value": "a",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 16,
"line": 1,
},
"start": Object {
@@ -105051,187 +114366,115 @@ Object {
},
"range": Array [
13,
- 14,
- ],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
- },
- "start": Object {
- "column": 15,
- "line": 1,
- },
- },
- "range": Array [
- 15,
- 21,
+ 16,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Keyword",
+ "value": "new",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 18,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 21,
- 22,
+ 17,
+ 18,
],
"type": "Punctuator",
- "value": ",",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 23,
- "line": 1,
- },
- },
- "range": Array [
- 23,
- 24,
- ],
- "type": "Identifier",
- "value": "b",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 19,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 18,
+ 19,
],
"type": "Punctuator",
- "value": "?",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 25,
- 26,
+ 20,
+ 22,
],
"type": "Punctuator",
- "value": ":",
+ "value": "=>",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
+ "column": 29,
"line": 1,
},
"start": Object {
- "column": 27,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 27,
- 33,
+ 23,
+ 29,
],
"type": "Identifier",
- "value": "number",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 1,
- },
- "start": Object {
- "column": 33,
- "line": 1,
- },
- },
- "range": Array [
- 33,
- 34,
- ],
- "type": "Punctuator",
- "value": ")",
+ "value": "string",
},
Object {
"loc": Object {
"end": Object {
- "column": 37,
+ "column": 30,
"line": 1,
},
"start": Object {
- "column": 35,
+ "column": 29,
"line": 1,
},
},
"range": Array [
- 35,
- 37,
+ 29,
+ 30,
],
"type": "Punctuator",
- "value": "=>",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 42,
- "line": 1,
- },
- "start": Object {
- "column": 38,
- "line": 1,
- },
- },
- "range": Array [
- 38,
- 42,
- ],
- "type": "Keyword",
- "value": "void",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 43,
+ "column": 31,
"line": 1,
},
"start": Object {
- "column": 42,
+ "column": 30,
"line": 1,
},
},
"range": Array [
- 42,
- 43,
+ 30,
+ 31,
],
"type": "Punctuator",
"value": ";",
@@ -105241,7 +114484,7 @@ Object {
}
`;
-exports[`typescript fixtures/types/constructor-generic.src 1`] = `
+exports[`typescript fixtures/types/constructor-with-rest.src 1`] = `
Object {
"body": Array [
Object {
@@ -105250,7 +114493,7 @@ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 35,
"line": 1,
},
"start": Object {
@@ -105261,13 +114504,13 @@ Object {
"name": "f",
"range": Array [
4,
- 25,
+ 35,
],
"type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 35,
"line": 1,
},
"start": Object {
@@ -105277,13 +114520,13 @@ Object {
},
"range": Array [
5,
- 25,
+ 35,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 35,
"line": 1,
},
"start": Object {
@@ -105293,194 +114536,138 @@ Object {
},
"params": Array [
Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 1,
- },
- "start": Object {
- "column": 15,
- "line": 1,
- },
- },
- "name": "a",
- "range": Array [
- 15,
- 19,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
+ "argument": Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 15,
"line": 1,
},
},
+ "name": "a",
"range": Array [
+ 15,
16,
- 19,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
- },
- "range": Array [
- 18,
- 19,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 18,
- 19,
- ],
- "type": "Identifier",
- },
- },
- },
- },
- ],
- "range": Array [
- 7,
- 25,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
- },
- "start": Object {
- "column": 21,
- "line": 1,
+ "type": "Identifier",
},
- },
- "range": Array [
- 21,
- 25,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 12,
+ 26,
],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
- },
- "start": Object {
- "column": 24,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 24,
- 25,
- ],
- "type": "Identifier",
- },
- },
- },
- "type": "TSConstructorType",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 14,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "params": Array [
- Object {
+ "type": "RestElement",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 16,
"line": 1,
},
},
- "name": Object {
+ "range": Array [
+ 16,
+ 26,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "elementType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 18,
+ 24,
+ ],
+ "type": "TSNumberKeyword",
+ },
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 18,
"line": 1,
},
},
- "name": "T",
"range": Array [
- 12,
- 13,
+ 18,
+ 26,
],
- "type": "Identifier",
+ "type": "TSArrayType",
},
- "range": Array [
- 12,
- 13,
- ],
- "type": "TSTypeParameter",
},
- ],
+ },
+ ],
+ "range": Array [
+ 7,
+ 35,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 35,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 28,
+ "line": 1,
+ },
+ },
"range": Array [
- 11,
- 14,
+ 28,
+ 35,
],
- "type": "TSTypeParameterDeclaration",
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 35,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 31,
+ 35,
+ ],
+ "type": "TSVoidKeyword",
+ },
},
+ "type": "TSConstructorType",
},
},
},
"init": null,
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 35,
"line": 1,
},
"start": Object {
@@ -105490,7 +114677,7 @@ Object {
},
"range": Array [
4,
- 25,
+ 35,
],
"type": "VariableDeclarator",
},
@@ -105498,7 +114685,7 @@ Object {
"kind": "let",
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 36,
"line": 1,
},
"start": Object {
@@ -105508,7 +114695,7 @@ Object {
},
"range": Array [
0,
- 26,
+ 36,
],
"type": "VariableDeclaration",
},
@@ -105526,7 +114713,7 @@ Object {
},
"range": Array [
0,
- 27,
+ 37,
],
"sourceType": "module",
"tokens": Array [
@@ -105618,12 +114805,12 @@ Object {
12,
],
"type": "Punctuator",
- "value": "<",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 15,
"line": 1,
},
"start": Object {
@@ -105633,115 +114820,115 @@ Object {
},
"range": Array [
12,
- 13,
+ 15,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Punctuator",
+ "value": "...",
},
Object {
"loc": Object {
"end": Object {
- "column": 14,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 13,
- 14,
+ 15,
+ 16,
],
- "type": "Punctuator",
- "value": ">",
+ "type": "Identifier",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 14,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 14,
- 15,
+ 16,
+ 17,
],
"type": "Punctuator",
- "value": "(",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 18,
"line": 1,
},
},
"range": Array [
- 15,
- 16,
+ 18,
+ 24,
],
"type": "Identifier",
- "value": "a",
+ "value": "number",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 25,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 24,
"line": 1,
},
},
"range": Array [
- 16,
- 17,
+ 24,
+ 25,
],
"type": "Punctuator",
- "value": ":",
+ "value": "[",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 26,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 25,
"line": 1,
},
},
"range": Array [
- 18,
- 19,
+ 25,
+ 26,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Punctuator",
+ "value": "]",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 27,
"line": 1,
},
"start": Object {
- "column": 19,
+ "column": 26,
"line": 1,
},
},
"range": Array [
- 19,
- 20,
+ 26,
+ 27,
],
"type": "Punctuator",
"value": ")",
@@ -105749,17 +114936,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 30,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 28,
"line": 1,
},
},
"range": Array [
- 21,
- 23,
+ 28,
+ 30,
],
"type": "Punctuator",
"value": "=>",
@@ -105767,35 +114954,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 35,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 31,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 31,
+ 35,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Keyword",
+ "value": "void",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 36,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 35,
"line": 1,
},
},
"range": Array [
- 25,
- 26,
+ 35,
+ 36,
],
"type": "Punctuator",
"value": ";",
@@ -105805,7 +114992,7 @@ Object {
}
`;
-exports[`typescript fixtures/types/constructor-in-generic.src 1`] = `
+exports[`typescript fixtures/types/function.src 1`] = `
Object {
"body": Array [
Object {
@@ -105814,7 +115001,7 @@ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 38,
"line": 1,
},
"start": Object {
@@ -105822,16 +115009,16 @@ Object {
"line": 1,
},
},
- "name": "x",
+ "name": "f",
"range": Array [
4,
- 30,
+ 38,
],
"type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 38,
"line": 1,
},
"start": Object {
@@ -105841,13 +115028,13 @@ Object {
},
"range": Array [
5,
- 30,
+ 38,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 38,
"line": 1,
},
"start": Object {
@@ -105855,107 +115042,159 @@ Object {
"line": 1,
},
},
- "range": Array [
- 7,
- 30,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 1,
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 1,
+ },
},
- "start": Object {
- "column": 7,
- "line": 1,
+ "name": "a",
+ "range": Array [
+ 8,
+ 17,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 9,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 9,
+ 17,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 11,
+ 17,
+ ],
+ "type": "TSNumberKeyword",
+ },
},
},
- "name": "Array",
- "range": Array [
- 7,
- 12,
- ],
- "type": "Identifier",
- },
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
},
- },
- "params": Array [
- Object {
+ "name": "b",
+ "optional": true,
+ "range": Array [
+ 19,
+ 29,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
"column": 29,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 21,
"line": 1,
},
},
- "params": Array [],
"range": Array [
- 13,
+ 21,
29,
],
- "returnType": Object {
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
"loc": Object {
"end": Object {
"column": 29,
"line": 1,
},
"start": Object {
- "column": 20,
+ "column": 23,
"line": 1,
},
},
"range": Array [
- 20,
+ 23,
29,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 23,
- "line": 1,
- },
- },
- "range": Array [
- 23,
- 29,
- ],
- "type": "TSStringKeyword",
- },
+ "type": "TSNumberKeyword",
},
- "type": "TSConstructorType",
},
- ],
+ },
+ ],
+ "range": Array [
+ 7,
+ 38,
+ ],
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 1,
+ },
+ },
"range": Array [
- 12,
- 30,
+ 31,
+ 38,
],
- "type": "TSTypeParameterInstantiation",
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 34,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 34,
+ 38,
+ ],
+ "type": "TSVoidKeyword",
+ },
},
+ "type": "TSFunctionType",
},
},
},
"init": null,
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 38,
"line": 1,
},
"start": Object {
@@ -105965,7 +115204,7 @@ Object {
},
"range": Array [
4,
- 30,
+ 38,
],
"type": "VariableDeclarator",
},
@@ -105973,7 +115212,7 @@ Object {
"kind": "let",
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 39,
"line": 1,
},
"start": Object {
@@ -105983,7 +115222,7 @@ Object {
},
"range": Array [
0,
- 31,
+ 39,
],
"type": "VariableDeclaration",
},
@@ -106001,7 +115240,7 @@ Object {
},
"range": Array [
0,
- 32,
+ 40,
],
"sourceType": "module",
"tokens": Array [
@@ -106039,7 +115278,7 @@ Object {
5,
],
"type": "Identifier",
- "value": "x",
+ "value": "f",
},
Object {
"loc": Object {
@@ -106062,7 +115301,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -106072,46 +115311,64 @@ Object {
},
"range": Array [
7,
- 12,
+ 8,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 8,
+ 9,
],
"type": "Identifier",
- "value": "Array",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 12,
- 13,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": "<",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 17,
"line": 1,
},
"start": Object {
- "column": 13,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 13,
- 16,
+ 11,
+ 17,
],
- "type": "Keyword",
- "value": "new",
+ "type": "Identifier",
+ "value": "number",
},
Object {
"loc": Object {
@@ -106129,30 +115386,30 @@ Object {
18,
],
"type": "Punctuator",
- "value": "(",
+ "value": ",",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 19,
"line": 1,
},
},
"range": Array [
- 18,
19,
+ 20,
],
- "type": "Punctuator",
- "value": ")",
+ "type": "Identifier",
+ "value": "b",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 21,
"line": 1,
},
"start": Object {
@@ -106162,10 +115419,28 @@ Object {
},
"range": Array [
20,
+ 21,
+ ],
+ "type": "Punctuator",
+ "value": "?",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 21,
22,
],
"type": "Punctuator",
- "value": "=>",
+ "value": ":",
},
Object {
"loc": Object {
@@ -106183,7 +115458,7 @@ Object {
29,
],
"type": "Identifier",
- "value": "string",
+ "value": "number",
},
Object {
"loc": Object {
@@ -106200,23 +115475,59 @@ Object {
29,
30,
],
- "type": "Punctuator",
- "value": ">",
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 31,
+ 33,
+ ],
+ "type": "Punctuator",
+ "value": "=>",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 34,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 34,
+ 38,
+ ],
+ "type": "Keyword",
+ "value": "void",
},
Object {
"loc": Object {
"end": Object {
- "column": 31,
+ "column": 39,
"line": 1,
},
"start": Object {
- "column": 30,
+ "column": 38,
"line": 1,
},
},
"range": Array [
- 30,
- 31,
+ 38,
+ 39,
],
"type": "Punctuator",
"value": ";",
@@ -106226,7 +115537,7 @@ Object {
}
`;
-exports[`typescript fixtures/types/constructor-with-rest.src 1`] = `
+exports[`typescript fixtures/types/function-generic.src 1`] = `
Object {
"body": Array [
Object {
@@ -106235,7 +115546,7 @@ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 21,
"line": 1,
},
"start": Object {
@@ -106246,13 +115557,13 @@ Object {
"name": "f",
"range": Array [
4,
- 35,
+ 21,
],
"type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 21,
"line": 1,
},
"start": Object {
@@ -106262,13 +115573,13 @@ Object {
},
"range": Array [
5,
- 35,
+ 21,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 21,
"line": 1,
},
"start": Object {
@@ -106278,138 +115589,194 @@ Object {
},
"params": Array [
Object {
- "argument": Object {
- "loc": Object {
- "end": Object {
- "column": 16,
- "line": 1,
- },
- "start": Object {
- "column": 15,
- "line": 1,
- },
- },
- "name": "a",
- "range": Array [
- 15,
- 16,
- ],
- "type": "Identifier",
- },
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 11,
"line": 1,
},
},
+ "name": "a",
"range": Array [
- 12,
- 26,
+ 11,
+ 15,
],
- "type": "RestElement",
+ "type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 16,
- 26,
+ 12,
+ 15,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
- "elementType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 14,
"line": 1,
},
},
+ "name": "T",
"range": Array [
- 18,
- 24,
+ 14,
+ 15,
],
- "type": "TSNumberKeyword",
- },
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 1,
- },
- "start": Object {
- "column": 18,
- "line": 1,
- },
+ "type": "Identifier",
},
- "range": Array [
- 18,
- 26,
- ],
- "type": "TSArrayType",
},
},
},
],
"range": Array [
7,
- 35,
+ 21,
],
"returnType": Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 28,
- 35,
+ 17,
+ 21,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 31,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 31,
- 35,
+ 20,
+ 21,
],
- "type": "TSVoidKeyword",
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Identifier",
+ },
},
},
- "type": "TSConstructorType",
+ "type": "TSFunctionType",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 7,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 8,
+ "line": 1,
+ },
+ },
+ "name": "T",
+ "range": Array [
+ 8,
+ 9,
+ ],
+ "type": "Identifier",
+ },
+ "range": Array [
+ 8,
+ 9,
+ ],
+ "type": "TSTypeParameter",
+ },
+ ],
+ "range": Array [
+ 7,
+ 10,
+ ],
+ "type": "TSTypeParameterDeclaration",
+ },
},
},
},
"init": null,
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 21,
"line": 1,
},
"start": Object {
@@ -106419,7 +115786,7 @@ Object {
},
"range": Array [
4,
- 35,
+ 21,
],
"type": "VariableDeclarator",
},
@@ -106427,7 +115794,7 @@ Object {
"kind": "let",
"loc": Object {
"end": Object {
- "column": 36,
+ "column": 22,
"line": 1,
},
"start": Object {
@@ -106437,7 +115804,7 @@ Object {
},
"range": Array [
0,
- 36,
+ 22,
],
"type": "VariableDeclaration",
},
@@ -106455,7 +115822,7 @@ Object {
},
"range": Array [
0,
- 37,
+ 23,
],
"sourceType": "module",
"tokens": Array [
@@ -106516,7 +115883,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -106526,151 +115893,133 @@ Object {
},
"range": Array [
7,
- 10,
- ],
- "type": "Keyword",
- "value": "new",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 12,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 12,
+ 8,
],
"type": "Punctuator",
- "value": "(",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 15,
+ "column": 9,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 8,
"line": 1,
},
},
"range": Array [
- 12,
- 15,
+ 8,
+ 9,
],
- "type": "Punctuator",
- "value": "...",
+ "type": "Identifier",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 16,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 15,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 15,
- 16,
+ 9,
+ 10,
],
- "type": "Identifier",
- "value": "a",
+ "type": "Punctuator",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 11,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 10,
"line": 1,
},
},
"range": Array [
- 16,
- 17,
+ 10,
+ 11,
],
"type": "Punctuator",
- "value": ":",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 18,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 18,
- 24,
+ 11,
+ 12,
],
"type": "Identifier",
- "value": "number",
+ "value": "a",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 24,
- 25,
+ 12,
+ 13,
],
"type": "Punctuator",
- "value": "[",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 26,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 25,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 25,
- 26,
+ 14,
+ 15,
],
- "type": "Punctuator",
- "value": "]",
+ "type": "Identifier",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 27,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 26,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 26,
- 27,
+ 15,
+ 16,
],
"type": "Punctuator",
"value": ")",
@@ -106678,17 +116027,17 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 30,
+ "column": 19,
"line": 1,
},
"start": Object {
- "column": 28,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 28,
- 30,
+ 17,
+ 19,
],
"type": "Punctuator",
"value": "=>",
@@ -106696,35 +116045,35 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 35,
+ "column": 21,
"line": 1,
},
"start": Object {
- "column": 31,
+ "column": 20,
"line": 1,
},
},
"range": Array [
- 31,
- 35,
+ 20,
+ 21,
],
- "type": "Keyword",
- "value": "void",
+ "type": "Identifier",
+ "value": "T",
},
Object {
"loc": Object {
"end": Object {
- "column": 36,
+ "column": 22,
"line": 1,
},
"start": Object {
- "column": 35,
+ "column": 21,
"line": 1,
},
},
"range": Array [
- 35,
- 36,
+ 21,
+ 22,
],
"type": "Punctuator",
"value": ";",
@@ -106734,7 +116083,7 @@ Object {
}
`;
-exports[`typescript fixtures/types/function.src 1`] = `
+exports[`typescript fixtures/types/function-in-generic.src 1`] = `
Object {
"body": Array [
Object {
@@ -106743,7 +116092,7 @@ Object {
"id": Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 24,
"line": 1,
},
"start": Object {
@@ -106751,16 +116100,16 @@ Object {
"line": 1,
},
},
- "name": "f",
+ "name": "x",
"range": Array [
4,
- 38,
+ 24,
],
"type": "Identifier",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 24,
"line": 1,
},
"start": Object {
@@ -106770,13 +116119,13 @@ Object {
},
"range": Array [
5,
- 38,
+ 24,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 24,
"line": 1,
},
"start": Object {
@@ -106784,159 +116133,107 @@ Object {
"line": 1,
},
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 8,
- "line": 1,
- },
+ "range": Array [
+ 7,
+ 24,
+ ],
+ "type": "TSTypeReference",
+ "typeName": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
},
- "name": "a",
- "range": Array [
- 8,
- 17,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 9,
- "line": 1,
- },
- },
- "range": Array [
- 9,
- 17,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 17,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "range": Array [
- 11,
- 17,
- ],
- "type": "TSNumberKeyword",
- },
+ "start": Object {
+ "column": 7,
+ "line": 1,
},
},
- Object {
- "loc": Object {
- "end": Object {
- "column": 29,
- "line": 1,
- },
- "start": Object {
- "column": 19,
- "line": 1,
- },
+ "name": "Array",
+ "range": Array [
+ 7,
+ 12,
+ ],
+ "type": "Identifier",
+ },
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
},
- "name": "b",
- "optional": true,
- "range": Array [
- 19,
- 29,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 13,
"line": 1,
},
},
+ "params": Array [],
"range": Array [
- 21,
- 29,
+ 13,
+ 23,
],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 23,
"line": 1,
},
"start": Object {
- "column": 23,
+ "column": 16,
"line": 1,
},
},
"range": Array [
+ 16,
23,
- 29,
],
- "type": "TSNumberKeyword",
- },
- },
- },
- ],
- "range": Array [
- 7,
- 38,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 31,
- "line": 1,
- },
- },
- "range": Array [
- 31,
- 38,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 34,
- "line": 1,
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 19,
+ 23,
+ ],
+ "type": "TSVoidKeyword",
+ },
},
+ "type": "TSFunctionType",
},
- "range": Array [
- 34,
- 38,
- ],
- "type": "TSVoidKeyword",
- },
+ ],
+ "range": Array [
+ 12,
+ 24,
+ ],
+ "type": "TSTypeParameterInstantiation",
},
- "type": "TSFunctionType",
},
},
},
"init": null,
"loc": Object {
"end": Object {
- "column": 38,
+ "column": 24,
"line": 1,
},
"start": Object {
@@ -106946,7 +116243,7 @@ Object {
},
"range": Array [
4,
- 38,
+ 24,
],
"type": "VariableDeclarator",
},
@@ -106954,7 +116251,7 @@ Object {
"kind": "let",
"loc": Object {
"end": Object {
- "column": 39,
+ "column": 25,
"line": 1,
},
"start": Object {
@@ -106964,7 +116261,7 @@ Object {
},
"range": Array [
0,
- 39,
+ 25,
],
"type": "VariableDeclaration",
},
@@ -106982,7 +116279,7 @@ Object {
},
"range": Array [
0,
- 40,
+ 26,
],
"sourceType": "module",
"tokens": Array [
@@ -107020,7 +116317,7 @@ Object {
5,
],
"type": "Identifier",
- "value": "f",
+ "value": "x",
},
Object {
"loc": Object {
@@ -107043,7 +116340,7 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 8,
+ "column": 12,
"line": 1,
},
"start": Object {
@@ -107053,64 +116350,64 @@ Object {
},
"range": Array [
7,
- 8,
+ 12,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "Array",
},
Object {
"loc": Object {
"end": Object {
- "column": 9,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 8,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 8,
- 9,
+ 12,
+ 13,
],
- "type": "Identifier",
- "value": "a",
+ "type": "Punctuator",
+ "value": "<",
},
Object {
"loc": Object {
"end": Object {
- "column": 10,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 9,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 9,
- 10,
+ 13,
+ 14,
],
"type": "Punctuator",
- "value": ":",
+ "value": "(",
},
Object {
"loc": Object {
"end": Object {
- "column": 17,
+ "column": 15,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 14,
"line": 1,
},
},
"range": Array [
- 11,
- 17,
+ 14,
+ 15,
],
- "type": "Identifier",
- "value": "number",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
@@ -107119,21 +116416,21 @@ Object {
"line": 1,
},
"start": Object {
- "column": 17,
+ "column": 16,
"line": 1,
},
},
"range": Array [
- 17,
+ 16,
18,
],
"type": "Punctuator",
- "value": ",",
+ "value": "=>",
},
Object {
"loc": Object {
"end": Object {
- "column": 20,
+ "column": 23,
"line": 1,
},
"start": Object {
@@ -107143,51 +116440,15 @@ Object {
},
"range": Array [
19,
- 20,
- ],
- "type": "Identifier",
- "value": "b",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
- },
- "start": Object {
- "column": 20,
- "line": 1,
- },
- },
- "range": Array [
- 20,
- 21,
- ],
- "type": "Punctuator",
- "value": "?",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 1,
- },
- "start": Object {
- "column": 21,
- "line": 1,
- },
- },
- "range": Array [
- 21,
- 22,
+ 23,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Keyword",
+ "value": "void",
},
Object {
"loc": Object {
"end": Object {
- "column": 29,
+ "column": 24,
"line": 1,
},
"start": Object {
@@ -107197,358 +116458,195 @@ Object {
},
"range": Array [
23,
- 29,
- ],
- "type": "Identifier",
- "value": "number",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 1,
- },
- "start": Object {
- "column": 29,
- "line": 1,
- },
- },
- "range": Array [
- 29,
- 30,
+ 24,
],
"type": "Punctuator",
- "value": ")",
+ "value": ">",
},
Object {
"loc": Object {
"end": Object {
- "column": 33,
+ "column": 25,
"line": 1,
},
"start": Object {
- "column": 31,
+ "column": 24,
"line": 1,
},
},
"range": Array [
- 31,
- 33,
+ 24,
+ 25,
],
"type": "Punctuator",
- "value": "=>",
+ "value": ";",
},
+ ],
+ "type": "Program",
+}
+`;
+
+exports[`typescript fixtures/types/function-with-array-destruction.src 1`] = `
+Object {
+ "body": Array [
Object {
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 1,
- },
- "start": Object {
- "column": 34,
- "line": 1,
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
},
+ "name": "foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
},
- "range": Array [
- 34,
- 38,
- ],
- "type": "Keyword",
- "value": "void",
- },
- Object {
"loc": Object {
"end": Object {
- "column": 39,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 38,
+ "column": 0,
"line": 1,
},
},
"range": Array [
- 38,
- 39,
+ 0,
+ 28,
],
- "type": "Punctuator",
- "value": ";",
- },
- ],
- "type": "Program",
-}
-`;
-
-exports[`typescript fixtures/types/function-generic.src 1`] = `
-Object {
- "body": Array [
- Object {
- "declarations": Array [
- Object {
- "id": Object {
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "elements": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "type": "Identifier",
+ },
+ ],
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 4,
+ "column": 12,
"line": 1,
},
},
- "name": "f",
"range": Array [
- 4,
- 21,
+ 12,
+ 20,
],
- "type": "Identifier",
+ "type": "ArrayPattern",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 15,
"line": 1,
},
},
"range": Array [
- 5,
- 21,
+ 15,
+ 20,
],
"type": "TSTypeAnnotation",
"typeAnnotation": Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 17,
"line": 1,
},
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 11,
- "line": 1,
- },
- },
- "name": "a",
- "range": Array [
- 11,
- 15,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
- },
- "range": Array [
- 12,
- 15,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "range": Array [
- 14,
- 15,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 15,
- "line": 1,
- },
- "start": Object {
- "column": 14,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 14,
- 15,
- ],
- "type": "Identifier",
- },
- },
- },
- },
- ],
"range": Array [
- 7,
- 21,
+ 17,
+ 20,
],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
- },
- "start": Object {
- "column": 17,
- "line": 1,
- },
- },
- "range": Array [
- 17,
- 21,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
- },
- "start": Object {
- "column": 20,
- "line": 1,
- },
- },
- "range": Array [
- 20,
- 21,
- ],
- "type": "TSTypeReference",
- "typeName": Object {
- "loc": Object {
- "end": Object {
- "column": 21,
- "line": 1,
- },
- "start": Object {
- "column": 20,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 20,
- 21,
- ],
- "type": "Identifier",
- },
- },
- },
- "type": "TSFunctionType",
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 10,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
- },
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 1,
- },
- "start": Object {
- "column": 8,
- "line": 1,
- },
- },
- "name": Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 1,
- },
- "start": Object {
- "column": 8,
- "line": 1,
- },
- },
- "name": "T",
- "range": Array [
- 8,
- 9,
- ],
- "type": "Identifier",
- },
- "range": Array [
- 8,
- 9,
- ],
- "type": "TSTypeParameter",
- },
- ],
- "range": Array [
- 7,
- 10,
- ],
- "type": "TSTypeParameterDeclaration",
- },
+ "type": "TSAnyKeyword",
},
},
},
- "init": null,
+ ],
+ "range": Array [
+ 11,
+ 28,
+ ],
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 21,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 4,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 4,
- 21,
+ 22,
+ 28,
],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "let",
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
- },
- },
- "range": Array [
- 0,
- 22,
- ],
- "type": "VariableDeclaration",
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 28,
+ ],
+ "type": "TSAnyKeyword",
+ },
+ },
+ "type": "TSFunctionType",
+ },
},
],
"comments": Array [],
@@ -107564,14 +116662,14 @@ Object {
},
"range": Array [
0,
- 23,
+ 29,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 3,
+ "column": 4,
"line": 1,
},
"start": Object {
@@ -107581,33 +116679,15 @@ Object {
},
"range": Array [
0,
- 3,
- ],
- "type": "Keyword",
- "value": "let",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 5,
- "line": 1,
- },
- "start": Object {
- "column": 4,
- "line": 1,
- },
- },
- "range": Array [
4,
- 5,
],
"type": "Identifier",
- "value": "f",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 8,
"line": 1,
},
"start": Object {
@@ -107617,46 +116697,10 @@ Object {
},
"range": Array [
5,
- 6,
- ],
- "type": "Punctuator",
- "value": ":",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 8,
- "line": 1,
- },
- "start": Object {
- "column": 7,
- "line": 1,
- },
- },
- "range": Array [
- 7,
- 8,
- ],
- "type": "Punctuator",
- "value": "<",
- },
- Object {
- "loc": Object {
- "end": Object {
- "column": 9,
- "line": 1,
- },
- "start": Object {
- "column": 8,
- "line": 1,
- },
- },
- "range": Array [
8,
- 9,
],
"type": "Identifier",
- "value": "T",
+ "value": "foo",
},
Object {
"loc": Object {
@@ -107674,22 +116718,22 @@ Object {
10,
],
"type": "Punctuator",
- "value": ">",
+ "value": "=",
},
Object {
"loc": Object {
"end": Object {
- "column": 11,
+ "column": 12,
"line": 1,
},
"start": Object {
- "column": 10,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 10,
11,
+ 12,
],
"type": "Punctuator",
"value": "(",
@@ -107697,38 +116741,38 @@ Object {
Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 13,
"line": 1,
},
"start": Object {
- "column": 11,
+ "column": 12,
"line": 1,
},
},
"range": Array [
- 11,
12,
+ 13,
],
- "type": "Identifier",
- "value": "a",
+ "type": "Punctuator",
+ "value": "[",
},
Object {
"loc": Object {
"end": Object {
- "column": 13,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 12,
+ "column": 13,
"line": 1,
},
},
"range": Array [
- 12,
13,
+ 14,
],
- "type": "Punctuator",
- "value": ":",
+ "type": "Identifier",
+ "value": "a",
},
Object {
"loc": Object {
@@ -107745,8 +116789,8 @@ Object {
14,
15,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Punctuator",
+ "value": "]",
},
Object {
"loc": Object {
@@ -107764,12 +116808,12 @@ Object {
16,
],
"type": "Punctuator",
- "value": ")",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 19,
+ "column": 20,
"line": 1,
},
"start": Object {
@@ -107779,10 +116823,10 @@ Object {
},
"range": Array [
17,
- 19,
+ 20,
],
- "type": "Punctuator",
- "value": "=>",
+ "type": "Identifier",
+ "value": "any",
},
Object {
"loc": Object {
@@ -107799,213 +116843,250 @@ Object {
20,
21,
],
- "type": "Identifier",
- "value": "T",
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
"end": Object {
- "column": 22,
+ "column": 24,
"line": 1,
},
"start": Object {
- "column": 21,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 21,
22,
+ 24,
],
"type": "Punctuator",
- "value": ";",
+ "value": "=>",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 28,
+ ],
+ "type": "Identifier",
+ "value": "any",
},
],
"type": "Program",
}
`;
-exports[`typescript fixtures/types/function-in-generic.src 1`] = `
+exports[`typescript fixtures/types/function-with-object-destruction.src 1`] = `
Object {
"body": Array [
Object {
- "declarations": Array [
- Object {
- "id": Object {
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 8,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 5,
+ "line": 1,
+ },
+ },
+ "name": "foo",
+ "range": Array [
+ 5,
+ 8,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 28,
+ ],
+ "type": "TSTypeAliasDeclaration",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 4,
+ "column": 12,
"line": 1,
},
},
- "name": "x",
- "range": Array [
- 4,
- 24,
- ],
- "type": "Identifier",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 5,
- "line": 1,
+ "properties": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 14,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "name": "a",
+ "range": Array [
+ 13,
+ 14,
+ ],
+ "type": "Identifier",
},
- },
- "range": Array [
- 5,
- 24,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
+ "kind": "init",
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 13,
"line": 1,
},
},
+ "method": false,
"range": Array [
- 7,
- 24,
+ 13,
+ 14,
],
- "type": "TSTypeReference",
- "typeName": Object {
+ "shorthand": true,
+ "type": "Property",
+ "value": Object {
"loc": Object {
"end": Object {
- "column": 12,
+ "column": 14,
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 13,
"line": 1,
},
},
- "name": "Array",
+ "name": "a",
"range": Array [
- 7,
- 12,
+ 13,
+ 14,
],
"type": "Identifier",
},
- "typeParameters": Object {
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- },
- "start": Object {
- "column": 12,
- "line": 1,
- },
+ },
+ ],
+ "range": Array [
+ 12,
+ 20,
+ ],
+ "type": "ObjectPattern",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 15,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 15,
+ 20,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 17,
+ "line": 1,
},
- "params": Array [
- Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 1,
- },
- "start": Object {
- "column": 13,
- "line": 1,
- },
- },
- "params": Array [],
- "range": Array [
- 13,
- 23,
- ],
- "returnType": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 1,
- },
- "start": Object {
- "column": 16,
- "line": 1,
- },
- },
- "range": Array [
- 16,
- 23,
- ],
- "type": "TSTypeAnnotation",
- "typeAnnotation": Object {
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 1,
- },
- "start": Object {
- "column": 19,
- "line": 1,
- },
- },
- "range": Array [
- 19,
- 23,
- ],
- "type": "TSVoidKeyword",
- },
- },
- "type": "TSFunctionType",
- },
- ],
- "range": Array [
- 12,
- 24,
- ],
- "type": "TSTypeParameterInstantiation",
},
+ "range": Array [
+ 17,
+ 20,
+ ],
+ "type": "TSAnyKeyword",
},
},
},
- "init": null,
+ ],
+ "range": Array [
+ 11,
+ 28,
+ ],
+ "returnType": Object {
"loc": Object {
"end": Object {
- "column": 24,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 4,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 4,
- 24,
+ 22,
+ 28,
],
- "type": "VariableDeclarator",
- },
- ],
- "kind": "let",
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
- },
- "start": Object {
- "column": 0,
- "line": 1,
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 28,
+ ],
+ "type": "TSAnyKeyword",
+ },
},
+ "type": "TSFunctionType",
},
- "range": Array [
- 0,
- 25,
- ],
- "type": "VariableDeclaration",
},
],
"comments": Array [],
@@ -108021,14 +117102,14 @@ Object {
},
"range": Array [
0,
- 26,
+ 29,
],
"sourceType": "module",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
- "column": 3,
+ "column": 4,
"line": 1,
},
"start": Object {
@@ -108038,46 +117119,46 @@ Object {
},
"range": Array [
0,
- 3,
+ 4,
],
- "type": "Keyword",
- "value": "let",
+ "type": "Identifier",
+ "value": "type",
},
Object {
"loc": Object {
"end": Object {
- "column": 5,
+ "column": 8,
"line": 1,
},
"start": Object {
- "column": 4,
+ "column": 5,
"line": 1,
},
},
"range": Array [
- 4,
5,
+ 8,
],
"type": "Identifier",
- "value": "x",
+ "value": "foo",
},
Object {
"loc": Object {
"end": Object {
- "column": 6,
+ "column": 10,
"line": 1,
},
"start": Object {
- "column": 5,
+ "column": 9,
"line": 1,
},
},
"range": Array [
- 5,
- 6,
+ 9,
+ 10,
],
"type": "Punctuator",
- "value": ":",
+ "value": "=",
},
Object {
"loc": Object {
@@ -108086,16 +117167,16 @@ Object {
"line": 1,
},
"start": Object {
- "column": 7,
+ "column": 11,
"line": 1,
},
},
"range": Array [
- 7,
+ 11,
12,
],
- "type": "Identifier",
- "value": "Array",
+ "type": "Punctuator",
+ "value": "(",
},
Object {
"loc": Object {
@@ -108113,7 +117194,7 @@ Object {
13,
],
"type": "Punctuator",
- "value": "<",
+ "value": "{",
},
Object {
"loc": Object {
@@ -108130,8 +117211,8 @@ Object {
13,
14,
],
- "type": "Punctuator",
- "value": "(",
+ "type": "Identifier",
+ "value": "a",
},
Object {
"loc": Object {
@@ -108149,43 +117230,61 @@ Object {
15,
],
"type": "Punctuator",
- "value": ")",
+ "value": "}",
},
Object {
"loc": Object {
"end": Object {
- "column": 18,
+ "column": 16,
"line": 1,
},
"start": Object {
- "column": 16,
+ "column": 15,
"line": 1,
},
},
"range": Array [
+ 15,
16,
- 18,
],
"type": "Punctuator",
- "value": "=>",
+ "value": ":",
},
Object {
"loc": Object {
"end": Object {
- "column": 23,
+ "column": 20,
"line": 1,
},
"start": Object {
- "column": 19,
+ "column": 17,
"line": 1,
},
},
"range": Array [
- 19,
- 23,
+ 17,
+ 20,
],
- "type": "Keyword",
- "value": "void",
+ "type": "Identifier",
+ "value": "any",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 21,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 20,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 20,
+ 21,
+ ],
+ "type": "Punctuator",
+ "value": ")",
},
Object {
"loc": Object {
@@ -108194,34 +117293,34 @@ Object {
"line": 1,
},
"start": Object {
- "column": 23,
+ "column": 22,
"line": 1,
},
},
"range": Array [
- 23,
+ 22,
24,
],
"type": "Punctuator",
- "value": ">",
+ "value": "=>",
},
Object {
"loc": Object {
"end": Object {
- "column": 25,
+ "column": 28,
"line": 1,
},
"start": Object {
- "column": 24,
+ "column": 25,
"line": 1,
},
},
"range": Array [
- 24,
25,
+ 28,
],
- "type": "Punctuator",
- "value": ";",
+ "type": "Identifier",
+ "value": "any",
},
],
"type": "Program",
diff --git a/packages/typescript-eslint-parser/tests/lib/basics.ts b/packages/parser/tests/lib/basics.ts
similarity index 84%
rename from packages/typescript-eslint-parser/tests/lib/basics.ts
rename to packages/parser/tests/lib/basics.ts
index 5dc91decaf69..a433e83ad426 100644
--- a/packages/typescript-eslint-parser/tests/lib/basics.ts
+++ b/packages/parser/tests/lib/basics.ts
@@ -26,13 +26,13 @@ describe('basics', () => {
export const Price: React.SFC = function Price(props) {}
`;
const config: Linter.Config = {
- parser: 'typescript-eslint-parser',
+ parser: '@typescript-eslint/parser',
rules: {
test: 'error'
}
};
- linter.defineParser('typescript-eslint-parser', parser);
+ linter.defineParser('@typescript-eslint/parser', parser);
linter.defineRule('test', {
create(context: any) {
return {
@@ -59,9 +59,7 @@ export const Price: React.SFC = function Price(props) {}
message: 'called on React.SFC',
nodeType: 'TSTypeReference',
ruleId: 'test',
- severity: 2,
- source:
- 'export const Price: React.SFC = function Price(props) {}'
+ severity: 2
},
{
column: 31,
@@ -71,9 +69,7 @@ export const Price: React.SFC = function Price(props) {}
message: 'called on PriceProps',
nodeType: 'TSTypeReference',
ruleId: 'test',
- severity: 2,
- source:
- 'export const Price: React.SFC = function Price(props) {}'
+ severity: 2
}
]);
});
diff --git a/packages/typescript-eslint-parser/tests/lib/comments.ts b/packages/parser/tests/lib/comments.ts
similarity index 91%
rename from packages/typescript-eslint-parser/tests/lib/comments.ts
rename to packages/parser/tests/lib/comments.ts
index bdf3356f3a4b..f2bb2260d651 100644
--- a/packages/typescript-eslint-parser/tests/lib/comments.ts
+++ b/packages/parser/tests/lib/comments.ts
@@ -15,8 +15,10 @@ describe('Comments', () => {
testFiles.forEach(filename => {
const code = fs.readFileSync(filename, 'utf8');
const config: ParserOptions = {
- jsx: true,
- sourceType: 'module'
+ sourceType: 'module',
+ ecmaFeatures: {
+ jsx: true
+ }
};
it(
testUtils.formatSnapshotName(filename, FIXTURES_DIR),
diff --git a/packages/typescript-eslint-parser/tests/lib/javascript.ts b/packages/parser/tests/lib/javascript.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/lib/javascript.ts
rename to packages/parser/tests/lib/javascript.ts
diff --git a/packages/typescript-eslint-parser/tests/lib/jsx.ts b/packages/parser/tests/lib/jsx.ts
similarity index 91%
rename from packages/typescript-eslint-parser/tests/lib/jsx.ts
rename to packages/parser/tests/lib/jsx.ts
index a986b3c26e9d..05adef987f6f 100644
--- a/packages/typescript-eslint-parser/tests/lib/jsx.ts
+++ b/packages/parser/tests/lib/jsx.ts
@@ -1,6 +1,6 @@
import fs from 'fs';
import glob from 'glob';
-import filesWithKnownIssues from '../../../typescript-eslint-shared-fixtures/jsx-known-issues';
+import filesWithKnownIssues from '../../../shared-fixtures/jsx-known-issues';
import * as testUtils from '../../tools/test-utils';
const JSX_FIXTURES_DIR =
@@ -28,7 +28,9 @@ describe('JSX', () => {
const code = fs.readFileSync(filename, 'utf8');
const config = {
useJSXTextNode,
- jsx: true
+ ecmaFeatures: {
+ jsx: true
+ }
};
it(
testUtils.formatSnapshotName(filename, fixturesDir),
diff --git a/packages/parser/tests/lib/parser.ts b/packages/parser/tests/lib/parser.ts
new file mode 100644
index 000000000000..6a844baae22e
--- /dev/null
+++ b/packages/parser/tests/lib/parser.ts
@@ -0,0 +1,108 @@
+import * as typescriptESTree from '@typescript-eslint/typescript-estree';
+import { parse, parseForESLint, Syntax } from '../../src/parser';
+import * as scope from '../../src/analyze-scope';
+
+describe('parser', () => {
+ it('parse() should return just the AST from parseForESLint()', () => {
+ const code = 'const valid = true;';
+ expect(parse(code)).toEqual(parseForESLint(code).ast);
+ });
+
+ it('parseForESLint() should work if options are `null`', () => {
+ const code = 'const valid = true;';
+ expect(() => parseForESLint(code, null)).not.toThrow();
+ });
+
+ it('parseForESLint() should set the sourceType to script, if an invalid one is provided', () => {
+ const code = 'const valid = true;';
+ const spy = jest.spyOn(typescriptESTree, 'parseAndGenerateServices');
+ const spyScope = jest.spyOn(scope, 'analyzeScope');
+ parseForESLint(code, { sourceType: 'foo' as any });
+ expect(spy).toHaveBeenCalledWith(code, {
+ ecmaFeatures: {},
+ jsx: false,
+ sourceType: 'script',
+ useJSXTextNode: true
+ });
+ expect(spyScope).toHaveBeenCalledWith(expect.any(Object), {
+ ecmaFeatures: {},
+ sourceType: 'script'
+ });
+ });
+
+ it('parseAndGenerateServices() should be called with options', () => {
+ const code = 'const valid = true;';
+ const spy = jest.spyOn(typescriptESTree, 'parseAndGenerateServices');
+ parseForESLint(code, {
+ loc: false,
+ comment: false,
+ range: false,
+ tokens: false,
+ sourceType: 'module',
+ ecmaVersion: 10,
+ ecmaFeatures: {
+ globalReturn: false,
+ jsx: false
+ },
+ // ts-estree specific
+ filePath: 'test/foo',
+ project: 'tsconfig.json',
+ useJSXTextNode: false,
+ errorOnUnknownASTType: false,
+ errorOnTypeScriptSyntacticAndSemanticIssues: false,
+ tsconfigRootDir: '../../',
+ extraFileExtensions: ['foo']
+ });
+ expect(spy).toHaveBeenCalledWith(code, {
+ jsx: false,
+ loc: false,
+ comment: false,
+ range: false,
+ tokens: false,
+ sourceType: 'module',
+ ecmaVersion: 10,
+ ecmaFeatures: {
+ globalReturn: false,
+ jsx: false
+ },
+ // ts-estree specific
+ filePath: 'test/foo',
+ project: 'tsconfig.json',
+ useJSXTextNode: false,
+ errorOnUnknownASTType: false,
+ errorOnTypeScriptSyntacticAndSemanticIssues: false,
+ tsconfigRootDir: '../../',
+ extraFileExtensions: ['foo']
+ });
+ });
+
+ it('Syntax should contain a frozen object of typescriptESTree.AST_NODE_TYPES', () => {
+ expect(Syntax).toEqual(typescriptESTree.AST_NODE_TYPES);
+ expect(
+ () => ((Syntax as any).ArrayExpression = 'foo')
+ ).toThrowErrorMatchingInlineSnapshot(
+ `"Cannot assign to read only property 'ArrayExpression' of object '#'"`
+ );
+ });
+
+ it('`warnOnUnsupportedTypeScriptVersion: false` should set `loggerFn: false` on typescript-estree', () => {
+ const code = 'const valid = true;';
+ const spy = jest.spyOn(typescriptESTree, 'parseAndGenerateServices');
+ parseForESLint(code, { warnOnUnsupportedTypeScriptVersion: true });
+ expect(spy).toHaveBeenCalledWith(code, {
+ ecmaFeatures: {},
+ jsx: false,
+ sourceType: 'script',
+ useJSXTextNode: true
+ });
+ parseForESLint(code, { warnOnUnsupportedTypeScriptVersion: false });
+ expect(spy).toHaveBeenCalledWith(code, {
+ ecmaFeatures: {},
+ jsx: false,
+ sourceType: 'script',
+ useJSXTextNode: true,
+ loggerFn: false,
+ warnOnUnsupportedTypeScriptVersion: false
+ });
+ });
+});
diff --git a/packages/typescript-eslint-parser/tests/lib/scope-analysis.ts b/packages/parser/tests/lib/scope-analysis.ts
similarity index 97%
rename from packages/typescript-eslint-parser/tests/lib/scope-analysis.ts
rename to packages/parser/tests/lib/scope-analysis.ts
index 8eec626225f1..b8eafccc63e9 100644
--- a/packages/typescript-eslint-parser/tests/lib/scope-analysis.ts
+++ b/packages/parser/tests/lib/scope-analysis.ts
@@ -159,7 +159,9 @@ describe('TypeScript scope analysis', () => {
range: true,
tokens: true,
sourceType: 'module',
- ecmaFeatures: {}
+ ecmaFeatures: {
+ jsx: path.extname(filePath) === '.tsx'
+ }
});
const { globalScope } = scopeManager;
@@ -191,7 +193,9 @@ describe('TypeScript scope analysis', () => {
range: true,
tokens: true,
sourceType: 'script',
- ecmaFeatures: {}
+ ecmaFeatures: {
+ jsx: path.extname(filePath) === '.tsx'
+ }
});
const { globalScope } = scopeManager;
diff --git a/packages/typescript-eslint-parser/tests/lib/services.ts b/packages/parser/tests/lib/services.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/lib/services.ts
rename to packages/parser/tests/lib/services.ts
diff --git a/packages/typescript-eslint-parser/tests/lib/tsx.ts b/packages/parser/tests/lib/tsx.ts
similarity index 82%
rename from packages/typescript-eslint-parser/tests/lib/tsx.ts
rename to packages/parser/tests/lib/tsx.ts
index d8609ad60659..a18278e80458 100644
--- a/packages/typescript-eslint-parser/tests/lib/tsx.ts
+++ b/packages/parser/tests/lib/tsx.ts
@@ -17,7 +17,9 @@ describe('TSX', () => {
const code = fs.readFileSync(filename, 'utf8');
const config = {
useJSXTextNode: true,
- jsx: true
+ ecmaFeatures: {
+ jsx: true
+ }
};
it(
testUtils.formatSnapshotName(filename, FIXTURES_DIR, '.tsx'),
@@ -27,12 +29,12 @@ describe('TSX', () => {
describe("if the filename ends with '.tsx', enable jsx option automatically.", () => {
const linter = new Linter();
- linter.defineParser('typescript-eslint-parser', parser);
+ linter.defineParser('@typescript-eslint/parser', parser);
it('filePath was not provided', () => {
const code = 'const element = ';
const config = {
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
};
const messages = linter.verify(code, config);
@@ -43,8 +45,7 @@ describe('TSX', () => {
line: 1,
message: "Parsing error: '>' expected.",
ruleId: null,
- severity: 2,
- source: 'const element = '
+ severity: 2
}
]);
});
@@ -52,9 +53,11 @@ describe('TSX', () => {
it("filePath was not provided and 'jsx:true' option", () => {
const code = 'const element = ';
const config = {
- parser: 'typescript-eslint-parser',
+ parser: '@typescript-eslint/parser',
parserOptions: {
- jsx: true
+ ecmaFeatures: {
+ jsx: true
+ }
}
};
const messages = linter.verify(code, config);
@@ -65,7 +68,7 @@ describe('TSX', () => {
it('test.ts', () => {
const code = 'const element = ';
const config = {
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
};
const messages = linter.verify(code, config, { filename: 'test.ts' });
@@ -76,8 +79,7 @@ describe('TSX', () => {
line: 1,
message: "Parsing error: '>' expected.",
ruleId: null,
- severity: 2,
- source: 'const element = '
+ severity: 2
}
]);
});
@@ -85,9 +87,11 @@ describe('TSX', () => {
it("test.ts with 'jsx:true' option", () => {
const code = 'const element = ';
const config = {
- parser: 'typescript-eslint-parser',
+ parser: '@typescript-eslint/parser',
parserOptions: {
- jsx: true
+ ecmaFeatures: {
+ jsx: true
+ }
}
};
const messages = linter.verify(code, config, { filename: 'test.ts' });
@@ -99,8 +103,7 @@ describe('TSX', () => {
line: 1,
message: "Parsing error: '>' expected.",
ruleId: null,
- severity: 2,
- source: 'const element = '
+ severity: 2
}
]);
});
@@ -108,7 +111,7 @@ describe('TSX', () => {
it('test.tsx', () => {
const code = 'const element = ';
const config = {
- parser: 'typescript-eslint-parser'
+ parser: '@typescript-eslint/parser'
};
const messages = linter.verify(code, config, { filename: 'test.tsx' });
@@ -118,9 +121,11 @@ describe('TSX', () => {
it("test.tsx with 'jsx:false' option", () => {
const code = 'const element = ';
const config = {
- parser: 'typescript-eslint-parser',
+ parser: '@typescript-eslint/parser',
parserOptions: {
- jsx: false
+ ecmaFeatures: {
+ jsx: false
+ }
}
};
const messages = linter.verify(code, config, { filename: 'test.tsx' });
diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.ts b/packages/parser/tests/lib/typescript.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tests/lib/typescript.ts
rename to packages/parser/tests/lib/typescript.ts
diff --git a/packages/parser/tests/lib/visitor-keys.ts b/packages/parser/tests/lib/visitor-keys.ts
new file mode 100644
index 000000000000..00fcde2a005e
--- /dev/null
+++ b/packages/parser/tests/lib/visitor-keys.ts
@@ -0,0 +1,28 @@
+import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree';
+import { visitorKeys } from '../../src/visitor-keys';
+
+//------------------------------------------------------------------------------
+// Setup
+//------------------------------------------------------------------------------
+
+const astTypes = Object.keys(AST_NODE_TYPES);
+astTypes.push('TSEmptyBodyFunctionExpression'); // node created by parser.ts
+
+//------------------------------------------------------------------------------
+// Tests
+//------------------------------------------------------------------------------
+
+describe('visitor-keys', () => {
+ for (const type of astTypes) {
+ it(`type ${type} should be present in visitor-keys`, () => {
+ expect(visitorKeys).toHaveProperty(type);
+ });
+ }
+
+ it('check if there is no deprecated TS nodes', () => {
+ const TSTypes = Object.keys(visitorKeys).filter(type =>
+ type.startsWith('TS')
+ );
+ expect(astTypes).toEqual(expect.arrayContaining(TSTypes));
+ });
+});
diff --git a/packages/typescript-eslint-parser/tools/test-utils.ts b/packages/parser/tools/test-utils.ts
similarity index 100%
rename from packages/typescript-eslint-parser/tools/test-utils.ts
rename to packages/parser/tools/test-utils.ts
diff --git a/packages/typescript-eslint-parser/tsconfig.json b/packages/parser/tsconfig.json
similarity index 100%
rename from packages/typescript-eslint-parser/tsconfig.json
rename to packages/parser/tsconfig.json
diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md
new file mode 100644
index 000000000000..d6a58a75e6c3
--- /dev/null
+++ b/packages/shared-fixtures/CHANGELOG.md
@@ -0,0 +1,59 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+# [1.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.2.0...v1.3.0) (2019-02-07)
+
+
+### Bug Fixes
+
+* **ts-estree:** align typeArguments and typeParameters across nodes ([#223](https://github.com/typescript-eslint/typescript-eslint/issues/223)) ([3306198](https://github.com/typescript-eslint/typescript-eslint/commit/3306198))
+
+
+### Features
+
+* **ts-estree:** enable errors 1098 and 1099 ([#219](https://github.com/typescript-eslint/typescript-eslint/issues/219)) ([fc50167](https://github.com/typescript-eslint/typescript-eslint/commit/fc50167))
+
+
+
+
+
+# [1.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.1...v1.2.0) (2019-02-01)
+
+**Note:** Version bump only for package @typescript-eslint/shared-fixtures
+
+
+
+
+
+## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29)
+
+**Note:** Version bump only for package @typescript-eslint/shared-fixtures
+
+
+
+
+
+# [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23)
+
+
+### Bug Fixes
+
+* **typescript-estree:** correct range of parameters with comments ([#128](https://github.com/typescript-eslint/typescript-eslint/issues/128)) ([91eedf2](https://github.com/typescript-eslint/typescript-eslint/commit/91eedf2))
+
+
+
+
+
+# [1.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.1...v1.0.0) (2019-01-20)
+
+**Note:** Version bump only for package @typescript-eslint/shared-fixtures
+
+
+
+
+
+## [0.2.1](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.0...v0.2.1) (2019-01-20)
+
+**Note:** Version bump only for package @typescript-eslint/shared-fixtures
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/block-trailing-comment.src.js b/packages/shared-fixtures/fixtures/comments/block-trailing-comment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/block-trailing-comment.src.js
rename to packages/shared-fixtures/fixtures/comments/block-trailing-comment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/comment-within-condition.src.js b/packages/shared-fixtures/fixtures/comments/comment-within-condition.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/comment-within-condition.src.js
rename to packages/shared-fixtures/fixtures/comments/comment-within-condition.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/export-default-anonymous-class.src.js b/packages/shared-fixtures/fixtures/comments/export-default-anonymous-class.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/export-default-anonymous-class.src.js
rename to packages/shared-fixtures/fixtures/comments/export-default-anonymous-class.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/jsdoc-comment.src.js b/packages/shared-fixtures/fixtures/comments/jsdoc-comment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/jsdoc-comment.src.js
rename to packages/shared-fixtures/fixtures/comments/jsdoc-comment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-block-comment.src.js b/packages/shared-fixtures/fixtures/comments/jsx-block-comment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-block-comment.src.js
rename to packages/shared-fixtures/fixtures/comments/jsx-block-comment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-comment-after-jsx.src.js b/packages/shared-fixtures/fixtures/comments/jsx-comment-after-jsx.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-comment-after-jsx.src.js
rename to packages/shared-fixtures/fixtures/comments/jsx-comment-after-jsx.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-comment-after-self-closing-jsx.src.js b/packages/shared-fixtures/fixtures/comments/jsx-comment-after-self-closing-jsx.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-comment-after-self-closing-jsx.src.js
rename to packages/shared-fixtures/fixtures/comments/jsx-comment-after-self-closing-jsx.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-tag-comments.src.js b/packages/shared-fixtures/fixtures/comments/jsx-tag-comments.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-tag-comments.src.js
rename to packages/shared-fixtures/fixtures/comments/jsx-tag-comments.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-text-with-multiline-non-comment.src.js b/packages/shared-fixtures/fixtures/comments/jsx-text-with-multiline-non-comment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-text-with-multiline-non-comment.src.js
rename to packages/shared-fixtures/fixtures/comments/jsx-text-with-multiline-non-comment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-text-with-url.src.js b/packages/shared-fixtures/fixtures/comments/jsx-text-with-url.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-text-with-url.src.js
rename to packages/shared-fixtures/fixtures/comments/jsx-text-with-url.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-with-greather-than.src.js b/packages/shared-fixtures/fixtures/comments/jsx-with-greather-than.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-with-greather-than.src.js
rename to packages/shared-fixtures/fixtures/comments/jsx-with-greather-than.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-with-operators.src.js b/packages/shared-fixtures/fixtures/comments/jsx-with-operators.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/jsx-with-operators.src.js
rename to packages/shared-fixtures/fixtures/comments/jsx-with-operators.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/line-comment-with-block-syntax.src.js b/packages/shared-fixtures/fixtures/comments/line-comment-with-block-syntax.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/line-comment-with-block-syntax.src.js
rename to packages/shared-fixtures/fixtures/comments/line-comment-with-block-syntax.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/mix-line-and-block-comments.src.js b/packages/shared-fixtures/fixtures/comments/mix-line-and-block-comments.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/mix-line-and-block-comments.src.js
rename to packages/shared-fixtures/fixtures/comments/mix-line-and-block-comments.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/no-comment-regex.src.js b/packages/shared-fixtures/fixtures/comments/no-comment-regex.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/no-comment-regex.src.js
rename to packages/shared-fixtures/fixtures/comments/no-comment-regex.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/no-comment-template.src.js b/packages/shared-fixtures/fixtures/comments/no-comment-template.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/no-comment-template.src.js
rename to packages/shared-fixtures/fixtures/comments/no-comment-template.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/surrounding-call-comments.src.js b/packages/shared-fixtures/fixtures/comments/surrounding-call-comments.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/surrounding-call-comments.src.js
rename to packages/shared-fixtures/fixtures/comments/surrounding-call-comments.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/surrounding-debugger-comments.src.js b/packages/shared-fixtures/fixtures/comments/surrounding-debugger-comments.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/surrounding-debugger-comments.src.js
rename to packages/shared-fixtures/fixtures/comments/surrounding-debugger-comments.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/surrounding-return-comments.src.js b/packages/shared-fixtures/fixtures/comments/surrounding-return-comments.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/surrounding-return-comments.src.js
rename to packages/shared-fixtures/fixtures/comments/surrounding-return-comments.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/surrounding-throw-comments.src.js b/packages/shared-fixtures/fixtures/comments/surrounding-throw-comments.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/surrounding-throw-comments.src.js
rename to packages/shared-fixtures/fixtures/comments/surrounding-throw-comments.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/surrounding-while-loop-comments.src.js b/packages/shared-fixtures/fixtures/comments/surrounding-while-loop-comments.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/surrounding-while-loop-comments.src.js
rename to packages/shared-fixtures/fixtures/comments/surrounding-while-loop-comments.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/switch-fallthrough-comment-in-function.src.js b/packages/shared-fixtures/fixtures/comments/switch-fallthrough-comment-in-function.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/switch-fallthrough-comment-in-function.src.js
rename to packages/shared-fixtures/fixtures/comments/switch-fallthrough-comment-in-function.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/switch-fallthrough-comment.src.js b/packages/shared-fixtures/fixtures/comments/switch-fallthrough-comment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/switch-fallthrough-comment.src.js
rename to packages/shared-fixtures/fixtures/comments/switch-fallthrough-comment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/switch-no-default-comment-in-function.src.js b/packages/shared-fixtures/fixtures/comments/switch-no-default-comment-in-function.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/switch-no-default-comment-in-function.src.js
rename to packages/shared-fixtures/fixtures/comments/switch-no-default-comment-in-function.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/switch-no-default-comment-in-nested-functions.src.js b/packages/shared-fixtures/fixtures/comments/switch-no-default-comment-in-nested-functions.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/switch-no-default-comment-in-nested-functions.src.js
rename to packages/shared-fixtures/fixtures/comments/switch-no-default-comment-in-nested-functions.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/switch-no-default-comment.src.js b/packages/shared-fixtures/fixtures/comments/switch-no-default-comment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/switch-no-default-comment.src.js
rename to packages/shared-fixtures/fixtures/comments/switch-no-default-comment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/template-string-block.src.js b/packages/shared-fixtures/fixtures/comments/template-string-block.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/template-string-block.src.js
rename to packages/shared-fixtures/fixtures/comments/template-string-block.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/comments/type-assertion-regression-test.src.ts b/packages/shared-fixtures/fixtures/comments/type-assertion-regression-test.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/comments/type-assertion-regression-test.src.ts
rename to packages/shared-fixtures/fixtures/comments/type-assertion-regression-test.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrayLiteral/array-literal-in-lhs.src.js b/packages/shared-fixtures/fixtures/javascript/arrayLiteral/array-literal-in-lhs.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrayLiteral/array-literal-in-lhs.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrayLiteral/array-literal-in-lhs.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrayLiteral/array-literals-in-binary-expr.src.js b/packages/shared-fixtures/fixtures/javascript/arrayLiteral/array-literals-in-binary-expr.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrayLiteral/array-literals-in-binary-expr.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrayLiteral/array-literals-in-binary-expr.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/as-param-with-params.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/as-param-with-params.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/as-param-with-params.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/as-param-with-params.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/as-param.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/as-param.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/as-param.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/as-param.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/basic-in-binary-expression.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/basic-in-binary-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/basic-in-binary-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/basic-in-binary-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/basic.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/basic.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/basic.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/basic.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/block-body-not-object.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/block-body-not-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/block-body-not-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/block-body-not-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/block-body.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/block-body.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/block-body.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/block-body.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-dup-params.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-dup-params.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-dup-params.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-dup-params.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-missing-paren.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-missing-paren.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-missing-paren.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-missing-paren.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-not-arrow.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-not-arrow.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-not-arrow.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-not-arrow.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-numeric-param-multi.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-numeric-param-multi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-numeric-param-multi.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-numeric-param-multi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-numeric-param.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-numeric-param.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-numeric-param.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-numeric-param.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-reverse-arrow.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-reverse-arrow.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-reverse-arrow.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-reverse-arrow.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-default-param-eval.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-default-param-eval.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-default-param-eval.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-default-param-eval.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-dup-params.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-dup-params.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-dup-params.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-dup-params.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-eval-return.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-eval-return.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-eval-return.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-eval-return.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-eval.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-eval.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-eval.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-eval.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-octal.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-octal.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-octal.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-octal.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-arguments.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-arguments.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-arguments.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-arguments.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-eval.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-eval.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-eval.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-eval.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-names.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-names.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-names.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-names.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-two-lines.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-two-lines.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-two-lines.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-two-lines.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-wrapped-param.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-wrapped-param.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/error-wrapped-param.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/error-wrapped-param.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/expression.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/iife.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/iife.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/iife.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/iife.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/multiple-params.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/multiple-params.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/multiple-params.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/multiple-params.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/no-auto-return.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/no-auto-return.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/no-auto-return.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/no-auto-return.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-arguments.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-arguments.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-arguments.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-arguments.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-eval-params.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-eval-params.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-eval-params.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-eval-params.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-eval.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-eval.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-eval.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-eval.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-octal.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-octal.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-octal.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/not-strict-octal.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/return-arrow-function.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/return-arrow-function.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/return-arrow-function.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/return-arrow-function.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/return-sequence.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/return-sequence.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/return-sequence.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/return-sequence.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/single-param-parens.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/single-param-parens.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/single-param-parens.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/single-param-parens.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/single-param-return-identifier.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/single-param-return-identifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/single-param-return-identifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/single-param-return-identifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/single-param.src.js b/packages/shared-fixtures/fixtures/javascript/arrowFunctions/single-param.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/arrowFunctions/single-param.src.js
rename to packages/shared-fixtures/fixtures/javascript/arrowFunctions/single-param.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/and-operator-array-object.src.js b/packages/shared-fixtures/fixtures/javascript/basics/and-operator-array-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/and-operator-array-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/and-operator-array-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/delete-expression.src.js b/packages/shared-fixtures/fixtures/javascript/basics/delete-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/delete-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/delete-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/do-while-statements.src.js b/packages/shared-fixtures/fixtures/javascript/basics/do-while-statements.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/do-while-statements.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/do-while-statements.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/identifiers-double-underscore.src.js b/packages/shared-fixtures/fixtures/javascript/basics/identifiers-double-underscore.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/identifiers-double-underscore.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/identifiers-double-underscore.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/instanceof.src.js b/packages/shared-fixtures/fixtures/javascript/basics/instanceof.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/instanceof.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/instanceof.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/new-with-member-expression.src.js b/packages/shared-fixtures/fixtures/javascript/basics/new-with-member-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/new-with-member-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/new-with-member-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/new-without-parens.src.js b/packages/shared-fixtures/fixtures/javascript/basics/new-without-parens.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/new-without-parens.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/new-without-parens.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/or-operator-array-object.src.js b/packages/shared-fixtures/fixtures/javascript/basics/or-operator-array-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/or-operator-array-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/or-operator-array-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/typeof-expression.src.js b/packages/shared-fixtures/fixtures/javascript/basics/typeof-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/typeof-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/typeof-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/update-expression.src.js b/packages/shared-fixtures/fixtures/javascript/basics/update-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/update-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/update-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/void-expression.src.js b/packages/shared-fixtures/fixtures/javascript/basics/void-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/basics/void-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/basics/void-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/bigIntLiterals/binary.src.js b/packages/shared-fixtures/fixtures/javascript/bigIntLiterals/binary.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/bigIntLiterals/binary.src.js
rename to packages/shared-fixtures/fixtures/javascript/bigIntLiterals/binary.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/bigIntLiterals/decimal.src.js b/packages/shared-fixtures/fixtures/javascript/bigIntLiterals/decimal.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/bigIntLiterals/decimal.src.js
rename to packages/shared-fixtures/fixtures/javascript/bigIntLiterals/decimal.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/bigIntLiterals/hex.src.js b/packages/shared-fixtures/fixtures/javascript/bigIntLiterals/hex.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/bigIntLiterals/hex.src.js
rename to packages/shared-fixtures/fixtures/javascript/bigIntLiterals/hex.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/bigIntLiterals/octal.src.js b/packages/shared-fixtures/fixtures/javascript/bigIntLiterals/octal.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/bigIntLiterals/octal.src.js
rename to packages/shared-fixtures/fixtures/javascript/bigIntLiterals/octal.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/binaryLiterals/invalid.src.js b/packages/shared-fixtures/fixtures/javascript/binaryLiterals/invalid.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/binaryLiterals/invalid.src.js
rename to packages/shared-fixtures/fixtures/javascript/binaryLiterals/invalid.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/binaryLiterals/lowercase.src.js b/packages/shared-fixtures/fixtures/javascript/binaryLiterals/lowercase.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/binaryLiterals/lowercase.src.js
rename to packages/shared-fixtures/fixtures/javascript/binaryLiterals/lowercase.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/binaryLiterals/uppercase.src.js b/packages/shared-fixtures/fixtures/javascript/binaryLiterals/uppercase.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/binaryLiterals/uppercase.src.js
rename to packages/shared-fixtures/fixtures/javascript/binaryLiterals/uppercase.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/blockBindings/const.src.js b/packages/shared-fixtures/fixtures/javascript/blockBindings/const.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/blockBindings/const.src.js
rename to packages/shared-fixtures/fixtures/javascript/blockBindings/const.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/blockBindings/let-in-switchcase.src.js b/packages/shared-fixtures/fixtures/javascript/blockBindings/let-in-switchcase.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/blockBindings/let-in-switchcase.src.js
rename to packages/shared-fixtures/fixtures/javascript/blockBindings/let-in-switchcase.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/blockBindings/let.src.js b/packages/shared-fixtures/fixtures/javascript/blockBindings/let.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/blockBindings/let.src.js
rename to packages/shared-fixtures/fixtures/javascript/blockBindings/let.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/callExpression/call-expression-with-array.src.js b/packages/shared-fixtures/fixtures/javascript/callExpression/call-expression-with-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/callExpression/call-expression-with-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/callExpression/call-expression-with-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/callExpression/call-expression-with-object.src.js b/packages/shared-fixtures/fixtures/javascript/callExpression/call-expression-with-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/callExpression/call-expression-with-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/callExpression/call-expression-with-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/callExpression/mixed-expression.src.js b/packages/shared-fixtures/fixtures/javascript/callExpression/mixed-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/callExpression/mixed-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/callExpression/mixed-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/callExpression/new-expression-with-array.src.js b/packages/shared-fixtures/fixtures/javascript/callExpression/new-expression-with-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/callExpression/new-expression-with-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/callExpression/new-expression-with-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/callExpression/new-expression-with-object.src.js b/packages/shared-fixtures/fixtures/javascript/callExpression/new-expression-with-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/callExpression/new-expression-with-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/callExpression/new-expression-with-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-accessor-properties.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-accessor-properties.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-accessor-properties.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-accessor-properties.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-computed-static-method.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-computed-static-method.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-computed-static-method.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-computed-static-method.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-expression.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-method-named-prototype.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-method-named-prototype.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-method-named-prototype.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-method-named-prototype.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-method-named-static.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-method-named-static.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-method-named-static.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-method-named-static.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-method-named-with-space.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-method-named-with-space.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-method-named-with-space.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-method-named-with-space.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-one-method-super.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-one-method-super.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-one-method-super.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-one-method-super.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-one-method.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-one-method.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-one-method.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-one-method.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-static-method-named-prototype.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-static-method-named-prototype.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-static-method-named-prototype.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-static-method-named-prototype.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-static-method-named-static.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-static-method-named-static.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-static-method-named-static.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-static-method-named-static.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-static-method.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-static-method.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-static-method.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-static-method.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-static-methods-and-accessor-properties.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-static-methods-and-accessor-properties.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-static-methods-and-accessor-properties.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-static-methods-and-accessor-properties.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-computed-static-methods.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-two-computed-static-methods.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-computed-static-methods.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-two-computed-static-methods.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-methods-computed-constructor.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-two-methods-computed-constructor.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-methods-computed-constructor.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-two-methods-computed-constructor.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-methods-semi.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-two-methods-semi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-methods-semi.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-two-methods-semi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-methods-three-semi.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-two-methods-three-semi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-methods-three-semi.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-two-methods-three-semi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-methods-two-semi.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-two-methods-two-semi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-methods-two-semi.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-two-methods-two-semi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-methods.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-two-methods.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-methods.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-two-methods.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-static-methods-named-constructor.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-two-static-methods-named-constructor.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-two-static-methods-named-constructor.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-two-static-methods-named-constructor.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-with-constructor-parameters.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-with-constructor-parameters.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-with-constructor-parameters.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-with-constructor-parameters.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-with-constructor-with-space.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-with-constructor-with-space.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-with-constructor-with-space.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-with-constructor-with-space.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-with-constructor.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-with-constructor.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/class-with-constructor.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/class-with-constructor.src.js
diff --git a/packages/shared-fixtures/fixtures/javascript/classes/class-with-no-body.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-with-no-body.src.js
new file mode 100644
index 000000000000..c389887ee5aa
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/javascript/classes/class-with-no-body.src.js
@@ -0,0 +1 @@
+class Foo
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/derived-class-assign-to-var.src.js b/packages/shared-fixtures/fixtures/javascript/classes/derived-class-assign-to-var.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/derived-class-assign-to-var.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/derived-class-assign-to-var.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/derived-class-expression.src.js b/packages/shared-fixtures/fixtures/javascript/classes/derived-class-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/derived-class-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/derived-class-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/empty-class-double-semi.src.js b/packages/shared-fixtures/fixtures/javascript/classes/empty-class-double-semi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/empty-class-double-semi.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/empty-class-double-semi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/empty-class-semi.src.js b/packages/shared-fixtures/fixtures/javascript/classes/empty-class-semi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/empty-class-semi.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/empty-class-semi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/empty-class.src.js b/packages/shared-fixtures/fixtures/javascript/classes/empty-class.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/empty-class.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/empty-class.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/empty-literal-derived-class.src.js b/packages/shared-fixtures/fixtures/javascript/classes/empty-literal-derived-class.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/empty-literal-derived-class.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/empty-literal-derived-class.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/invalid-class-declaration.src.js b/packages/shared-fixtures/fixtures/javascript/classes/invalid-class-declaration.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/invalid-class-declaration.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/invalid-class-declaration.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/invalid-class-setter-declaration.src.js b/packages/shared-fixtures/fixtures/javascript/classes/invalid-class-setter-declaration.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/invalid-class-setter-declaration.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/invalid-class-setter-declaration.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/invalid-class-two-super-classes.src.js b/packages/shared-fixtures/fixtures/javascript/classes/invalid-class-two-super-classes.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/invalid-class-two-super-classes.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/invalid-class-two-super-classes.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/named-class-expression.src.js b/packages/shared-fixtures/fixtures/javascript/classes/named-class-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/named-class-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/named-class-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/named-derived-class-expression.src.js b/packages/shared-fixtures/fixtures/javascript/classes/named-derived-class-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/classes/named-derived-class-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/classes/named-derived-class-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/class-constructor.src.js b/packages/shared-fixtures/fixtures/javascript/defaultParams/class-constructor.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/class-constructor.src.js
rename to packages/shared-fixtures/fixtures/javascript/defaultParams/class-constructor.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/class-method.src.js b/packages/shared-fixtures/fixtures/javascript/defaultParams/class-method.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/class-method.src.js
rename to packages/shared-fixtures/fixtures/javascript/defaultParams/class-method.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/declaration.src.js b/packages/shared-fixtures/fixtures/javascript/defaultParams/declaration.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/declaration.src.js
rename to packages/shared-fixtures/fixtures/javascript/defaultParams/declaration.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/expression.src.js b/packages/shared-fixtures/fixtures/javascript/defaultParams/expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/defaultParams/expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/method.src.js b/packages/shared-fixtures/fixtures/javascript/defaultParams/method.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/method.src.js
rename to packages/shared-fixtures/fixtures/javascript/defaultParams/method.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/not-all-params.src.js b/packages/shared-fixtures/fixtures/javascript/defaultParams/not-all-params.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/defaultParams/not-all-params.src.js
rename to packages/shared-fixtures/fixtures/javascript/defaultParams/not-all-params.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/array-const-undefined.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/array-const-undefined.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/array-const-undefined.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/array-const-undefined.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/array-let-undefined.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/array-let-undefined.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/array-let-undefined.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/array-let-undefined.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-const-named.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-const-named.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-const-named.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-const-named.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-const-undefined.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-const-undefined.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-const-undefined.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-const-undefined.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-let-named.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-let-named.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-let-named.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-let-named.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-let-undefined.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-let-undefined.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-let-undefined.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-blockBindings/object-let-undefined.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object-short.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object-short.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object-short.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object-short.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-defaultParams/param-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-forOf/loop.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-forOf/loop.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-forOf/loop.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-forOf/loop.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/complex-destructured.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/complex-destructured.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/complex-destructured.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/complex-destructured.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/destructured-array-literal.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/destructured-array-literal.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/destructured-array-literal.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/destructured-array-literal.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/destructuring-param.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/destructuring-param.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/destructuring-param.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/destructuring-param.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/multi-destructured.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/multi-destructured.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/multi-destructured.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/multi-destructured.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/not-final-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/not-final-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/not-final-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/not-final-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/single-destructured.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/single-destructured.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/single-destructured.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/single-destructured.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/var-complex-destructured.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/var-complex-destructured.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/var-complex-destructured.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/var-complex-destructured.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/var-destructured-array-literal.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/var-destructured-array-literal.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/var-destructured-array-literal.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/var-destructured-array-literal.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/var-multi-destructured.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/var-multi-destructured.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/var-multi-destructured.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/var-multi-destructured.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/var-single-destructured.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/var-single-destructured.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring-and-spread/var-single-destructured.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring-and-spread/var-single-destructured.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/array-member.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/array-member.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/array-member.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/array-member.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/array-to-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/array-to-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/array-to-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/array-to-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/array-var-undefined.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/array-var-undefined.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/array-var-undefined.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/array-var-undefined.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/call-expression-destruction-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/call-expression-destruction-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/call-expression-destruction-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/call-expression-destruction-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/call-expression-destruction-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/call-expression-destruction-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/call-expression-destruction-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/call-expression-destruction-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-defaults-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-defaults-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-defaults-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-defaults-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-defaults-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-defaults-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-defaults-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-defaults-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/class-constructor-params-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-method-params-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/class-method-params-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-method-params-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/class-method-params-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-method-params-defaults-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/class-method-params-defaults-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-method-params-defaults-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/class-method-params-defaults-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-method-params-defaults-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/class-method-params-defaults-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-method-params-defaults-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/class-method-params-defaults-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-method-params-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/class-method-params-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/class-method-params-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/class-method-params-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array-all.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array-all.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array-all.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array-all.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array-longform-nested-multi.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array-longform-nested-multi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array-longform-nested-multi.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array-longform-nested-multi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array-multi.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array-multi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array-multi.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array-multi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array-nested-all.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array-nested-all.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array-nested-all.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array-nested-all.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array-nested-multi.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array-nested-multi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array-nested-multi.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array-nested-multi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-all.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-all.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-all.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-all.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-assign.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-assign.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-assign.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-assign.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform-all.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform-all.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform-all.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform-all.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform-multi.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform-multi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform-multi.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform-multi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-longform.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-mixed-multi.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-mixed-multi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-mixed-multi.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-mixed-multi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-multi.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-multi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-multi.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-multi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-nested-all.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-nested-all.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-nested-all.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-nested-all.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-nested-multi.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-nested-multi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object-nested-multi.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object-nested-multi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/defaults-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/defaults-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/destructured-array-catch.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/destructured-array-catch.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/destructured-array-catch.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/destructured-array-catch.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/destructured-object-catch.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/destructured-object-catch.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/destructured-object-catch.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/destructured-object-catch.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/invalid-defaults-object-assign.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/invalid-defaults-object-assign.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/invalid-defaults-object-assign.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/invalid-defaults-object-assign.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/named-param.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/named-param.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/named-param.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/named-param.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/nested-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/nested-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/nested-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/nested-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/nested-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/nested-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/nested-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/nested-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/object-var-named.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/object-var-named.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/object-var-named.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/object-var-named.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/object-var-undefined.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/object-var-undefined.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/object-var-undefined.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/object-var-undefined.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/param-defaults-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/param-defaults-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/param-defaults-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/param-defaults-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/param-defaults-object-nested.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/param-defaults-object-nested.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/param-defaults-object-nested.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/param-defaults-object-nested.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/param-defaults-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/param-defaults-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/param-defaults-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/param-defaults-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-array-wrapped.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/params-array-wrapped.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-array-wrapped.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/params-array-wrapped.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/params-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/params-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-multi-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/params-multi-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-multi-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/params-multi-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-nested-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/params-nested-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-nested-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/params-nested-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-nested-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/params-nested-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-nested-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/params-nested-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-object-wrapped.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/params-object-wrapped.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-object-wrapped.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/params-object-wrapped.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-object.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/params-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/params-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/params-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/sparse-array.src.js b/packages/shared-fixtures/fixtures/javascript/destructuring/sparse-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/destructuring/sparse-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/destructuring/sparse-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/block.src.js b/packages/shared-fixtures/fixtures/javascript/directives/block.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/block.src.js
rename to packages/shared-fixtures/fixtures/javascript/directives/block.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/directive-in-class.src.js b/packages/shared-fixtures/fixtures/javascript/directives/directive-in-class.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/directive-in-class.src.js
rename to packages/shared-fixtures/fixtures/javascript/directives/directive-in-class.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/first-expression.src.js b/packages/shared-fixtures/fixtures/javascript/directives/first-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/first-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/directives/first-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/function-non-strict.src.js b/packages/shared-fixtures/fixtures/javascript/directives/function-non-strict.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/function-non-strict.src.js
rename to packages/shared-fixtures/fixtures/javascript/directives/function-non-strict.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/non-directive-string.src.js b/packages/shared-fixtures/fixtures/javascript/directives/non-directive-string.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/non-directive-string.src.js
rename to packages/shared-fixtures/fixtures/javascript/directives/non-directive-string.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/non-unique-directive.src.js b/packages/shared-fixtures/fixtures/javascript/directives/non-unique-directive.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/non-unique-directive.src.js
rename to packages/shared-fixtures/fixtures/javascript/directives/non-unique-directive.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/program-order.src.js b/packages/shared-fixtures/fixtures/javascript/directives/program-order.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/program-order.src.js
rename to packages/shared-fixtures/fixtures/javascript/directives/program-order.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/program.src.js b/packages/shared-fixtures/fixtures/javascript/directives/program.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/program.src.js
rename to packages/shared-fixtures/fixtures/javascript/directives/program.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/raw.src.js b/packages/shared-fixtures/fixtures/javascript/directives/raw.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/directives/raw.src.js
rename to packages/shared-fixtures/fixtures/javascript/directives/raw.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalAsyncIteration/async-generators.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalAsyncIteration/async-generators.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalAsyncIteration/async-generators.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalAsyncIteration/async-generators.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalAsyncIteration/async-iterator.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalAsyncIteration/async-iterator.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalAsyncIteration/async-iterator.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalAsyncIteration/async-iterator.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalDynamicImport/dynamic-import.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalDynamicImport/dynamic-import.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalDynamicImport/dynamic-import.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalDynamicImport/dynamic-import.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/arg-spread.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/arg-spread.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/arg-spread.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/arg-spread.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/invalid-rest.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/invalid-rest.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/invalid-rest.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/invalid-rest.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/object-rest.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/object-rest.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/object-rest.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/object-rest.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/property-spread.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/property-spread.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/property-spread.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/property-spread.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-methods.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-methods.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-methods.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-methods.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-properties.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-properties.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-properties.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/shorthand-properties.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/single-spread.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/single-spread.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/single-spread.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/single-spread.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/two-spread.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/two-spread.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/two-spread.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalObjectRestSpread/two-spread.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding.src.js b/packages/shared-fixtures/fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding.src.js
rename to packages/shared-fixtures/fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/exponentiationOperators/exponential-operators.src.js b/packages/shared-fixtures/fixtures/javascript/exponentiationOperators/exponential-operators.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/exponentiationOperators/exponential-operators.src.js
rename to packages/shared-fixtures/fixtures/javascript/exponentiationOperators/exponential-operators.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-empty.src.js b/packages/shared-fixtures/fixtures/javascript/for/for-empty.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-empty.src.js
rename to packages/shared-fixtures/fixtures/javascript/for/for-empty.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-loop.src.js b/packages/shared-fixtures/fixtures/javascript/for/for-loop.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-loop.src.js
rename to packages/shared-fixtures/fixtures/javascript/for/for-loop.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-with-coma.src.js b/packages/shared-fixtures/fixtures/javascript/for/for-with-coma.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-with-coma.src.js
rename to packages/shared-fixtures/fixtures/javascript/for/for-with-coma.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-with-const.src.js b/packages/shared-fixtures/fixtures/javascript/for/for-with-const.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-with-const.src.js
rename to packages/shared-fixtures/fixtures/javascript/for/for-with-const.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-with-function.src.js b/packages/shared-fixtures/fixtures/javascript/for/for-with-function.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-with-function.src.js
rename to packages/shared-fixtures/fixtures/javascript/for/for-with-function.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-with-let.src.js b/packages/shared-fixtures/fixtures/javascript/for/for-with-let.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/for/for-with-let.src.js
rename to packages/shared-fixtures/fixtures/javascript/for/for-with-let.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-array.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-bare-nonstrict.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-bare-nonstrict.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-bare-nonstrict.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-bare-nonstrict.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-destruction-object.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-destruction-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-destruction-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-destruction-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-destruction.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-destruction.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-destruction.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-destruction.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-object-with-body.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-object-with-body.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-object-with-body.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-object-with-body.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-object.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-assigment.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-assigment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-assigment.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-assigment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-bare-assigment.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-bare-assigment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-bare-assigment.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-bare-assigment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-const.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-const.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-const.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-const.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-milti-asigment.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-milti-asigment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-milti-asigment.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-milti-asigment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-rest.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-rest.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-rest.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-rest.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-var.src.js b/packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-var.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forIn/for-in-with-var.src.js
rename to packages/shared-fixtures/fixtures/javascript/forIn/for-in-with-var.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-array.src.js b/packages/shared-fixtures/fixtures/javascript/forOf/for-of-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/forOf/for-of-array.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-destruction-object.src.js b/packages/shared-fixtures/fixtures/javascript/forOf/for-of-destruction-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-destruction-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/forOf/for-of-destruction-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-destruction.src.js b/packages/shared-fixtures/fixtures/javascript/forOf/for-of-destruction.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-destruction.src.js
rename to packages/shared-fixtures/fixtures/javascript/forOf/for-of-destruction.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-object.src.js b/packages/shared-fixtures/fixtures/javascript/forOf/for-of-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/forOf/for-of-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-with-function-initializer.src.js b/packages/shared-fixtures/fixtures/javascript/forOf/for-of-with-function-initializer.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-with-function-initializer.src.js
rename to packages/shared-fixtures/fixtures/javascript/forOf/for-of-with-function-initializer.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-with-rest.src.js b/packages/shared-fixtures/fixtures/javascript/forOf/for-of-with-rest.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-with-rest.src.js
rename to packages/shared-fixtures/fixtures/javascript/forOf/for-of-with-rest.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-with-var-and-braces.src.js b/packages/shared-fixtures/fixtures/javascript/forOf/for-of-with-var-and-braces.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-with-var-and-braces.src.js
rename to packages/shared-fixtures/fixtures/javascript/forOf/for-of-with-var-and-braces.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-with-var-and-no-braces.src.js b/packages/shared-fixtures/fixtures/javascript/forOf/for-of-with-var-and-no-braces.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/for-of-with-var-and-no-braces.src.js
rename to packages/shared-fixtures/fixtures/javascript/forOf/for-of-with-var-and-no-braces.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js b/packages/shared-fixtures/fixtures/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js
rename to packages/shared-fixtures/fixtures/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js b/packages/shared-fixtures/fixtures/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js
rename to packages/shared-fixtures/fixtures/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js
diff --git a/packages/shared-fixtures/fixtures/javascript/function/function-with-return.js b/packages/shared-fixtures/fixtures/javascript/function/function-with-return.js
new file mode 100644
index 000000000000..c98a373f0c38
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/javascript/function/function-with-return.js
@@ -0,0 +1,3 @@
+function foo () {
+ return 1;
+}
diff --git a/packages/shared-fixtures/fixtures/javascript/function/return-multiline-sequence.src.js b/packages/shared-fixtures/fixtures/javascript/function/return-multiline-sequence.src.js
new file mode 100644
index 000000000000..be3070488139
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/javascript/function/return-multiline-sequence.src.js
@@ -0,0 +1,7 @@
+function foo (x, y, z) {
+ return (
+ x,
+ y,
+ z
+ );
+}
diff --git a/packages/shared-fixtures/fixtures/javascript/function/return-sequence.src.js b/packages/shared-fixtures/fixtures/javascript/function/return-sequence.src.js
new file mode 100644
index 000000000000..3ffe77903028
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/javascript/function/return-sequence.src.js
@@ -0,0 +1,3 @@
+function foo (x, y, z) {
+ return (x, y, z);
+}
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/anonymous-generator.src.js b/packages/shared-fixtures/fixtures/javascript/generators/anonymous-generator.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/anonymous-generator.src.js
rename to packages/shared-fixtures/fixtures/javascript/generators/anonymous-generator.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/async-generator-function.src.js b/packages/shared-fixtures/fixtures/javascript/generators/async-generator-function.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/async-generator-function.src.js
rename to packages/shared-fixtures/fixtures/javascript/generators/async-generator-function.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/async-generator-method.src.js b/packages/shared-fixtures/fixtures/javascript/generators/async-generator-method.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/async-generator-method.src.js
rename to packages/shared-fixtures/fixtures/javascript/generators/async-generator-method.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/double-yield.src.js b/packages/shared-fixtures/fixtures/javascript/generators/double-yield.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/double-yield.src.js
rename to packages/shared-fixtures/fixtures/javascript/generators/double-yield.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/empty-generator-declaration.src.js b/packages/shared-fixtures/fixtures/javascript/generators/empty-generator-declaration.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/empty-generator-declaration.src.js
rename to packages/shared-fixtures/fixtures/javascript/generators/empty-generator-declaration.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/generator-declaration.src.js b/packages/shared-fixtures/fixtures/javascript/generators/generator-declaration.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/generator-declaration.src.js
rename to packages/shared-fixtures/fixtures/javascript/generators/generator-declaration.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/yield-delegation.src.js b/packages/shared-fixtures/fixtures/javascript/generators/yield-delegation.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/yield-delegation.src.js
rename to packages/shared-fixtures/fixtures/javascript/generators/yield-delegation.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/yield-without-value-in-call.src.js b/packages/shared-fixtures/fixtures/javascript/generators/yield-without-value-in-call.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/yield-without-value-in-call.src.js
rename to packages/shared-fixtures/fixtures/javascript/generators/yield-without-value-in-call.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/yield-without-value-no-semi.src.js b/packages/shared-fixtures/fixtures/javascript/generators/yield-without-value-no-semi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/yield-without-value-no-semi.src.js
rename to packages/shared-fixtures/fixtures/javascript/generators/yield-without-value-no-semi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/yield-without-value.src.js b/packages/shared-fixtures/fixtures/javascript/generators/yield-without-value.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/generators/yield-without-value.src.js
rename to packages/shared-fixtures/fixtures/javascript/generators/yield-without-value.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/globalReturn/return-identifier.src.js b/packages/shared-fixtures/fixtures/javascript/globalReturn/return-identifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/globalReturn/return-identifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/globalReturn/return-identifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/globalReturn/return-no-arg.src.js b/packages/shared-fixtures/fixtures/javascript/globalReturn/return-no-arg.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/globalReturn/return-no-arg.src.js
rename to packages/shared-fixtures/fixtures/javascript/globalReturn/return-no-arg.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/globalReturn/return-true.src.js b/packages/shared-fixtures/fixtures/javascript/globalReturn/return-true.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/globalReturn/return-true.src.js
rename to packages/shared-fixtures/fixtures/javascript/globalReturn/return-true.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/hexLiterals/invalid.src.js b/packages/shared-fixtures/fixtures/javascript/hexLiterals/invalid.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/hexLiterals/invalid.src.js
rename to packages/shared-fixtures/fixtures/javascript/hexLiterals/invalid.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/hexLiterals/lowercase.src.js b/packages/shared-fixtures/fixtures/javascript/hexLiterals/lowercase.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/hexLiterals/lowercase.src.js
rename to packages/shared-fixtures/fixtures/javascript/hexLiterals/lowercase.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/hexLiterals/uppercase.src.js b/packages/shared-fixtures/fixtures/javascript/hexLiterals/uppercase.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/hexLiterals/uppercase.src.js
rename to packages/shared-fixtures/fixtures/javascript/hexLiterals/uppercase.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/importMeta/simple-import-meta.src.js b/packages/shared-fixtures/fixtures/javascript/importMeta/simple-import-meta.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/importMeta/simple-import-meta.src.js
rename to packages/shared-fixtures/fixtures/javascript/importMeta/simple-import-meta.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/labels/label-break.src.js b/packages/shared-fixtures/fixtures/javascript/labels/label-break.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/labels/label-break.src.js
rename to packages/shared-fixtures/fixtures/javascript/labels/label-break.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/labels/label-continue.src.js b/packages/shared-fixtures/fixtures/javascript/labels/label-continue.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/labels/label-continue.src.js
rename to packages/shared-fixtures/fixtures/javascript/labels/label-continue.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/error-delete.src.js b/packages/shared-fixtures/fixtures/javascript/modules/error-delete.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/error-delete.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/error-delete.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/error-function.src.js b/packages/shared-fixtures/fixtures/javascript/modules/error-function.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/error-function.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/error-function.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/error-strict.src.js b/packages/shared-fixtures/fixtures/javascript/modules/error-strict.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/error-strict.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/error-strict.src.js
diff --git a/packages/shared-fixtures/fixtures/javascript/modules/export-async-named-function.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-async-named-function.src.js
new file mode 100644
index 000000000000..7c26b9ed6873
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/javascript/modules/export-async-named-function.src.js
@@ -0,0 +1 @@
+export async function foo() {}
diff --git a/packages/shared-fixtures/fixtures/javascript/modules/export-const.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-const.src.js
new file mode 100644
index 000000000000..cc57a55e257d
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/javascript/modules/export-const.src.js
@@ -0,0 +1 @@
+export const foo = 2;
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-array.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-array.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-array.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-default-array.src.js
diff --git a/packages/shared-fixtures/fixtures/javascript/modules/export-default-async-named-function.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-async-named-function.src.js
new file mode 100644
index 000000000000..c40a5f27d267
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/javascript/modules/export-default-async-named-function.src.js
@@ -0,0 +1 @@
+export default async function foo() {}
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-class.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-class.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-class.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-default-class.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-expression.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-default-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-function.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-function.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-function.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-default-function.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-named-class.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-named-class.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-named-class.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-default-named-class.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-named-function.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-named-function.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-named-function.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-default-named-function.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-number.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-number.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-number.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-default-number.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-object.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-object.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-object.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-default-object.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-value.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-value.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-default-value.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-default-value.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-batch.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-from-batch.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-batch.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-from-batch.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-default.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-from-default.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-default.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-from-default.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-named-as-default.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-from-named-as-default.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-named-as-default.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-from-named-as-default.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-named-as-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-from-named-as-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-named-as-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-from-named-as-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-named-as-specifiers.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-from-named-as-specifiers.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-named-as-specifiers.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-from-named-as-specifiers.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-from-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-from-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-specifiers.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-from-specifiers.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-from-specifiers.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-from-specifiers.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-function.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-function.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-function.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-function.src.js
diff --git a/packages/shared-fixtures/fixtures/javascript/modules/export-let.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-let.src.js
new file mode 100644
index 000000000000..a3bcdb0d8122
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/javascript/modules/export-let.src.js
@@ -0,0 +1 @@
+export let foo = 2;
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-as-default.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-named-as-default.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-as-default.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-named-as-default.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-as-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-named-as-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-as-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-named-as-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-as-specifiers.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-named-as-specifiers.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-as-specifiers.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-named-as-specifiers.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-class.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-named-class.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-class.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-named-class.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-empty.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-named-empty.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-empty.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-named-empty.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-named-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-named-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-specifiers-comma.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-named-specifiers-comma.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-specifiers-comma.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-named-specifiers-comma.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-specifiers.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-named-specifiers.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-named-specifiers.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-named-specifiers.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-var-anonymous-function.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-var-anonymous-function.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-var-anonymous-function.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-var-anonymous-function.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-var-number.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-var-number.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-var-number.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-var-number.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-var.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-var.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/export-var.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/export-var.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-default-and-named-specifiers.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-default-and-named-specifiers.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-default-and-named-specifiers.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-default-and-named-specifiers.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-default-and-namespace-specifiers.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-default-and-namespace-specifiers.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-default-and-namespace-specifiers.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-default-and-namespace-specifiers.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-default-as.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-default-as.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-default-as.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-default-as.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-default.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-default.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-default.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-default.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-jquery.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-jquery.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-jquery.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-jquery.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-module.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-module.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-module.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-module.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-as-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-named-as-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-as-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-named-as-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-as-specifiers.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-named-as-specifiers.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-as-specifiers.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-named-as-specifiers.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-empty.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-named-empty.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-empty.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-named-empty.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-named-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-named-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-specifiers-comma.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-named-specifiers-comma.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-specifiers-comma.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-named-specifiers-comma.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-specifiers.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-named-specifiers.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-named-specifiers.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-named-specifiers.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-namespace-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-namespace-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-namespace-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-namespace-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-null-as-nil.src.js b/packages/shared-fixtures/fixtures/javascript/modules/import-null-as-nil.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/import-null-as-nil.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/import-null-as-nil.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-await.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-await.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-await.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-await.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-class.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-class.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-class.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-class.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-batch-missing-from-clause.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-batch-missing-from-clause.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-batch-missing-from-clause.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-export-batch-missing-from-clause.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-batch-token.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-batch-token.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-batch-token.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-export-batch-token.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-default-equal.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-default-equal.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-default-equal.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-export-default-equal.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-default-token.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-default-token.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-default-token.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-export-default-token.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-default.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-default.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-default.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-export-default.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-named-default.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-named-default.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-named-default.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-export-named-default.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-named-extra-comma.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-named-extra-comma.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-named-extra-comma.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-export-named-extra-comma.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-named-middle-comma.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-named-middle-comma.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-export-named-middle-comma.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-export-named-middle-comma.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-default-after-named-after-default.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-default-after-named-after-default.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-default-after-named-after-default.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-default-after-named-after-default.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-default-after-named.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-default-after-named.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-default-after-named.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-default-after-named.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-default-missing-module-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-default-missing-module-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-default-missing-module-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-default-missing-module-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-default-module-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-default-module-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-default-module-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-default-module-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-default.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-default.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-default.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-default.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-missing-module-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-missing-module-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-missing-module-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-missing-module-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-module-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-module-specifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-module-specifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-module-specifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-named-after-named.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-named-after-named.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-named-after-named.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-named-after-named.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-named-after-namespace.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-named-after-namespace.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-named-after-namespace.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-named-after-namespace.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-named-as-missing-from.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-named-as-missing-from.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-named-as-missing-from.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-named-as-missing-from.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-named-extra-comma.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-named-extra-comma.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-named-extra-comma.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-named-extra-comma.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-named-middle-comma.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-named-middle-comma.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-named-middle-comma.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-named-middle-comma.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-namespace-after-named.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-namespace-after-named.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-namespace-after-named.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-namespace-after-named.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-namespace-missing-as.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-import-namespace-missing-as.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/modules/invalid-import-namespace-missing-as.src.js
rename to packages/shared-fixtures/fixtures/javascript/modules/invalid-import-namespace-missing-as.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/newTarget/invalid-new-target.src.js b/packages/shared-fixtures/fixtures/javascript/newTarget/invalid-new-target.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/newTarget/invalid-new-target.src.js
rename to packages/shared-fixtures/fixtures/javascript/newTarget/invalid-new-target.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/newTarget/invalid-unknown-property.src.js b/packages/shared-fixtures/fixtures/javascript/newTarget/invalid-unknown-property.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/newTarget/invalid-unknown-property.src.js
rename to packages/shared-fixtures/fixtures/javascript/newTarget/invalid-unknown-property.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/newTarget/simple-new-target.src.js b/packages/shared-fixtures/fixtures/javascript/newTarget/simple-new-target.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/newTarget/simple-new-target.src.js
rename to packages/shared-fixtures/fixtures/javascript/newTarget/simple-new-target.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteral/object-literal-in-lhs.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteral/object-literal-in-lhs.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteral/object-literal-in-lhs.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteral/object-literal-in-lhs.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-addition-property.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-addition-property.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-addition-property.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-addition-property.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-string-property.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-string-property.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-string-property.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-string-property.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-variable-property.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-variable-property.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-variable-property.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/computed-variable-property.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralComputedProperties/standalone-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/method-property.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/method-property.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/method-property.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/method-property.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/simple-method.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js b/packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js
rename to packages/shared-fixtures/fixtures/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/octalLiterals/invalid.src.js b/packages/shared-fixtures/fixtures/javascript/octalLiterals/invalid.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/octalLiterals/invalid.src.js
rename to packages/shared-fixtures/fixtures/javascript/octalLiterals/invalid.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/octalLiterals/legacy.src.js b/packages/shared-fixtures/fixtures/javascript/octalLiterals/legacy.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/octalLiterals/legacy.src.js
rename to packages/shared-fixtures/fixtures/javascript/octalLiterals/legacy.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/octalLiterals/lowercase.src.js b/packages/shared-fixtures/fixtures/javascript/octalLiterals/lowercase.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/octalLiterals/lowercase.src.js
rename to packages/shared-fixtures/fixtures/javascript/octalLiterals/lowercase.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/octalLiterals/strict-uppercase.src.js b/packages/shared-fixtures/fixtures/javascript/octalLiterals/strict-uppercase.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/octalLiterals/strict-uppercase.src.js
rename to packages/shared-fixtures/fixtures/javascript/octalLiterals/strict-uppercase.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/octalLiterals/uppercase.src.js b/packages/shared-fixtures/fixtures/javascript/octalLiterals/uppercase.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/octalLiterals/uppercase.src.js
rename to packages/shared-fixtures/fixtures/javascript/octalLiterals/uppercase.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/regex/regexp-simple.src.js b/packages/shared-fixtures/fixtures/javascript/regex/regexp-simple.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/regex/regexp-simple.src.js
rename to packages/shared-fixtures/fixtures/javascript/regex/regexp-simple.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/regexUFlag/regex-u-extended-escape.src.js b/packages/shared-fixtures/fixtures/javascript/regexUFlag/regex-u-extended-escape.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/regexUFlag/regex-u-extended-escape.src.js
rename to packages/shared-fixtures/fixtures/javascript/regexUFlag/regex-u-extended-escape.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js b/packages/shared-fixtures/fixtures/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js
rename to packages/shared-fixtures/fixtures/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/regexUFlag/regex-u-simple.src.js b/packages/shared-fixtures/fixtures/javascript/regexUFlag/regex-u-simple.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/regexUFlag/regex-u-simple.src.js
rename to packages/shared-fixtures/fixtures/javascript/regexUFlag/regex-u-simple.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/regexYFlag/regexp-y-simple.src.js b/packages/shared-fixtures/fixtures/javascript/regexYFlag/regexp-y-simple.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/regexYFlag/regexp-y-simple.src.js
rename to packages/shared-fixtures/fixtures/javascript/regexYFlag/regexp-y-simple.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/basic-rest.src.js b/packages/shared-fixtures/fixtures/javascript/restParams/basic-rest.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/basic-rest.src.js
rename to packages/shared-fixtures/fixtures/javascript/restParams/basic-rest.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/class-constructor.src.js b/packages/shared-fixtures/fixtures/javascript/restParams/class-constructor.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/class-constructor.src.js
rename to packages/shared-fixtures/fixtures/javascript/restParams/class-constructor.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/class-method.src.js b/packages/shared-fixtures/fixtures/javascript/restParams/class-method.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/class-method.src.js
rename to packages/shared-fixtures/fixtures/javascript/restParams/class-method.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/error-no-default.src.js b/packages/shared-fixtures/fixtures/javascript/restParams/error-no-default.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/error-no-default.src.js
rename to packages/shared-fixtures/fixtures/javascript/restParams/error-no-default.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/error-not-last.src.js b/packages/shared-fixtures/fixtures/javascript/restParams/error-not-last.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/error-not-last.src.js
rename to packages/shared-fixtures/fixtures/javascript/restParams/error-not-last.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/func-expression-multi.src.js b/packages/shared-fixtures/fixtures/javascript/restParams/func-expression-multi.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/func-expression-multi.src.js
rename to packages/shared-fixtures/fixtures/javascript/restParams/func-expression-multi.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/func-expression.src.js b/packages/shared-fixtures/fixtures/javascript/restParams/func-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/func-expression.src.js
rename to packages/shared-fixtures/fixtures/javascript/restParams/func-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/invalid-rest-param.src.js b/packages/shared-fixtures/fixtures/javascript/restParams/invalid-rest-param.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/invalid-rest-param.src.js
rename to packages/shared-fixtures/fixtures/javascript/restParams/invalid-rest-param.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/single-rest.src.js b/packages/shared-fixtures/fixtures/javascript/restParams/single-rest.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/restParams/single-rest.src.js
rename to packages/shared-fixtures/fixtures/javascript/restParams/single-rest.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-float-negative.src.js b/packages/shared-fixtures/fixtures/javascript/simple-literals/literal-float-negative.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-float-negative.src.js
rename to packages/shared-fixtures/fixtures/javascript/simple-literals/literal-float-negative.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-float.src.js b/packages/shared-fixtures/fixtures/javascript/simple-literals/literal-float.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-float.src.js
rename to packages/shared-fixtures/fixtures/javascript/simple-literals/literal-float.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-null.src.js b/packages/shared-fixtures/fixtures/javascript/simple-literals/literal-null.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-null.src.js
rename to packages/shared-fixtures/fixtures/javascript/simple-literals/literal-null.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-number-negative.src.js b/packages/shared-fixtures/fixtures/javascript/simple-literals/literal-number-negative.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-number-negative.src.js
rename to packages/shared-fixtures/fixtures/javascript/simple-literals/literal-number-negative.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-number.src.js b/packages/shared-fixtures/fixtures/javascript/simple-literals/literal-number.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-number.src.js
rename to packages/shared-fixtures/fixtures/javascript/simple-literals/literal-number.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-string.src.js b/packages/shared-fixtures/fixtures/javascript/simple-literals/literal-string.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-string.src.js
rename to packages/shared-fixtures/fixtures/javascript/simple-literals/literal-string.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-undefined.src.js b/packages/shared-fixtures/fixtures/javascript/simple-literals/literal-undefined.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/simple-literals/literal-undefined.src.js
rename to packages/shared-fixtures/fixtures/javascript/simple-literals/literal-undefined.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/complex-spread.src.js b/packages/shared-fixtures/fixtures/javascript/spread/complex-spread.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/complex-spread.src.js
rename to packages/shared-fixtures/fixtures/javascript/spread/complex-spread.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/error-invalid-if.src.js b/packages/shared-fixtures/fixtures/javascript/spread/error-invalid-if.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/error-invalid-if.src.js
rename to packages/shared-fixtures/fixtures/javascript/spread/error-invalid-if.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/error-invalid-sequence.src.js b/packages/shared-fixtures/fixtures/javascript/spread/error-invalid-sequence.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/error-invalid-sequence.src.js
rename to packages/shared-fixtures/fixtures/javascript/spread/error-invalid-sequence.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/multi-function-call.src.js b/packages/shared-fixtures/fixtures/javascript/spread/multi-function-call.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/multi-function-call.src.js
rename to packages/shared-fixtures/fixtures/javascript/spread/multi-function-call.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/not-final-param.src.js b/packages/shared-fixtures/fixtures/javascript/spread/not-final-param.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/not-final-param.src.js
rename to packages/shared-fixtures/fixtures/javascript/spread/not-final-param.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/simple-function-call.src.js b/packages/shared-fixtures/fixtures/javascript/spread/simple-function-call.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/spread/simple-function-call.src.js
rename to packages/shared-fixtures/fixtures/javascript/spread/simple-function-call.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/deeply-nested.src.js b/packages/shared-fixtures/fixtures/javascript/templateStrings/deeply-nested.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/deeply-nested.src.js
rename to packages/shared-fixtures/fixtures/javascript/templateStrings/deeply-nested.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/error-octal-literal.src.js b/packages/shared-fixtures/fixtures/javascript/templateStrings/error-octal-literal.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/error-octal-literal.src.js
rename to packages/shared-fixtures/fixtures/javascript/templateStrings/error-octal-literal.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/escape-characters.src.js b/packages/shared-fixtures/fixtures/javascript/templateStrings/escape-characters.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/escape-characters.src.js
rename to packages/shared-fixtures/fixtures/javascript/templateStrings/escape-characters.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/expressions.src.js b/packages/shared-fixtures/fixtures/javascript/templateStrings/expressions.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/expressions.src.js
rename to packages/shared-fixtures/fixtures/javascript/templateStrings/expressions.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/multi-line-template-string.src.js b/packages/shared-fixtures/fixtures/javascript/templateStrings/multi-line-template-string.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/multi-line-template-string.src.js
rename to packages/shared-fixtures/fixtures/javascript/templateStrings/multi-line-template-string.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/simple-template-string.src.js b/packages/shared-fixtures/fixtures/javascript/templateStrings/simple-template-string.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/simple-template-string.src.js
rename to packages/shared-fixtures/fixtures/javascript/templateStrings/simple-template-string.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/single-dollar-sign.src.js b/packages/shared-fixtures/fixtures/javascript/templateStrings/single-dollar-sign.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/single-dollar-sign.src.js
rename to packages/shared-fixtures/fixtures/javascript/templateStrings/single-dollar-sign.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/tagged-no-placeholders.src.js b/packages/shared-fixtures/fixtures/javascript/templateStrings/tagged-no-placeholders.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/tagged-no-placeholders.src.js
rename to packages/shared-fixtures/fixtures/javascript/templateStrings/tagged-no-placeholders.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/tagged-template-string.src.js b/packages/shared-fixtures/fixtures/javascript/templateStrings/tagged-template-string.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/templateStrings/tagged-template-string.src.js
rename to packages/shared-fixtures/fixtures/javascript/templateStrings/tagged-template-string.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/basic-string-literal.src.js b/packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/basic-string-literal.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/basic-string-literal.src.js
rename to packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/basic-string-literal.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/complex-string-literal.src.js b/packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/complex-string-literal.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/complex-string-literal.src.js
rename to packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/complex-string-literal.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js b/packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js
rename to packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js b/packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js
rename to packages/shared-fixtures/fixtures/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js b/packages/shared-fixtures/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js
rename to packages/shared-fixtures/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx-useJSXTextNode/test-content.src.js b/packages/shared-fixtures/fixtures/jsx-useJSXTextNode/test-content.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx-useJSXTextNode/test-content.src.js
rename to packages/shared-fixtures/fixtures/jsx-useJSXTextNode/test-content.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/attributes.src.js b/packages/shared-fixtures/fixtures/jsx/attributes.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/attributes.src.js
rename to packages/shared-fixtures/fixtures/jsx/attributes.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/element-keyword-name.src.js b/packages/shared-fixtures/fixtures/jsx/element-keyword-name.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/element-keyword-name.src.js
rename to packages/shared-fixtures/fixtures/jsx/element-keyword-name.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/embedded-comment.src.js b/packages/shared-fixtures/fixtures/jsx/embedded-comment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/embedded-comment.src.js
rename to packages/shared-fixtures/fixtures/jsx/embedded-comment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/embedded-conditional.src.js b/packages/shared-fixtures/fixtures/jsx/embedded-conditional.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/embedded-conditional.src.js
rename to packages/shared-fixtures/fixtures/jsx/embedded-conditional.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/embedded-invalid-js-identifier.src.js b/packages/shared-fixtures/fixtures/jsx/embedded-invalid-js-identifier.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/embedded-invalid-js-identifier.src.js
rename to packages/shared-fixtures/fixtures/jsx/embedded-invalid-js-identifier.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/embedded-tags.src.js b/packages/shared-fixtures/fixtures/jsx/embedded-tags.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/embedded-tags.src.js
rename to packages/shared-fixtures/fixtures/jsx/embedded-tags.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/empty-placeholder.src.js b/packages/shared-fixtures/fixtures/jsx/empty-placeholder.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/empty-placeholder.src.js
rename to packages/shared-fixtures/fixtures/jsx/empty-placeholder.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/escape-patterns.src.js b/packages/shared-fixtures/fixtures/jsx/escape-patterns.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/escape-patterns.src.js
rename to packages/shared-fixtures/fixtures/jsx/escape-patterns.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-attribute-missing-equals.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-attribute-missing-equals.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-attribute-missing-equals.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-attribute-missing-equals.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-attribute.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-attribute.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-attribute.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-attribute.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-broken-tag.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-broken-tag.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-broken-tag.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-broken-tag.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-computed-end-tag-name.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-computed-end-tag-name.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-computed-end-tag-name.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-computed-end-tag-name.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-computed-string-end-tag-name.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-computed-string-end-tag-name.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-computed-string-end-tag-name.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-computed-string-end-tag-name.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-embedded-expression.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-embedded-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-embedded-expression.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-embedded-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-leading-dot-tag-name.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-leading-dot-tag-name.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-leading-dot-tag-name.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-leading-dot-tag-name.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-mismatched-closing-tag.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-mismatched-closing-tag.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-mismatched-closing-tag.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-mismatched-closing-tag.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-mismatched-closing-tags.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-mismatched-closing-tags.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-mismatched-closing-tags.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-mismatched-closing-tags.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-mismatched-dot-tag-name.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-mismatched-dot-tag-name.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-mismatched-dot-tag-name.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-mismatched-dot-tag-name.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-mismatched-namespace-tag.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-mismatched-namespace-tag.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-mismatched-namespace-tag.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-mismatched-namespace-tag.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-missing-closing-tag.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-missing-closing-tag.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-missing-closing-tag.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-missing-closing-tag.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-missing-namespace-name.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-missing-namespace-name.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-missing-namespace-name.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-missing-namespace-name.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-missing-namespace-value.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-missing-namespace-value.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-missing-namespace-value.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-missing-namespace-value.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-missing-spread-operator.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-missing-spread-operator.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-missing-spread-operator.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-missing-spread-operator.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-namespace-name-with-docts.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-namespace-name-with-docts.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-namespace-name-with-docts.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-namespace-name-with-docts.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-namespace-value-with-dots.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-namespace-value-with-dots.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-namespace-value-with-dots.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-namespace-value-with-dots.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-no-common-parent-with-comment.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-no-common-parent-with-comment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-no-common-parent-with-comment.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-no-common-parent-with-comment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-no-common-parent.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-no-common-parent.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-no-common-parent.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-no-common-parent.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-no-tag-name.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-no-tag-name.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-no-tag-name.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-no-tag-name.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-placeholder-in-closing-tag.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-placeholder-in-closing-tag.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-placeholder-in-closing-tag.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-placeholder-in-closing-tag.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-shorthand-fragment-no-closing.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-shorthand-fragment-no-closing.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-shorthand-fragment-no-closing.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-shorthand-fragment-no-closing.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-trailing-dot-tag-name.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-trailing-dot-tag-name.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-trailing-dot-tag-name.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-trailing-dot-tag-name.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-unexpected-comma.src.js b/packages/shared-fixtures/fixtures/jsx/invalid-unexpected-comma.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/invalid-unexpected-comma.src.js
rename to packages/shared-fixtures/fixtures/jsx/invalid-unexpected-comma.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/japanese-characters.src.js b/packages/shared-fixtures/fixtures/jsx/japanese-characters.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/japanese-characters.src.js
rename to packages/shared-fixtures/fixtures/jsx/japanese-characters.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/less-than-operator.src.js b/packages/shared-fixtures/fixtures/jsx/less-than-operator.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/less-than-operator.src.js
rename to packages/shared-fixtures/fixtures/jsx/less-than-operator.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/member-expression-this.src.js b/packages/shared-fixtures/fixtures/jsx/member-expression-this.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/member-expression-this.src.js
rename to packages/shared-fixtures/fixtures/jsx/member-expression-this.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/member-expression.src.js b/packages/shared-fixtures/fixtures/jsx/member-expression.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/member-expression.src.js
rename to packages/shared-fixtures/fixtures/jsx/member-expression.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/multiple-blank-spaces.src.js b/packages/shared-fixtures/fixtures/jsx/multiple-blank-spaces.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/multiple-blank-spaces.src.js
rename to packages/shared-fixtures/fixtures/jsx/multiple-blank-spaces.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/namespaced-attribute-and-value-inserted.src.js b/packages/shared-fixtures/fixtures/jsx/namespaced-attribute-and-value-inserted.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/namespaced-attribute-and-value-inserted.src.js
rename to packages/shared-fixtures/fixtures/jsx/namespaced-attribute-and-value-inserted.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/namespaced-name-and-attribute.src.js b/packages/shared-fixtures/fixtures/jsx/namespaced-name-and-attribute.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/namespaced-name-and-attribute.src.js
rename to packages/shared-fixtures/fixtures/jsx/namespaced-name-and-attribute.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/newslines-and-entities.src.js b/packages/shared-fixtures/fixtures/jsx/newslines-and-entities.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/newslines-and-entities.src.js
rename to packages/shared-fixtures/fixtures/jsx/newslines-and-entities.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/self-closing-tag-inside-tag.src.js b/packages/shared-fixtures/fixtures/jsx/self-closing-tag-inside-tag.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/self-closing-tag-inside-tag.src.js
rename to packages/shared-fixtures/fixtures/jsx/self-closing-tag-inside-tag.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/self-closing-tag-with-newline.src.js b/packages/shared-fixtures/fixtures/jsx/self-closing-tag-with-newline.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/self-closing-tag-with-newline.src.js
rename to packages/shared-fixtures/fixtures/jsx/self-closing-tag-with-newline.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/self-closing-tag.src.js b/packages/shared-fixtures/fixtures/jsx/self-closing-tag.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/self-closing-tag.src.js
rename to packages/shared-fixtures/fixtures/jsx/self-closing-tag.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/shorthand-fragment-with-child.src.js b/packages/shared-fixtures/fixtures/jsx/shorthand-fragment-with-child.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/shorthand-fragment-with-child.src.js
rename to packages/shared-fixtures/fixtures/jsx/shorthand-fragment-with-child.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/shorthand-fragment.src.js b/packages/shared-fixtures/fixtures/jsx/shorthand-fragment.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/shorthand-fragment.src.js
rename to packages/shared-fixtures/fixtures/jsx/shorthand-fragment.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/spread-child.src.js b/packages/shared-fixtures/fixtures/jsx/spread-child.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/spread-child.src.js
rename to packages/shared-fixtures/fixtures/jsx/spread-child.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/spread-operator-attribute-and-regular-attribute.src.js b/packages/shared-fixtures/fixtures/jsx/spread-operator-attribute-and-regular-attribute.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/spread-operator-attribute-and-regular-attribute.src.js
rename to packages/shared-fixtures/fixtures/jsx/spread-operator-attribute-and-regular-attribute.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/spread-operator-attributes.src.js b/packages/shared-fixtures/fixtures/jsx/spread-operator-attributes.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/spread-operator-attributes.src.js
rename to packages/shared-fixtures/fixtures/jsx/spread-operator-attributes.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/tag-names-with-dots.src.js b/packages/shared-fixtures/fixtures/jsx/tag-names-with-dots.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/tag-names-with-dots.src.js
rename to packages/shared-fixtures/fixtures/jsx/tag-names-with-dots.src.js
diff --git a/packages/shared-fixtures/fixtures/jsx/tag-names-with-multi-dots-multi.src.js b/packages/shared-fixtures/fixtures/jsx/tag-names-with-multi-dots-multi.src.js
new file mode 100644
index 000000000000..1599e0620cd9
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/jsx/tag-names-with-multi-dots-multi.src.js
@@ -0,0 +1,3 @@
+
+
+ ;
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/tag-names-with-multi-dots.src.js b/packages/shared-fixtures/fixtures/jsx/tag-names-with-multi-dots.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/tag-names-with-multi-dots.src.js
rename to packages/shared-fixtures/fixtures/jsx/tag-names-with-multi-dots.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/test-content.src.js b/packages/shared-fixtures/fixtures/jsx/test-content.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/test-content.src.js
rename to packages/shared-fixtures/fixtures/jsx/test-content.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/trailing-spread-operator-attribute.src.js b/packages/shared-fixtures/fixtures/jsx/trailing-spread-operator-attribute.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/trailing-spread-operator-attribute.src.js
rename to packages/shared-fixtures/fixtures/jsx/trailing-spread-operator-attribute.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/jsx/unknown-escape-pattern.src.js b/packages/shared-fixtures/fixtures/jsx/unknown-escape-pattern.src.js
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/jsx/unknown-escape-pattern.src.js
rename to packages/shared-fixtures/fixtures/jsx/unknown-escape-pattern.src.js
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/tsx/generic-jsx-element.src.tsx b/packages/shared-fixtures/fixtures/tsx/generic-jsx-element.src.tsx
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/tsx/generic-jsx-element.src.tsx
rename to packages/shared-fixtures/fixtures/tsx/generic-jsx-element.src.tsx
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/tsx/react-typed-props.src.tsx b/packages/shared-fixtures/fixtures/tsx/react-typed-props.src.tsx
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/tsx/react-typed-props.src.tsx
rename to packages/shared-fixtures/fixtures/tsx/react-typed-props.src.tsx
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts b/packages/shared-fixtures/fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts
rename to packages/shared-fixtures/fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/babylon-convergence/type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/babylon-convergence/type-parameters.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/babylon-convergence/type-parameters.src.ts
rename to packages/shared-fixtures/fixtures/typescript/babylon-convergence/type-parameters.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-constructor.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-constructor.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-constructor.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-constructor.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-method.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-method.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-method.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-class-with-optional-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-optional-method.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-class-with-optional-method.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-optional-method.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-interface.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-interface.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/abstract-interface.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/abstract-interface.src.ts
diff --git a/packages/shared-fixtures/fixtures/typescript/basics/arrow-function-with-optional-parameter.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/arrow-function-with-optional-parameter.src.ts
new file mode 100644
index 000000000000..0289f3828aa8
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/basics/arrow-function-with-optional-parameter.src.ts
@@ -0,0 +1 @@
+((k?) => k + 1)();
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/arrow-function-with-type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/arrow-function-with-type-parameters.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/arrow-function-with-type-parameters.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/arrow-function-with-type-parameters.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/async-function-expression.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/async-function-expression.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/async-function-expression.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/async-function-expression.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/async-function-with-var-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/async-function-with-var-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/async-function-with-var-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/async-function-with-var-declaration.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/call-signatures-with-generics.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/call-signatures-with-generics.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/call-signatures-with-generics.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/call-signatures-with-generics.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/call-signatures.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/call-signatures.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/call-signatures.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/call-signatures.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/cast-as-expression.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/cast-as-expression.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/cast-as-expression.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/cast-as-expression.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/cast-as-multi-assign.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/cast-as-multi-assign.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/cast-as-multi-assign.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/cast-as-multi-assign.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/cast-as-multi.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/cast-as-multi.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/cast-as-multi.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/cast-as-multi.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/cast-as-operator.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/cast-as-operator.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/cast-as-operator.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/cast-as-operator.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/cast-as-simple.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/cast-as-simple.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/cast-as-simple.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/cast-as-simple.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-multi-line-keyword-abstract.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-multi-line-keyword-abstract.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-multi-line-keyword-abstract.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-multi-line-keyword-abstract.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-multi-line-keyword-declare.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-multi-line-keyword-declare.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-multi-line-keyword-declare.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-multi-line-keyword-declare.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-accessibility-modifiers.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-accessibility-modifiers.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-accessibility-modifiers.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-accessibility-modifiers.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-modifier.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-modifier.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-modifier.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-modifier.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-return-type.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-return-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-return-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-return-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-type-parameters.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-type-parameters.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-type-parameters.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-definite-assignment.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-definite-assignment.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-definite-assignment.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-definite-assignment.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-export-parameter-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-export-parameter-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-export-parameter-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-export-parameter-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-extends-and-implements.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-extends-and-implements.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-extends-and-implements.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-extends-and-implements.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-extends-generic-multiple.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-extends-generic-multiple.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-extends-generic-multiple.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-extends-generic-multiple.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-extends-generic.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-extends-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-extends-generic.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-extends-generic.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-generic-method-default.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-generic-method-default.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-generic-method-default.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-generic-method-default.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-generic-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-generic-method.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-generic-method.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-generic-method.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-implements-and-extends.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-implements-and-extends.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-implements-and-extends.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-implements-and-extends.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-implements-generic-multiple.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-implements-generic-multiple.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-implements-generic-multiple.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-implements-generic-multiple.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-implements-generic.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-implements-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-implements-generic.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-implements-generic.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-implements.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-implements.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-implements.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-implements.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-method.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-method.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-method.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-mixin-reference.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-mixin-reference.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-mixin-reference.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-mixin-reference.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-mixin.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-mixin.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-mixin.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-mixin.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-optional-computed-property.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-computed-property.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-optional-computed-property.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-computed-property.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-optional-methods.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-methods.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-optional-methods.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-methods.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-optional-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-optional-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-optional-property-undefined.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-property-undefined.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-optional-property-undefined.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-property-undefined.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-private-parameter-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-private-parameter-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-private-parameter-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-private-parameter-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-property-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-property-function.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-property-function.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-property-function.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-property-values.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-property-values.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-property-values.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-property-values.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-protected-parameter-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-protected-parameter-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-protected-parameter-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-protected-parameter-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-public-parameter-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-public-parameter-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-public-parameter-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-public-parameter-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-readonly-parameter-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-readonly-parameter-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-readonly-parameter-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-readonly-parameter-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-readonly-property.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-readonly-property.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-readonly-property.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-readonly-property.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-static-parameter-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-static-parameter-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-static-parameter-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-static-parameter-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-two-methods-computed-constructor.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-two-methods-computed-constructor.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-two-methods-computed-constructor.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-two-methods-computed-constructor.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-type-parameter-default.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-type-parameter-default.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-type-parameter-default.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-type-parameter-default.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-type-parameter-underscore.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-type-parameter-underscore.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-type-parameter-underscore.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-type-parameter-underscore.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-type-parameter.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-type-parameter.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/class-with-type-parameter.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/class-with-type-parameter.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/const-enum.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/const-enum.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/const-enum.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/const-enum.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/declare-class-with-optional-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/declare-class-with-optional-method.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/declare-class-with-optional-method.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/declare-class-with-optional-method.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/declare-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/declare-function.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/declare-function.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/declare-function.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/destructuring-assignment-nested.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/destructuring-assignment-nested.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/destructuring-assignment-nested.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/destructuring-assignment-nested.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/destructuring-assignment-object.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/destructuring-assignment-object.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/destructuring-assignment-object.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/destructuring-assignment-object.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/destructuring-assignment-property.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/destructuring-assignment-property.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/destructuring-assignment-property.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/destructuring-assignment-property.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/destructuring-assignment.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/destructuring-assignment.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/destructuring-assignment.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/destructuring-assignment.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/directive-in-module.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/directive-in-module.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/directive-in-module.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/directive-in-module.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/directive-in-namespace.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/directive-in-namespace.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/directive-in-namespace.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/directive-in-namespace.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-as-namespace.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-as-namespace.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-as-namespace.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-as-namespace.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-assignment.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-assignment.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-assignment.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-assignment.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-declare-const-named-enum.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-declare-const-named-enum.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-declare-const-named-enum.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-declare-const-named-enum.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-declare-named-enum.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-declare-named-enum.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-declare-named-enum.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-declare-named-enum.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-default-class-with-generic.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-default-class-with-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-default-class-with-generic.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-default-class-with-generic.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-default-class-with-multiple-generics.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-default-class-with-multiple-generics.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-default-class-with-multiple-generics.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-default-class-with-multiple-generics.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-named-class-with-generic.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-named-class-with-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-named-class-with-generic.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-named-class-with-generic.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-named-class-with-multiple-generics.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-named-class-with-multiple-generics.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-named-class-with-multiple-generics.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-named-class-with-multiple-generics.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-named-enum.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-named-enum.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-named-enum.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-named-enum.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-type-alias-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-type-alias-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-type-alias-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-type-alias-declaration.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-type-class-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-type-class-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-type-class-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-type-class-declaration.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-type-function-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/export-type-function-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/export-type-function-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/export-type-function-declaration.src.ts
diff --git a/packages/shared-fixtures/fixtures/typescript/basics/function-anonymus-with-type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-anonymus-with-type-parameters.src.ts
new file mode 100644
index 000000000000..44c7468b366d
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/basics/function-anonymus-with-type-parameters.src.ts
@@ -0,0 +1,3 @@
+var obj = function (a: string) {
+ return a;
+};
diff --git a/packages/shared-fixtures/fixtures/typescript/basics/function-anynomus-with-return-type.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-anynomus-with-return-type.src.ts
new file mode 100644
index 000000000000..a5d4544e0b12
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/basics/function-anynomus-with-return-type.src.ts
@@ -0,0 +1,2 @@
+var obj = function (): void {
+};
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-overloads.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-overloads.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-overloads.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/function-overloads.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-await.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-with-await.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-await.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/function-with-await.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-object-type-with-optional-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-with-object-type-with-optional-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-object-type-with-optional-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/function-with-object-type-with-optional-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-object-type-without-annotation.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-with-object-type-without-annotation.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-object-type-without-annotation.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/function-with-object-type-without-annotation.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-type-parameters-with-constraint.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-with-type-parameters-with-constraint.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-type-parameters-with-constraint.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/function-with-type-parameters-with-constraint.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-with-type-parameters.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-type-parameters.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/function-with-type-parameters.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-types-assignation.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-with-types-assignation.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-types-assignation.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/function-with-types-assignation.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-types.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-with-types.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/function-with-types.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/function-with-types.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/import-equal-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/import-equal-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/import-equal-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/import-equal-declaration.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/import-export-equal-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/import-export-equal-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/import-export-equal-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/import-export-equal-declaration.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/import-type-with-type-parameters-in-type-reference.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/import-type-with-type-parameters-in-type-reference.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/import-type-with-type-parameters-in-type-reference.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/import-type-with-type-parameters-in-type-reference.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/import-type.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/import-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/import-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/import-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-extends-multiple.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-extends-multiple.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-extends-multiple.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-extends-multiple.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-extends.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-extends.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-extends.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-extends.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-type-parameters.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-type-parameters.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-type-parameters.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-all-property-types.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-with-all-property-types.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-all-property-types.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-with-all-property-types.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-extends-member-expression.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-with-extends-member-expression.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-extends-member-expression.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-with-extends-member-expression.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-extends-type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-with-extends-type-parameters.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-extends-type-parameters.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-with-extends-type-parameters.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-generic.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-with-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-generic.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-with-generic.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-jsdoc.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-with-jsdoc.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-jsdoc.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-with-jsdoc.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-with-method.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-method.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-with-method.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-optional-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-with-optional-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-with-optional-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-with-optional-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-without-type-annotation.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/interface-without-type-annotation.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/interface-without-type-annotation.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/interface-without-type-annotation.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/keyof-operator.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/keyof-operator.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/keyof-operator.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/keyof-operator.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/nested-type-arguments.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/nested-type-arguments.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/nested-type-arguments.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/nested-type-arguments.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/never-type-param.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/never-type-param.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/never-type-param.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/never-type-param.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/non-null-assertion-operator.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/non-null-assertion-operator.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/non-null-assertion-operator.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/non-null-assertion-operator.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/null-and-undefined-type-annotations.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/null-and-undefined-type-annotations.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/null-and-undefined-type-annotations.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/null-and-undefined-type-annotations.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/object-with-escaped-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/object-with-escaped-properties.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/object-with-escaped-properties.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/object-with-escaped-properties.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/object-with-typed-methods.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/object-with-typed-methods.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/object-with-typed-methods.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/object-with-typed-methods.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/parenthesized-use-strict.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/parenthesized-use-strict.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/parenthesized-use-strict.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/parenthesized-use-strict.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/symbol-type-param.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/symbol-type-param.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/symbol-type-param.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/symbol-type-param.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-alias-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-alias-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-alias-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-alias-declaration.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-alias-object-without-annotation.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-alias-object-without-annotation.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-alias-object-without-annotation.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-alias-object-without-annotation.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-assertion-arrow-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-arrow-function.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-assertion-arrow-function.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-assertion-arrow-function.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-assertion.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-assertion.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-assertion.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-guard-in-arrow-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-guard-in-arrow-function.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-guard-in-arrow-function.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-guard-in-arrow-function.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-guard-in-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-guard-in-function.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-guard-in-function.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-guard-in-function.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-guard-in-interface.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-guard-in-interface.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-guard-in-interface.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-guard-in-interface.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-guard-in-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-guard-in-method.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-guard-in-method.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-guard-in-method.src.ts
diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-parameters-comments-heritage.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-parameters-comments-heritage.src.ts
new file mode 100644
index 000000000000..986f4826089f
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/basics/type-parameters-comments-heritage.src.ts
@@ -0,0 +1,4 @@
+class foo < /* aaa */ A /* bbb */> extends bar < /* aaa */ A /* bbb */> {}
+class foo2 < /* aaa */ A /* bbb */ = 2 /* bbb */> extends bar < /* aaa */ A /* bbb */> {}
+interface bar < /* aaa */ A /* bbb */> extends bar2 < /* aaa */ A /* bbb */> {}
+interface bar2 < /* aaa */ A /* bbb */ = 2 /* bbb */> extends bar < /* aaa */ A /* bbb */> {}
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-parameters-comments.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-parameters-comments.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-parameters-comments.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-parameters-comments.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-reference-comments.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-reference-comments.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/type-reference-comments.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/type-reference-comments.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-bigint.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-bigint.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-bigint.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-bigint.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-boolean.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-boolean.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-boolean.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-boolean.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-false.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-false.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-false.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-false.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-never.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-never.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-never.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-never.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-null.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-null.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-null.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-null.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-number.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-number.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-number.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-number.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-object.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-object.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-object.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-object.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-string.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-string.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-string.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-string.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-symbol.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-symbol.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-symbol.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-symbol.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-true.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-true.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-true.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-true.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-undefined.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-undefined.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-undefined.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-undefined.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-unknown.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-unknown.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-unknown.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-unknown.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-void.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-void.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-keyword-void.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-keyword-void.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-method-signature.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-method-signature.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-method-signature.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-method-signature.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-this.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/typed-this.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/typed-this.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/typed-this.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/unique-symbol.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/unique-symbol.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/unique-symbol.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/unique-symbol.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/unknown-type-annotation.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/unknown-type-annotation.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/unknown-type-annotation.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/unknown-type-annotation.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/var-with-definite-assignment.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/var-with-definite-assignment.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/var-with-definite-assignment.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/var-with-definite-assignment.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/var-with-dotted-type.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/var-with-dotted-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/var-with-dotted-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/var-with-dotted-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/var-with-type.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/var-with-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/var-with-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/var-with-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/variable-declaration-type-annotation-spacing.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/variable-declaration-type-annotation-spacing.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/basics/variable-declaration-type-annotation-spacing.src.ts
rename to packages/shared-fixtures/fixtures/typescript/basics/variable-declaration-type-annotation-spacing.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/abstract-class.src.ts b/packages/shared-fixtures/fixtures/typescript/declare/abstract-class.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/abstract-class.src.ts
rename to packages/shared-fixtures/fixtures/typescript/declare/abstract-class.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/class.src.ts b/packages/shared-fixtures/fixtures/typescript/declare/class.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/class.src.ts
rename to packages/shared-fixtures/fixtures/typescript/declare/class.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/enum.src.ts b/packages/shared-fixtures/fixtures/typescript/declare/enum.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/enum.src.ts
rename to packages/shared-fixtures/fixtures/typescript/declare/enum.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/function.src.ts b/packages/shared-fixtures/fixtures/typescript/declare/function.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/function.src.ts
rename to packages/shared-fixtures/fixtures/typescript/declare/function.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/interface.src.ts b/packages/shared-fixtures/fixtures/typescript/declare/interface.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/interface.src.ts
rename to packages/shared-fixtures/fixtures/typescript/declare/interface.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/module.src.ts b/packages/shared-fixtures/fixtures/typescript/declare/module.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/module.src.ts
rename to packages/shared-fixtures/fixtures/typescript/declare/module.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/namespace.src.ts b/packages/shared-fixtures/fixtures/typescript/declare/namespace.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/namespace.src.ts
rename to packages/shared-fixtures/fixtures/typescript/declare/namespace.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/type-alias.src.ts b/packages/shared-fixtures/fixtures/typescript/declare/type-alias.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/type-alias.src.ts
rename to packages/shared-fixtures/fixtures/typescript/declare/type-alias.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/variable.src.ts b/packages/shared-fixtures/fixtures/typescript/declare/variable.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/declare/variable.src.ts
rename to packages/shared-fixtures/fixtures/typescript/declare/variable.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/class-decorators/class-decorator-factory.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/class-decorators/class-decorator-factory.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/class-decorators/class-decorator-factory.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/class-decorators/class-decorator-factory.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/class-decorators/class-decorator.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/class-decorators/class-decorator.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/class-decorators/class-decorator.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/class-decorators/class-decorator.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src.ts
diff --git a/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts
new file mode 100644
index 000000000000..81dfc005fc92
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts
@@ -0,0 +1,3 @@
+class Foo {
+ bar(@special(true) [ bar ]: any) {}
+}
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts
diff --git a/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts
new file mode 100644
index 000000000000..dc9133b3deaf
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts
@@ -0,0 +1,3 @@
+class Foo {
+ bar(@special(true) { bar }: any) {}
+}
diff --git a/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts
new file mode 100644
index 000000000000..35b2ac60bc94
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts
@@ -0,0 +1,3 @@
+class Foo {
+ bar(@special(true) ...foo: any) {}
+}
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src.ts
rename to packages/shared-fixtures/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/class-empty-extends-implements.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/class-empty-extends-implements.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/class-empty-extends-implements.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/class-empty-extends-implements.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/class-empty-extends.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/class-empty-extends.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/class-empty-extends.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/class-empty-extends.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/class-extends-empty-implements.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/class-extends-empty-implements.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/class-extends-empty-implements.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/class-extends-empty-implements.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/class-multiple-implements.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/class-multiple-implements.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/class-multiple-implements.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/class-multiple-implements.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src.ts
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-function.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-function.src.ts
new file mode 100644
index 000000000000..72ed3035b15f
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-function.src.ts
@@ -0,0 +1,2 @@
+@dec
+function b(){}
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src.ts
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-variable.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-variable.src.ts
new file mode 100644
index 000000000000..700dea545cce
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-variable.src.ts
@@ -0,0 +1,2 @@
+@deco()
+const a = 1
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts
new file mode 100644
index 000000000000..8370eae3584f
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts
@@ -0,0 +1 @@
+foo<>();
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts
new file mode 100644
index 000000000000..58900f001ee1
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts
@@ -0,0 +1 @@
+new Foo<>()
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-arguments.src.ts
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts
new file mode 100644
index 000000000000..1dbabedb798c
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts
@@ -0,0 +1 @@
+function f1<>() {}
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts
new file mode 100644
index 000000000000..1c24174dfb9d
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts
@@ -0,0 +1,3 @@
+class foo {
+ constructor<>() {}
+}
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts
new file mode 100644
index 000000000000..97b3b1bd5b97
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts
@@ -0,0 +1 @@
+const foo = function<>() {}
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts
new file mode 100644
index 000000000000..266c7827325d
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts
@@ -0,0 +1,3 @@
+interface foo {
+ test<>();
+}
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src.ts
new file mode 100644
index 000000000000..5544096856d7
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src.ts
@@ -0,0 +1,3 @@
+class foo {
+ test<>() {}
+}
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters.src.ts
new file mode 100644
index 000000000000..1dbabedb798c
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/empty-type-parameters.src.ts
@@ -0,0 +1 @@
+function f1<>() {}
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/enum-with-keywords.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/enum-with-keywords.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/enum-with-keywords.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/enum-with-keywords.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/index-signature-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/index-signature-parameters.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/index-signature-parameters.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/index-signature-parameters.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-empty-extends.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-empty-extends.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-empty-extends.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-empty-extends.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-implements.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-implements.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-implements.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-implements.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-export.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-export.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-export.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-export.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-private.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-private.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-private.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-private.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-protected.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-protected.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-protected.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-protected.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-public.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-public.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-public.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-public.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-static.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-static.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-static.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-index-signature-static.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-method-export.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-export.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-method-export.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-export.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-method-private.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-private.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-method-private.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-private.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-method-protected.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-protected.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-method-protected.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-protected.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-method-public.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-public.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-method-public.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-public.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-method-static.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-static.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-method-static.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-static.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-multiple-extends.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-multiple-extends.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-multiple-extends.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-multiple-extends.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-export.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-export.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-export.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-export.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-private.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-private.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-private.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-private.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-protected.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-protected.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-protected.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-protected.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-public.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-public.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-public.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-public.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-static.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-static.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-static.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-static.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-with-default-value.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-with-default-value.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/interface-property-with-default-value.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-property-with-default-value.src.ts
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-with-no-body.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-with-no-body.src.ts
new file mode 100644
index 000000000000..3f943170b49e
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-with-no-body.src.ts
@@ -0,0 +1 @@
+interface Foo
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/object-assertion-not-allowed.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/object-assertion-not-allowed.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/object-assertion-not-allowed.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/object-assertion-not-allowed.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/object-optional-not-allowed.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/object-optional-not-allowed.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/object-optional-not-allowed.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/object-optional-not-allowed.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/solo-const.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/solo-const.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/errorRecovery/solo-const.src.ts
rename to packages/shared-fixtures/fixtures/typescript/errorRecovery/solo-const.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/expressions/call-expression-type-arguments.src.ts b/packages/shared-fixtures/fixtures/typescript/expressions/call-expression-type-arguments.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/expressions/call-expression-type-arguments.src.ts
rename to packages/shared-fixtures/fixtures/typescript/expressions/call-expression-type-arguments.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/expressions/new-expression-type-arguments.src.ts b/packages/shared-fixtures/fixtures/typescript/expressions/new-expression-type-arguments.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/expressions/new-expression-type-arguments.src.ts
rename to packages/shared-fixtures/fixtures/typescript/expressions/new-expression-type-arguments.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/expressions/tagged-template-expression-type-arguments.src.ts b/packages/shared-fixtures/fixtures/typescript/expressions/tagged-template-expression-type-arguments.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/expressions/tagged-template-expression-type-arguments.src.ts
rename to packages/shared-fixtures/fixtures/typescript/expressions/tagged-template-expression-type-arguments.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts b/packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts
rename to packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts b/packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts
rename to packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/global-module-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/global-module-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/global-module-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/global-module-declaration.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/module-with-default-exports.src.ts b/packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/module-with-default-exports.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/module-with-default-exports.src.ts
rename to packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/module-with-default-exports.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/nested-internal-module.src.ts b/packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/nested-internal-module.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/nested-internal-module.src.ts
rename to packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/nested-internal-module.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts
rename to packages/shared-fixtures/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/array-type.src.ts b/packages/shared-fixtures/fixtures/typescript/types/array-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/array-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/array-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/conditional-infer-nested.src.ts b/packages/shared-fixtures/fixtures/typescript/types/conditional-infer-nested.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/conditional-infer-nested.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/conditional-infer-nested.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/conditional-infer-simple.src.ts b/packages/shared-fixtures/fixtures/typescript/types/conditional-infer-simple.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/conditional-infer-simple.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/conditional-infer-simple.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/conditional-infer.src.ts b/packages/shared-fixtures/fixtures/typescript/types/conditional-infer.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/conditional-infer.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/conditional-infer.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/conditional-with-null.src.ts b/packages/shared-fixtures/fixtures/typescript/types/conditional-with-null.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/conditional-with-null.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/conditional-with-null.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/conditional.src.ts b/packages/shared-fixtures/fixtures/typescript/types/conditional.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/conditional.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/conditional.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/constructor-generic.src.ts b/packages/shared-fixtures/fixtures/typescript/types/constructor-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/constructor-generic.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/constructor-generic.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/constructor-in-generic.src.ts b/packages/shared-fixtures/fixtures/typescript/types/constructor-in-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/constructor-in-generic.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/constructor-in-generic.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/constructor-with-rest.src.ts b/packages/shared-fixtures/fixtures/typescript/types/constructor-with-rest.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/constructor-with-rest.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/constructor-with-rest.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/constructor.src.ts b/packages/shared-fixtures/fixtures/typescript/types/constructor.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/constructor.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/constructor.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/function-generic.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/function-generic.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/function-generic.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/function-in-generic.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function-in-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/function-in-generic.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/function-in-generic.src.ts
diff --git a/packages/shared-fixtures/fixtures/typescript/types/function-with-array-destruction.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function-with-array-destruction.src.ts
new file mode 100644
index 000000000000..2517be450da2
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/types/function-with-array-destruction.src.ts
@@ -0,0 +1 @@
+type foo = ([a]: any) => any
diff --git a/packages/shared-fixtures/fixtures/typescript/types/function-with-object-destruction.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function-with-object-destruction.src.ts
new file mode 100644
index 000000000000..fdb44b90178c
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/types/function-with-object-destruction.src.ts
@@ -0,0 +1 @@
+type foo = ({a}: any) => any
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/function-with-rest.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function-with-rest.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/function-with-rest.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/function-with-rest.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/function-with-this.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function-with-this.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/function-with-this.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/function-with-this.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/function.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/function.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/function.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/index-signature-readonly.src.ts b/packages/shared-fixtures/fixtures/typescript/types/index-signature-readonly.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/index-signature-readonly.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/index-signature-readonly.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/index-signature-without-type.src.ts b/packages/shared-fixtures/fixtures/typescript/types/index-signature-without-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/index-signature-without-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/index-signature-without-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/index-signature.src.ts b/packages/shared-fixtures/fixtures/typescript/types/index-signature.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/index-signature.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/index-signature.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/indexed.src.ts b/packages/shared-fixtures/fixtures/typescript/types/indexed.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/indexed.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/indexed.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/intersection-type.src.ts b/packages/shared-fixtures/fixtures/typescript/types/intersection-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/intersection-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/intersection-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/literal-number-negative.src.ts b/packages/shared-fixtures/fixtures/typescript/types/literal-number-negative.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/literal-number-negative.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/literal-number-negative.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/literal-number.src.ts b/packages/shared-fixtures/fixtures/typescript/types/literal-number.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/literal-number.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/literal-number.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/literal-string.src.ts b/packages/shared-fixtures/fixtures/typescript/types/literal-string.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/literal-string.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/literal-string.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/mapped-readonly-minus.src.ts b/packages/shared-fixtures/fixtures/typescript/types/mapped-readonly-minus.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/mapped-readonly-minus.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/mapped-readonly-minus.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/mapped-readonly-plus.src.ts b/packages/shared-fixtures/fixtures/typescript/types/mapped-readonly-plus.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/mapped-readonly-plus.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/mapped-readonly-plus.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/mapped-readonly.src.ts b/packages/shared-fixtures/fixtures/typescript/types/mapped-readonly.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/mapped-readonly.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/mapped-readonly.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/mapped.src.ts b/packages/shared-fixtures/fixtures/typescript/types/mapped.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/mapped.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/mapped.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/nested-types.src.ts b/packages/shared-fixtures/fixtures/typescript/types/nested-types.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/nested-types.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/nested-types.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/parenthesized-type.src.ts b/packages/shared-fixtures/fixtures/typescript/types/parenthesized-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/parenthesized-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/parenthesized-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/reference-generic-nested.src.ts b/packages/shared-fixtures/fixtures/typescript/types/reference-generic-nested.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/reference-generic-nested.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/reference-generic-nested.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/reference-generic.src.ts b/packages/shared-fixtures/fixtures/typescript/types/reference-generic.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/reference-generic.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/reference-generic.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/reference.src.ts b/packages/shared-fixtures/fixtures/typescript/types/reference.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/reference.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/reference.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/this-type-expanded.src.ts b/packages/shared-fixtures/fixtures/typescript/types/this-type-expanded.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/this-type-expanded.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/this-type-expanded.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/this-type.src.ts b/packages/shared-fixtures/fixtures/typescript/types/this-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/this-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/this-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/tuple-empty.src.ts b/packages/shared-fixtures/fixtures/typescript/types/tuple-empty.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/tuple-empty.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/tuple-empty.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/tuple-optional.src.ts b/packages/shared-fixtures/fixtures/typescript/types/tuple-optional.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/tuple-optional.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/tuple-optional.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/tuple-rest.src.ts b/packages/shared-fixtures/fixtures/typescript/types/tuple-rest.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/tuple-rest.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/tuple-rest.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/tuple-type.src.ts b/packages/shared-fixtures/fixtures/typescript/types/tuple-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/tuple-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/tuple-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/tuple.src.ts b/packages/shared-fixtures/fixtures/typescript/types/tuple.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/tuple.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/tuple.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/type-literal.src.ts b/packages/shared-fixtures/fixtures/typescript/types/type-literal.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/type-literal.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/type-literal.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/type-operator.src.ts b/packages/shared-fixtures/fixtures/typescript/types/type-operator.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/type-operator.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/type-operator.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/typeof.src.ts b/packages/shared-fixtures/fixtures/typescript/types/typeof.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/typeof.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/typeof.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/union-intersection.src.ts b/packages/shared-fixtures/fixtures/typescript/types/union-intersection.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/union-intersection.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/union-intersection.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/union-type.src.ts b/packages/shared-fixtures/fixtures/typescript/types/union-type.src.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/fixtures/typescript/types/union-type.src.ts
rename to packages/shared-fixtures/fixtures/typescript/types/union-type.src.ts
diff --git a/packages/typescript-eslint-shared-fixtures/jsx-known-issues.ts b/packages/shared-fixtures/jsx-known-issues.ts
similarity index 100%
rename from packages/typescript-eslint-shared-fixtures/jsx-known-issues.ts
rename to packages/shared-fixtures/jsx-known-issues.ts
diff --git a/packages/typescript-eslint-shared-fixtures/package.json b/packages/shared-fixtures/package.json
similarity index 76%
rename from packages/typescript-eslint-shared-fixtures/package.json
rename to packages/shared-fixtures/package.json
index dfb21239d0cf..30339b84cab3 100644
--- a/packages/typescript-eslint-shared-fixtures/package.json
+++ b/packages/shared-fixtures/package.json
@@ -1,5 +1,5 @@
{
"name": "@typescript-eslint/shared-fixtures",
- "version": "0.0.0",
+ "version": "1.3.0",
"private": true
}
diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md
deleted file mode 100644
index 15510d3fb820..000000000000
--- a/packages/typescript-eslint-parser/CHANGELOG.md
+++ /dev/null
@@ -1,368 +0,0 @@
-v21.0.2 - December 3, 2018
-
-- [`fed0a5a`](https://github.com/eslint/typescript-eslint-parser/commit/fed0a5a4bc7b3c6a242081adf91af50e848fcf62) Docs: Update README.md (#567) (dudiharush)
-- [`47abd82`](https://github.com/eslint/typescript-eslint-parser/commit/47abd8282384617793d800209b5eb5d71d0c5730) Fix: issue with global augmentation when tokens are not present (#574) (Armano)
-- [`c5ffad3`](https://github.com/eslint/typescript-eslint-parser/commit/c5ffad3ecafdc9596174d1a2de5fd978d386035a) Fix: scope for TSImportEqualsDeclaration (#571) (Armano)
-- [`8ff0ad1`](https://github.com/eslint/typescript-eslint-parser/commit/8ff0ad153cf66b873c21624b7af31d33ce9d7073) Fix: missing implements in classes (#562) (Armano)
-- [`cc92044`](https://github.com/eslint/typescript-eslint-parser/commit/cc920441093356a7a47ff5fdb752643b6c42cff8) Fix: visiting superTypeParameters in classes (#561) (Armano)
-- [`83dbabb`](https://github.com/eslint/typescript-eslint-parser/commit/83dbabb626e5592c07085743a44586378956a153) Fix: visiting typeParameters in expressions (#565) (Armano)
-- [`c19e479`](https://github.com/eslint/typescript-eslint-parser/commit/c19e4798ae6067daf9994b90fabcdf2d1953d70c) Fix: visitor-keys for TSAbstractClassProperty (#560) (Armano)
-- [`491ebca`](https://github.com/eslint/typescript-eslint-parser/commit/491ebcaff9815071d4194584e3d94d0edf601e3b) Fix: crash in no-unused-vars when using enum (#556) (Armano)
-- [`ae7c4e6`](https://github.com/eslint/typescript-eslint-parser/commit/ae7c4e661737b0db8cb0f7b612f58a94e1cced7c) Fix: missing visitor-keys (#554) (Armano)
-
-v21.0.1 - November 15, 2018
-
-- [`3715584`](https://github.com/eslint/typescript-eslint-parser/commit/3715584404de566c9b6db975328122e819993768) Fix: wrong reference on TSQualifiedName (fixes #550) (#551) (Toru Nagashima)
-- [`15b32d0`](https://github.com/eslint/typescript-eslint-parser/commit/15b32d0c9430111cdcdc7d187dfdc00b049bf3fb) Upgrade: eslint-release v1.2.0 (#549) (Kai Cataldo)
-
-v21.0.0 - November 13, 2018
-
-- eb23b26 Update: add proper scope analysis (fixes #535) (#540) (Toru Nagashima)
-- 150ffe8 Breaking: make 'useJSXTextNode:true' by default (#544) (Toru Nagashima)
-- 2d22321 Breaking: switch 'jsx' option by filename (fixes #517) (#543) (Toru Nagashima)
-- 3b1ed17 Breaking: make eslint a peerDep/devDep (#541) (Kai Cataldo)
-- 1d54346 Chore: test Node v11 in CI (#542) (Kai Cataldo)
-- a9d932a Breaking: typescript-estree v5 (#538) (Kai Cataldo)
-- 6a9b629 Docs: add options to README (#530) (Joe Pea)
-
-v20.1.1 - October 31, 2018
-
-- 1683169 Revert "Chore: Make ESLint a devDependency/peerDependency (fixes #523)" (#537) (Kevin Partington)
-
-v20.1.0 - October 30, 2018
-
-- 075d243 Chore: Make ESLint a devDependency/peerDependency (fixes #523) (#526) (Kevin Partington)
-- 4310aac Chore: Force LF for tsx files (#520) (Benjamin Lichtman)
-- bacac5f New: Add visitor keys (#516) (Michał Sajnóg)
-- 4172933 Upgrade: eslint-release@1.0.0 (#527) (Teddy Katz)
-
-v20.0.0 - October 8, 2018
-
-- f4b9893 Breaking: Support TypeScript 3.1 (fixes #524) (#525) (James Henry)
-
-v19.0.2 - September 29, 2018
-
-- aa0fe13 Fix: Re-expose parse method (fixes #519) (#521) (Kevin Partington)
-- 655359f Chore: Makefile tweaks (#522) (Kevin Partington)
-
-v19.0.1 - September 25, 2018
-
-- 7a367c7 Fix: Remove lib from package.json files (#518) (James Henry)
-
-v19.0.0 - September 25, 2018
-
-- 3d3ab2f Breaking: Use typescript-estree for parsing (#515) (James Henry)
-
-v18.0.0 - August 6, 2018
-
-- 16d1a78 Breaking: Support TypeScript 3.0 (#504) (James Henry)
-- 7461462 Fix: remove unnecessary TypeRef wrapper for ImportType (fixes #507) (#508) (Ika)
-
-v17.0.1 - July 26, 2018
-
-- f1d7de3 Chore: Replace removed API with public flags (fixes #498) (#505) (Texas Toland)
-
-v17.0.0 - July 26, 2018
-
-- 117800d Fix: support JSXSpreadChild (fixes #500) (#501) (Ika)
-- 6eec85b Breaking: Remove "Experimental" from rest and spread (fixes #428) (#429) (Lucas Duailibe)
-- 42f29a1 Fix: error on multiple super classes (fixes #493) (#494) (Ika)
-- 11d9169 Breaking: always set optional on ClassProperty (fixes #472) (#491) (Ika)
-
-v16.0.1 - June 27, 2018
-
-- bc83c6a Chore: Do not run integration tests within npm test (James Henry)
-- db62d63 Fix: Snapshot all ecma-features fixtures (#495) (James Henry)
-- 3c1fab0 Fix: support ImportMeta (fixes #489) (#490) (Ika)
-- 6611535 Chore: Loosen node version requirement in package.json (fixes #482) (#484) (James Henry)
-- 27f39cc Chore: Powerful integration tests and improved README (#483) (James Henry)
-
-v16.0.0 - June 3, 2018
-
-- 009336d Breaking: Set minimum node version to 6 (#481) (James Henry)
-- 9316b23 Breaking: Support TypeScript 2.9 (#480) (James Henry)
-
-v15.0.1 - June 3, 2018
-
-- 891cee9 Fix: decorators removed on interface declarations (fixes #478) (#479) (Muhanad Rabie)
-
-v15.0.0 - April 17, 2018
-
-- e572416 Breaking: Support TypeScript 2.8 (fixes #453) (#454) (James Henry)
-
-v14.0.0 - February 21, 2018
-
-- 439ea24 New: Support Definite Assignment (fixes #424) (#432) (Lucas Azzola)
-- adc0b1b Breaking: Remove all tokens inside comments from tokens array (fixes #422) (#423) (Kai Cataldo)
-
-v13.0.0 - February 9, 2018
-
-- fb5e4c4 Breaking: Support TypeScript 2.7 (fixes #442,#426) (#447) (James Henry)
-- bd9c12f Docs: Update Known Issues section of README (#440) (Kepler Sticka-Jones)
-
-v12.0.0 - January 16, 2018
-
-- 6ce4cd8 Breaking: Properly categorize constructors with no body (#427) (Jed Fox)
-- e94ede3 Docs: Sets default code block language in issue template to "ts" (#421) (Marius Schulz)
-
-v11.0.0 - December 13, 2017
-
-- 6698042 Breaking: No prefix on FnDec within namespace (fixes #127) (#413) (James Henry)
-- aec31cb Breaking: Implement parseForESLint() function (#412) (James Henry)
-
-v10.0.0 - December 11, 2017
-
-- 59a37f4 Breaking: Updates to AST node types of some TSNodes (fixes #386) (#388) (James Henry)
-- 627355e Chore: Introduce integration tests (#411) (James Henry)
-- b4d22e7 Chore: No package-lock like other ESLint repos (#409) (James Henry)
-
-v9.0.1 - November 29, 2017
-
-- 153cdb8 Fix: Calculate end position of TypeInstantiation (fixes #406) (#405) (Lucas Duailibe)
-- 678907b Fix: Explicitly convert AbstractKeyword (fixes #407) (#408) (James Henry)
-
-v9.0.0 - November 10, 2017
-
-- 46479e8 Breaking: Support TypeScript 2.6 (fixes #394) (#397) (James Henry)
-
-v8.0.1 - October 22, 2017
-
-- 0401ffc Fix: Calculate typeArguments loc data correctly if empty (fixes #395) (#396) (James Henry)
-- a214f71 Chore: Add a way to test TSX specific issues (fixes #376) (#398) (James Henry)
-- 9c71a62 Fix: add missing TSSymbolKeyword type (#385) (Ika)
-- e10aab8 Chore: Refactor alignment tests, now on by default (#387) (James Henry)
-- 9e17d0b Chore: Minor cleanup, fix jQuery foundation copyright (#383) (James Henry)
-
-v8.0.0 - September 5, 2017
-
-- 9877e98 Breaking: Support TypeScript 2.5 (fixes #368) (#369) (#370) (James Henry)
-- 5b49870 Fix: Location data for typeAnnotations (#378) (James Henry)
-
-v7.0.0 - August 22, 2017
-
-- 01c34f4 Fix: Ensure exports applied to TSModuleDeclaration (#375) (James Henry)
-- 38bd1ae Breaking: Check for isTypeKeyword in type params (fixes #373) (#374) (James Henry)
-- 3727956 Breaking: Handle TSModuleDeclaration and refactor (fixes #371) (#372) (James Henry)
-- d67ee6c Fix: Typo in TSExportAssignment node type (#367) (James Henry)
-
-v6.0.1 - August 19, 2017
-
-- 7bcc0d6 Fix: Ensure modifiers are applied to enums (fixes #365) (#366) (James Henry)
-
-v6.0.0 - August 19, 2017
-
-- 32c0cc8 Breaking: Explicitly handle TSEnumDeclaration (fixes #345) (#364) (James Henry)
-- 5f741a9 Fix: Allow other orderings of implements/extends clauses (fixes #361) (#363) (Jed Fox)
-- f5bd145 Chore: Breakout and label TS-specific AST comparison tests (#360) (James Henry)
-- f6e56b3 Chore: Build out AST comparison tests and categorize issues (#358) (James Henry)
-- ab4e05e Breaking: Only add .implements/.accessibility/.decorators if truthy (#354) (James Henry)
-- 275897b Fix: Location data for methods and constructors (#357) (James Henry)
-- 5fce5e7 Fix: Exp. operator assignment is AssignmentExpression (fixes #355) (#356) (James Henry)
-- 67971de Fix: Include newlines at the end of source in AST (fixes #352) (#353) (James Henry)
-- 8406209 Fix: Remove start and end values from JSX tokens (fixes #341) (#351) (James Henry)
-
-v5.0.1 - August 9, 2017
-
-- 81e20c0 Fix: Only warn about an unsupported TypeScript version once (#347) (Jed Fox)
-- 5e22fac Chore: AST alignment testing against Babylon (#342) (James Henry)
-
-v5.0.0 - August 6, 2017
-
-- 271b4f1 New: Support TypeScript 2.4 (fixes #321) (#322) (#326) (James Henry)
-- ea6c3bb Breaking: Use TSTypeReference for TypeParameters (#340) (James Henry)
-- a9ca775 Fix: Use name 'this' in JSXMemberExpression (fixes #337) (#338) (Reyad Attiyat)
-- ef2687b Fix: Handle assignment within property destructuring (fixes #332) (#336) (James Henry)
-
-v4.0.0 - July 10, 2017
-
-- 6a612cd Breaking: Include type annotation range for Identifiers (fixes #314) (#319) (Reyad Attiyat)
-- 074a64f Fix: Arrow function body should be ObjectExpression (fixes #331) (#334) (Reyad Attiyat)
-- fb66f61 Fix: Unescape string literal identifiers (fixes #328) (#330) (Lucas Azzola)
-- 9cab9d3 Breaking: Remove TypeAnnotation wrapper from constraint (#325) (James Henry)
-- b255499 New: Provider loggerFn option to configure logging (fixes #323) (#324) (James Henry)
-- 0540298 Fix: Calculate correct type parameter range (fixes #316) (#320) (Reyad Attiyat)
-- 4938c2c Fix: Ensure JSX tag names are JSXIdentifiers (fixes #315) (#318) (Reyad Attiyat)
-- 1f20557 Fix: Use TSExportAssignment node type (fixes #304) (#317) (Reyad Attiyat)
-- b26cda1 Fix: Use TSNullKeyword for null type instead of Literal (#313) (James Henry)
-- 9037dc5 Chore: Add node 8 to .travis.yml (#312) (James Henry)
-- 8062515 Chore: Refactor tests to assert snapshots not JSON (#311) (James Henry)
-- 2ad791b Fix: Add name to JSXIdentifier when converting ThisKeyword (fixes #307) (#310) (Reyad Attiyat)
-- 519907e Breaking: Use ESTree export node types in modules (fixes# 263) (#265) (Reyad Attiyat)
-- c4b0b64 Fix: Label readonly class properties (fixes #302) (#303) (Reyad Attiyat)
-- bffd6cc Fix: Add more tests for destructuring and spread (fixes #306) (#308) (Reyad Attiyat)
-- f7c9246 Chore: Fix typo in comment (#305) (Jeremy Attali)
-- 3dcba7d Breaking: Change isReadonly to readonly (fixes #284) (#285) (James Henry)
-- bc9225f Chore: Replace mocha (istanbul, chai, leche) with Jest (#300) (James Henry)
-- 8744577 Breaking: Decorator ESTree compliance, always convert (fixes #250) (#293) (James Henry)
-- dd6404a Breaking: Convert Signature types to be more ESTree like (fixes #262) (#264) (Reyad Attiyat)
-- 379dcaf Fix: Only set optional property on certain node property (fixes #289) (#292) (Reyad Attiyat)
-- 89f8561 Fix: Label static and export in TSParameterProperty (fixes #286) (#301) (Reyad Attiyat)
-- 992f1fa Fix: Unescape type parameter names (fixes #296) (#298) (Reyad Attiyat)
-- 5ed8573 Fix: Async generator method should be labeled (fixes #297) (#299) (Reyad Attiyat)
-- 31ad3c4 Fix: Create RegExp object for RegExp literals (fixes #287) (#291) (Reyad Attiyat)
-- 525a544 Fix: Set node type to ExperimentalRestProperty (fixes #276) (#279) (Reyad Attiyat)
-- eb32fed Fix: Convert type guards (fixes #282) (#283) (James Henry)
-- b7220fd New: Create option to enable JSXText node type (fixes #266) (#272) (Reyad Attiyat)
-- 6dd3696 Fix: Add exponentiation operators (fixes #280) (#281) (Lucas Azzola)
-- 3491b4b Fix: Replace JSXMemberExpression with TSQualifiedName (fixes #257) (#258) (Lucas Azzola)
-- b4eb0b5 Fix: Convert range and line number corretly in JSX literals (#277) (Reyad Attiyat)
-- 3f9f41c Fix: wrap interface in ExportNamedDeclaration if necessary (fixes #269) (#270) (Danny Martini)
-
-v3.0.0 - May 17, 2017
-
-- 6b56bfe Fix: Use correct starting range and loc for JSXText tokens (fixes #227) (#271) (Reyad Attiyat)
-- f5fcc87 Breaking: Allow comment scanner to rescan tokens (fixes #216) (#219) (Reyad Attiyat)
-- f836bb9 Chore: Refactor the codebase (fixes #220) (#261) (James Henry)
-- aade6bd Chore: Update README with list of known issues (#247) (Reyad Attiyat)
-- c8e881a Breaking: Normalize type parameters (fixes #197) (#196) (Rasmus Eneman)
-- d37bf04 Fix: Type parameter start location calculation (fixes #260) (#259) (Igor Oleinikov)
-- 1a97650 Fix: Handle case where class has extends but no super class (fixes #249) (#254) (Reyad Attiyat)
-- 00ad71d Fix: add `instanceof` to ast-converter (fixes #252) (#251) (Danny Arnold)
-- 2989f8b Upgrade: Update semver package (#246) (Simen Bekkhus)
-- b1efe69 Breaking: Change how interface node gets converted (fixes #201) (#241) (Reyad Attiyat)
-- e311620 Fix: Set await property on async iterators (for await) (fixes #236) (#239) (Reyad Attiyat)
-- a294afa Fix: Set async on async FunctionExpressions (fixes #244) (#245) (Lucas Azzola)
-- 7c00f16 Chore: Add tests for object spread and async generator (refs #236) (#237) (Reyad Attiyat)
-- 7b69bc9 Fix: Label abstract class properties (fixes #234) (#238) (Reyad Attiyat)
-- a330ec6 New: Add support for default type parameters (fixes #235) (#240) (Reyad Attiyat)
-- e1ef800 Fix: Support superTypeParameters (fixes #242) (#243) (Lucas Azzola)
-- 65c2e0a Breaking: Support TypeScript 2.3 (fixes #232) (#233) (Lucas Azzola)
-- 15f1173 Fix: Use TSAbsractMethodDefinition for abstract constructor (fixes #228) (#229) (Lucas Azzola)
-- 8fb71d2 Breaking: Add .body to TSModuleBlock nodes (fixes #217) (#218) (Philipp A)
-- 471f403 Chore: Remove before_script from .travis.yml (fixes #231) (#230) (James Henry)
-- 9397c5c Chore: Cleanup Makefile (#221) (Reyad Attiyat)
-- dd57f81 Update: Open TS peerDependency, warn non-supported version (fixes #167) (#193) (James Henry)
-- a37d5ed Fix: Wrap any parameter with modifiers, not just in constructors (#214) (Rasmus Eneman)
-
-v2.1.0 - April 4, 2017
-
-- d709fd8 Fix: Set root to true in eslintrc (fixes #211) (#212) (Reyad Attiyat)
-- 1e73711 Fix: Optional methods are not marked as optional (fixes #206) (#207) (Rasmus Eneman)
-- 1cee2e3 Fix: Nested type arguments are not preserved (fixes #204) (#205) (Rasmus Eneman)
-- 5a324a3 Fix: Preserve type parameters for methods (fixes #202) (#203) (Rasmus Eneman)
-- bfb1506 New: Add type parameters to more AST nodes (fixes #184) (#183) (Rasmus Eneman)
-- 0fadfc3 Fix: Convert MetaProperty (new.target) nodes correcly (fixes #194) (#195) (Reyad Attiyat)
-- 4d755ed New: Store type parameter constraints (fixes #188) (#189) (Rasmus Eneman)
-- 29d848c Fix: Updated broken class-with-optional-properties test result (#192) (James Henry)
-- 04f6556 New: Mark optional parameters and properties (fixes #186) (#187) (Rasmus Eneman)
-- cc9d4b3 Fix: Add missing typeAnnotation to class properties (fixes #190) (#191) (Rasmus Eneman)
-- 215a012 Fix: Change DoWhileStatement to DoStatement to match TS (fixes #180) (#181) (James Henry)
-- 581a7a5 Fix: Missing parameter properties info in constructors (fixes #143) (#168) (patricio trevino)
-- 69d2537 Chore: Add test for constructor and methods with parameters (refs #168) (#178) (Reyad Attiyat)
-- c2a0b71 Fix: Add start and end property to tokens (fixes #172) (#176) (Reyad Attiyat)
-- 2640d81 Fix: Remove jsdoc node property from ts nodes (fixes #164) (#177) (Reyad Attiyat)
-- 701e2c5 Fix: Set name to type JSXIdentifier and fix selfClosing (fixes #172) (#175) (Reyad Attiyat)
-- 8b4e548 Fix: Convert Void and Delete expressions to UnaryExpression (fixes #171) (#174) (Reyad Attiyat)
-
-v2.0.0 - February 24, 2017
-
-- 38aef53 Breaking: Updated supported TypeScript version to ~2.2.1 (fixes #149) (#169) (James Henry)
-- 25207e0 Fix: Optimize convertTokens, treat JsxText as token (fixes #70) (#158) (James Henry)
-- 76c33f8 Fix: Await node should have argument property (fixes #160) (#161) (Reyad Attiyat)
-- 2f86bef Fix: Unescape identifiers typescript may prepend underscore (fixes #145) (#159) (Reyad Attiyat)
-
-v1.0.3 - February 10, 2017
-
-- 19e7f15 Docs: Show currently supported TypeScript version (#157) (James Henry)
-- e96ba1f Fix: Calculate range correctly for exported generic class (fixes #152) (#155) (Reyad Attiyat)
-- 11d5a7d Fix: Handle object types without annotations (fixes #148) (#154) (Reyad Attiyat)
-- fc1e6bb Fix: Parameter with assignation provide type annotations (fixes #146) (#147) (patricio trevino)
-- e5f378f Fix: Calculate range correctly when class is exported (fixes #152) (#153) (Reyad Attiyat)
-- 6312383 Fix: Calculate constructor range using node.parameters.pos (fixes #139) (#140) (Reyad Attiyat)
-
-v1.0.2 - January 12, 2017
-
-- d53f1f8 Fix: Use ts utilities determine variable declaration type (fixes #136) (#138) (Reyad Attiyat)
-- 918190d Fix: export type alias ExportNamedDeclaration node generation (fixes #134) (#135) (patricio trevino)
-
-v1.0.1 - January 4, 2017
-
-- 9882a8e Fix: Add missing async property (#133) (James Henry)
-- 60843ad Fix: Handle async/await (fixes #119) (#129) (Philipp A)
-- 0ff19dd Fix: Exception thrown when space occurs after function name (fixes #123) (#124) (Reyad Attiyat)
-- ff283aa Fix: Allow running without options (fixes #121) (#120) (Philipp A)
-- dd03b2f Docs: Changed --save to --save-dev in readme (#132) (Amila Welihinda)
-- 41ccef5 Build: Add TS as dev-dep, only support minor range (#131) (James Henry)
-
-v1.0.0 - November 11, 2016
-
-- c60f216 Chore: Normalize .yml line endings (fixes #113) (#115) (James Henry)
-- 9521396 Breaking: Updated to TypeScript 2.x (fixes #105) (#112) (James Henry)
-- a7320df Docs: Update license copyright (Nicholas C. Zakas)
-- 51ec64d Fix: Exclude TSNode.flags when deeplyCopy fallback is used (refs #105) (#107) (James Henry)
-- 7ebf4d5 Fix: Rename decorator example to avoid issue in TS 2.x (refs #105) (#106) (James Henry)
-- 45b9874 Fix: Added missing yml lf gitattribute (#104) (James Henry)
-- 4dd3439 Build: Add Node 6.x to Travis (fixes #99) (#98) (Danny Fritz)
-
-v0.4.0 - September 23, 2016
-
-- eb1ad9b Fix: Add loc and range data to generated VariableDeclarator node (#100) (James Henry)
-- 5dae849 New: Accessibility Modifiers (fixes #87) (#88) (Danny Fritz)
-- 68992eb Fix: Tests break with Windows line-endings (fixes #93) (#97) (Danny Fritz)
-
-v0.3.1 - September 20, 2016
-
-- e36d800 Fix: Convert TypeAliasDeclaration into VariableDeclarator (fixes #89) (#91) (James Henry)
-- ac0c95d Fix: Prefix function declarations in TS namespaces (fixes #78) (#82) (James Henry)
-- 7cc865e Fix: Support abstract classes and methods (fixes #80) (#81) (James Henry)
-
-v0.3.0 - September 13, 2016
-
-- e76f3b9 New: Convert type alias into variable declaration (refs #77) (#83) (James Henry)
-- 5c47ad5 Fix: Convert TSTypeOfExpression to UnaryExpression (fixes #85) (#86) (James Henry)
-- 799fd63 Fix: Distinguish between DeclareFunction and FunctionDeclaration (#79) (James Henry)
-
-v0.2.0 - August 29, 2016
-
-- 138495f New: Add accessor decorators to AST (fixes #63) (#73) (James Henry)
-- f6a8e71 New: Add property decorators to AST (fixes #71) (#72) (James Henry)
-- 328259f New: Add param decorators to the AST (fixes #68) (#69) (James Henry)
-- 8b97fe7 New: Add class decorators to AST (fixes #66) (#67) (James Henry)
-- 7364cb9 New: Add method decorators to AST (fixes #65) (#64) (James Henry)
-
-v0.1.3 - August 22, 2016
-
-- da984bf Fix: manually update package.json after build failure (Nicholas C. Zakas)
-- 5bfb9bf Fix: Check for arguments property on NewExpression (fixes #60) (#62) (James Henry)
-- d323ee7 Docs: Add issue template (Nicholas C. Zakas)
-- 8f4964c Fix: UpdateExpression detection and operator format (fixes #58) (#59) (James Henry)
-- e09ebb3 Fix: Add function type parameters (fixes #52) (#56) (James Henry)
-
-v0.1.1 - August 10, 2016
-
-- 62d14b4 Fix: Class implements generic syntax (fixes #44) (#53) (James Henry)
-
-v0.1.0 - August 9, 2016
-
-- d49b5f1 Build: Add CI build scripts (Nicholas C. Zakas)
-- 32a46b3 New: Attaches comments to the ESTree AST (fixes #31) (#49) (James Henry)
-- f4856f9 Fix: Class implements conversion (fixes #39) (#43) (Nicholas C. Zakas)
-- 795a418 Build: Add linting to npm test (Nicholas C. Zakas)
-- d26fec4 New: Automatically generate TS-specific nodes (#40) (Nicholas C. Zakas)
-- 46b9c87 Docs: Update README to have the correct phase order. (#35) (Dean Taub)
-- a8b00fe Chore: Add jQuery Foundation copyright (Nicholas C. Zakas)
-- 560bb99 Fix: Remove console logging of node.kind (fixes #29) (Tom X. Tobin)
-
-v0.1.0-alpha.1 - March 18, 2016
-
-- 0eddb71 New: Implements JSX syntax (fixes #18) (James Henry)
-- e890743 Docs: PR validation check (Nicholas C. Zakas)
-- c314f77 Build: Don't test Node 0.10 (Nicholas C. Zakas)
-- bc05e1a Fix: Ensure true, false and null values are not stringifed (fixes #1) (James Henry)
-
-v0.1.0-alpha.0 - March 4, 2016
-
-- c05b5da Build: Add release tool (Nicholas C. Zakas)
-- 091973b Fix: SyntaxKind code checks, update TS peerDependency ^1.7.3 (fixes #15) (James Henry)
-- e34f6b4 Fix: Use YAML file for ESLint config (Nicholas C. Zakas)
-- e19b29d Update: TypeScript to be a peer dependency (fixes #12) (Nicholas C. Zakas)
-- bdb1e3a Fix: Make tests actually work (fixes #6) (Nicholas C. Zakas)
-- c61cc81 Docs: Improved detail and accuracy of JSDoc blocks (James Henry)
-- 918a9cc Fix: Fixes linting errors (fixes #10) (James Henry)
-- 1721dde Fix: Bumped lint script dependencies (fixes #8) (James Henry)
-- 2f04e92 Fix: Removed unused reference to acorn-jsx/inject (fixes #2) (James Henry)
-- 0e9d61e Docs: Update README with plans (Nicholas C. Zakas)
-- c88e3ab New: Finished up ES6 features (Nicholas C. Zakas)
-- 0ea1e32 Build: Tag as alpha release (Nicholas C. Zakas)
-- 08702b8 Docs: Update README (Nicholas C. Zakas)
-- c88ba98 New: First commit (Nicholas C. Zakas)
diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md
deleted file mode 100644
index 49e7a196a2dd..000000000000
--- a/packages/typescript-eslint-parser/README.md
+++ /dev/null
@@ -1,108 +0,0 @@
-# TypeScript ESLint Parser
-
-An ESLint custom parser which leverages [TypeScript ESTree](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/typescript-estree) to allow for ESLint to lint TypeScript source code.
-
-## Installation:
-
-```sh
-npm install --save-dev typescript-eslint-parser
-```
-
-## Usage
-
-In your ESLint configuration file, set the `parser` property:
-
-```json
-{
- "parser": "typescript-eslint-parser"
-}
-```
-
-There is sometimes an incorrect assumption that the parser itself is what does everything necessary to facilitate the use of ESLint with TypeScript. In actuality, it is the combination of the parser _and_ one or more plugins which allow you to maximize your usage of ESLint with TypeScript.
-
-For example, once this parser successfully produces an AST for the TypeScript source code, it might well contain some information which simply does not exist in a standard JavaScript context, such as the data for a TypeScript-specific construct, like an `interface`.
-
-The core rules built into ESLint, such as `indent` have no knowledge of such constructs, so it is impossible to expect them to work out of the box with them.
-
-Instead, you also need to make use of one more plugins which will add or extend rules with TypeScript-specific features.
-
-By far the most common case will be installing the [eslint-plugin-typescript](https://github.com/nzakas/eslint-plugin-typescript) plugin, but there are also other relevant options available such a [eslint-plugin-tslint](https://github.com/JamesHenry/eslint-plugin-tslint).
-
-## Configuration
-
-The following additional configuration options are available by specifying them in [`parserOptions`](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) in your ESLint configuration file.
-
-- **`jsx`** - default `false`. Enable parsing JSX when `true`. More details can be found [here](https://www.typescriptlang.org/docs/handbook/jsx.html).
-
- - It's `false` on `*.ts` files regardless of this option.
- - It's `true` on `*.tsx` files regardless of this option.
- - Otherwise, it respects this option.
-
-- **`useJSXTextNode`** - default `true`. Please set `false` if you use this parser on ESLint v4. If this is `false`, the parser creates the AST of JSX texts as the legacy style.
-
-### .eslintrc.json
-
-```json
-{
- "parser": "typescript-eslint-parser",
- "parserOptions": {
- "jsx": true,
- "useJSXTextNode": true
- }
-}
-```
-
-## Supported TypeScript Version
-
-We will always endeavor to support the latest stable version of TypeScript.
-
-The version of TypeScript currently supported by this parser is `~3.2.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.
-
-If you use a non-supported version of TypeScript, the parser will log a warning to the console.
-
-**Please ensure that you are using a supported version before submitting any issues/bug reports.**
-
-## Reporting Issues
-
-Please check the current list of open and known issues and ensure the issue has not been reported before. When creating a new issue provide as much information about your environment as possible. This includes:
-
-- ESLint Version
-- TypeScript version
-- The `typescript-eslint-parser` version
-- ESLint config or rules and plugins currently enabled
-
-## Integration Tests
-
-We have a very flexible way of running integration tests which connects all of the moving parts of the usage of this parser in the ESLint ecosystem.
-
-We run each test within its own docker container, and so each one has complete autonomy over what dependencies/plugins are installed and what versions are used. This also has the benefit of not bloating the `package.json` and `node_modules` of the parser project itself.
-
-> If you are going to submit an issue related to the usage of this parser with ESLint, please consider creating a failing integration test which clearly demonstrates the behavior. It's honestly super quick!
-
-You just need to duplicate one of the existing test sub-directories found in `tests/integration/`, tweak the dependencies and ESLint config to match what you need, and add a new entry to the docker-compose.yml file which matches the format of the existing ones.
-
-Then run:
-
-```sh
-npm run integration-tests
-```
-
-If you ever need to change what gets installed when the docker images are built by docker-compose, you will first need to kill the existing containers by running:
-
-```sh
-npm run kill-integration-test-containers
-```
-
-## Contributing
-
-Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/typescript-eslint-parser/issues).
-
-## Build Commands
-
-- `npm test` - run all linting and tests
-- `npm run lint` - run all linting
-- `npm run integration-tests` - run only integration tests
-
-## License
-
-TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license.
diff --git a/packages/typescript-eslint-parser/src/parser-options.ts b/packages/typescript-eslint-parser/src/parser-options.ts
deleted file mode 100644
index 6bb6b160bca7..000000000000
--- a/packages/typescript-eslint-parser/src/parser-options.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-export interface ParserOptions {
- useJSXTextNode?: boolean;
- loc?: true;
- range?: true;
- tokens?: true;
- filePath?: string;
- sourceType?: 'script' | 'module';
- ecmaVersion?: number;
- ecmaFeatures?: {
- globalReturn?: boolean;
- };
- /**
- * @deprecated We should finalize the work from
- * https://github.com/eslint/typescript-eslint-parser#595
- */
- jsx?: boolean;
-}
diff --git a/packages/typescript-eslint-parser/src/parser.ts b/packages/typescript-eslint-parser/src/parser.ts
deleted file mode 100644
index bdf4fd7d5f46..000000000000
--- a/packages/typescript-eslint-parser/src/parser.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import traverser from 'eslint/lib/util/traverser';
-import * as typescriptESTree from 'typescript-estree';
-import { analyzeScope } from './analyze-scope';
-import { ParserOptions } from './parser-options';
-import { visitorKeys } from './visitor-keys';
-import { Program } from 'typescript';
-
-const packageJSON = require('../package.json');
-
-interface ParserServices {
- program: Program | undefined;
- esTreeNodeToTSNodeMap: WeakMap | undefined;
- tsNodeToESTreeNodeMap: WeakMap | undefined;
-}
-
-interface ParseForESLintResult {
- ast: any;
- services: ParserServices;
- visitorKeys: typeof visitorKeys;
- scopeManager: ReturnType;
-}
-
-export const version = packageJSON.version;
-
-export function parse(code: string, options?: ParserOptions) {
- return parseForESLint(code, options).ast;
-}
-
-export const Syntax = Object.freeze(typescriptESTree.AST_NODE_TYPES);
-
-export function parseForESLint(
- code: string,
- options?: T | null
-): ParseForESLintResult {
- if (typeof options !== 'object' || options === null) {
- options = { useJSXTextNode: true } as T;
- } else if (typeof options.useJSXTextNode !== 'boolean') {
- options = Object.assign({}, options, { useJSXTextNode: true });
- }
- if (typeof options.filePath === 'string') {
- const tsx = options.filePath.endsWith('.tsx');
- if (tsx || options.filePath.endsWith('.ts')) {
- options = Object.assign({}, options, { jsx: tsx });
- }
- }
-
- // https://eslint.org/docs/user-guide/configuring#specifying-parser-options
- // if sourceType is not provided by default eslint expect that it will be set to "script"
- options.sourceType = options.sourceType || 'script';
- if (options.sourceType !== 'module' && options.sourceType !== 'script') {
- options.sourceType = 'script';
- }
-
- const { ast, services } = typescriptESTree.parseAndGenerateServices(
- code,
- options
- );
- ast.sourceType = options.sourceType;
-
- traverser.traverse(ast, {
- enter: (node: any) => {
- switch (node.type) {
- // Function#body cannot be null in ESTree spec.
- case 'FunctionExpression':
- if (!node.body) {
- node.type = `TSEmptyBody${
- node.type
- }` as typescriptESTree.AST_NODE_TYPES;
- }
- break;
- // no default
- }
- }
- });
-
- const scopeManager = analyzeScope(ast, options);
- return { ast, services, scopeManager, visitorKeys };
-}
diff --git a/packages/typescript-eslint-parser/tests/lib/parser.ts b/packages/typescript-eslint-parser/tests/lib/parser.ts
deleted file mode 100644
index 89ad87638db8..000000000000
--- a/packages/typescript-eslint-parser/tests/lib/parser.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import * as typescriptESTree from 'typescript-estree';
-import { parse, parseForESLint, Syntax } from '../../src/parser';
-
-describe('parser', () => {
- it('parse() should return just the AST from parseForESLint()', () => {
- const code = 'const valid = true;';
- expect(parse(code)).toEqual(parseForESLint(code).ast);
- });
-
- it('parseForESLint() should work if options are `null`', () => {
- const code = 'const valid = true;';
- expect(() => parseForESLint(code, null)).not.toThrow();
- });
-
- it('parseForESLint() should set the sourceType to script, if an invalid one is provided', () => {
- const code = 'const valid = true;';
- const spy = jest.spyOn(typescriptESTree, 'parseAndGenerateServices');
- parseForESLint(code, { sourceType: 'foo' as any });
- expect(spy).toHaveBeenCalledWith(code, {
- sourceType: 'script',
- useJSXTextNode: true
- });
- });
-
- it('Syntax should contain a frozen object of typescriptESTree.AST_NODE_TYPES', () => {
- expect(Syntax).toEqual(typescriptESTree.AST_NODE_TYPES);
- expect(
- () => ((Syntax as any).ArrayExpression = 'foo')
- ).toThrowErrorMatchingInlineSnapshot(
- `"Cannot assign to read only property 'ArrayExpression' of object '#'"`
- );
- });
-});
diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md
new file mode 100644
index 000000000000..53d7a048eabe
--- /dev/null
+++ b/packages/typescript-estree/CHANGELOG.md
@@ -0,0 +1,49 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+# [1.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.2.0...v1.3.0) (2019-02-07)
+
+### Bug Fixes
+
+- **ts-estree:** align typeArguments and typeParameters across nodes ([#223](https://github.com/typescript-eslint/typescript-eslint/issues/223)) ([3306198](https://github.com/typescript-eslint/typescript-eslint/commit/3306198))
+- **ts-estree:** convert decorators on var and fn decs ([#211](https://github.com/typescript-eslint/typescript-eslint/issues/211)) ([0a1777f](https://github.com/typescript-eslint/typescript-eslint/commit/0a1777f))
+- **ts-estree:** fix issues with typeParams in FunctionExpression ([#208](https://github.com/typescript-eslint/typescript-eslint/issues/208)) ([d4dfa3b](https://github.com/typescript-eslint/typescript-eslint/commit/d4dfa3b))
+
+### Features
+
+- change TypeScript version range to >=3.2.1 <3.4.0 ([#184](https://github.com/typescript-eslint/typescript-eslint/issues/184)) ([f513a14](https://github.com/typescript-eslint/typescript-eslint/commit/f513a14))
+- **ts-estree:** enable errors 1098 and 1099 ([#219](https://github.com/typescript-eslint/typescript-eslint/issues/219)) ([fc50167](https://github.com/typescript-eslint/typescript-eslint/commit/fc50167))
+
+# [1.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.1...v1.2.0) (2019-02-01)
+
+**Note:** Version bump only for package @typescript-eslint/typescript-estree
+
+## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29)
+
+### Bug Fixes
+
+- **parser:** add visiting of type parameters in JSXOpeningElement ([#150](https://github.com/typescript-eslint/typescript-eslint/issues/150)) ([5e16003](https://github.com/typescript-eslint/typescript-eslint/commit/5e16003))
+- **ts-estree:** expand optional property to include question token ([#138](https://github.com/typescript-eslint/typescript-eslint/issues/138)) ([9068b62](https://github.com/typescript-eslint/typescript-eslint/commit/9068b62))
+
+### Performance Improvements
+
+- **ts-estree:** don't create Program in parse() ([#148](https://github.com/typescript-eslint/typescript-eslint/issues/148)) ([aacf5b0](https://github.com/typescript-eslint/typescript-eslint/commit/aacf5b0))
+
+# [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23)
+
+### Bug Fixes
+
+- **typescript-estree:** correct range of parameters with comments ([#128](https://github.com/typescript-eslint/typescript-eslint/issues/128)) ([91eedf2](https://github.com/typescript-eslint/typescript-eslint/commit/91eedf2))
+- **typescript-estree:** fix range of assignment in parameter ([#115](https://github.com/typescript-eslint/typescript-eslint/issues/115)) ([4e781f1](https://github.com/typescript-eslint/typescript-eslint/commit/4e781f1))
+
+# [1.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.1...v1.0.0) (2019-01-20)
+
+### Features
+
+- **parser:** support ecmaFeatures.jsx flag and tests ([#85](https://github.com/typescript-eslint/typescript-eslint/issues/85)) ([b321736](https://github.com/typescript-eslint/typescript-eslint/commit/b321736))
+
+## [0.2.1](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.0...v0.2.1) (2019-01-20)
+
+**Note:** Version bump only for package @typescript-eslint/typescript-estree
diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md
index 922a49f766bc..6769f0fca20b 100644
--- a/packages/typescript-estree/README.md
+++ b/packages/typescript-estree/README.md
@@ -3,12 +3,11 @@
A parser that converts TypeScript source code into an ESTree -compatible form
-
-
-
-
-
-
+
+
+
+
+
@@ -20,13 +19,12 @@ This parser is somewhat generic and robust, and could be used to power any use-c
In fact, it is already used within these hyper-popular open-source projects to power their TypeScript support:
- [ESLint](https://eslint.org), the pluggable linting utility for JavaScript and JSX
- - See [typescript-eslint-parser](https://github.com/eslint/typescript-eslint-parser) for more details
- [Prettier](https://prettier.io), an opinionated code formatter
## Installation
-```
-npm install --save typescript-estree
+```sh
+npm install @typescript-eslint/typescript-estree --save-dev
```
## API
@@ -35,47 +33,47 @@ npm install --save typescript-estree
Parses the given string of code with the options provided and returns an ESTree-compatible AST. The options object has the following properties:
-```javascript
+```js
{
- // attach range information to each node
- range: false,
-
- // attach line/column location information to each node
- loc: false,
-
- // create a top-level tokens array containing all tokens
- tokens: false,
-
- // create a top-level comments array containing all comments
- comment: false,
-
- // enable parsing JSX. For more details, see https://www.typescriptlang.org/docs/handbook/jsx.html
- jsx: false,
-
- /*
- * The JSX AST changed the node type for string literals
- * inside a JSX Element from `Literal` to `JSXText`.
- * When value is `true`, these nodes will be parsed as type `JSXText`.
- * When value is `false`, these nodes will be parsed as type `Literal`.
- */
- useJSXTextNode: false,
-
- // Cause the parser to error if it encounters an unknown AST node type (useful for testing)
- errorOnUnknownASTType: false,
-
- /*
- * Allows overriding of function used for logging.
- * When value is `false`, no logging will occur.
- * When value is not provided, `console.log()` will be used.
- */
- loggerFn: undefined
+ // attach range information to each node
+ range: false,
+
+ // attach line/column location information to each node
+ loc: false,
+
+ // create a top-level tokens array containing all tokens
+ tokens: false,
+
+ // create a top-level comments array containing all comments
+ comment: false,
+
+ // enable parsing JSX. For more details, see https://www.typescriptlang.org/docs/handbook/jsx.html
+ jsx: false,
+
+ /*
+ * The JSX AST changed the node type for string literals
+ * inside a JSX Element from `Literal` to `JSXText`.
+ * When value is `true`, these nodes will be parsed as type `JSXText`.
+ * When value is `false`, these nodes will be parsed as type `Literal`.
+ */
+ useJSXTextNode: false,
+
+ // Cause the parser to error if it encounters an unknown AST node type (useful for testing)
+ errorOnUnknownASTType: false,
+
+ /*
+ * Allows overriding of function used for logging.
+ * When value is `false`, no logging will occur.
+ * When value is not provided, `console.log()` will be used.
+ */
+ loggerFn: undefined
}
```
Example usage:
-```javascript
-const parser = require('typescript-estree');
+```js
+const parser = require('@typescript-eslint/typescript-estree');
const code = `const hello: string = 'world';`;
const ast = parser.parse(code, {
range: true,
@@ -89,8 +87,8 @@ Exposes the current version of typescript-estree as specified in package.json.
Example usage:
-```javascript
-const parser = require('typescript-estree');
+```js
+const parser = require('@typescript-eslint/typescript-estree');
const version = parser.version;
```
@@ -100,8 +98,8 @@ Exposes an object that contains the AST node types produced by the parser.
Example usage:
-```javascript
-const parser = require('typescript-estree');
+```js
+const parser = require('@typescript-eslint/typescript-estree');
const astNodeTypes = parser.AST_NODE_TYPES;
```
diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json
index 2c0f3f5173e9..18b452e4be5d 100644
--- a/packages/typescript-estree/package.json
+++ b/packages/typescript-estree/package.json
@@ -1,8 +1,9 @@
{
- "name": "typescript-estree",
+ "name": "@typescript-eslint/typescript-estree",
+ "version": "1.3.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"main": "dist/parser.js",
- "version": "18.1.0",
+ "types": "dist/parser.d.ts",
"files": [
"dist",
"README.md",
@@ -41,7 +42,6 @@
"typescript": "*"
},
"devDependencies": {
- "@typescript-eslint/shared-fixtures": "*",
- "typescript": "~3.2.1"
+ "@typescript-eslint/shared-fixtures": "1.3.0"
}
}
diff --git a/packages/typescript-estree/src/ast-converter.ts b/packages/typescript-estree/src/ast-converter.ts
index ce6f14b63f71..131539a981b8 100644
--- a/packages/typescript-estree/src/ast-converter.ts
+++ b/packages/typescript-estree/src/ast-converter.ts
@@ -5,17 +5,17 @@
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
-import convert, { getASTMaps, resetASTMaps, convertError } from './convert';
+import { convertError, Converter } from './convert';
import { convertComments } from './convert-comments';
import { convertTokens } from './node-utils';
import ts from 'typescript';
-import { Extra } from './temp-types-based-on-js-source';
+import { Extra } from './parser-options';
-export default (
+export default function astConverter(
ast: ts.SourceFile,
extra: Extra,
shouldProvideParserServices: boolean
-) => {
+) {
/**
* The TypeScript compiler produced fundamental parse errors when parsing the
* source.
@@ -27,17 +27,14 @@ export default (
/**
* Recursively convert the TypeScript AST into an ESTree-compatible AST
*/
- const estree: any = convert({
- node: ast,
- parent: null,
- ast,
- additionalOptions: {
- errorOnUnknownASTType: extra.errorOnUnknownASTType || false,
- useJSXTextNode: extra.useJSXTextNode || false,
- shouldProvideParserServices
- }
+ const instance = new Converter(ast, {
+ errorOnUnknownASTType: extra.errorOnUnknownASTType || false,
+ useJSXTextNode: extra.useJSXTextNode || false,
+ shouldProvideParserServices
});
+ const estree = instance.convertProgram();
+
/**
* Optionally convert and include all tokens in the AST
*/
@@ -52,11 +49,9 @@ export default (
estree.comments = convertComments(ast, extra.code);
}
- let astMaps = undefined;
- if (shouldProvideParserServices) {
- astMaps = getASTMaps();
- resetASTMaps();
- }
+ const astMaps = shouldProvideParserServices
+ ? instance.getASTMaps()
+ : undefined;
return { estree, astMaps };
-};
+}
diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts
index ac7f8504d8aa..1efff92648dc 100644
--- a/packages/typescript-estree/src/convert-comments.ts
+++ b/packages/typescript-estree/src/convert-comments.ts
@@ -7,31 +7,28 @@
import ts from 'typescript';
import { getLocFor, getNodeContainer } from './node-utils';
-import {
- ESTreeComment,
- LineAndColumnData
-} from './temp-types-based-on-js-source';
+import { TSESTree } from './ts-estree';
/**
* Converts a TypeScript comment to an Esprima comment.
- * @param {boolean} block True if it's a block comment, false if not.
- * @param {string} text The text of the comment.
- * @param {number} start The index at which the comment starts.
- * @param {number} end The index at which the comment ends.
- * @param {LineAndColumnData} startLoc The location at which the comment starts.
- * @param {LineAndColumnData} endLoc The location at which the comment ends.
- * @returns {Object} The comment object.
- * @private
+ * @param block True if it's a block comment, false if not.
+ * @param text The text of the comment.
+ * @param start The index at which the comment starts.
+ * @param end The index at which the comment ends.
+ * @param startLoc The location at which the comment starts.
+ * @param endLoc The location at which the comment ends.
+ * @returns The comment object.
+ * @internal
*/
function convertTypeScriptCommentToEsprimaComment(
block: boolean,
text: string,
start: number,
end: number,
- startLoc: LineAndColumnData,
- endLoc: LineAndColumnData
-): ESTreeComment {
- const comment: ESTreeComment = {
+ startLoc: TSESTree.LineAndColumnData,
+ endLoc: TSESTree.LineAndColumnData
+): TSESTree.Comment {
+ const comment: TSESTree.OptionalRangeAndLoc = {
type: block ? 'Block' : 'Line',
value: text
};
@@ -47,22 +44,22 @@ function convertTypeScriptCommentToEsprimaComment(
};
}
- return comment;
+ return comment as TSESTree.Comment;
}
/**
* Convert comment from TypeScript Triva Scanner.
- * @param {ts.Scanner} triviaScanner TS Scanner
- * @param {ts.SourceFile} ast the AST object
- * @param {string} code TypeScript code
- * @returns {ESTreeComment} the converted ESTreeComment
+ * @param triviaScanner TS Scanner
+ * @param ast the AST object
+ * @param code TypeScript code
+ * @returns the converted Comment
* @private
*/
function getCommentFromTriviaScanner(
triviaScanner: ts.Scanner,
ast: ts.SourceFile,
code: string
-): ESTreeComment {
+): TSESTree.Comment {
const kind = triviaScanner.getToken();
const isBlock = kind === ts.SyntaxKind.MultiLineCommentTrivia;
const range = {
@@ -77,7 +74,7 @@ function getCommentFromTriviaScanner(
: comment.replace(/^\/\//, '');
const loc = getLocFor(range.pos, range.end, ast);
- const esprimaComment = convertTypeScriptCommentToEsprimaComment(
+ return convertTypeScriptCommentToEsprimaComment(
isBlock,
text,
range.pos,
@@ -85,22 +82,20 @@ function getCommentFromTriviaScanner(
loc.start,
loc.end
);
-
- return esprimaComment;
}
/**
* Convert all comments for the given AST.
- * @param {ts.SourceFile} ast the AST object
- * @param {string} code the TypeScript code
- * @returns {ESTreeComment[]} the converted ESTreeComment
+ * @param ast the AST object
+ * @param code the TypeScript code
+ * @returns the converted ESTreeComment
* @private
*/
export function convertComments(
ast: ts.SourceFile,
code: string
-): ESTreeComment[] {
- const comments: ESTreeComment[] = [];
+): TSESTree.Comment[] {
+ const comments: TSESTree.Comment[] = [];
/**
* Create a TypeScript Scanner, with skipTrivia set to false so that
diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts
index f75547953df8..9f14bbcc2489 100644
--- a/packages/typescript-estree/src/convert.ts
+++ b/packages/typescript-estree/src/convert.ts
@@ -6,65 +6,42 @@
* MIT License
*/
import ts from 'typescript';
+import { TSESTree } from './ts-estree';
import {
canContainDirective,
createError,
- getLoc,
- getLocFor,
findNextToken,
- convertToken,
- hasModifier,
fixExports,
- getTSNodeAccessibility,
+ getBinaryExpressionType,
+ getDeclarationKind,
+ getLastModifier,
+ getLineAndCharacterFor,
+ getLocFor,
+ getRange,
getTextForTokenKind,
- isJSXToken,
+ getTSNodeAccessibility,
+ hasModifier,
+ isComma,
isComputedProperty,
isESTreeClassMember,
- isComma,
- getBinaryExpressionType,
isOptional,
- findFirstMatchingToken,
- unescapeStringLiteralText,
- getDeclarationKind,
- getLastModifier
+ unescapeStringLiteralText
} from './node-utils';
import { AST_NODE_TYPES } from './ast-node-types';
-import { ESTreeNode } from './temp-types-based-on-js-source';
import { TSNode } from './ts-nodes';
const SyntaxKind = ts.SyntaxKind;
-let esTreeNodeToTSNodeMap = new WeakMap();
-let tsNodeToESTreeNodeMap = new WeakMap();
-
-export function resetASTMaps() {
- esTreeNodeToTSNodeMap = new WeakMap();
- tsNodeToESTreeNodeMap = new WeakMap();
-}
-
-export function getASTMaps() {
- return { esTreeNodeToTSNodeMap, tsNodeToESTreeNodeMap };
-}
-
-interface ConvertAdditionalOptions {
+interface ConverterOptions {
errorOnUnknownASTType: boolean;
useJSXTextNode: boolean;
shouldProvideParserServices: boolean;
}
-interface ConvertConfig {
- node: ts.Node;
- parent?: ts.Node | null;
- inTypeMode?: boolean;
- allowPattern?: boolean;
- ast: ts.SourceFile;
- additionalOptions: ConvertAdditionalOptions;
-}
-
/**
* Extends and formats a given error object
- * @param {Object} error the error object
- * @returns {Object} converted error object
+ * @param error the error object
+ * @returns converted error object
*/
export function convertError(error: any) {
return createError(
@@ -74,121 +51,179 @@ export function convertError(error: any) {
);
}
-/**
- * Converts a TypeScript node into an ESTree node
- * @param {Object} config configuration options for the conversion
- * @param {TSNode} config.node the ts.Node
- * @param {ts.Node} config.parent the parent ts.Node
- * @param {ts.SourceFile} config.ast the full TypeScript AST
- * @param {Object} config.additionalOptions additional options for the conversion
- * @returns {ESTreeNode|null} the converted ESTreeNode
- */
-export default function convert(config: ConvertConfig): ESTreeNode | null {
- const node: TSNode = config.node as TSNode;
- const parent = config.parent;
- const ast = config.ast;
- const additionalOptions = config.additionalOptions || {};
+export class Converter {
+ private readonly ast: ts.SourceFile;
+ private options: ConverterOptions;
+ private esTreeNodeToTSNodeMap = new WeakMap();
+ private tsNodeToESTreeNodeMap = new WeakMap();
+
+ private allowPattern: boolean = false;
+ private inTypeMode: boolean = false;
/**
- * Exit early for null and undefined
+ * Converts a TypeScript node into an ESTree node
+ * @param ast the full TypeScript AST
+ * @param options additional options for the conversion
+ * @returns the converted ESTreeNode
*/
- if (!node) {
- return null;
+ constructor(ast: ts.SourceFile, options: ConverterOptions) {
+ this.ast = ast;
+ this.options = options;
+ }
+
+ getASTMaps() {
+ return {
+ esTreeNodeToTSNodeMap: this.esTreeNodeToTSNodeMap,
+ tsNodeToESTreeNodeMap: this.tsNodeToESTreeNodeMap
+ };
+ }
+
+ convertProgram(): TSESTree.Program {
+ return this.converter(this.ast) as TSESTree.Program;
}
/**
- * Create a new ESTree node
+ * Converts a TypeScript node into an ESTree node.
+ * @param node the child ts.Node
+ * @param parent parentNode
+ * @param inTypeMode flag to determine if we are in typeMode
+ * @param allowPattern flag to determine if patterns are allowed
+ * @returns the converted ESTree node
*/
- let result: ESTreeNode = {
- type: '' as AST_NODE_TYPES,
- range: [node.getStart(ast), node.end],
- loc: getLoc(node, ast)
- };
-
- function converter(
- child?: ts.Node,
+ private converter(
+ node?: ts.Node,
+ parent?: ts.Node,
inTypeMode?: boolean,
allowPattern?: boolean
- ): ESTreeNode | null {
- if (!child) {
+ ): any {
+ /**
+ * Exit early for null and undefined
+ */
+ if (!node) {
return null;
}
- return convert({
- node: child,
- parent: node,
- inTypeMode,
- allowPattern,
- ast,
- additionalOptions
- });
+
+ const typeMode = this.inTypeMode;
+ const pattern = this.allowPattern;
+ if (inTypeMode !== undefined) {
+ this.inTypeMode = inTypeMode;
+ }
+ if (allowPattern !== undefined) {
+ this.allowPattern = allowPattern;
+ }
+
+ let result: TSESTree.BaseNode | null = this.convertNode(
+ node as TSNode,
+ parent || node.parent
+ );
+
+ if (result && this.options.shouldProvideParserServices) {
+ this.tsNodeToESTreeNodeMap.set(node, result);
+ if (
+ node.kind !== SyntaxKind.ParenthesizedExpression &&
+ node.kind !== SyntaxKind.ComputedPropertyName
+ ) {
+ // Parenthesized expressions and computed property names do not have individual nodes in ESTree.
+ // Therefore, result.type will never "match" node.kind if it is a ParenthesizedExpression
+ // or a ComputedPropertyName and, furthermore, will overwrite the "matching" node
+ this.esTreeNodeToTSNodeMap.set(result, node);
+ }
+ }
+
+ this.inTypeMode = typeMode;
+ this.allowPattern = pattern;
+ return result;
}
/**
* Converts a TypeScript node into an ESTree node.
- * @param {ts.Node} child the child ts.Node
- * @returns {ESTreeNode|null} the converted ESTree node
+ * @param child the child ts.Node
+ * @param parent parentNode
+ * @returns the converted ESTree node
*/
- function convertPattern(child?: ts.Node): ESTreeNode | null {
- return converter(child, config.inTypeMode, true);
+ private convertPattern(child?: ts.Node, parent?: ts.Node): any | null {
+ return this.converter(child, parent, this.inTypeMode, true);
}
/**
* Converts a TypeScript node into an ESTree node.
- * @param {ts.Node} child the child ts.Node
- * @returns {ESTreeNode|null} the converted ESTree node
+ * @param child the child ts.Node
+ * @param parent parentNode
+ * @returns the converted ESTree node
*/
- function convertChild(child?: ts.Node): ESTreeNode | null {
- return converter(child, config.inTypeMode, false);
+ private convertChild(child?: ts.Node, parent?: ts.Node): any | null {
+ return this.converter(child, parent, this.inTypeMode, false);
}
/**
* Converts a TypeScript node into an ESTree node.
- * @param {ts.Node} child the child ts.Node
- * @returns {ESTreeNode|null} the converted ESTree node
+ * @param child the child ts.Node
+ * @param parent parentNode
+ * @returns the converted ESTree node
*/
- function convertChildType(child?: ts.Node): ESTreeNode | null {
- return converter(child, true, false);
+ private convertType(child?: ts.Node, parent?: ts.Node): any | null {
+ return this.converter(child, parent, true, false);
+ }
+
+ private createNode(
+ node: ts.Node,
+ data: TSESTree.OptionalRangeAndLoc
+ ): T {
+ const result = data;
+ if (!result.range) {
+ result.range = getRange(node, this.ast);
+ }
+ if (!result.loc) {
+ result.loc = getLocFor(result.range[0], result.range[1], this.ast);
+ }
+
+ return result as T;
}
/**
* Converts a child into a type annotation. This creates an intermediary
* TypeAnnotation node to match what Flow does.
- * @param {ts.TypeNode} child The TypeScript AST node to convert.
- * @returns {ESTreeNode} The type annotation node.
+ * @param child The TypeScript AST node to convert.
+ * @param parent parentNode
+ * @returns The type annotation node.
*/
- function convertTypeAnnotation(child: ts.TypeNode): ESTreeNode {
- const annotation = convertChildType(child);
+ private convertTypeAnnotation(
+ child: ts.TypeNode,
+ parent: ts.Node
+ ): TSESTree.TSTypeAnnotation {
// in FunctionType and ConstructorType typeAnnotation has 2 characters `=>` and in other places is just colon
const offset =
- node.kind === SyntaxKind.FunctionType ||
- node.kind === SyntaxKind.ConstructorType
+ parent.kind === SyntaxKind.FunctionType ||
+ parent.kind === SyntaxKind.ConstructorType
? 2
: 1;
const annotationStartCol = child.getFullStart() - offset;
- const loc = getLocFor(annotationStartCol, child.end, ast);
+ const loc = getLocFor(annotationStartCol, child.end, this.ast);
return {
type: AST_NODE_TYPES.TSTypeAnnotation,
loc,
range: [annotationStartCol, child.end],
- typeAnnotation: annotation
+ typeAnnotation: this.convertType(child)
};
}
/**
* Coverts body Nodes and add directive field to StringLiterals
- * @param {ts.NodeArray} nodes of ts.Node
- * @returns {ESTreeNode[]} Array of body statements
+ * @param nodes of ts.Node
+ * @param parent parentNode
+ * @returns Array of body statements
*/
- function convertBodyExpressions(
- nodes: ts.NodeArray
- ): ESTreeNode[] {
- let allowDirectives = canContainDirective(node);
+ private convertBodyExpressions(
+ nodes: ts.NodeArray,
+ parent: ts.Node
+ ): any[] {
+ let allowDirectives = canContainDirective(parent);
return (
nodes
.map(statement => {
- const child = convertChild(statement);
+ const child = this.convertChild(statement);
if (allowDirectives) {
if (
child &&
@@ -196,14 +231,14 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
ts.isExpressionStatement(statement) &&
ts.isStringLiteral(statement.expression)
) {
- const raw = child.expression.raw!;
+ const raw = child.expression.raw;
child.directive = raw.slice(1, -1);
- return child!; // child can be null but it's filtered below
+ return child; // child can be null but it's filtered below
} else {
allowDirectives = false;
}
}
- return child!; // child can be null but it's filtered below
+ return child; // child can be null but it's filtered below
})
// filter out unknown nodes for now
.filter(statement => statement)
@@ -211,84 +246,63 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
}
/**
- * Converts a ts.Node's typeArguments ts.NodeArray to a flow-like typeParameters node
- * @param {ts.NodeArray} typeArguments ts.Node typeArguments
- * @returns {ESTreeNode} TypeParameterInstantiation node
+ * Converts a ts.Node's typeArguments to TSTypeParameterInstantiation node
+ * @param typeArguments ts.Node typeArguments
+ * @returns TypeParameterInstantiation node
*/
- function convertTypeArgumentsToTypeParameters(
- typeArguments: ts.NodeArray
- ): ESTreeNode {
- /**
- * Even if typeArguments is an empty array, TypeScript sets a `pos` and `end`
- * property on the array object so we can safely read the values here
- */
- const start = typeArguments.pos - 1;
- let end = typeArguments.end + 1;
- if (typeArguments && typeArguments.length) {
- const firstTypeArgument = typeArguments[0];
- const typeArgumentsParent = firstTypeArgument.parent;
- /**
- * In the case of the parent being a CallExpression or a TypeReference we have to use
- * slightly different logic to calculate the correct end position
- */
- if (
- typeArgumentsParent &&
- (typeArgumentsParent.kind === SyntaxKind.CallExpression ||
- typeArgumentsParent.kind === SyntaxKind.TypeReference)
- ) {
- const lastTypeArgument = typeArguments[typeArguments.length - 1];
- const greaterThanToken = findNextToken(lastTypeArgument, ast, ast);
- end = greaterThanToken!.end;
- }
- }
+ private convertTypeArgumentsToTypeParameters(
+ typeArguments: ts.NodeArray
+ ): TSESTree.TSTypeParameterInstantiation {
+ const greaterThanToken = findNextToken(typeArguments, this.ast, this.ast)!;
+
return {
type: AST_NODE_TYPES.TSTypeParameterInstantiation,
- range: [start, end],
- loc: getLocFor(start, end, ast),
- params: typeArguments.map(typeArgument => convertChildType(typeArgument))
+ range: [typeArguments.pos - 1, greaterThanToken.end],
+ loc: getLocFor(typeArguments.pos - 1, greaterThanToken.end, this.ast),
+ params: typeArguments.map(typeArgument => this.convertType(typeArgument))
};
}
/**
- * Converts a ts.Node's typeParameters ts.ts.NodeArray to a flow-like TypeParameterDeclaration node
- * @param {ts.NodeArray} typeParameters ts.Node typeParameters
- * @returns {ESTreeNode} TypeParameterDeclaration node
+ * Converts a ts.Node's typeParameters to TSTypeParameterDeclaration node
+ * @param typeParameters ts.Node typeParameters
+ * @returns TypeParameterDeclaration node
*/
- function convertTSTypeParametersToTypeParametersDeclaration(
- typeParameters: ts.NodeArray
- ): ESTreeNode {
- const firstTypeParameter = typeParameters[0];
- const lastTypeParameter = typeParameters[typeParameters.length - 1];
-
- const greaterThanToken = findNextToken(lastTypeParameter, ast, ast);
+ private convertTSTypeParametersToTypeParametersDeclaration(
+ typeParameters: ts.NodeArray
+ ): TSESTree.TSTypeParameterDeclaration {
+ const greaterThanToken = findNextToken(typeParameters, this.ast, this.ast)!;
return {
type: AST_NODE_TYPES.TSTypeParameterDeclaration,
- range: [firstTypeParameter.pos - 1, greaterThanToken!.end],
- loc: getLocFor(firstTypeParameter.pos - 1, greaterThanToken!.end, ast),
+ range: [typeParameters.pos - 1, greaterThanToken.end],
+ loc: getLocFor(typeParameters.pos - 1, greaterThanToken.end, this.ast),
params: typeParameters.map(typeParameter =>
- convertChildType(typeParameter)
+ this.convertType(typeParameter)
)
};
}
/**
* Converts an array of ts.Node parameters into an array of ESTreeNode params
- * @param {ts.Node[]} parameters An array of ts.Node params to be converted
- * @returns {ESTreeNode[]} an array of converted ESTreeNode params
+ * @param parameters An array of ts.Node params to be converted
+ * @returns an array of converted ESTreeNode params
*/
- function convertParameters(parameters: ts.NodeArray): ESTreeNode[] {
+ private convertParameters(
+ parameters: ts.NodeArray
+ ): TSESTree.Parameter[] {
if (!parameters || !parameters.length) {
return [];
}
return parameters.map(param => {
- const convertedParam = convertChild(param)!;
- if (!param.decorators || !param.decorators.length) {
- return convertedParam;
+ const convertedParam = this.convertChild(param) as TSESTree.Parameter;
+
+ if (param.decorators && param.decorators.length) {
+ convertedParam.decorators = param.decorators.map(el =>
+ this.convertChild(el)
+ );
}
- return Object.assign(convertedParam, {
- decorators: param.decorators.map(convertChild)
- });
+ return convertedParam;
});
}
@@ -296,21 +310,20 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
* For nodes that are copied directly from the TypeScript AST into
* ESTree mostly as-is. The only difference is the addition of a type
* property instead of a kind property. Recursively copies all children.
- * @returns {void}
*/
- function deeplyCopy(): void {
+ private deeplyCopy(node: ts.Node): any {
const customType = `TS${SyntaxKind[node.kind]}` as AST_NODE_TYPES;
/**
* If the "errorOnUnknownASTType" option is set to true, throw an error,
* otherwise fallback to just including the unknown type as-is.
*/
- if (
- additionalOptions.errorOnUnknownASTType &&
- !AST_NODE_TYPES[customType]
- ) {
+ if (this.options.errorOnUnknownASTType && !AST_NODE_TYPES[customType]) {
throw new Error(`Unknown AST_NODE_TYPE: "${customType}"`);
}
- result.type = customType;
+ const result = this.createNode(node, {
+ type: customType
+ });
+
Object.keys(node)
.filter(
key =>
@@ -321,83 +334,102 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
.forEach(key => {
if (key === 'type') {
result.typeAnnotation = (node as any).type
- ? convertTypeAnnotation((node as any).type)
+ ? this.convertTypeAnnotation((node as any).type, node)
: null;
} else if (key === 'typeArguments') {
result.typeParameters = (node as any).typeArguments
- ? convertTypeArgumentsToTypeParameters((node as any).typeArguments)
+ ? this.convertTypeArgumentsToTypeParameters(
+ (node as any).typeArguments
+ )
: null;
} else if (key === 'typeParameters') {
result.typeParameters = (node as any).typeParameters
- ? convertTSTypeParametersToTypeParametersDeclaration(
+ ? this.convertTSTypeParametersToTypeParametersDeclaration(
(node as any).typeParameters
)
: null;
} else if (key === 'decorators') {
if (node.decorators && node.decorators.length) {
- result.decorators = node.decorators.map(convertChild);
+ result.decorators = node.decorators.map((el: any) =>
+ this.convertChild(el)
+ );
}
} else {
if (Array.isArray((node as any)[key])) {
- (result as any)[key] = (node as any)[key].map(convertChild);
+ result[key] = (node as any)[key].map((el: any) =>
+ this.convertChild(el)
+ );
} else if (
(node as any)[key] &&
typeof (node as any)[key] === 'object' &&
(node as any)[key].kind
) {
// need to check node[key].kind to ensure we don't try to convert a symbol
- (result as any)[key] = convertChild((node as any)[key]);
+ result[key] = this.convertChild((node as any)[key]);
} else {
- (result as any)[key] = (node as any)[key];
+ result[key] = (node as any)[key];
}
}
});
+ return result;
}
/**
* Converts a TypeScript JSX node.tagName into an ESTree node.name
- * @param {ts.JsxTagNameExpression} tagName the tagName object from a JSX ts.Node
- * @returns {Object} the converted ESTree name object
+ * @param node the tagName object from a JSX ts.Node
+ * @param parent
+ * @returns the converted ESTree name object
*/
- function convertTypeScriptJSXTagNameToESTreeName(
- tagName: ts.JsxTagNameExpression
- ): ESTreeNode {
- const tagNameToken = convertToken(tagName, ast);
-
- if (tagNameToken.type === AST_NODE_TYPES.JSXMemberExpression) {
- const isNestedMemberExpression =
- (node as any).tagName.expression.kind ===
- SyntaxKind.PropertyAccessExpression;
-
- // Convert TSNode left and right objects into ESTreeNode object
- // and property objects
- tagNameToken.object = convertChild((node as any).tagName.expression);
- tagNameToken.property = convertChild((node as any).tagName.name);
-
- // Assign the appropriate types
- tagNameToken.object.type = isNestedMemberExpression
- ? AST_NODE_TYPES.JSXMemberExpression
- : AST_NODE_TYPES.JSXIdentifier;
- tagNameToken.property.type = AST_NODE_TYPES.JSXIdentifier;
- if ((tagName as any).expression.kind === SyntaxKind.ThisKeyword) {
- tagNameToken.object.name = 'this';
- }
- } else {
- tagNameToken.type = AST_NODE_TYPES.JSXIdentifier;
- tagNameToken.name = tagNameToken.value;
+ private convertJSXTagName(
+ node: ts.JsxTagNameExpression,
+ parent: ts.Node
+ ): TSESTree.JSXMemberExpression | TSESTree.JSXIdentifier {
+ let result: TSESTree.JSXMemberExpression | TSESTree.JSXIdentifier;
+ switch (node.kind) {
+ case SyntaxKind.PropertyAccessExpression:
+ result = this.createNode(node, {
+ type: AST_NODE_TYPES.JSXMemberExpression,
+ object: this.convertJSXTagName(node.expression, parent),
+ property: this.convertJSXTagName(
+ node.name,
+ parent
+ ) as TSESTree.JSXIdentifier
+ });
+ break;
+ case SyntaxKind.ThisKeyword:
+ result = this.createNode(node, {
+ type: AST_NODE_TYPES.JSXIdentifier,
+ name: 'this'
+ });
+ break;
+ case SyntaxKind.Identifier:
+ default:
+ result = this.createNode(node, {
+ type: AST_NODE_TYPES.JSXIdentifier,
+ name: node.text
+ });
+ break;
}
- delete tagNameToken.value;
+ if (result && this.options.shouldProvideParserServices) {
+ this.tsNodeToESTreeNodeMap.set(node, result);
+ this.esTreeNodeToTSNodeMap.set(result, node);
+ }
- return tagNameToken;
+ return result;
}
/**
* Applies the given TS modifiers to the given result object.
- * @param {ts.ModifiersArray} modifiers original ts.Nodes from the node.modifiers array
- * @returns {void} (the current result object will be mutated)
+ * @param result
+ * @param modifiers original ts.Nodes from the node.modifiers array
+ * @returns the current result object will be mutated
+ * @deprecated This method adds not standardized `modifiers` property in nodes
*/
- function applyModifiersToResult(modifiers?: ts.ModifiersArray): void {
+ private applyModifiersToResult(
+ result: TSESTree.TSEnumDeclaration | TSESTree.TSModuleDeclaration,
+ modifiers?: ts.ModifiersArray
+ ): void {
if (!modifiers || !modifiers.length) {
return;
}
@@ -420,7 +452,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
handledModifierIndices[i] = true;
break;
case SyntaxKind.ConstKeyword:
- result.const = true;
+ (result as any).const = true;
handledModifierIndices[i] = true;
break;
case SyntaxKind.DeclareKeyword:
@@ -441,2168 +473,2014 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
if (!remainingModifiers || !remainingModifiers.length) {
return;
}
- result.modifiers = remainingModifiers.map(convertChild);
+ result.modifiers = remainingModifiers.map(el => this.convertChild(el));
}
/**
- * Uses the current TSNode's end location for its `type` to adjust the location data of the given
- * ESTreeNode, which should be the parent of the final typeAnnotation node
- * @param {ESTreeNode} typeAnnotationParent The node that will have its location data mutated
- * @returns {void}
+ * Uses the provided range location to adjust the location data of the given Node
+ * @param result The node that will have its location data mutated
+ * @param childRange The child node range used to expand location
*/
- function fixTypeAnnotationParentLocation(
- typeAnnotationParent: ESTreeNode
+ private fixParentLocation(
+ result: TSESTree.BaseNode,
+ childRange: [number, number]
): void {
- typeAnnotationParent.range[1] = (node as any).type.getEnd();
- typeAnnotationParent.loc = getLocFor(
- typeAnnotationParent.range[0],
- typeAnnotationParent.range[1],
- ast
- );
+ if (childRange[0] < result.range[0]) {
+ result.range[0] = childRange[0];
+ result.loc.start = getLineAndCharacterFor(result.range[0], this.ast);
+ }
+ if (childRange[1] > result.range[1]) {
+ result.range[1] = childRange[1];
+ result.loc.end = getLineAndCharacterFor(result.range[1], this.ast);
+ }
}
/**
+ * Converts a TypeScript node into an ESTree node.
* The core of the conversion logic:
* Identify and convert each relevant TypeScript SyntaxKind
+ * @param node the child ts.Node
+ * @param parent parentNode
+ * @returns the converted ESTree node
*/
- switch (node.kind) {
- case SyntaxKind.SourceFile:
- Object.assign(result, {
- type: AST_NODE_TYPES.Program,
- body: convertBodyExpressions(node.statements),
- // externalModuleIndicator is internal field in TSC
- sourceType: (node as any).externalModuleIndicator ? 'module' : 'script'
- });
-
- result.range[1] = node.endOfFileToken.end;
- result.loc = getLocFor(node.getStart(ast), result.range[1], ast);
- break;
-
- case SyntaxKind.Block:
- Object.assign(result, {
- type: AST_NODE_TYPES.BlockStatement,
- body: convertBodyExpressions(node.statements)
- });
- break;
-
- case SyntaxKind.Identifier:
- Object.assign(result, {
- type: AST_NODE_TYPES.Identifier,
- name: node.text
- });
- break;
-
- case SyntaxKind.WithStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.WithStatement,
- object: convertChild(node.expression),
- body: convertChild(node.statement)
- });
- break;
-
- // Control Flow
-
- case SyntaxKind.ReturnStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.ReturnStatement,
- argument: convertChild(node.expression)
- });
- break;
+ private convertNode(node: TSNode, parent: ts.Node): TSESTree.Node | null {
+ switch (node.kind) {
+ case SyntaxKind.SourceFile: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Program,
+ body: this.convertBodyExpressions(node.statements, node),
+ // externalModuleIndicator is internal field in TSC
+ sourceType: (node as any).externalModuleIndicator
+ ? 'module'
+ : 'script',
+ range: [node.getStart(this.ast), node.endOfFileToken.end]
+ });
+ }
- case SyntaxKind.LabeledStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.LabeledStatement,
- label: convertChild(node.label),
- body: convertChild(node.statement)
- });
- break;
+ case SyntaxKind.Block: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.BlockStatement,
+ body: this.convertBodyExpressions(node.statements, node)
+ });
+ }
- case SyntaxKind.BreakStatement:
- case SyntaxKind.ContinueStatement:
- Object.assign(result, {
- type: SyntaxKind[node.kind],
- label: convertChild(node.label)
- });
- break;
+ case SyntaxKind.Identifier: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Identifier,
+ name: node.text
+ });
+ }
- // Choice
+ case SyntaxKind.WithStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.WithStatement,
+ object: this.convertChild(node.expression),
+ body: this.convertChild(node.statement)
+ });
- case SyntaxKind.IfStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.IfStatement,
- test: convertChild(node.expression),
- consequent: convertChild(node.thenStatement),
- alternate: convertChild(node.elseStatement)
- });
- break;
+ // Control Flow
- case SyntaxKind.SwitchStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.SwitchStatement,
- discriminant: convertChild(node.expression),
- cases: node.caseBlock.clauses.map(convertChild)
- });
- break;
-
- case SyntaxKind.CaseClause:
- case SyntaxKind.DefaultClause:
- Object.assign(result, {
- type: AST_NODE_TYPES.SwitchCase,
- // expression is present in case only
- test:
- node.kind === SyntaxKind.CaseClause
- ? convertChild(node.expression)
- : null,
- consequent: node.statements.map(convertChild)
- });
- break;
+ case SyntaxKind.ReturnStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ReturnStatement,
+ argument: this.convertChild(node.expression)
+ });
- // Exceptions
+ case SyntaxKind.LabeledStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.LabeledStatement,
+ label: this.convertChild(node.label),
+ body: this.convertChild(node.statement)
+ });
- case SyntaxKind.ThrowStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.ThrowStatement,
- argument: convertChild(node.expression)
- });
- break;
-
- case SyntaxKind.TryStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.TryStatement,
- block: convert({
- node: node.tryBlock,
- parent: null,
- ast,
- additionalOptions
- }),
- handler: convertChild(node.catchClause),
- finalizer: convertChild(node.finallyBlock)
- });
- break;
-
- case SyntaxKind.CatchClause:
- Object.assign(result, {
- type: AST_NODE_TYPES.CatchClause,
- param: node.variableDeclaration
- ? convertChild(node.variableDeclaration.name)
- : null,
- body: convertChild(node.block)
- });
- break;
+ case SyntaxKind.ContinueStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ContinueStatement,
+ label: this.convertChild(node.label)
+ });
- // Loops
+ case SyntaxKind.BreakStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.BreakStatement,
+ label: this.convertChild(node.label)
+ });
- case SyntaxKind.WhileStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.WhileStatement,
- test: convertChild(node.expression),
- body: convertChild(node.statement)
- });
- break;
+ // Choice
- /**
- * Unlike other parsers, TypeScript calls a "DoWhileStatement"
- * a "DoStatement"
- */
- case SyntaxKind.DoStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.DoWhileStatement,
- test: convertChild(node.expression),
- body: convertChild(node.statement)
- });
- break;
-
- case SyntaxKind.ForStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.ForStatement,
- init: convertChild(node.initializer),
- test: convertChild(node.condition),
- update: convertChild(node.incrementor),
- body: convertChild(node.statement)
- });
- break;
-
- case SyntaxKind.ForInStatement:
- case SyntaxKind.ForOfStatement: {
- Object.assign(result, {
- type: SyntaxKind[node.kind],
- left: convertPattern(node.initializer),
- right: convertChild(node.expression),
- body: convertChild(node.statement)
- });
+ case SyntaxKind.IfStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.IfStatement,
+ test: this.convertChild(node.expression),
+ consequent: this.convertChild(node.thenStatement),
+ alternate: this.convertChild(node.elseStatement)
+ });
- // await is only available in for of statement
- if (node.kind === SyntaxKind.ForOfStatement) {
- (result as any).await = Boolean(
- node.awaitModifier &&
- node.awaitModifier.kind === SyntaxKind.AwaitKeyword
- );
- }
- break;
- }
+ case SyntaxKind.SwitchStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.SwitchStatement,
+ discriminant: this.convertChild(node.expression),
+ cases: node.caseBlock.clauses.map(el => this.convertChild(el))
+ });
- // Declarations
+ case SyntaxKind.CaseClause:
+ case SyntaxKind.DefaultClause:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.SwitchCase,
+ // expression is present in case only
+ test:
+ node.kind === SyntaxKind.CaseClause
+ ? this.convertChild(node.expression)
+ : null,
+ consequent: node.statements.map(el => this.convertChild(el))
+ });
- case SyntaxKind.FunctionDeclaration: {
- const isDeclare = hasModifier(SyntaxKind.DeclareKeyword, node);
- let functionDeclarationType = AST_NODE_TYPES.FunctionDeclaration;
- if (isDeclare || !node.body) {
- functionDeclarationType = AST_NODE_TYPES.TSDeclareFunction;
- }
+ // Exceptions
- Object.assign(result, {
- type: functionDeclarationType,
- id: convertChild(node.name),
- generator: !!node.asteriskToken,
- expression: false,
- async: hasModifier(SyntaxKind.AsyncKeyword, node),
- params: convertParameters(node.parameters),
- body: convertChild(node.body) || undefined
- });
+ case SyntaxKind.ThrowStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ThrowStatement,
+ argument: this.convertChild(node.expression)
+ });
- // Process returnType
- if (node.type) {
- result.returnType = convertTypeAnnotation(node.type);
- }
+ case SyntaxKind.TryStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TryStatement,
+ block: this.convertChild(node.tryBlock),
+ handler: this.convertChild(node.catchClause),
+ finalizer: this.convertChild(node.finallyBlock)
+ });
- if (isDeclare) {
- result.declare = true;
- }
+ case SyntaxKind.CatchClause:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.CatchClause,
+ param: node.variableDeclaration
+ ? this.convertChild(node.variableDeclaration.name)
+ : null,
+ body: this.convertChild(node.block)
+ });
- // Process typeParameters
- if (node.typeParameters && node.typeParameters.length) {
- result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters
- );
- }
+ // Loops
- // check for exports
- result = fixExports(node, result, ast);
+ case SyntaxKind.WhileStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.WhileStatement,
+ test: this.convertChild(node.expression),
+ body: this.convertChild(node.statement)
+ });
- break;
- }
+ /**
+ * Unlike other parsers, TypeScript calls a "DoWhileStatement"
+ * a "DoStatement"
+ */
+ case SyntaxKind.DoStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.DoWhileStatement,
+ test: this.convertChild(node.expression),
+ body: this.convertChild(node.statement)
+ });
- case SyntaxKind.VariableDeclaration: {
- Object.assign(result, {
- type: AST_NODE_TYPES.VariableDeclarator,
- id: convertPattern(node.name),
- init: convertChild(node.initializer)
- });
+ case SyntaxKind.ForStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ForStatement,
+ init: this.convertChild(node.initializer),
+ test: this.convertChild(node.condition),
+ update: this.convertChild(node.incrementor),
+ body: this.convertChild(node.statement)
+ });
- if (node.exclamationToken) {
- (result as any).definite = true;
- }
+ case SyntaxKind.ForInStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ForInStatement,
+ left: this.convertPattern(node.initializer),
+ right: this.convertChild(node.expression),
+ body: this.convertChild(node.statement)
+ });
- if (node.type) {
- (result as any).id.typeAnnotation = convertTypeAnnotation(node.type);
- fixTypeAnnotationParentLocation((result as any).id);
- }
- break;
- }
+ case SyntaxKind.ForOfStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ForOfStatement,
+ left: this.convertPattern(node.initializer),
+ right: this.convertChild(node.expression),
+ body: this.convertChild(node.statement),
+ await: Boolean(
+ node.awaitModifier &&
+ node.awaitModifier.kind === SyntaxKind.AwaitKeyword
+ )
+ });
- case SyntaxKind.VariableStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.VariableDeclaration,
- declarations: node.declarationList.declarations.map(convertChild),
- kind: getDeclarationKind(node.declarationList)
- });
+ // Declarations
- if (hasModifier(SyntaxKind.DeclareKeyword, node)) {
- result.declare = true;
- }
+ case SyntaxKind.FunctionDeclaration: {
+ const isDeclare = hasModifier(SyntaxKind.DeclareKeyword, node);
- // check for exports
- result = fixExports(node, result, ast);
- break;
+ const result = this.createNode<
+ TSESTree.TSDeclareFunction | TSESTree.FunctionDeclaration
+ >(node, {
+ type:
+ isDeclare || !node.body
+ ? AST_NODE_TYPES.TSDeclareFunction
+ : AST_NODE_TYPES.FunctionDeclaration,
+ id: this.convertChild(node.name),
+ generator: !!node.asteriskToken,
+ expression: false,
+ async: hasModifier(SyntaxKind.AsyncKeyword, node),
+ params: this.convertParameters(node.parameters),
+ body: this.convertChild(node.body) || undefined
+ });
- // mostly for for-of, for-in
- case SyntaxKind.VariableDeclarationList:
- Object.assign(result, {
- type: AST_NODE_TYPES.VariableDeclaration,
- declarations: node.declarations.map(convertChild),
- kind: getDeclarationKind(node)
- });
- break;
+ // Process returnType
+ if (node.type) {
+ result.returnType = this.convertTypeAnnotation(node.type, node);
+ }
- // Expressions
+ if (isDeclare) {
+ result.declare = true;
+ }
- case SyntaxKind.ExpressionStatement:
- Object.assign(result, {
- type: AST_NODE_TYPES.ExpressionStatement,
- expression: convertChild(node.expression)
- });
- break;
+ // Process typeParameters
+ if (node.typeParameters) {
+ result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters
+ );
+ }
- case SyntaxKind.ThisKeyword:
- Object.assign(result, {
- type: AST_NODE_TYPES.ThisExpression
- });
- break;
+ /**
+ * Semantically, decorators are not allowed on function declarations,
+ * but the TypeScript compiler will parse them and produce a valid AST,
+ * so we handle them here too.
+ */
+ if (node.decorators) {
+ (result as any).decorators = node.decorators.map(el =>
+ this.convertChild(el)
+ );
+ }
- case SyntaxKind.ArrayLiteralExpression: {
- // TypeScript uses ArrayLiteralExpression in destructuring assignment, too
- if (config.allowPattern) {
- Object.assign(result, {
- type: AST_NODE_TYPES.ArrayPattern,
- elements: node.elements.map(convertPattern)
- });
- } else {
- Object.assign(result, {
- type: AST_NODE_TYPES.ArrayExpression,
- elements: node.elements.map(convertChild)
- });
+ // check for exports
+ return fixExports(node, result, this.ast);
}
- break;
- }
- case SyntaxKind.ObjectLiteralExpression: {
- // TypeScript uses ObjectLiteralExpression in destructuring assignment, too
- if (config.allowPattern) {
- Object.assign(result, {
- type: AST_NODE_TYPES.ObjectPattern,
- properties: node.properties.map(convertPattern)
+ case SyntaxKind.VariableDeclaration: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.VariableDeclarator,
+ id: this.convertPattern(node.name),
+ init: this.convertChild(node.initializer)
});
- } else {
- Object.assign(result, {
- type: AST_NODE_TYPES.ObjectExpression,
- properties: node.properties.map(convertChild)
- });
- }
- break;
- }
- case SyntaxKind.PropertyAssignment:
- Object.assign(result, {
- type: AST_NODE_TYPES.Property,
- key: convertChild(node.name),
- value: converter(
- node.initializer,
- config.inTypeMode,
- config.allowPattern
- ),
- computed: isComputedProperty(node.name),
- method: false,
- shorthand: false,
- kind: 'init'
- });
- break;
+ if (node.exclamationToken) {
+ result.definite = true;
+ }
- case SyntaxKind.ShorthandPropertyAssignment: {
- if (node.objectAssignmentInitializer) {
- Object.assign(result, {
- type: AST_NODE_TYPES.Property,
- key: convertChild(node.name),
- value: {
- type: AST_NODE_TYPES.AssignmentPattern,
- left: convertPattern(node.name),
- right: convertChild(node.objectAssignmentInitializer),
- loc: result.loc,
- range: result.range
- },
- computed: false,
- method: false,
- shorthand: true,
- kind: 'init'
- });
- } else {
- // TODO: this node has no initializer field
- Object.assign(result, {
- type: AST_NODE_TYPES.Property,
- key: convertChild(node.name),
- value: convertChild((node as any).initializer || node.name),
- computed: false,
- method: false,
- shorthand: true,
- kind: 'init'
- });
+ if (node.type) {
+ result.id.typeAnnotation = this.convertTypeAnnotation(
+ node.type,
+ node
+ );
+ this.fixParentLocation(result.id, result.id.typeAnnotation.range);
+ }
+ return result;
}
- break;
- }
- case SyntaxKind.ComputedPropertyName:
- if (parent!.kind === SyntaxKind.ObjectLiteralExpression) {
- // TODO: ComputedPropertyName has no name field
- Object.assign(result, {
- type: AST_NODE_TYPES.Property,
- key: convertChild((node as any).name),
- value: convertChild((node as any).name),
- computed: false,
- method: false,
- shorthand: true,
- kind: 'init'
+ case SyntaxKind.VariableStatement: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.VariableDeclaration,
+ declarations: node.declarationList.declarations.map(el =>
+ this.convertChild(el)
+ ),
+ kind: getDeclarationKind(node.declarationList)
});
- } else {
- return convertChild(node.expression);
- }
- break;
-
- case SyntaxKind.PropertyDeclaration: {
- const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node);
- Object.assign(result, {
- type: isAbstract
- ? AST_NODE_TYPES.TSAbstractClassProperty
- : AST_NODE_TYPES.ClassProperty,
- key: convertChild(node.name),
- value: convertChild(node.initializer),
- computed: isComputedProperty(node.name),
- static: hasModifier(SyntaxKind.StaticKeyword, node),
- readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined
- });
- if (node.type) {
- result.typeAnnotation = convertTypeAnnotation(node.type);
- }
+ /**
+ * Semantically, decorators are not allowed on variable declarations,
+ * but the TypeScript compiler will parse them and produce a valid AST,
+ * so we handle them here too.
+ */
+ if (node.decorators) {
+ (result as any).decorators = node.decorators.map(el =>
+ this.convertChild(el)
+ );
+ }
- if (node.decorators) {
- result.decorators = node.decorators.map(convertChild);
- }
+ if (hasModifier(SyntaxKind.DeclareKeyword, node)) {
+ result.declare = true;
+ }
- const accessibility = getTSNodeAccessibility(node);
- if (accessibility) {
- result.accessibility = accessibility;
+ // check for exports
+ return fixExports(node, result, this.ast);
}
- if (node.name.kind === SyntaxKind.Identifier && node.questionToken) {
- result.optional = true;
- }
+ // mostly for for-of, for-in
+ case SyntaxKind.VariableDeclarationList:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.VariableDeclaration,
+ declarations: node.declarations.map(el => this.convertChild(el)),
+ kind: getDeclarationKind(node)
+ });
- if (node.exclamationToken) {
- (result as any).definite = true;
- }
+ // Expressions
- if (
- (result as any).key.type === AST_NODE_TYPES.Literal &&
- node.questionToken
- ) {
- result.optional = true;
- }
- break;
- }
+ case SyntaxKind.ExpressionStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ExpressionStatement,
+ expression: this.convertChild(node.expression)
+ });
- case SyntaxKind.GetAccessor:
- case SyntaxKind.SetAccessor:
- case SyntaxKind.MethodDeclaration: {
- const openingParen = findFirstMatchingToken(
- node.name,
- ast,
- (token: any) => {
- if (!token || !token.kind) {
- return false;
- }
- return getTextForTokenKind(token.kind) === '(';
- },
- ast
- );
-
- const methodLoc = ast.getLineAndCharacterOfPosition(
- (openingParen as any).getStart(ast)
- ),
- nodeIsMethod = node.kind === SyntaxKind.MethodDeclaration,
- method: ESTreeNode = {
- type: AST_NODE_TYPES.FunctionExpression,
- id: null,
- generator: !!node.asteriskToken,
- expression: false, // ESTreeNode as ESTreeNode here
- async: hasModifier(SyntaxKind.AsyncKeyword, node),
- body: convertChild(node.body),
- range: [node.parameters.pos - 1, result.range[1]],
- loc: {
- start: {
- line: methodLoc.line + 1,
- column: methodLoc.character
- },
- end: result.loc.end
- }
- } as any;
+ case SyntaxKind.ThisKeyword:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ThisExpression
+ });
- if (node.type) {
- (method as any).returnType = convertTypeAnnotation(node.type);
+ case SyntaxKind.ArrayLiteralExpression: {
+ // TypeScript uses ArrayLiteralExpression in destructuring assignment, too
+ if (this.allowPattern) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ArrayPattern,
+ elements: node.elements.map(el => this.convertPattern(el))
+ });
+ } else {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ArrayExpression,
+ elements: node.elements.map(el => this.convertChild(el))
+ });
+ }
}
- if (parent!.kind === SyntaxKind.ObjectLiteralExpression) {
- (method as any).params = node.parameters.map(convertChild);
+ case SyntaxKind.ObjectLiteralExpression: {
+ // TypeScript uses ObjectLiteralExpression in destructuring assignment, too
+ if (this.allowPattern) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ObjectPattern,
+ properties: node.properties.map(el => this.convertPattern(el))
+ });
+ } else {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ObjectExpression,
+ properties: node.properties.map(el => this.convertChild(el))
+ });
+ }
+ }
- Object.assign(result, {
+ case SyntaxKind.PropertyAssignment:
+ return this.createNode(node, {
type: AST_NODE_TYPES.Property,
- key: convertChild(node.name),
- value: method,
+ key: this.convertChild(node.name),
+ value: this.converter(
+ node.initializer,
+ node,
+ this.inTypeMode,
+ this.allowPattern
+ ),
computed: isComputedProperty(node.name),
- method: nodeIsMethod,
+ method: false,
shorthand: false,
kind: 'init'
});
- } else {
- // class
- /**
- * Unlike in object literal methods, class method params can have decorators
- */
- (method as any).params = convertParameters(node.parameters);
+ case SyntaxKind.ShorthandPropertyAssignment: {
+ if (node.objectAssignmentInitializer) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Property,
+ key: this.convertChild(node.name),
+ value: this.createNode(node, {
+ type: AST_NODE_TYPES.AssignmentPattern,
+ left: this.convertPattern(node.name),
+ right: this.convertChild(node.objectAssignmentInitializer)
+ }),
+ computed: false,
+ method: false,
+ shorthand: true,
+ kind: 'init'
+ });
+ } else {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Property,
+ key: this.convertChild(node.name),
+ value: this.convertChild(node.name),
+ computed: false,
+ method: false,
+ shorthand: true,
+ kind: 'init'
+ });
+ }
+ }
- /**
- * TypeScript class methods can be defined as "abstract"
- */
- const methodDefinitionType = hasModifier(
- SyntaxKind.AbstractKeyword,
- node
- )
- ? AST_NODE_TYPES.TSAbstractMethodDefinition
- : AST_NODE_TYPES.MethodDefinition;
-
- Object.assign(result, {
- type: methodDefinitionType,
- key: convertChild(node.name),
- value: method,
+ case SyntaxKind.ComputedPropertyName:
+ return this.convertChild(node.expression);
+
+ case SyntaxKind.PropertyDeclaration: {
+ const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node);
+ const result = this.createNode<
+ TSESTree.TSAbstractClassProperty | TSESTree.ClassProperty
+ >(node, {
+ type: isAbstract
+ ? AST_NODE_TYPES.TSAbstractClassProperty
+ : AST_NODE_TYPES.ClassProperty,
+ key: this.convertChild(node.name),
+ value: this.convertChild(node.initializer),
computed: isComputedProperty(node.name),
static: hasModifier(SyntaxKind.StaticKeyword, node),
- kind: 'method'
+ readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined
});
+ if (node.type) {
+ result.typeAnnotation = this.convertTypeAnnotation(node.type, node);
+ }
+
if (node.decorators) {
- result.decorators = node.decorators.map(convertChild);
+ result.decorators = node.decorators.map(el => this.convertChild(el));
}
const accessibility = getTSNodeAccessibility(node);
if (accessibility) {
result.accessibility = accessibility;
}
- }
- if (
- (result as any).key.type === AST_NODE_TYPES.Identifier &&
- node.questionToken
- ) {
- (result as any).key.optional = true;
- }
-
- if (node.kind === SyntaxKind.GetAccessor) {
- (result as any).kind = 'get';
- } else if (node.kind === SyntaxKind.SetAccessor) {
- (result as any).kind = 'set';
- } else if (
- !(result as any).static &&
- node.name.kind === SyntaxKind.StringLiteral &&
- node.name.text === 'constructor' &&
- result.type !== AST_NODE_TYPES.Property
- ) {
- (result as any).kind = 'constructor';
+ if (node.name.kind === SyntaxKind.Identifier && node.questionToken) {
+ result.optional = true;
+ }
+
+ if (node.exclamationToken) {
+ result.definite = true;
+ }
+
+ if (result.key.type === AST_NODE_TYPES.Literal && node.questionToken) {
+ result.optional = true;
+ }
+ return result;
}
- // Process typeParameters
- if (node.typeParameters && node.typeParameters.length) {
- if (result.type !== AST_NODE_TYPES.Property) {
- method.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters
- );
- } else {
- result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
+ case SyntaxKind.GetAccessor:
+ case SyntaxKind.SetAccessor:
+ case SyntaxKind.MethodDeclaration: {
+ const method = this.createNode(node, {
+ type: AST_NODE_TYPES.FunctionExpression,
+ id: null,
+ generator: !!node.asteriskToken,
+ expression: false, // ESTreeNode as ESTreeNode here
+ async: hasModifier(SyntaxKind.AsyncKeyword, node),
+ body: this.convertChild(node.body),
+ range: [node.parameters.pos - 1, node.end],
+ params: []
+ });
+
+ if (node.type) {
+ method.returnType = this.convertTypeAnnotation(node.type, node);
+ }
+
+ // Process typeParameters
+ if (node.typeParameters) {
+ method.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
node.typeParameters
);
+ this.fixParentLocation(method, method.typeParameters.range);
}
- }
-
- break;
- }
- // TypeScript uses this even for static methods named "constructor"
- case SyntaxKind.Constructor: {
- const lastModifier = getLastModifier(node);
- const constructorToken =
- (lastModifier && findNextToken(lastModifier, node, ast)) ||
- node.getFirstToken()!;
-
- const constructorTokenRange = [
- constructorToken.getStart(ast),
- constructorToken.end
- ];
-
- const constructorLoc = ast.getLineAndCharacterOfPosition(
- node.parameters.pos - 1
- );
-
- const constructor: ESTreeNode = {
- type: AST_NODE_TYPES.FunctionExpression,
- id: null,
- params: convertParameters(node.parameters),
- generator: false,
- expression: false, // is not present in ESTreeNode
- async: false,
- body: convertChild(node.body),
- range: [node.parameters.pos - 1, result.range[1]],
- loc: {
- start: {
- line: constructorLoc.line + 1,
- column: constructorLoc.character
- },
- end: result.loc.end
- }
- } as any;
+ let result:
+ | TSESTree.Property
+ | TSESTree.TSAbstractMethodDefinition
+ | TSESTree.MethodDefinition;
- // Process typeParameters
- if (node.typeParameters && node.typeParameters.length) {
- constructor.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters
- );
- }
+ if (parent.kind === SyntaxKind.ObjectLiteralExpression) {
+ method.params = node.parameters.map(el => this.convertChild(el));
- // Process returnType
- if (node.type) {
- constructor.returnType = convertTypeAnnotation(node.type);
- }
+ result = this.createNode(node, {
+ type: AST_NODE_TYPES.Property,
+ key: this.convertChild(node.name),
+ value: method,
+ computed: isComputedProperty(node.name),
+ method: node.kind === SyntaxKind.MethodDeclaration,
+ shorthand: false,
+ kind: 'init'
+ });
+ } else {
+ // class
+
+ /**
+ * Unlike in object literal methods, class method params can have decorators
+ */
+ method.params = this.convertParameters(node.parameters);
+
+ /**
+ * TypeScript class methods can be defined as "abstract"
+ */
+ const methodDefinitionType = hasModifier(
+ SyntaxKind.AbstractKeyword,
+ node
+ )
+ ? AST_NODE_TYPES.TSAbstractMethodDefinition
+ : AST_NODE_TYPES.MethodDefinition;
+
+ result = this.createNode<
+ TSESTree.TSAbstractMethodDefinition | TSESTree.MethodDefinition
+ >(node, {
+ type: methodDefinitionType,
+ key: this.convertChild(node.name),
+ value: method,
+ computed: isComputedProperty(node.name),
+ static: hasModifier(SyntaxKind.StaticKeyword, node),
+ kind: 'method'
+ });
- const constructorKey = {
- type: AST_NODE_TYPES.Identifier,
- name: 'constructor',
- range: constructorTokenRange,
- loc: getLocFor(constructorTokenRange[0], constructorTokenRange[1], ast)
- };
+ if (node.decorators) {
+ result.decorators = node.decorators.map(el =>
+ this.convertChild(el)
+ );
+ }
- const isStatic = hasModifier(SyntaxKind.StaticKeyword, node);
+ const accessibility = getTSNodeAccessibility(node);
+ if (accessibility) {
+ result.accessibility = accessibility;
+ }
+ }
- Object.assign(result, {
- type: hasModifier(SyntaxKind.AbstractKeyword, node)
- ? AST_NODE_TYPES.TSAbstractMethodDefinition
- : AST_NODE_TYPES.MethodDefinition,
- key: constructorKey,
- value: constructor,
- computed: false,
- static: isStatic,
- kind: isStatic ? 'method' : 'constructor'
- });
+ if (
+ result.key.type === AST_NODE_TYPES.Identifier &&
+ node.questionToken
+ ) {
+ result.key.optional = true;
+ }
- const accessibility = getTSNodeAccessibility(node);
- if (accessibility) {
- result.accessibility = accessibility;
+ if (node.kind === SyntaxKind.GetAccessor) {
+ result.kind = 'get';
+ } else if (node.kind === SyntaxKind.SetAccessor) {
+ result.kind = 'set';
+ } else if (
+ !(result as TSESTree.MethodDefinition).static &&
+ node.name.kind === SyntaxKind.StringLiteral &&
+ node.name.text === 'constructor' &&
+ result.type !== AST_NODE_TYPES.Property
+ ) {
+ result.kind = 'constructor';
+ }
+ return result;
}
- break;
- }
+ // TypeScript uses this even for static methods named "constructor"
+ case SyntaxKind.Constructor: {
+ const lastModifier = getLastModifier(node);
+ const constructorToken =
+ (lastModifier && findNextToken(lastModifier, node, this.ast)) ||
+ node.getFirstToken()!;
- case SyntaxKind.FunctionExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.FunctionExpression,
- id: convertChild(node.name),
- generator: !!node.asteriskToken,
- params: convertParameters(node.parameters),
- body: convertChild(node.body),
- async: hasModifier(SyntaxKind.AsyncKeyword, node),
- expression: false
- });
+ const constructor = this.createNode(node, {
+ type: AST_NODE_TYPES.FunctionExpression,
+ id: null,
+ params: this.convertParameters(node.parameters),
+ generator: false,
+ expression: false, // is not present in ESTreeNode
+ async: false,
+ body: this.convertChild(node.body),
+ range: [node.parameters.pos - 1, node.end]
+ });
- // Process returnType
- if (node.type) {
- result.returnType = convertTypeAnnotation(node.type);
- }
+ // Process typeParameters
+ if (node.typeParameters) {
+ constructor.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters
+ );
+ this.fixParentLocation(constructor, constructor.typeParameters.range);
+ }
- // Process typeParameters
- if (node.typeParameters && node.typeParameters.length) {
- result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters
- );
- }
- break;
+ // Process returnType
+ if (node.type) {
+ constructor.returnType = this.convertTypeAnnotation(node.type, node);
+ }
- case SyntaxKind.SuperKeyword:
- Object.assign(result, {
- type: AST_NODE_TYPES.Super
- });
- break;
+ const constructorKey = this.createNode(node, {
+ type: AST_NODE_TYPES.Identifier,
+ name: 'constructor',
+ range: [constructorToken.getStart(this.ast), constructorToken.end]
+ });
- case SyntaxKind.ArrayBindingPattern:
- Object.assign(result, {
- type: AST_NODE_TYPES.ArrayPattern,
- elements: node.elements.map(convertPattern)
- });
- break;
+ const isStatic = hasModifier(SyntaxKind.StaticKeyword, node);
+ const result = this.createNode<
+ TSESTree.TSAbstractMethodDefinition | TSESTree.MethodDefinition
+ >(node, {
+ type: hasModifier(SyntaxKind.AbstractKeyword, node)
+ ? AST_NODE_TYPES.TSAbstractMethodDefinition
+ : AST_NODE_TYPES.MethodDefinition,
+ key: constructorKey,
+ value: constructor,
+ computed: false,
+ static: isStatic,
+ kind: isStatic ? 'method' : 'constructor'
+ });
- // occurs with missing array elements like [,]
- case SyntaxKind.OmittedExpression:
- return null;
+ const accessibility = getTSNodeAccessibility(node);
+ if (accessibility) {
+ result.accessibility = accessibility;
+ }
- case SyntaxKind.ObjectBindingPattern:
- Object.assign(result, {
- type: AST_NODE_TYPES.ObjectPattern,
- properties: node.elements.map(convertPattern)
- });
- break;
+ return result;
+ }
- case SyntaxKind.BindingElement:
- if (parent!.kind === SyntaxKind.ArrayBindingPattern) {
- const arrayItem = convert({
- node: node.name,
- parent,
- ast,
- additionalOptions
+ case SyntaxKind.FunctionExpression: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.FunctionExpression,
+ id: this.convertChild(node.name),
+ generator: !!node.asteriskToken,
+ params: this.convertParameters(node.parameters),
+ body: this.convertChild(node.body),
+ async: hasModifier(SyntaxKind.AsyncKeyword, node),
+ expression: false
});
- if (node.initializer) {
- Object.assign(result, {
- type: AST_NODE_TYPES.AssignmentPattern,
- left: arrayItem,
- right: convertChild(node.initializer)
- });
- } else if (node.dotDotDotToken) {
- Object.assign(result, {
- type: AST_NODE_TYPES.RestElement,
- argument: arrayItem
- });
- } else {
- return arrayItem;
+ // Process returnType
+ if (node.type) {
+ result.returnType = this.convertTypeAnnotation(node.type, node);
}
- } else if (parent!.kind === SyntaxKind.ObjectBindingPattern) {
- if (node.dotDotDotToken) {
- Object.assign(result, {
- type: AST_NODE_TYPES.RestElement,
- argument: convertChild(node.propertyName || node.name)
- });
- } else {
- Object.assign(result, {
- type: AST_NODE_TYPES.Property,
- key: convertChild(node.propertyName || node.name),
- value: convertChild(node.name),
- computed: Boolean(
- node.propertyName &&
- node.propertyName.kind === SyntaxKind.ComputedPropertyName
- ),
- method: false,
- shorthand: !node.propertyName,
- kind: 'init'
- });
+
+ // Process typeParameters
+ if (node.typeParameters) {
+ result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters
+ );
}
+ return result;
+ }
- if (node.initializer) {
- (result as any).value = {
- type: AST_NODE_TYPES.AssignmentPattern,
- left: convertChild(node.name),
- right: convertChild(node.initializer),
- range: [node.name.getStart(ast), node.initializer.end],
- loc: getLocFor(node.name.getStart(ast), node.initializer.end, ast)
- };
- }
- }
- break;
-
- case SyntaxKind.ArrowFunction:
- Object.assign(result, {
- type: AST_NODE_TYPES.ArrowFunctionExpression,
- generator: false,
- id: null,
- params: convertParameters(node.parameters),
- body: convertChild(node.body),
- async: hasModifier(SyntaxKind.AsyncKeyword, node),
- expression: node.body.kind !== SyntaxKind.Block
- });
+ case SyntaxKind.SuperKeyword:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Super
+ });
- // Process returnType
- if (node.type) {
- result.returnType = convertTypeAnnotation(node.type);
- }
+ case SyntaxKind.ArrayBindingPattern:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ArrayPattern,
+ elements: node.elements.map(el => this.convertPattern(el))
+ });
- // Process typeParameters
- if (node.typeParameters && node.typeParameters.length) {
- result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters
- );
- }
- break;
+ // occurs with missing array elements like [,]
+ case SyntaxKind.OmittedExpression:
+ return null;
- case SyntaxKind.YieldExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.YieldExpression,
- delegate: !!node.asteriskToken,
- argument: convertChild(node.expression)
- });
- break;
+ case SyntaxKind.ObjectBindingPattern:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ObjectPattern,
+ properties: node.elements.map(el => this.convertPattern(el))
+ });
- case SyntaxKind.AwaitExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.AwaitExpression,
- argument: convertChild(node.expression)
- });
- break;
-
- // Template Literals
-
- case SyntaxKind.NoSubstitutionTemplateLiteral:
- Object.assign(result, {
- type: AST_NODE_TYPES.TemplateLiteral,
- quasis: [
- {
- type: AST_NODE_TYPES.TemplateElement,
- value: {
- raw: ast.text.slice(node.getStart(ast) + 1, node.end - 1),
- cooked: node.text
- },
- tail: true,
- range: result.range,
- loc: result.loc
+ case SyntaxKind.BindingElement: {
+ if (parent.kind === SyntaxKind.ArrayBindingPattern) {
+ const arrayItem = this.convertChild(node.name, parent);
+
+ if (node.initializer) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.AssignmentPattern,
+ left: arrayItem,
+ right: this.convertChild(node.initializer)
+ });
+ } else if (node.dotDotDotToken) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.RestElement,
+ argument: arrayItem
+ });
+ } else {
+ return arrayItem;
+ }
+ } else if (parent.kind === SyntaxKind.ObjectBindingPattern) {
+ let result: TSESTree.RestElement | TSESTree.Property;
+ if (node.dotDotDotToken) {
+ result = this.createNode(node, {
+ type: AST_NODE_TYPES.RestElement,
+ argument: this.convertChild(node.propertyName || node.name)
+ });
+ } else {
+ result = this.createNode(node, {
+ type: AST_NODE_TYPES.Property,
+ key: this.convertChild(node.propertyName || node.name),
+ value: this.convertChild(node.name),
+ computed: Boolean(
+ node.propertyName &&
+ node.propertyName.kind === SyntaxKind.ComputedPropertyName
+ ),
+ method: false,
+ shorthand: !node.propertyName,
+ kind: 'init'
+ });
}
- ],
- expressions: []
- });
- break;
- case SyntaxKind.TemplateExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.TemplateLiteral,
- quasis: [convertChild(node.head)],
- expressions: []
- });
+ if (node.initializer) {
+ result.value = this.createNode(node, {
+ type: AST_NODE_TYPES.AssignmentPattern,
+ left: this.convertChild(node.name),
+ right: this.convertChild(node.initializer),
+ range: [node.name.getStart(this.ast), node.initializer.end]
+ });
+ }
+ return result;
+ }
+ return null;
+ }
- node.templateSpans.forEach((templateSpan: any) => {
- (result as any).expressions.push(convertChild(templateSpan.expression));
- (result as any).quasis.push(convertChild(templateSpan.literal));
- });
- break;
-
- case SyntaxKind.TaggedTemplateExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.TaggedTemplateExpression,
- typeParameters: node.typeArguments
- ? convertTypeArgumentsToTypeParameters(node.typeArguments)
- : undefined,
- tag: convertChild(node.tag),
- quasi: convertChild(node.template)
- });
- break;
-
- case SyntaxKind.TemplateHead:
- case SyntaxKind.TemplateMiddle:
- case SyntaxKind.TemplateTail: {
- const tail = node.kind === SyntaxKind.TemplateTail;
- Object.assign(result, {
- type: AST_NODE_TYPES.TemplateElement,
- value: {
- raw: ast.text.slice(
- node.getStart(ast) + 1,
- node.end - (tail ? 1 : 2)
- ),
- cooked: node.text
- },
- tail
- });
- break;
- }
+ case SyntaxKind.ArrowFunction: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.ArrowFunctionExpression,
+ generator: false,
+ id: null,
+ params: this.convertParameters(node.parameters),
+ body: this.convertChild(node.body),
+ async: hasModifier(SyntaxKind.AsyncKeyword, node),
+ expression: node.body.kind !== SyntaxKind.Block
+ });
+
+ // Process returnType
+ if (node.type) {
+ result.returnType = this.convertTypeAnnotation(node.type, node);
+ }
- // Patterns
+ // Process typeParameters
+ if (node.typeParameters) {
+ result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters
+ );
+ }
+ return result;
+ }
- case SyntaxKind.SpreadAssignment:
- case SyntaxKind.SpreadElement: {
- if (config.allowPattern) {
- Object.assign(result, {
- type: AST_NODE_TYPES.RestElement,
- argument: convertPattern(node.expression)
+ case SyntaxKind.YieldExpression:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.YieldExpression,
+ delegate: !!node.asteriskToken,
+ argument: this.convertChild(node.expression)
});
- } else {
- Object.assign(result, {
- type: AST_NODE_TYPES.SpreadElement,
- argument: convertChild(node.expression)
+
+ case SyntaxKind.AwaitExpression:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.AwaitExpression,
+ argument: this.convertChild(node.expression)
});
- }
- break;
- }
- case SyntaxKind.Parameter: {
- let parameter: ESTreeNode;
+ // Template Literals
+
+ case SyntaxKind.NoSubstitutionTemplateLiteral:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TemplateLiteral,
+ quasis: [
+ this.createNode(node, {
+ type: AST_NODE_TYPES.TemplateElement,
+ value: {
+ raw: this.ast.text.slice(
+ node.getStart(this.ast) + 1,
+ node.end - 1
+ ),
+ cooked: node.text
+ },
+ tail: true
+ })
+ ],
+ expressions: []
+ });
- if (node.dotDotDotToken) {
- Object.assign(result, {
- type: AST_NODE_TYPES.RestElement,
- argument: convertChild(node.name)
+ case SyntaxKind.TemplateExpression: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TemplateLiteral,
+ quasis: [this.convertChild(node.head)],
+ expressions: []
});
- parameter = result;
- } else if (node.initializer) {
- parameter = convertChild(node.name)!;
- Object.assign(result, {
- type: AST_NODE_TYPES.AssignmentPattern,
- left: parameter,
- right: convertChild(node.initializer)
+
+ node.templateSpans.forEach(templateSpan => {
+ result.expressions.push(this.convertChild(templateSpan.expression));
+ result.quasis.push(this.convertChild(templateSpan.literal));
});
- } else {
- parameter = result = convert({
- node: node.name,
- parent,
- ast,
- additionalOptions
- })!;
+ return result;
}
- if (node.type) {
- parameter.typeAnnotation = convertTypeAnnotation(node.type);
- fixTypeAnnotationParentLocation(parameter);
- }
+ case SyntaxKind.TaggedTemplateExpression:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TaggedTemplateExpression,
+ typeParameters: node.typeArguments
+ ? this.convertTypeArgumentsToTypeParameters(node.typeArguments)
+ : undefined,
+ tag: this.convertChild(node.tag),
+ quasi: this.convertChild(node.template)
+ });
- if (node.questionToken) {
- (parameter as any).optional = true;
+ case SyntaxKind.TemplateHead:
+ case SyntaxKind.TemplateMiddle:
+ case SyntaxKind.TemplateTail: {
+ const tail = node.kind === SyntaxKind.TemplateTail;
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TemplateElement,
+ value: {
+ raw: this.ast.text.slice(
+ node.getStart(this.ast) + 1,
+ node.end - (tail ? 1 : 2)
+ ),
+ cooked: node.text
+ },
+ tail
+ });
}
- if (node.modifiers) {
- return {
- type: AST_NODE_TYPES.TSParameterProperty,
- range: [node.getStart(ast), node.end],
- loc: getLoc(node, ast),
- accessibility: getTSNodeAccessibility(node) || undefined,
- readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined,
- static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined,
- export: hasModifier(SyntaxKind.ExportKeyword, node) || undefined,
- parameter: result
- };
+ // Patterns
+
+ case SyntaxKind.SpreadAssignment:
+ case SyntaxKind.SpreadElement: {
+ if (this.allowPattern) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.RestElement,
+ argument: this.convertPattern(node.expression)
+ });
+ } else {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.SpreadElement,
+ argument: this.convertChild(node.expression)
+ });
+ }
}
- break;
- }
+ case SyntaxKind.Parameter: {
+ let parameter: any;
+ let result: TSESTree.RestElement | TSESTree.AssignmentPattern;
- // Classes
+ if (node.dotDotDotToken) {
+ parameter = result = this.createNode(node, {
+ type: AST_NODE_TYPES.RestElement,
+ argument: this.convertChild(node.name)
+ });
+ } else if (node.initializer) {
+ parameter = this.convertChild(node.name);
+ result = this.createNode(node, {
+ type: AST_NODE_TYPES.AssignmentPattern,
+ left: parameter,
+ right: this.convertChild(node.initializer)
+ });
- case SyntaxKind.ClassDeclaration:
- case SyntaxKind.ClassExpression: {
- const heritageClauses = node.heritageClauses || [];
+ if (node.modifiers) {
+ // AssignmentPattern should not contain modifiers in range
+ result.range[0] = parameter.range[0];
+ result.loc = getLocFor(result.range[0], result.range[1], this.ast);
+ }
+ } else {
+ parameter = result = this.convertChild(node.name, parent);
+ }
- let classNodeType = SyntaxKind[node.kind];
- let lastClassToken: any = heritageClauses.length
- ? heritageClauses[heritageClauses.length - 1]
- : node.name;
+ if (node.type) {
+ parameter.typeAnnotation = this.convertTypeAnnotation(
+ node.type,
+ node
+ );
+ this.fixParentLocation(parameter, parameter.typeAnnotation.range);
+ }
- if (node.typeParameters && node.typeParameters.length) {
- const lastTypeParameter =
- node.typeParameters[node.typeParameters.length - 1];
+ if (node.questionToken) {
+ if (node.questionToken.end > parameter.range[1]) {
+ parameter.range[1] = node.questionToken.end;
+ parameter.loc.end = getLineAndCharacterFor(
+ parameter.range[1],
+ this.ast
+ );
+ }
+ parameter.optional = true;
+ }
- if (!lastClassToken || lastTypeParameter.pos > lastClassToken.pos) {
- lastClassToken = findNextToken(lastTypeParameter, ast, ast);
+ if (node.modifiers) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSParameterProperty,
+ accessibility: getTSNodeAccessibility(node) || undefined,
+ readonly:
+ hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined,
+ static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined,
+ export: hasModifier(SyntaxKind.ExportKeyword, node) || undefined,
+ parameter: result
+ });
}
- result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters
- );
+ return result;
}
- if (node.modifiers && node.modifiers.length) {
- /**
- * We need check for modifiers, and use the last one, as there
- * could be multiple before the open brace
- */
- const lastModifier = node.modifiers![node.modifiers!.length - 1];
+ // Classes
- if (!lastClassToken || lastModifier.pos > lastClassToken.pos) {
- lastClassToken = findNextToken(lastModifier, ast, ast);
- }
- } else if (!lastClassToken) {
- // no name
- lastClassToken = node.getFirstToken();
- }
+ case SyntaxKind.ClassDeclaration:
+ case SyntaxKind.ClassExpression: {
+ const heritageClauses = node.heritageClauses || [];
+ let classNodeType =
+ node.kind === SyntaxKind.ClassDeclaration
+ ? AST_NODE_TYPES.ClassDeclaration
+ : AST_NODE_TYPES.ClassExpression;
- const openBrace = findNextToken(lastClassToken, ast, ast)!;
- const superClass = heritageClauses.find(
- clause => clause.token === SyntaxKind.ExtendsKeyword
- );
+ const superClass = heritageClauses.find(
+ clause => clause.token === SyntaxKind.ExtendsKeyword
+ );
- if (superClass) {
- if (superClass.types.length > 1) {
- throw createError(
- ast,
- superClass.types[1].pos,
- 'Classes can only extend a single class.'
- );
+ const implementsClause = heritageClauses.find(
+ clause => clause.token === SyntaxKind.ImplementsKeyword
+ );
+
+ const result = this.createNode<
+ TSESTree.ClassDeclaration | TSESTree.ClassExpression
+ >(node, {
+ type: classNodeType,
+ id: this.convertChild(node.name),
+ body: this.createNode(node, {
+ type: AST_NODE_TYPES.ClassBody,
+ body: [],
+ range: [node.members.pos - 1, node.end]
+ }),
+ superClass:
+ superClass && superClass.types[0]
+ ? this.convertChild(superClass.types[0].expression)
+ : null
+ });
+
+ if (superClass) {
+ if (superClass.types.length > 1) {
+ throw createError(
+ this.ast,
+ superClass.types[1].pos,
+ 'Classes can only extend a single class.'
+ );
+ }
+
+ if (superClass.types[0] && superClass.types[0].typeArguments) {
+ result.superTypeParameters = this.convertTypeArgumentsToTypeParameters(
+ superClass.types[0].typeArguments
+ );
+ }
}
- if (superClass.types[0] && superClass.types[0].typeArguments) {
- (result as any).superTypeParameters = convertTypeArgumentsToTypeParameters(
- superClass.types[0].typeArguments
+ if (node.typeParameters) {
+ result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters
);
}
- }
-
- const implementsClause = heritageClauses.find(
- clause => clause.token === SyntaxKind.ImplementsKeyword
- );
- Object.assign(result, {
- type: classNodeType,
- id: convertChild(node.name),
- body: {
- type: AST_NODE_TYPES.ClassBody,
- body: [],
- range: [openBrace.getStart(ast), node.end],
- loc: getLocFor(openBrace.getStart(ast), node.end, ast)
- },
- superClass:
- superClass && superClass.types[0]
- ? convertChild(superClass.types[0].expression)
- : null
- });
+ if (implementsClause) {
+ result.implements = implementsClause.types.map(el =>
+ this.convertChild(el)
+ );
+ }
- if (implementsClause) {
- result.implements = implementsClause.types.map(convertChild);
- }
+ /**
+ * TypeScript class declarations can be defined as "abstract"
+ */
+ if (hasModifier(SyntaxKind.AbstractKeyword, node)) {
+ result.abstract = true;
+ }
- /**
- * TypeScript class declarations can be defined as "abstract"
- */
- if (hasModifier(SyntaxKind.AbstractKeyword, node)) {
- result.abstract = true;
- }
+ if (hasModifier(SyntaxKind.DeclareKeyword, node)) {
+ result.declare = true;
+ }
- if (hasModifier(SyntaxKind.DeclareKeyword, node)) {
- result.declare = true;
- }
+ if (node.decorators) {
+ result.decorators = node.decorators.map(el => this.convertChild(el));
+ }
- if (node.decorators) {
- result.decorators = node.decorators.map(convertChild);
- }
+ const filteredMembers = node.members.filter(isESTreeClassMember);
- const filteredMembers = node.members.filter(isESTreeClassMember);
+ if (filteredMembers.length) {
+ result.body.body = filteredMembers.map(el => this.convertChild(el));
+ }
- if (filteredMembers.length) {
- result.body.body = filteredMembers.map(convertChild);
+ // check for exports
+ return fixExports(node, result, this.ast);
}
- // check for exports
- result = fixExports(node, result, ast);
-
- break;
- }
+ // Modules
+ case SyntaxKind.ModuleBlock:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSModuleBlock,
+ body: this.convertBodyExpressions(node.statements, node)
+ });
- // Modules
- case SyntaxKind.ModuleBlock:
- Object.assign(result, {
- type: AST_NODE_TYPES.TSModuleBlock,
- body: convertBodyExpressions(node.statements)
- });
- break;
+ case SyntaxKind.ImportDeclaration: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.ImportDeclaration,
+ source: this.convertChild(node.moduleSpecifier),
+ specifiers: []
+ });
- case SyntaxKind.ImportDeclaration:
- Object.assign(result, {
- type: AST_NODE_TYPES.ImportDeclaration,
- source: convertChild(node.moduleSpecifier),
- specifiers: []
- });
+ if (node.importClause) {
+ if (node.importClause.name) {
+ result.specifiers.push(this.convertChild(node.importClause));
+ }
- if (node.importClause) {
- if (node.importClause.name) {
- result.specifiers!.push(convertChild(node.importClause));
- }
-
- if (node.importClause.namedBindings) {
- switch (node.importClause.namedBindings.kind) {
- case SyntaxKind.NamespaceImport:
- result.specifiers!.push(
- convertChild(node.importClause.namedBindings)
- );
- break;
- case SyntaxKind.NamedImports:
- result.specifiers = result.specifiers!.concat(
- node.importClause.namedBindings.elements.map(convertChild)
- );
- break;
+ if (node.importClause.namedBindings) {
+ switch (node.importClause.namedBindings.kind) {
+ case SyntaxKind.NamespaceImport:
+ result.specifiers.push(
+ this.convertChild(node.importClause.namedBindings)
+ );
+ break;
+ case SyntaxKind.NamedImports:
+ result.specifiers = result.specifiers.concat(
+ node.importClause.namedBindings.elements.map(el =>
+ this.convertChild(el)
+ )
+ );
+ break;
+ }
}
}
+ return result;
}
- break;
-
- case SyntaxKind.NamespaceImport:
- Object.assign(result, {
- type: AST_NODE_TYPES.ImportNamespaceSpecifier,
- local: convertChild(node.name)
- });
- break;
- case SyntaxKind.ImportSpecifier:
- Object.assign(result, {
- type: AST_NODE_TYPES.ImportSpecifier,
- local: convertChild(node.name),
- imported: convertChild(node.propertyName || node.name)
- });
- break;
-
- case SyntaxKind.ImportClause:
- Object.assign(result, {
- type: AST_NODE_TYPES.ImportDefaultSpecifier,
- local: convertChild(node.name)
- });
-
- // have to adjust location information due to tree differences
- result.range[1] = node.name!.end;
- result.loc = getLocFor(result.range[0], result.range[1], ast);
- break;
+ case SyntaxKind.NamespaceImport:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ImportNamespaceSpecifier,
+ local: this.convertChild(node.name)
+ });
- case SyntaxKind.ExportDeclaration:
- if (node.exportClause) {
- Object.assign(result, {
- type: AST_NODE_TYPES.ExportNamedDeclaration,
- source: convertChild(node.moduleSpecifier),
- specifiers: node.exportClause.elements.map(convertChild),
- declaration: null
+ case SyntaxKind.ImportSpecifier:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ImportSpecifier,
+ local: this.convertChild(node.name),
+ imported: this.convertChild(node.propertyName || node.name)
});
- } else {
- Object.assign(result, {
- type: AST_NODE_TYPES.ExportAllDeclaration,
- source: convertChild(node.moduleSpecifier)
+
+ case SyntaxKind.ImportClause:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ImportDefaultSpecifier,
+ local: this.convertChild(node.name),
+ range: [node.getStart(this.ast), node.name!.end]
});
- }
- break;
- case SyntaxKind.ExportSpecifier:
- Object.assign(result, {
- type: AST_NODE_TYPES.ExportSpecifier,
- local: convertChild(node.propertyName || node.name),
- exported: convertChild(node.name)
- });
- break;
+ case SyntaxKind.ExportDeclaration:
+ if (node.exportClause) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ExportNamedDeclaration,
+ source: this.convertChild(node.moduleSpecifier),
+ specifiers: node.exportClause.elements.map(el =>
+ this.convertChild(el)
+ ),
+ declaration: null
+ });
+ } else {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ExportAllDeclaration,
+ source: this.convertChild(node.moduleSpecifier)
+ });
+ }
- case SyntaxKind.ExportAssignment:
- if (node.isExportEquals) {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSExportAssignment,
- expression: convertChild(node.expression)
- });
- } else {
- Object.assign(result, {
- type: AST_NODE_TYPES.ExportDefaultDeclaration,
- declaration: convertChild(node.expression)
+ case SyntaxKind.ExportSpecifier:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ExportSpecifier,
+ local: this.convertChild(node.propertyName || node.name),
+ exported: this.convertChild(node.name)
});
- }
- break;
- // Unary Operations
+ case SyntaxKind.ExportAssignment:
+ if (node.isExportEquals) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSExportAssignment,
+ expression: this.convertChild(node.expression)
+ });
+ } else {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ExportDefaultDeclaration,
+ declaration: this.convertChild(node.expression)
+ });
+ }
+
+ // Unary Operations
- case SyntaxKind.PrefixUnaryExpression:
- case SyntaxKind.PostfixUnaryExpression: {
- const operator = getTextForTokenKind(node.operator) || '';
- Object.assign(result, {
+ case SyntaxKind.PrefixUnaryExpression:
+ case SyntaxKind.PostfixUnaryExpression: {
+ const operator = (getTextForTokenKind(node.operator) || '') as any;
/**
* ESTree uses UpdateExpression for ++/--
*/
- type: /^(?:\+\+|--)$/.test(operator)
- ? AST_NODE_TYPES.UpdateExpression
- : AST_NODE_TYPES.UnaryExpression,
- operator,
- prefix: node.kind === SyntaxKind.PrefixUnaryExpression,
- argument: convertChild(node.operand)
- });
- break;
- }
+ if (/^(?:\+\+|--)$/.test(operator)) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.UpdateExpression,
+ operator,
+ prefix: node.kind === SyntaxKind.PrefixUnaryExpression,
+ argument: this.convertChild(node.operand)
+ });
+ } else {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.UnaryExpression,
+ operator,
+ prefix: node.kind === SyntaxKind.PrefixUnaryExpression,
+ argument: this.convertChild(node.operand)
+ });
+ }
+ }
- case SyntaxKind.DeleteExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.UnaryExpression,
- operator: 'delete',
- prefix: true,
- argument: convertChild(node.expression)
- });
- break;
-
- case SyntaxKind.VoidExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.UnaryExpression,
- operator: 'void',
- prefix: true,
- argument: convertChild(node.expression)
- });
- break;
-
- case SyntaxKind.TypeOfExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.UnaryExpression,
- operator: 'typeof',
- prefix: true,
- argument: convertChild(node.expression)
- });
- break;
+ case SyntaxKind.DeleteExpression:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.UnaryExpression,
+ operator: 'delete',
+ prefix: true,
+ argument: this.convertChild(node.expression)
+ });
- case SyntaxKind.TypeOperator:
- Object.assign(result, {
- type: AST_NODE_TYPES.TSTypeOperator,
- operator: getTextForTokenKind(node.operator),
- typeAnnotation: convertChild(node.type)
- });
- break;
+ case SyntaxKind.VoidExpression:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.UnaryExpression,
+ operator: 'void',
+ prefix: true,
+ argument: this.convertChild(node.expression)
+ });
- // Binary Operations
+ case SyntaxKind.TypeOfExpression:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.UnaryExpression,
+ operator: 'typeof',
+ prefix: true,
+ argument: this.convertChild(node.expression)
+ });
- case SyntaxKind.BinaryExpression:
- // TypeScript uses BinaryExpression for sequences as well
- if (isComma(node.operatorToken)) {
- Object.assign(result, {
- type: AST_NODE_TYPES.SequenceExpression,
- expressions: []
+ case SyntaxKind.TypeOperator:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSTypeOperator,
+ operator: getTextForTokenKind(node.operator) as any,
+ typeAnnotation: this.convertChild(node.type)
});
- const left = convertChild(node.left)!,
- right = convertChild(node.right)!;
+ // Binary Operations
- if (left.type === AST_NODE_TYPES.SequenceExpression) {
- (result as any).expressions = (result as any).expressions.concat(
- (left as any).expressions
- );
- } else {
- (result as any).expressions.push(left);
- }
+ case SyntaxKind.BinaryExpression: {
+ // TypeScript uses BinaryExpression for sequences as well
+ if (isComma(node.operatorToken)) {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.SequenceExpression,
+ expressions: []
+ });
- if (right.type === AST_NODE_TYPES.SequenceExpression) {
- (result as any).expressions = (result as any).expressions.concat(
- (right as any).expressions
- );
+ const left = this.convertChild(node.left),
+ right = this.convertChild(node.right);
+
+ if (left.type === AST_NODE_TYPES.SequenceExpression) {
+ result.expressions = result.expressions.concat(left.expressions);
+ } else {
+ result.expressions.push(left);
+ }
+
+ if (right.type === AST_NODE_TYPES.SequenceExpression) {
+ result.expressions = result.expressions.concat(right.expressions);
+ } else {
+ result.expressions.push(right);
+ }
+ return result;
} else {
- (result as any).expressions.push(right);
- }
- } else {
- const type = getBinaryExpressionType(node.operatorToken);
- Object.assign(result, {
- type,
- operator: getTextForTokenKind(node.operatorToken.kind),
- left: converter(
- node.left,
- config.inTypeMode,
+ const type = getBinaryExpressionType(node.operatorToken);
+ if (
+ this.allowPattern &&
type === AST_NODE_TYPES.AssignmentExpression
- ),
- right: convertChild(node.right)
- });
-
- // if the binary expression is in a destructured array, switch it
- if (result.type === AST_NODE_TYPES.AssignmentExpression) {
- if (config.allowPattern) {
- delete (result as any).operator;
- result.type = AST_NODE_TYPES.AssignmentPattern;
+ ) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.AssignmentPattern,
+ left: this.convertPattern(node.left, node),
+ right: this.convertChild(node.right)
+ });
}
+ return this.createNode<
+ | TSESTree.AssignmentExpression
+ | TSESTree.LogicalExpression
+ | TSESTree.BinaryExpression
+ >(node, {
+ type: type,
+ operator: getTextForTokenKind(node.operatorToken.kind)!,
+ left: this.converter(
+ node.left,
+ node,
+ this.inTypeMode,
+ type === AST_NODE_TYPES.AssignmentExpression
+ ),
+ right: this.convertChild(node.right)
+ });
}
}
- break;
- case SyntaxKind.PropertyAccessExpression:
- if (isJSXToken(parent!)) {
- const jsxMemberExpression = {
+ case SyntaxKind.PropertyAccessExpression:
+ return this.createNode(node, {
type: AST_NODE_TYPES.MemberExpression,
- object: convertChild(node.expression),
- property: convertChild(node.name)
- };
- const isNestedMemberExpression =
- node.expression.kind === SyntaxKind.PropertyAccessExpression;
- if (node.expression.kind === SyntaxKind.ThisKeyword) {
- (jsxMemberExpression as any).object.name = 'this';
- }
-
- (jsxMemberExpression as any).object.type = isNestedMemberExpression
- ? AST_NODE_TYPES.MemberExpression
- : AST_NODE_TYPES.JSXIdentifier;
- (jsxMemberExpression as any).property.type =
- AST_NODE_TYPES.JSXIdentifier;
- Object.assign(result, jsxMemberExpression);
- } else {
- Object.assign(result, {
- type: AST_NODE_TYPES.MemberExpression,
- object: convertChild(node.expression),
- property: convertChild(node.name),
+ object: this.convertChild(node.expression),
+ property: this.convertChild(node.name),
computed: false
});
- }
- break;
- case SyntaxKind.ElementAccessExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.MemberExpression,
- object: convertChild(node.expression),
- property: convertChild(node.argumentExpression),
- computed: true
- });
- break;
-
- case SyntaxKind.ConditionalExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.ConditionalExpression,
- test: convertChild(node.condition),
- consequent: convertChild(node.whenTrue),
- alternate: convertChild(node.whenFalse)
- });
- break;
+ case SyntaxKind.ElementAccessExpression:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.MemberExpression,
+ object: this.convertChild(node.expression),
+ property: this.convertChild(node.argumentExpression),
+ computed: true
+ });
- case SyntaxKind.CallExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.CallExpression,
- callee: convertChild(node.expression),
- arguments: node.arguments.map(convertChild)
- });
- if (node.typeArguments && node.typeArguments.length) {
- result.typeParameters = convertTypeArgumentsToTypeParameters(
- node.typeArguments
- );
+ case SyntaxKind.ConditionalExpression:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.ConditionalExpression,
+ test: this.convertChild(node.condition),
+ consequent: this.convertChild(node.whenTrue),
+ alternate: this.convertChild(node.whenFalse)
+ });
+
+ case SyntaxKind.CallExpression: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.CallExpression,
+ callee: this.convertChild(node.expression),
+ arguments: node.arguments.map(el => this.convertChild(el))
+ });
+ if (node.typeArguments) {
+ result.typeParameters = this.convertTypeArgumentsToTypeParameters(
+ node.typeArguments
+ );
+ }
+ return result;
}
- break;
- case SyntaxKind.NewExpression:
- Object.assign(result, {
- type: AST_NODE_TYPES.NewExpression,
- callee: convertChild(node.expression),
- arguments: node.arguments ? node.arguments.map(convertChild) : []
- });
- if (node.typeArguments && node.typeArguments.length) {
- result.typeParameters = convertTypeArgumentsToTypeParameters(
- node.typeArguments
- );
+ case SyntaxKind.NewExpression: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.NewExpression,
+ callee: this.convertChild(node.expression),
+ arguments: node.arguments
+ ? node.arguments.map(el => this.convertChild(el))
+ : []
+ });
+ if (node.typeArguments) {
+ result.typeParameters = this.convertTypeArgumentsToTypeParameters(
+ node.typeArguments
+ );
+ }
+ return result;
}
- break;
- case SyntaxKind.MetaProperty: {
- const newToken = convertToken(node.getFirstToken()!, ast);
- Object.assign(result, {
- type: AST_NODE_TYPES.MetaProperty,
- meta: {
- type: AST_NODE_TYPES.Identifier,
- range: newToken.range,
- loc: newToken.loc,
- name: getTextForTokenKind(node.keywordToken)
- },
- property: convertChild(node.name)
- });
- break;
- }
+ case SyntaxKind.MetaProperty: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.MetaProperty,
+ meta: this.createNode(node.getFirstToken()!, {
+ type: AST_NODE_TYPES.Identifier,
+ name: getTextForTokenKind(node.keywordToken)!
+ }),
+ property: this.convertChild(node.name)
+ });
+ }
- case SyntaxKind.Decorator: {
- Object.assign(result, {
- type: AST_NODE_TYPES.Decorator,
- expression: convertChild(node.expression)
- });
- break;
- }
+ case SyntaxKind.Decorator: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Decorator,
+ expression: this.convertChild(node.expression)
+ });
+ }
- // Literals
+ // Literals
- case SyntaxKind.StringLiteral:
- Object.assign(result, {
- type: AST_NODE_TYPES.Literal,
- raw: ast.text.slice(result.range[0], result.range[1])
- });
- if ((parent as any).name && (parent as any).name === node) {
- (result as any).value = node.text;
- } else {
- (result as any).value = unescapeStringLiteralText(node.text);
- }
- break;
-
- case SyntaxKind.NumericLiteral: {
- Object.assign(result, {
- type: AST_NODE_TYPES.Literal,
- value: Number(node.text),
- raw: node.getText()
- });
- break;
- }
-
- case SyntaxKind.BigIntLiteral: {
- const raw = ast.text.slice(result.range[0], result.range[1]);
- const value = raw.slice(0, -1); // remove suffix `n`
- Object.assign(result, {
- type: AST_NODE_TYPES.BigIntLiteral,
- raw,
- value
- });
- break;
- }
+ case SyntaxKind.StringLiteral: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.Literal,
+ raw: '',
+ value: ''
+ });
+ result.raw = this.ast.text.slice(result.range[0], result.range[1]);
+ if ((parent as any).name && (parent as any).name === node) {
+ result.value = node.text;
+ } else {
+ result.value = unescapeStringLiteralText(node.text);
+ }
+ return result;
+ }
- case SyntaxKind.RegularExpressionLiteral: {
- const pattern = node.text.slice(1, node.text.lastIndexOf('/'));
- const flags = node.text.slice(node.text.lastIndexOf('/') + 1);
+ case SyntaxKind.NumericLiteral: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Literal,
+ value: Number(node.text),
+ raw: node.getText()
+ });
+ }
- let regex = null;
- try {
- regex = new RegExp(pattern, flags);
- } catch (exception) {
- regex = null;
+ case SyntaxKind.BigIntLiteral: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.BigIntLiteral,
+ raw: '',
+ value: ''
+ });
+ result.raw = this.ast.text.slice(result.range[0], result.range[1]);
+ result.value = result.raw.slice(0, -1); // remove suffix `n`
+ return result;
}
- Object.assign(result, {
- type: AST_NODE_TYPES.Literal,
- value: regex,
- raw: node.text,
- regex: {
- pattern,
- flags
- }
- });
- break;
- }
+ case SyntaxKind.RegularExpressionLiteral: {
+ const pattern = node.text.slice(1, node.text.lastIndexOf('/'));
+ const flags = node.text.slice(node.text.lastIndexOf('/') + 1);
- case SyntaxKind.TrueKeyword:
- Object.assign(result, {
- type: AST_NODE_TYPES.Literal,
- value: true,
- raw: 'true'
- });
- break;
+ let regex = null;
+ try {
+ regex = new RegExp(pattern, flags);
+ } catch (exception) {
+ regex = null;
+ }
- case SyntaxKind.FalseKeyword:
- Object.assign(result, {
- type: AST_NODE_TYPES.Literal,
- value: false,
- raw: 'false'
- });
- break;
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Literal,
+ value: regex,
+ raw: node.text,
+ regex: {
+ pattern,
+ flags
+ }
+ });
+ }
- case SyntaxKind.NullKeyword: {
- if (config.inTypeMode) {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSNullKeyword
+ case SyntaxKind.TrueKeyword:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Literal,
+ value: true,
+ raw: 'true'
});
- } else {
- Object.assign(result, {
+
+ case SyntaxKind.FalseKeyword:
+ return this.createNode(node, {
type: AST_NODE_TYPES.Literal,
- value: null,
- raw: 'null'
+ value: false,
+ raw: 'false'
});
+
+ case SyntaxKind.NullKeyword: {
+ if (this.inTypeMode) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSNullKeyword
+ });
+ } else {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Literal,
+ value: null,
+ raw: 'null'
+ });
+ }
}
- break;
- }
- case SyntaxKind.ImportKeyword:
- Object.assign(result, {
- type: AST_NODE_TYPES.Import
- });
- break;
+ case SyntaxKind.ImportKeyword:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Import
+ });
- case SyntaxKind.EmptyStatement:
- case SyntaxKind.DebuggerStatement:
- Object.assign(result, {
- type: SyntaxKind[node.kind]
- });
- break;
+ case SyntaxKind.EmptyStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.EmptyStatement
+ });
- // JSX
+ case SyntaxKind.DebuggerStatement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.DebuggerStatement
+ });
- case SyntaxKind.JsxElement:
- Object.assign(result, {
- type: AST_NODE_TYPES.JSXElement,
- openingElement: convertChild(node.openingElement),
- closingElement: convertChild(node.closingElement),
- children: node.children.map(convertChild)
- });
+ // JSX
- break;
+ case SyntaxKind.JsxElement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXElement,
+ openingElement: this.convertChild(node.openingElement),
+ closingElement: this.convertChild(node.closingElement),
+ children: node.children.map(el => this.convertChild(el))
+ });
- case SyntaxKind.JsxFragment:
- Object.assign(result, {
- type: AST_NODE_TYPES.JSXFragment,
- openingFragment: convertChild(node.openingFragment),
- closingFragment: convertChild(node.closingFragment),
- children: node.children.map(convertChild)
- });
- break;
+ case SyntaxKind.JsxFragment:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXFragment,
+ openingFragment: this.convertChild(node.openingFragment),
+ closingFragment: this.convertChild(node.closingFragment),
+ children: node.children.map(el => this.convertChild(el))
+ });
- case SyntaxKind.JsxSelfClosingElement: {
- Object.assign(result, {
- type: AST_NODE_TYPES.JSXElement,
- /**
- * Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement,
- * TypeScript does not seem to have the idea of openingElement when tag is self-closing
- */
- openingElement: {
+ case SyntaxKind.JsxSelfClosingElement: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXElement,
+ /**
+ * Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement,
+ * TypeScript does not seem to have the idea of openingElement when tag is self-closing
+ */
+ openingElement: this.createNode(node, {
+ type: AST_NODE_TYPES.JSXOpeningElement,
+ typeParameters: node.typeArguments
+ ? this.convertTypeArgumentsToTypeParameters(node.typeArguments)
+ : undefined,
+ selfClosing: true,
+ name: this.convertJSXTagName(node.tagName, node),
+ attributes: node.attributes.properties.map(el =>
+ this.convertChild(el)
+ ),
+ range: getRange(node, this.ast)
+ }),
+ closingElement: null,
+ children: []
+ });
+ }
+
+ case SyntaxKind.JsxOpeningElement:
+ return this.createNode(node, {
type: AST_NODE_TYPES.JSXOpeningElement,
typeParameters: node.typeArguments
- ? convertTypeArgumentsToTypeParameters(node.typeArguments)
+ ? this.convertTypeArgumentsToTypeParameters(node.typeArguments)
: undefined,
- selfClosing: true,
- name: convertTypeScriptJSXTagNameToESTreeName(node.tagName),
- attributes: node.attributes.properties.map(convertChild),
- range: result.range,
- loc: result.loc
- },
- closingElement: null,
- children: []
- });
- break;
- }
-
- case SyntaxKind.JsxOpeningElement:
- Object.assign(result, {
- type: AST_NODE_TYPES.JSXOpeningElement,
- typeParameters: node.typeArguments
- ? convertTypeArgumentsToTypeParameters(node.typeArguments)
- : undefined,
- selfClosing: false,
- name: convertTypeScriptJSXTagNameToESTreeName(node.tagName),
- attributes: node.attributes.properties.map(convertChild)
- });
- break;
+ selfClosing: false,
+ name: this.convertJSXTagName(node.tagName, node),
+ attributes: node.attributes.properties.map(el =>
+ this.convertChild(el)
+ )
+ });
- case SyntaxKind.JsxClosingElement:
- Object.assign(result, {
- type: AST_NODE_TYPES.JSXClosingElement,
- name: convertTypeScriptJSXTagNameToESTreeName(node.tagName)
- });
- break;
+ case SyntaxKind.JsxClosingElement:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXClosingElement,
+ name: this.convertJSXTagName(node.tagName, node)
+ });
- case SyntaxKind.JsxOpeningFragment:
- Object.assign(result, {
- type: AST_NODE_TYPES.JSXOpeningFragment
- });
- break;
- case SyntaxKind.JsxClosingFragment:
- Object.assign(result, {
- type: AST_NODE_TYPES.JSXClosingFragment
- });
- break;
-
- case SyntaxKind.JsxExpression: {
- const eloc = ast.getLineAndCharacterOfPosition(result.range[0] + 1);
- const expression = node.expression
- ? convertChild(node.expression)
- : {
- type: AST_NODE_TYPES.JSXEmptyExpression,
- loc: {
- start: {
- line: eloc.line + 1,
- column: eloc.character
- },
- end: {
- line: result.loc.end.line,
- column: result.loc.end.column - 1
- }
- },
- range: [result.range[0] + 1, result.range[1] - 1]
- };
-
- Object.assign(result, {
- type: node.dotDotDotToken
- ? AST_NODE_TYPES.JSXSpreadChild
- : AST_NODE_TYPES.JSXExpressionContainer,
- expression
- });
+ case SyntaxKind.JsxOpeningFragment:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXOpeningFragment
+ });
- break;
- }
+ case SyntaxKind.JsxClosingFragment:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXClosingFragment
+ });
- case SyntaxKind.JsxAttribute: {
- const attributeName = convertToken(node.name, ast);
- attributeName.type = AST_NODE_TYPES.JSXIdentifier;
- attributeName.name = attributeName.value;
- delete attributeName.value;
+ case SyntaxKind.JsxExpression: {
+ const expression = node.expression
+ ? this.convertChild(node.expression)
+ : this.createNode(node, {
+ type: AST_NODE_TYPES.JSXEmptyExpression,
+ range: [node.getStart(this.ast) + 1, node.getEnd() - 1]
+ });
- Object.assign(result, {
- type: AST_NODE_TYPES.JSXAttribute,
- name: attributeName,
- value: convertChild(node.initializer)
- });
+ if (node.dotDotDotToken) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXSpreadChild,
+ expression
+ });
+ } else {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXExpressionContainer,
+ expression
+ });
+ }
+ }
- break;
- }
+ case SyntaxKind.JsxAttribute: {
+ const attributeName = this.convertChild(node.name);
+ attributeName.type = AST_NODE_TYPES.JSXIdentifier;
- /**
- * The JSX AST changed the node type for string literals
- * inside a JSX Element from `Literal` to `JSXText`. We
- * provide a flag to support both types until `Literal`
- * node type is deprecated in ESLint v5.
- */
- case SyntaxKind.JsxText: {
- const start = node.getFullStart();
- const end = node.getEnd();
-
- const type = additionalOptions.useJSXTextNode
- ? AST_NODE_TYPES.JSXText
- : AST_NODE_TYPES.Literal;
-
- Object.assign(result, {
- type,
- value: ast.text.slice(start, end),
- raw: ast.text.slice(start, end)
- });
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXAttribute,
+ name: attributeName,
+ value: this.convertChild(node.initializer)
+ });
+ }
- result.loc = getLocFor(start, end, ast);
- result.range = [start, end];
+ /**
+ * The JSX AST changed the node type for string literals
+ * inside a JSX Element from `Literal` to `JSXText`. We
+ * provide a flag to support both types until `Literal`
+ * node type is deprecated in ESLint v5.
+ */
+ case SyntaxKind.JsxText: {
+ const start = node.getFullStart();
+ const end = node.getEnd();
+
+ if (this.options.useJSXTextNode) {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXText,
+ value: this.ast.text.slice(start, end),
+ raw: this.ast.text.slice(start, end),
+ range: [start, end]
+ });
+ } else {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.Literal,
+ value: this.ast.text.slice(start, end),
+ raw: this.ast.text.slice(start, end),
+ range: [start, end]
+ });
+ }
+ }
- break;
- }
+ case SyntaxKind.JsxSpreadAttribute:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.JSXSpreadAttribute,
+ argument: this.convertChild(node.expression)
+ });
- case SyntaxKind.JsxSpreadAttribute:
- Object.assign(result, {
- type: AST_NODE_TYPES.JSXSpreadAttribute,
- argument: convertChild(node.expression)
- });
- break;
+ case SyntaxKind.QualifiedName: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSQualifiedName,
+ left: this.convertChild(node.left),
+ right: this.convertChild(node.right)
+ });
+ }
- case SyntaxKind.QualifiedName: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSQualifiedName,
- left: convertChild(node.left),
- right: convertChild(node.right)
- });
- break;
- }
+ // TypeScript specific
- // TypeScript specific
+ case SyntaxKind.TypeReference: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSTypeReference,
+ typeName: this.convertType(node.typeName),
+ typeParameters: node.typeArguments
+ ? this.convertTypeArgumentsToTypeParameters(node.typeArguments)
+ : undefined
+ });
+ }
- case SyntaxKind.TypeReference: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSTypeReference,
- typeName: convertChildType(node.typeName),
- typeParameters: node.typeArguments
- ? convertTypeArgumentsToTypeParameters(node.typeArguments)
- : undefined
- });
- break;
- }
+ case SyntaxKind.TypeParameter: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSTypeParameter,
+ name: this.convertType(node.name),
+ constraint: node.constraint
+ ? this.convertType(node.constraint)
+ : undefined,
+ default: node.default ? this.convertType(node.default) : undefined
+ });
+ }
- case SyntaxKind.TypeParameter: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSTypeParameter,
- name: convertChildType(node.name),
- constraint: node.constraint
- ? convertChildType(node.constraint)
- : undefined,
- default: node.default ? convertChildType(node.default) : undefined
- });
- break;
- }
+ case SyntaxKind.ThisType:
+ case SyntaxKind.AnyKeyword:
+ case SyntaxKind.BigIntKeyword:
+ case SyntaxKind.BooleanKeyword:
+ case SyntaxKind.NeverKeyword:
+ case SyntaxKind.NumberKeyword:
+ case SyntaxKind.ObjectKeyword:
+ case SyntaxKind.StringKeyword:
+ case SyntaxKind.SymbolKeyword:
+ case SyntaxKind.UnknownKeyword:
+ case SyntaxKind.VoidKeyword:
+ case SyntaxKind.UndefinedKeyword: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES[`TS${SyntaxKind[node.kind]}` as AST_NODE_TYPES]
+ });
+ }
- case SyntaxKind.ThisType:
- case SyntaxKind.AnyKeyword:
- case SyntaxKind.BigIntKeyword:
- case SyntaxKind.BooleanKeyword:
- case SyntaxKind.NeverKeyword:
- case SyntaxKind.NumberKeyword:
- case SyntaxKind.ObjectKeyword:
- case SyntaxKind.StringKeyword:
- case SyntaxKind.SymbolKeyword:
- case SyntaxKind.UnknownKeyword:
- case SyntaxKind.VoidKeyword:
- case SyntaxKind.UndefinedKeyword: {
- Object.assign(result, {
- type: AST_NODE_TYPES[`TS${SyntaxKind[node.kind]}` as AST_NODE_TYPES]
- });
- break;
- }
+ case SyntaxKind.NonNullExpression: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSNonNullExpression,
+ expression: this.convertChild(node.expression)
+ });
+ }
- case SyntaxKind.NonNullExpression: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSNonNullExpression,
- expression: convertChild(node.expression)
- });
- break;
- }
+ case SyntaxKind.TypeLiteral: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSTypeLiteral,
+ members: node.members.map(el => this.convertChild(el))
+ });
+ }
- case SyntaxKind.TypeLiteral: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSTypeLiteral,
- members: node.members.map(convertChild)
- });
- break;
- }
+ case SyntaxKind.ArrayType: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSArrayType,
+ elementType: this.convertType(node.elementType)
+ });
+ }
- case SyntaxKind.ArrayType: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSArrayType,
- elementType: convertChildType(node.elementType)
- });
- break;
- }
+ case SyntaxKind.IndexedAccessType: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSIndexedAccessType,
+ objectType: this.convertType(node.objectType),
+ indexType: this.convertType(node.indexType)
+ });
+ }
- case SyntaxKind.IndexedAccessType: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSIndexedAccessType,
- objectType: convertChildType(node.objectType),
- indexType: convertChildType(node.indexType)
- });
- break;
- }
+ case SyntaxKind.ConditionalType: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSConditionalType,
+ checkType: this.convertType(node.checkType),
+ extendsType: this.convertType(node.extendsType),
+ trueType: this.convertType(node.trueType),
+ falseType: this.convertType(node.falseType)
+ });
+ }
- case SyntaxKind.ConditionalType: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSConditionalType,
- checkType: convertChildType(node.checkType),
- extendsType: convertChildType(node.extendsType),
- trueType: convertChildType(node.trueType),
- falseType: convertChildType(node.falseType)
- });
- break;
- }
+ case SyntaxKind.TypeQuery: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSTypeQuery,
+ exprName: this.convertType(node.exprName)
+ });
+ }
- case SyntaxKind.TypeQuery: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSTypeQuery,
- exprName: convertChildType(node.exprName)
- });
- break;
- }
+ case SyntaxKind.MappedType: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TSMappedType,
+ typeParameter: this.convertType(node.typeParameter)
+ });
- case SyntaxKind.MappedType: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSMappedType,
- typeParameter: convertChildType(node.typeParameter)
- });
+ if (node.readonlyToken) {
+ if (node.readonlyToken.kind === SyntaxKind.ReadonlyKeyword) {
+ result.readonly = true;
+ } else {
+ result.readonly = getTextForTokenKind(node.readonlyToken.kind) as
+ | '+'
+ | '-';
+ }
+ }
- if (node.readonlyToken) {
- if (node.readonlyToken.kind === SyntaxKind.ReadonlyKeyword) {
- result.readonly = true;
- } else {
- result.readonly = getTextForTokenKind(node.readonlyToken.kind);
+ if (node.questionToken) {
+ if (node.questionToken.kind === SyntaxKind.QuestionToken) {
+ result.optional = true;
+ } else {
+ result.optional = getTextForTokenKind(node.questionToken.kind) as
+ | '+'
+ | '-';
+ }
}
- }
- if (node.questionToken) {
- if (node.questionToken.kind === SyntaxKind.QuestionToken) {
- result.optional = true;
- } else {
- result.optional = getTextForTokenKind(node.questionToken.kind);
+ if (node.type) {
+ result.typeAnnotation = this.convertType(node.type);
}
+ return result;
}
- if (node.type) {
- result.typeAnnotation = convertChildType(node.type);
- }
- break;
- }
+ case SyntaxKind.ParenthesizedExpression:
+ return this.convertChild(node.expression, parent);
- case SyntaxKind.ParenthesizedExpression:
- return convert({
- node: node.expression,
- parent,
- ast,
- additionalOptions
- });
+ case SyntaxKind.TypeAliasDeclaration: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TSTypeAliasDeclaration,
+ id: this.convertChild(node.name),
+ typeAnnotation: this.convertType(node.type)
+ });
- case SyntaxKind.TypeAliasDeclaration: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSTypeAliasDeclaration,
- id: convertChild(node.name),
- typeAnnotation: convertChildType(node.type)
- });
+ if (hasModifier(SyntaxKind.DeclareKeyword, node)) {
+ result.declare = true;
+ }
- if (hasModifier(SyntaxKind.DeclareKeyword, node)) {
- result.declare = true;
- }
+ // Process typeParameters
+ if (node.typeParameters) {
+ result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters
+ );
+ }
- // Process typeParameters
- if (node.typeParameters && node.typeParameters.length) {
- result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters
- );
+ // check for exports
+ return fixExports(node, result, this.ast);
}
- // check for exports
- result = fixExports(node, result, ast);
- break;
- }
+ case SyntaxKind.MethodSignature: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TSMethodSignature,
+ computed: isComputedProperty(node.name),
+ key: this.convertChild(node.name),
+ params: this.convertParameters(node.parameters)
+ });
- case SyntaxKind.MethodSignature: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSMethodSignature,
- computed: isComputedProperty(node.name),
- key: convertChild(node.name),
- params: convertParameters(node.parameters)
- });
+ if (isOptional(node)) {
+ result.optional = true;
+ }
- if (isOptional(node)) {
- result.optional = true;
- }
+ if (node.type) {
+ result.returnType = this.convertTypeAnnotation(node.type, node);
+ }
- if (node.type) {
- result.returnType = convertTypeAnnotation(node.type);
- }
+ if (hasModifier(SyntaxKind.ReadonlyKeyword, node)) {
+ result.readonly = true;
+ }
- if (hasModifier(SyntaxKind.ReadonlyKeyword, node)) {
- result.readonly = true;
- }
+ if (node.typeParameters) {
+ result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters
+ );
+ }
- if (node.typeParameters) {
- result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters
- );
- }
+ const accessibility = getTSNodeAccessibility(node);
+ if (accessibility) {
+ result.accessibility = accessibility;
+ }
- const accessibility = getTSNodeAccessibility(node);
- if (accessibility) {
- result.accessibility = accessibility;
- }
+ if (hasModifier(SyntaxKind.ExportKeyword, node)) {
+ result.export = true;
+ }
- if (hasModifier(SyntaxKind.ExportKeyword, node)) {
- result.export = true;
+ if (hasModifier(SyntaxKind.StaticKeyword, node)) {
+ result.static = true;
+ }
+ return result;
}
- if (hasModifier(SyntaxKind.StaticKeyword, node)) {
- result.static = true;
- }
- break;
- }
+ case SyntaxKind.PropertySignature: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TSPropertySignature,
+ optional: isOptional(node) || undefined,
+ computed: isComputedProperty(node.name),
+ key: this.convertChild(node.name),
+ typeAnnotation: node.type
+ ? this.convertTypeAnnotation(node.type, node)
+ : undefined,
+ initializer: this.convertChild(node.initializer) || undefined,
+ readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined,
+ static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined,
+ export: hasModifier(SyntaxKind.ExportKeyword, node) || undefined
+ });
- case SyntaxKind.PropertySignature: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSPropertySignature,
- optional: isOptional(node) || undefined,
- computed: isComputedProperty(node.name),
- key: convertChild(node.name),
- typeAnnotation: node.type
- ? convertTypeAnnotation(node.type)
- : undefined,
- initializer: convertChild(node.initializer) || undefined,
- readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined,
- static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined,
- export: hasModifier(SyntaxKind.ExportKeyword, node) || undefined
- });
+ const accessibility = getTSNodeAccessibility(node);
+ if (accessibility) {
+ result.accessibility = accessibility;
+ }
- const accessibility = getTSNodeAccessibility(node);
- if (accessibility) {
- result.accessibility = accessibility;
+ return result;
}
- break;
- }
+ case SyntaxKind.IndexSignature: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TSIndexSignature,
+ parameters: node.parameters.map(el => this.convertChild(el))
+ });
- case SyntaxKind.IndexSignature: {
- Object.assign(result, {
- type: AST_NODE_TYPES.TSIndexSignature,
- parameters: node.parameters.map(convertChild)
- });
+ if (node.type) {
+ result.typeAnnotation = this.convertTypeAnnotation(node.type, node);
+ }
- if (node.type) {
- result.typeAnnotation = convertTypeAnnotation(node.type);
- }
+ if (hasModifier(SyntaxKind.ReadonlyKeyword, node)) {
+ result.readonly = true;
+ }
- if (hasModifier(SyntaxKind.ReadonlyKeyword, node)) {
- result.readonly = true;
- }
+ const accessibility = getTSNodeAccessibility(node);
+ if (accessibility) {
+ result.accessibility = accessibility;
+ }
- const accessibility = getTSNodeAccessibility(node);
- if (accessibility) {
- result.accessibility = accessibility;
- }
+ if (hasModifier(SyntaxKind.ExportKeyword, node)) {
+ result.export = true;
+ }
- if (hasModifier(SyntaxKind.ExportKeyword, node)) {
- result.export = true;
- }
+ if (hasModifier(SyntaxKind.StaticKeyword, node)) {
+ result.static = true;
+ }
+ return result;
+ }
+ case SyntaxKind.ConstructorType:
+ case SyntaxKind.FunctionType:
+ case SyntaxKind.ConstructSignature:
+ case SyntaxKind.CallSignature: {
+ let type: AST_NODE_TYPES;
+ switch (node.kind) {
+ case SyntaxKind.ConstructSignature:
+ type = AST_NODE_TYPES.TSConstructSignatureDeclaration;
+ break;
+ case SyntaxKind.CallSignature:
+ type = AST_NODE_TYPES.TSCallSignatureDeclaration;
+ break;
+ case SyntaxKind.FunctionType:
+ type = AST_NODE_TYPES.TSFunctionType;
+ break;
+ case SyntaxKind.ConstructorType:
+ default:
+ type = AST_NODE_TYPES.TSConstructorType;
+ break;
+ }
+ const result = this.createNode<
+ | TSESTree.TSConstructSignatureDeclaration
+ | TSESTree.TSCallSignatureDeclaration
+ | TSESTree.TSFunctionType
+ | TSESTree.TSConstructorType
+ >(node, {
+ type: type,
+ params: this.convertParameters(node.parameters)
+ });
- if (hasModifier(SyntaxKind.StaticKeyword, node)) {
- result.static = true;
- }
- break;
- }
- case SyntaxKind.ConstructorType:
- case SyntaxKind.FunctionType:
- case SyntaxKind.ConstructSignature:
- case SyntaxKind.CallSignature: {
- let type: AST_NODE_TYPES;
- switch (node.kind) {
- case SyntaxKind.ConstructSignature:
- type = AST_NODE_TYPES.TSConstructSignatureDeclaration;
- break;
- case SyntaxKind.CallSignature:
- type = AST_NODE_TYPES.TSCallSignatureDeclaration;
- break;
- case SyntaxKind.FunctionType:
- type = AST_NODE_TYPES.TSFunctionType;
- break;
- case SyntaxKind.ConstructorType:
- default:
- type = AST_NODE_TYPES.TSConstructorType;
- break;
- }
- Object.assign(result, {
- type: type,
- params: convertParameters(node.parameters)
- });
+ if (node.type) {
+ result.returnType = this.convertTypeAnnotation(node.type, node);
+ }
- if (node.type) {
- result.returnType = convertTypeAnnotation(node.type);
- }
+ if (node.typeParameters) {
+ result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters
+ );
+ }
- if (node.typeParameters) {
- result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters
- );
+ return result;
}
- break;
- }
-
- case SyntaxKind.ExpressionWithTypeArguments: {
- Object.assign(result, {
- type:
- parent && parent.kind === SyntaxKind.InterfaceDeclaration
- ? AST_NODE_TYPES.TSInterfaceHeritage
- : AST_NODE_TYPES.TSClassImplements,
- expression: convertChild(node.expression)
- });
-
- if (node.typeArguments && node.typeArguments.length) {
- result.typeParameters = convertTypeArgumentsToTypeParameters(
- node.typeArguments
- );
- }
- break;
- }
+ case SyntaxKind.ExpressionWithTypeArguments: {
+ const result = this.createNode<
+ TSESTree.TSInterfaceHeritage | TSESTree.TSClassImplements
+ >(node, {
+ type:
+ parent && parent.kind === SyntaxKind.InterfaceDeclaration
+ ? AST_NODE_TYPES.TSInterfaceHeritage
+ : AST_NODE_TYPES.TSClassImplements,
+ expression: this.convertChild(node.expression)
+ });
- case SyntaxKind.InterfaceDeclaration: {
- const interfaceHeritageClauses = node.heritageClauses || [];
+ if (node.typeArguments) {
+ result.typeParameters = this.convertTypeArgumentsToTypeParameters(
+ node.typeArguments
+ );
+ }
+ return result;
+ }
+
+ case SyntaxKind.InterfaceDeclaration: {
+ const interfaceHeritageClauses = node.heritageClauses || [];
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TSInterfaceDeclaration,
+ body: this.createNode(node, {
+ type: AST_NODE_TYPES.TSInterfaceBody,
+ body: node.members.map(member => this.convertChild(member)),
+ range: [node.members.pos - 1, node.end]
+ }),
+ id: this.convertChild(node.name)
+ });
- let interfaceLastClassToken = interfaceHeritageClauses.length
- ? interfaceHeritageClauses[interfaceHeritageClauses.length - 1]
- : node.name;
+ if (node.typeParameters) {
+ result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters
+ );
+ }
- if (node.typeParameters && node.typeParameters.length) {
- const interfaceLastTypeParameter =
- node.typeParameters[node.typeParameters.length - 1];
+ if (interfaceHeritageClauses.length > 0) {
+ const interfaceExtends = [];
+ const interfaceImplements = [];
- if (
- !interfaceLastClassToken ||
- interfaceLastTypeParameter.pos > interfaceLastClassToken.pos
- ) {
- interfaceLastClassToken = findNextToken(
- interfaceLastTypeParameter,
- ast,
- ast
- ) as any;
- }
- result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters
- );
- }
+ for (const heritageClause of interfaceHeritageClauses) {
+ if (heritageClause.token === SyntaxKind.ExtendsKeyword) {
+ for (const n of heritageClause.types) {
+ interfaceExtends.push(this.convertChild(n, node));
+ }
+ } else if (heritageClause.token === SyntaxKind.ImplementsKeyword) {
+ for (const n of heritageClause.types) {
+ interfaceImplements.push(this.convertChild(n, node));
+ }
+ }
+ }
- const interfaceOpenBrace = findNextToken(
- interfaceLastClassToken,
- ast,
- ast
- )!;
+ if (interfaceExtends.length) {
+ result.extends = interfaceExtends;
+ }
- const interfaceBody = {
- type: AST_NODE_TYPES.TSInterfaceBody,
- body: node.members.map(member => convertChild(member)),
- range: [interfaceOpenBrace.getStart(ast), node.end],
- loc: getLocFor(interfaceOpenBrace.getStart(ast), node.end, ast)
- };
+ if (interfaceImplements.length) {
+ result.implements = interfaceImplements;
+ }
+ }
- Object.assign(result, {
- type: AST_NODE_TYPES.TSInterfaceDeclaration,
- body: interfaceBody,
- id: convertChild(node.name)
- });
+ /**
+ * Semantically, decorators are not allowed on interface declarations,
+ * but the TypeScript compiler will parse them and produce a valid AST,
+ * so we handle them here too.
+ */
+ if (node.decorators) {
+ result.decorators = node.decorators.map(el => this.convertChild(el));
+ }
+ if (hasModifier(SyntaxKind.AbstractKeyword, node)) {
+ result.abstract = true;
+ }
+ if (hasModifier(SyntaxKind.DeclareKeyword, node)) {
+ result.declare = true;
+ }
+ // check for exports
+ return fixExports(node, result, this.ast);
+ }
- if (interfaceHeritageClauses.length > 0) {
- const interfaceExtends = [];
- const interfaceImplements = [];
+ case SyntaxKind.FirstTypeNode: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TSTypePredicate,
+ parameterName: this.convertChild(node.parameterName),
+ typeAnnotation: this.convertTypeAnnotation(node.type, node)
+ });
+ /**
+ * Specific fix for type-guard location data
+ */
+ result.typeAnnotation.loc = result.typeAnnotation.typeAnnotation.loc;
+ result.typeAnnotation.range =
+ result.typeAnnotation.typeAnnotation.range;
+ return result;
+ }
+
+ case SyntaxKind.ImportType:
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSImportType,
+ isTypeOf: !!node.isTypeOf,
+ parameter: this.convertChild(node.argument),
+ qualifier: this.convertChild(node.qualifier),
+ typeParameters: node.typeArguments
+ ? this.convertTypeArgumentsToTypeParameters(node.typeArguments)
+ : null
+ });
- for (const heritageClause of interfaceHeritageClauses) {
- if (heritageClause.token === SyntaxKind.ExtendsKeyword) {
- for (const n of heritageClause.types) {
- interfaceExtends.push(convertChild(n));
- }
- } else if (heritageClause.token === SyntaxKind.ImplementsKeyword) {
- for (const n of heritageClause.types) {
- interfaceImplements.push(convertChild(n));
- }
- }
+ case SyntaxKind.EnumDeclaration: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TSEnumDeclaration,
+ id: this.convertChild(node.name),
+ members: node.members.map(el => this.convertChild(el))
+ });
+ // apply modifiers first...
+ this.applyModifiersToResult(result, node.modifiers);
+ /**
+ * Semantically, decorators are not allowed on enum declarations,
+ * but the TypeScript compiler will parse them and produce a valid AST,
+ * so we handle them here too.
+ */
+ if (node.decorators) {
+ result.decorators = node.decorators.map(el => this.convertChild(el));
}
+ // ...then check for exports
+ return fixExports(node, result, this.ast);
+ }
- if (interfaceExtends.length) {
- result.extends = interfaceExtends;
+ case SyntaxKind.EnumMember: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TSEnumMember,
+ id: this.convertChild(node.name)
+ });
+ if (node.initializer) {
+ result.initializer = this.convertChild(node.initializer);
}
+ return result;
+ }
- if (interfaceImplements.length) {
- result.implements = interfaceImplements;
+ case SyntaxKind.ModuleDeclaration: {
+ const result = this.createNode(node, {
+ type: AST_NODE_TYPES.TSModuleDeclaration,
+ id: this.convertChild(node.name)
+ });
+ if (node.body) {
+ result.body = this.convertChild(node.body);
}
+ // apply modifiers first...
+ this.applyModifiersToResult(result, node.modifiers);
+ if (node.flags & ts.NodeFlags.GlobalAugmentation) {
+ result.global = true;
+ }
+ // ...then check for exports
+ return fixExports(node, result, this.ast);
}
- /**
- * Semantically, decorators are not allowed on interface declarations,
- * but the TypeScript compiler will parse them and produce a valid AST,
- * so we handle them here too.
- */
- if (node.decorators) {
- result.decorators = node.decorators.map(convertChild);
+ // TypeScript specific types
+ case SyntaxKind.OptionalType: {
+ return this.createNode(node, {
+ type: AST_NODE_TYPES.TSOptionalType,
+ typeAnnotation: this.convertType(node.type)
+ });
}
- if (hasModifier(SyntaxKind.AbstractKeyword, node)) {
- result.abstract = true;
+ case SyntaxKind.ParenthesizedType: {
+ return this.createNode