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

- Travis + Azure Pipelines GitHub license - NPM Version - NPM Downloads + NPM Downloads + Codecov Commitizen friendly

@@ -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: + +NPM Version + +The `canary` (latest master) version is: + +NPM Version ## 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

-[![Travis](https://img.shields.io/travis/JamesHenry/eslint-plugin-tslint.svg?style=flat-square)](https://travis-ci.org/JamesHenry/eslint-plugin-tslint) -[![GitHub license](https://img.shields.io/npm/l/eslint-plugin-tslint.svg?style=flat-square)](https://github.com/JamesHenry/eslint-plugin-tslint/blob/master/LICENSE) -[![NPM Version](https://img.shields.io/npm/v/eslint-plugin-tslint.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-tslint) -[![NPM Downloads](https://img.shields.io/npm/dt/eslint-plugin-tslint.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-tslint) -[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) -[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) -[![greenkeeper.io](https://badges.greenkeeper.io/JamesHenry/mongoose-schema-to-typescript-interface.svg?style=flat-square)](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. +

+ Azure Pipelines + GitHub license + NPM Version + NPM Downloads + Commitizen friendly +

-## 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 - -[![NPM version](https://img.shields.io/npm/v/eslint-plugin-typescript.svg)](https://www.npmjs.com/package/eslint-plugin-typescript) -[![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-typescript.svg)](https://www.npmjs.com/package/eslint-plugin-typescript) -[![TravisCI](https://img.shields.io/travis/bradzacher/eslint-plugin-typescript.svg)](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

+ +

+ Azure Pipelines + GitHub license + NPM Version + NPM Downloads + Commitizen friendly +

+ +## 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.

+ +

+ Azure Pipelines + GitHub license + NPM Version + NPM Downloads + Commitizen friendly +

+ +## 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

- Travis - GitHub license - NPM Version - NPM Downloads - Commitizen friendly - semantic-release + Azure Pipelines + GitHub license + NPM Version + NPM Downloads + Commitizen friendly


@@ -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(node, { + type: AST_NODE_TYPES.TSParenthesizedType, + typeAnnotation: this.convertType(node.type) + }); } - if (hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; + case SyntaxKind.TupleType: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSTupleType, + elementTypes: node.elementTypes.map(el => this.convertType(el)) + }); } - // check for exports - result = fixExports(node, result, ast); - - break; - } - - case SyntaxKind.FirstTypeNode: - Object.assign(result, { - type: AST_NODE_TYPES.TSTypePredicate, - parameterName: convertChild(node.parameterName), - typeAnnotation: convertTypeAnnotation(node.type) - }); - /** - * Specific fix for type-guard location data - */ - result.typeAnnotation!.loc = result.typeAnnotation!.typeAnnotation!.loc; - result.typeAnnotation!.range = result.typeAnnotation!.typeAnnotation!.range; - break; - - case SyntaxKind.ImportType: - Object.assign(result, { - type: AST_NODE_TYPES.TSImportType, - isTypeOf: !!node.isTypeOf, - parameter: convertChild(node.argument), - qualifier: convertChild(node.qualifier), - typeParameters: node.typeArguments - ? convertTypeArgumentsToTypeParameters(node.typeArguments) - : null - }); - break; - - case SyntaxKind.EnumDeclaration: { - Object.assign(result, { - type: AST_NODE_TYPES.TSEnumDeclaration, - id: convertChild(node.name), - members: node.members.map(convertChild) - }); - // apply modifiers first... - applyModifiersToResult(node.modifiers); - // ...then check for exports - result = fixExports(node, result, ast); - /** - * 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(convertChild); + case SyntaxKind.UnionType: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSUnionType, + types: node.types.map(el => this.convertType(el)) + }); } - break; - } - - case SyntaxKind.EnumMember: { - Object.assign(result, { - type: AST_NODE_TYPES.TSEnumMember, - id: convertChild(node.name) - }); - if (node.initializer) { - (result as any).initializer = convertChild(node.initializer); + case SyntaxKind.IntersectionType: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSIntersectionType, + types: node.types.map(el => this.convertType(el)) + }); } - break; - } - - case SyntaxKind.AbstractKeyword: { - Object.assign(result, { - type: AST_NODE_TYPES.TSAbstractKeyword - }); - break; - } - - case SyntaxKind.ModuleDeclaration: { - Object.assign(result, { - type: AST_NODE_TYPES.TSModuleDeclaration, - id: convertChild(node.name) - }); - if (node.body) { - result.body = convertChild(node.body); + case SyntaxKind.RestType: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSRestType, + typeAnnotation: this.convertType(node.type) + }); } - // apply modifiers first... - applyModifiersToResult(node.modifiers); - if (node.flags & ts.NodeFlags.GlobalAugmentation) { - result.global = true; + case SyntaxKind.AsExpression: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSAsExpression, + expression: this.convertChild(node.expression), + typeAnnotation: this.convertType(node.type) + }); } - // ...then check for exports - result = fixExports(node, result, ast); - break; - } - - // TypeScript specific types - case SyntaxKind.OptionalType: { - Object.assign(result, { - type: AST_NODE_TYPES.TSOptionalType, - typeAnnotation: convertChildType(node.type) - }); - break; - } - case SyntaxKind.ParenthesizedType: { - Object.assign(result, { - type: AST_NODE_TYPES.TSParenthesizedType, - typeAnnotation: convertChildType(node.type) - }); - break; - } - case SyntaxKind.TupleType: { - Object.assign(result, { - type: AST_NODE_TYPES.TSTupleType, - elementTypes: node.elementTypes.map(convertChildType) - }); - break; - } - case SyntaxKind.UnionType: { - Object.assign(result, { - type: AST_NODE_TYPES.TSUnionType, - types: node.types.map(convertChildType) - }); - break; - } - case SyntaxKind.IntersectionType: { - Object.assign(result, { - type: AST_NODE_TYPES.TSIntersectionType, - types: node.types.map(convertChildType) - }); - break; - } - case SyntaxKind.RestType: { - Object.assign(result, { - type: AST_NODE_TYPES.TSRestType, - typeAnnotation: convertChildType(node.type) - }); - break; - } - case SyntaxKind.AsExpression: { - Object.assign(result, { - type: AST_NODE_TYPES.TSAsExpression, - expression: convertChild(node.expression), - typeAnnotation: convertChildType(node.type) - }); - break; - } - case SyntaxKind.InferType: { - Object.assign(result, { - type: AST_NODE_TYPES.TSInferType, - typeParameter: convertChildType(node.typeParameter) - }); - break; - } - case SyntaxKind.LiteralType: { - Object.assign(result, { - type: AST_NODE_TYPES.TSLiteralType, - literal: convertChildType(node.literal) - }); - break; - } - case SyntaxKind.TypeAssertionExpression: { - Object.assign(result, { - type: AST_NODE_TYPES.TSTypeAssertion, - typeAnnotation: convertChildType(node.type), - expression: convertChild(node.expression) - }); - break; - } - case SyntaxKind.ImportEqualsDeclaration: { - Object.assign(result, { - type: AST_NODE_TYPES.TSImportEqualsDeclaration, - id: convertChild(node.name), - moduleReference: convertChild(node.moduleReference), - isExport: hasModifier(SyntaxKind.ExportKeyword, node) - }); - break; - } - case SyntaxKind.ExternalModuleReference: { - Object.assign(result, { - type: AST_NODE_TYPES.TSExternalModuleReference, - expression: convertChild(node.expression) - }); - break; - } - case SyntaxKind.NamespaceExportDeclaration: { - Object.assign(result, { - type: AST_NODE_TYPES.TSNamespaceExportDeclaration, - id: convertChild(node.name) - }); - break; + case SyntaxKind.InferType: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSInferType, + typeParameter: this.convertType(node.typeParameter) + }); + } + case SyntaxKind.LiteralType: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSLiteralType, + literal: this.convertType(node.literal) + }); + } + case SyntaxKind.TypeAssertionExpression: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSTypeAssertion, + typeAnnotation: this.convertType(node.type), + expression: this.convertChild(node.expression) + }); + } + case SyntaxKind.ImportEqualsDeclaration: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSImportEqualsDeclaration, + id: this.convertChild(node.name), + moduleReference: this.convertChild(node.moduleReference), + isExport: hasModifier(SyntaxKind.ExportKeyword, node) + }); + } + case SyntaxKind.ExternalModuleReference: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSExternalModuleReference, + expression: this.convertChild(node.expression) + }); + } + case SyntaxKind.NamespaceExportDeclaration: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSNamespaceExportDeclaration, + id: this.convertChild(node.name) + }); + } + case SyntaxKind.AbstractKeyword: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSAbstractKeyword + }); + } + default: + return this.deeplyCopy(node); } - - default: - deeplyCopy(); } - - if (additionalOptions.shouldProvideParserServices) { - tsNodeToESTreeNodeMap.set(node, result); - esTreeNodeToTSNodeMap.set(result, node); - } - - return result; } diff --git a/packages/typescript-estree/src/estree/experimental.ts b/packages/typescript-estree/src/estree/experimental.ts deleted file mode 100644 index 103d9ffd53a5..000000000000 --- a/packages/typescript-estree/src/estree/experimental.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Node, Expression, MethodDefinition, Property, Class } from './spec'; - -/** - * Decorator - */ -export interface Decorator extends Node { - type: 'Decorator'; - expression: Expression; -} - -/** - * MethodDefinition - */ -export interface ExtendedMethodDefinition extends MethodDefinition { - decorators: Decorator[]; -} - -/** - * Property - */ -export interface ExtendedProperty extends Property { - decorators: Decorator[]; -} - -/** - * Class - */ -export interface ExtendedClass extends Class { - decorators: Decorator[]; -} diff --git a/packages/typescript-estree/src/estree/extensions.ts b/packages/typescript-estree/src/estree/extensions.ts deleted file mode 100644 index 5e036917a3b3..000000000000 --- a/packages/typescript-estree/src/estree/extensions.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Based on https://github.com/estree/estree/blob/master/extensions/type-annotations.md - */ - -import { - Identifier, - Function, - ObjectPattern, - ArrayPattern, - RestElement -} from './spec'; - -/** - * Type Annotations - */ - -/** - * Any type annotation. - */ -export interface TypeAnnotation extends Node {} - -/** - * Identifier - * - * The `typeAnnotation` property is used only in the case of variable declarations with type annotations or function arguments with type annotations. - */ -export interface ExtendedIdentifier extends Identifier { - typeAnnotation: TypeAnnotation | null; -} - -/** - * Functions - * - * The `returnType` property is used to specify the type annotation for the return value of the function. - */ -export interface ExtendedFunction extends Function { - returnType: TypeAnnotation | null; -} - -/** - * Patterns - */ - -/** - * ObjectPattern - */ -export interface ExtendedObjectPattern extends ObjectPattern { - typeAnnotation: TypeAnnotation | null; -} - -/** - * ArrayPattern - */ -export interface ExtendedArrayPattern extends ArrayPattern { - typeAnnotation: TypeAnnotation | null; -} - -/** - * RestElement - */ -export interface ExtendedRestElement extends RestElement { - typeAnnotation: TypeAnnotation | null; -} diff --git a/packages/typescript-estree/src/estree/spec.ts b/packages/typescript-estree/src/estree/spec.ts deleted file mode 100644 index 1d2a0a765ee6..000000000000 --- a/packages/typescript-estree/src/estree/spec.ts +++ /dev/null @@ -1,985 +0,0 @@ -/** - * This document specifies the core ESTree AST node types based on: - * - ES5: https://github.com/estree/estree/blob/master/es5.md - * - ES2015: https://github.com/estree/estree/blob/master/es2015.md - * - ES2016: https://github.com/estree/estree/blob/master/es2016.md - * - ES2017: https://github.com/estree/estree/blob/master/es2017.md - * - ES2018: https://github.com/estree/estree/blob/master/es2018.md - */ - -/** - * Node objects - * - * ESTree AST nodes are represented as `Node` objects, which may have any prototype inheritance but which implement the following interface: - */ - -export interface Node { - type: string; - loc: SourceLocation | null; -} - -/** - * The `type` field is a string representing the AST variant type. Each subtype of `Node` is documented below with the specific string of its `type` field. You can use this field to determine which interface a node implements. - * - * The `loc` field represents the source location information of the node. If the node contains no information about the source location, the field is `null`; otherwise it is an object consisting of a start position (the position of the first character of the parsed source region) and an end position (the position of the first character after the parsed source region): - */ -export interface SourceLocation { - source: string | null; - start: Position; - end: Position; -} - -/** - * Each `Position` object consists of a `line` number (1-indexed) and a `column` number (0-indexed): - */ -export interface Position { - line: number; // >= 1 - column: number; // >= 0 -} - -/** - * Identifier - * - * An identifier. Note that an identifier may be an expression or a destructuring pattern. - */ -export interface Identifier extends Expression, Pattern { - type: 'Identifier'; - name: string; -} - -/** - * Literal - * - * A literal token. Note that a literal can be an expression. - */ -export interface Literal extends Expression { - type: 'Literal'; - value: string | boolean | null | number | RegExp; -} - -/** - * RegExpLiteral - * - * The `regex` property allows regexes to be represented in environments that don’t - * support certain flags such as `y` or `u`. In environments that don't support - * these flags `value` will be `null` as the regex can't be represented natively. - */ -export interface RegExpLiteral extends Literal { - regex: { - pattern: string; - flags: string; - }; -} - -/** - * Programs - * - * A complete program source tree. - * - * ES2015+ Parsers must specify sourceType as "module" if the source has been parsed as an ES6 module. Otherwise, sourceType must be "script". - */ -export interface Program extends Node { - type: 'Program'; - body: Array; - sourceType: 'script' | 'module'; -} - -/** - * Functions - * - * A function declaration or expression. - */ -export interface Function extends Node { - id: Identifier | null; - params: Pattern[]; - body: FunctionBody; - generator: boolean; - async: boolean; -} - -/** - * Statements - * - * Any statement. - */ -export interface Statement extends Node {} - -/** - * ExpressionStatement - * - * An expression statement, i.e., a statement consisting of a single expression. - */ -export interface ExpressionStatement extends Statement { - type: 'ExpressionStatement'; - expression: Expression; -} - -/** - * Directive - * - * A directive from the directive prologue of a script or function. - * The `directive` property is the raw string source of the directive without quotes. - */ -export interface Directive extends Node { - type: 'ExpressionStatement'; - expression: Literal; - directive: string; -} - -/** - * BlockStatement - * - * A block statement, i.e., a sequence of statements surrounded by braces. - */ -export interface BlockStatement extends Statement { - type: 'BlockStatement'; - body: Statement[]; -} - -/** - * FunctionBody - * - * The body of a function, which is a block statement that may begin with directives. - */ -export interface FunctionBody extends BlockStatement { - body: Array; -} - -/** - * EmptyStatement - * - * An empty statement, i.e., a solitary semicolon. - */ -export interface EmptyStatement extends Statement { - type: 'EmptyStatement'; -} - -/** - * DebuggerStatement - * - * A `debugger` statement. - */ -export interface DebuggerStatement extends Statement { - type: 'DebuggerStatement'; -} - -/** - * WithStatement - * - * A `with` statement. - */ -export interface WithStatement extends Statement { - type: 'WithStatement'; - object: Expression; - body: Statement; -} - -/** - * Control flow - */ - -/** - * ReturnStatement - * - * A `return` statement. - */ -export interface ReturnStatement extends Statement { - type: 'ReturnStatement'; - argument: Expression | null; -} - -/** - * LabeledStatement - * - * A labeled statement, i.e., a statement prefixed by a `break`/`continue` label. - */ -export interface LabeledStatement extends Statement { - type: 'LabeledStatement'; - label: Identifier; - body: Statement; -} - -/** - * BreakStatement - * - * A `break` statement. - */ -export interface BreakStatement extends Statement { - type: 'BreakStatement'; - label: Identifier | null; -} - -/** - * ContinueStatement - * - * A `continue` statement. - */ -export interface ContinueStatement extends Statement { - type: 'ContinueStatement'; - label: Identifier | null; -} - -/** - * Choice - */ - -/** - * IfStatement - * - * An `if` statement. - */ -export interface IfStatement extends Statement { - type: 'IfStatement'; - test: Expression; - consequent: Statement; - alternate: Statement | null; -} - -/** - * SwitchStatement - * - * A `switch` statement. - */ -export interface SwitchStatement extends Statement { - type: 'SwitchStatement'; - discriminant: Expression; - cases: SwitchCase[]; -} - -/** - * SwitchCase - * - * A `case` (if `test` is an `Expression`) or `default` (if `test === null`) clause in the body of a `switch` statement. - */ -export interface SwitchCase extends Node { - type: 'SwitchCase'; - test: Expression | null; - consequent: Statement[]; -} - -/** - * Exceptions - */ - -/** - * ThrowStatement - * - * A `throw` statement. - */ -export interface ThrowStatement extends Statement { - type: 'ThrowStatement'; - argument: Expression; -} - -/** - * TryStatement - * - * A `try` statement. If `handler` is `null` then `finalizer` must be a `BlockStatement`. - */ -export interface TryStatement extends Statement { - type: 'TryStatement'; - block: BlockStatement; - handler: CatchClause | null; - finalizer: BlockStatement | null; -} - -/** - * CatchClause - * - * A `catch` clause following a `try` block. - * - * The param is null if the catch binding is omitted. E.g., try { foo() } catch { bar() } - */ -export interface CatchClause extends Node { - type: 'CatchClause'; - param: Pattern | null; - body: BlockStatement; -} - -/** - * Loops - */ - -/** - * WhileStatement - * - * A `while` statement. - */ -export interface WhileStatement extends Statement { - type: 'WhileStatement'; - test: Expression; - body: Statement; -} - -/** - * DoWhileStatement - * - * A `do`/`while` statement. - */ -export interface DoWhileStatement extends Statement { - type: 'DoWhileStatement'; - body: Statement; - test: Expression; -} - -/** - * ForStatement - * - * A `for` statement. - */ -export interface ForStatement extends Statement { - type: 'ForStatement'; - init: VariableDeclaration | Expression | null; - test: Expression | null; - update: Expression | null; - body: Statement; -} - -/** - * ForInStatement - * - * A `for`/`in` statement. - */ -export interface ForInStatement extends Statement { - type: 'ForInStatement'; - left: VariableDeclaration | Pattern; - right: Expression; - body: Statement; -} - -/** - * ForOfStatement - * - * A `for`/`of` statement and for-await-of statements, e.g., for await (const x of xs) { - */ -export interface ForOfStatement { - type: 'ForOfStatement'; - left: VariableDeclaration | Pattern; - right: Expression; - body: Statement; - await: boolean; -} - -/** - * Declarations - * - * Any declaration node. Note that declarations are considered statements; this is because declarations can appear in any statement context. - */ -export interface Declaration extends Statement {} - -/** - * FunctionDeclaration - * - * A function declaration. Note that unlike in the parent interface `Function`, the `id` cannot be `null`. - */ -export interface FunctionDeclaration extends Function, Declaration { - type: 'FunctionDeclaration'; - id: Identifier; -} - -/** - * VariableDeclaration - * - * A variable declaration. - */ -export interface VariableDeclaration extends Declaration { - type: 'VariableDeclaration'; - declarations: VariableDeclarator[]; - kind: 'var' | 'let' | 'const'; -} - -/** - * VariableDeclarator - * - * A variable declarator. - */ -export interface VariableDeclarator extends Node { - type: 'VariableDeclarator'; - id: Pattern; - init: Expression | null; -} - -/** - * Expressions - * - * Any expression node. Since the left-hand side of an assignment may be any expression in general, an expression can also be a pattern. - */ -export interface Expression extends Node {} - -/** - * Super - * - * A super pseudo-expression. - */ -export interface Super extends Node { - type: 'Super'; -} - -/** - * ThisExpression - * - * A `this` expression. - */ -export interface ThisExpression extends Expression { - type: 'ThisExpression'; -} - -/** - * SpreadElement - * - * Spread expression, e.g., [head, ...iter, tail], f(head, ...iter, ...tail). - */ -export interface SpreadElement extends Node { - type: 'SpreadElement'; - argument: Expression; -} - -/** - * ArrayExpression - * - * An array expression. - */ -export interface ArrayExpression extends Expression { - type: 'ArrayExpression'; - elements: Array; -} - -/** - * ObjectExpression - * - * An object expression. - * - * Spread properties, e.g., {a: 1, ...obj, b: 2}. - */ -export interface ObjectExpression extends Expression { - type: 'ObjectExpression'; - properties: Array; -} - -/** - * Property - * - * A literal property in an object expression can have either a string or number as its `value`. Ordinary property initializers have a `kind` value `"init"`; getters and setters have the kind values `"get"` and `"set"`, respectively. - */ -export interface Property extends Node { - type: 'Property'; - key: Literal | Identifier | Expression; - value: Expression; - kind: 'init' | 'get' | 'set'; - method: boolean; - shorthand: boolean; - computed: boolean; -} - -/** - * FunctionExpression - * - * A `function` expression. - */ -export interface FunctionExpression extends Function, Expression { - type: 'FunctionExpression'; -} - -/** - * ArrowFunctionExpression - * - * A fat arrow function expression, e.g., let foo = (bar) => { / body / }. - */ -export interface ArrowFunctionExpression extends Expression { - id: Identifier | null; - params: Pattern[]; - type: 'ArrowFunctionExpression'; - body: FunctionBody | Expression; - generator: boolean; - expression: boolean; -} - -/** - * Unary operations - */ - -/** - * UnaryExpression - * - * A unary operator expression. - */ -export interface UnaryExpression extends Expression { - type: 'UnaryExpression'; - operator: UnaryOperator; - prefix: boolean; - argument: Expression; -} - -/** - * UnaryOperator - * - * A unary operator token. - */ -export type UnaryOperator = - | '-' - | '+' - | '!' - | '~' - | 'typeof' - | 'void' - | 'delete'; - -/** - * UpdateExpression - * - * An update (increment or decrement) operator expression. - */ -export interface UpdateExpression extends Expression { - type: 'UpdateExpression'; - operator: UpdateOperator; - argument: Expression; - prefix: boolean; -} - -/** - * UpdateOperator - * - * An update (increment or decrement) operator token. - */ -export type UpdateOperator = '++' | '--'; - -/** - * Binary operations - */ - -/** - * BinaryExpression - * - * A binary operator expression. - */ -export interface BinaryExpression extends Expression { - type: 'BinaryExpression'; - operator: BinaryOperator; - left: Expression; - right: Expression; -} - -/** - * BinaryOperator - * - * A binary operator token. - */ -export type BinaryOperator = - | '==' - | '!=' - | '===' - | '!==' - | '<' - | '<=' - | '>' - | '>=' - | '<<' - | '>>' - | '>>>' - | '+' - | '-' - | '*' - | '/' - | '%' - | '|' - | '^' - | '&' - | 'in' - | 'instanceof' - | '**'; - -/** - * AssignmentExpression - * - * An assignment operator expression. - * - * FROM ESTREE DOCS: - * - * ``` - * FIXME: This describes the Esprima and Acorn behaviors, which is not currently aligned with the SpiderMonkey behavior. - * - * extend interface AssignmentExpression { - * left: Pattern; - * } - * - * Note that pre-ES6 code was allowed to pass references around and so left was much more liberal; an implementation might choose to continue using old definition if it needs to support such legacy code. - * ``` - */ -export interface AssignmentExpression extends Expression { - type: 'AssignmentExpression'; - operator: AssignmentOperator; - left: Pattern | Expression; - right: Expression; -} - -/** - * AssignmentOperator - * - * An assignment operator token. - */ -export type AssignmentOperator = - | '=' - | '+=' - | '-=' - | '*=' - | '/=' - | '%=' - | '<<=' - | '>>=' - | '>>>=' - | '|=' - | '^=' - | '&=' - | '**='; - -/** - * LogicalExpression - * - * A logical operator expression. - */ -export interface LogicalExpression extends Expression { - type: 'LogicalExpression'; - operator: LogicalOperator; - left: Expression; - right: Expression; -} - -/** - * LogicalOperator - * - * A logical operator token. - */ -export type LogicalOperator = '||' | '&&'; - -/** - * MemberExpression - * - * A member expression. If `computed` is `true`, the node corresponds to a computed (`a[b]`) member expression and `property` is an `Expression`. If `computed` is `false`, the node corresponds to a static (`a.b`) member expression and `property` is an `Identifier`. - */ -export interface MemberExpression extends Expression, Pattern { - type: 'MemberExpression'; - object: Expression | Super; - property: Expression; - computed: boolean; -} - -/** - * ConditionalExpression - * - * A conditional expression, i.e., a ternary `?`/`:` expression. - */ -export interface ConditionalExpression extends Expression { - type: 'ConditionalExpression'; - test: Expression; - alternate: Expression; - consequent: Expression; -} - -/** - * CallExpression - * - * A function or method call expression. - */ -export interface CallExpression extends Expression { - type: 'CallExpression'; - callee: Expression | Super; - arguments: Array; -} - -/** - * NewExpression - * - * A `new` expression. - */ -export interface NewExpression extends Expression { - type: 'NewExpression'; - callee: Expression; - arguments: Array; -} - -/** - * SequenceExpression - * - * A sequence expression, i.e., a comma-separated sequence of expressions. - */ -export interface SequenceExpression extends Expression { - type: 'SequenceExpression'; - expressions: Expression[]; -} - -/** - * YieldExpression - * - * A yield expression. - */ -export interface YieldExpression extends Expression { - type: 'YieldExpression'; - argument: Expression | null; - delegate: boolean; -} - -/** - * AwaitExpression - */ -export interface AwaitExpression extends Expression { - type: 'AwaitExpression'; - argument: Expression; -} - -/** - * Template Literals - */ - -/** - * TemplateLiteral - */ -export interface TemplateLiteral extends Expression { - type: 'TemplateLiteral'; - quasis: TemplateElement[]; - expressions: Expression[]; -} - -/** - * TaggedTemplateExpression - */ -export interface TaggedTemplateExpression extends Expression { - type: 'TaggedTemplateExpression'; - tag: Expression; - quasi: TemplateLiteral; -} - -/** - * TemplateElement - * - * If the template literal is tagged and the text has an invalid escape, cooked will be null, e.g., tag`\unicode and \u{55}` - */ -export interface TemplateElement extends Node { - type: 'TemplateElement'; - tail: boolean; - value: { - cooked: string | null; - raw: string; - }; -} - -/** - * Patterns - * - * Destructuring binding and assignment are not part of ES5, but all binding positions accept Pattern to allow for destructuring in ES6. Nevertheless, for ES5, the only Pattern subtype is Identifier. - */ -export interface Pattern extends Node {} - -/** - * AssignmentProperty - */ -export interface AssignmentProperty extends Property { - type: 'Property'; // inherited - value: Pattern; - kind: 'init'; - method: false; -} - -/** - * ObjectPattern - * - * Rest properties, e.g., {a, ...rest} = obj. - */ -export interface ObjectPattern extends Pattern { - type: 'ObjectPattern'; - properties: Array; -} - -/** - * ArrayPattern - */ -export interface ArrayPattern extends Pattern { - type: 'ArrayPattern'; - elements: Array; -} - -/** - * RestElement - */ -export interface RestElement extends Pattern { - type: 'RestElement'; - argument: Pattern; -} - -/** - * AssignmentPattern - */ -export interface AssignmentPattern extends Pattern { - type: 'AssignmentPattern'; - left: Pattern; - right: Expression; -} - -/** - * Classes - */ - -/** - * Class - */ -export interface Class extends Node { - id: Identifier | null; - superClass: Expression | null; - body: ClassBody; -} - -/** - * ClassBody - */ -export interface ClassBody extends Node { - type: 'ClassBody'; - body: MethodDefinition[]; -} - -/** - * MethodDefinition - */ -export interface MethodDefinition extends Node { - type: 'MethodDefinition'; - key: Expression; - value: FunctionExpression; - kind: 'constructor' | 'method' | 'get' | 'set'; - computed: boolean; - static: boolean; -} - -/** - * ClassDeclaration - */ -export interface ClassDeclaration extends Class, Declaration { - type: 'ClassDeclaration'; - id: Identifier; -} - -/** - * ClassExpression - */ -export interface ClassExpression extends Class, Expression { - type: 'ClassExpression'; -} - -/** - * MetaProperty - */ -export interface MetaProperty extends Expression { - type: 'MetaProperty'; - meta: Identifier; - property: Identifier; -} - -/** - * Modules - */ - -/** - * ModuleDeclaration - * - * A module `import` or `export` declaration. - */ -export interface ModuleDeclaration extends Node {} - -/** - * ModuleSpecifier - * - * A specifier in an import or export declaration. - */ -export interface ModuleSpecifier extends Node { - local: Identifier; -} - -/** - * Imports - */ - -/** - * ImportDeclaration - * - * An import declaration, e.g., `import foo from "mod";`. - */ -export interface ImportDeclaration extends ModuleDeclaration { - type: 'ImportDeclaration'; - specifiers: Array< - ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier - >; - source: Literal; -} - -/** - * ImportSpecifier - * - * An imported variable binding, e.g., `{foo}` in `import {foo} from "mod"` or `{foo as bar}` in `import {foo as bar} from "mod"`. The `imported` field refers to the name of the export imported from the module. The `local` field refers to the binding imported into the local module scope. If it is a basic named import, such as in `import {foo} from "mod"`, both `imported` and `local` are equivalent `Identifier` nodes; in this case an `Identifier` node representing `foo`. If it is an aliased import, such as in `import {foo as bar} from "mod"`, the `imported` field is an `Identifier` node representing `foo`, and the `local` field is an `Identifier` node representing `bar`. - */ -export interface ImportSpecifier extends ModuleSpecifier { - type: 'ImportSpecifier'; - imported: Identifier; -} - -/** - * ImportDefaultSpecifier - * - * A default import specifier, e.g., `foo` in `import foo from "mod.js"`. - */ -export interface ImportDefaultSpecifier extends ModuleSpecifier { - type: 'ImportDefaultSpecifier'; -} - -/** - * ImportNamespaceSpecifier - * - * A namespace import specifier, e.g., `* as foo` in `import * as foo from "mod.js"`. - */ -export interface ImportNamespaceSpecifier extends ModuleSpecifier { - type: 'ImportNamespaceSpecifier'; -} - -/** - * Exports - */ - -/** - * ExportNamedDeclaration - * - * An export named declaration, e.g., `export {foo, bar};`, `export {foo} from "mod";` or `export var foo = 1;`. - * - * _Note: Having `declaration` populated with non-empty `specifiers` or non-null `source` results in an invalid state._ - */ -export interface ExportNamedDeclaration extends ModuleDeclaration { - type: 'ExportNamedDeclaration'; - declaration: Declaration | null; - specifiers: [ExportSpecifier]; - source: Literal | null; -} - -/** - * ExportSpecifier - * - * An exported variable binding, e.g., `{foo}` in `export {foo}` or `{bar as foo}` in `export {bar as foo}`. The `exported` field refers to the name exported in the module. The `local` field refers to the binding into the local module scope. If it is a basic named export, such as in `export {foo}`, both `exported` and `local` are equivalent `Identifier` nodes; in this case an `Identifier` node representing `foo`. If it is an aliased export, such as in `export {bar as foo}`, the `exported` field is an `Identifier` node representing `foo`, and the `local` field is an `Identifier` node representing `bar`. - */ -export interface ExportSpecifier extends ModuleSpecifier { - type: 'ExportSpecifier'; - exported: Identifier; -} - -/** - * ExportDefaultDeclaration - * - * An export default declaration, e.g., `export default function () {};` or `export default 1;`. - */ -export interface ExportDefaultDeclaration extends ModuleDeclaration { - type: 'ExportDefaultDeclaration'; - declaration: Declaration | Expression; -} - -/** - * ExportAllDeclaration - * - * An export batch declaration, e.g., `export * from "mod";`. - */ -export interface ExportAllDeclaration extends ModuleDeclaration { - type: 'ExportAllDeclaration'; - source: Literal; -} diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 678c97215fa0..4ab71cf5e9a4 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -6,11 +6,7 @@ */ import ts from 'typescript'; import unescape from 'lodash.unescape'; -import { - ESTreeNodeLoc, - ESTreeNode, - ESTreeToken -} from './temp-types-based-on-js-source'; +import { TSESTree } from './ts-estree'; import { AST_NODE_TYPES } from './ast-node-types'; const SyntaxKind = ts.SyntaxKind; @@ -101,8 +97,8 @@ const TOKEN_TO_TEXT: { readonly [P in ts.SyntaxKind]?: string } = { /** * Returns true if the given ts.Token is the assignment operator - * @param {ts.Token} operator the operator token - * @returns {boolean} is assignment + * @param operator the operator token + * @returns is assignment */ export function isAssignmentOperator( operator: ts.Token @@ -112,8 +108,8 @@ export function isAssignmentOperator( /** * Returns true if the given ts.Token is a logical operator - * @param {ts.Token} operator the operator token - * @returns {boolean} is a logical operator + * @param operator the operator token + * @returns is a logical operator */ export function isLogicalOperator( operator: ts.Token @@ -123,8 +119,8 @@ export function isLogicalOperator( /** * Returns the string form of the given TSToken SyntaxKind - * @param {number} kind the token's SyntaxKind - * @returns {string} the token applicable token as a string + * @param kind the token's SyntaxKind + * @returns the token applicable token as a string */ export function getTextForTokenKind(kind: ts.SyntaxKind): string | undefined { return TOKEN_TO_TEXT[kind]; @@ -132,8 +128,8 @@ export function getTextForTokenKind(kind: ts.SyntaxKind): string | undefined { /** * Returns true if the given ts.Node is a valid ESTree class member - * @param {ts.Node} node TypeScript AST node - * @returns {boolean} is valid ESTree class member + * @param node TypeScript AST node + * @returns is valid ESTree class member */ export function isESTreeClassMember(node: ts.Node): boolean { return node.kind !== SyntaxKind.SemicolonClassElement; @@ -141,9 +137,9 @@ export function isESTreeClassMember(node: ts.Node): boolean { /** * Checks if a ts.Node has a modifier - * @param {ts.KeywordSyntaxKind} modifierKind TypeScript SyntaxKind modifier - * @param {ts.Node} node TypeScript AST node - * @returns {boolean} has the modifier specified + * @param modifierKind TypeScript SyntaxKind modifier + * @param node TypeScript AST node + * @returns has the modifier specified */ export function hasModifier( modifierKind: ts.KeywordSyntaxKind, @@ -161,7 +157,7 @@ export function hasModifier( * @param node TypeScript AST node * @returns returns last modifier if present or null */ -export function getLastModifier(node: ts.Node): ts.Node | null { +export function getLastModifier(node: ts.Node): ts.Modifier | null { return ( (!!node.modifiers && !!node.modifiers.length && @@ -172,8 +168,8 @@ export function getLastModifier(node: ts.Node): ts.Node | null { /** * Returns true if the given ts.Token is a comma - * @param {ts.Node} token the TypeScript token - * @returns {boolean} is comma + * @param token the TypeScript token + * @returns is comma */ export function isComma(token: ts.Node): boolean { return token.kind === SyntaxKind.CommaToken; @@ -181,8 +177,8 @@ export function isComma(token: ts.Node): boolean { /** * Returns true if the given ts.Node is a comment - * @param {ts.Node} node the TypeScript node - * @returns {boolean} is comment + * @param node the TypeScript node + * @returns is comment */ export function isComment(node: ts.Node): boolean { return ( @@ -193,8 +189,8 @@ export function isComment(node: ts.Node): boolean { /** * Returns true if the given ts.Node is a JSDoc comment - * @param {ts.Node} node the TypeScript node - * @returns {boolean} is JSDoc comment + * @param node the TypeScript node + * @returns is JSDoc comment */ export function isJSDocComment(node: ts.Node): boolean { return node.kind === SyntaxKind.JSDocComment; @@ -202,8 +198,8 @@ export function isJSDocComment(node: ts.Node): boolean { /** * Returns the binary expression type of the given ts.Token - * @param {ts.Token} operator the operator token - * @returns {string} the binary expression type + * @param operator the operator token + * @returns the binary expression type */ export function getBinaryExpressionType( operator: ts.Token @@ -219,38 +215,46 @@ export function getBinaryExpressionType( return AST_NODE_TYPES.BinaryExpression; } +/** + * Returns line and column data for the given positions, + * @param pos position to check + * @param ast the AST object + * @returns line and column + */ +export function getLineAndCharacterFor( + pos: number, + ast: ts.SourceFile +): TSESTree.LineAndColumnData { + const loc = ast.getLineAndCharacterOfPosition(pos); + return { + line: loc.line + 1, + column: loc.character + }; +} + /** * Returns line and column data for the given start and end positions, * for the given AST - * @param {number} start start data - * @param {number} end end data - * @param {ts.SourceFile} ast the AST object - * @returns {ESTreeNodeLoc} the loc data + * @param start start data + * @param end end data + * @param ast the AST object + * @returns the loc data */ export function getLocFor( start: number, end: number, ast: ts.SourceFile -): ESTreeNodeLoc { - const startLoc = ast.getLineAndCharacterOfPosition(start), - endLoc = ast.getLineAndCharacterOfPosition(end); - +): TSESTree.SourceLocation { return { - start: { - line: startLoc.line + 1, - column: startLoc.character - }, - end: { - line: endLoc.line + 1, - column: endLoc.character - } + start: getLineAndCharacterFor(start, ast), + end: getLineAndCharacterFor(end, ast) }; } /** * Check whatever node can contain directive - * @param {ts.Node} node - * @returns {boolean} returns true if node can contain directive + * @param node + * @returns returns true if node can contain directive */ export function canContainDirective(node: ts.Node): boolean { switch (node.kind) { @@ -276,23 +280,19 @@ export function canContainDirective(node: ts.Node): boolean { } /** - * Returns line and column data for the given ts.Node or ts.Token, - * for the given AST - * @param {ts.Node} nodeOrToken the ts.Node or ts.Token - * @param {ts.SourceFile} ast the AST object - * @returns {ESTreeLoc} the loc data + * Returns range for the given ts.Node + * @param node the ts.Node or ts.Token + * @param ast the AST object + * @returns the range data */ -export function getLoc( - nodeOrToken: ts.Node, - ast: ts.SourceFile -): ESTreeNodeLoc { - return getLocFor(nodeOrToken.getStart(ast), nodeOrToken.end, ast); +export function getRange(node: ts.Node, ast: ts.SourceFile): [number, number] { + return [node.getStart(ast), node.getEnd()]; } /** * Returns true if a given ts.Node is a token - * @param {ts.Node} node the ts.Node - * @returns {boolean} is a token + * @param node the ts.Node + * @returns is a token */ export function isToken(node: ts.Node): boolean { return ( @@ -302,8 +302,8 @@ export function isToken(node: ts.Node): boolean { /** * Returns true if a given ts.Node is a JSX token - * @param {ts.Node} node ts.Node to be checked - * @returns {boolean} is a JSX token + * @param node ts.Node to be checked + * @returns is a JSX token */ export function isJSXToken(node: ts.Node): boolean { return ( @@ -313,8 +313,8 @@ export function isJSXToken(node: ts.Node): boolean { /** * Returns the declaration kind of the given ts.Node - * @param {ts.VariableDeclarationList} node TypeScript AST node - * @returns {string} declaration kind + * @param node TypeScript AST node + * @returns declaration kind */ export function getDeclarationKind( node: ts.VariableDeclarationList @@ -330,8 +330,8 @@ export function getDeclarationKind( /** * Gets a ts.Node's accessibility level - * @param {ts.Node} node The ts.Node - * @returns {string | null} accessibility "public", "protected", "private", or null + * @param node The ts.Node + * @returns accessibility "public", "protected", "private", or null */ export function getTSNodeAccessibility( node: ts.Node @@ -359,13 +359,13 @@ export function getTSNodeAccessibility( /** * Finds the next token based on the previous one and its parent * Had to copy this from TS instead of using TS's version because theirs doesn't pass the ast to getChildren - * @param {ts.Node} previousToken The previous TSToken - * @param {ts.Node} parent The parent TSNode - * @param {ts.SourceFile} ast The TS AST - * @returns {ts.Node|undefined} the next TSToken + * @param previousToken The previous TSToken + * @param parent The parent TSNode + * @param ast The TS AST + * @returns the next TSToken */ export function findNextToken( - previousToken: ts.Node, + previousToken: ts.TextRange, parent: ts.Node, ast: ts.SourceFile ): ts.Node | undefined { @@ -389,34 +389,11 @@ export function findNextToken( } } -/** - * Find the first matching token based on the given predicate function. - * @param {ts.Node} previousToken The previous ts.Token - * @param {ts.Node} parent The parent ts.Node - * @param {Function} predicate The predicate function to apply to each checked token - * @param {ts.SourceFile} ast The TS AST - * @returns {ts.Node|undefined} a matching ts.Token - */ -export function findFirstMatchingToken( - previousToken: ts.Node | undefined, - parent: ts.Node, - predicate: (node: ts.Node) => boolean, - ast: ts.SourceFile -): ts.Node | undefined { - while (previousToken) { - if (predicate(previousToken)) { - return previousToken; - } - previousToken = findNextToken(previousToken, parent, ast); - } - return undefined; -} - /** * Find the first matching ancestor based on the given predicate function. - * @param {ts.Node} node The current ts.Node - * @param {Function} predicate The predicate function to apply to each checked ancestor - * @returns {ts.Node|undefined} a matching parent ts.Node + * @param node The current ts.Node + * @param predicate The predicate function to apply to each checked ancestor + * @returns a matching parent ts.Node */ export function findFirstMatchingAncestor( node: ts.Node, @@ -433,8 +410,8 @@ export function findFirstMatchingAncestor( /** * Returns true if a given ts.Node has a JSX token within its hierarchy - * @param {ts.Node} node ts.Node to be checked - * @returns {boolean} has JSX ancestor + * @param node ts.Node to be checked + * @returns has JSX ancestor */ export function hasJSXAncestor(node: ts.Node): boolean { return !!findFirstMatchingAncestor(node, isJSXToken); @@ -442,8 +419,8 @@ export function hasJSXAncestor(node: ts.Node): boolean { /** * Unescape the text content of string literals, e.g. & -> & - * @param {string} text The escaped string literal text. - * @returns {string} The unescaped string literal text. + * @param text The escaped string literal text. + * @returns The unescaped string literal text. */ export function unescapeStringLiteralText(text: string): string { return unescape(text); @@ -451,8 +428,8 @@ export function unescapeStringLiteralText(text: string): string { /** * Returns true if a given ts.Node is a computed property - * @param {ts.Node} node ts.Node to be checked - * @returns {boolean} is Computed Property + * @param node ts.Node to be checked + * @returns is Computed Property */ export function isComputedProperty(node: ts.Node): boolean { return node.kind === SyntaxKind.ComputedPropertyName; @@ -460,8 +437,8 @@ export function isComputedProperty(node: ts.Node): boolean { /** * Returns true if a given ts.Node is optional (has QuestionToken) - * @param {ts.Node} node ts.Node to be checked - * @returns {boolean} is Optional + * @param node ts.Node to be checked + * @returns is Optional */ export function isOptional(node: { questionToken?: ts.QuestionToken; @@ -473,45 +450,47 @@ export function isOptional(node: { /** * Fixes the exports of the given ts.Node - * @param {ts.Node} node the ts.Node - * @param {ESTreeNode} result result - * @param {ts.SourceFile} ast the AST - * @returns {ESTreeNode} the ESTreeNode with fixed exports + * @param node the ts.Node + * @param result result + * @param ast the AST + * @returns the ESTreeNode with fixed exports */ -export function fixExports( +export function fixExports( node: ts.Node, - result: ESTreeNode, + result: T, ast: ts.SourceFile -): ESTreeNode { +): TSESTree.ExportDefaultDeclaration | TSESTree.ExportNamedDeclaration | T { // check for exports if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { - const exportKeyword = node.modifiers[0], - nextModifier = node.modifiers[1], - lastModifier = node.modifiers[node.modifiers.length - 1], - declarationIsDefault = - nextModifier && nextModifier.kind === SyntaxKind.DefaultKeyword, - varToken = findNextToken(lastModifier, ast, ast); - - result.range[0] = varToken!.getStart(ast); - result.loc = getLocFor(result.range[0], result.range[1], ast); - - const declarationType = declarationIsDefault - ? AST_NODE_TYPES.ExportDefaultDeclaration - : AST_NODE_TYPES.ExportNamedDeclaration; - - const newResult: any = { - type: declarationType, - declaration: result, - range: [exportKeyword.getStart(ast), result.range[1]], - loc: getLocFor(exportKeyword.getStart(ast), result.range[1], ast) - }; - - if (!declarationIsDefault) { - newResult.specifiers = []; - newResult.source = null; + const exportKeyword = node.modifiers[0]; + const nextModifier = node.modifiers[1]; + const declarationIsDefault = + nextModifier && nextModifier.kind === SyntaxKind.DefaultKeyword; + + const varToken = declarationIsDefault + ? findNextToken(nextModifier, ast, ast) + : findNextToken(exportKeyword, ast, ast); + + result.range![0] = varToken!.getStart(ast); + result.loc = getLocFor(result.range![0], result.range![1], ast); + + if (declarationIsDefault) { + return { + type: AST_NODE_TYPES.ExportDefaultDeclaration, + declaration: result as any, + range: [exportKeyword.getStart(ast), result.range![1]], + loc: getLocFor(exportKeyword.getStart(ast), result.range![1], ast) + }; + } else { + return { + type: AST_NODE_TYPES.ExportNamedDeclaration, + declaration: result as any, + range: [exportKeyword.getStart(ast), result.range![1]], + loc: getLocFor(exportKeyword.getStart(ast), result.range![1], ast), + specifiers: [], + source: null + }; } - - return newResult; } return result; @@ -519,10 +498,10 @@ export function fixExports( /** * Returns the type of a given ts.Token - * @param {ts.Token} token the ts.Token - * @returns {string} the token type + * @param token the ts.Token + * @returns the token type */ -export function getTokenType(token: any): string { +export function getTokenType(token: any): TSESTree.TokenType { // Need two checks for keywords since some are also identifiers if (token.originalKeywordKind) { switch (token.originalKeywordKind) { @@ -626,18 +605,21 @@ export function getTokenType(token: any): string { /** * Extends and formats a given ts.Token, for a given AST - * @param {ts.Node} token the ts.Token - * @param {ts.SourceFile} ast the AST object - * @returns {ESTreeToken} the converted ESTreeToken + * @param token the ts.Token + * @param ast the AST object + * @returns the converted Token */ -export function convertToken(token: ts.Node, ast: ts.SourceFile): ESTreeToken { +export function convertToken( + token: ts.Node, + ast: ts.SourceFile +): TSESTree.Token { const start = token.kind === SyntaxKind.JsxText ? token.getFullStart() : token.getStart(ast), end = token.getEnd(), value = ast.text.slice(start, end), - newToken: any = { + newToken: TSESTree.Token = { type: getTokenType(token), value, range: [start, end], @@ -656,14 +638,13 @@ export function convertToken(token: ts.Node, ast: ts.SourceFile): ESTreeToken { /** * Converts all tokens for the given AST - * @param {ts.SourceFile} ast the AST object - * @returns {ESTreeToken[]} the converted ESTreeTokens + * @param ast the AST object + * @returns the converted Tokens */ -export function convertTokens(ast: ts.SourceFile): ESTreeToken[] { - const result: ESTreeToken[] = []; +export function convertTokens(ast: ts.SourceFile): TSESTree.Token[] { + const result: TSESTree.Token[] = []; /** - * @param {ts.Node} node the ts.Node - * @returns {void} + * @param node the ts.Node */ function walk(node: ts.Node): void { // TypeScript generates tokens for types in JSDoc blocks. Comment tokens @@ -688,10 +669,10 @@ export function convertTokens(ast: ts.SourceFile): ESTreeToken[] { /** * Get container token node between range - * @param {ts.SourceFile} ast the AST object - * @param {number} start The index at which the comment starts. - * @param {number} end The index at which the comment ends. - * @returns {ts.Node} typescript container token + * @param ast the AST object + * @param start The index at which the comment starts. + * @param end The index at which the comment ends. + * @returns typescript container token * @private */ export function getNodeContainer( @@ -702,8 +683,7 @@ export function getNodeContainer( let container: ts.Node | null = null; /** - * @param {ts.Node} node the ts.Node - * @returns {void} + * @param node the ts.Node */ function walk(node: ts.Node): void { const nodeStart = node.pos; @@ -723,10 +703,10 @@ export function getNodeContainer( } /** - * @param {ts.SourceFile} ast the AST object - * @param {number} start the index at which the error starts - * @param {string} message the error message - * @returns {Object} converted error object + * @param ast the AST object + * @param start the index at which the error starts + * @param message the error message + * @returns converted error object */ export function createError( ast: ts.SourceFile, @@ -743,8 +723,8 @@ export function createError( } /** - * @param {ts.Node} n the TSNode - * @param {ts.SourceFile} ast the TS AST + * @param n the TSNode + * @param ast the TS AST */ export function nodeHasTokens(n: ts.Node, ast: ts.SourceFile) { // If we have a token or node that has a non-zero width, it must have tokens. @@ -758,9 +738,8 @@ export function nodeHasTokens(n: ts.Node, ast: ts.SourceFile) { * Like `forEach`, but suitable for use with numbers and strings (which may be falsy). * @template T * @template U - * @param {ReadonlyArray|undefined} array - * @param {(element: T, index: number) => (U|undefined)} callback - * @returns {U|undefined} + * @param array + * @param callback */ export function firstDefined( array: ReadonlyArray | undefined, diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts new file mode 100644 index 000000000000..6ec07b902cd1 --- /dev/null +++ b/packages/typescript-estree/src/parser-options.ts @@ -0,0 +1,47 @@ +import { Program } from 'typescript'; +import { Token, Comment, Node } from './typedefs'; +import { TSNode } from './ts-nodes'; + +export interface Extra { + errorOnUnknownASTType: boolean; + errorOnTypeScriptSyntacticAndSemanticIssues: boolean; + useJSXTextNode: boolean; + tokens: null | Token[]; + comment: boolean; + code: string; + range: boolean; + loc: boolean; + comments: Comment[]; + strict: boolean; + jsx: boolean; + log: Function; + projects: string[]; + tsconfigRootDir: string; + extraFileExtensions: string[]; +} + +export interface ParserOptions { + range?: boolean; + loc?: boolean; + tokens?: boolean; + comment?: boolean; + jsx?: boolean; + errorOnUnknownASTType?: boolean; + errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; + useJSXTextNode?: boolean; + loggerFn?: Function | false; + project?: string | string[]; + filePath?: string; + tsconfigRootDir?: string; + extraFileExtensions?: string[]; +} + +export interface ParserWeakMap { + get(key: TKey): TValue; +} + +export interface ParserServices { + program: Program | undefined; + esTreeNodeToTSNodeMap: ParserWeakMap | undefined; + tsNodeToESTreeNodeMap: ParserWeakMap | undefined; +} diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 1a39cfd2f31f..bb77a186171a 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -13,19 +13,16 @@ import semver from 'semver'; import ts from 'typescript'; import convert from './ast-converter'; import { convertError } from './convert'; -import { Program } from './estree/spec'; import { firstDefined } from './node-utils'; -import { - ESTreeComment, - ESTreeToken, - Extra, - ParserOptions -} from './temp-types-based-on-js-source'; +import { TSESTree } from './ts-estree'; +import { Extra, ParserOptions, ParserServices } from './parser-options'; import { getFirstSemanticOrSyntacticError } from './semantic-errors'; -const packageJSON = require('../package.json'); - -const SUPPORTED_TYPESCRIPT_VERSIONS = packageJSON.devDependencies.typescript; +/** + * This needs to be kept in sync with the top-level README.md in the + * typescript-eslint monorepo + */ +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.4.0'; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, @@ -36,7 +33,10 @@ let extra: Extra; let warnedAboutTSVersion = false; /** - * Compute the filename based on the parser options + * Compute the filename based on the parser options. + * + * Even if jsx option is set in typescript compiler, filename still has to + * contain .tsx file extension. * * @param options Parser options */ @@ -46,7 +46,6 @@ function getFileName({ jsx }: { jsx?: boolean }) { /** * Resets the extra config object - * @returns {void} */ function resetExtra(): void { extra = { @@ -69,9 +68,9 @@ function resetExtra(): void { } /** - * @param {string} code The code of the file being linted - * @param {Object} options The config object - * @returns {{ast: ts.SourceFile, program: ts.Program} | undefined} If found, returns the source file corresponding to the code and the containing program + * @param code The code of the file being linted + * @param options The config object + * @returns If found, returns the source file corresponding to the code and the containing program */ function getASTFromProject(code: string, options: ParserOptions) { return firstDefined( @@ -90,9 +89,9 @@ function getASTFromProject(code: string, options: ParserOptions) { } /** - * @param {string} code The code of the file being linted - * @param {Object} options The config object - * @returns {{ast: ts.SourceFile, program: ts.Program} | undefined} If found, returns the source file corresponding to the code and the containing program + * @param code The code of the file being linted + * @param options The config object + * @returns If found, returns the source file corresponding to the code and the containing program */ function getASTAndDefaultProject(code: string, options: ParserOptions) { const fileName = options.filePath || getFileName(options); @@ -102,15 +101,13 @@ function getASTAndDefaultProject(code: string, options: ParserOptions) { } /** - * @param {string} code The code of the file being linted - * @returns {{ast: ts.SourceFile, program: ts.Program}} Returns a new source file and program corresponding to the linted code + * @param code The code of the file being linted + * @returns Returns a new source file and program corresponding to the linted code */ function createNewProgram(code: string) { - // Even if jsx option is set in typescript compiler, filename still has to - // contain .tsx file extension const FILENAME = getFileName(extra); - const compilerHost = { + const compilerHost: ts.CompilerHost = { fileExists() { return true; }, @@ -161,10 +158,10 @@ function createNewProgram(code: string) { } /** - * @param {string} code The code of the file being linted - * @param {Object} options The config object - * @param {boolean} shouldProvideParserServices True iff the program should be attempted to be calculated from provided tsconfig files - * @returns {{ast: ts.SourceFile, program: ts.Program}} Returns a source file and program corresponding to the linted code + * @param code The code of the file being linted + * @param options The config object + * @param shouldProvideParserServices True iff the program should be attempted to be calculated from provided tsconfig files + * @returns Returns a source file and program corresponding to the linted code */ function getProgramAndAST( code: string, @@ -178,124 +175,82 @@ function getProgramAndAST( ); } -//------------------------------------------------------------------------------ -// Parser -//------------------------------------------------------------------------------ - -type AST = Program & - (T['range'] extends true ? { range: [number, number] } : {}) & - (T['tokens'] extends true ? { tokens: ESTreeToken[] } : {}) & - (T['comment'] extends true ? { comments: ESTreeComment[] } : {}); - -/** - * Parses the given source code to produce a valid AST - * @param {string} code TypeScript code - * @param {boolean} shouldGenerateServices Flag determining whether to generate ast maps and program or not - * @param {ParserOptions} options configuration object for the parser - * @returns {Object} the AST - */ -function generateAST( - code: string, - options: T = {} as T, - shouldGenerateServices = false -): { - estree: AST; - program: typeof shouldGenerateServices extends true - ? ts.Program - : (ts.Program | undefined); - astMaps: typeof shouldGenerateServices extends true - ? { - esTreeNodeToTSNodeMap: WeakMap; - tsNodeToESTreeNodeMap: WeakMap; - } - : { - esTreeNodeToTSNodeMap?: WeakMap; - tsNodeToESTreeNodeMap?: WeakMap; - }; -} { - const toString = String; - - if (typeof code !== 'string' && !((code as any) instanceof String)) { - code = toString(code); +function applyParserOptionsToExtra(options: ParserOptions): void { + /** + * Track range information in the AST + */ + extra.range = typeof options.range === 'boolean' && options.range; + extra.loc = typeof options.loc === 'boolean' && options.loc; + /** + * Track tokens in the AST + */ + if (typeof options.tokens === 'boolean' && options.tokens) { + extra.tokens = []; + } + /** + * Track comments in the AST + */ + if (typeof options.comment === 'boolean' && options.comment) { + extra.comment = true; + extra.comments = []; + } + /** + * Enable JSX - note the applicable file extension is still required + */ + if (typeof options.jsx === 'boolean' && options.jsx) { + extra.jsx = true; + } + /** + * 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`. + */ + if (typeof options.useJSXTextNode === 'boolean' && options.useJSXTextNode) { + extra.useJSXTextNode = true; + } + /** + * Allow the user to cause the parser to error if it encounters an unknown AST Node Type + * (used in testing) + */ + if ( + typeof options.errorOnUnknownASTType === 'boolean' && + options.errorOnUnknownASTType + ) { + extra.errorOnUnknownASTType = true; + } + /** + * Allow the user to override the function used for logging + */ + if (typeof options.loggerFn === 'function') { + extra.log = options.loggerFn; + } else if (options.loggerFn === false) { + extra.log = Function.prototype; } - resetExtra(); - - if (typeof options !== 'undefined') { - extra.range = typeof options.range === 'boolean' && options.range; - extra.loc = typeof options.loc === 'boolean' && options.loc; - - if (typeof options.tokens === 'boolean' && options.tokens) { - extra.tokens = []; - } - - if (typeof options.comment === 'boolean' && options.comment) { - extra.comment = true; - extra.comments = []; - } - - if (typeof options.jsx === 'boolean' && options.jsx) { - extra.jsx = true; - } - - /** - * Allow the user to cause the parser to error if it encounters an unknown AST Node Type - * (used in testing). - */ - if ( - typeof options.errorOnUnknownASTType === 'boolean' && - options.errorOnUnknownASTType - ) { - extra.errorOnUnknownASTType = true; - } - - /** - * Retrieve semantic and syntactic diagnostics from the underlying TypeScript Program - * and turn them into parse errors - */ - if ( - shouldGenerateServices && - typeof options.errorOnTypeScriptSyntacticAndSemanticIssues === - 'boolean' && - options.errorOnTypeScriptSyntacticAndSemanticIssues - ) { - extra.errorOnTypeScriptSyntacticAndSemanticIssues = true; - } - - if (typeof options.useJSXTextNode === 'boolean' && options.useJSXTextNode) { - extra.useJSXTextNode = true; - } - - /** - * Allow the user to override the function used for logging - */ - if (typeof options.loggerFn === 'function') { - extra.log = options.loggerFn; - } else if (options.loggerFn === false) { - extra.log = Function.prototype; - } - - if (typeof options.project === 'string') { - extra.projects = [options.project]; - } else if ( - Array.isArray(options.project) && - options.project.every(projectPath => typeof projectPath === 'string') - ) { - extra.projects = options.project; - } + if (typeof options.project === 'string') { + extra.projects = [options.project]; + } else if ( + Array.isArray(options.project) && + options.project.every(projectPath => typeof projectPath === 'string') + ) { + extra.projects = options.project; + } - if (typeof options.tsconfigRootDir === 'string') { - extra.tsconfigRootDir = options.tsconfigRootDir; - } + if (typeof options.tsconfigRootDir === 'string') { + extra.tsconfigRootDir = options.tsconfigRootDir; + } - if ( - Array.isArray(options.extraFileExtensions) && - options.extraFileExtensions.every(ext => typeof ext === 'string') - ) { - extra.extraFileExtensions = options.extraFileExtensions; - } + if ( + Array.isArray(options.extraFileExtensions) && + options.extraFileExtensions.every(ext => typeof ext === 'string') + ) { + extra.extraFileExtensions = options.extraFileExtensions; } +} +function warnAboutTSVersion(): void { if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { const border = '============='; const versionWarning = [ @@ -310,71 +265,155 @@ function generateAST( extra.log(versionWarning.join('\n\n')); warnedAboutTSVersion = true; } +} - const shouldProvideParserServices = - shouldGenerateServices && extra.projects && extra.projects.length > 0; - const { ast, program } = getProgramAndAST( - code, - options, - shouldProvideParserServices - ); - - extra.code = code; - - /** - * Convert the AST - */ - const { estree, astMaps } = convert(ast, extra, shouldProvideParserServices); +//------------------------------------------------------------------------------ +// Parser +//------------------------------------------------------------------------------ - /** - * Even if TypeScript parsed the source code ok, and we had no problems converting the AST, - * there may be other syntactic or semantic issues in the code that we can optionally report on. - */ - if (program && extra.errorOnTypeScriptSyntacticAndSemanticIssues) { - const error = getFirstSemanticOrSyntacticError(program, ast); - if (error) { - throw convertError(error); - } - } +type AST = TSESTree.Program & + (T['range'] extends true ? { range: [number, number] } : {}) & + (T['tokens'] extends true ? { tokens: TSESTree.Token[] } : {}) & + (T['comment'] extends true ? { comments: TSESTree.Comment[] } : {}); - return { - estree, - program: shouldProvideParserServices ? program : undefined, - astMaps: shouldProvideParserServices - ? astMaps! - : { esTreeNodeToTSNodeMap: undefined, tsNodeToESTreeNodeMap: undefined } - }; +interface ParseAndGenerateServicesResult { + ast: AST; + services: ParserServices; } //------------------------------------------------------------------------------ // Public //------------------------------------------------------------------------------ -export { AST_NODE_TYPES } from './ast-node-types'; -export { version }; - -const version = packageJSON.version; +export const version: string = require('../package.json').version; export function parse( code: string, options?: T -) { +): AST { + /** + * Reset the parse configuration + */ + resetExtra(); + /** + * Ensure users do not attempt to use parse() when they need parseAndGenerateServices() + */ if (options && options.errorOnTypeScriptSyntacticAndSemanticIssues) { throw new Error( `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()` ); } - return generateAST(code, options).estree; + /** + * Ensure the source code is a string, and store a reference to it + */ + if (typeof code !== 'string' && !((code as any) instanceof String)) { + code = String(code); + } + extra.code = code; + /** + * Apply the given parser options + */ + if (typeof options !== 'undefined') { + applyParserOptionsToExtra(options); + } + /** + * Warn if the user is using an unsupported version of TypeScript + */ + warnAboutTSVersion(); + /** + * Create a ts.SourceFile directly, no ts.Program is needed for a simple + * parse + */ + const ast = ts.createSourceFile( + getFileName(extra), + code, + ts.ScriptTarget.Latest, + /* setParentNodes */ true + ); + /** + * Convert the TypeScript AST to an ESTree-compatible one + */ + const { estree } = convert(ast, extra, false); + return estree as AST; } -export function parseAndGenerateServices(code: string, options: ParserOptions) { - const result = generateAST(code, options, /*shouldGenerateServices*/ true); +export function parseAndGenerateServices< + T extends ParserOptions = ParserOptions +>(code: string, options: T): ParseAndGenerateServicesResult { + /** + * Reset the parse configuration + */ + resetExtra(); + /** + * Ensure the source code is a string, and store a reference to it + */ + if (typeof code !== 'string' && !((code as any) instanceof String)) { + code = String(code); + } + extra.code = code; + /** + * Apply the given parser options + */ + if (typeof options !== 'undefined') { + applyParserOptionsToExtra(options); + if ( + typeof options.errorOnTypeScriptSyntacticAndSemanticIssues === + 'boolean' && + options.errorOnTypeScriptSyntacticAndSemanticIssues + ) { + extra.errorOnTypeScriptSyntacticAndSemanticIssues = true; + } + } + /** + * Warn if the user is using an unsupported version of TypeScript + */ + warnAboutTSVersion(); + /** + * Generate a full ts.Program in order to be able to provide parser + * services, such as type-checking + */ + const shouldProvideParserServices = + extra.projects && extra.projects.length > 0; + const { ast, program } = getProgramAndAST( + code, + options, + shouldProvideParserServices + ); + /** + * Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve + * mappings between converted and original AST nodes + */ + const { estree, astMaps } = convert(ast, extra, shouldProvideParserServices); + /** + * Even if TypeScript parsed the source code ok, and we had no problems converting the AST, + * there may be other syntactic or semantic issues in the code that we can optionally report on. + */ + if (program && extra.errorOnTypeScriptSyntacticAndSemanticIssues) { + const error = getFirstSemanticOrSyntacticError(program, ast); + if (error) { + throw convertError(error); + } + } + /** + * Return the converted AST and additional parser services + */ return { - ast: result.estree, + ast: estree as AST, services: { - program: result.program, - esTreeNodeToTSNodeMap: result.astMaps.esTreeNodeToTSNodeMap, - tsNodeToESTreeNodeMap: result.astMaps.tsNodeToESTreeNodeMap + program: shouldProvideParserServices ? program : undefined, + esTreeNodeToTSNodeMap: + shouldProvideParserServices && astMaps + ? astMaps.esTreeNodeToTSNodeMap + : undefined, + tsNodeToESTreeNodeMap: + shouldProvideParserServices && astMaps + ? astMaps.tsNodeToESTreeNodeMap + : undefined } }; } + +export { AST_NODE_TYPES } from './ast-node-types'; +export { ParserOptions }; +export { ParserServices }; +export { TSESTree }; diff --git a/packages/typescript-estree/src/semantic-errors.ts b/packages/typescript-estree/src/semantic-errors.ts index 22e8210ba55d..f563e404464d 100644 --- a/packages/typescript-estree/src/semantic-errors.ts +++ b/packages/typescript-estree/src/semantic-errors.ts @@ -54,6 +54,7 @@ function whitelistSupportedDiagnostics( ): ReadonlyArray { return diagnostics.filter(diagnostic => { switch (diagnostic.code) { + case 1013: // ts 3.2 "A rest parameter or binding pattern may not have a trailing comma." case 1014: // ts 3.2 "A rest parameter must be last in a parameter list." case 1044: // ts 3.2 "'{0}' modifier cannot appear on a module or namespace element." case 1045: // ts 3.2 "A '{0}' modifier cannot be used with an interface declaration." @@ -65,6 +66,8 @@ function whitelistSupportedDiagnostics( case 1090: // ts 3.2 "'{0}' modifier cannot appear on a parameter." case 1096: // ts 3.2 "An index signature must have exactly one parameter." case 1097: // ts 3.2 "'{0}' list cannot be empty." + case 1098: // ts 3.3 "Type parameter list cannot be empty." + case 1099: // ts 3.3 "Type argument list cannot be empty." case 1117: // ts 3.2 "An object literal cannot have multiple properties with the same name in strict mode." case 1121: // ts 3.2 "Octal literals are not allowed in strict mode." case 1123: // ts 3.2: "Variable declaration list cannot be empty." diff --git a/packages/typescript-estree/src/temp-types-based-on-js-source.ts b/packages/typescript-estree/src/temp-types-based-on-js-source.ts deleted file mode 100644 index a2234fc1308a..000000000000 --- a/packages/typescript-estree/src/temp-types-based-on-js-source.ts +++ /dev/null @@ -1,106 +0,0 @@ -/** - * NOTE: The following types are inferred from usage within the original JavaScript source. - * - * They will be gradually replaced with the more accurate types derived from the ESTree spec, and its - * applicable extensions - */ -import { AST_NODE_TYPES } from './ast-node-types'; - -export interface ESTreeToken { - type: AST_NODE_TYPES; - range: [number, number]; - loc: ESTreeNodeLoc; - value: string; - regex?: { - pattern: string; - flags: string; - }; - object?: any; - property?: any; - name?: any; -} - -export interface ESTreeNode { - type: AST_NODE_TYPES; - range: [number, number]; - loc: ESTreeNodeLoc; - declaration?: ESTreeNode; - specifiers?: (ESTreeNode | null)[]; - source?: any; - typeAnnotation?: ESTreeNode | null; - typeParameters?: ESTreeNode | null; - id?: ESTreeNode | null; - raw?: string; - value?: string; - expression?: ESTreeNode | null; - decorators?: (ESTreeNode | null)[]; - implements?: (ESTreeNode | null)[]; - extends?: (ESTreeNode | null)[]; - const?: boolean; - declare?: boolean; - global?: boolean; - modifiers?: any; - body?: any; - params?: any; - accessibility?: 'public' | 'protected' | 'private'; - readonly?: boolean | string; - static?: boolean; - export?: boolean; - parameter?: any; - abstract?: boolean; - typeName?: ESTreeNode | null; - directive?: string; - returnType?: ESTreeNode; - optional?: boolean | string; -} - -export interface ESTreeComment { - type: 'Block' | 'Line'; - range?: [number, number]; - loc?: ESTreeNodeLoc; - value: string; -} - -export interface LineAndColumnData { - line: number; - column: number; -} - -export interface ESTreeNodeLoc { - start: LineAndColumnData; - end: LineAndColumnData; -} - -export interface Extra { - errorOnUnknownASTType: boolean; - errorOnTypeScriptSyntacticAndSemanticIssues: boolean; - useJSXTextNode: boolean; - tokens: null | ESTreeToken[]; - comment: boolean; - code: string; - range: boolean; - loc: boolean; - comments: ESTreeComment[]; - strict: boolean; - jsx: boolean; - log: Function; - projects: string[]; - tsconfigRootDir: string; - extraFileExtensions: string[]; -} - -export interface ParserOptions { - range?: boolean; - loc?: boolean; - tokens?: boolean; - comment?: boolean; - jsx?: boolean; - errorOnUnknownASTType?: boolean; - errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; - useJSXTextNode?: boolean; - loggerFn?: Function | false; - project?: string | string[]; - filePath?: string; - tsconfigRootDir?: string; - extraFileExtensions?: string[]; -} diff --git a/packages/typescript-estree/src/ts-estree.ts b/packages/typescript-estree/src/ts-estree.ts new file mode 100644 index 000000000000..846392c54430 --- /dev/null +++ b/packages/typescript-estree/src/ts-estree.ts @@ -0,0 +1,2 @@ +import * as TSESTree from './typedefs'; +export { TSESTree }; diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index 2212c4d0b1d0..3d68a034c16e 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -2,7 +2,7 @@ import path from 'path'; import ts from 'typescript'; -import { Extra } from './temp-types-based-on-js-source'; +import { Extra } from './parser-options'; //------------------------------------------------------------------------------ // Environment calculation @@ -10,7 +10,6 @@ import { Extra } from './temp-types-based-on-js-source'; /** * Default compiler options for program generation from single root file - * @type {ts.CompilerOptions} */ const defaultCompilerOptions: ts.CompilerOptions = { allowNonTsExtensions: true, @@ -19,7 +18,6 @@ const defaultCompilerOptions: ts.CompilerOptions = { /** * Maps tsconfig paths to their corresponding file contents and resulting watches - * @type {Map>} */ const knownWatchProgramMap = new Map< string, @@ -29,13 +27,11 @@ const knownWatchProgramMap = new Map< /** * Maps file paths to their set of corresponding watch callbacks * There may be more than one per file if a file is shared between projects - * @type {Map} */ const watchCallbackTrackingMap = new Map(); /** * Holds information about the file currently being linted - * @type {{code: string, filePath: string}} */ const currentLintOperationState = { code: '', @@ -44,8 +40,7 @@ const currentLintOperationState = { /** * Appropriately report issues found when reading a config file - * @param {ts.Diagnostic} diagnostic The diagnostic raised when creating a program - * @returns {void} + * @param diagnostic The diagnostic raised when creating a program */ function diagnosticReporter(diagnostic: ts.Diagnostic): void { throw new Error( @@ -57,11 +52,11 @@ const noopFileWatcher = { close: () => {} }; /** * Calculate project environments using options provided by consumer and paths from config - * @param {string} code The code being linted - * @param {string} filePath The path of the file being parsed - * @param {string} extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param {string[]} extra.project Provided tsconfig paths - * @returns {ts.Program[]} The programs corresponding to the supplied tsconfig paths + * @param code The code being linted + * @param filePath The path of the file being parsed + * @param extra.tsconfigRootDir The root directory for relative tsconfig paths + * @param extra.project Provided tsconfig paths + * @returns The programs corresponding to the supplied tsconfig paths */ export function calculateProjectParserOptions( code: string, @@ -187,9 +182,9 @@ export function calculateProjectParserOptions( * Create program from single root file. Requires a single tsconfig to be specified. * @param code The code being linted * @param filePath The file being linted - * @param {string} extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param {string[]} extra.project Provided tsconfig paths - * @returns {ts.Program} The program containing just the file being linted and associated library files + * @param extra.tsconfigRootDir The root directory for relative tsconfig paths + * @param extra.project Provided tsconfig paths + * @returns The program containing just the file being linted and associated library files */ export function createProgram(code: string, filePath: string, extra: Extra) { if (!extra.projects || extra.projects.length !== 1) { diff --git a/packages/typescript-estree/src/typedefs.ts b/packages/typescript-estree/src/typedefs.ts new file mode 100644 index 000000000000..af8d17e0157a --- /dev/null +++ b/packages/typescript-estree/src/typedefs.ts @@ -0,0 +1,1420 @@ +import { AST_NODE_TYPES } from './ast-node-types'; + +export interface LineAndColumnData { + /** + * Line number (1-indexed) + */ + line: number; + /** + * Column number on the line (0-indexed) + */ + column: number; +} +export interface SourceLocation { + /** + * The position of the first character of the parsed source region + */ + start: LineAndColumnData; + /** + * The position of the first character after the parsed source region + */ + end: LineAndColumnData; +} + +export interface BaseNode { + /** + * The source location information of the node. + */ + loc: SourceLocation; + /** + * An array of two numbers. + * Both numbers are a 0-based index which is the position in the array of source code characters. + * The first is the start position of the node, the second is the end position of the node. + */ + range: [number, number]; + /** + * The parent node of the current node + */ + parent?: Node; + + // every node *will* have a type, but let the nodes define their own exact string + // type: string; + + // we don't ever set this from within ts-estree + // source?: string | null; +} + +/* + * Token and Comment are pseudo-nodes to represent pieces of source code + * + * NOTE: + * They are not included in the `Node` union below on purpose because they + * are not ever included as part of the standard AST tree. + */ + +export type TokenType = + | 'Boolean' + | 'Identifier' + | 'JSXIdentifier' + | 'JSXMemberExpression' + | 'JSXText' + | 'Keyword' + | 'Null' + | 'Numeric' + | 'Punctuator' + | 'RegularExpression' + | 'String' + | 'Template'; + +export interface Token extends BaseNode { + type: TokenType; + value: string; + regex?: { + pattern: string; + flags: string; + }; +} +export interface Comment extends BaseNode { + type: 'Line' | 'Block'; + value: string; +} + +export type OptionalRangeAndLoc = Pick< + T, + Exclude +> & { + range?: [number, number]; + loc?: SourceLocation; +}; + +// Every single valid AST Node +// Please keep it sorted alphabetically. +export type Node = + | ArrayExpression + | ArrayPattern + | ArrowFunctionExpression + | AssignmentExpression + | AssignmentPattern + | AwaitExpression + | BigIntLiteral + | BinaryExpression + | BlockStatement + | BreakStatement + | CallExpression + | CatchClause + | ClassBody + | ClassDeclaration + | ClassExpression + | ClassProperty + | ConditionalExpression + | ContinueStatement + | DebuggerStatement + | Decorator + | DoWhileStatement + | EmptyStatement + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | ExportSpecifier + | ExpressionStatement + | ForInStatement + | ForOfStatement + | ForStatement + | FunctionDeclaration + | FunctionExpression + | Identifier + | IfStatement + | Import + | ImportDeclaration + | ImportDefaultSpecifier + | ImportNamespaceSpecifier + | ImportSpecifier + | JSXAttribute + | JSXClosingElement + | JSXClosingFragment + | JSXElement + | JSXEmptyExpression + | JSXExpressionContainer + | JSXFragment + | JSXIdentifier + | JSXOpeningElement + | JSXOpeningFragment + | JSXSpreadAttribute + | JSXSpreadChild + | JSXText + | LabeledStatement + | Literal + | LogicalExpression + | MemberExpression + | MetaProperty + | MethodDefinition + | NewExpression + | ObjectExpression + | ObjectPattern + | Program + | Property + | RestElement + | ReturnStatement + | SequenceExpression + | SpreadElement + | Super + | SwitchCase + | SwitchStatement + | TaggedTemplateExpression + | TemplateElement + | TemplateLiteral + | ThisExpression + | ThrowStatement + | TryStatement + | TSAbstractClassProperty + | TSAbstractKeyword + | TSAbstractMethodDefinition + | TSAnyKeyword + | TSArrayType + | TSAsExpression + | TSAsyncKeyword + | TSBigIntKeyword + | TSBooleanKeyword + | TSCallSignatureDeclaration + | TSClassImplements + | TSConditionalType + | TSConstructorType + | TSConstructSignatureDeclaration + | TSDeclareFunction + | TSDeclareKeyword + | TSEnumDeclaration + | TSEnumMember + | TSExportAssignment + | TSExportKeyword + | TSExternalModuleReference + | TSFunctionType + | TSImportEqualsDeclaration + | TSImportType + | TSIndexedAccessType + | TSIndexSignature + | TSInferType + | TSInterfaceDeclaration + | TSInterfaceBody + | TSInterfaceHeritage + | TSIntersectionType + | TSLiteralType + | TSMappedType + | TSMethodSignature + | TSModuleBlock + | TSModuleDeclaration + | TSNamespaceExportDeclaration + | TSNeverKeyword + | TSNonNullExpression + | TSNullKeyword + | TSNumberKeyword + | TSObjectKeyword + | TSOptionalType + | TSParameterProperty + | TSParenthesizedType + | TSPropertySignature + | TSPublicKeyword + | TSPrivateKeyword + | TSProtectedKeyword + | TSQualifiedName + | TSReadonlyKeyword + | TSRestType + | TSStaticKeyword + | TSStringKeyword + | TSSymbolKeyword + | TSThisType + | TSTupleType + | TSTypeAliasDeclaration + | TSTypeAnnotation + | TSTypeAssertion + | TSTypeLiteral + | TSTypeOperator + | TSTypeParameter + | TSTypeParameterDeclaration + | TSTypeParameterInstantiation + | TSTypePredicate + | TSTypeQuery + | TSTypeReference + | TSUndefinedKeyword + | TSUnionType + | TSUnknownKeyword + | TSVoidKeyword + | UpdateExpression + | UnaryExpression + | VariableDeclaration + | VariableDeclarator + | WhileStatement + | WithStatement + | YieldExpression; + +////////// +// Reusable Unions +// These are based off of types used in the Typescript AST definitions +// **Ensure you sort the union members alphabetically** +////////// + +export type Accessibility = 'public' | 'protected' | 'private'; +export type BindingPattern = ArrayPattern | ObjectPattern; +export type BindingName = BindingPattern | Identifier; +export type ClassElement = + | ClassProperty + | FunctionExpression + | MethodDefinition + | TSAbstractClassProperty + | TSAbstractMethodDefinition + | TSIndexSignature; +export type DeclarationStatement = + | ClassDeclaration + | ClassExpression + | ExportAllDeclaration + | ExportNamedDeclaration + | FunctionDeclaration + | TSDeclareFunction + | TSImportEqualsDeclaration + | TSInterfaceDeclaration + | TSModuleDeclaration + | TSNamespaceExportDeclaration + | TSTypeAliasDeclaration + | TSEnumDeclaration; +export type EntityName = Identifier | TSQualifiedName; +export type ExportDeclaration = + | ClassDeclaration + | ClassExpression + | FunctionDeclaration + | TSDeclareFunction + | TSEnumDeclaration + | TSInterfaceDeclaration + | TSModuleDeclaration + | TSTypeAliasDeclaration + | VariableDeclarator; +export type Expression = + | ArrowFunctionExpression + | AssignmentExpression + | BinaryExpression + | ConditionalExpression + | JSXClosingElement + | JSXClosingFragment + | JSXExpressionContainer + | JSXOpeningElement + | JSXOpeningFragment + | JSXSpreadChild + | LogicalExpression + | RestElement + | SequenceExpression + | SpreadElement + | TSAsExpression + | TSUnaryExpression + | YieldExpression; +export type ExpressionWithTypeArguments = + | TSClassImplements + | TSInterfaceHeritage; +export type ForInitialiser = Expression | VariableDeclaration; +export type ImportClause = + | ImportDefaultSpecifier + | ImportNamespaceSpecifier + | ImportSpecifier; +export type IterationStatement = + | DoWhileStatement + | ForInStatement + | ForOfStatement + | ForStatement + | WhileStatement; +export type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText; +export type JSXExpression = + | JSXEmptyExpression + | JSXSpreadChild + | JSXExpressionContainer; +export type JSXTagNameExpression = JSXIdentifier | JSXMemberExpression; +export type LeftHandSideExpression = + | CallExpression + | ClassExpression + | ClassDeclaration + | FunctionExpression + | LiteralExpression + | MemberExpression + | PrimaryExpression + | TaggedTemplateExpression + | TSNonNullExpression; +export type LiteralExpression = BigIntLiteral | Literal | TemplateLiteral; +export type Modifier = + | TSAbstractKeyword + | TSAsyncKeyword + | TSDeclareKeyword + | TSExportKeyword + | TSPublicKeyword + | TSPrivateKeyword + | TSProtectedKeyword + | TSReadonlyKeyword + | TSStaticKeyword; +export type ObjectLiteralElementLike = + | MethodDefinition + | Property + | RestElement + | SpreadElement + | TSAbstractMethodDefinition; +export type Parameter = + | AssignmentPattern + | RestElement + | ArrayPattern + | ObjectPattern + | Identifier + | TSParameterProperty; +export type PrimaryExpression = + | ArrayExpression + | ArrayPattern + | ClassExpression + | FunctionExpression + | Identifier + | Import + | JSXElement + | JSXFragment + | JSXOpeningElement + | Literal + | LiteralExpression + | MetaProperty + | ObjectExpression + | ObjectPattern + | Super + | TemplateLiteral + | ThisExpression + | TSNullKeyword; +export type PropertyName = Identifier | Literal; +export type Statement = + | BlockStatement + | BreakStatement + | ContinueStatement + | DebuggerStatement + | DeclarationStatement + | EmptyStatement + | ExpressionStatement + | IfStatement + | IterationStatement + | ImportDeclaration + | LabeledStatement + | TSModuleBlock + | ReturnStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | VariableDeclaration + | WithStatement; +export type TypeElement = + | TSCallSignatureDeclaration + | TSConstructSignatureDeclaration + | TSIndexSignature + | TSMethodSignature + | TSPropertySignature; +export type TypeNode = + | ThisExpression + | TSAnyKeyword + | TSArrayType + | TSBigIntKeyword + | TSBooleanKeyword + | TSClassImplements + | TSConditionalType + | TSConstructorType + | TSFunctionType + | TSImportType + | TSIndexedAccessType + | TSInferType + | TSInterfaceHeritage + | TSIntersectionType + | TSLiteralType + | TSMappedType + | TSNeverKeyword + | TSNullKeyword + | TSNumberKeyword + | TSObjectKeyword + | TSOptionalType + | TSParenthesizedType + | TSRestType + | TSStringKeyword + | TSSymbolKeyword + | TSThisType + | TSTupleType + | TSTypeLiteral + | TSTypeOperator + | TSTypeReference + | TSTypePredicate + | TSTypeQuery + | TSUndefinedKeyword + | TSUnionType + | TSUnknownKeyword + | TSVoidKeyword; +export type TSUnaryExpression = + | AwaitExpression + | LeftHandSideExpression + | TSTypeAssertion + | UnaryExpression + | UpdateExpression; + +/////////////// +// Base, common types +// **Ensure you sort the interfaces alphabetically** +/////////////// + +interface BinaryExpressionBase extends BaseNode { + operator: string; + left: Expression; + right: Expression; +} + +interface ClassDeclarationBase extends BaseNode { + typeParameters?: TSTypeParameterDeclaration; + superTypeParameters?: TSTypeParameterInstantiation; + id?: Identifier; + body: ClassBody; + superClass?: LeftHandSideExpression; + implements?: ExpressionWithTypeArguments[]; + abstract?: boolean; + declare?: boolean; + decorators?: Decorator[]; +} + +interface ClassPropertyBase extends BaseNode { + key: PropertyName; + value: Expression; + computed: boolean; + static: boolean; + readonly?: boolean; + decorators?: Decorator[]; + accessibility?: Accessibility; + optional?: boolean; + definite?: boolean; + typeAnnotation?: TSTypeAnnotation; +} + +interface FunctionDeclarationBase extends BaseNode { + id: Identifier | null; + generator: boolean; + expression: boolean; + async: boolean; + params: Parameter[]; + body?: BlockStatement | null; + returnType?: TSTypeAnnotation; + typeParameters?: TSTypeParameterDeclaration; + declare?: boolean; +} + +interface FunctionSignatureBase extends BaseNode { + params: Parameter[]; + returnType?: TSTypeAnnotation; + typeParameters?: TSTypeParameterDeclaration; +} + +interface LiteralBase extends BaseNode { + raw: string; + value: boolean | number | RegExp | string | null; + regex?: { + pattern: string; + flags: string; + }; +} + +interface MethodDefinitionBase extends BaseNode { + key: PropertyName; + value: FunctionExpression; + computed: boolean; + static: boolean; + kind: 'method' | 'get' | 'set' | 'constructor'; + decorators?: Decorator[]; + accessibility?: Accessibility; + typeParameters?: TSTypeParameterDeclaration; +} + +interface TSHeritageBase extends BaseNode { + expression: Expression; + typeParameters?: TSTypeParameterInstantiation; +} + +interface UnaryExpressionBase extends BaseNode { + operator: string; + prefix: boolean; + argument: LeftHandSideExpression | Literal | UnaryExpression; +} + +/////////////// +// Typescript ESTree Nodes +// **Ensure you sort the interfaces alphabetically** +/////////////// + +export interface ArrayExpression extends BaseNode { + type: AST_NODE_TYPES.ArrayExpression; + elements: Expression[]; +} + +export interface ArrayPattern extends BaseNode { + type: AST_NODE_TYPES.ArrayPattern; + elements: Expression[]; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + decorators?: Decorator[]; +} + +export interface ArrowFunctionExpression extends BaseNode { + type: AST_NODE_TYPES.ArrowFunctionExpression; + generator: boolean; + id: null; + params: Parameter[]; + body: Expression | BlockStatement; + async: boolean; + expression: boolean; + returnType?: TSTypeAnnotation; + typeParameters?: TSTypeParameterDeclaration; +} + +export interface AssignmentExpression extends BinaryExpressionBase { + type: AST_NODE_TYPES.AssignmentExpression; +} + +export interface AssignmentPattern extends BaseNode { + type: AST_NODE_TYPES.AssignmentPattern; + left: BindingName; + right?: Expression; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + decorators?: Decorator[]; +} + +export interface AwaitExpression extends BaseNode { + type: AST_NODE_TYPES.AwaitExpression; + argument: TSUnaryExpression; +} + +export interface BigIntLiteral extends LiteralBase { + type: AST_NODE_TYPES.BigIntLiteral; +} + +export interface BinaryExpression extends BinaryExpressionBase { + type: AST_NODE_TYPES.BinaryExpression; +} + +export interface BlockStatement extends BaseNode { + type: AST_NODE_TYPES.BlockStatement; + body: Statement[]; +} + +export interface BreakStatement extends BaseNode { + type: AST_NODE_TYPES.BreakStatement; + label: Identifier | null; +} + +export interface CallExpression extends BaseNode { + type: AST_NODE_TYPES.CallExpression; + callee: LeftHandSideExpression; + arguments: Expression[]; + typeParameters?: TSTypeParameterInstantiation; +} + +export interface CatchClause extends BaseNode { + type: AST_NODE_TYPES.CatchClause; + param: BindingName | null; + body: BlockStatement; +} + +export interface ClassBody extends BaseNode { + type: AST_NODE_TYPES.ClassBody; + body: ClassElement[]; +} + +export interface ClassDeclaration extends ClassDeclarationBase { + type: AST_NODE_TYPES.ClassDeclaration; +} + +export interface ClassExpression extends ClassDeclarationBase { + type: AST_NODE_TYPES.ClassExpression; +} + +export interface ClassProperty extends ClassPropertyBase { + type: AST_NODE_TYPES.ClassProperty; +} + +export interface ConditionalExpression extends BaseNode { + type: AST_NODE_TYPES.ConditionalExpression; + test: Expression; + consequent: Expression; + alternate: Expression; +} + +export interface ContinueStatement extends BaseNode { + type: AST_NODE_TYPES.ContinueStatement; + label: Identifier | null; +} + +export interface DebuggerStatement extends BaseNode { + type: AST_NODE_TYPES.DebuggerStatement; +} + +export interface Decorator extends BaseNode { + type: AST_NODE_TYPES.Decorator; + expression: LeftHandSideExpression; +} + +export interface DoWhileStatement extends BaseNode { + type: AST_NODE_TYPES.DoWhileStatement; + test: Expression; + body: Statement; +} + +export interface EmptyStatement extends BaseNode { + type: AST_NODE_TYPES.EmptyStatement; +} + +export interface ExportAllDeclaration extends BaseNode { + type: AST_NODE_TYPES.ExportAllDeclaration; + source: Expression | null; +} + +export interface ExportDefaultDeclaration extends BaseNode { + type: AST_NODE_TYPES.ExportDefaultDeclaration; + declaration: ExportDeclaration; +} + +export interface ExportNamedDeclaration extends BaseNode { + type: AST_NODE_TYPES.ExportNamedDeclaration; + declaration: ExportDeclaration | null; + specifiers: ExportSpecifier[]; + source: Expression | null; +} + +export interface ExportSpecifier extends BaseNode { + type: AST_NODE_TYPES.ExportSpecifier; + local: Identifier; + exported: Identifier; +} + +export interface ExpressionStatement extends BaseNode { + type: AST_NODE_TYPES.ExpressionStatement; + expression: Expression; +} + +export interface ForInStatement extends BaseNode { + type: AST_NODE_TYPES.ForInStatement; + left: ForInitialiser; + right: Expression; + body: Statement; +} + +export interface ForOfStatement extends BaseNode { + type: AST_NODE_TYPES.ForOfStatement; + left: ForInitialiser; + right: Expression; + body: Statement; + await: boolean; +} + +export interface ForStatement extends BaseNode { + type: AST_NODE_TYPES.ForStatement; + init: Expression | ForInitialiser | null; + test: Expression | null; + update: Expression | null; + body: Statement; +} + +export interface FunctionDeclaration extends FunctionDeclarationBase { + type: AST_NODE_TYPES.FunctionDeclaration; +} + +export interface FunctionExpression extends FunctionDeclarationBase { + type: AST_NODE_TYPES.FunctionExpression; +} + +export interface Identifier extends BaseNode { + type: AST_NODE_TYPES.Identifier; + name: string; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + decorators?: Decorator[]; +} + +export interface IfStatement extends BaseNode { + type: AST_NODE_TYPES.IfStatement; + test: Expression; + consequent: Statement; + alternate: Statement | null; +} + +export interface Import extends BaseNode { + type: AST_NODE_TYPES.Import; +} + +export interface ImportDeclaration extends BaseNode { + type: AST_NODE_TYPES.ImportDeclaration; + source: Expression; + specifiers: ImportClause[]; +} + +export interface ImportDefaultSpecifier extends BaseNode { + type: AST_NODE_TYPES.ImportDefaultSpecifier; + local: Identifier; +} + +export interface ImportNamespaceSpecifier extends BaseNode { + type: AST_NODE_TYPES.ImportNamespaceSpecifier; + local: Identifier; +} + +export interface ImportSpecifier extends BaseNode { + type: AST_NODE_TYPES.ImportSpecifier; + local: Identifier; + imported: Identifier; +} + +export interface JSXAttribute extends BaseNode { + type: AST_NODE_TYPES.JSXAttribute; + name: JSXIdentifier; + value: Literal | JSXExpression | null; +} + +export interface JSXClosingElement extends BaseNode { + type: AST_NODE_TYPES.JSXClosingElement; + name: JSXTagNameExpression; +} + +export interface JSXClosingFragment extends BaseNode { + type: AST_NODE_TYPES.JSXClosingFragment; +} + +export interface JSXElement extends BaseNode { + type: AST_NODE_TYPES.JSXElement; + openingElement: JSXOpeningElement; + closingElement: JSXClosingElement | null; + children: JSXChild[]; +} + +export interface JSXEmptyExpression extends BaseNode { + type: AST_NODE_TYPES.JSXEmptyExpression; +} + +export interface JSXExpressionContainer extends BaseNode { + type: AST_NODE_TYPES.JSXExpressionContainer; + expression: Expression | JSXEmptyExpression; +} + +export interface JSXFragment extends BaseNode { + type: AST_NODE_TYPES.JSXFragment; + openingFragment: JSXOpeningFragment; + closingFragment: JSXClosingFragment; + children: JSXChild[]; +} + +export interface JSXIdentifier extends BaseNode { + type: AST_NODE_TYPES.JSXIdentifier; + name: string; +} + +export interface JSXMemberExpression extends BaseNode { + type: AST_NODE_TYPES.JSXMemberExpression; + object: JSXTagNameExpression; + property: JSXIdentifier; +} + +export interface JSXOpeningElement extends BaseNode { + type: AST_NODE_TYPES.JSXOpeningElement; + typeParameters?: TSTypeParameterInstantiation; + selfClosing: boolean; + name: JSXTagNameExpression; + attributes: JSXAttribute[]; +} + +export interface JSXOpeningFragment extends BaseNode { + type: AST_NODE_TYPES.JSXOpeningFragment; +} + +export interface JSXSpreadAttribute extends BaseNode { + type: AST_NODE_TYPES.JSXSpreadAttribute; + argument: Expression; +} + +export interface JSXSpreadChild extends BaseNode { + type: AST_NODE_TYPES.JSXSpreadChild; + expression: Expression | JSXEmptyExpression; +} + +export interface JSXText extends BaseNode { + type: AST_NODE_TYPES.JSXText; + value: string; + raw: string; +} + +export interface LabeledStatement extends BaseNode { + type: AST_NODE_TYPES.LabeledStatement; + label: Identifier; + body: Statement; +} + +export interface Literal extends LiteralBase { + type: AST_NODE_TYPES.Literal; +} + +export interface LogicalExpression extends BinaryExpressionBase { + type: AST_NODE_TYPES.LogicalExpression; +} + +export interface MemberExpression extends BaseNode { + type: AST_NODE_TYPES.MemberExpression; + object: LeftHandSideExpression; + property: Expression | Identifier; + computed?: boolean; +} + +export interface MetaProperty extends BaseNode { + type: AST_NODE_TYPES.MetaProperty; + meta: Identifier; + property: Identifier; +} + +export interface MethodDefinition extends MethodDefinitionBase { + type: AST_NODE_TYPES.MethodDefinition; +} + +export interface NewExpression extends BaseNode { + type: AST_NODE_TYPES.NewExpression; + callee: LeftHandSideExpression; + arguments: Expression[]; + typeParameters?: TSTypeParameterInstantiation; +} + +export interface ObjectExpression extends BaseNode { + type: AST_NODE_TYPES.ObjectExpression; + properties: ObjectLiteralElementLike[]; +} + +export interface ObjectPattern extends BaseNode { + type: AST_NODE_TYPES.ObjectPattern; + properties: ObjectLiteralElementLike[]; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + decorators?: Decorator[]; +} + +export interface Program extends BaseNode { + type: AST_NODE_TYPES.Program; + body: Statement[]; + sourceType: 'module' | 'script'; + comments?: Comment[]; + tokens?: Token[]; +} + +export interface Property extends BaseNode { + type: AST_NODE_TYPES.Property; + key: PropertyName; + value: Expression | AssignmentPattern | BindingName; + computed: boolean; + method: boolean; + shorthand: boolean; + kind: 'init'; +} + +export interface RestElement extends BaseNode { + type: AST_NODE_TYPES.RestElement; + argument: BindingName | Expression | PropertyName; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + value?: AssignmentPattern; + decorators?: Decorator[]; +} + +export interface ReturnStatement extends BaseNode { + type: AST_NODE_TYPES.ReturnStatement; + argument: Expression | null; +} + +export interface SequenceExpression extends BaseNode { + type: AST_NODE_TYPES.SequenceExpression; + expressions: Expression[]; +} + +export interface SpreadElement extends BaseNode { + type: AST_NODE_TYPES.SpreadElement; + argument: BindingName | Expression | PropertyName; +} + +export interface Super extends BaseNode { + type: AST_NODE_TYPES.Super; +} + +export interface SwitchCase extends BaseNode { + type: AST_NODE_TYPES.SwitchCase; + test: Expression; + consequent: Statement[]; +} + +export interface SwitchStatement extends BaseNode { + type: AST_NODE_TYPES.SwitchStatement; + discriminant: Expression; + cases: SwitchCase[]; +} + +export interface TaggedTemplateExpression extends BaseNode { + type: AST_NODE_TYPES.TaggedTemplateExpression; + typeParameters?: TSTypeParameterInstantiation; + tag: LeftHandSideExpression; + quasi: TemplateLiteral; +} + +export interface TemplateElement extends BaseNode { + type: AST_NODE_TYPES.TemplateElement; + value: { + raw: string; + cooked: string; + }; + tail: boolean; +} + +export interface TemplateLiteral extends BaseNode { + type: AST_NODE_TYPES.TemplateLiteral; + quasis: TemplateElement[]; + expressions: Expression[]; +} + +export interface ThisExpression extends BaseNode { + type: AST_NODE_TYPES.ThisExpression; +} + +export interface ThrowStatement extends BaseNode { + type: AST_NODE_TYPES.ThrowStatement; + argument: Statement | null; +} + +export interface TryStatement extends BaseNode { + type: AST_NODE_TYPES.TryStatement; + block: BlockStatement; + handler: CatchClause | null; + finalizer: BlockStatement; +} + +export interface TSAbstractClassProperty extends ClassPropertyBase { + type: AST_NODE_TYPES.TSAbstractClassProperty; +} + +export interface TSAbstractKeyword extends BaseNode { + type: AST_NODE_TYPES.TSAbstractKeyword; +} + +export interface TSAbstractMethodDefinition extends MethodDefinitionBase { + type: AST_NODE_TYPES.TSAbstractMethodDefinition; +} + +export interface TSAnyKeyword extends BaseNode { + type: AST_NODE_TYPES.TSAnyKeyword; +} + +export interface TSArrayType extends BaseNode { + type: AST_NODE_TYPES.TSArrayType; + elementType: TypeNode; +} + +export interface TSAsExpression extends BaseNode { + type: AST_NODE_TYPES.TSAsExpression; + expression: Expression; + typeAnnotation: TypeNode; +} + +export interface TSAsyncKeyword extends BaseNode { + type: AST_NODE_TYPES.TSAsyncKeyword; +} + +export interface TSBigIntKeyword extends BaseNode { + type: AST_NODE_TYPES.TSBigIntKeyword; +} + +export interface TSBooleanKeyword extends BaseNode { + type: AST_NODE_TYPES.TSBooleanKeyword; +} + +export interface TSCallSignatureDeclaration extends FunctionSignatureBase { + type: AST_NODE_TYPES.TSCallSignatureDeclaration; +} + +export interface TSClassImplements extends TSHeritageBase { + type: AST_NODE_TYPES.TSClassImplements; +} + +export interface TSConditionalType extends BaseNode { + type: AST_NODE_TYPES.TSConditionalType; + checkType: TypeNode; + extendsType: TypeNode; + trueType: TypeNode; + falseType: TypeNode; +} + +export interface TSConstructorType extends FunctionSignatureBase { + type: AST_NODE_TYPES.TSConstructorType; +} + +export interface TSConstructSignatureDeclaration extends FunctionSignatureBase { + type: AST_NODE_TYPES.TSConstructSignatureDeclaration; +} + +export interface TSDeclareFunction extends FunctionDeclarationBase { + type: AST_NODE_TYPES.TSDeclareFunction; +} + +export interface TSDeclareKeyword extends BaseNode { + type: AST_NODE_TYPES.TSDeclareKeyword; +} + +export interface TSEnumDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSEnumDeclaration; + id: Identifier; + members: TSEnumMember[]; + const?: boolean; + declare?: boolean; + modifiers?: Modifier[]; + decorators?: Decorator[]; +} + +export interface TSEnumMember extends BaseNode { + type: AST_NODE_TYPES.TSEnumMember; + id: PropertyName; + initializer?: Expression; +} + +export interface TSExportAssignment extends BaseNode { + type: AST_NODE_TYPES.TSExportAssignment; + expression: Expression; +} + +export interface TSExportKeyword extends BaseNode { + type: AST_NODE_TYPES.TSExportKeyword; +} + +export interface TSExternalModuleReference extends BaseNode { + type: AST_NODE_TYPES.TSExternalModuleReference; + expression: Expression; +} + +export interface TSFunctionType extends FunctionSignatureBase { + type: AST_NODE_TYPES.TSFunctionType; +} + +export interface TSImportEqualsDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSImportEqualsDeclaration; + id: Identifier; + moduleReference: EntityName | TSExternalModuleReference; + isExport: boolean; +} + +export interface TSImportType extends BaseNode { + type: AST_NODE_TYPES.TSImportType; + isTypeOf: boolean; + parameter: TypeNode; + qualifier: EntityName | null; + typeParameters: TSTypeParameterInstantiation | null; +} + +export interface TSIndexedAccessType extends BaseNode { + type: AST_NODE_TYPES.TSIndexedAccessType; + objectType: TypeNode; + indexType: TypeNode; +} + +export interface TSIndexSignature extends BaseNode { + type: AST_NODE_TYPES.TSIndexSignature; + parameters: Parameter[]; + typeAnnotation?: TSTypeAnnotation; + readonly?: boolean; + accessibility?: Accessibility; + export?: boolean; + static?: boolean; +} + +export interface TSInferType extends BaseNode { + type: AST_NODE_TYPES.TSInferType; + typeParameter: TSTypeParameterDeclaration; +} + +export interface TSInterfaceDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSInterfaceDeclaration; + body: TSInterfaceBody; + id: Identifier; + typeParameters?: TSTypeParameterDeclaration; + extends?: ExpressionWithTypeArguments[]; + implements?: ExpressionWithTypeArguments[]; + decorators?: Decorator[]; + abstract?: boolean; + declare?: boolean; +} + +export interface TSInterfaceBody extends BaseNode { + type: AST_NODE_TYPES.TSInterfaceBody; + body: TypeElement[]; +} + +export interface TSInterfaceHeritage extends TSHeritageBase { + type: AST_NODE_TYPES.TSInterfaceHeritage; +} + +export interface TSIntersectionType extends BaseNode { + type: AST_NODE_TYPES.TSIntersectionType; + types: TypeNode[]; +} + +export interface TSLiteralType extends BaseNode { + type: AST_NODE_TYPES.TSLiteralType; + literal: LiteralExpression | UnaryExpression | UpdateExpression; +} + +export interface TSMappedType extends BaseNode { + type: AST_NODE_TYPES.TSMappedType; + typeParameter: TSTypeParameterDeclaration; + readonly?: boolean | '-' | '+'; + optional?: boolean | '-' | '+'; + typeAnnotation?: TypeNode; +} + +export interface TSMethodSignature extends BaseNode { + type: AST_NODE_TYPES.TSMethodSignature; + computed: boolean; + key: PropertyName; + params: Parameter[]; + optional?: boolean; + returnType?: TSTypeAnnotation; + readonly?: boolean; + typeParameters?: TSTypeParameterDeclaration; + accessibility?: Accessibility; + export?: boolean; + static?: boolean; +} + +export interface TSModuleBlock extends BaseNode { + type: AST_NODE_TYPES.TSModuleBlock; + body: Statement[]; +} + +export interface TSModuleDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSModuleDeclaration; + id: Identifier | Literal; + body?: TSModuleBlock | TSModuleDeclaration; + global?: boolean; + declare?: boolean; + modifiers?: Modifier[]; +} + +export interface TSNamespaceExportDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSNamespaceExportDeclaration; + id: Identifier; +} + +export interface TSNeverKeyword extends BaseNode { + type: AST_NODE_TYPES.TSNeverKeyword; +} + +export interface TSNonNullExpression extends BaseNode { + type: AST_NODE_TYPES.TSNonNullExpression; + expression: Expression; +} + +export interface TSNullKeyword extends BaseNode { + type: AST_NODE_TYPES.TSNullKeyword; +} + +export interface TSNumberKeyword extends BaseNode { + type: AST_NODE_TYPES.TSNumberKeyword; +} + +export interface TSObjectKeyword extends BaseNode { + type: AST_NODE_TYPES.TSObjectKeyword; +} + +export interface TSOptionalType extends BaseNode { + type: AST_NODE_TYPES.TSOptionalType; + typeAnnotation: TypeNode; +} + +export interface TSParameterProperty extends BaseNode { + type: AST_NODE_TYPES.TSParameterProperty; + accessibility?: Accessibility; + readonly?: boolean; + static?: boolean; + export?: boolean; + parameter: AssignmentPattern | BindingName | RestElement; + decorators?: Decorator[]; +} + +export interface TSParenthesizedType extends BaseNode { + type: AST_NODE_TYPES.TSParenthesizedType; + typeAnnotation: TypeNode; +} + +export interface TSPropertySignature extends BaseNode { + type: AST_NODE_TYPES.TSPropertySignature; + optional?: boolean; + computed: boolean; + key: PropertyName; + typeAnnotation?: TSTypeAnnotation; + initializer?: Expression; + readonly?: boolean; + static?: boolean; + export?: boolean; + accessibility?: Accessibility; +} + +export interface TSPublicKeyword extends BaseNode { + type: AST_NODE_TYPES.TSPublicKeyword; +} + +export interface TSPrivateKeyword extends BaseNode { + type: AST_NODE_TYPES.TSPrivateKeyword; +} + +export interface TSProtectedKeyword extends BaseNode { + type: AST_NODE_TYPES.TSProtectedKeyword; +} + +export interface TSQualifiedName extends BaseNode { + type: AST_NODE_TYPES.TSQualifiedName; + left: EntityName; + right: Identifier; +} + +export interface TSReadonlyKeyword extends BaseNode { + type: AST_NODE_TYPES.TSReadonlyKeyword; +} + +export interface TSRestType extends BaseNode { + type: AST_NODE_TYPES.TSRestType; + typeAnnotation: TypeNode; +} + +export interface TSStaticKeyword extends BaseNode { + type: AST_NODE_TYPES.TSStaticKeyword; +} + +export interface TSStringKeyword extends BaseNode { + type: AST_NODE_TYPES.TSStringKeyword; +} + +export interface TSSymbolKeyword extends BaseNode { + type: AST_NODE_TYPES.TSSymbolKeyword; +} + +export interface TSThisType extends BaseNode { + type: AST_NODE_TYPES.TSThisType; +} + +export interface TSTupleType extends BaseNode { + type: AST_NODE_TYPES.TSTupleType; + elementTypes: TypeNode[]; +} + +export interface TSTypeAliasDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSTypeAliasDeclaration; + id: Identifier; + typeAnnotation: TypeNode; + declare?: boolean; + typeParameters?: TSTypeParameterDeclaration; +} + +export interface TSTypeAnnotation extends BaseNode { + type: AST_NODE_TYPES.TSTypeAnnotation; + typeAnnotation: TypeNode; +} + +export interface TSTypeAssertion extends BaseNode { + type: AST_NODE_TYPES.TSTypeAssertion; + typeAnnotation: TypeNode; + expression: UnaryExpression; +} + +export interface TSTypeLiteral extends BaseNode { + type: AST_NODE_TYPES.TSTypeLiteral; + members: TypeElement[]; +} + +export interface TSTypeOperator extends BaseNode { + type: AST_NODE_TYPES.TSTypeOperator; + operator: 'keyof' | 'unique'; + typeAnnotation?: TSTypeAnnotation; +} + +export interface TSTypeParameter extends BaseNode { + type: AST_NODE_TYPES.TSTypeParameter; + name: Identifier; + constraint?: TypeNode; + default?: TypeNode; +} + +export interface TSTypeParameterDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSTypeParameterDeclaration; + params: TSTypeParameter[]; +} + +export interface TSTypeParameterInstantiation extends BaseNode { + type: AST_NODE_TYPES.TSTypeParameterInstantiation; + params: TypeNode[]; +} + +export interface TSTypePredicate extends BaseNode { + type: AST_NODE_TYPES.TSTypePredicate; + parameterName: Identifier | TSThisType; + typeAnnotation: TSTypeAnnotation; +} + +export interface TSTypeQuery extends BaseNode { + type: AST_NODE_TYPES.TSTypeQuery; + exprName: EntityName; +} + +export interface TSTypeReference extends BaseNode { + type: AST_NODE_TYPES.TSTypeReference; + typeName: EntityName; + typeParameters?: TSTypeParameterInstantiation; +} + +export interface TSUndefinedKeyword extends BaseNode { + type: AST_NODE_TYPES.TSUndefinedKeyword; +} + +export interface TSUnionType extends BaseNode { + type: AST_NODE_TYPES.TSUnionType; + types: TypeNode[]; +} + +export interface TSUnknownKeyword extends BaseNode { + type: AST_NODE_TYPES.TSUnknownKeyword; +} + +export interface TSVoidKeyword extends BaseNode { + type: AST_NODE_TYPES.TSVoidKeyword; +} + +export interface UpdateExpression extends UnaryExpressionBase { + type: AST_NODE_TYPES.UpdateExpression; +} + +export interface UnaryExpression extends UnaryExpressionBase { + type: AST_NODE_TYPES.UnaryExpression; +} + +export interface VariableDeclaration extends BaseNode { + type: AST_NODE_TYPES.VariableDeclaration; + declarations: VariableDeclarator[]; + kind: 'let' | 'const' | 'var'; + declare?: boolean; +} + +export interface VariableDeclarator extends BaseNode { + type: AST_NODE_TYPES.VariableDeclarator; + id: BindingName; + init: Expression | null; + definite?: boolean; +} + +export interface WhileStatement extends BaseNode { + type: AST_NODE_TYPES.WhileStatement; + test: Expression; + body: Statement; +} + +export interface WithStatement extends BaseNode { + type: AST_NODE_TYPES.WithStatement; + object: Expression; + body: Statement; +} + +export interface YieldExpression extends BaseNode { + type: AST_NODE_TYPES.YieldExpression; + delegate: boolean; + argument?: Expression; +} diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 59210d587f95..8fc5d6acd68c 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -2,7 +2,8 @@ import glob from 'glob'; import fs from 'fs'; import path from 'path'; -import jsxKnownIssues from '../../../typescript-eslint-shared-fixtures/jsx-known-issues'; +import jsxKnownIssues from '../../../shared-fixtures/jsx-known-issues'; +import { isJSXFileType } from '../../tools/test-utils'; interface Fixture { filename: string; @@ -26,7 +27,7 @@ interface CreateFixturePatternConfig { const fixturesDirPath = path.join(__dirname, '../fixtures'); const sharedFixturesDirPath = path.join( __dirname, - '../../../typescript-eslint-shared-fixtures/fixtures' + '../../../shared-fixtures/fixtures' ); class FixturesTester { @@ -61,7 +62,7 @@ class FixturesTester { const ignore = config.ignore || []; const fileType = config.fileType || 'js'; const ignoreSourceType = config.ignoreSourceType || []; - const jsx = fileType === 'js' || fileType === 'jsx' || fileType === 'tsx'; + const jsx = isJSXFileType(fileType); /** * The TypeScript compiler gives us the "externalModuleIndicator" to allow typescript-estree do dynamically detect the "sourceType". @@ -147,14 +148,7 @@ tester.addFixturePatternConfig('javascript/simple-literals'); tester.addFixturePatternConfig('javascript/directives'); -tester.addFixturePatternConfig('javascript/experimentalObjectRestSpread', { - ignore: [ - /** - * Trailing comma is not permitted after a "RestElement" in Babel - */ - 'invalid-rest-trailing-comma' - ] -}); +tester.addFixturePatternConfig('javascript/experimentalObjectRestSpread'); tester.addFixturePatternConfig('javascript/arrowFunctions', { ignore: [ @@ -171,7 +165,29 @@ tester.addFixturePatternConfig('javascript/arrowFunctions', { * with the same name, for example. */ 'error-dup-params', // babel parse errors - 'error-strict-dup-params' // babel parse errors + 'error-strict-dup-params', // babel parse errors + /** + * typescript reports TS1100 and babel errors on this + * TS1100: "Invalid use of '{0}' in strict mode." + * TODO: do we want TS1100 error code? + */ + 'error-strict-eval', // babel parse errors + 'error-strict-default-param-eval', + 'error-strict-eval-return', + 'error-strict-param-arguments', + 'error-strict-param-eval', + 'error-strict-param-names', + 'error-strict-param-no-paren-arguments', + 'error-strict-param-no-paren-eval' + ] +}); +tester.addFixturePatternConfig('javascript/function', { + ignore: [ + /** + * Babel has invalid end range of multiline SequenceExpression + * TODO: report it to babel + */ + 'return-multiline-sequence' ] }); @@ -234,7 +250,12 @@ tester.addFixturePatternConfig('javascript/modules', { */ 'invalid-export-named-default' // babel parse errors ], - ignoreSourceType: ['error-function', 'error-strict', 'error-delete'] + ignoreSourceType: [ + 'error-function', + 'error-strict', + 'error-delete', + 'invalid-await' + ] }); tester.addFixturePatternConfig('javascript/newTarget'); @@ -330,33 +351,12 @@ tester.addFixturePatternConfig('typescript/basics', { * TODO: Investigate in more depth, potentially split up different parts of the interface */ 'interface-with-all-property-types', // babel parse errors - /** - * PR for generic ArrowFunctionExpression ranges has been merged into Babel: https://github.com/babel/babel/pull/9295 - * TODO: remove me in next babel > 7.2.3 - */ - 'arrow-function-with-type-parameters', - /** - * PR for this type predicate ranges has been merged into Babel: https://github.com/babel/babel/pull/9339 - * TODO: remove me in next babel > 7.2.3 - */ - 'type-guard-in-method', - /** - * there is difference in range between babel and ts-estree - */ - 'export-declare-const-named-enum', - 'interface-with-optional-properties', /** * Babel parses it as TSQualifiedName * ts parses it as MemberExpression * TODO: report it to babel */ 'interface-with-extends-member-expression', - /** - * Babel bug for parsing exported abstract interface - * https://github.com/babel/babel/issues/9304 - * PR: https://github.com/babel/babel/pull/9336 - */ - 'abstract-interface', /** * Babel bug for optional or abstract methods * https://github.com/babel/babel/issues/9305 @@ -365,46 +365,28 @@ tester.addFixturePatternConfig('typescript/basics', { 'abstract-class-with-optional-method', // babel parse errors 'declare-class-with-optional-method', // babel parse errors /** - * PR for parameter property ranges has been merged into Babel: https://github.com/babel/babel/pull/9284 - * TODO: remove me in next babel > 7.2.3 - */ - 'class-with-private-parameter-properties', - 'class-with-protected-parameter-properties', - 'class-with-public-parameter-properties', - 'class-with-readonly-parameter-properties', - /** - * PR for type import has been merged into Babel: https://github.com/babel/babel/pull/9302 - * TODO: remove me in next babel > 7.2.3 + * Was expected to be fixed by PR into Babel: https://github.com/babel/babel/pull/9302 + * But not fixed in Babel 7.3 + * TODO: Investigate differences */ 'import-type', 'import-type-with-type-parameters-in-type-reference', - /** - * PR for BigInt support has been merged into Babel: https://github.com/babel/babel/pull/9230 - * TODO: remove me in next babel > 7.2.3 - */ - 'typed-keyword-bigint', /** * Not yet supported in Babel https://github.com/babel/babel/issues/9228 * Directive field is not added to module and namespace */ 'directive-in-module', 'directive-in-namespace', - /** - * PR for type assertions ranges has been merged into Babel: https://github.com/babel/babel/pull/9284 - * TODO: remove me in next babel > 7.2.3 - */ - 'type-assertion', /** * Babel parses this incorrectly * https://github.com/babel/babel/issues/9324 */ 'type-assertion-arrow-function', /** - * PR for type parsing declare and abstract classes has been merged into Babel: https://github.com/babel/babel/pull/9328 - * TODO: remove me in next babel > 7.2.3 + * PR for optional parameters in arrow function has been merged into Babel: https://github.com/babel/babel/pull/9463 + * TODO: remove me in next babel > 7.3.2 */ - 'class-multi-line-keyword-declare', - 'class-multi-line-keyword-abstract' + 'arrow-function-with-optional-parameter' ], ignoreSourceType: [ /** @@ -427,7 +409,15 @@ tester.addFixturePatternConfig('typescript/decorators/method-decorators', { fileType: 'ts' }); tester.addFixturePatternConfig('typescript/decorators/parameter-decorators', { - fileType: 'ts' + fileType: 'ts', + ignore: [ + /** + * babel does not support decorators on array and rest parameters + * TODO: report this to babel + */ + 'parameter-array-pattern-decorator', + 'parameter-rest-element-decorator' + ] }); tester.addFixturePatternConfig('typescript/decorators/property-decorators', { fileType: 'ts' @@ -447,11 +437,19 @@ tester.addFixturePatternConfig('typescript/errorRecovery', { fileType: 'ts', ignore: [ /** - * PR with errors in empty extends and implements has been merged into Babel: https://github.com/babel/babel/pull/9292 - * TODO: remove me in next babel > 7.2.3 + * Expected error on empty type arguments and type parameters + * TypeScript report diagnostics correctly but babel not + * https://github.com/babel/babel/issues/9462 */ - 'interface-empty-extends', - 'class-extends-empty-implements' + 'empty-type-arguments', + 'empty-type-arguments-in-call-expression', + 'empty-type-arguments-in-new-expression', + 'empty-type-parameters', + 'empty-type-parameters-in-arrow-function', + 'empty-type-parameters-in-constructor', + 'empty-type-parameters-in-function-expression', + 'empty-type-parameters-in-method', + 'empty-type-parameters-in-method-signature' ] }); @@ -459,16 +457,13 @@ tester.addFixturePatternConfig('typescript/types', { fileType: 'ts', ignore: [ /** - * PR for type Identifier in TSIndexSignature ranges has been merged into Babel: https://github.com/babel/babel/pull/9335 - * TODO: remove me in next babel > 7.2.3 + * AST difference */ - 'index-signature', - 'index-signature-readonly', - 'index-signature-without-type', + 'literal-number-negative', /** - * AST difference + * Babel parse error: https://github.com/babel/babel/pull/9431 */ - 'literal-number-negative' + 'function-with-array-destruction' ] }); @@ -478,13 +473,8 @@ tester.addFixturePatternConfig('typescript/declare', { tester.addFixturePatternConfig('typescript/namespaces-and-modules', { fileType: 'ts', - ignore: [ - /** - * Minor AST difference - */ - 'nested-internal-module' - ], ignoreSourceType: [ + 'nested-internal-module', 'module-with-default-exports', 'ambient-module-declaration-with-import', 'declare-namespace-with-exported-function' diff --git a/packages/typescript-estree/tests/ast-alignment/parse.ts b/packages/typescript-estree/tests/ast-alignment/parse.ts index 407346455311..ec6123c03995 100644 --- a/packages/typescript-estree/tests/ast-alignment/parse.ts +++ b/packages/typescript-estree/tests/ast-alignment/parse.ts @@ -80,7 +80,7 @@ export function parse(text: string, opts: ASTComparisonParseOptions) { try { switch (opts.parser) { - case 'typescript-estree': + case '@typescript-eslint/typescript-estree': result.ast = parseUtils.normalizeNodeTypes( parseWithTypeScriptESTree(text, opts.jsx) ); diff --git a/packages/typescript-estree/tests/ast-alignment/spec.ts b/packages/typescript-estree/tests/ast-alignment/spec.ts index 777e0b704b41..0f3a91966dc7 100644 --- a/packages/typescript-estree/tests/ast-alignment/spec.ts +++ b/packages/typescript-estree/tests/ast-alignment/spec.ts @@ -11,7 +11,7 @@ fixturesToTest.forEach(fixture => { * Parse with typescript-estree */ const typeScriptESTreeResult = parse(source, { - parser: 'typescript-estree', + parser: '@typescript-eslint/typescript-estree', jsx: fixture.jsx }); diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index 77336ee7b5f4..3b9cdfd087c9 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -236,7 +236,7 @@ export function preprocessBabylonAST(ast: any): any { * Babel: ClassProperty + abstract: true * ts-estree: TSAbstractClassProperty */ - ClassProperty(node: any, parent: any) { + ClassProperty(node: any) { if (node.abstract) { node.type = 'TSAbstractClassProperty'; delete node.abstract; @@ -251,6 +251,24 @@ export function preprocessBabylonAST(ast: any): any { ) { node.type = 'TSClassImplements'; } + }, + // https://github.com/prettier/prettier/issues/5817 + FunctionExpression(node: any, parent: any) { + if (parent.typeParameters && parent.type === 'Property') { + node.typeParameters = parent.typeParameters; + delete parent.typeParameters; + } + + /** + * babel issue: ranges of typeParameters are not included in FunctionExpression range + */ + if ( + node.typeParameters && + node.typeParameters.range[0] < node.range[0] + ) { + node.range[0] = node.typeParameters.range[0]; + node.loc.start = Object.assign({}, node.typeParameters.loc.start); + } } } ); diff --git a/packages/typescript-estree/tests/fixtures/semanticInfo/non-existent-estree-nodes.src.ts b/packages/typescript-estree/tests/fixtures/semanticInfo/non-existent-estree-nodes.src.ts new file mode 100644 index 000000000000..4eb9dba432b4 --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/semanticInfo/non-existent-estree-nodes.src.ts @@ -0,0 +1,5 @@ +const binExp = (3 + 5); + +class Bar { + ['test']: string; +} diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap new file mode 100644 index 000000000000..3049a51ae47a --- /dev/null +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap @@ -0,0 +1,788 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`convert deeplyCopy should convert array of nodes 1`] = ` +Object { + "amdDependencies": Array [], + "bindDiagnostics": Array [], + "bindSuggestionDiagnostics": undefined, + "checkJsDirective": undefined, + "endOfFileToken": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 12, + ], + "type": "TSEndOfFileToken", + }, + "externalModuleIndicator": undefined, + "fileName": "text.ts", + "hasNoDefaultLib": false, + "identifierCount": 2, + "identifiers": Map { + "foo" => "foo", + "T" => "T", + }, + "isDeclarationFile": false, + "languageVariant": 1, + "languageVersion": 6, + "libReferenceDirectives": Array [], + "lineMap": Array [ + null, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "nodeCount": 7, + "parseDiagnostics": Array [], + "pragmas": Map {}, + "range": Array [ + 0, + 12, + ], + "referencedFiles": Array [], + "scriptKind": 4, + "statements": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "NewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "text": "new foo()", + "transformFlags": undefined, + "type": "TSSourceFile", + "typeReferenceDirectives": Array [], +} +`; + +exports[`convert deeplyCopy should convert node correctly 1`] = ` +Object { + "body": Array [ + 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": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 35, + ], + "transformFlags": undefined, + "type": "TSJSDocNullableType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 35, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 15, + 18, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 35, + ], + "transformFlags": undefined, + "type": "TSJSDocNullableType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 35, + ], + "transformFlags": undefined, + "type": "TSJSDocNullableType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 34, + ], + "type": "TSParenthesizedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 23, + 33, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + }, + }, + }, + }, + }, + }, + ], + }, + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`convert deeplyCopy should convert node with decorators correctly 1`] = ` +Object { + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Decorator", + }, + ], + "heritageClauses": undefined, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [], + "modifiers": undefined, + "name": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 18, + ], + "transformFlags": undefined, + "type": "TSClassDeclaration", + "typeParameters": null, +} +`; + +exports[`convert deeplyCopy should convert node with type arguments correctly 1`] = ` +Object { + "arguments": Array [], + "expression": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "transformFlags": undefined, + "type": "TSNewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterInstantiation", + }, +} +`; + +exports[`convert deeplyCopy should convert node with type parameters correctly 1`] = ` +Object { + "heritageClauses": undefined, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [], + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 15, + ], + "transformFlags": undefined, + "type": "TSClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 10, + 11, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TSTypeParameterDeclaration", + }, +} +`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap index eb2eb8f6f916..85045786c853 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap @@ -30246,6 +30246,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 [ @@ -99056,125 +99058,217 @@ 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", }, ], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -99183,14 +99277,14 @@ Object { }, "range": Array [ 0, - 27, + 63, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 8, "line": 1, }, "start": Object { @@ -99200,25 +99294,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", @@ -99226,7 +99302,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -99236,25 +99312,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": "(", @@ -99262,107 +99338,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": ")", @@ -99370,237 +99446,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", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 2, + "type": "Keyword", + "value": "return", }, - }, - "range": Array [ - 1, - 28, - ], - "sourceType": "script", - "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": 0, + "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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 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", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 1, + 28, + ], + "sourceType": "script", + "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, "line": 4, }, }, @@ -104916,59 +106094,484 @@ 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", + }, + ], + "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", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -104977,7 +106580,7 @@ Object { }, "range": Array [ 0, - 65, + 31, ], "sourceType": "module", "tokens": Array [ @@ -104997,7 +106600,7 @@ Object { 6, ], "type": "Keyword", - "value": "import", + "value": "export", }, Object { "loc": Object { @@ -105015,12 +106618,12 @@ Object { 12, ], "type": "Identifier", - "value": "house", + "value": "async", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 21, "line": 1, }, "start": Object { @@ -105030,10 +106633,10 @@ Object { }, "range": Array [ 13, - 17, + 21, ], - "type": "Identifier", - "value": "from", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { @@ -105042,16 +106645,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 { @@ -105069,256 +106672,490 @@ 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", + }, + ], + "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", }, + ], + "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 { @@ -105326,15 +107163,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 { @@ -105344,7 +107182,7 @@ Object { }, "range": Array [ 0, - 18, + 38, ], "type": "ExportDefaultDeclaration", }, @@ -105361,7 +107199,7 @@ Object { }, "range": Array [ 0, - 19, + 39, ], "sourceType": "module", "tokens": Array [ @@ -105404,7 +107242,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 20, "line": 1, }, "start": Object { @@ -105414,46 +107252,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", @@ -109176,6 +111086,232 @@ 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", + }, + ], + "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-estree/tests/lib/__snapshots__/jsx.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap index 1da61ddcac7e..d0d092c78411 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap @@ -9423,6 +9423,1715 @@ 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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "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-estree/tests/lib/__snapshots__/parse.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap index ae6a9a339e17..38e378d9f7e0 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap @@ -188,3 +188,163 @@ Object { "type": "Program", } `; + +exports[`parse() non string code should correctly convert code to a string for parse() 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "12345", + "type": "Literal", + "value": 12345, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "12345", + }, + ], + "type": "Program", +} +`; + +exports[`parse() non string code should correctly convert code to a string for parseAndGenerateServices() 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "12345", + "type": "Literal", + "value": 12345, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "12345", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index 3407f292ace2..bfbda1148412 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -8,77 +8,21 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsdoc-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-block-comment.src 1`] = ` -Object { - "column": 10, - "index": 84, - "lineNumber": 5, - "message": "Unterminated regular expression literal.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-block-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-jsx.src 1`] = ` -Object { - "column": 14, - "index": 48, - "lineNumber": 3, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-jsx.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-self-closing-jsx.src 1`] = ` -Object { - "column": 13, - "index": 47, - "lineNumber": 3, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-self-closing-jsx.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-tag-comments.src 1`] = ` -Object { - "column": 9, - "index": 113, - "lineNumber": 7, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-tag-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-multiline-non-comment.src 1`] = ` -Object { - "column": 5, - "index": 81, - "lineNumber": 7, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-multiline-non-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-url.src 1`] = ` -Object { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-url.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-with-greather-than.src 1`] = ` -Object { - "column": 0, - "index": 69, - "lineNumber": 4, - "message": "Expression expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-with-greather-than.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-with-operators.src 1`] = ` -Object { - "column": 0, - "index": 69, - "lineNumber": 4, - "message": "Expression expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-with-operators.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/line-comment-with-block-syntax.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -349,6 +293,15 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-with-constructor-with-space.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-with-no-body.src 1`] = ` +Object { + "column": 0, + "index": 10, + "lineNumber": 2, + "message": "'{' expected.", +} +`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/derived-class-assign-to-var.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/derived-class-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -560,7 +513,14 @@ Object { } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/invalid-not-final-array-empty.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/invalid-not-final-array-empty.src 1`] = ` +Object { + "column": 5, + "index": 5, + "lineNumber": 1, + "message": "A rest parameter or binding pattern may not have a trailing comma.", +} +`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/multi-destructured.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -622,7 +582,14 @@ Object { } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src 1`] = ` +Object { + "column": 16, + "index": 16, + "lineNumber": 1, + "message": "A rest parameter or binding pattern may not have a trailing comma.", +} +`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/object-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -716,6 +683,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/invalid-for-of-with-let-and-no-braces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/function/return-multiline-sequence.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/function/return-sequence.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/anonymous-generator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/async-generator-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -767,8 +738,14 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/error-strict.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-async-named-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-const.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-async-named-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -801,6 +778,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-let.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-as-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-as-specifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -1295,120 +1274,71 @@ Object { } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/attributes.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/attributes.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/element-keyword-name.src 1`] = ` -Object { - "column": 12, - "index": 18, - "lineNumber": 2, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/element-keyword-name.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-comment.src 1`] = ` -Object { - "column": 30, - "index": 30, - "lineNumber": 1, - "message": "Unterminated regular expression literal.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-conditional.src 1`] = ` -Object { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-conditional.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-invalid-js-identifier.src 1`] = ` -Object { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-invalid-js-identifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-tags.src 1`] = ` Object { - "column": 11, - "index": 11, + "column": 16, + "index": 16, "lineNumber": 1, - "message": "'>' expected.", + "message": "'{' expected.", } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/empty-placeholder.src 1`] = ` -Object { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "Unterminated regular expression literal.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/empty-placeholder.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns.src 1`] = ` -Object { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-attribute.src 1`] = ` Object { - "column": 3, - "index": 3, + "column": 5, + "index": 5, "lineNumber": 1, - "message": "'>' expected.", + "message": "'{' expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-attribute-missing-equals.src 1`] = ` Object { - "column": 5, - "index": 5, + "column": 14, + "index": 14, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-broken-tag.src 1`] = ` Object { - "column": 3, - "index": 3, + "column": 12, + "index": 12, "lineNumber": 1, - "message": "'>' expected.", + "message": "Unterminated string literal.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-computed-end-tag-name.src 1`] = ` Object { - "column": 9, - "index": 9, + "column": 2, + "index": 2, "lineNumber": 1, - "message": "Type expected.", + "message": "Identifier expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-computed-string-end-tag-name.src 1`] = ` Object { - "column": 11, - "index": 11, + "column": 2, + "index": 2, "lineNumber": 1, - "message": "Type expected.", + "message": "Identifier expected.", } `; @@ -1417,23 +1347,23 @@ Object { "column": 9, "index": 9, "lineNumber": 1, - "message": "':' expected.", + "message": "'}' expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-leading-dot-tag-name.src 1`] = ` Object { - "column": 1, - "index": 1, + "column": 0, + "index": 0, "lineNumber": 1, - "message": "Type expected.", + "message": "Expression expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src 1`] = ` Object { - "column": 5, - "index": 5, + "column": 27, + "index": 27, "lineNumber": 1, "message": "'>' expected.", } @@ -1441,28 +1371,28 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-closing-tag.src 1`] = ` Object { - "column": 4, - "index": 4, + "column": 3, + "index": 3, "lineNumber": 1, - "message": "Type expected.", + "message": "Expected corresponding JSX closing tag for 'a'.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-closing-tags.src 1`] = ` Object { - "column": 6, - "index": 6, + "column": 1, + "index": 1, "lineNumber": 1, - "message": "'>' expected.", + "message": "JSX element 'a' has no corresponding closing tag.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-dot-tag-name.src 1`] = ` Object { - "column": 8, - "index": 8, + "column": 7, + "index": 7, "lineNumber": 1, - "message": "Type expected.", + "message": "Expected corresponding JSX closing tag for 'a.b.c'.", } `; @@ -1471,34 +1401,34 @@ Object { "column": 2, "index": 2, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-closing-tag.src 1`] = ` Object { - "column": 3, - "index": 3, + "column": 1, + "index": 1, "lineNumber": 1, - "message": "Expression expected.", + "message": "JSX element 'a' has no corresponding closing tag.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src 1`] = ` Object { - "column": 3, - "index": 3, + "column": 1, + "index": 1, "lineNumber": 1, - "message": "'>' expected.", + "message": "JSX element 'a' has no corresponding closing tag.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-namespace-name.src 1`] = ` Object { - "column": 1, - "index": 1, + "column": 0, + "index": 0, "lineNumber": 1, - "message": "Type expected.", + "message": "Expression expected.", } `; @@ -1507,16 +1437,16 @@ Object { "column": 2, "index": 2, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-spread-operator.src 1`] = ` Object { - "column": 5, - "index": 5, + "column": 6, + "index": 6, "lineNumber": 1, - "message": "'>' expected.", + "message": "'...' expected.", } `; @@ -1525,7 +1455,7 @@ Object { "column": 4, "index": 4, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; @@ -1534,7 +1464,7 @@ Object { "column": 2, "index": 2, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; @@ -1543,43 +1473,43 @@ Object { "column": 36, "index": 36, "lineNumber": 1, - "message": "Expression expected.", + "message": "JSX expressions must have one parent element.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-common-parent-with-comment.src 1`] = ` Object { - "column": 38, - "index": 38, + "column": 63, + "index": 63, "lineNumber": 1, - "message": "',' expected.", + "message": "JSX expressions must have one parent element.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-tag-name.src 1`] = ` Object { - "column": 1, - "index": 1, + "column": 0, + "index": 0, "lineNumber": 1, - "message": "Type expected.", + "message": "Declaration or statement expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-placeholder-in-closing-tag.src 1`] = ` Object { - "column": 12, - "index": 12, + "column": 16, + "index": 16, "lineNumber": 1, - "message": "Unterminated regular expression literal.", + "message": "'>' expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-shorthand-fragment-no-closing.src 1`] = ` Object { - "column": 1, - "index": 1, + "column": 0, + "index": 0, "lineNumber": 1, - "message": "Type expected.", + "message": "JSX fragment has no corresponding closing tag.", } `; @@ -1594,64 +1524,29 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-unexpected-comma.src 1`] = ` Object { - "column": 6, - "index": 6, + "column": 19, + "index": 19, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/japanese-characters.src 1`] = ` -Object { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/japanese-characters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/less-than-operator.src 1`] = ` -Object { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/less-than-operator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression.src 1`] = ` -Object { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression-this.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/multiple-blank-spaces.src 1`] = ` -Object { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/multiple-blank-spaces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespaced-attribute-and-value-inserted.src 1`] = ` Object { - "column": 3, - "index": 3, + "column": 4, + "index": 4, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; @@ -1660,36 +1555,22 @@ Object { "column": 2, "index": 2, "lineNumber": 1, - "message": "'>' expected.", + "message": "Identifier expected.", } `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/newslines-and-entities.src 1`] = ` Object { - "column": 4, - "index": 4, + "column": 8, + "index": 8, "lineNumber": 1, - "message": "'>' expected.", + "message": "Invalid character.", } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag.src 1`] = ` -Object { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag-inside-tag.src 1`] = ` -Object { - "column": 9, - "index": 15, - "lineNumber": 2, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag-inside-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag-with-newline.src 1`] = ` Object { @@ -1700,131 +1581,35 @@ Object { } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/shorthand-fragment.src 1`] = ` -Object { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/shorthand-fragment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/shorthand-fragment-with-child.src 1`] = ` -Object { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/shorthand-fragment-with-child.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-child.src 1`] = ` -Object { - "column": 15, - "index": 15, - "lineNumber": 1, - "message": "Unterminated regular expression literal.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-child.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-operator-attribute-and-regular-attribute.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-operator-attribute-and-regular-attribute.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-operator-attributes.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-operator-attributes.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-dots.src 1`] = ` -Object { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-dots.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-multi-dots.src 1`] = ` -Object { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "Type expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-multi-dots.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/test-content.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "Expression expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-multi-dots-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/trailing-spread-operator-attribute.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/test-content.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/unknown-escape-pattern.src 1`] = ` -Object { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/trailing-spread-operator-attribute.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src 1`] = ` -Object { - "column": 9, - "index": 15, - "lineNumber": 2, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/unknown-escape-pattern.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/test-content.src 1`] = ` -Object { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "Expression expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-element.src 1`] = ` -Object { - "column": 21, - "index": 21, - "lineNumber": 1, - "message": "'>' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/test-content.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/react-typed-props.src 1`] = ` -Object { - "column": 12, - "index": 141, - "lineNumber": 9, - "message": "',' expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-element.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/react-typed-props.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -1856,6 +1641,8 @@ Object { } `; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/arrow-function-with-optional-parameter.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/arrow-function-with-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/async-function-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2011,6 +1798,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-type-function-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-anonymus-with-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-anynomus-with-return-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-overloads.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-await.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2106,6 +1897,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-parameters-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-parameters-comments-heritage.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-reference-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-bigint.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2188,6 +1981,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2198,6 +1993,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2251,6 +2050,15 @@ Object { } `; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-function.src 1`] = ` +Object { + "column": 0, + "index": 0, + "lineNumber": 1, + "message": "Decorators are not valid here.", +} +`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src 1`] = ` Object { "column": 0, @@ -2260,7 +2068,95 @@ Object { } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-variable.src 1`] = ` +Object { + "column": 0, + "index": 0, + "lineNumber": 1, + "message": "Decorators are not valid here.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments.src 1`] = ` +Object { + "column": 14, + "index": 14, + "lineNumber": 1, + "message": "Type argument list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = ` +Object { + "column": 3, + "index": 3, + "lineNumber": 1, + "message": "Type argument list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src 1`] = ` +Object { + "column": 7, + "index": 7, + "lineNumber": 1, + "message": "Type argument list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters.src 1`] = ` +Object { + "column": 11, + "index": 11, + "lineNumber": 1, + "message": "Type parameter list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src 1`] = ` +Object { + "column": 11, + "index": 11, + "lineNumber": 1, + "message": "Type parameter list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src 1`] = ` +Object { + "column": 13, + "index": 25, + "lineNumber": 2, + "message": "Type parameter list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = ` +Object { + "column": 20, + "index": 20, + "lineNumber": 1, + "message": "Type parameter list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src 1`] = ` +Object { + "column": 6, + "index": 18, + "lineNumber": 2, + "message": "Type parameter list cannot be empty.", +} +`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src 1`] = ` +Object { + "column": 6, + "index": 22, + "lineNumber": 2, + "message": "Type parameter list cannot be empty.", +} +`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/enum-with-keywords.src 1`] = ` Object { @@ -2451,6 +2347,15 @@ Object { } `; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-with-no-body.src 1`] = ` +Object { + "column": 0, + "index": 14, + "lineNumber": 2, + "message": "'{' expected.", +} +`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/object-assertion-not-allowed.src 1`] = ` Object { "column": 3, @@ -2522,6 +2427,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-in-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-array-destruction.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-object-destruction.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap index 5af1b41ba261..f5722861dd24 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap @@ -1133,4 +1133,611 @@ Object { } `; +exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "binExp", + "range": Array [ + 6, + 12, + ], + "type": "Identifier", + }, + "init": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 16, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + Object { + "body": Object { + "body": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 40, + 46, + ], + "raw": "'test'", + "type": "Literal", + "value": "test", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 39, + 56, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 47, + 55, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 49, + 55, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 35, + 58, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "Bar", + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 58, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 12, + ], + "type": "Identifier", + "value": "binExp", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Numeric", + "value": "3", + }, + 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": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 30, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "String", + "value": "'test'", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 49, + 55, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`semanticInfo malformed project file 1`] = `"Compiler option 'compileOnSave' requires a value of type boolean."`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index 5ad5989309a8..b9e876c45955 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -812,12 +812,12 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 68, ], "superClass": null, @@ -1259,12 +1259,12 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 86, ], "superClass": null, @@ -2561,12 +2561,12 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 78, ], "superClass": null, @@ -2948,12 +2948,12 @@ Object { "line": 2, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 31, ], "type": "TSInterfaceDeclaration", @@ -3106,6 +3106,397 @@ 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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 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 [ @@ -10632,13 +11023,13 @@ Object { "line": 2, }, "start": Object { - "column": 16, + "column": 13, "line": 2, }, }, "params": Array [], "range": Array [ - 26, + 23, 32, ], "type": "FunctionExpression", @@ -10765,13 +11156,13 @@ Object { "line": 4, }, "start": Object { - "column": 20, + "column": 17, "line": 4, }, }, "params": Array [], "range": Array [ - 54, + 51, 60, ], "type": "FunctionExpression", @@ -13410,13 +13801,13 @@ Object { "line": 2, }, "start": Object { - "column": 11, + "column": 8, "line": 2, }, }, "params": Array [], "range": Array [ - 23, + 20, 28, ], "type": "FunctionExpression", @@ -13838,13 +14229,13 @@ Object { "line": 2, }, "start": Object { - "column": 17, + "column": 8, "line": 2, }, }, "params": Array [], "range": Array [ - 29, + 20, 34, ], "type": "FunctionExpression", @@ -15685,13 +16076,13 @@ Object { "line": 3, }, "start": Object { - "column": 8, + "column": 5, "line": 3, }, }, "params": Array [], "range": Array [ - 38, + 35, 44, ], "type": "FunctionExpression", @@ -21291,12 +21682,12 @@ Object { "line": 4, }, "start": Object { - "column": 14, + "column": 22, "line": 4, }, }, "range": Array [ - 116, + 124, 140, ], "right": Object { @@ -21397,12 +21788,12 @@ Object { "line": 5, }, "start": Object { - "column": 14, + "column": 31, "line": 5, }, }, "range": Array [ - 156, + 173, 197, ], "right": Object { @@ -24408,12 +24799,12 @@ Object { "line": 4, }, "start": Object { - "column": 14, + "column": 24, "line": 4, }, }, "range": Array [ - 120, + 130, 146, ], "right": Object { @@ -24514,12 +24905,12 @@ Object { "line": 5, }, "start": Object { - "column": 14, + "column": 33, "line": 5, }, }, "range": Array [ - 162, + 181, 205, ], "right": Object { @@ -25533,12 +25924,12 @@ Object { "line": 4, }, "start": Object { - "column": 14, + "column": 21, "line": 4, }, }, "range": Array [ - 114, + 121, 137, ], "right": Object { @@ -25639,12 +26030,12 @@ Object { "line": 5, }, "start": Object { - "column": 14, + "column": 30, "line": 5, }, }, "range": Array [ - 153, + 169, 193, ], "right": Object { @@ -26586,12 +26977,12 @@ Object { "line": 3, }, "start": Object { - "column": 14, + "column": 23, "line": 3, }, }, "range": Array [ - 68, + 77, 103, ], "right": Object { @@ -27918,13 +28309,13 @@ Object { "line": 3, }, "start": Object { - "column": 18, + "column": 15, "line": 2, }, }, "params": Array [], "range": Array [ - 28, + 25, 44, ], "returnType": Object { @@ -28085,13 +28476,13 @@ Object { "line": 6, }, "start": Object { - "column": 20, + "column": 17, "line": 5, }, }, "params": Array [], "range": Array [ - 66, + 63, 82, ], "returnType": Object { @@ -35398,7 +35789,7 @@ Object { "line": 4, }, "start": Object { - "column": 21, + "column": 7, "line": 1, }, }, @@ -35494,7 +35885,7 @@ Object { }, ], "range": Array [ - 21, + 7, 54, ], "type": "TSEnumDeclaration", @@ -35785,7 +36176,7 @@ Object { "line": 4, }, "start": Object { - "column": 15, + "column": 7, "line": 1, }, }, @@ -35881,7 +36272,7 @@ Object { }, ], "range": Array [ - 15, + 7, 48, ], "type": "TSEnumDeclaration", @@ -38786,139 +39177,268 @@ Object { } `; -exports[`typescript fixtures/basics/function-overloads.src 1`] = ` +exports[`typescript fixtures/basics/function-anonymus-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "async": false, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "f", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 27, + "column": 7, "line": 1, }, "start": Object { - "column": 18, + "column": 4, "line": 1, }, }, - "name": "x", + "name": "obj", "range": Array [ - 18, - 27, + 4, + 7, ], "type": "Identifier", - "typeAnnotation": Object { + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 38, + 47, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 19, + "column": 34, "line": 1, }, }, "range": Array [ - 19, - 27, + 34, + 49, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 27, + "column": 32, "line": 1, }, "start": Object { - "column": 21, + "column": 23, "line": 1, }, }, + "name": "a", "range": Array [ - 21, - 27, + 23, + 32, ], - "type": "TSNumberKeyword", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 10, + 49, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 19, + 22, + ], + "type": "TSTypeParameterDeclaration", }, }, - ], - "range": Array [ - 7, - 37, - ], - "returnType": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 28, + "column": 4, "line": 1, }, }, "range": Array [ - 28, - 36, + 4, + 49, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "TSNumberKeyword", - }, + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, - "type": "TSDeclareFunction", }, + "range": Array [ + 0, + 50, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 37, + "column": 3, "line": 1, }, "start": Object { @@ -38928,651 +39448,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", - }, - ], - "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, }, }, @@ -39581,364 +39685,338 @@ Object { 44, ], "type": "Keyword", - "value": "export", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 2, }, "start": Object { - "column": 7, + "column": 9, "line": 2, }, }, "range": Array [ 45, - 53, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 54, - 55, + 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", + ], + "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": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 3, + "line": 1, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 76, - 82, + 0, + 3, ], "type": "Keyword", - "value": "export", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { "column": 7, - "line": 3, - }, - }, - "range": Array [ - 83, - 91, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 4, + "line": 1, }, }, "range": Array [ - 92, - 93, + 4, + 7, ], "type": "Identifier", - "value": "f", + "value": "obj", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 9, + "line": 1, }, "start": Object { - "column": 17, - "line": 3, + "column": 8, + "line": 1, }, }, "range": Array [ - 93, - 94, + 8, + 9, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 94, - 95, + 10, + 18, ], - "type": "Identifier", - "value": "x", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { "column": 20, - "line": 3, + "line": 1, }, "start": Object { "column": 19, - "line": 3, + "line": 1, }, }, "range": Array [ - 95, - 96, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 103, - ], - "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, - }, - }, - "range": Array [ - 104, - 105, - ], - "type": "Punctuator", - "value": "|", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 106, - 112, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 3, + "line": 1, }, "start": Object { - "column": 36, - "line": 3, + "column": 20, + "line": 1, }, }, "range": Array [ - 112, - 113, + 20, + 21, ], "type": "Punctuator", "value": ")", @@ -39946,17 +40024,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 37, - "line": 3, + "column": 21, + "line": 1, }, }, "range": Array [ - 113, - 114, + 21, + 22, ], "type": "Punctuator", "value": ":", @@ -39964,305 +40042,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", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 50, - ], - "sourceType": "script", - "tokens": Array [ - Object { + "type": "TSDeclareFunction", + }, "loc": Object { "end": Object { - "column": 5, + "column": 37, "line": 1, }, "start": Object { @@ -40272,539 +40258,433 @@ 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 [ + 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 [ - 13, - 45, + 92, + 93, ], - "type": "ObjectPattern", - "typeAnnotation": Object { + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 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", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -40813,14 +40693,14 @@ Object { }, "range": Array [ 0, - 52, + 147, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -40830,151 +40710,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": ":", @@ -40982,71 +40862,341 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { - "column": 25, + "column": 30, "line": 1, }, }, "range": Array [ - 25, - 26, + 30, + 36, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 37, "line": 1, }, "start": Object { - "column": 26, + "column": 36, "line": 1, }, }, "range": Array [ - 26, - 29, + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 53, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, ], "type": "Identifier", - "value": "bar", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, }, "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { "column": 29, - "line": 1, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, }, }, "range": Array [ - 29, - 30, + 66, + 67, ], "type": "Punctuator", - "value": "?", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 36, + "line": 2, }, "start": Object { "column": 30, - "line": 1, + "line": 2, }, }, "range": Array [ - 30, - 31, + 68, + 74, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 83, + 91, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 95, + 96, ], "type": "Punctuator", "value": ":", @@ -41054,17 +41204,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 27, + "line": 3, }, "start": Object { - "column": 32, - "line": 1, + "column": 21, + "line": 3, }, }, "range": Array [ - 32, - 38, + 97, + 103, ], "type": "Identifier", "value": "string", @@ -41072,125 +41222,215 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 29, + "line": 3, }, "start": Object { - "column": 38, - "line": 1, + "column": 28, + "line": 3, }, }, "range": Array [ - 38, - 39, + 104, + 105, ], "type": "Punctuator", - "value": ",", + "value": "|", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 36, + "line": 3, }, "start": Object { - "column": 40, - "line": 1, + "column": 30, + "line": 3, }, }, "range": Array [ - 40, - 43, + 106, + 112, ], "type": "Identifier", - "value": "baz", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 37, + "line": 3, }, "start": Object { - "column": 43, - "line": 1, + "column": 36, + "line": 3, }, }, "range": Array [ - 43, - 44, + 112, + 113, ], "type": "Punctuator", - "value": "?", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 38, + "line": 3, }, "start": Object { - "column": 44, - "line": 1, + "column": 37, + "line": 3, }, }, "range": Array [ - 44, - 45, + 113, + 114, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 45, + "line": 3, }, "start": Object { - "column": 45, - "line": 1, + "column": 39, + "line": 3, }, }, "range": Array [ - 45, - 46, + 115, + 121, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 122, + 123, ], "type": "Punctuator", - "value": ")", + "value": "|", }, Object { "loc": Object { "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { "column": 48, - "line": 1, + "line": 3, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 3, }, "start": Object { - "column": 47, - "line": 1, + "column": 55, + "line": 3, }, }, "range": Array [ - 47, - 48, + 131, + 132, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ";", + }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 50, - 51, + 145, + 146, ], "type": "Punctuator", "value": "}", @@ -41200,7 +41440,359 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` +exports[`typescript fixtures/basics/function-with-await.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "future", + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 46, + ], + "type": "AwaitExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "hope", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "future", + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 49, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "hope", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "value": "future", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "future", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = ` Object { "body": Array [ Object { @@ -41213,13 +41805,13 @@ Object { "line": 3, }, "start": Object { - "column": 45, + "column": 47, "line": 1, }, }, "range": Array [ - 45, - 49, + 47, + 51, ], "type": "BlockStatement", }, @@ -41257,7 +41849,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, + "column": 45, "line": 1, }, "start": Object { @@ -41383,13 +41975,13 @@ Object { ], "range": Array [ 13, - 43, + 45, ], "type": "ObjectPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 43, + "column": 45, "line": 1, }, "start": Object { @@ -41399,13 +41991,13 @@ Object { }, "range": Array [ 23, - 43, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 43, + "column": 45, "line": 1, }, "start": Object { @@ -41436,7 +42028,7 @@ Object { }, "loc": Object { "end": Object { - "column": 38, + "column": 39, "line": 1, }, "start": Object { @@ -41444,41 +42036,42 @@ Object { "line": 1, }, }, + "optional": true, "range": Array [ 26, - 38, + 39, ], "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 38, "line": 1, }, "start": Object { - "column": 29, + "column": 30, "line": 1, }, }, "range": Array [ - 29, - 37, + 30, + 38, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 38, "line": 1, }, "start": Object { - "column": 31, + "column": 32, "line": 1, }, }, "range": Array [ - 31, - 37, + 32, + 38, ], "type": "TSStringKeyword", }, @@ -41489,41 +42082,42 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 42, + "column": 43, "line": 1, }, "start": Object { - "column": 39, + "column": 40, "line": 1, }, }, "name": "baz", "range": Array [ - 39, - 42, + 40, + 43, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 42, + "column": 44, "line": 1, }, "start": Object { - "column": 39, + "column": 40, "line": 1, }, }, + "optional": true, "range": Array [ - 39, - 42, + 40, + 44, ], "type": "TSPropertySignature", }, ], "range": Array [ 25, - 43, + 45, ], "type": "TSTypeLiteral", }, @@ -41532,7 +42126,7 @@ Object { ], "range": Array [ 0, - 49, + 51, ], "type": "FunctionDeclaration", }, @@ -41549,7 +42143,7 @@ Object { }, "range": Array [ 0, - 50, + 52, ], "sourceType": "script", "tokens": Array [ @@ -41767,22 +42361,40 @@ Object { 30, ], "type": "Punctuator", - "value": ":", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 31, "line": 1, }, "start": Object { - "column": 31, + "column": 30, "line": 1, }, }, "range": Array [ + 30, 31, - 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, ], "type": "Identifier", "value": "string", @@ -41790,17 +42402,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 39, "line": 1, }, "start": Object { - "column": 37, + "column": 38, "line": 1, }, }, "range": Array [ - 37, 38, + 39, ], "type": "Punctuator", "value": ",", @@ -41808,17 +42420,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 43, "line": 1, }, "start": Object { - "column": 39, + "column": 40, "line": 1, }, }, "range": Array [ - 39, - 42, + 40, + 43, ], "type": "Identifier", "value": "baz", @@ -41826,38 +42438,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, + "column": 44, "line": 1, }, "start": Object { - "column": 42, + "column": 43, "line": 1, }, }, "range": Array [ - 42, 43, + 44, ], "type": "Punctuator", - "value": "}", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 45, "line": 1, }, "start": Object { - "column": 43, + "column": 44, "line": 1, }, }, "range": Array [ - 43, 44, + 45, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { @@ -41875,6 +42487,24 @@ Object { 46, ], "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", "value": "{", }, Object { @@ -41889,8 +42519,8 @@ Object { }, }, "range": Array [ - 48, - 49, + 50, + 51, ], "type": "Punctuator", "value": "}", @@ -41900,62 +42530,26 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` +exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` Object { "body": Array [ Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "b", - "range": Array [ - 36, - 37, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 29, - 38, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { "column": 1, "line": 3, }, "start": Object { - "column": 23, + "column": 45, "line": 1, }, }, "range": Array [ - 23, - 40, + 45, + 49, ], "type": "BlockStatement", }, @@ -41964,7 +42558,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -41972,10 +42566,10 @@ Object { "line": 1, }, }, - "name": "a", + "name": "foo", "range": Array [ 9, - 10, + 12, ], "type": "Identifier", }, @@ -41993,185 +42587,284 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 43, "line": 1, }, "start": Object { - "column": 14, + "column": 13, "line": 1, }, }, - "name": "b", - "range": Array [ - 14, - 18, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", }, - }, - "range": Array [ - 15, - 18, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { - "column": 17, + "column": 14, "line": 1, }, }, + "method": false, "range": Array [ + 14, 17, - 18, ], - "type": "TSTypeReference", - "typeName": Object { + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { - "column": 17, + "column": 14, "line": 1, }, }, - "name": "X", + "name": "bar", "range": Array [ + 14, 17, - 18, ], "type": "Identifier", }, }, - }, - }, - ], - "range": Array [ - 0, - 40, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 22, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, }, - }, + ], "range": Array [ - 21, - 22, + 13, + 43, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "ObjectPattern", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, + "column": 43, "line": 1, }, "start": Object { - "column": 21, + "column": 23, "line": 1, }, }, - "name": "X", "range": Array [ - 21, - 22, + 23, + 43, ], - "type": "Identifier", - }, - }, - }, - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 12, + "column": 43, "line": 1, }, "start": Object { - "column": 11, + "column": 25, "line": 1, }, }, - "name": "X", + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 38, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "TSPropertySignature", + }, + ], "range": Array [ - 11, - 12, + 25, + 43, ], - "type": "Identifier", + "type": "TSTypeLiteral", }, - "range": Array [ - 11, - 12, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 10, - 13, - ], - "type": "TSTypeParameterDeclaration", - }, + }, + ], + "range": Array [ + 0, + 49, + ], + "type": "FunctionDeclaration", }, ], "loc": Object { @@ -42186,7 +42879,7 @@ Object { }, "range": Array [ 0, - 41, + 50, ], "sourceType": "script", "tokens": Array [ @@ -42211,7 +42904,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -42221,46 +42914,10 @@ Object { }, "range": Array [ 9, - 10, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, 12, ], "type": "Identifier", - "value": "X", + "value": "foo", }, Object { "loc": Object { @@ -42278,7 +42935,7 @@ Object { 13, ], "type": "Punctuator", - "value": ">", + "value": "(", }, Object { "loc": Object { @@ -42296,12 +42953,12 @@ Object { 14, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { @@ -42311,79 +42968,79 @@ Object { }, "range": Array [ 14, - 15, + 17, ], "type": "Identifier", - "value": "b", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 18, "line": 1, }, "start": Object { - "column": 15, + "column": 17, "line": 1, }, }, "range": Array [ - 15, - 16, + 17, + 18, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 22, "line": 1, }, "start": Object { - "column": 17, + "column": 19, "line": 1, }, }, "range": Array [ - 17, - 18, + 19, + 22, ], "type": "Identifier", - "value": "X", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 23, "line": 1, }, "start": Object { - "column": 18, + "column": 22, "line": 1, }, }, "range": Array [ - 18, - 19, + 22, + 23, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 1, }, "start": Object { - "column": 19, + "column": 23, "line": 1, }, }, "range": Array [ - 19, - 20, + 23, + 24, ], "type": "Punctuator", "value": ":", @@ -42391,369 +43048,143 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 1, }, "start": Object { - "column": 21, + "column": 25, "line": 1, }, }, "range": Array [ - 21, - 22, + 25, + 26, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 29, "line": 1, }, "start": Object { - "column": 23, + "column": 26, "line": 1, }, }, "range": Array [ - 23, - 24, + 26, + 29, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 29, + "line": 1, }, }, "range": Array [ 29, - 35, + 30, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 37, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 31, + "line": 1, }, }, "range": Array [ - 36, + 31, 37, ], "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 37, - 38, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = ` -Object { - "body": Array [ - Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 35, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "compare", - "range": Array [ - 9, - 16, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 0, - 35, - ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 28, - 29, - ], - "type": "Identifier", - }, - "range": Array [ - 28, - 29, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 16, - 30, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 35, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 8, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 16, - ], - "type": "Identifier", - "value": "compare", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 38, "line": 1, }, "start": Object { - "column": 16, + "column": 37, "line": 1, }, }, "range": Array [ - 16, - 17, + 37, + 38, ], "type": "Punctuator", - "value": "<", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 42, "line": 1, }, "start": Object { - "column": 28, + "column": 39, "line": 1, }, }, "range": Array [ - 28, - 29, + 39, + 42, ], "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": ">", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 43, "line": 1, }, "start": Object { - "column": 30, + "column": 42, "line": 1, }, }, "range": Array [ - 30, - 31, + 42, + 43, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 44, "line": 1, }, "start": Object { - "column": 31, + "column": 43, "line": 1, }, }, "range": Array [ - 31, - 32, + 43, + 44, ], "type": "Punctuator", "value": ")", @@ -42761,17 +43192,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 46, "line": 1, }, "start": Object { - "column": 33, + "column": 45, "line": 1, }, }, "range": Array [ - 33, - 34, + 45, + 46, ], "type": "Punctuator", "value": "{", @@ -42779,17 +43210,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 34, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 34, - 35, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -42799,7 +43230,7 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { @@ -42820,8 +43251,8 @@ Object { }, "name": "b", "range": Array [ - 47, - 48, + 36, + 37, ], "type": "Identifier", }, @@ -42836,8 +43267,8 @@ Object { }, }, "range": Array [ - 40, - 49, + 29, + 38, ], "type": "ReturnStatement", }, @@ -42848,13 +43279,13 @@ Object { "line": 3, }, "start": Object { - "column": 34, + "column": 23, "line": 1, }, }, "range": Array [ - 34, - 51, + 23, + 40, ], "type": "BlockStatement", }, @@ -42892,67 +43323,67 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 18, "line": 1, }, "start": Object { - "column": 25, + "column": 14, "line": 1, }, }, "name": "b", "range": Array [ - 25, - 29, + 14, + 18, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 29, + "column": 18, "line": 1, }, "start": Object { - "column": 26, + "column": 15, "line": 1, }, }, "range": Array [ - 26, - 29, + 15, + 18, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 29, + "column": 18, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 29, + 17, + 18, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 29, + "column": 18, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "name": "X", "range": Array [ - 28, - 29, + 17, + 18, ], "type": "Identifier", }, @@ -42962,55 +43393,55 @@ Object { ], "range": Array [ 0, - 51, + 40, ], "returnType": Object { "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 1, }, "start": Object { - "column": 30, + "column": 19, "line": 1, }, }, "range": Array [ - 30, - 33, + 19, + 22, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 1, }, "start": Object { - "column": 32, + "column": 21, "line": 1, }, }, "range": Array [ - 32, - 33, + 21, + 22, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 1, }, "start": Object { - "column": 32, + "column": 21, "line": 1, }, }, "name": "X", "range": Array [ - 32, - 33, + 21, + 22, ], "type": "Identifier", }, @@ -43020,7 +43451,7 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 24, + "column": 13, "line": 1, }, "start": Object { @@ -43030,27 +43461,9 @@ Object { }, "params": Array [ Object { - "constraint": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 21, - 23, - ], - "type": "TSTypeLiteral", - }, "loc": Object { "end": Object { - "column": 23, + "column": 12, "line": 1, }, "start": Object { @@ -43078,14 +43491,14 @@ Object { }, "range": Array [ 11, - 23, + 12, ], "type": "TSTypeParameter", }, ], "range": Array [ 10, - 24, + 13, ], "type": "TSTypeParameterDeclaration", }, @@ -43103,7 +43516,7 @@ Object { }, "range": Array [ 0, - 52, + 41, ], "sourceType": "script", "tokens": Array [ @@ -43182,125 +43595,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 13, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 13, - 20, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 14, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, "range": Array [ - 21, - 22, + 13, + 14, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 15, "line": 1, }, "start": Object { - "column": 22, + "column": 14, "line": 1, }, }, "range": Array [ - 22, - 23, + 14, + 15, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 16, "line": 1, }, "start": Object { - "column": 23, + "column": 15, "line": 1, }, }, "range": Array [ - 23, - 24, + 15, + 16, ], "type": "Punctuator", - "value": ">", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 18, "line": 1, }, "start": Object { - "column": 24, + "column": 17, "line": 1, }, }, "range": Array [ - 24, - 25, + 17, + 18, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 19, "line": 1, }, "start": Object { - "column": 25, + "column": 18, "line": 1, }, }, "range": Array [ - 25, - 26, + 18, + 19, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 20, "line": 1, }, "start": Object { - "column": 26, + "column": 19, "line": 1, }, }, "range": Array [ - 26, - 27, + 19, + 20, ], "type": "Punctuator", "value": ":", @@ -43308,17 +43721,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 1, }, "start": Object { - "column": 28, + "column": 21, "line": 1, }, }, "range": Array [ - 28, - 29, + 21, + 22, ], "type": "Identifier", "value": "X", @@ -43326,110 +43739,56 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { - "column": 29, + "column": 23, "line": 1, }, }, "range": Array [ - 29, - 30, + 23, + 24, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 30, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 30, - 31, + 29, + 35, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 32, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 32, - 33, + 36, + 37, ], "type": "Identifier", - "value": "X", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 40, - 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", + "value": "b", }, Object { "loc": Object { @@ -43443,8 +43802,8 @@ Object { }, }, "range": Array [ - 48, - 49, + 37, + 38, ], "type": "Punctuator", "value": ";", @@ -43461,8 +43820,8 @@ Object { }, }, "range": Array [ - 50, - 51, + 39, + 40, ], "type": "Punctuator", "value": "}", @@ -43472,62 +43831,26 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-types.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = ` Object { "body": Array [ Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "name", - "range": Array [ - 50, - 54, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 43, - 55, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { - "column": 37, + "column": 33, "line": 1, }, }, "range": Array [ - 37, - 57, + 33, + 35, ], "type": "BlockStatement", }, @@ -43544,7 +43867,7 @@ Object { "line": 1, }, }, - "name": "message", + "name": "compare", "range": Array [ 9, 16, @@ -43553,113 +43876,80 @@ Object { }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "params": Array [], + "range": Array [ + 0, + 35, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, }, - "name": "name", - "range": Array [ - 17, - 28, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 21, + "column": 28, "line": 1, }, }, - "range": Array [ - 21, - 28, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "name": Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 22, + "column": 28, "line": 1, }, }, + "name": "T", "range": Array [ - 22, 28, + 29, ], - "type": "TSStringKeyword", + "type": "Identifier", }, + "range": Array [ + 28, + 29, + ], + "type": "TSTypeParameter", }, - }, - ], - "range": Array [ - 0, - 57, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, + ], "range": Array [ - 29, - 36, + 16, + 30, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "TSStringKeyword", - }, + "type": "TSTypeParameterDeclaration", }, - "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 35, + "line": 1, }, "start": Object { "column": 0, @@ -43668,7 +43958,7 @@ Object { }, "range": Array [ 0, - 58, + 35, ], "sourceType": "script", "tokens": Array [ @@ -43706,7 +43996,7 @@ Object { 16, ], "type": "Identifier", - "value": "message", + "value": "compare", }, Object { "loc": Object { @@ -43724,61 +44014,7 @@ Object { 17, ], "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 21, - ], - "type": "Identifier", - "value": "name", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "Identifier", - "value": "string", + "value": "<", }, Object { "loc": Object { @@ -43795,8 +44031,8 @@ Object { 28, 29, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { @@ -43814,12 +44050,12 @@ Object { 30, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 31, "line": 1, }, "start": Object { @@ -43829,97 +44065,61 @@ Object { }, "range": Array [ 30, - 36, + 31, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 32, "line": 1, }, "start": Object { - "column": 37, + "column": 31, "line": 1, }, }, "range": Array [ - 37, - 38, + 31, + 32, ], "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 43, - 49, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 50, - 54, - ], - "type": "Identifier", - "value": "name", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 34, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 33, + "line": 1, }, }, "range": Array [ - 54, - 55, + 33, + 34, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 34, + "line": 1, }, }, "range": Array [ - 56, - 57, + 34, + 35, ], "type": "Punctuator", "value": "}", @@ -43929,7 +44129,7 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-types-assignation.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = ` Object { "body": Array [ Object { @@ -43940,34 +44140,34 @@ Object { "argument": Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, - "name": "name", + "name": "b", "range": Array [ - 89, - 93, + 47, + 48, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 82, - 94, + 40, + 49, ], "type": "ReturnStatement", }, @@ -43978,13 +44178,13 @@ Object { "line": 3, }, "start": Object { - "column": 78, + "column": 34, "line": 1, }, }, "range": Array [ - 78, - 96, + 34, + 51, ], "type": "BlockStatement", }, @@ -43993,7 +44193,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { @@ -44001,10 +44201,10 @@ Object { "line": 1, }, }, - "name": "message", + "name": "a", "range": Array [ 9, - 16, + 10, ], "type": "Identifier", }, @@ -44022,306 +44222,203 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 17, + "column": 25, "line": 1, }, }, - "name": "name", + "name": "b", "range": Array [ - 17, - 28, + 25, + 29, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 21, + "column": 26, "line": 1, }, }, "range": Array [ - 21, - 28, + 26, + 29, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 22, + "column": 28, "line": 1, }, }, "range": Array [ - 22, 28, + 29, ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "name": "age", - "range": Array [ - 30, - 40, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 40, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 40, + "column": 29, "line": 1, }, "start": Object { - "column": 34, + "column": 28, "line": 1, }, }, + "name": "X", "range": Array [ - 34, - 40, + 28, + 29, ], - "type": "TSNumberKeyword", + "type": "Identifier", }, }, }, + }, + ], + "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": 46, + "column": 33, "line": 1, }, "start": Object { - "column": 30, + "column": 32, "line": 1, }, }, "range": Array [ - 30, - 46, + 32, + 33, ], - "right": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 46, + "column": 33, "line": 1, }, "start": Object { - "column": 43, + "column": 32, "line": 1, }, }, + "name": "X", "range": Array [ - 43, - 46, + 32, + 33, ], - "raw": "100", - "type": "Literal", - "value": 100, + "type": "Identifier", }, - "type": "AssignmentPattern", }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 1, - }, - "start": Object { - "column": 51, - "line": 1, - }, - }, - "name": "args", - "range": Array [ - 51, - 55, - ], - "type": "Identifier", + }, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 69, - "line": 1, - }, - "start": Object { - "column": 48, - "line": 1, - }, + "start": Object { + "column": 10, + "line": 1, }, - "range": Array [ - 48, - 69, - ], - "type": "RestElement", - "typeAnnotation": Object { + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 21, + 23, + ], + "type": "TSTypeLiteral", + }, "loc": Object { "end": Object { - "column": 69, + "column": 23, "line": 1, }, "start": Object { - "column": 55, + "column": 11, "line": 1, }, }, - "range": Array [ - 55, - 69, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "name": Object { "loc": Object { "end": Object { - "column": 69, + "column": 12, "line": 1, }, "start": Object { - "column": 56, + "column": 11, "line": 1, }, }, + "name": "X", "range": Array [ - 56, - 69, + 11, + 12, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 61, - "line": 1, - }, - "start": Object { - "column": 56, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 56, - 61, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 69, - "line": 1, - }, - "start": Object { - "column": 61, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 68, - "line": 1, - }, - "start": Object { - "column": 62, - "line": 1, - }, - }, - "range": Array [ - 62, - 68, - ], - "type": "TSStringKeyword", - }, - ], - "range": Array [ - 61, - 69, - ], - "type": "TSTypeParameterInstantiation", - }, + "type": "Identifier", }, + "range": Array [ + 11, + 23, + ], + "type": "TSTypeParameter", }, - }, - ], - "range": Array [ - 0, - 96, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 70, - "line": 1, - }, - }, + ], "range": Array [ - 70, - 77, + 10, + 24, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 71, - "line": 1, - }, - }, - "range": Array [ - 71, - 77, - ], - "type": "TSStringKeyword", - }, + "type": "TSTypeParameterDeclaration", }, - "type": "FunctionDeclaration", }, ], "loc": Object { @@ -44336,7 +44433,7 @@ Object { }, "range": Array [ 0, - 97, + 52, ], "sourceType": "script", "tokens": Array [ @@ -44361,7 +44458,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { @@ -44371,259 +44468,169 @@ Object { }, "range": Array [ 9, - 16, + 10, ], "type": "Identifier", - "value": "message", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 11, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 12, "line": 1, }, "start": Object { - "column": 17, + "column": 11, "line": 1, }, }, "range": Array [ - 17, - 21, + 11, + 12, ], "type": "Identifier", - "value": "name", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 20, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, "range": Array [ - 21, - 22, + 13, + 20, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { "column": 22, "line": 1, }, - }, - "range": Array [ - 22, - 28, - ], - "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 33, - ], - "type": "Identifier", - "value": "age", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, "start": Object { - "column": 33, + "column": 21, "line": 1, }, }, "range": Array [ - 33, - 34, + 21, + 22, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "range": Array [ - 34, - 40, - ], - "type": "Identifier", - "value": "number", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 23, "line": 1, }, "start": Object { - "column": 41, + "column": 22, "line": 1, }, }, "range": Array [ - 41, - 42, + 22, + 23, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 43, - "line": 1, - }, - }, - "range": Array [ - 43, - 46, - ], - "type": "Numeric", - "value": "100", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 47, + "column": 24, "line": 1, }, "start": Object { - "column": 46, + "column": 23, "line": 1, }, }, "range": Array [ - 46, - 47, + 23, + 24, ], "type": "Punctuator", - "value": ",", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 51, + "column": 25, "line": 1, }, "start": Object { - "column": 48, + "column": 24, "line": 1, }, }, "range": Array [ - 48, - 51, + 24, + 25, ], "type": "Punctuator", - "value": "...", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 55, + "column": 26, "line": 1, }, "start": Object { - "column": 51, + "column": 25, "line": 1, }, }, "range": Array [ - 51, - 55, + 25, + 26, ], "type": "Identifier", - "value": "args", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 27, "line": 1, }, "start": Object { - "column": 55, + "column": 26, "line": 1, }, }, "range": Array [ - 55, - 56, + 26, + 27, ], "type": "Punctuator", "value": ":", @@ -44631,89 +44638,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 61, - "line": 1, - }, - "start": Object { - "column": 56, - "line": 1, - }, - }, - "range": Array [ - 56, - 61, - ], - "type": "Identifier", - "value": "Array", - }, - Object { - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 61, - "line": 1, - }, - }, - "range": Array [ - 61, - 62, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 68, + "column": 29, "line": 1, }, "start": Object { - "column": 62, + "column": 28, "line": 1, }, }, "range": Array [ - 62, - 68, + 28, + 29, ], "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": ">", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 70, + "column": 30, "line": 1, }, "start": Object { - "column": 69, + "column": 29, "line": 1, }, }, "range": Array [ - 69, - 70, + 29, + 30, ], "type": "Punctuator", "value": ")", @@ -44721,17 +44674,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": ":", @@ -44739,35 +44692,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": "{", @@ -44775,17 +44728,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", @@ -44793,35 +44746,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": ";", @@ -44838,9 +44791,9 @@ Object { }, }, "range": Array [ - 95, - 96, - ], + 50, + 51, + ], "type": "Punctuator", "value": "}", }, @@ -44849,86 +44802,194 @@ Object { } `; -exports[`typescript fixtures/basics/import-equal-declaration.src 1`] = ` +exports[`typescript fixtures/basics/function-with-types.src 1`] = ` Object { "body": Array [ Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "name", + "range": Array [ + 50, + 54, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 55, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 57, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { - "column": 7, + "column": 9, "line": 1, }, }, - "name": "foo", + "name": "message", "range": Array [ - 7, - 10, + 9, + 16, ], "type": "Identifier", }, - "isExport": false, "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, - "moduleReference": Object { - "expression": Object { + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 26, + "column": 28, "line": 1, }, "start": Object { - "column": 21, + "column": 17, "line": 1, }, }, + "name": "name", "range": Array [ - 21, - 26, + 17, + 28, ], - "raw": "'bar'", - "type": "Literal", - "value": "bar", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, }, + ], + "range": Array [ + 0, + 57, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 27, + "column": 36, "line": 1, }, "start": Object { - "column": 13, + "column": 29, "line": 1, }, }, "range": Array [ - 13, - 27, + 29, + 36, ], - "type": "TSExternalModuleReference", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, }, - "range": Array [ - 0, - 28, - ], - "type": "TSImportEqualsDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -44937,14 +44998,14 @@ Object { }, "range": Array [ 0, - 29, + 58, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -44954,115 +45015,115 @@ Object { }, "range": Array [ 0, - 6, + 8, ], "type": "Keyword", - "value": "import", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { - "column": 7, + "column": 9, "line": 1, }, }, "range": Array [ - 7, - 10, + 9, + 16, ], "type": "Identifier", - "value": "foo", + "value": "message", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 12, + 16, + 17, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 21, "line": 1, }, "start": Object { - "column": 13, + "column": 17, "line": 1, }, }, "range": Array [ - 13, - 20, + 17, + 21, ], "type": "Identifier", - "value": "require", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 22, "line": 1, }, "start": Object { - "column": 20, + "column": 21, "line": 1, }, }, "range": Array [ - 20, 21, + 22, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 28, "line": 1, }, "start": Object { - "column": 21, + "column": 22, "line": 1, }, }, "range": Array [ - 21, - 26, + 22, + 28, ], - "type": "String", - "value": "'bar'", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 29, "line": 1, }, "start": Object { - "column": 26, + "column": 28, "line": 1, }, }, "range": Array [ - 26, - 27, + 28, + 29, ], "type": "Punctuator", "value": ")", @@ -45070,545 +45131,533 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 30, "line": 1, }, "start": Object { - "column": 27, + "column": 29, "line": 1, }, }, "range": Array [ - 27, - 28, + 29, + 30, ], "type": "Punctuator", - "value": ";", + "value": ":", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/import-export-equal-declaration.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "isExport": true, "loc": Object { "end": Object { - "column": 35, + "column": 36, "line": 1, }, "start": Object { - "column": 0, + "column": 30, "line": 1, }, }, - "moduleReference": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 33, - ], - "raw": "'bar'", - "type": "Literal", - "value": "bar", - }, - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 34, - ], - "type": "TSExternalModuleReference", - }, "range": Array [ - 0, - 35, + 30, + 36, ], - "type": "TSImportEqualsDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "string", }, - }, - "range": Array [ - 0, - 36, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 38, "line": 1, }, "start": Object { - "column": 0, + "column": 37, "line": 1, }, }, "range": Array [ - 0, - 6, + 37, + 38, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 7, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 7, - 13, + 43, + 49, ], "type": "Keyword", - "value": "import", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 14, - 17, + 50, + 54, ], "type": "Identifier", - "value": "foo", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 18, - 19, + 54, + 55, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 20, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 20, - 27, + 56, + 57, ], - "type": "Identifier", - "value": "require", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-types-assignation.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, + "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, + }, }, - "start": Object { - "column": 27, - "line": 1, + "range": Array [ + 78, + 96, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, + "name": "message", + "range": Array [ + 9, + 16, + ], + "type": "Identifier", }, - "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": "(", - }, - Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 28, + "column": 0, "line": 1, }, }, - "range": Array [ - 28, - 33, - ], - "type": "String", - "value": "'bar'", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/import-type.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": 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, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, }, - "start": Object { - "column": 9, - "line": 1, + "name": "name", + "range": Array [ + 17, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, }, }, - "parameter": Object { - "literal": Object { + Object { + "left": Object { "loc": Object { "end": Object { - "column": 26, + "column": 40, "line": 1, }, "start": Object { - "column": 23, + "column": 30, "line": 1, }, }, + "name": "age", "range": Array [ - 23, - 26, + 30, + 40, ], - "raw": "'A'", - "type": "Literal", - "value": "A", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "TSNumberKeyword", + }, + }, }, "loc": Object { "end": Object { - "column": 26, + "column": 46, "line": 1, }, "start": Object { - "column": 23, + "column": 30, "line": 1, }, }, "range": Array [ - 23, - 26, + 30, + 46, ], - "type": "TSLiteralType", - }, - "qualifier": null, - "range": Array [ - 9, - 27, - ], - "type": "TSImportType", - "typeParameters": null, - }, - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "B", - "range": Array [ - 34, - 35, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 29, - 55, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "isTypeOf": false, - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "parameter": Object { - "literal": Object { + "right": Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 46, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 43, + "line": 1, }, }, "range": Array [ - 45, - 48, + 43, + 46, ], - "raw": "\\"B\\"", + "raw": "100", "type": "Literal", - "value": "B", + "value": 100, }, - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, + "type": "AssignmentPattern", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, }, + "name": "args", + "range": Array [ + 51, + 55, + ], + "type": "Identifier", }, - "range": Array [ - 45, - 48, - ], - "type": "TSLiteralType", - }, - "qualifier": Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 69, + "line": 1, }, "start": Object { - "column": 21, - "line": 2, + "column": 48, + "line": 1, }, }, - "name": "X", "range": Array [ - 50, - 51, + 48, + 69, ], - "type": "Identifier", - }, - "range": Array [ - 38, - 54, - ], - "type": "TSImportType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, + "type": "RestElement", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "range": Array [ + 55, + 69, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 69, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 56, + "line": 1, }, }, "range": Array [ - 52, - 53, + 56, + 69, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 61, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 56, + "line": 1, }, }, - "name": "Y", + "name": "Array", "range": Array [ - 52, - 53, + 56, + 61, ], "type": "Identifier", }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 61, + 69, + ], + "type": "TSTypeParameterInstantiation", + }, }, - ], + }, + }, + ], + "range": Array [ + 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", }, ], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -45617,14 +45666,14 @@ Object { }, "range": Array [ 0, - 56, + 97, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 8, "line": 1, }, "start": Object { @@ -45634,64 +45683,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 { @@ -45700,21 +45749,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 { @@ -45724,115 +45773,97 @@ 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, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 29, 33, + 34, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 40, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 34, + "line": 1, }, }, "range": Array [ 34, - 35, + 40, ], "type": "Identifier", - "value": "B", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 42, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 41, + "line": 1, }, }, "range": Array [ - 36, - 37, + 41, + 42, ], "type": "Punctuator", "value": "=", @@ -45840,125 +45871,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 46, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 43, + "line": 1, }, }, "range": Array [ - 38, - 44, + 43, + 46, ], - "type": "Keyword", - "value": "import", + "type": "Numeric", + "value": "100", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 47, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 46, + "line": 1, }, }, "range": Array [ - 44, - 45, + 46, + 47, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 51, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 48, + "line": 1, }, }, "range": Array [ - 45, 48, + 51, ], - "type": "String", - "value": "\\"B\\"", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 55, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 51, + "line": 1, }, }, "range": Array [ - 48, - 49, + 51, + 55, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "args", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 56, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 55, + "line": 1, }, }, "range": Array [ - 49, - 50, + 55, + 56, ], "type": "Punctuator", - "value": ".", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 61, + "line": 1, }, "start": Object { - "column": 21, - "line": 2, + "column": 56, + "line": 1, }, }, "range": Array [ - 50, - 51, + 56, + 61, ], "type": "Identifier", - "value": "X", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 62, + "line": 1, }, "start": Object { - "column": 22, - "line": 2, + "column": 61, + "line": 1, }, }, "range": Array [ - 51, - 52, + 61, + 62, ], "type": "Punctuator", "value": "<", @@ -45966,35 +45997,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 68, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 62, + "line": 1, }, }, "range": Array [ - 52, - 53, + 62, + 68, ], "type": "Identifier", - "value": "Y", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 69, + "line": 1, }, "start": Object { - "column": 24, - "line": 2, + "column": 68, + "line": 1, }, }, "range": Array [ - 53, - 54, + 68, + 69, ], "type": "Punctuator", "value": ">", @@ -46002,527 +46033,384 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 70, + "line": 1, }, "start": Object { - "column": 25, - "line": 2, + "column": 69, + "line": 1, }, }, "range": Array [ - 54, - 55, + 69, + 70, ], "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": 30, + "column": 71, "line": 1, }, "start": Object { - "column": 0, + "column": 70, "line": 1, }, }, "range": Array [ - 0, - 30, + 70, + 71, ], - "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, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [ - Object { - "isTypeOf": false, - "loc": Object { - "end": Object { - "column": 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", - }, - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ":", }, - }, - "range": Array [ - 0, - 31, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 77, "line": 1, }, "start": Object { - "column": 0, + "column": 71, "line": 1, }, }, "range": Array [ - 0, - 4, + 71, + 77, ], "type": "Identifier", - "value": "type", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 79, "line": 1, }, "start": Object { - "column": 5, + "column": 78, "line": 1, }, }, "range": Array [ - 5, - 6, + 78, + 79, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 1, + "line": 2, }, "start": Object { - "column": 7, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 7, - 8, + 82, + 88, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { "column": 9, - "line": 1, + "line": 2, }, }, "range": Array [ - 9, - 10, + 89, + 93, ], "type": "Identifier", - "value": "A", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 10, - 11, + 93, + 94, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, - }, + "column": 0, + "line": 3, + }, }, "range": Array [ - 11, - 17, + 95, + 96, ], - "type": "Keyword", - "value": "import", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/import-equal-declaration.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "isExport": false, "loc": Object { "end": Object { - "column": 18, + "column": 28, "line": 1, }, "start": Object { - "column": 17, + "column": 0, "line": 1, }, }, + "moduleReference": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 27, + ], + "type": "TSExternalModuleReference", + }, "range": Array [ - 17, - 18, + 0, + 28, ], - "type": "Punctuator", - "value": "(", + "type": "TSImportEqualsDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 20, + "column": 6, "line": 1, }, "start": Object { - "column": 18, + "column": 0, "line": 1, }, }, "range": Array [ - 18, - 20, + 0, + 6, ], - "type": "String", - "value": "\\"\\"", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 10, "line": 1, }, "start": Object { - "column": 20, + "column": 7, "line": 1, }, }, "range": Array [ - 20, - 21, + 7, + 10, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 12, "line": 1, }, "start": Object { - "column": 21, + "column": 11, "line": 1, }, }, "range": Array [ - 21, - 22, + 11, + 12, ], "type": "Punctuator", - "value": ".", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 20, "line": 1, }, "start": Object { - "column": 22, + "column": 13, "line": 1, }, }, "range": Array [ - 22, - 23, + 13, + 20, ], "type": "Identifier", - "value": "B", + "value": "require", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 21, "line": 1, }, "start": Object { - "column": 23, + "column": 20, "line": 1, }, }, "range": Array [ - 23, - 24, + 20, + 21, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 26, "line": 1, }, "start": Object { - "column": 24, + "column": 21, "line": 1, }, }, "range": Array [ - 24, - 27, + 21, + 26, ], - "type": "Identifier", - "value": "any", + "type": "String", + "value": "'bar'", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 27, "line": 1, }, "start": Object { - "column": 27, + "column": 26, "line": 1, }, }, "range": Array [ + 26, 27, - 28, ], "type": "Punctuator", - "value": ">", + "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, + "column": 27, "line": 1, }, }, "range": Array [ - 29, - 30, + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -46532,104 +46420,86 @@ Object { } `; -exports[`typescript fixtures/basics/interface-extends.src 1`] = ` +exports[`typescript fixtures/basics/import-export-equal-declaration.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], + "id": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 26, + "column": 14, "line": 1, }, }, + "name": "foo", "range": Array [ - 26, - 30, + 14, + 17, ], - "type": "TSInterfaceBody", + "type": "Identifier", }, - "extends": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 22, - 25, - ], - "type": "Identifier", - }, + "isExport": true, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "moduleReference": Object { + "expression": Object { "loc": Object { "end": Object { - "column": 25, + "column": 33, "line": 1, }, "start": Object { - "column": 22, + "column": 28, "line": 1, }, }, "range": Array [ - 22, - 25, + 28, + 33, ], - "type": "TSInterfaceHeritage", + "raw": "'bar'", + "type": "Literal", + "value": "bar", }, - ], - "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 34, "line": 1, }, "start": Object { - "column": 10, + "column": 20, "line": 1, }, }, - "name": "Foo", "range": Array [ - 10, - 13, + 20, + 34, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "TSExternalModuleReference", }, "range": Array [ 0, - 30, + 35, ], - "type": "TSInterfaceDeclaration", + "type": "TSImportEqualsDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -46638,14 +46508,14 @@ Object { }, "range": Array [ 0, - 31, + 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { @@ -46655,10 +46525,10 @@ Object { }, "range": Array [ 0, - 9, + 6, ], "type": "Keyword", - "value": "interface", + "value": "export", }, Object { "loc": Object { @@ -46667,21 +46537,21 @@ Object { "line": 1, }, "start": Object { - "column": 10, + "column": 7, "line": 1, }, }, "range": Array [ - 10, + 7, 13, ], - "type": "Identifier", - "value": "Foo", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 1, }, "start": Object { @@ -46691,28 +46561,28 @@ Object { }, "range": Array [ 14, - 21, + 17, ], - "type": "Keyword", - "value": "extends", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 19, "line": 1, }, "start": Object { - "column": 22, + "column": 18, "line": 1, }, }, "range": Array [ - 22, - 25, + 18, + 19, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { @@ -46721,173 +46591,354 @@ Object { "line": 1, }, "start": Object { - "column": 26, + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 27, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, "line": 1, }, }, "range": Array [ - 26, 27, + 28, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 33, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 28, + "line": 1, }, }, "range": Array [ - 29, - 30, + 28, + 33, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, ], "type": "Punctuator", - "value": "}", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/interface-extends-multiple.src 1`] = ` +exports[`typescript fixtures/basics/import-type.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], + "id": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 6, + "line": 1, }, "start": Object { - "column": 30, + "column": 5, "line": 1, }, }, + "name": "A", "range": Array [ - 30, - 34, + 5, + 6, ], - "type": "TSInterfaceBody", + "type": "Identifier", }, - "extends": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 22, - 25, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "isTypeOf": true, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, + "start": Object { + "column": 9, + "line": 1, }, - "range": Array [ - 22, - 25, - ], - "type": "TSInterfaceHeritage", }, - Object { - "expression": Object { + "parameter": Object { + "literal": Object { "loc": Object { "end": Object { - "column": 29, + "column": 26, "line": 1, }, "start": Object { - "column": 26, + "column": 23, "line": 1, }, }, - "name": "Baz", "range": Array [ + 23, 26, - 29, ], - "type": "Identifier", + "raw": "'A'", + "type": "Literal", + "value": "A", }, "loc": Object { "end": Object { - "column": 29, + "column": 26, "line": 1, }, "start": Object { - "column": 26, + "column": 23, "line": 1, }, }, "range": Array [ + 23, 26, - 29, ], - "type": "TSInterfaceHeritage", + "type": "TSLiteralType", }, - ], - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, + "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": "Foo", + "name": "B", "range": Array [ - 10, - 13, + 34, + 35, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 26, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 34, + 29, + 55, ], - "type": "TSInterfaceDeclaration", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "isTypeOf": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "parameter": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "raw": "\\"B\\"", + "type": "Literal", + "value": "B", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "TSLiteralType", + }, + "qualifier": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "X", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "range": Array [ + 38, + 54, + ], + "type": "TSImportType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "Y", + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 51, + 54, + ], + "type": "TSTypeParameterInstantiation", + }, + }, }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -46896,14 +46947,14 @@ Object { }, "range": Array [ 0, - 35, + 56, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 4, "line": 1, }, "start": Object { @@ -46913,1223 +46964,7608 @@ Object { }, "range": Array [ 0, - 9, + 4, ], - "type": "Keyword", - "value": "interface", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 6, "line": 1, }, "start": Object { - "column": 10, + "column": 5, "line": 1, }, }, "range": Array [ - 10, - 13, + 5, + 6, ], "type": "Identifier", - "value": "Foo", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 8, "line": 1, }, "start": Object { - "column": 14, + "column": 7, "line": 1, }, }, "range": Array [ - 14, - 21, + 7, + 8, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 1, }, "start": Object { - "column": 22, + "column": 9, "line": 1, }, }, "range": Array [ - 22, - 25, + 9, + 15, ], - "type": "Identifier", - "value": "Bar", + "type": "Keyword", + "value": "typeof", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 22, "line": 1, }, "start": Object { - "column": 25, + "column": 16, "line": 1, }, }, "range": Array [ - 25, - 26, + 16, + 22, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 26, + "column": 22, "line": 1, }, }, "range": Array [ - 26, - 29, + 22, + 23, ], - "type": "Identifier", - "value": "Baz", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 26, "line": 1, }, "start": Object { - "column": 30, + "column": 23, "line": 1, }, }, "range": Array [ - 30, - 31, + 23, + 26, ], - "type": "Punctuator", - "value": "{", + "type": "String", + "value": "'A'", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 27, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 26, + "line": 1, }, }, "range": Array [ - 33, - 34, + 26, + 27, ], "type": "Punctuator", - "value": "}", + "value": ")", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-type-parameters.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 21, - ], - "type": "TSInterfaceBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 28, + "line": 1, }, "start": Object { - "column": 0, + "column": 27, "line": 1, }, }, "range": Array [ - 0, - 21, + 27, + 28, ], - "type": "TSInterfaceDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 13, - 16, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ";", }, - }, - "range": Array [ - 0, - 22, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 9, + 29, + 33, ], - "type": "Keyword", - "value": "interface", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 10, - 13, + 34, + 35, ], "type": "Identifier", - "value": "Foo", + "value": "B", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 13, - 14, + 36, + 37, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { "column": 15, - "line": 1, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 14, - 15, + 38, + 44, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 1, + "line": 2, }, "start": Object { "column": 15, - "line": 1, + "line": 2, }, }, "range": Array [ - 15, - 16, + 44, + 45, ], "type": "Punctuator", - "value": ">", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 17, - 18, + 45, + 48, + ], + "type": "String", + "value": "\\"B\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 21, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 20, + "line": 2, }, }, "range": Array [ - 20, - 21, + 49, + 50, ], "type": "Punctuator", - "value": "}", + "value": ".", }, - ], - "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, - }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "value": "Y", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/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": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 29, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, }, - "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", + "name": "A", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "start": Object { + "column": 10, + "line": 1, }, - "optional": true, - "range": Array [ - 37, - 50, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { + }, + "params": Array [ + Object { + "isTypeOf": false, "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 28, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 11, + "line": 1, }, }, - "range": Array [ - 41, - 49, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "parameter": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 20, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 18, + "line": 1, }, }, "range": Array [ - 43, - 49, + 18, + 20, ], - "type": "TSNumberKeyword", - }, - }, - }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "name": "bax", - "range": Array [ - 56, - 59, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 55, - 69, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, + "type": "TSLiteralType", }, - "range": Array [ - 60, - 68, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "qualifier": Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 23, + "line": 1, }, "start": Object { - "column": 11, - "line": 4, + "column": 22, + "line": 1, }, }, + "name": "B", "range": Array [ - 62, - 68, + 22, + 23, ], - "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": "Identifier", }, "range": Array [ - 80, - 88, + 11, + 28, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "TSImportType", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 28, + "line": 1, }, "start": Object { - "column": 12, - "line": 5, + "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 [ - 82, - 88, + 23, + 28, ], - "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", + "type": "TSTypeParameterInstantiation", }, }, + ], + "range": Array [ + 10, + 29, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 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, }, - Object { + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "TSInterfaceBody", + }, + "extends": Array [ + Object { + "expression": Object { "loc": Object { "end": Object { - "column": 27, - "line": 7, + "column": 25, + "line": 1, }, "start": Object { - "column": 4, - "line": 7, + "column": 22, + "line": 1, }, }, - "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, - ], - "type": "TSNumberKeyword", - }, - }, - }, - ], + "name": "Bar", "range": Array [ - 121, - 144, + 22, + 25, ], - "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", - }, - }, + "type": "Identifier", }, - 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": 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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 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": 16, - "line": 8, + "column": 25, + "line": 1, }, "start": Object { - "column": 4, - "line": 8, + "column": 22, + "line": 1, }, }, - "params": Array [], + "name": "Bar", "range": Array [ - 149, - 161, + 22, + 25, ], - "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": "Identifier", }, - 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": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSInterfaceHeritage", + }, + Object { + "expression": Object { "loc": Object { "end": Object { - "column": 24, - "line": 9, + "column": 29, + "line": 1, }, "start": Object { - "column": 4, - "line": 9, + "column": 26, + "line": 1, }, }, - "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", - }, - ], + "name": "Baz", "range": Array [ - 166, - 186, + 26, + 29, ], - "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": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, }, - "type": "TSMethodSignature", + "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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 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", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 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, + ], + "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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 16, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 297, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 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", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 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", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-jsdoc.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "bar", + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 76, + 85, + ], + "type": "TSMethodSignature", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 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": "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, + }, + }, + "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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 62, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 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": true, + "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 8, - "line": 10, + "column": 7, + "line": 2, }, "start": Object { - "column": 5, - "line": 10, + "column": 4, + "line": 2, }, }, - "name": "loo", + "name": "foo", "range": Array [ - 192, - 195, + 21, + 24, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 26, - "line": 10, + "column": 9, + "line": 2, }, "start": Object { "column": 4, - "line": 10, + "line": 2, }, }, "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, + 21, + 26, ], - "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", + "type": "TSPropertySignature", }, Object { "computed": false, @@ -48137,435 +54573,221 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 11, + "line": 3, }, "start": Object { "column": 4, - "line": 11, + "line": 3, }, }, - "name": "boo", + "name": "bar", "range": Array [ - 218, - 221, + 31, + 34, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 26, - "line": 11, + "column": 17, + "line": 3, }, "start": Object { "column": 4, - "line": 11, + "line": 3, }, }, - "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", - }, - ], + "optional": true, "range": Array [ - 218, - 240, + 31, + 44, ], - "returnType": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, - "line": 11, + "column": 16, + "line": 3, }, "start": Object { - "column": 19, - "line": 11, + "column": 8, + "line": 3, }, }, "range": Array [ - 233, - 239, + 35, + 43, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, - "line": 11, + "column": 16, + "line": 3, }, "start": Object { - "column": 21, - "line": 11, + "column": 10, + "line": 3, }, }, "range": Array [ - 235, - 239, + 37, + 43, ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSMethodSignature", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 11, - }, - "start": Object { - "column": 7, - "line": 11, - }, + "type": "TSStringKeyword", }, - "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": 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": 4, }, "start": Object { - "column": 15, - "line": 12, + "column": 4, + "line": 4, }, }, + "name": "baz", "range": Array [ - 256, - 264, + 49, + 52, ], - "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": 34, + "line": 4, }, "start": Object { "column": 4, - "line": 13, + "line": 4, }, }, + "optional": true, "params": Array [ Object { "loc": Object { "end": Object { - "column": 13, - "line": 13, + "column": 12, + "line": 4, }, "start": Object { - "column": 12, - "line": 13, + "column": 9, + "line": 4, }, }, - "name": "a", + "name": "foo", "range": Array [ - 278, - 279, + 54, + 57, ], "type": "Identifier", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 13, + "column": 26, + "line": 4, }, "start": Object { - "column": 15, - "line": 13, + "column": 14, + "line": 4, }, }, - "name": "b", + "name": "bar", "optional": true, "range": Array [ - 281, - 282, + 59, + 71, ], "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 { + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 10, - "line": 13, + "column": 26, + "line": 4, }, "start": Object { - "column": 9, - "line": 13, + "column": 18, + "line": 4, }, }, - "name": Object { + "range": Array [ + 63, + 71, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 10, - "line": 13, + "column": 26, + "line": 4, }, "start": Object { - "column": 9, - "line": 13, + "column": 20, + "line": 4, }, }, - "name": "F", "range": Array [ - 275, - 276, + 65, + 71, ], - "type": "Identifier", + "type": "TSStringKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, }, - "range": Array [ - 275, - 276, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 274, - 277, - ], - "type": "TSTypeParameterDeclaration", - }, + "name": "baz", + "optional": true, + "range": Array [ + 73, + 77, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 49, + 79, + ], + "type": "TSMethodSignature", }, ], "loc": Object { "end": Object { "column": 1, - "line": 14, + "line": 5, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, - 295, + 15, + 81, ], "type": "TSInterfaceBody", }, "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { @@ -48573,17 +54795,17 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "test", "range": Array [ 10, - 13, + 14, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 14, + "line": 5, }, "start": Object { "column": 0, @@ -48592,7 +54814,7 @@ Object { }, "range": Array [ 0, - 295, + 81, ], "type": "TSInterfaceDeclaration", }, @@ -48600,7 +54822,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 16, + "line": 6, }, "start": Object { "column": 0, @@ -48609,7 +54831,7 @@ Object { }, "range": Array [ 0, - 297, + 82, ], "sourceType": "script", "tokens": Array [ @@ -48634,7 +54856,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { @@ -48644,25 +54866,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": "{", @@ -48679,11 +54901,11 @@ Object { }, }, "range": Array [ - 20, - 23, + 21, + 24, ], "type": "Identifier", - "value": "baa", + "value": "foo", }, Object { "loc": Object { @@ -48697,44 +54919,26 @@ Object { }, }, "range": Array [ - 23, 24, + 25, ], "type": "Punctuator", - "value": ":", + "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, + "column": 8, "line": 2, }, }, "range": Array [ - 31, - 32, + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -48751,8 +54955,8 @@ Object { }, }, "range": Array [ - 37, - 40, + 31, + 34, ], "type": "Identifier", "value": "bar", @@ -48769,8 +54973,8 @@ Object { }, }, "range": Array [ - 40, - 41, + 34, + 35, ], "type": "Punctuator", "value": "?", @@ -48787,8 +54991,8 @@ Object { }, }, "range": Array [ - 41, - 42, + 35, + 36, ], "type": "Punctuator", "value": ":", @@ -48805,11 +55009,11 @@ Object { }, }, "range": Array [ + 37, 43, - 49, ], "type": "Identifier", - "value": "number", + "value": "string", }, Object { "loc": Object { @@ -48823,8 +55027,8 @@ Object { }, }, "range": Array [ - 49, - 50, + 43, + 44, ], "type": "Punctuator", "value": ";", @@ -48832,7 +55036,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 4, }, "start": Object { @@ -48841,332 +55045,1035 @@ Object { }, }, "range": Array [ - 55, - 56, + 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": "[", + "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": 5, + "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 [ - 56, - 59, + 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 { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "TSPropertySignature", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 27, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 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": "bax", + "value": "test", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 16, + "line": 1, }, "start": Object { - "column": 8, - "line": 4, + "column": 15, + "line": 1, }, }, "range": Array [ - 59, - 60, + 15, + 16, ], "type": "Punctuator", - "value": "]", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 7, + "line": 2, }, "start": Object { - "column": 9, - "line": 4, + "column": 4, + "line": 2, }, }, "range": Array [ - 60, - 61, + 21, + 24, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 8, + "line": 2, }, "start": Object { - "column": 11, - "line": 4, + "column": 7, + "line": 2, }, }, "range": Array [ - 62, - 68, + 24, + 25, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 1, + "line": 3, }, "start": Object { - "column": 17, - "line": 4, + "column": 0, + "line": 3, }, }, "range": Array [ - 68, - 69, + 26, + 27, ], "type": "Punctuator", - "value": ";", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/keyof-operator.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 4, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 74, - 75, + 0, + 19, ], - "type": "Punctuator", - "value": "[", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "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", + }, + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, - "line": 5, + "column": 4, + "line": 1, }, "start": Object { - "column": 5, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 75, - 78, + 0, + 4, ], "type": "Identifier", - "value": "baz", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 6, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 5, + "line": 1, }, }, "range": Array [ - 78, - 79, + 5, + 6, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 8, + "line": 1, }, "start": Object { - "column": 9, - "line": 5, + "column": 7, + "line": 1, }, }, "range": Array [ - 79, - 80, + 7, + 8, ], "type": "Punctuator", - "value": "?", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 5, + "column": 14, + "line": 1, }, "start": Object { - "column": 10, - "line": 5, + "column": 9, + "line": 1, }, }, "range": Array [ - 80, - 81, + 9, + 14, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "keyof", }, Object { "loc": Object { "end": Object { "column": 18, - "line": 5, + "line": 1, }, "start": Object { - "column": 12, - "line": 5, + "column": 15, + "line": 1, }, }, "range": Array [ - 82, - 88, + 15, + 18, ], "type": "Identifier", - "value": "string", + "value": "foo", }, Object { "loc": Object { "end": Object { "column": 19, - "line": 5, + "line": 1, }, "start": Object { "column": 18, - "line": 5, + "line": 1, }, }, "range": Array [ - 88, - 89, + 18, + 19, ], "type": "Punctuator", "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "range": Array [ - 94, - 95, + "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", + }, ], - "type": "Punctuator", - "value": "[", - }, - Object { + "kind": "var", "loc": Object { "end": Object { - "column": 8, - "line": 6, + "column": 44, + "line": 1, }, "start": Object { - "column": 5, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 95, - 98, + 0, + 44, ], - "type": "Identifier", - "value": "eee", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 6, + "column": 3, + "line": 1, }, "start": Object { - "column": 8, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 98, - 99, + 0, + 3, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 6, + "column": 15, + "line": 1, }, "start": Object { - "column": 10, - "line": 6, + "column": 4, + "line": 1, }, }, "range": Array [ - 100, - 106, + 4, + 15, ], "type": "Identifier", - "value": "number", + "value": "nestedArray", }, 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, + "line": 1, }, "start": Object { - "column": 17, - "line": 6, + "column": 15, + "line": 1, }, }, "range": Array [ - 107, - 108, + 15, + 16, ], "type": "Punctuator", "value": ":", @@ -49174,971 +56081,1366 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 6, + "column": 22, + "line": 1, }, "start": Object { - "column": 19, - "line": 6, + "column": 17, + "line": 1, }, }, "range": Array [ - 109, - 115, + 17, + 22, ], "type": "Identifier", - "value": "string", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 6, + "column": 23, + "line": 1, }, "start": Object { - "column": 25, - "line": 6, + "column": 22, + "line": 1, }, }, "range": Array [ - 115, - 116, + 22, + 23, ], "type": "Punctuator", - "value": ";", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 7, + "column": 28, + "line": 1, }, "start": Object { - "column": 4, - "line": 7, + "column": 23, + "line": 1, }, }, "range": Array [ - 121, - 122, + 23, + 28, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 7, + "column": 29, + "line": 1, }, "start": Object { - "column": 5, - "line": 7, + "column": 28, + "line": 1, }, }, "range": Array [ - 122, - 125, + 28, + 29, ], - "type": "Identifier", - "value": "fff", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 7, + "column": 34, + "line": 1, }, "start": Object { - "column": 8, - "line": 7, + "column": 29, + "line": 1, }, }, "range": Array [ - 125, - 126, + 29, + 34, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 7, + "column": 35, + "line": 1, }, "start": Object { - "column": 9, - "line": 7, + "column": 34, + "line": 1, }, }, "range": Array [ - 126, - 127, + 34, + 35, ], "type": "Punctuator", - "value": ":", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 7, + "column": 41, + "line": 1, }, "start": Object { - "column": 11, - "line": 7, + "column": 35, + "line": 1, }, }, "range": Array [ - 128, - 134, + 35, + 41, ], "type": "Identifier", - "value": "number", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 7, + "column": 42, + "line": 1, }, "start": Object { - "column": 17, - "line": 7, + "column": 41, + "line": 1, }, }, "range": Array [ - 134, - 135, + 41, + 42, ], "type": "Punctuator", - "value": "]", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 7, + "column": 43, + "line": 1, }, "start": Object { - "column": 18, - "line": 7, + "column": 42, + "line": 1, }, }, "range": Array [ - 135, - 136, + 42, + 43, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 7, + "column": 44, + "line": 1, }, "start": Object { - "column": 20, - "line": 7, + "column": 43, + "line": 1, }, }, "range": Array [ - 137, - 143, + 43, + 44, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ">", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/never-type-param.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 7, - }, - "start": Object { - "column": 26, - "line": 7, + "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", }, - }, - "range": Array [ - 143, - 144, ], - "type": "Punctuator", - "value": ";", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 18, + "line": 1, }, "start": Object { - "column": 4, - "line": 8, + "column": 0, + "line": 1, }, }, "range": Array [ - 149, - 152, + 0, + 18, ], - "type": "Identifier", - "value": "doo", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 8, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "Observable", + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "empty", + "range": Array [ + 30, + 35, + ], + "type": "Identifier", + }, + "range": Array [ + 19, + 35, + ], + "type": "MemberExpression", }, - "start": Object { - "column": 7, - "line": 8, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 19, + 44, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "TSNeverKeyword", + }, + ], + "range": Array [ + 35, + 42, + ], + "type": "TSTypeParameterInstantiation", }, }, - "range": Array [ - 152, - 153, - ], - "type": "Punctuator", - "value": "(", - }, - Object { "loc": Object { "end": Object { - "column": 9, - "line": 8, + "column": 26, + "line": 2, }, "start": Object { - "column": 8, - "line": 8, + "column": 0, + "line": 2, }, }, "range": Array [ - 153, - 154, + 19, + 45, ], - "type": "Punctuator", - "value": ")", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 5, + "line": 1, }, "start": Object { - "column": 9, - "line": 8, + "column": 0, + "line": 1, }, }, "range": Array [ - 154, - 155, + 0, + 5, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 8, + "column": 7, + "line": 1, }, "start": Object { - "column": 11, - "line": 8, + "column": 6, + "line": 1, }, }, "range": Array [ - 156, - 160, + 6, + 7, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 8, + "column": 8, + "line": 1, }, "start": Object { - "column": 15, - "line": 8, + "column": 7, + "line": 1, }, }, "range": Array [ - 160, - 161, + 7, + 8, ], "type": "Punctuator", - "value": ";", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 9, + "column": 10, + "line": 1, }, "start": Object { - "column": 4, - "line": 9, + "column": 9, + "line": 1, }, }, "range": Array [ - 166, - 169, + 9, + 10, ], "type": "Identifier", - "value": "doo", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 9, + "column": 11, + "line": 1, }, "start": Object { - "column": 7, - "line": 9, + "column": 10, + "line": 1, }, }, "range": Array [ - 169, - 170, + 10, + 11, ], "type": "Punctuator", - "value": "?", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 9, + "column": 16, + "line": 1, }, "start": Object { - "column": 8, - "line": 9, + "column": 11, + "line": 1, }, }, "range": Array [ - 170, - 171, + 11, + 16, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "never", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 9, + "column": 17, + "line": 1, }, "start": Object { - "column": 9, - "line": 9, + "column": 16, + "line": 1, }, }, "range": Array [ - 171, - 172, + 16, + 17, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 9, + "column": 18, + "line": 1, }, "start": Object { - "column": 10, - "line": 9, + "column": 17, + "line": 1, }, }, "range": Array [ - 172, - 173, + 17, + 18, ], "type": "Punctuator", - "value": ",", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 9, + "column": 10, + "line": 2, }, "start": Object { - "column": 12, - "line": 9, + "column": 0, + "line": 2, }, }, "range": Array [ - 174, - 175, + 19, + 29, ], "type": "Identifier", - "value": "b", + "value": "Observable", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 9, + "column": 11, + "line": 2, }, "start": Object { - "column": 13, - "line": 9, + "column": 10, + "line": 2, }, }, "range": Array [ - 175, - 176, + 29, + 30, ], "type": "Punctuator", - "value": ",", + "value": ".", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 9, + "line": 2, }, "start": Object { - "column": 15, - "line": 9, + "column": 11, + "line": 2, }, }, "range": Array [ - 177, - 178, + 30, + 35, ], "type": "Identifier", - "value": "c", + "value": "empty", }, Object { "loc": Object { "end": Object { "column": 17, - "line": 9, + "line": 2, }, "start": Object { "column": 16, - "line": 9, + "line": 2, }, }, "range": Array [ - 178, - 179, + 35, + 36, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 9, + "column": 22, + "line": 2, }, "start": Object { "column": 17, - "line": 9, + "line": 2, }, }, "range": Array [ - 179, - 180, + 36, + 41, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "never", }, Object { "loc": Object { "end": Object { "column": 23, - "line": 9, + "line": 2, }, "start": Object { - "column": 19, - "line": 9, + "column": 22, + "line": 2, }, }, "range": Array [ - 181, - 185, + 41, + 42, ], - "type": "Keyword", - "value": "void", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { "column": 24, - "line": 9, + "line": 2, }, "start": Object { "column": 23, - "line": 9, + "line": 2, }, }, "range": Array [ - 185, - 186, + 42, + 43, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 10, + "column": 25, + "line": 2, }, "start": Object { - "column": 4, - "line": 10, + "column": 24, + "line": 2, }, }, "range": Array [ - 191, - 192, + 43, + 44, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 10, + "column": 26, + "line": 2, }, "start": Object { - "column": 5, - "line": 10, + "column": 25, + "line": 2, }, }, "range": Array [ - 192, - 195, + 44, + 45, ], - "type": "Identifier", - "value": "loo", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 10, - }, - "start": Object { - "column": 8, - "line": 10, + "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", }, - "range": Array [ - 195, - 196, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 10, - }, - "start": Object { - "column": 9, - "line": 10, + "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", }, - "range": Array [ - 196, - 197, - ], - "type": "Punctuator", - "value": "?", - }, - Object { "loc": Object { "end": Object { - "column": 11, - "line": 10, + "column": 1, + "line": 4, }, "start": Object { - "column": 10, - "line": 10, + "column": 0, + "line": 1, }, }, - "range": Array [ - 197, - 198, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 10, - }, - "start": Object { - "column": 11, - "line": 10, + "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 [ - 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, + 0, + 82, ], - "type": "Punctuator", - "value": ",", + "type": "FunctionDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 10, - }, - "start": Object { - "column": 14, - "line": 10, - }, - }, - "range": Array [ - 201, - 202, - ], - "type": "Identifier", - "value": "b", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 16, - "line": 10, + "column": 8, + "line": 1, }, "start": Object { - "column": 15, - "line": 10, + "column": 0, + "line": 1, }, }, "range": Array [ - 202, - 203, + 0, + 8, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 10, + "column": 22, + "line": 1, }, "start": Object { - "column": 17, - "line": 10, + "column": 9, + "line": 1, }, }, "range": Array [ - 204, - 205, + 9, + 22, ], "type": "Identifier", - "value": "c", + "value": "processEntity", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 10, + "column": 23, + "line": 1, }, "start": Object { - "column": 18, - "line": 10, + "column": 22, + "line": 1, }, }, "range": Array [ - 205, - 206, + 22, + 23, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 10, + "column": 24, + "line": 1, }, "start": Object { - "column": 19, - "line": 10, + "column": 23, + "line": 1, }, }, "range": Array [ - 206, - 207, + 23, + 24, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "e", }, Object { "loc": Object { "end": Object { "column": 25, - "line": 10, + "line": 1, }, "start": Object { - "column": 21, - "line": 10, + "column": 24, + "line": 1, }, }, "range": Array [ - 208, - 212, + 24, + 25, ], - "type": "Keyword", - "value": "void", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { "column": 26, - "line": 10, + "line": 1, }, "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, + "line": 1, }, }, "range": Array [ - 221, - 222, + 25, + 26, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 11, + "column": 33, + "line": 1, }, "start": Object { - "column": 8, - "line": 11, + "column": 27, + "line": 1, }, }, "range": Array [ - 222, - 223, + 27, + 33, ], "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": ">", + "value": "Entity", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 11, + "column": 34, + "line": 1, }, "start": Object { - "column": 10, - "line": 11, + "column": 33, + "line": 1, }, }, "range": Array [ - 224, - 225, + 33, + 34, ], "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", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 11, + "column": 36, + "line": 1, }, "start": Object { - "column": 12, - "line": 11, + "column": 35, + "line": 1, }, }, "range": Array [ - 226, - 227, + 35, + 36, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 11, + "column": 18, + "line": 2, }, "start": Object { - "column": 14, - "line": 11, + "column": 4, + "line": 2, }, }, "range": Array [ - 228, - 229, + 41, + 55, ], "type": "Identifier", - "value": "b", + "value": "validateEntity", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 11, + "column": 19, + "line": 2, }, "start": Object { - "column": 15, - "line": 11, + "column": 18, + "line": 2, }, }, "range": Array [ - 229, - 230, + 55, + 56, ], "type": "Punctuator", - "value": ",", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 11, + "column": 20, + "line": 2, }, "start": Object { - "column": 17, - "line": 11, + "column": 19, + "line": 2, }, }, "range": Array [ - 231, - 232, + 56, + 57, ], "type": "Identifier", - "value": "c", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 11, + "column": 21, + "line": 2, }, "start": Object { - "column": 18, - "line": 11, + "column": 20, + "line": 2, }, }, "range": Array [ - 232, - 233, + 57, + 58, ], "type": "Punctuator", "value": ")", @@ -50146,694 +57448,1118 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, - "line": 11, + "column": 22, + "line": 2, }, "start": Object { - "column": 19, - "line": 11, + "column": 21, + "line": 2, }, }, "range": Array [ - 233, - 234, + 58, + 59, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 11, + "column": 7, + "line": 3, }, "start": Object { - "column": 21, - "line": 11, + "column": 4, + "line": 3, }, }, "range": Array [ - 235, - 239, + 64, + 67, ], "type": "Keyword", - "value": "void", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 11, + "column": 9, + "line": 3, }, "start": Object { - "column": 25, - "line": 11, + "column": 8, + "line": 3, }, }, "range": Array [ - 239, - 240, + 68, + 69, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "s", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 12, + "column": 11, + "line": 3, }, "start": Object { - "column": 4, - "line": 12, + "column": 10, + "line": 3, }, }, "range": Array [ - 245, - 248, + 70, + 71, ], - "type": "Keyword", - "value": "new", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 12, + "column": 13, + "line": 3, }, "start": Object { - "column": 8, - "line": 12, + "column": 12, + "line": 3, }, }, "range": Array [ - 249, - 250, + 72, + 73, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 12, + "column": 14, + "line": 3, }, "start": Object { - "column": 9, - "line": 12, + "column": 13, + "line": 3, }, }, "range": Array [ - 250, - 251, + 73, + 74, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 12, + "column": 15, + "line": 3, }, "start": Object { - "column": 10, - "line": 12, + "column": 14, + "line": 3, }, }, "range": Array [ - 251, - 252, + 74, + 75, ], "type": "Punctuator", - "value": ",", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 12, + "column": 19, + "line": 3, }, "start": Object { - "column": 12, - "line": 12, + "column": 15, + "line": 3, }, }, "range": Array [ - 253, - 254, + 75, + 79, ], "type": "Identifier", - "value": "b", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 12, + "column": 20, + "line": 3, }, "start": Object { - "column": 13, - "line": 12, + "column": 19, + "line": 3, }, }, "range": Array [ - 254, - 255, + 79, + 80, ], "type": "Punctuator", - "value": "?", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 12, + "column": 1, + "line": 4, }, "start": Object { - "column": 14, - "line": 12, + "column": 0, + "line": 4, }, }, "range": Array [ - 255, - 256, + 81, + 82, ], "type": "Punctuator", - "value": ")", + "value": "}", }, + ], + "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": 16, - "line": 12, + "column": 12, + "line": 1, }, "start": Object { - "column": 15, - "line": 12, + "column": 0, + "line": 1, }, }, "range": Array [ - 256, - 257, + 0, + 12, ], - "type": "Punctuator", - "value": ":", + "type": "VariableDeclaration", }, Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "y", + "range": Array [ + 17, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "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": 23, - "line": 12, + "column": 17, + "line": 2, }, "start": Object { - "column": 17, - "line": 12, + "column": 0, + "line": 2, }, }, "range": Array [ - 258, - 264, + 13, + 30, ], - "type": "Identifier", - "value": "string", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, - "line": 12, + "column": 3, + "line": 1, }, "start": Object { - "column": 23, - "line": 12, + "column": 0, + "line": 1, }, }, "range": Array [ - 264, - 265, + 0, + 3, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 13, + "column": 5, + "line": 1, }, "start": Object { "column": 4, - "line": 13, + "line": 1, }, }, "range": Array [ - 270, - 273, + 4, + 5, ], - "type": "Keyword", - "value": "new", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 13, + "column": 6, + "line": 1, }, "start": Object { - "column": 8, - "line": 13, + "column": 5, + "line": 1, }, }, "range": Array [ - 274, - 275, + 5, + 6, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 13, + "column": 11, + "line": 1, }, "start": Object { - "column": 9, - "line": 13, + "column": 7, + "line": 1, }, }, "range": Array [ - 275, - 276, + 7, + 11, ], - "type": "Identifier", - "value": "F", + "type": "Keyword", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 13, + "column": 12, + "line": 1, }, "start": Object { - "column": 10, - "line": 13, + "column": 11, + "line": 1, }, }, "range": Array [ - 276, - 277, + 11, + 12, ], "type": "Punctuator", - "value": ">", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 13, + "column": 3, + "line": 2, }, "start": Object { - "column": 11, - "line": 13, + "column": 0, + "line": 2, }, }, "range": Array [ - 277, - 278, + 13, + 16, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 13, + "column": 5, + "line": 2, }, "start": Object { - "column": 12, - "line": 13, + "column": 4, + "line": 2, }, }, "range": Array [ - 278, - 279, + 17, + 18, ], "type": "Identifier", - "value": "a", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 13, + "column": 6, + "line": 2, }, "start": Object { - "column": 13, - "line": 13, + "column": 5, + "line": 2, }, }, "range": Array [ - 279, - 280, + 18, + 19, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 13, + "line": 2, }, "start": Object { - "column": 15, - "line": 13, + "column": 7, + "line": 2, }, }, "range": Array [ - 281, - 282, + 20, + 29, ], "type": "Identifier", - "value": "b", + "value": "undefined", }, Object { "loc": Object { "end": Object { "column": 17, - "line": 13, + "line": 2, }, "start": Object { "column": 16, - "line": 13, + "line": 2, + }, + }, + "range": Array [ + 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", }, - "range": Array [ - 282, - 283, - ], - "type": "Punctuator", - "value": "?", - }, - Object { "loc": Object { "end": Object { - "column": 18, - "line": 13, + "column": 17, + "line": 1, }, "start": Object { - "column": 17, - "line": 13, + "column": 0, + "line": 1, }, }, "range": Array [ - 283, - 284, + 0, + 17, ], - "type": "Punctuator", - "value": ")", + "type": "ExpressionStatement", }, Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 13, - }, - "start": Object { - "column": 18, - "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 [ - 284, - 285, - ], - "type": "Punctuator", - "value": ":", - }, - Object { "loc": Object { "end": Object { - "column": 26, - "line": 13, + "column": 16, + "line": 3, }, "start": Object { - "column": 20, - "line": 13, + "column": 0, + "line": 3, }, }, "range": Array [ - 286, - 292, + 19, + 35, ], - "type": "Identifier", - "value": "string", + "type": "ExpressionStatement", }, Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 13, - }, - "start": Object { - "column": 26, - "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 [ - 292, - 293, - ], - "type": "Punctuator", - "value": ";", - }, - Object { "loc": Object { "end": Object { - "column": 1, - "line": 14, + "column": 19, + "line": 5, }, "start": Object { "column": 0, - "line": 14, + "line": 5, }, }, "range": Array [ - 294, - 295, + 37, + 56, ], - "type": "Punctuator", - "value": "}", + "type": "ExpressionStatement", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-with-construct-signature-with-parameter-accessibility.src 1`] = ` -Object { - "body": Array [ Object { "body": Object { "body": Array [ Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 68, + 72, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, "loc": Object { "end": Object { - "column": 30, - "line": 2, + "column": 21, + "line": 7, }, "start": Object { - "column": 4, - "line": 2, + "column": 10, + "line": 7, }, }, - "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, - }, + "range": Array [ + 68, + 79, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "name": "y", - "range": Array [ - 44, - 45, - ], - "type": "Identifier", + "start": Object { + "column": 17, + "line": 7, }, - "range": Array [ - 36, - 45, - ], - "type": "TSParameterProperty", }, - ], - "range": Array [ - 21, - 47, - ], - "type": "TSConstructSignatureDeclaration", + "range": Array [ + 75, + 79, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, }, ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 23, + "line": 7, }, "start": Object { - "column": 15, - "line": 1, + "column": 8, + "line": 7, }, }, "range": Array [ - 15, - 49, + 66, + 81, ], - "type": "TSInterfaceBody", + "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 7, + "line": 7, }, "start": Object { - "column": 10, - "line": 1, + "column": 6, + "line": 7, }, }, - "name": "Test", + "name": "X", "range": Array [ - 10, - 14, + 64, + 65, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 23, + "line": 7, }, "start": Object { "column": 0, - "line": 1, + "line": 7, }, }, "range": Array [ - 0, - 49, + 58, + 81, ], - "type": "TSInterfaceDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 8, }, "start": Object { "column": 0, "line": 1, }, - }, - "range": Array [ - 0, - 50, - ], - "sourceType": "script", - "tokens": Array [ + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { - "column": 0, + "column": 9, "line": 1, }, }, "range": Array [ - 0, 9, + 13, ], "type": "Keyword", - "value": "interface", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 10, + "column": 14, "line": 1, }, }, "range": Array [ - 10, 14, + 15, ], - "type": "Identifier", - "value": "Test", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { @@ -50851,40 +58577,94 @@ Object { 16, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, }, }, "range": Array [ + 20, 21, - 24, ], - "type": "Keyword", - "value": "new", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 7, + "line": 3, }, "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { "column": 8, - "line": 2, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, }, }, "range": Array [ - 25, 26, + 27, ], "type": "Punctuator", "value": "(", @@ -50892,48 +58672,102 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 9, + "line": 3, }, "start": Object { - "column": 9, - "line": 2, + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, }, }, "range": Array [ - 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 [ @@ -50941,53 +58775,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 [ @@ -50995,17 +58865,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 [ @@ -51013,317 +58883,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", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 34, - ], - "sourceType": "script", - "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": "}", @@ -51333,418 +59088,893 @@ 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, + ], + "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", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 6, + "line": 11, + }, + }, + "name": "a", + "range": Array [ + 146, + 147, ], "type": "Identifier", }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 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", + }, }, ], "range": Array [ - 28, - 31, + 12, + 174, ], - "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, + "type": "ObjectExpression", }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", + "start": Object { + "column": 6, + "line": 1, }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 13, - 16, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 37, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 9, - ], - "type": "Keyword", - "value": "interface", - }, - Object { - "loc": Object { - "end": Object { - "column": 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 [ + 6, + 174, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 14, - 15, ], - "type": "Identifier", - "value": "T", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 2, + "line": 13, }, "start": Object { - "column": 15, + "column": 0, "line": 1, }, }, "range": Array [ - 15, - 16, + 0, + 175, ], - "type": "Punctuator", - "value": ">", + "type": "VariableDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 24, - ], - "type": "Keyword", - "value": "extends", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 14, }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - "value": "Bar", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 176, + ], + "sourceType": "script", + "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": "{", @@ -51752,1295 +59982,719 @@ 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", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "String", + "value": "\\"constructor\\"", }, - }, - "range": Array [ - 0, - 22, - ], - "sourceType": "script", - "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": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - "value": "T", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 16, - 17, + 32, + 33, ], "type": "Punctuator", - "value": ">", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 18, - 19, + 33, + 34, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 21, "line": 2, }, "start": Object { - "column": 0, + "column": 20, "line": 2, }, }, "range": Array [ - 20, - 21, + 34, + 35, ], "type": "Punctuator", - "value": "}", + "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, + "column": 28, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 0, - 87, + 36, + 42, ], - "type": "TSInterfaceDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 8, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "number", }, - }, - "range": Array [ - 0, - 88, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 30, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 29, + "line": 2, }, }, "range": Array [ - 0, - 9, + 43, + 44, ], - "type": "Keyword", - "value": "interface", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 10, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 10, - 14, + 49, + 55, ], - "type": "Identifier", - "value": "Test", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 12, + "line": 3, }, "start": Object { - "column": 15, - "line": 1, + "column": 11, + "line": 3, }, }, "range": Array [ - 15, - 16, + 56, + 57, ], - "type": "Punctuator", - "value": "{", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 6, + "column": 3, + "line": 4, }, "start": Object { - "column": 4, - "line": 6, + "column": 2, + "line": 4, }, }, "range": Array [ - 76, - 79, + 60, + 61, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 6, + "column": 4, + "line": 4, }, "start": Object { - "column": 7, - "line": 6, + "column": 3, + "line": 4, }, }, "range": Array [ - 79, - 80, + 61, + 62, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 6, + "column": 5, + "line": 5, }, "start": Object { - "column": 8, - "line": 6, + "column": 2, + "line": 5, }, }, "range": Array [ - 80, - 83, + 65, + 68, ], "type": "Identifier", - "value": "bar", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 6, + "line": 5, }, "start": Object { - "column": 11, - "line": 6, + "column": 5, + "line": 5, }, }, "range": Array [ - 83, - 84, + 68, + 69, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 7, + "line": 5, }, "start": Object { - "column": 12, - "line": 6, + "column": 6, + "line": 5, }, }, "range": Array [ - 84, - 85, + 69, + 70, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 8, + "line": 5, }, "start": Object { - "column": 0, - "line": 7, + "column": 7, + "line": 5, }, }, "range": Array [ - 86, - 87, + 70, + 71, ], "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": 9, + "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": 8, + "line": 5, }, - "name": "test", - "range": Array [ - 10, - 14, - ], - "type": "Identifier", }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "(", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 10, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 9, + "line": 5, }, }, "range": Array [ - 0, - 61, + 72, + 73, ], - "type": "TSInterfaceDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 62, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 11, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 10, + "line": 5, }, }, "range": Array [ - 0, - 9, + 73, + 74, ], - "type": "Keyword", - "value": "interface", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 18, + "line": 5, }, "start": Object { - "column": 10, - "line": 1, + "column": 12, + "line": 5, }, }, "range": Array [ - 10, - 14, + 75, + 81, ], "type": "Identifier", - "value": "test", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 20, + "line": 5, }, "start": Object { - "column": 15, - "line": 1, + "column": 19, + "line": 5, }, }, "range": Array [ - 15, - 16, + 82, + 83, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 88, + 94, + ], + "type": "Keyword", + "value": "return", + }, + 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": 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": "(", @@ -53048,35 +60702,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": ":", @@ -53084,84 +60792,199 @@ 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 [ + 160, + 166, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 11, + }, + "start": Object { + "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", }, - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - "value": "T", - }, - Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 15, + "line": 2, }, "start": Object { - "column": 13, - "line": 3, + "column": 0, + "line": 2, }, }, "range": Array [ - 54, - 55, + 45, + 60, ], - "type": "Punctuator", - "value": ")", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, }, + }, + "range": Array [ + 45, + 60, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 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 [ @@ -53169,330 +60992,220 @@ 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", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 6, + "column": 42, + "line": 1, }, "start": Object { "column": 0, @@ -53501,14 +61214,14 @@ Object { }, "range": Array [ 0, - 82, + 42, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 8, "line": 1, }, "start": Object { @@ -53518,25 +61231,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", @@ -53544,143 +61257,143 @@ 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": 8, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ - 25, - 26, + 19, + 22, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "Map", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 22, + "line": 1, }, }, "range": Array [ - 31, - 34, + 22, + 23, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 29, + "line": 1, }, "start": Object { - "column": 7, - "line": 3, + "column": 23, + "line": 1, }, }, "range": Array [ - 34, - 35, + 23, + 29, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "symbol", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 30, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 29, + "line": 1, }, }, "range": Array [ - 35, - 36, + 29, + 30, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 37, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 31, + "line": 1, }, }, "range": Array [ + 31, 37, - 43, ], "type": "Identifier", "value": "string", @@ -53688,394 +61401,811 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 38, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 37, + "line": 1, }, }, "range": Array [ - 43, - 44, + 37, + 38, ], "type": "Punctuator", - "value": ";", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 39, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 49, - 52, + 38, + 39, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 4, + "column": 41, + "line": 1, }, "start": Object { - "column": 7, - "line": 4, + "column": 40, + "line": 1, }, }, "range": Array [ - 52, - 53, + 40, + 41, ], "type": "Punctuator", - "value": "?", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 42, + "line": 1, }, "start": Object { - "column": 8, - "line": 4, + "column": 41, + "line": 1, }, }, "range": Array [ - 53, - 54, + 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": 12, - "line": 4, + "column": 37, + "line": 1, }, "start": Object { - "column": 9, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 54, - 57, + 0, + 37, ], - "type": "Identifier", - "value": "foo", + "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", + }, }, + ], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 4, + "line": 1, }, "start": Object { - "column": 12, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 57, - 58, + 0, + 4, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 11, + "line": 1, }, "start": Object { - "column": 14, - "line": 4, + "column": 5, + "line": 1, }, }, "range": Array [ - 59, - 62, + 5, + 11, ], "type": "Identifier", - "value": "bar", + "value": "Result", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 12, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 11, + "line": 1, }, }, "range": Array [ - 62, - 63, + 11, + 12, ], "type": "Punctuator", - "value": "?", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 13, + "line": 1, }, "start": Object { - "column": 18, - "line": 4, + "column": 12, + "line": 1, }, }, "range": Array [ - 63, - 64, + 12, + 13, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 14, + "line": 1, }, "start": Object { - "column": 20, - "line": 4, + "column": 13, + "line": 1, }, }, "range": Array [ - 65, - 71, + 13, + 14, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 4, + "column": 16, + "line": 1, }, "start": Object { - "column": 26, - "line": 4, + "column": 15, + "line": 1, }, }, "range": Array [ - 71, - 72, + 15, + 16, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 24, + "line": 1, }, "start": Object { - "column": 28, - "line": 4, + "column": 17, + "line": 1, }, }, "range": Array [ - 73, - 76, + 17, + 24, ], "type": "Identifier", - "value": "baz", + "value": "Success", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 25, + "line": 1, }, "start": Object { - "column": 31, - "line": 4, + "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 [ - 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", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { "column": 0, @@ -54084,14 +62214,14 @@ Object { }, "range": Array [ 0, - 28, + 48, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 4, "line": 1, }, "start": Object { @@ -54101,354 +62231,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, }, }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ">", }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 20, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 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 { @@ -54458,13 +62590,13 @@ Object { }, "range": Array [ 15, - 44, + 23, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 44, + "column": 23, "line": 1, }, "start": Object { @@ -54474,214 +62606,61 @@ 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", }, ], "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -54690,14 +62669,14 @@ Object { }, "range": Array [ 0, - 44, + 31, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -54707,233 +62686,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", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Punctuator", - "value": ":", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 8, "line": 1, }, "start": Object { - "column": 17, + "column": 5, "line": 1, }, }, "range": Array [ - 17, - 22, + 5, + 8, ], "type": "Identifier", - "value": "Array", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 10, "line": 1, }, "start": Object { - "column": 22, + "column": 9, "line": 1, }, }, "range": Array [ - 22, - 23, + 9, + 10, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 12, "line": 1, }, "start": Object { - "column": 23, + "column": 11, "line": 1, }, }, "range": Array [ - 23, - 28, + 11, + 12, ], - "type": "Identifier", - "value": "Array", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 15, "line": 1, }, "start": Object { - "column": 28, + "column": 12, "line": 1, }, }, "range": Array [ - 28, - 29, + 12, + 15, ], - "type": "Punctuator", - "value": "<", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 16, "line": 1, }, "start": Object { - "column": 29, + "column": 15, "line": 1, }, }, "range": Array [ - 29, - 34, + 15, + 16, ], - "type": "Identifier", - "value": "Array", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 23, "line": 1, }, "start": Object { - "column": 34, + "column": 17, "line": 1, }, }, "range": Array [ - 34, - 35, + 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 { @@ -54942,7 +62885,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 17, + "column": 9, "line": 1, }, "start": Object { @@ -54950,105 +62893,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 { @@ -55058,7 +62965,7 @@ Object { }, "range": Array [ 6, - 17, + 27, ], "type": "VariableDeclarator", }, @@ -55066,7 +62973,7 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 18, + "column": 28, "line": 1, }, "start": Object { @@ -55076,140 +62983,15 @@ 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", - }, ], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 2, }, "start": Object { "column": 0, @@ -55218,7 +63000,7 @@ Object { }, "range": Array [ 0, - 46, + 29, ], "sourceType": "script", "tokens": Array [ @@ -55243,7 +63025,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -55253,46 +63035,10 @@ 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": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ 9, - 10, ], "type": "Identifier", - "value": "X", + "value": "foo", }, Object { "loc": Object { @@ -55310,220 +63056,94 @@ Object { 11, ], "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 16, - ], - "type": "Identifier", - "value": "never", + "value": "=", }, 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": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 17, + "column": 13, "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, + 13, + 16, ], "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": ">", + "value": "any", }, Object { "loc": Object { - "end": Object { - "column": 24, - "line": 2, + "end": Object { + "column": 17, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 42, - 43, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { - "column": 24, - "line": 2, + "column": 26, + "line": 1, }, }, "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": ";", @@ -55533,371 +63153,317 @@ 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, + 44, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "Identifier", + "value": "asserted2", + }, + 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": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, }, - ], + "start": Object { + "column": 17, + "line": 1, + }, + }, "range": Array [ - 0, - 82, + 17, + 20, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "any", }, - }, - "range": Array [ - 0, - 82, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, - 8, + 20, + 21, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { @@ -55906,16 +63472,16 @@ Object { "line": 1, }, "start": Object { - "column": 9, + "column": 21, "line": 1, }, }, "range": Array [ - 9, + 21, 22, ], - "type": "Identifier", - "value": "processEntity", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -55951,7 +63517,7 @@ Object { 24, ], "type": "Identifier", - "value": "e", + "value": "n", }, Object { "loc": Object { @@ -55969,148 +63535,130 @@ Object { 25, ], "type": "Punctuator", - "value": "?", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 28, "line": 1, }, "start": Object { - "column": 25, + "column": 26, "line": 1, }, }, "range": Array [ - 25, 26, + 28, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 30, "line": 1, }, "start": Object { - "column": 27, + "column": 29, "line": 1, }, }, "range": Array [ - 27, - 33, + 29, + 30, ], - "type": "Identifier", - "value": "Entity", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 37, "line": 1, }, "start": Object { - "column": 33, + "column": 31, "line": 1, }, }, "range": Array [ - 33, - 34, + 31, + 37, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 39, "line": 1, }, "start": Object { - "column": 35, + "column": 38, "line": 1, }, }, "range": Array [ - 35, - 36, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 41, - 55, + 38, + 39, ], "type": "Identifier", - "value": "validateEntity", + "value": "n", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 40, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 39, + "line": 1, }, }, "range": Array [ - 55, - 56, + 39, + 40, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 42, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 41, + "line": 1, }, }, "range": Array [ - 56, - 57, + 41, + 42, ], - "type": "Identifier", - "value": "e", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 43, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 42, + "line": 1, }, }, "range": Array [ - 57, - 58, + 42, + 43, ], "type": "Punctuator", "value": ")", @@ -56118,999 +63666,1033 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 44, + "line": 1, }, "start": Object { - "column": 21, - "line": 2, + "column": 43, + "line": 1, }, }, "range": Array [ - 58, - 59, + 43, + 44, ], "type": "Punctuator", "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-guard-in-arrow-function.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, + "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", }, - }, - "range": Array [ - 64, - 67, ], - "type": "Keyword", - "value": "let", - }, - Object { + "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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 79, + ], + "sourceType": "script", + "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", - }, - ], - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ":", }, - }, - "range": Array [ - 0, - 30, - ], - "sourceType": "script", - "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, - "line": 2, - }, - }, - "range": Array [ - 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", + "column": 24, + "line": 2, + }, }, + "range": Array [ + 68, + 76, + ], + "type": "String", + "value": "'string'", + }, + Object { "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 { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 3, - "line": 3, + "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", }, - }, - "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, + "column": 19, + "line": 2, }, "start": Object { - "column": 10, - "line": 3, + "column": 11, + "line": 2, }, }, + "operator": "typeof", + "prefix": true, "range": Array [ - 29, - 31, + 52, + 60, ], - "type": "BlockStatement", + "type": "UnaryExpression", }, - "expression": false, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 32, + "line": 2, }, "start": Object { - "column": 7, - "line": 3, + "column": 11, + "line": 2, }, }, - "params": Array [], + "operator": "===", "range": Array [ - 26, - 31, + 52, + 73, ], - "type": "FunctionExpression", + "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 [ - 20, - 33, + 39, + 75, ], - "type": "ObjectExpression", + "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 [ + 9, + 17, + ], + "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", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 8, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -57119,14 +64701,14 @@ Object { }, "range": Array [ 0, - 82, + 75, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 8, "line": 1, }, "start": Object { @@ -57136,619 +64718,838 @@ Object { }, "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, + 8, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 17, "line": 1, }, "start": Object { - "column": 3, + "column": 9, "line": 1, }, }, "range": Array [ - 3, - 7, + 9, + 17, ], - "type": "String", - "value": "'__'", + "type": "Identifier", + "value": "isString", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 18, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, "range": Array [ - 7, - 8, + 17, + 18, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 19, "line": 1, }, "start": Object { - "column": 9, + "column": 18, "line": 1, }, }, "range": Array [ - 9, - 13, + 18, + 19, ], - "type": "Keyword", - "value": "null", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 20, "line": 1, }, "start": Object { - "column": 14, + "column": 19, "line": 1, }, }, "range": Array [ - 14, - 15, + 19, + 20, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 1, }, "start": Object { - "column": 15, + "column": 21, "line": 1, }, }, "range": Array [ - 15, - 16, + 21, + 24, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "any", }, 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": 1, - "line": 3, + "column": 26, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 25, + "line": 1, }, }, "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", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "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": "}", @@ -57758,796 +65559,518 @@ 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, - }, - }, - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 13, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "properties": Array [ - Object { - "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, - }, - "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": 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, - }, - }, - "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", - }, - }, - 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 { + "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", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 75, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 15, + "line": 3, }, "start": Object { - "column": 6, - "line": 5, + "column": 11, + "line": 3, }, }, - "name": "T", "range": Array [ - 69, - 70, + 51, + 55, ], - "type": "Identifier", + "type": "ThisExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, }, + "operator": "instanceof", "range": Array [ - 69, + 51, 70, ], - "type": "TSTypeParameter", - }, - ], - "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, - }, + "right": Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 30, + "line": 3, }, "start": Object { - "column": 4, - "line": 6, + "column": 27, + "line": 3, }, }, + "name": "Foo", "range": Array [ - 88, - 96, + 67, + 70, ], - "type": "ReturnStatement", + "type": "Identifier", }, - ], + "type": "BinaryExpression", + }, "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, + }, }, - ], - "kind": "const", + "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": 2, - "line": 13, + "column": 1, + "line": 8, }, "start": Object { "column": 0, @@ -58556,15 +66079,16 @@ Object { }, "range": Array [ 0, - 175, + 147, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 14, + "line": 9, }, "start": Object { "column": 0, @@ -58573,7 +66097,7 @@ Object { }, "range": Array [ 0, - 176, + 148, ], "sourceType": "script", "tokens": Array [ @@ -58593,7 +66117,7 @@ Object { 5, ], "type": "Keyword", - "value": "const", + "value": "class", }, Object { "loc": Object { @@ -58611,7 +66135,7 @@ Object { 9, ], "type": "Identifier", - "value": "foo", + "value": "Foo", }, Object { "loc": Object { @@ -58629,30 +66153,12 @@ Object { 11, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 2, }, "start": Object { @@ -58661,152 +66167,134 @@ Object { }, }, "range": Array [ - 16, - 29, + 14, + 19, ], - "type": "String", - "value": "\\"constructor\\"", + "type": "Identifier", + "value": "isBar", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 8, "line": 2, }, "start": Object { - "column": 15, + "column": 7, "line": 2, }, }, "range": Array [ - 29, - 30, + 19, + 20, ], "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Identifier", - "value": "T", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 9, "line": 2, }, "start": Object { - "column": 17, + "column": 8, "line": 2, }, }, "range": Array [ - 31, - 32, + 20, + 21, ], "type": "Punctuator", - "value": ">", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 10, "line": 2, }, "start": Object { - "column": 18, + "column": 9, "line": 2, }, }, "range": Array [ - 32, - 33, + 21, + 22, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 15, "line": 2, }, "start": Object { - "column": 19, + "column": 11, "line": 2, }, }, "range": Array [ - 33, - 34, + 23, + 27, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 18, "line": 2, }, "start": Object { - "column": 20, + "column": 16, "line": 2, }, }, "range": Array [ - 34, - 35, + 28, + 30, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "is", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 25, "line": 2, }, "start": Object { - "column": 22, + "column": 19, "line": 2, }, }, "range": Array [ - 36, - 42, + 31, + 37, ], "type": "Identifier", - "value": "number", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 27, "line": 2, }, "start": Object { - "column": 29, + "column": 26, "line": 2, }, }, "range": Array [ - 43, - 44, + 38, + 39, ], "type": "Punctuator", "value": "{", @@ -58823,8 +66311,8 @@ Object { }, }, "range": Array [ - 49, - 55, + 44, + 50, ], "type": "Keyword", "value": "return", @@ -58832,7 +66320,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 15, "line": 3, }, "start": Object { @@ -58841,83 +66329,83 @@ Object { }, }, "range": Array [ - 56, - 57, + 51, + 55, ], - "type": "Numeric", - "value": "1", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 26, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 16, + "line": 3, }, }, "range": Array [ - 60, - 61, + 56, + 66, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "instanceof", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 4, + "column": 30, + "line": 3, }, "start": Object { - "column": 3, - "line": 4, + "column": 27, + "line": 3, }, }, "range": Array [ - 61, - 62, + 67, + 70, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 31, + "line": 3, }, "start": Object { - "column": 2, - "line": 5, + "column": 30, + "line": 3, }, }, "range": Array [ - 65, - 68, + 70, + 71, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 5, + "column": 3, + "line": 4, }, "start": Object { - "column": 5, - "line": 5, + "column": 2, + "line": 4, }, }, "range": Array [ - 68, - 69, + 74, + 75, ], "type": "Punctuator", - "value": "<", + "value": "}", }, Object { "loc": Object { @@ -58926,49 +66414,49 @@ Object { "line": 5, }, "start": Object { - "column": 6, + "column": 2, "line": 5, }, }, "range": Array [ - 69, - 70, + 78, + 83, ], "type": "Identifier", - "value": "T", + "value": "isBaz", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 5, }, "start": Object { - "column": 7, + "column": 8, "line": 5, }, }, "range": Array [ - 70, - 71, + 84, + 85, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 5, }, "start": Object { - "column": 8, + "column": 10, "line": 5, }, }, "range": Array [ - 71, - 72, + 86, + 87, ], "type": "Punctuator", "value": "(", @@ -58976,17 +66464,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 5, }, "start": Object { - "column": 9, + "column": 11, "line": 5, }, }, "range": Array [ - 72, - 73, + 87, + 88, ], "type": "Punctuator", "value": ")", @@ -58994,17 +66482,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 5, }, "start": Object { - "column": 10, + "column": 12, "line": 5, }, }, "range": Array [ - 73, - 74, + 88, + 89, ], "type": "Punctuator", "value": ":", @@ -59016,892 +66504,906 @@ Object { "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, - }, - "start": Object { - "column": 19, - "line": 5, - }, - }, - "range": Array [ - 82, - 83, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "range": Array [ - 88, - 94, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 11, - "line": 6, + "column": 14, + "line": 5, }, }, "range": Array [ - 95, - 96, + 90, + 94, ], - "type": "Numeric", - "value": "1", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 7, + "column": 21, + "line": 5, }, "start": Object { - "column": 2, - "line": 7, + "column": 19, + "line": 5, }, }, "range": Array [ - 99, - 100, + 95, + 97, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "is", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 7, + "column": 28, + "line": 5, }, "start": Object { - "column": 3, - "line": 7, + "column": 22, + "line": 5, }, }, "range": Array [ - 100, - 101, + 98, + 104, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 8, + "column": 31, + "line": 5, }, "start": Object { - "column": 2, - "line": 8, + "column": 29, + "line": 5, }, }, "range": Array [ - 104, + 105, 107, ], - "type": "Identifier", - "value": "get", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 33, + "line": 5, }, "start": Object { - "column": 6, - "line": 8, + "column": 32, + "line": 5, }, }, "range": Array [ 108, 109, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 8, + "column": 10, + "line": 6, }, "start": Object { - "column": 7, - "line": 8, + "column": 4, + "line": 6, }, }, "range": Array [ - 109, - 110, + 114, + 120, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 8, + "column": 15, + "line": 6, }, "start": Object { - "column": 8, - "line": 8, + "column": 11, + "line": 6, }, }, "range": Array [ - 110, - 111, + 121, + 125, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 26, + "line": 6, }, "start": Object { - "column": 9, - "line": 8, + "column": 16, + "line": 6, }, }, "range": Array [ - 111, - 112, + 126, + 136, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "instanceof", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 8, + "column": 30, + "line": 6, }, "start": Object { - "column": 11, - "line": 8, + "column": 27, + "line": 6, }, }, "range": Array [ - 113, - 119, + 137, + 140, ], "type": "Identifier", - "value": "number", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 8, + "column": 31, + "line": 6, }, "start": Object { - "column": 18, - "line": 8, + "column": 30, + "line": 6, }, }, "range": Array [ - 120, - 121, + 140, + 141, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 9, + "column": 3, + "line": 7, }, "start": Object { - "column": 4, - "line": 9, + "column": 2, + "line": 7, }, }, "range": Array [ - 126, - 132, + 144, + 145, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 9, + "column": 1, + "line": 8, }, "start": Object { - "column": 11, - "line": 9, + "column": 0, + "line": 8, }, }, "range": Array [ - 133, - 134, + 146, + 147, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "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": 3, - "line": 10, + "column": 43, + "line": 1, }, "start": Object { - "column": 2, - "line": 10, + "column": 0, + "line": 1, }, }, "range": Array [ - 137, - 138, + 0, + 43, ], - "type": "Punctuator", - "value": "}", + "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": 4, - "line": 10, + "column": 43, + "line": 2, }, "start": Object { - "column": 3, - "line": 10, + "column": 0, + "line": 2, }, }, + "params": Array [], "range": Array [ - 138, - 139, + 44, + 87, ], - "type": "Punctuator", - "value": ",", + "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": 5, - "line": 11, + "column": 49, + "line": 3, }, "start": Object { - "column": 2, - "line": 11, + "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", }, - "range": Array [ - 142, - 145, - ], - "type": "Identifier", - "value": "set", }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 11, - }, - "start": Object { - "column": 6, - "line": 11, - }, - }, - "range": Array [ - 146, - 147, - ], - "type": "Identifier", - "value": "a", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 11, - }, - "start": Object { - "column": 7, - "line": 11, - }, - }, - "range": Array [ - 147, - 148, - ], - "type": "Punctuator", - "value": "(", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 138, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 11, + "column": 3, + "line": 1, }, "start": Object { - "column": 8, - "line": 11, + "column": 0, + "line": 1, }, }, "range": Array [ - 148, - 149, + 0, + 3, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 11, + "column": 4, + "line": 1, }, "start": Object { - "column": 9, - "line": 11, + "column": 3, + "line": 1, }, }, "range": Array [ - 149, - 150, + 3, + 4, ], "type": "Punctuator", - "value": ":", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 11, + "column": 22, + "line": 1, }, "start": Object { - "column": 11, - "line": 11, + "column": 21, + "line": 1, }, }, "range": Array [ - 151, - 157, + 21, + 22, ], "type": "Identifier", - "value": "number", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 11, + "column": 40, + "line": 1, }, "start": Object { - "column": 17, - "line": 11, + "column": 39, + "line": 1, }, }, "range": Array [ - 157, - 158, + 39, + 40, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 11, + "column": 41, + "line": 1, }, "start": Object { - "column": 18, - "line": 11, + "column": 40, + "line": 1, }, }, "range": Array [ - 158, - 159, + 40, + 41, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 11, - }, - "start": Object { - "column": 20, - "line": 11, - }, - }, - "range": Array [ - 160, - 166, - ], - "type": "Identifier", - "value": "number", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 11, + "column": 42, + "line": 1, }, "start": Object { - "column": 27, - "line": 11, + "column": 41, + "line": 1, }, }, "range": Array [ - 167, - 168, + 41, + 42, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 12, + "column": 43, + "line": 1, }, "start": Object { - "column": 2, - "line": 12, + "column": 42, + "line": 1, }, }, "range": Array [ - 171, - 172, + 42, + 43, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 13, + "column": 8, + "line": 2, }, "start": Object { "column": 0, - "line": 13, + "line": 2, }, }, "range": Array [ - 173, - 174, + 44, + 52, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 13, + "column": 12, + "line": 2, }, "start": Object { - "column": 1, - "line": 13, + "column": 9, + "line": 2, }, }, "range": Array [ - 174, - 175, + 53, + 56, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "bar", }, - ], - "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, + "column": 13, "line": 2, }, "start": Object { - "column": 0, + "column": 12, "line": 2, }, }, "range": Array [ - 45, - 60, + 56, + 57, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, + "type": "Punctuator", + "value": "<", }, - }, - "range": Array [ - 45, - 60, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 25, "line": 2, }, "start": Object { - "column": 0, + "column": 24, "line": 2, }, }, "range": Array [ - 45, - 46, + 68, + 69, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 37, "line": 2, }, "start": Object { - "column": 1, + "column": 36, "line": 2, }, }, "range": Array [ - 46, - 58, + 80, + 81, ], - "type": "String", - "value": "\\"use strict\\"", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 38, "line": 2, }, "start": Object { - "column": 13, + "column": 37, "line": 2, }, }, "range": Array [ - 58, - 59, + 81, + 82, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 39, "line": 2, }, "start": Object { - "column": 14, + "column": 38, "line": 2, }, }, "range": Array [ - 59, - 60, + 82, + 83, ], "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, - }, - "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, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "abc", - "range": Array [ - 14, - 38, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 38, - ], - "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", - }, - }, - }, + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, }, - ], + "start": Object { + "column": 40, + "line": 2, + }, + }, "range": Array [ - 0, - 42, + 84, + 85, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 1, + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 42, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { "column": 8, - "line": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 8, + 88, + 96, ], "type": "Keyword", "value": "function", @@ -59909,473 +67411,1013 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 12, + "line": 3, }, "start": Object { "column": 9, - "line": 1, + "line": 3, }, }, "range": Array [ - 9, - 13, + 97, + 100, ], "type": "Identifier", - "value": "test", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 13, - "line": 1, + "column": 12, + "line": 3, }, }, "range": Array [ - 13, - 14, + 100, + 101, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 25, + "line": 3, }, "start": Object { - "column": 14, - "line": 1, + "column": 24, + "line": 3, }, }, "range": Array [ - 14, - 17, + 112, + 113, ], "type": "Identifier", - "value": "abc", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 37, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 36, + "line": 3, }, }, "range": Array [ - 17, - 18, + 124, + 125, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 41, + "line": 3, }, "start": Object { - "column": 19, - "line": 1, + "column": 38, + "line": 3, }, }, "range": Array [ - 19, - 22, + 126, + 129, ], "type": "Identifier", - "value": "Map", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 43, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 42, + "line": 3, }, }, "range": Array [ - 22, - 23, + 130, + 131, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 44, + "line": 3, }, "start": Object { - "column": 23, - "line": 1, + "column": 43, + "line": 3, }, }, "range": Array [ - 23, - 29, + 131, + 132, ], - "type": "Identifier", - "value": "symbol", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 45, + "line": 3, }, "start": Object { - "column": 29, - "line": 1, + "column": 44, + "line": 3, }, }, "range": Array [ - 29, - 30, + 132, + 133, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 47, + "line": 3, }, "start": Object { - "column": 31, - "line": 1, + "column": 46, + "line": 3, }, }, "range": Array [ - 31, - 37, + 134, + 135, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 49, + "line": 3, }, "start": Object { - "column": 37, - "line": 1, + "column": 48, + "line": 3, }, }, "range": Array [ - 37, - 38, + 136, + 137, ], "type": "Punctuator", - "value": ">", + "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": 39, + "column": 74, "line": 1, }, "start": Object { - "column": 38, + "column": 0, "line": 1, }, }, - "range": Array [ - 38, - 39, - ], - "type": "Punctuator", - "value": ")", + "range": Array [ + 0, + 74, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 43, + 46, + ], + "type": "Identifier", + }, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 47, + 71, + ], + "type": "TSTypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "range": Array [ + 22, + 23, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 10, + 34, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "range": Array [ + 162, + 164, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "foo2", + "range": Array [ + 81, + 85, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "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", + }, }, Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, + "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 [ - 40, - 41, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, + "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 [ - 41, - 42, ], - "type": "Punctuator", - "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, + "column": 13, + "line": 3, }, "start": Object { - "column": 5, - "line": 1, + "column": 10, + "line": 3, }, }, - "name": "Result", + "name": "bar", "range": Array [ - 5, - 11, + 175, + 178, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 79, + "line": 3, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 37, + 165, + 244, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { + "type": "TSInterfaceDeclaration", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 38, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 14, + "line": 3, }, }, - "range": Array [ - 17, - 37, - ], - "type": "TSUnionType", - "types": Array [ + "params": Array [ Object { "loc": Object { "end": Object { "column": 27, - "line": 1, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 26, + "line": 3, }, }, - "range": Array [ - 17, - 27, - ], - "type": "TSTypeReference", - "typeName": Object { + "name": Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 27, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 26, + "line": 3, }, }, - "name": "Success", + "name": "A", "range": Array [ - 17, - 24, + 191, + 192, ], "type": "Identifier", }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, + "range": Array [ + 191, + 192, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 179, + 203, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 93, + "line": 4, + }, + "start": Object { + "column": 91, + "line": 4, + }, + }, + "range": Array [ + 336, + 338, + ], + "type": "TSInterfaceBody", + }, + "extends": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 4, }, - "params": Array [ - Object { + "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": 26, - "line": 1, + "column": 79, + "line": 4, }, "start": Object { - "column": 25, - "line": 1, + "column": 78, + "line": 4, }, }, + "name": "A", "range": Array [ - 25, - 26, + 323, + 324, ], - "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", - }, + "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, + 311, + 335, ], - "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", - }, + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, }, + }, + "name": "bar2", + "range": Array [ + 255, + 259, ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 93, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, }, + "range": Array [ + 245, + 338, + ], + "type": "TSInterfaceDeclaration", "typeParameters": Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 53, + "line": 4, }, "start": Object { - "column": 11, - "line": 1, + "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": 13, - "line": 1, + "column": 42, + "line": 4, }, "start": Object { - "column": 12, - "line": 1, + "column": 27, + "line": 4, }, }, "name": Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 28, + "line": 4, }, "start": Object { - "column": 12, - "line": 1, + "column": 27, + "line": 4, }, }, - "name": "T", + "name": "A", "range": Array [ - 12, - 13, + 272, + 273, ], "type": "Identifier", }, "range": Array [ - 12, - 13, + 272, + 287, ], "type": "TSTypeParameter", }, ], "range": Array [ - 11, - 14, + 260, + 298, ], "type": "TSTypeParameterDeclaration", }, @@ -60383,8 +68425,8 @@ Object { ], "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -60393,14 +68435,14 @@ Object { }, "range": Array [ 0, - 37, + 339, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 5, "line": 1, }, "start": Object { @@ -60410,43 +68452,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": "<", @@ -60454,35 +68496,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": ">", @@ -60490,53 +68532,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": "<", @@ -60544,35 +68586,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": ">", @@ -60580,364 +68622,341 @@ 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": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 75, + 80, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 81, + 85, ], "type": "Identifier", - "value": "Failure", + "value": "foo2", }, - ], - "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, - }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, }, - "name": "Result", - "range": Array [ - 5, - 11, - ], - "type": "Identifier", }, + "range": Array [ + 112, + 113, + ], + "type": "Numeric", + "value": "2", + }, + Object { "loc": Object { "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { "column": 48, - "line": 1, + "line": 2, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 50, + "line": 2, }, }, "range": Array [ - 0, - 48, + 125, + 132, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 2, + }, + "start": Object { + "column": 58, + "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, - }, + "range": Array [ + 133, + 136, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 2, + }, + "start": Object { + "column": 62, + "line": 2, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, }, - "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 [ + 149, + 150, + ], + "type": "Identifier", + "value": "A", }, - ], - "loc": Object { - "end": Object { - "column": 48, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 86, + "line": 2, + }, + "start": Object { + "column": 85, + "line": 2, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ">", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 88, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 48, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 89, + "line": 2, + }, + "start": Object { + "column": 88, + "line": 2, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 4, + 165, + 174, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 5, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 5, - 11, + 175, + 178, ], "type": "Identifier", - "value": "Result", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ - 11, - 12, + 179, + 180, ], "type": "Punctuator", "value": "<", @@ -60945,35 +68964,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 27, + "line": 3, }, "start": Object { - "column": 12, - "line": 1, + "column": 26, + "line": 3, }, }, "range": Array [ - 12, - 13, + 191, + 192, ], "type": "Identifier", - "value": "T", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 38, + "line": 3, }, "start": Object { - "column": 14, - "line": 1, + "column": 37, + "line": 3, }, }, "range": Array [ - 14, - 21, + 202, + 203, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 204, + 211, ], "type": "Keyword", "value": "extends", @@ -60981,53 +69018,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 51, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 47, + "line": 3, }, }, "range": Array [ - 22, - 23, + 212, + 216, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "bar2", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 53, + "line": 3, }, "start": Object { - "column": 23, - "line": 1, + "column": 52, + "line": 3, }, }, "range": Array [ - 23, - 24, + 217, + 218, ], "type": "Punctuator", - "value": "}", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 65, + "line": 3, }, "start": Object { - "column": 24, - "line": 1, + "column": 64, + "line": 3, }, }, "range": Array [ - 24, - 25, + 229, + 230, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 3, + }, + "start": Object { + "column": 75, + "line": 3, + }, + }, + "range": Array [ + 240, + 241, ], "type": "Punctuator", "value": ">", @@ -61035,53 +69090,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 78, + "line": 3, }, "start": Object { - "column": 26, - "line": 1, + "column": 77, + "line": 3, }, }, "range": Array [ - 26, - 27, + 242, + 243, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 79, + "line": 3, }, "start": Object { - "column": 28, - "line": 1, + "column": 78, + "line": 3, }, }, "range": Array [ - 28, - 35, + 243, + 244, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 245, + 254, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 255, + 259, ], "type": "Identifier", - "value": "Success", + "value": "bar2", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 16, + "line": 4, }, "start": Object { - "column": 35, - "line": 1, + "column": 15, + "line": 4, }, }, "range": Array [ - 35, - 36, + 260, + 261, ], "type": "Punctuator", "value": "<", @@ -61089,35 +69180,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 28, + "line": 4, }, "start": Object { - "column": 36, - "line": 1, + "column": 27, + "line": 4, }, }, "range": Array [ - 36, - 37, + 272, + 273, ], "type": "Identifier", - "value": "T", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 40, + "line": 4, }, "start": Object { - "column": 37, - "line": 1, + "column": 39, + "line": 4, }, }, "range": Array [ - 37, - 38, + 284, + 285, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 286, + 287, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 52, + "line": 4, + }, + }, + "range": Array [ + 297, + 298, ], "type": "Punctuator", "value": ">", @@ -61125,212 +69252,358 @@ Object { Object { "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 61, + "line": 4, }, "start": Object { - "column": 39, - "line": 1, + "column": 54, + "line": 4, }, }, "range": Array [ - 39, - 40, + 299, + 306, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 4, + }, + "start": Object { + "column": 62, + "line": 4, + }, + }, + "range": Array [ + 307, + 310, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 4, + }, + "start": Object { + "column": 66, + "line": 4, + }, + }, + "range": Array [ + 311, + 312, ], "type": "Punctuator", - "value": "|", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 79, + "line": 4, }, "start": Object { - "column": 41, - "line": 1, + "column": 78, + "line": 4, }, }, "range": Array [ - 41, - 48, + 323, + 324, ], "type": "Identifier", - "value": "Failure", + "value": "A", }, - ], - "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": 90, + "line": 4, + }, + "start": Object { + "column": 89, + "line": 4, }, - "name": "foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", }, + "range": Array [ + 334, + 335, + ], + "type": "Punctuator", + "value": ">", + }, + Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 92, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 91, + "line": 4, }, }, "range": Array [ - 0, - 30, + 336, + 337, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 93, + "line": 4, }, - "members": Array [ + "start": Object { + "column": 92, + "line": 4, + }, + }, + "range": Array [ + 337, + 338, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-reference-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ Object { "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 2, + "line": 2, }, }, - "name": "bar", + "name": "mBuffers", "range": Array [ - 12, - 15, + 26, + 34, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 51, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 12, - 24, + 26, + 75, ], - "type": "TSPropertySignature", + "static": false, + "type": "ClassProperty", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 50, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 15, - 23, + 34, + 74, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 50, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 17, - 23, + 36, + 74, ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, + "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", }, - "start": Object { - "column": 25, - "line": 1, + "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", }, }, - "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", + "value": null, }, ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, "range": Array [ - 11, - 29, + 22, + 77, ], - "type": "TSTypeLiteral", + "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": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 77, + ], + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -61339,14 +69612,14 @@ Object { }, "range": Array [ 0, - 31, + 78, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 5, "line": 1, }, "start": Object { @@ -61356,294 +69629,257 @@ Object { }, "range": Array [ 0, - 4, + 5, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 1, }, "start": Object { - "column": 5, + "column": 6, "line": 1, }, }, "range": Array [ - 5, - 8, + 6, + 21, ], "type": "Identifier", - "value": "foo", + "value": "AudioBufferList", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 23, "line": 1, }, "start": Object { - "column": 9, + "column": 22, "line": 1, }, }, "range": Array [ - 9, - 10, + 22, + 23, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "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": 1, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, }, }, "range": Array [ - 11, - 12, + 34, + 35, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { "column": 12, - "line": 1, + "line": 2, }, }, "range": Array [ - 12, - 15, + 36, + 43, ], "type": "Identifier", - "value": "bar", + "value": "interop", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 15, - 16, + 43, + 44, ], "type": "Punctuator", - "value": ":", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 17, - 23, + 44, + 53, ], "type": "Identifier", - "value": "string", + "value": "Reference", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 30, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 29, + "line": 2, }, }, "range": Array [ - 23, - 24, + 53, + 54, ], "type": "Punctuator", - "value": ",", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 25, - "line": 1, + "column": 30, + "line": 2, }, }, "range": Array [ - 25, - 28, + 54, + 57, ], "type": "Identifier", - "value": "baz", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 50, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 49, + "line": 2, }, }, "range": Array [ - 28, - 29, + 73, + 74, ], "type": "Punctuator", - "value": "}", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 51, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 50, + "line": 2, }, }, "range": Array [ - 29, - 30, + 74, + 75, ], "type": "Punctuator", "value": ";", }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "}", + }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-assertion.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-bigint.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 27, - ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "TSAnyKeyword", - }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 5, + "line": 1, }, - "range": Array [ - 6, - 27, - ], - "type": "VariableDeclarator", }, - ], - "kind": "const", + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 28, + "column": 17, "line": 1, }, "start": Object { @@ -61653,9 +69889,26 @@ Object { }, "range": Array [ 0, - 28, + 17, ], - "type": "VariableDeclaration", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSBigIntKeyword", + }, }, ], "loc": Object { @@ -61670,14 +69923,14 @@ Object { }, "range": Array [ 0, - 29, + 18, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 4, "line": 1, }, "start": Object { @@ -61687,83 +69940,47 @@ Object { }, "range": Array [ 0, - 5, + 4, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, "range": Array [ - 6, - 9, + 5, + 8, ], "type": "Identifier", - "value": "foo", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ + 9, 10, - 11, ], "type": "Punctuator", "value": "=", }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - "value": "any", - }, Object { "loc": Object { "end": Object { @@ -61771,232 +69988,47 @@ Object { "line": 1, }, "start": Object { - "column": 16, + "column": 11, "line": 1, }, }, "range": Array [ - 16, + 11, 17, ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "bigint", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-assertion-arrow-function.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-boolean.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", - }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "start": Object { + "column": 5, + "line": 1, }, - "range": Array [ - 4, - 43, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 44, + "column": 18, "line": 1, }, "start": Object { @@ -62006,9 +70038,26 @@ Object { }, "range": Array [ 0, - 44, + 18, ], - "type": "VariableDeclaration", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "TSBooleanKeyword", + }, }, ], "loc": Object { @@ -62023,14 +70072,14 @@ Object { }, "range": Array [ 0, - 45, + 19, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -62040,43 +70089,43 @@ Object { }, "range": Array [ 0, - 3, + 4, ], - "type": "Keyword", - "value": "var", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 5, "line": 1, }, }, "range": Array [ - 4, - 13, + 5, + 8, ], "type": "Identifier", - "value": "asserted2", + "value": "Foo", }, 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": "=", @@ -62084,595 +70133,518 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "Identifier", + "value": "boolean", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-false.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { "column": 16, "line": 1, }, + "start": Object { + "column": 0, + "line": 1, + }, }, "range": Array [ + 0, 16, - 17, ], - "type": "Punctuator", - "value": "<", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSLiteralType", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 20, + "column": 4, "line": 1, }, "start": Object { - "column": 17, + "column": 0, "line": 1, }, }, "range": Array [ - 17, - 20, + 0, + 4, ], "type": "Identifier", - "value": "any", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 8, "line": 1, }, "start": Object { - "column": 20, + "column": 5, "line": 1, }, }, "range": Array [ - 20, - 21, + 5, + 8, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 10, "line": 1, }, "start": Object { - "column": 21, + "column": 9, "line": 1, }, }, "range": Array [ - 21, - 22, + 9, + 10, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 16, "line": 1, }, "start": Object { - "column": 22, + "column": 11, "line": 1, }, }, "range": Array [ - 22, - 23, + 11, + 16, ], - "type": "Punctuator", - "value": "(", + "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": 24, + "column": 16, "line": 1, }, "start": Object { - "column": 23, + "column": 0, "line": 1, }, }, "range": Array [ - 23, - 24, + 0, + 16, ], - "type": "Identifier", - "value": "n", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSNeverKeyword", + }, }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 25, + "column": 4, "line": 1, }, "start": Object { - "column": 24, + "column": 0, "line": 1, }, }, "range": Array [ - 24, - 25, + 0, + 4, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 8, "line": 1, }, "start": Object { - "column": 26, + "column": 5, "line": 1, }, }, "range": Array [ - 26, - 28, + 5, + 8, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 10, "line": 1, }, "start": Object { - "column": 29, + "column": 9, "line": 1, }, }, "range": Array [ - 29, - 30, + 9, + 10, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 16, "line": 1, }, "start": Object { - "column": 31, + "column": 11, "line": 1, }, }, "range": Array [ - 31, - 37, + 11, + 16, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "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": 39, + "column": 15, "line": 1, }, "start": Object { - "column": 38, + "column": 0, "line": 1, }, }, "range": Array [ - 38, - 39, + 0, + 15, ], - "type": "Identifier", - "value": "n", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "TSNullKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 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": 15, "line": 1, }, "start": Object { - "column": 43, - "line": 1, - }, - }, - "range": Array [ - 43, - 44, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-guard-in-arrow-function.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ - 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", + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "Keyword", + "value": "null", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-number.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, }, - "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": 17, + "line": 1, }, "start": Object { "column": 0, @@ -62681,15 +70653,32 @@ Object { }, "range": Array [ 0, - 78, + 17, ], - "type": "VariableDeclaration", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -62698,14 +70687,14 @@ Object { }, "range": Array [ 0, - 79, + 18, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 4, "line": 1, }, "start": Object { @@ -62715,43 +70704,43 @@ Object { }, "range": Array [ 0, - 5, + 4, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, "range": Array [ - 6, - 14, + 5, + 8, ], "type": "Identifier", - "value": "isString", + "value": "Foo", }, 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": "Punctuator", "value": "=", @@ -62759,610 +70748,701 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "number", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-object.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { "column": 17, "line": 1, }, + "start": Object { + "column": 0, + "line": 1, + }, }, "range": Array [ + 0, 17, - 18, ], - "type": "Punctuator", - "value": "(", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSObjectKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 19, + "column": 4, "line": 1, }, "start": Object { - "column": 18, + "column": 0, "line": 1, }, }, "range": Array [ - 18, - 19, + 0, + 4, ], "type": "Identifier", - "value": "x", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 8, "line": 1, }, "start": Object { - "column": 19, + "column": 5, "line": 1, }, }, "range": Array [ - 19, - 20, + 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": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 17, "line": 1, }, "start": Object { - "column": 21, + "column": 11, "line": 1, }, }, "range": Array [ - 21, - 24, + 11, + 17, ], "type": "Identifier", - "value": "any", + "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": 25, + "column": 17, "line": 1, }, "start": Object { - "column": 24, + "column": 0, "line": 1, }, }, "range": Array [ - 24, - 25, + 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", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 26, + "column": 4, "line": 1, }, "start": Object { - "column": 25, + "column": 0, "line": 1, }, }, "range": Array [ - 25, - 26, + 0, + 4, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 8, "line": 1, }, "start": Object { - "column": 27, + "column": 5, "line": 1, }, }, "range": Array [ - 27, - 28, + 5, + 8, ], "type": "Identifier", - "value": "x", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 10, "line": 1, }, "start": Object { - "column": 29, + "column": 9, "line": 1, }, }, "range": Array [ - 29, - 31, + 9, + 10, ], - "type": "Identifier", - "value": "is", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 17, "line": 1, }, "start": Object { - "column": 32, + "column": 11, "line": 1, }, }, "range": Array [ - 32, - 38, + 11, + 17, ], "type": "Identifier", "value": "string", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-symbol.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 41, + "column": 17, "line": 1, }, "start": Object { - "column": 39, + "column": 0, "line": 1, }, }, "range": Array [ - 39, - 41, + 0, + 17, ], - "type": "Punctuator", - "value": "=>", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSSymbolKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 43, + "column": 4, "line": 1, }, "start": Object { - "column": 42, + "column": 0, "line": 1, }, }, "range": Array [ - 42, - 43, + 0, + 4, ], - "type": "Punctuator", - "value": "{", + "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": 2, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 48, - 54, + 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": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "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": 11, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 55, - 61, + 0, + 15, ], - "type": "Keyword", - "value": "typeof", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "TSLiteralType", + }, }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 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": 15, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 11, + "line": 1, }, }, "range": Array [ - 77, - 78, + 11, + 15, ], - "type": "Punctuator", - "value": "}", + "type": "Boolean", + "value": "true", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-guard-in-function.src 1`] = ` +exports[`typescript fixtures/basics/typed-keyword-undefined.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, "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": 20, + "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, + 20, ], - "returnType": Object { + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 20, "line": 1, }, "start": Object { - "column": 25, + "column": 11, "line": 1, }, }, "range": Array [ - 25, - 38, + 11, + 20, ], - "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": "TSUndefinedKeyword", }, - "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -63371,14 +71451,14 @@ Object { }, "range": Array [ 0, - 75, + 21, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 4, "line": 1, }, "start": Object { @@ -63388,334 +71468,423 @@ 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": 20, "line": 1, }, "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + "value": "undefined", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-keyword-unknown.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { "column": 18, "line": 1, }, + "start": Object { + "column": 0, + "line": 1, + }, }, "range": Array [ + 0, 18, - 19, ], - "type": "Identifier", - "value": "x", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "TSUnknownKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 20, + "column": 4, "line": 1, }, "start": Object { - "column": 19, + "column": 0, "line": 1, }, }, "range": Array [ - 19, - 20, + 0, + 4, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 8, "line": 1, }, "start": Object { - "column": 21, + "column": 5, "line": 1, }, }, "range": Array [ - 21, - 24, + 5, + 8, ], "type": "Identifier", - "value": "any", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 10, "line": 1, }, "start": Object { - "column": 24, + "column": 9, "line": 1, }, }, "range": Array [ - 24, - 25, + 9, + 10, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 18, "line": 1, }, "start": Object { - "column": 25, + "column": 11, "line": 1, }, }, "range": Array [ - 25, - 26, + 11, + 18, ], - "type": "Punctuator", - "value": ":", + "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", + }, "loc": Object { "end": Object { - "column": 28, + "column": 15, "line": 1, }, "start": Object { - "column": 27, + "column": 0, "line": 1, }, }, "range": Array [ - 27, - 28, + 0, + 15, ], - "type": "Identifier", - "value": "x", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "TSVoidKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 31, + "column": 4, "line": 1, }, "start": Object { - "column": 29, + "column": 0, "line": 1, }, }, "range": Array [ - 29, - 31, + 0, + 4, ], "type": "Identifier", - "value": "is", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 8, "line": 1, }, "start": Object { - "column": 32, + "column": 5, "line": 1, }, }, "range": Array [ - 32, - 38, + 5, + 8, ], "type": "Identifier", - "value": "string", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 10, "line": 1, }, "start": Object { - "column": 39, + "column": 9, "line": 1, }, }, "range": Array [ - 39, - 40, + 9, + 10, ], "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 45, - 51, - ], - "type": "Keyword", - "value": "return", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { "column": 11, - "line": 2, + "line": 1, }, }, "range": Array [ - 52, - 58, + 11, + 15, ], "type": "Keyword", - "value": "typeof", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 59, - 60, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 61, - 64, - ], - "type": "Punctuator", - "value": "===", + "value": "void", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-method-signature.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", }, - "range": Array [ - 65, - 73, - ], - "type": "String", - "value": "'string'", - }, - Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 74, - 75, + 0, + 57, ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-guard-in-interface.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ + "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": 10, + "column": 3, "line": 2, }, "start": Object { @@ -63723,16 +71892,16 @@ Object { "line": 2, }, }, - "name": "isString", + "name": "h", "range": Array [ - 18, - 26, + 15, + 16, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 38, + "column": 23, "line": 2, }, "start": Object { @@ -63744,204 +71913,323 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 15, "line": 2, }, "start": Object { - "column": 11, + "column": 4, "line": 2, }, }, - "name": "node", + "name": "bar", "range": Array [ - 27, - 36, + 17, + 28, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 20, + "column": 15, "line": 2, }, "start": Object { - "column": 15, + "column": 7, "line": 2, }, }, "range": Array [ - 31, - 36, + 20, + 28, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 20, + "column": 15, "line": 2, }, "start": Object { - "column": 17, + "column": 9, "line": 2, }, }, "range": Array [ - 33, - 36, + 22, + 28, ], - "type": "TSAnyKeyword", + "type": "TSStringKeyword", }, }, }, ], "range": Array [ - 18, - 54, + 15, + 36, ], "returnType": Object { "loc": Object { "end": Object { - "column": 37, + "column": 22, "line": 2, }, "start": Object { - "column": 21, + "column": 16, "line": 2, }, }, "range": Array [ - 37, - 53, + 29, + 35, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 22, "line": 2, }, "start": Object { - "column": 23, + "column": 18, "line": 2, }, }, - "parameterName": Object { + "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": 27, - "line": 2, + "column": 13, + "line": 3, }, "start": Object { - "column": 23, - "line": 2, + "column": 10, + "line": 3, }, }, - "name": "node", "range": Array [ - 39, - 43, + 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", }, - "range": Array [ - 39, - 53, - ], - "type": "TSTypePredicate", - "typeAnnotation": Object { + }, + }, + "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": 37, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 31, - "line": 2, + "column": 4, + "line": 3, }, }, - "range": Array [ - 47, - 53, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "name": Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 31, - "line": 2, + "column": 4, + "line": 3, }, }, + "name": "T", "range": Array [ - 47, - 53, + 41, + 42, ], - "type": "TSStringKeyword", + "type": "Identifier", }, + "range": Array [ + 41, + 42, + ], + "type": "TSTypeParameter", }, - }, + ], + "range": Array [ + 40, + 43, + ], + "type": "TSTypeParameterDeclaration", }, - "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, + 11, + 57, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "TSTypeLiteral", }, - "range": Array [ - 0, - 56, - ], - "type": "TSInterfaceDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 5, }, "start": Object { "column": 0, @@ -63950,14 +72238,14 @@ Object { }, "range": Array [ 0, - 57, + 58, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 4, "line": 1, }, "start": Object { @@ -63967,25 +72255,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", @@ -63993,17 +72281,35 @@ 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": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, ], "type": "Punctuator", "value": "{", @@ -64011,7 +72317,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 3, "line": 2, }, "start": Object { @@ -64020,26 +72326,26 @@ Object { }, }, "range": Array [ - 18, - 26, + 15, + 16, ], "type": "Identifier", - "value": "isString", + "value": "h", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 4, "line": 2, }, "start": Object { - "column": 10, + "column": 3, "line": 2, }, }, "range": Array [ - 26, - 27, + 16, + 17, ], "type": "Punctuator", "value": "(", @@ -64047,35 +72353,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 2, }, "start": Object { - "column": 11, + "column": 4, "line": 2, }, }, "range": Array [ - 27, - 31, + 17, + 20, ], "type": "Identifier", - "value": "node", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 8, "line": 2, }, "start": Object { - "column": 15, + "column": 7, "line": 2, }, }, "range": Array [ - 31, - 32, + 20, + 21, ], "type": "Punctuator", "value": ":", @@ -64083,35 +72389,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 15, "line": 2, }, "start": Object { - "column": 17, + "column": 9, "line": 2, }, }, "range": Array [ - 33, - 36, + 22, + 28, ], "type": "Identifier", - "value": "any", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 16, "line": 2, }, "start": Object { - "column": 20, + "column": 15, "line": 2, }, }, "range": Array [ - 36, - 37, + 28, + 29, ], "type": "Punctuator", "value": ")", @@ -64119,17 +72425,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 17, "line": 2, }, "start": Object { - "column": 21, + "column": 16, "line": 2, }, }, "range": Array [ - 37, - 38, + 29, + 30, ], "type": "Punctuator", "value": ":", @@ -64137,610 +72443,605 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 22, "line": 2, }, "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { "column": 23, "line": 2, }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, }, "range": Array [ 39, - 43, + 40, ], "type": "Identifier", - "value": "node", + "value": "g", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 2, + "column": 4, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 3, + "line": 3, }, }, "range": Array [ - 44, - 46, + 40, + 41, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, ], "type": "Identifier", - "value": "is", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 6, + "line": 3, }, "start": Object { - "column": 31, - "line": 2, + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, }, }, "range": Array [ + 44, 47, - 53, ], "type": "Identifier", - "value": "string", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 37, - "line": 2, + "column": 10, + "line": 3, }, }, "range": Array [ - 53, - 54, + 47, + 48, ], "type": "Punctuator", - "value": ";", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 13, "line": 3, }, "start": Object { - "column": 0, + "column": 12, "line": 3, }, }, "range": Array [ - 55, - 56, + 49, + 50, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "T", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-guard-in-method.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "isBar", - "range": Array [ - 14, - 19, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 75, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 51, - 55, - ], - "type": "ThisExpression", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "operator": "instanceof", - "range": Array [ - 51, - 70, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 27, - "line": 3, - }, - }, - "name": "Foo", - "range": Array [ - 67, - 70, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 31, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 44, - 71, - ], - "type": "ReturnStatement", - }, - ], - "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": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 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": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-this.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 17, + "line": 2, }, "start": Object { - "column": 7, + "column": 1, "line": 2, }, }, - "params": Array [], + "name": "addClickListener", "range": Array [ - 19, - 75, + 23, + 39, ], - "returnType": Object { + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 65, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 25, + "column": 57, "line": 2, }, "start": Object { - "column": 9, + "column": 18, "line": 2, }, }, + "name": "onclick", "range": Array [ - 21, - 37, + 40, + 79, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 57, "line": 2, }, "start": Object { - "column": 11, + "column": 25, "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, + 47, + 79, ], - "type": "TSTypePredicate", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 57, "line": 2, }, "start": Object { - "column": 19, + "column": 27, "line": 2, }, }, - "range": Array [ - 31, - 37, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 31, - 37, - ], - "type": "TSStringKeyword", - }, - }, - }, - }, - "type": "FunctionExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "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 { + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 15, - "line": 6, + "column": 38, + "line": 2, }, "start": Object { - "column": 11, - "line": 6, + "column": 28, + "line": 2, }, }, + "name": "this", "range": Array [ - 121, - 125, + 50, + 60, ], - "type": "ThisExpression", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 6, - }, - "start": Object { - "column": 11, - "line": 6, + "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", + }, }, }, - "operator": "instanceof", - "range": Array [ - 121, - 140, - ], - "right": Object { + Object { "loc": Object { "end": Object { - "column": 30, - "line": 6, + "column": 48, + "line": 2, }, "start": Object { - "column": 27, - "line": 6, + "column": 40, + "line": 2, }, }, - "name": "Foo", + "name": "e", "range": Array [ - 137, - 140, + 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", + }, + }, + }, }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 31, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "range": Array [ - 114, - 141, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 7, - }, - "start": Object { - "column": 32, - "line": 5, - }, - }, - "range": Array [ - 108, - 145, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 3, - "line": 7, - }, - "start": Object { - "column": 10, - "line": 5, - }, - }, - "params": Array [], - "range": Array [ - 86, - 145, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 5, - }, - "start": Object { - "column": 12, - "line": 5, - }, - }, - "range": Array [ - 88, - 104, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "parameterName": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "range": Array [ - 90, - 94, ], - "type": "TSThisType", - }, - "range": Array [ - 90, - 104, - ], - "type": "TSTypePredicate", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, - }, - }, "range": Array [ - 98, - 104, + 49, + 79, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 28, - "line": 5, + "column": 57, + "line": 2, }, "start": Object { - "column": 22, - "line": 5, + "column": 50, + "line": 2, }, }, "range": Array [ - 98, - 104, + 72, + 79, ], - "type": "TSStringKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, }, }, - "type": "ArrowFunctionExpression", + ], + "range": Array [ + 23, + 87, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "range": Array [ + 80, + 86, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 60, + "line": 2, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSMethodSignature", }, ], "loc": Object { "end": Object { "column": 1, - "line": 8, + "line": 3, }, "start": Object { - "column": 10, + "column": 20, "line": 1, }, }, "range": Array [ - 10, - 147, + 20, + 89, ], - "type": "ClassBody", + "type": "TSInterfaceBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 19, "line": 1, }, "start": Object { - "column": 6, + "column": 10, "line": 1, }, }, - "name": "Foo", + "name": "UIElement", "range": Array [ - 6, - 9, + 10, + 19, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 8, + "line": 3, }, "start": Object { "column": 0, @@ -64749,16 +73050,15 @@ Object { }, "range": Array [ 0, - 147, + 89, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "TSInterfaceDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 9, + "line": 4, }, "start": Object { "column": 0, @@ -64767,14 +73067,14 @@ Object { }, "range": Array [ 0, - 148, + 90, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { @@ -64784,43 +73084,43 @@ Object { }, "range": Array [ 0, - 5, + 9, ], "type": "Keyword", - "value": "class", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 19, "line": 1, }, "start": Object { - "column": 6, + "column": 10, "line": 1, }, }, "range": Array [ - 6, - 9, + 10, + 19, ], "type": "Identifier", - "value": "Foo", + "value": "UIElement", }, 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": "{", @@ -64828,35 +73128,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 17, "line": 2, }, "start": Object { - "column": 2, + "column": 1, "line": 2, }, }, "range": Array [ - 14, - 19, + 23, + 39, ], "type": "Identifier", - "value": "isBar", + "value": "addClickListener", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 18, "line": 2, }, "start": Object { - "column": 7, + "column": 17, "line": 2, }, }, "range": Array [ - 19, - 20, + 39, + 40, ], "type": "Punctuator", "value": "(", @@ -64864,35 +73164,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 25, "line": 2, }, "start": Object { - "column": 8, + "column": 18, "line": 2, }, }, "range": Array [ - 20, - 21, + 40, + 47, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "onclick", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 26, "line": 2, }, "start": Object { - "column": 9, + "column": 25, "line": 2, }, }, "range": Array [ - 21, - 22, + 47, + 48, ], "type": "Punctuator", "value": ":", @@ -64900,156 +73200,156 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 28, "line": 2, }, "start": Object { - "column": 11, + "column": 27, "line": 2, }, }, "range": Array [ - 23, - 27, + 49, + 50, ], - "type": "Keyword", - "value": "this", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 32, "line": 2, }, "start": Object { - "column": 16, + "column": 28, "line": 2, }, }, "range": Array [ - 28, - 30, + 50, + 54, ], - "type": "Identifier", - "value": "is", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 33, "line": 2, }, "start": Object { - "column": 19, + "column": 32, "line": 2, }, }, "range": Array [ - 31, - 37, + 54, + 55, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 38, "line": 2, }, "start": Object { - "column": 26, + "column": 34, "line": 2, }, }, "range": Array [ - 38, - 39, + 56, + 60, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 39, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 38, + "line": 2, }, }, "range": Array [ - 44, - 50, + 60, + 61, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 41, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 40, + "line": 2, }, }, "range": Array [ - 51, - 55, + 62, + 63, ], - "type": "Keyword", - "value": "this", + "type": "Identifier", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 3, + "column": 42, + "line": 2, }, "start": Object { - "column": 16, - "line": 3, + "column": 41, + "line": 2, }, }, "range": Array [ - 56, - 66, + 63, + 64, ], - "type": "Keyword", - "value": "instanceof", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 48, + "line": 2, }, "start": Object { - "column": 27, - "line": 3, + "column": 43, + "line": 2, }, }, "range": Array [ - 67, + 65, 70, ], "type": "Identifier", - "value": "Foo", + "value": "Event", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 49, + "line": 2, }, "start": Object { - "column": 30, - "line": 3, + "column": 48, + "line": 2, }, }, "range": Array [ @@ -65057,107 +73357,125 @@ Object { 71, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 52, + "line": 2, }, "start": Object { - "column": 2, - "line": 4, + "column": 50, + "line": 2, }, }, "range": Array [ + 72, 74, - 75, ], "type": "Punctuator", - "value": "}", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 57, + "line": 2, }, "start": Object { - "column": 2, - "line": 5, + "column": 53, + "line": 2, }, }, "range": Array [ - 78, - 83, + 75, + 79, ], - "type": "Identifier", - "value": "isBaz", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 58, + "line": 2, }, "start": Object { - "column": 8, - "line": 5, + "column": 57, + "line": 2, }, }, "range": Array [ - 84, - 85, + 79, + 80, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 5, + "column": 59, + "line": 2, }, "start": Object { - "column": 10, - "line": 5, + "column": 58, + "line": 2, }, }, "range": Array [ - 86, - 87, + 80, + 81, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 5, + "column": 64, + "line": 2, }, "start": Object { - "column": 11, - "line": 5, + "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, - 88, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 5, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, - "line": 5, + "column": 0, + "line": 3, }, }, "range": Array [ @@ -65165,326 +73483,502 @@ Object { 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": 18, - "line": 5, + "column": 23, + "line": 1, }, "start": Object { - "column": 14, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 90, - 94, + 0, + 23, ], - "type": "Keyword", - "value": "this", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "unique", + "range": Array [ + 9, + 22, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSSymbolKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 21, - "line": 5, + "column": 4, + "line": 1, }, "start": Object { - "column": 19, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 95, - 97, + 0, + 4, ], "type": "Identifier", - "value": "is", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 5, + "column": 6, + "line": 1, }, "start": Object { - "column": 22, - "line": 5, + "column": 5, + "line": 1, }, }, "range": Array [ - 98, - 104, + 5, + 6, ], "type": "Identifier", - "value": "string", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 5, + "column": 8, + "line": 1, }, "start": Object { - "column": 29, - "line": 5, + "column": 7, + "line": 1, }, }, "range": Array [ - 105, - 107, + 7, + 8, ], "type": "Punctuator", - "value": "=>", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 5, + "column": 15, + "line": 1, }, "start": Object { - "column": 32, - "line": 5, + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Identifier", + "value": "unique", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, }, }, "range": Array [ - 108, - 109, + 16, + 22, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "symbol", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 6, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 22, + "line": 1, }, }, "range": Array [ - 114, - 120, + 22, + 23, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "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": 15, - "line": 6, + "column": 17, + "line": 1, }, "start": Object { - "column": 11, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 121, - 125, + 0, + 17, ], - "type": "Keyword", - "value": "this", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 26, - "line": 6, + "column": 3, + "line": 1, }, "start": Object { - "column": 16, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 126, - 136, + 0, + 3, ], "type": "Keyword", - "value": "instanceof", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 6, + "column": 7, + "line": 1, }, "start": Object { - "column": 27, - "line": 6, + "column": 4, + "line": 1, }, }, "range": Array [ - 137, - 140, + 4, + 7, ], "type": "Identifier", - "value": "Foo", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 6, + "column": 8, + "line": 1, }, "start": Object { - "column": 30, - "line": 6, + "column": 7, + "line": 1, }, }, "range": Array [ - 140, - 141, + 7, + 8, ], "type": "Punctuator", - "value": ";", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 7, + "column": 16, + "line": 1, }, "start": Object { - "column": 2, - "line": 7, + "column": 9, + "line": 1, }, }, "range": Array [ - 144, - 145, + 9, + 16, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "unknown", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 8, + "column": 17, + "line": 1, }, "start": Object { - "column": 0, - "line": 8, + "column": 16, + "line": 1, }, }, "range": Array [ - 146, - 147, + 16, + 17, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-parameters-comments.src 1`] = ` +exports[`typescript fixtures/basics/var-with-definite-assignment.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, + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "name": "x", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, + "column": 16, "line": 1, }, "start": Object { - "column": 21, + "column": 8, "line": 1, }, }, "range": Array [ - 21, - 22, + 8, + 16, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, + "column": 16, "line": 1, }, "start": Object { - "column": 21, + "column": 10, "line": 1, }, }, - "name": "A", "range": Array [ - 21, - 22, + 10, + 16, ], - "type": "Identifier", + "type": "TSStringKeyword", }, }, - ], + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, "range": Array [ - 3, - 40, + 6, + 16, ], - "type": "TSTypeParameterInstantiation", + "type": "VariableDeclarator", }, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 43, + "column": 17, "line": 1, }, "start": Object { @@ -65494,266 +73988,191 @@ Object { }, "range": Array [ 0, - 43, + 17, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 43, - "line": 2, - }, - "start": Object { - "column": 40, - "line": 2, - }, - }, - "range": Array [ - 84, - 87, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 53, - 56, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 43, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 44, - 87, - ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "params": Array [ - Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { "loc": Object { "end": Object { - "column": 25, + "column": 14, "line": 2, }, "start": Object { - "column": 24, + "column": 4, "line": 2, }, }, - "name": Object { + "name": "y", + "range": Array [ + 22, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 14, "line": 2, }, "start": Object { - "column": 24, + "column": 6, "line": 2, }, }, - "name": "A", "range": Array [ - 68, - 69, + 24, + 32, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSNumberKeyword", + }, }, - "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, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, }, + "range": Array [ + 22, + 32, + ], + "type": "VariableDeclarator", }, - "name": "baz", - "range": Array [ - 97, - 100, - ], - "type": "Identifier", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 49, - "line": 3, + "column": 15, + "line": 2, }, "start": Object { "column": 0, - "line": 3, + "line": 2, }, }, - "params": Array [], "range": Array [ - 88, - 137, + 18, + 33, ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "params": Array [ - Object { - "default": Object { + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "z", + "range": Array [ + 38, + 48, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 14, "line": 3, }, "start": Object { - "column": 38, + "column": 6, "line": 3, }, }, "range": Array [ - 126, - 129, + 40, + 48, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 14, "line": 3, }, "start": Object { - "column": 38, + "column": 8, "line": 3, }, }, - "name": "Foo", "range": Array [ - 126, - 129, + 42, + 48, ], - "type": "Identifier", + "type": "TSObjectKeyword", }, }, - "loc": Object { - "end": Object { - "column": 41, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "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", + "start": Object { + "column": 4, + "line": 3, }, - "range": Array [ - 112, - 129, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 100, - 131, - ], - "type": "TSTypeParameterDeclaration", + "range": Array [ + 38, + 48, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, }, + "range": Array [ + 34, + 49, + ], + "type": "VariableDeclaration", }, ], "loc": Object { @@ -65768,14 +74187,14 @@ Object { }, "range": Array [ 0, - 138, + 50, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -65785,115 +74204,97 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 4, + 5, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 7, "line": 1, }, "start": Object { - "column": 21, + "column": 6, "line": 1, }, }, "range": Array [ - 21, - 22, + 6, + 7, ], "type": "Identifier", - "value": "A", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 8, "line": 1, }, "start": Object { - "column": 39, + "column": 7, "line": 1, }, }, "range": Array [ - 39, - 40, + 7, + 8, ], "type": "Punctuator", - "value": ">", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 9, "line": 1, }, "start": Object { - "column": 40, + "column": 8, "line": 1, }, }, "range": Array [ - 40, - 41, + 8, + 9, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 16, "line": 1, }, "start": Object { - "column": 41, + "column": 10, "line": 1, }, }, "range": Array [ - 41, - 42, + 10, + 16, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 17, "line": 1, }, "start": Object { - "column": 42, + "column": 16, "line": 1, }, }, "range": Array [ - 42, - 43, + 16, + 17, ], "type": "Punctuator", "value": ";", @@ -65901,7 +74302,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 3, "line": 2, }, "start": Object { @@ -65910,160 +74311,106 @@ Object { }, }, "range": Array [ - 44, - 52, + 18, + 21, ], "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 53, - 56, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 56, - 57, - ], - "type": "Punctuator", - "value": "<", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 5, "line": 2, }, "start": Object { - "column": 24, + "column": 4, "line": 2, }, }, "range": Array [ - 68, - 69, + 22, + 23, ], "type": "Identifier", - "value": "A", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 36, - "line": 2, - }, - }, - "range": Array [ - 80, - 81, - ], - "type": "Punctuator", - "value": ">", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 6, "line": 2, }, "start": Object { - "column": 37, + "column": 5, "line": 2, }, }, "range": Array [ - 81, - 82, + 23, + 24, ], "type": "Punctuator", - "value": "(", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 7, "line": 2, }, "start": Object { - "column": 38, + "column": 6, "line": 2, }, }, "range": Array [ - 82, - 83, + 24, + 25, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 14, "line": 2, }, "start": Object { - "column": 40, + "column": 8, "line": 2, }, }, "range": Array [ - 84, - 85, + 26, + 32, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 15, "line": 2, }, "start": Object { - "column": 42, + "column": 14, "line": 2, }, }, "range": Array [ - 86, - 87, + 32, + 33, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 3, "line": 3, }, "start": Object { @@ -66072,403 +74419,276 @@ Object { }, }, "range": Array [ - 88, - 96, + 34, + 37, ], "type": "Keyword", - "value": "function", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 5, "line": 3, }, "start": Object { - "column": 9, + "column": 4, "line": 3, }, }, "range": Array [ - 97, - 100, + 38, + 39, ], "type": "Identifier", - "value": "baz", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 6, "line": 3, }, "start": Object { - "column": 12, + "column": 5, "line": 3, }, }, "range": Array [ - 100, - 101, + 39, + 40, ], "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "range": Array [ - 112, - 113, - ], - "type": "Identifier", - "value": "A", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 7, "line": 3, }, "start": Object { - "column": 36, + "column": 6, "line": 3, }, }, "range": Array [ - 124, - 125, + 40, + 41, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 14, "line": 3, }, "start": Object { - "column": 38, + "column": 8, "line": 3, }, }, "range": Array [ - 126, - 129, + 42, + 48, ], "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 3, - }, - "start": Object { - "column": 42, - "line": 3, - }, - }, - "range": Array [ - 130, - 131, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 3, - }, - "start": Object { - "column": 43, - "line": 3, - }, - }, - "range": Array [ - 131, - 132, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 3, - }, - "start": Object { - "column": 44, - "line": 3, - }, - }, - "range": Array [ - 132, - 133, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 3, - }, - "start": Object { - "column": 46, - "line": 3, - }, - }, - "range": Array [ - 134, - 135, - ], - "type": "Punctuator", - "value": "{", + "value": "object", }, Object { "loc": Object { "end": Object { - "column": 49, + "column": 15, "line": 3, }, "start": Object { - "column": 48, + "column": 14, "line": 3, - }, - }, - "range": Array [ - 136, - 137, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-reference-comments.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "mBuffers", - "range": Array [ - 26, - 34, - ], - "type": "Identifier", - }, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 51, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 4, + "line": 1, }, }, + "name": "foo", "range": Array [ - 26, - 75, + 4, + 14, ], - "static": false, - "type": "ClassProperty", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 50, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 34, - 74, + 7, + 14, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 50, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 36, - 74, + 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": 19, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 9, + "line": 1, }, }, - "name": "interop", "range": Array [ - 36, - 43, + 9, + 12, ], - "type": "Identifier", + "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": 29, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 36, - 53, + 9, + 14, ], "right": Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 13, + "line": 1, }, }, - "name": "Reference", + "name": "C", "range": Array [ - 44, - 53, + 13, + 14, ], "type": "Identifier", }, "type": "TSQualifiedName", }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 54, - 57, - ], - "type": "TSAnyKeyword", - }, - ], - "range": Array [ - 53, - 74, - ], - "type": "TSTypeParameterInstantiation", - }, }, }, - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 77, - ], - "type": "ClassBody", - }, - "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": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", }, - "name": "AudioBufferList", - "range": Array [ - 6, - 21, - ], - "type": "Identifier", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { "column": 0, @@ -66477,16 +74697,15 @@ Object { }, "range": Array [ 0, - 77, + 15, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -66495,14 +74714,14 @@ Object { }, "range": Array [ 0, - 78, + 16, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -66512,115 +74731,79 @@ Object { }, "range": Array [ 0, - 5, + 3, ], "type": "Keyword", - "value": "class", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 7, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 21, + 4, + 7, ], "type": "Identifier", - "value": "AudioBufferList", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 8, "line": 1, }, "start": Object { - "column": 22, + "column": 7, "line": 1, }, }, "range": Array [ - 22, - 23, + 7, + 8, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { "column": 10, - "line": 2, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 26, - 34, + 9, + 10, ], "type": "Identifier", - "value": "mBuffers", + "value": "A", }, Object { "loc": Object { "end": Object { "column": 11, - "line": 2, + "line": 1, }, "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, + "line": 1, }, }, "range": Array [ - 43, - 44, + 10, + 11, ], "type": "Punctuator", "value": ".", @@ -66628,141 +74811,178 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 44, - 53, + 11, + 12, ], "type": "Identifier", - "value": "Reference", + "value": "B", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { - "column": 29, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 53, - 54, + 12, + 13, ], "type": "Punctuator", - "value": "<", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 30, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 54, - 57, + 13, + 14, ], "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 2, - }, - "start": Object { - "column": 49, - "line": 2, - }, - }, - "range": Array [ - 73, - 74, - ], - "type": "Punctuator", - "value": ">", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 51, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 50, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 74, - 75, + 14, + 15, ], "type": "Punctuator", "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 76, - 77, - ], - "type": "Punctuator", - "value": "}", - }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-bigint.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, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "name", + "range": Array [ + 4, + 15, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 15, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "TSStringKeyword", + }, + }, }, - "start": Object { - "column": 5, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "raw": "\\"Nicholas\\"", + "type": "Literal", + "value": "Nicholas", }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 17, + "column": 29, "line": 1, }, "start": Object { @@ -66772,32 +74992,123 @@ Object { }, "range": Array [ 0, - 17, + 29, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 34, + 45, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 37, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "TSStringKeyword", + }, + }, }, - "start": Object { - "column": 11, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 48, + 53, + ], + "raw": "\\"Bar\\"", + "type": "Literal", + "value": "Bar", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, }, + "range": Array [ + 34, + 53, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, }, - "range": Array [ - 11, - 17, - ], - "type": "TSBigIntKeyword", }, + "range": Array [ + 30, + 54, + ], + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 3, }, "start": Object { "column": 0, @@ -66806,14 +75117,14 @@ Object { }, "range": Array [ 0, - 18, + 55, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 3, "line": 1, }, "start": Object { @@ -66823,10 +75134,10 @@ Object { }, "range": Array [ 0, - 4, + 3, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { @@ -66835,400 +75146,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": "bigint", + "value": "string", }, - ], - "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, + "column": 17, "line": 1, }, "start": Object { - "column": 0, + "column": 16, "line": 1, }, }, "range": Array [ - 0, - 18, + 16, + 17, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 18, - ], - "type": "TSBooleanKeyword", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "=", }, - }, - "range": Array [ - 0, - 19, - ], - "sourceType": "script", - "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": 18, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 11, - 18, + 34, + 37, ], "type": "Identifier", - "value": "boolean", + "value": "foo", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/typed-keyword-false.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 0, - 16, + 37, + 38, ], - "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", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ":", }, - }, - "range": Array [ - 0, - 17, - ], - "sourceType": "script", - "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": 16, - "line": 1, + "column": 24, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 23, + "line": 2, }, }, "range": Array [ - 11, - 16, + 53, + 54, ], - "type": "Boolean", - "value": "false", + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-never.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": 16, + "column": 22, "line": 1, }, "start": Object { @@ -67238,32 +75467,15 @@ Object { }, "range": Array [ 0, - 16, + 22, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 16, - ], - "type": "TSNeverKeyword", - }, + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { "column": 0, @@ -67272,14 +75484,14 @@ Object { }, "range": Array [ 0, - 17, + 22, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 3, "line": 1, }, "start": Object { @@ -67289,96 +75501,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": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 11, + "column": 15, "line": 1, }, }, "range": Array [ - 11, - 16, + 15, + 21, ], "type": "Identifier", - "value": "never", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-null.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, @@ -67387,32 +75637,16 @@ Object { }, "range": Array [ 0, - 15, + 31, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "type": "TSNullKeyword", - }, + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -67421,14 +75655,14 @@ Object { }, "range": Array [ 0, - 16, + 32, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -67438,96 +75672,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": "Keyword", - "value": "null", + "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-number.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": 17, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -67536,32 +75825,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": "TSNumberKeyword", - }, + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -67570,14 +75843,14 @@ Object { }, "range": Array [ 0, - 18, + 23, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -67587,25 +75860,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", @@ -67613,104 +75904,160 @@ 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": 17, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 11, - 17, + 21, + 22, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-object.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": 17, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, "line": 1, }, }, - "range": Array [ - 0, - 17, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "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, - 17, - ], - "type": "TSObjectKeyword", - }, + 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", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 5, }, "start": Object { "column": 0, @@ -67719,112 +76066,188 @@ Object { }, "range": Array [ 0, - 18, + 38, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, "line": 1, }, "start": Object { - "column": 0, + "column": 17, "line": 1, }, }, "range": Array [ - 0, - 4, + 17, + 18, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 5, - 8, + 23, + 26, ], "type": "Identifier", - "value": "Foo", + "value": "Bar", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 9, - 10, + 26, + 27, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 11, - 17, + 32, + 35, ], "type": "Identifier", - "value": "object", + "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-string.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": 17, + "column": 28, "line": 1, }, "start": Object { @@ -67832,28 +76255,46 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 17, + 28, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 17, + "column": 28, "line": 1, }, "start": Object { - "column": 11, + "column": 22, "line": 1, }, }, "range": Array [ - 11, - 17, + 22, + 28, ], - "type": "TSStringKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSDeclareFunction", }, ], "loc": Object { @@ -67868,14 +76309,14 @@ Object { }, "range": Array [ 0, - 18, + 29, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -67885,96 +76326,169 @@ 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": 17, + "column": 22, "line": 1, }, "start": Object { - "column": 11, + "column": 21, "line": 1, }, }, "range": Array [ - 11, - 17, + 21, + 22, ], - "type": "Identifier", - "value": "string", + "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": 28, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "Keyword", + "value": "void", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-symbol.src 1`] = ` +exports[`typescript fixtures/declare/interface.src 1`] = ` Object { "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "TSInterfaceBody", + }, + "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 1, }, "start": Object { - "column": 5, + "column": 18, "line": 1, }, }, "name": "Foo", "range": Array [ - 5, - 8, + 18, + 21, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -67983,32 +76497,15 @@ Object { }, "range": Array [ 0, - 17, + 26, ], - "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": "TSInterfaceDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -68017,14 +76514,14 @@ Object { }, "range": Array [ 0, - 18, + 27, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -68034,25 +76531,43 @@ 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": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, ], "type": "Identifier", "value": "Foo", @@ -68060,70 +76575,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 23, "line": 1, }, "start": Object { - "column": 9, + "column": 22, "line": 1, }, }, "range": Array [ - 9, - 10, + 22, + 23, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 11, - 17, + 25, + 26, ], - "type": "Identifier", - "value": "symbol", + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-true.src 1`] = ` +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": 8, + "column": 18, "line": 1, }, "start": Object { - "column": 5, + "column": 15, "line": 1, }, }, "name": "Foo", "range": Array [ - 5, - 8, + 15, + 18, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -68132,51 +76666,15 @@ Object { }, "range": Array [ 0, - 15, + 23, ], - "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", - }, + "type": "TSModuleDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -68185,14 +76683,14 @@ Object { }, "range": Array [ 0, - 16, + 24, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -68202,130 +76700,150 @@ Object { }, "range": Array [ 0, - 4, + 7, ], "type": "Identifier", - "value": "type", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 14, "line": 1, }, "start": Object { - "column": 5, + "column": 8, "line": 1, }, }, "range": Array [ - 5, 8, + 14, ], "type": "Identifier", - "value": "Foo", + "value": "module", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 18, "line": 1, }, "start": Object { - "column": 9, + "column": 15, "line": 1, }, }, "range": Array [ - 9, - 10, + 15, + 18, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 20, "line": 1, }, "start": Object { - "column": 11, + "column": 19, "line": 1, }, }, "range": Array [ - 11, - 15, + 19, + 20, ], - "type": "Boolean", - "value": "true", + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-undefined.src 1`] = ` +exports[`typescript fixtures/declare/namespace.src 1`] = ` Object { "body": Array [ Object { - "id": Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 5, + "column": 22, "line": 1, }, }, - "name": "Foo", "range": Array [ - 5, - 8, + 22, + 26, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "TSModuleBlock", }, - "range": Array [ - 0, - 20, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { + "declare": true, + "id": Object { "loc": Object { "end": Object { - "column": 20, + "column": 21, "line": 1, }, "start": Object { - "column": 11, + "column": 18, "line": 1, }, }, + "name": "Foo", "range": Array [ - 11, - 20, + 18, + 21, ], - "type": "TSUndefinedKeyword", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 26, + ], + "type": "TSModuleDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -68334,14 +76852,14 @@ Object { }, "range": Array [ 0, - 21, + 27, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -68351,95 +76869,114 @@ 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", + "value": "namespace", }, 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": 20, + "column": 23, "line": 1, }, "start": Object { - "column": 11, + "column": 22, "line": 1, }, }, "range": Array [ - 11, - 20, + 22, + 23, ], - "type": "Identifier", - "value": "undefined", + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-unknown.src 1`] = ` +exports[`typescript fixtures/declare/type-alias.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, + "column": 25, "line": 1, }, "start": Object { @@ -68449,25 +76986,25 @@ Object { }, "range": Array [ 0, - 18, + 25, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 18, + "column": 25, "line": 1, }, "start": Object { - "column": 11, + "column": 19, "line": 1, }, }, "range": Array [ - 11, - 18, + 19, + 25, ], - "type": "TSUnknownKeyword", + "type": "TSStringKeyword", }, }, ], @@ -68483,14 +77020,14 @@ Object { }, "range": Array [ 0, - 19, + 26, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -68500,25 +77037,43 @@ 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": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, ], "type": "Identifier", "value": "Foo", @@ -68526,17 +77081,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 18, "line": 1, }, "start": Object { - "column": 9, + "column": 17, "line": 1, }, }, "range": Array [ - 9, - 10, + 17, + 18, ], "type": "Punctuator", "value": "=", @@ -68544,51 +77099,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 25, "line": 1, }, "start": Object { - "column": 11, + "column": 19, "line": 1, }, }, "range": Array [ - 11, - 18, + 19, + 25, ], "type": "Identifier", - "value": "unknown", + "value": "string", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/typed-keyword-void.src 1`] = ` +exports[`typescript fixtures/declare/variable.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": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 12, + 20, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", + }, + }, }, - "start": Object { - "column": 5, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, }, + "range": Array [ + 12, + 20, + ], + "type": "VariableDeclarator", }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, + ], + "declare": true, + "kind": "var", "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { @@ -68598,26 +77209,9 @@ Object { }, "range": Array [ 0, - 15, + 21, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "type": "TSVoidKeyword", - }, + "type": "VariableDeclaration", }, ], "loc": Object { @@ -68632,14 +77226,14 @@ Object { }, "range": Array [ 0, - 16, + 22, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { @@ -68649,470 +77243,393 @@ Object { }, "range": Array [ 0, - 4, + 7, ], "type": "Identifier", - "value": "type", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 11, "line": 1, }, "start": Object { - "column": 5, + "column": 8, "line": 1, }, }, "range": Array [ - 5, 8, + 11, ], - "type": "Identifier", - "value": "Foo", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { - "column": 9, + "column": 12, "line": 1, }, }, "range": Array [ - 9, - 10, + 12, + 15, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 11, + "column": 15, "line": 1, }, }, "range": Array [ - 11, 15, + 16, ], - "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": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "any", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 21, + "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, - 57, + 20, + 21, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "members": Array [ + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-instance-member.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 [ - 15, - 16, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "params": Array [ + "decorators": 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, + "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, }, - }, - "range": Array [ - 20, - 28, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "callee": Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 2, }, "start": Object { - "column": 9, + "column": 5, "line": 2, }, }, + "name": "configurable", "range": Array [ - 22, - 28, + 19, + 31, ], - "type": "TSStringKeyword", + "type": "Identifier", }, - }, - }, - ], - "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": 24, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 38, + ], + "type": "CallExpression", + }, "loc": Object { "end": Object { - "column": 22, + "column": 24, "line": 2, }, "start": Object { - "column": 18, + "column": 4, "line": 2, }, }, "range": Array [ - 31, - 35, + 18, + 38, ], - "type": "TSVoidKeyword", + "type": "Decorator", }, - }, - "type": "TSMethodSignature", - }, - Object { - "computed": false, + ], "key": Object { "loc": Object { "end": Object { - "column": 3, + "column": 9, "line": 3, }, "start": Object { - "column": 2, + "column": 8, "line": 3, }, }, - "name": "g", + "name": "x", "range": Array [ - 39, - 40, + 47, + 48, ], "type": "Identifier", }, + "kind": "get", "loc": Object { "end": Object { - "column": 18, + "column": 31, "line": 3, }, "start": Object { - "column": 2, - "line": 3, + "column": 4, + "line": 2, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 44, - 50, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 47, - 50, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "TSTypeReference", - "typeName": Object { + "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": 13, + "column": 28, "line": 3, }, "start": Object { - "column": 12, + "column": 21, "line": 3, }, }, - "name": "T", + "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 [ - 49, - 50, + 60, + 67, ], - "type": "Identifier", + "type": "MemberExpression", }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 68, + ], + "type": "ReturnStatement", }, - }, - }, - ], - "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, + "column": 31, "line": 3, }, "start": Object { - "column": 16, + "column": 12, "line": 3, }, }, "range": Array [ - 53, - 54, + 51, + 70, ], - "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": "BlockStatement", }, - }, - "type": "TSMethodSignature", - "typeParameters": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 6, + "column": 31, "line": 3, }, "start": Object { - "column": 3, + "column": 9, "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", - }, - ], + "params": Array [], "range": Array [ - 40, - 43, + 48, + 70, ], - "type": "TSTypeParameterDeclaration", + "type": "FunctionExpression", }, }, ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 72, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Point", "range": Array [ + 6, 11, - 57, ], - "type": "TSTypeLiteral", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 72, + ], + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 5, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -69121,14 +77638,14 @@ Object { }, "range": Array [ 0, - 58, + 72, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 5, "line": 1, }, "start": Object { @@ -69138,61 +77655,43 @@ Object { }, "range": Array [ 0, - 4, + 5, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 11, "line": 1, }, "start": Object { - "column": 5, + "column": 6, "line": 1, }, }, "range": Array [ - 5, - 8, + 6, + 11, ], "type": "Identifier", - "value": "Foo", + "value": "Point", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "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, + 13, ], "type": "Punctuator", "value": "{", @@ -69200,43 +77699,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - "value": "h", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 2, - }, - "start": Object { - "column": 3, - "line": 2, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, + "column": 5, "line": 2, }, "start": Object { @@ -69245,88 +77708,52 @@ Object { }, }, "range": Array [ - 17, - 20, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 20, - 21, + 18, + 19, ], "type": "Punctuator", - "value": ":", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 2, }, "start": Object { - "column": 9, + "column": 5, "line": 2, }, }, "range": Array [ - 22, - 28, + 19, + 31, ], "type": "Identifier", - "value": "string", + "value": "configurable", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 18, "line": 2, }, "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { "column": 17, "line": 2, }, - "start": Object { - "column": 16, - "line": 2, - }, }, "range": Array [ - 29, - 30, + 31, + 32, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 23, "line": 2, }, "start": Object { @@ -69335,245 +77762,227 @@ Object { }, }, "range": Array [ - 31, - 35, + 32, + 37, ], - "type": "Keyword", - "value": "void", + "type": "Boolean", + "value": "false", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 24, "line": 2, }, "start": Object { - "column": 22, + "column": 23, "line": 2, }, }, "range": Array [ - 35, - 36, + 37, + 38, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 3, }, "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Identifier", - "value": "g", - }, - Object { - "loc": Object { - "end": Object { "column": 4, "line": 3, }, - "start": Object { - "column": 3, - "line": 3, - }, }, "range": Array [ - 40, - 41, + 43, + 46, ], - "type": "Punctuator", - "value": "<", + "type": "Identifier", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 3, }, "start": Object { - "column": 4, + "column": 8, "line": 3, }, }, "range": Array [ - 41, - 42, + 47, + 48, ], "type": "Identifier", - "value": "T", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 3, }, "start": Object { - "column": 5, + "column": 9, "line": 3, }, }, "range": Array [ - 42, - 43, + 48, + 49, ], "type": "Punctuator", - "value": ">", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 3, }, "start": Object { - "column": 6, + "column": 10, "line": 3, }, }, "range": Array [ - 43, - 44, + 49, + 50, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 3, }, "start": Object { - "column": 7, + "column": 12, "line": 3, }, }, "range": Array [ - 44, - 47, + 51, + 52, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 20, "line": 3, }, "start": Object { - "column": 10, + "column": 14, "line": 3, }, }, "range": Array [ - 47, - 48, + 53, + 59, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 25, "line": 3, }, "start": Object { - "column": 12, + "column": 21, "line": 3, }, }, "range": Array [ - 49, - 50, + 60, + 64, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 26, "line": 3, }, "start": Object { - "column": 13, + "column": 25, "line": 3, }, }, "range": Array [ - 50, - 51, + 64, + 65, ], "type": "Punctuator", - "value": ")", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 28, "line": 3, }, "start": Object { - "column": 14, + "column": 26, "line": 3, }, }, "range": Array [ - 51, - 52, + 65, + 67, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "_x", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 29, "line": 3, }, "start": Object { - "column": 16, + "column": 28, "line": 3, }, }, "range": Array [ - 53, - 54, + 67, + 68, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 31, "line": 3, }, "start": Object { - "column": 17, + "column": 30, "line": 3, }, }, "range": Array [ - 54, - 55, + 69, + 70, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { @@ -69587,8 +77996,8 @@ Object { }, }, "range": Array [ - 56, - 57, + 71, + 72, ], "type": "Punctuator", "value": "}", @@ -69598,7 +78007,7 @@ Object { } `; -exports[`typescript fixtures/basics/typed-this.src 1`] = ` +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -69606,325 +78015,325 @@ Object { "body": Array [ Object { "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, - }, - }, - "name": "addClickListener", - "range": Array [ - 23, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 65, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, - }, - }, - "params": Array [ + "decorators": 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, - }, + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "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 { + "start": Object { + "column": 9, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 38, + "column": 14, "line": 2, }, "start": Object { - "column": 34, + "column": 11, "line": 2, }, }, + "name": "baz", "range": Array [ - 56, - 60, + 25, + 28, ], - "type": "TSVoidKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 40, - "line": 2, + "type": "Identifier", }, - }, - "name": "e", - "range": Array [ - 62, - 70, - ], - "type": "Identifier", - "typeAnnotation": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 48, + "column": 20, "line": 2, }, "start": Object { - "column": 41, + "column": 11, "line": 2, }, }, + "method": false, "range": Array [ - 63, - 70, + 25, + 34, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "shorthand": false, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 48, + "column": 20, "line": 2, }, "start": Object { - "column": 43, + "column": 16, "line": 2, }, }, "range": Array [ - 65, - 70, + 30, + 34, ], - "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", - }, + "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 [ - 49, - 79, + 19, + 22, ], - "returnType": Object { + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 37, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 37, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 80, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, "loc": Object { "end": Object { - "column": 57, - "line": 2, + "column": 39, + "line": 3, }, "start": Object { - "column": 50, - "line": 2, + "column": 30, + "line": 3, }, }, - "range": Array [ - 72, - 79, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "object": Object { "loc": Object { "end": Object { - "column": 57, - "line": 2, + "column": 34, + "line": 3, }, "start": Object { - "column": 53, - "line": 2, + "column": 30, + "line": 3, }, }, "range": Array [ - 75, - 79, + 68, + 72, ], - "type": "TSVoidKeyword", + "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", }, - "type": "TSFunctionType", + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 78, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, }, }, + "range": Array [ + 59, + 80, + ], + "type": "BlockStatement", }, - ], - "range": Array [ - 23, - 87, - ], - "returnType": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 64, - "line": 2, + "column": 42, + "line": 3, }, "start": Object { - "column": 58, - "line": 2, + "column": 18, + "line": 3, }, }, + "params": Array [], "range": Array [ + 56, 80, - 86, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 64, - "line": 2, - }, - "start": Object { - "column": 60, - "line": 2, - }, - }, - "range": Array [ - 82, - 86, - ], - "type": "TSVoidKeyword", - }, + "type": "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, + 82, ], - "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": "Other", "range": Array [ - 10, - 19, + 6, + 11, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -69933,14 +78342,15 @@ Object { }, "range": Array [ 0, - 89, + 82, ], - "type": "TSInterfaceDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, + "column": 1, "line": 4, }, "start": Object { @@ -69950,14 +78360,14 @@ Object { }, "range": Array [ 0, - 90, + 82, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 1, }, "start": Object { @@ -69967,43 +78377,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": "Other", }, 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": "{", @@ -70011,89 +78421,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": 8, "line": 2, }, "start": Object { - "column": 18, + "column": 5, "line": 2, }, }, "range": Array [ - 40, - 47, + 19, + 22, ], "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": "foo", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 9, "line": 2, }, "start": Object { - "column": 27, + "column": 8, "line": 2, }, }, "range": Array [ - 49, - 50, + 22, + 23, ], "type": "Punctuator", "value": "(", @@ -70101,107 +78475,53 @@ 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, + "column": 10, "line": 2, }, "start": Object { - "column": 38, + "column": 9, "line": 2, }, }, "range": Array [ - 60, - 61, + 23, + 24, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 14, "line": 2, }, "start": Object { - "column": 40, + "column": 11, "line": 2, }, }, "range": Array [ - 62, - 63, + 25, + 28, ], "type": "Identifier", - "value": "e", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 15, "line": 2, }, "start": Object { - "column": 41, + "column": 14, "line": 2, }, }, "range": Array [ - 63, - 64, + 28, + 29, ], "type": "Punctuator", "value": ":", @@ -70209,89 +78529,53 @@ Object { 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, + "column": 20, "line": 2, }, "start": Object { - "column": 48, + "column": 16, "line": 2, }, }, "range": Array [ - 70, - 71, + 30, + 34, ], - "type": "Punctuator", - "value": ")", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 52, + "column": 22, "line": 2, }, "start": Object { - "column": 50, + "column": 21, "line": 2, }, }, "range": Array [ - 72, - 74, + 35, + 36, ], "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", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 58, + "column": 23, "line": 2, }, "start": Object { - "column": 57, + "column": 22, "line": 2, }, }, "range": Array [ - 79, - 80, + 36, + 37, ], "type": "Punctuator", "value": ")", @@ -70299,768 +78583,490 @@ Object { 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, + "column": 10, + "line": 3, }, "start": Object { - "column": 60, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 82, - 86, + 42, + 48, ], "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": ";", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 14, "line": 3, }, "start": Object { - "column": 0, + "column": 11, "line": 3, }, }, "range": Array [ - 88, - 89, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/unique-symbol.src 1`] = ` -Object { - "body": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 23, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "operator": "unique", - "range": Array [ - 9, - 22, - ], - "type": "TSTypeOperator", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 22, - ], - "type": "TSSymbolKeyword", - }, - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 24, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 4, + 49, + 52, ], "type": "Identifier", - "value": "type", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 5, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ - 5, - 6, + 53, + 56, ], "type": "Identifier", - "value": "A", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 7, - "line": 1, + "column": 18, + "line": 3, }, }, "range": Array [ - 7, - 8, + 56, + 57, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 20, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 19, + "line": 3, }, }, "range": Array [ - 9, - 15, + 57, + 58, ], - "type": "Identifier", - "value": "unique", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 22, - "line": 1, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 21, + "line": 3, }, }, "range": Array [ - 16, - 22, + 59, + 60, ], - "type": "Identifier", - "value": "symbol", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 29, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 23, + "line": 3, }, }, "range": Array [ - 22, - 23, + 61, + 67, ], - "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": 34, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 30, + "line": 3, }, }, "range": Array [ - 0, - 17, + 68, + 72, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "this", }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 35, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 34, + "line": 3, }, }, "range": Array [ - 0, - 3, + 72, + 73, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 39, + "line": 3, }, "start": Object { - "column": 4, - "line": 1, + "column": 35, + "line": 3, }, }, "range": Array [ - 4, - 7, + 73, + 77, ], "type": "Identifier", - "value": "foo", + "value": "_bar", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 40, + "line": 3, }, "start": Object { - "column": 7, - "line": 1, + "column": 39, + "line": 3, }, }, "range": Array [ - 7, - 8, + 77, + 78, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 42, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 41, + "line": 3, }, }, "range": Array [ - 9, - 16, + 79, + 80, ], - "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, + 81, + 82, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/var-with-definite-assignment.src 1`] = ` +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-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 { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "hidden", + "range": Array [ + 15, + 21, + ], + "type": "Identifier", }, - }, - "range": Array [ - 8, - 16, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 10, - 16, + 14, + 21, ], - "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": 9, + "line": 3, }, "start": Object { - "column": 6, - "line": 2, + "column": 8, + "line": 3, }, }, + "name": "z", "range": Array [ - 24, - 32, + 30, + 31, ], - "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": 31, "line": 3, }, "start": Object { "column": 4, - "line": 3, + "line": 2, }, }, - "name": "z", "range": Array [ - 38, - 48, + 14, + 53, ], - "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": 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": 14, + "column": 31, "line": 3, }, "start": Object { - "column": 8, + "column": 12, "line": 3, }, }, "range": Array [ - 42, - 48, + 34, + 53, ], - "type": "TSObjectKeyword", + "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", }, }, - "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": 8, + "line": 1, }, - "range": Array [ - 38, - 48, - ], - "type": "VariableDeclarator", }, - ], - "kind": "let", + "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": 15, - "line": 3, + "column": 1, + "line": 4, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 34, - 49, + 0, + 55, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, + "column": 1, "line": 4, }, "start": Object { @@ -71070,7 +79076,7 @@ Object { }, "range": Array [ 0, - 50, + 55, ], "sourceType": "script", "tokens": Array [ @@ -71090,7 +79096,7 @@ Object { 5, ], "type": "Keyword", - "value": "const", + "value": "class", }, Object { "loc": Object { @@ -71108,25 +79114,7 @@ Object { 7, ], "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "!", + "value": "P", }, Object { "loc": Object { @@ -71144,434 +79132,551 @@ Object { 9, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 10, - 16, + 14, + 15, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 16, - 17, + 15, + 21, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "hidden", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 7, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 18, - 21, + 26, + 29, ], - "type": "Keyword", - "value": "var", + "type": "Identifier", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 9, + "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 22, - 23, + 30, + 31, ], "type": "Identifier", - "value": "y", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 10, + "line": 3, }, "start": Object { - "column": 5, - "line": 2, + "column": 9, + "line": 3, }, }, "range": Array [ - 23, - 24, + 31, + 32, ], "type": "Punctuator", - "value": "!", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 6, - "line": 2, + "column": 10, + "line": 3, }, }, "range": Array [ - 24, - 25, + 32, + 33, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 13, + "line": 3, }, "start": Object { - "column": 8, - "line": 2, + "column": 12, + "line": 3, }, }, "range": Array [ - 26, - 32, + 34, + 35, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 20, + "line": 3, }, "start": Object { "column": 14, - "line": 2, + "line": 3, }, }, "range": Array [ - 32, - 33, + 36, + 42, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 25, "line": 3, }, "start": Object { - "column": 0, + "column": 21, "line": 3, }, }, "range": Array [ - 34, - 37, + 43, + 47, ], "type": "Keyword", - "value": "let", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 26, "line": 3, }, "start": Object { - "column": 4, + "column": 25, "line": 3, }, }, "range": Array [ - 38, - 39, + 47, + 48, ], - "type": "Identifier", - "value": "z", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 28, "line": 3, }, "start": Object { - "column": 5, + "column": 26, "line": 3, }, }, "range": Array [ - 39, - 40, + 48, + 50, ], - "type": "Punctuator", - "value": "!", + "type": "Identifier", + "value": "_z", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 29, "line": 3, }, "start": Object { - "column": 6, + "column": 28, "line": 3, }, }, "range": Array [ - 40, - 41, + 50, + 51, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 31, "line": 3, }, "start": Object { - "column": 8, + "column": 30, "line": 3, }, }, "range": Array [ - 42, - 48, + 52, + 53, ], - "type": "Identifier", - "value": "object", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 1, + "line": 4, }, "start": Object { - "column": 14, - "line": 3, + "column": 0, + "line": 4, }, }, "range": Array [ - 48, - 49, + 54, + 55, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/var-with-dotted-type.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": 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, + "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", }, - }, - "range": Array [ - 7, - 14, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { "loc": Object { "end": Object { "column": 14, - "line": 1, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 9, - 14, + 17, + 27, ], - "type": "TSTypeReference", - "typeName": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "y", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 76, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, }, - "start": Object { - "column": 9, - "line": 1, + "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", }, - "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, + "column": 19, + "line": 4, }, "start": Object { - "column": 11, - "line": 1, + "column": 8, + "line": 4, }, }, - "name": "B", + "operator": "=", "range": Array [ - 11, - 12, + 58, + 69, ], - "type": "Identifier", - }, - "type": "TSQualifiedName", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "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", }, - }, - "range": Array [ - 9, - 14, - ], - "right": Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 20, + "line": 4, }, "start": Object { - "column": 13, - "line": 1, + "column": 8, + "line": 4, }, }, - "name": "C", "range": Array [ - 13, - 14, + 58, + 70, ], - "type": "Identifier", + "type": "ExpressionStatement", }, - "type": "TSQualifiedName", + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 48, + 76, + ], + "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": 14, - "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, - 14, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "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": 15, - "line": 1, + "column": 1, + "line": 6, }, "start": Object { "column": 0, @@ -71580,15 +79685,16 @@ Object { }, "range": Array [ 0, - 15, + 78, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 1, + "line": 6, }, "start": Object { "column": 0, @@ -71597,14 +79703,14 @@ Object { }, "range": Array [ 0, - 16, + 78, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -71614,46 +79720,10 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": ":", + "value": "class", }, Object { "loc": Object { @@ -71662,34 +79732,16 @@ Object { "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, "range": Array [ - 9, + 6, 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": "User", }, Object { "loc": Object { @@ -71706,642 +79758,401 @@ Object { 11, 12, ], - "type": "Identifier", - "value": "B", - }, - 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": "Identifier", - "value": "C", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 14, - 15, + 17, + 18, ], "type": "Punctuator", - "value": ";", + "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", - }, - ], - "kind": "var", "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 5, + "line": 2, }, }, - "range": Array [ - 0, - 29, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 34, - 45, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 37, - 45, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 39, - 45, - ], - "type": "TSStringKeyword", - }, - }, - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 48, - 53, - ], - "raw": "\\"Bar\\"", - "type": "Literal", - "value": "Bar", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 34, - 53, - ], - "type": "VariableDeclarator", - }, + "range": Array [ + 18, + 27, ], - "kind": "var", + "type": "Identifier", + "value": "adminonly", + }, + Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 10, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 30, - 54, + 32, + 38, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "static", }, - }, - "range": Array [ - 0, - 55, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 3, }, }, "range": Array [ - 0, - 3, + 39, + 42, ], - "type": "Keyword", - "value": "var", + "type": "Identifier", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 16, + "line": 3, }, "start": Object { - "column": 4, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ - 4, - 8, + 43, + 44, ], "type": "Identifier", - "value": "name", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 17, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 16, + "line": 3, }, }, "range": Array [ - 8, - 9, + 44, + 45, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 17, + "line": 3, }, }, "range": Array [ - 9, - 15, + 45, + 46, ], "type": "Identifier", - "value": "string", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 18, + "line": 3, }, }, "range": Array [ - 16, - 17, + 46, + 47, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 21, + "line": 3, }, "start": Object { - "column": 18, - "line": 1, + "column": 20, + "line": 3, }, }, "range": Array [ - 18, - 28, + 48, + 49, ], - "type": "String", - "value": "\\"Nicholas\\"", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 12, + "line": 4, }, "start": Object { - "column": 28, - "line": 1, + "column": 8, + "line": 4, }, }, "range": Array [ - 28, - 29, + 58, + 62, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 13, + "line": 4, }, "start": Object { - "column": 0, - "line": 2, + "column": 12, + "line": 4, }, }, "range": Array [ - 30, - 33, + 62, + 63, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 15, + "line": 4, }, "start": Object { - "column": 4, - "line": 2, + "column": 13, + "line": 4, }, }, "range": Array [ - 34, - 37, + 63, + 65, ], "type": "Identifier", - "value": "foo", + "value": "_y", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 17, + "line": 4, }, "start": Object { - "column": 7, - "line": 2, + "column": 16, + "line": 4, }, }, "range": Array [ - 37, - 38, + 66, + 67, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 19, + "line": 4, }, "start": Object { - "column": 9, - "line": 2, + "column": 18, + "line": 4, }, }, "range": Array [ - 39, - 45, + 68, + 69, ], "type": "Identifier", - "value": "string", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 20, + "line": 4, }, "start": Object { - "column": 16, - "line": 2, + "column": 19, + "line": 4, }, }, "range": Array [ - 46, - 47, + 69, + 70, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 5, + "line": 5, }, "start": Object { - "column": 18, - "line": 2, + "column": 4, + "line": 5, }, }, "range": Array [ - 48, - 53, + 75, + 76, ], - "type": "String", - "value": "\\"Bar\\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 1, + "line": 6, }, "start": Object { - "column": 23, - "line": 2, + "column": 0, + "line": 6, }, }, "range": Array [ - 53, - 54, + 77, + 78, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/variable-declaration-type-annotation-spacing.src 1`] = ` +exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ + "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 { - "id": Object { + "expression": Object { "loc": Object { "end": Object { - "column": 21, + "column": 7, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, - "name": "x", + "name": "sealed", "range": Array [ - 4, - 21, + 1, + 7, ], "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 21, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 21, - ], - "type": "TSStringKeyword", - }, - }, }, - "init": null, "loc": Object { "end": Object { - "column": 21, + "column": 7, "line": 1, }, "start": Object { - "column": 4, + "column": 0, "line": 1, }, }, "range": Array [ - 4, - 21, + 0, + 7, ], - "type": "VariableDeclarator", + "type": "Decorator", }, ], - "kind": "let", + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "Qux", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { "column": 0, @@ -72350,15 +80161,16 @@ Object { }, "range": Array [ 0, - 22, + 20, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { "column": 0, @@ -72367,14 +80179,14 @@ Object { }, "range": Array [ 0, - 22, + 20, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -72384,134 +80196,283 @@ Object { }, "range": Array [ 0, - 3, + 1, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, "range": Array [ - 4, - 5, + 1, + 7, ], "type": "Identifier", - "value": "x", + "value": "sealed", }, 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": "class", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 6, + "line": 2, }, }, "range": Array [ - 15, - 21, + 14, + 17, ], "type": "Identifier", - "value": "string", + "value": "Qux", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 21, - 22, + 18, + 19, ], "type": "Punctuator", - "value": ";", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/declare/abstract-class.src 1`] = ` +exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = ` Object { "body": Array [ Object { - "abstract": true, "body": Object { "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 21, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 56, + 58, + ], + "type": "ClassBody", + }, + "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", }, - "start": Object { - "column": 27, - "line": 1, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 36, + ], + "type": "Decorator", }, - "range": Array [ - 27, - 31, - ], - "type": "ClassBody", - }, - "declare": true, + ], "id": Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 18, + "line": 4, }, "start": Object { - "column": 23, - "line": 1, + "column": 6, + "line": 4, }, }, - "name": "Foo", + "name": "FooComponent", "range": Array [ - 23, - 26, + 43, + 55, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 21, + "line": 4, }, "start": Object { "column": 0, @@ -72520,7 +80481,7 @@ Object { }, "range": Array [ 0, - 31, + 58, ], "superClass": null, "type": "ClassDeclaration", @@ -72528,7 +80489,7 @@ Object { ], "loc": Object { "end": Object { - "column": 0, + "column": 21, "line": 4, }, "start": Object { @@ -72538,14 +80499,14 @@ Object { }, "range": Array [ 0, - 32, + 58, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 1, "line": 1, }, "start": Object { @@ -72555,147 +80516,138 @@ 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": "Identifier", - "value": "abstract", + "value": "Component", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 11, "line": 1, }, "start": Object { - "column": 17, + "column": 10, "line": 1, }, }, "range": Array [ - 17, - 22, + 10, + 11, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 12, "line": 1, }, "start": Object { - "column": 23, + "column": 11, "line": 1, }, }, "range": Array [ - 23, - 26, + 11, + 12, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 27, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 27, - 28, + 17, + 25, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "selector", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 13, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 12, + "line": 2, }, }, "range": Array [ - 30, - 31, + 25, + 26, ], "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": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, }, - "range": Array [ - 18, - 22, - ], - "type": "ClassBody", }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "range": Array [ + 27, + 32, + ], + "type": "String", + "value": "'foo'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, }, - "name": "Foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ",", + }, + Object { "loc": Object { "end": Object { "column": 1, @@ -72703,65 +80655,48 @@ Object { }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 22, + 34, + 35, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 23, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 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": 13, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 8, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 8, - 13, + 37, + 42, ], "type": "Keyword", "value": "class", @@ -72769,35 +80704,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 18, + "line": 4, }, "start": Object { - "column": 14, - "line": 1, + "column": 6, + "line": 4, }, }, "range": Array [ - 14, - 17, + 43, + 55, ], "type": "Identifier", - "value": "Foo", + "value": "FooComponent", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 20, + "line": 4, }, "start": Object { - "column": 18, - "line": 1, + "column": 19, + "line": 4, }, }, "range": Array [ - 18, - 19, + 56, + 57, ], "type": "Punctuator", "value": "{", @@ -72805,17 +80740,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 [ - 21, - 22, + 57, + 58, ], "type": "Punctuator", "value": "}", @@ -72825,26 +80760,197 @@ Object { } `; -exports[`typescript fixtures/declare/enum.src 1`] = ` +exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-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": 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": 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": "B", "range": Array [ - 13, - 16, + 6, + 7, ], "type": "Identifier", }, @@ -72858,83 +80964,12 @@ Object { "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", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 23, - 26, - ], - "type": "TSEnumMember", - }, - 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, + 56, ], - "type": "TSEnumDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { @@ -72949,14 +80984,14 @@ Object { }, "range": Array [ 0, - 38, + 57, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -72966,61 +81001,43 @@ Object { }, "range": Array [ 0, - 7, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 12, + 5, ], "type": "Keyword", - "value": "enum", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 7, "line": 1, }, "start": Object { - "column": 13, + "column": 6, "line": 1, }, }, "range": Array [ - 13, - 16, + 6, + 7, ], "type": "Identifier", - "value": "Foo", + "value": "B", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 9, "line": 1, }, "start": Object { - "column": 17, + "column": 8, "line": 1, }, }, "range": Array [ - 17, - 18, + 8, + 9, ], "type": "Punctuator", "value": "{", @@ -73028,7 +81045,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 2, }, "start": Object { @@ -73037,341 +81054,395 @@ Object { }, }, "range": Array [ - 23, - 26, + 14, + 15, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 13, "line": 2, }, "start": Object { - "column": 7, + "column": 5, "line": 2, }, }, "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 32, - 35, + 15, + 23, ], "type": "Identifier", - "value": "Baz", + "value": "onlyRead", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 14, + "line": 2, }, "start": Object { - "column": 0, - "line": 4, + "column": 13, + "line": 2, }, }, "range": Array [ - 36, - 37, + 23, + 24, ], "type": "Punctuator", - "value": "}", + "value": "(", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/function.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "declare": true, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 17, - 20, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 2, }, }, - "params": Array [], "range": Array [ - 0, - 28, + 24, + 29, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 28, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSDeclareFunction", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Boolean", + "value": "false", }, - }, - "range": Array [ - 0, - 29, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 0, - 7, + 29, + 30, ], - "type": "Identifier", - "value": "declare", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 8, - 16, + 35, + 49, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "instanceMethod", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 18, + "line": 3, }, }, "range": Array [ - 17, - 20, + 49, + 50, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 20, + "line": 3, }, "start": Object { - "column": 20, - "line": 1, + "column": 19, + "line": 3, }, }, "range": Array [ - 20, - 21, + 50, + 51, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 22, - "line": 1, + "line": 3, }, "start": Object { "column": 21, - "line": 1, + "line": 3, }, }, "range": Array [ - 21, - 22, + 52, + 53, ], "type": "Punctuator", - "value": ")", + "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": 28, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 24, - 28, + 55, + 56, ], - "type": "Keyword", - "value": "void", + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/declare/interface.src 1`] = ` +exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-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": 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": 3, + "line": 4, }, "start": Object { - "column": 22, + "column": 8, "line": 1, }, }, "range": Array [ - 22, - 26, + 8, + 56, ], - "type": "TSInterfaceBody", + "type": "ClassBody", }, - "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 21, + "column": 7, "line": 1, }, "start": Object { - "column": 18, + "column": 6, "line": 1, }, }, - "name": "Foo", + "name": "C", "range": Array [ - 18, - 21, + 6, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -73380,15 +81451,16 @@ Object { }, "range": Array [ 0, - 26, + 56, ], - "type": "TSInterfaceDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 5, }, "start": Object { "column": 0, @@ -73397,14 +81469,14 @@ Object { }, "range": Array [ 0, - 27, + 57, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -73414,61 +81486,43 @@ Object { }, "range": Array [ 0, - 7, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 17, + 5, ], "type": "Keyword", - "value": "interface", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 7, "line": 1, }, "start": Object { - "column": 18, + "column": 6, "line": 1, }, }, "range": Array [ - 18, - 21, + 6, + 7, ], "type": "Identifier", - "value": "Foo", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 9, "line": 1, }, "start": Object { - "column": 22, + "column": 8, "line": 1, }, }, "range": Array [ - 22, - 23, + 8, + 9, ], "type": "Punctuator", "value": "{", @@ -73476,391 +81530,384 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 5, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 4, + "line": 2, }, }, "range": Array [ - 25, - 26, + 14, + 15, ], "type": "Punctuator", - "value": "}", + "value": "@", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/declare/module.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 23, - ], - "type": "TSModuleBlock", - }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 8, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 0, - 23, + 15, + 18, ], - "type": "TSModuleDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "Foo", }, - }, - "range": Array [ - 0, - 24, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 0, - 7, + 18, + 19, ], - "type": "Identifier", - "value": "declare", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 14, - "line": 1, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 8, - 14, + 19, + 24, ], - "type": "Identifier", - "value": "module", + "type": "Boolean", + "value": "false", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 15, - 18, + 24, + 25, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 19, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 19, - 20, + 30, + 36, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 23, "line": 3, }, "start": Object { - "column": 0, + "column": 11, "line": 3, }, }, "range": Array [ - 22, - 23, + 37, + 49, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "staticMethod", }, - ], - "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, + "column": 24, "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 23, + "line": 3, }, }, "range": Array [ - 0, - 26, + 49, + 50, ], - "type": "TSModuleDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 0, - 27, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 25, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 24, + "line": 3, }, }, "range": Array [ - 0, - 7, + 50, + 51, ], - "type": "Identifier", - "value": "declare", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 27, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 26, + "line": 3, }, }, "range": Array [ - 8, - 17, + 52, + 53, ], - "type": "Identifier", - "value": "namespace", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 28, + "line": 3, }, "start": Object { - "column": 18, - "line": 1, + "column": 27, + "line": 3, }, }, "range": Array [ - 18, - 21, + 53, + 54, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 22, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 22, - 23, + 55, + 56, ], "type": "Punctuator", - "value": "{", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, + "body": Object { + "body": Array [ + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "instanceMethod", + "range": Array [ + 28, + 42, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 47, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, + "range": Array [ + 8, + 49, + ], + "type": "ClassBody", }, - "range": Array [ - 25, - 26, - ], - "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, + "column": 7, "line": 1, }, "start": Object { - "column": 13, + "column": 6, "line": 1, }, }, - "name": "Foo", + "name": "A", "range": Array [ - 13, - 16, + 6, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -73869,32 +81916,16 @@ Object { }, "range": Array [ 0, - 25, + 49, ], - "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", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 5, }, "start": Object { "column": 0, @@ -73903,14 +81934,14 @@ Object { }, "range": Array [ 0, - 26, + 50, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -73920,313 +81951,197 @@ Object { }, "range": Array [ 0, - 7, + 5, ], - "type": "Identifier", - "value": "declare", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 7, "line": 1, }, "start": Object { - "column": 8, + "column": 6, "line": 1, }, }, "range": Array [ - 8, - 12, + 6, + 7, ], "type": "Identifier", - "value": "type", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, "range": Array [ - 13, - 16, + 8, + 9, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 17, - 18, + 14, + 15, ], "type": "Punctuator", - "value": "=", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 19, - 25, + 15, + 23, ], "type": "Identifier", - "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": 21, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 21, - ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "value": "onlyRead", }, - }, - "range": Array [ - 0, - 22, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 0, - 7, + 28, + 42, ], "type": "Identifier", - "value": "declare", + "value": "instanceMethod", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 18, + "line": 3, }, }, "range": Array [ - 8, - 11, + 42, + 43, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 20, + "line": 3, }, "start": Object { - "column": 12, - "line": 1, + "column": 19, + "line": 3, }, }, "range": Array [ - 12, - 15, + 43, + 44, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 22, + "line": 3, }, "start": Object { - "column": 15, - "line": 1, + "column": 21, + "line": 3, }, }, "range": Array [ - 15, - 16, + 45, + 46, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 23, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 22, + "line": 3, }, }, "range": Array [ - 17, - 20, + 46, + 47, ], - "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, + 48, + 49, ], "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-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -74237,48 +82152,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": 8, "line": 2, }, "start": Object { @@ -74286,15 +82162,16 @@ Object { "line": 2, }, }, + "name": "Foo", "range": Array [ - 19, - 38, + 15, + 18, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 24, + "column": 8, "line": 2, }, "start": Object { @@ -74303,8 +82180,8 @@ Object { }, }, "range": Array [ + 14, 18, - 38, ], "type": "Decorator", }, @@ -74312,25 +82189,25 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 23, "line": 3, }, "start": Object { - "column": 8, + "column": 11, "line": 3, }, }, - "name": "x", + "name": "staticMethod", "range": Array [ - 47, - 48, + 30, + 42, ], "type": "Identifier", }, - "kind": "get", + "kind": "method", "loc": Object { "end": Object { - "column": 31, + "column": 28, "line": 3, }, "start": Object { @@ -74339,99 +82216,28 @@ Object { }, }, "range": Array [ - 18, - 70, + 14, + 47, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "object": Object { - "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", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 31, + "column": 28, "line": 3, }, "start": Object { - "column": 12, + "column": 26, "line": 3, }, }, "range": Array [ - 51, - 70, + 45, + 47, ], "type": "BlockStatement", }, @@ -74440,18 +82246,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 31, + "column": 28, "line": 3, }, "start": Object { - "column": 9, + "column": 23, "line": 3, }, }, "params": Array [], "range": Array [ - 48, - 70, + 42, + 47, ], "type": "FunctionExpression", }, @@ -74463,20 +82269,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 { @@ -74484,10 +82290,10 @@ Object { "line": 1, }, }, - "name": "Point", + "name": "D", "range": Array [ 6, - 11, + 7, ], "type": "Identifier", }, @@ -74503,7 +82309,7 @@ Object { }, "range": Array [ 0, - 72, + 49, ], "superClass": null, "type": "ClassDeclaration", @@ -74511,8 +82317,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -74521,7 +82327,7 @@ Object { }, "range": Array [ 0, - 72, + 50, ], "sourceType": "script", "tokens": Array [ @@ -74546,7 +82352,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 1, }, "start": Object { @@ -74556,25 +82362,25 @@ Object { }, "range": Array [ 6, - 11, + 7, ], "type": "Identifier", - "value": "Point", + "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": "{", @@ -74591,8 +82397,8 @@ Object { }, }, "range": Array [ - 18, - 19, + 14, + 15, ], "type": "Punctuator", "value": "@", @@ -74600,7 +82406,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 8, "line": 2, }, "start": Object { @@ -74609,70 +82415,16 @@ Object { }, }, "range": Array [ - 19, - 31, + 15, + 18, ], "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": "(", - }, - 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": ")", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 3, }, "start": Object { @@ -74681,44 +82433,44 @@ Object { }, }, "range": Array [ - 43, - 46, + 23, + 29, ], - "type": "Identifier", - "value": "get", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 23, "line": 3, }, "start": Object { - "column": 8, + "column": 11, "line": 3, }, }, "range": Array [ - 47, - 48, + 30, + 42, ], "type": "Identifier", - "value": "x", + "value": "staticMethod", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 24, "line": 3, }, "start": Object { - "column": 9, + "column": 23, "line": 3, }, }, "range": Array [ - 48, - 49, + 42, + 43, ], "type": "Punctuator", "value": "(", @@ -74726,17 +82478,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 25, "line": 3, }, "start": Object { - "column": 10, + "column": 24, "line": 3, }, }, "range": Array [ - 49, - 50, + 43, + 44, ], "type": "Punctuator", "value": ")", @@ -74744,125 +82496,35 @@ 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": 27, "line": 3, }, "start": Object { - "column": 21, - "line": 3, - }, - }, - "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, + 45, + 46, ], "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", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { "column": 28, "line": 3, }, - }, - "range": Array [ - 67, - 68, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 3, - }, "start": Object { - "column": 30, + "column": 27, "line": 3, }, }, "range": Array [ - 69, - 70, + 46, + 47, ], "type": "Punctuator", "value": "}", @@ -74879,8 +82541,8 @@ Object { }, }, "range": Array [ - 71, - 72, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -74890,7 +82552,7 @@ Object { } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -74898,282 +82560,225 @@ Object { "body": Array [ Object { "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 25, - 34, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 30, - 34, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - }, - ], - "range": Array [ - 23, - 36, - ], - "type": "ObjectExpression", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 19, - 37, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 18, - 37, - ], - "type": "Decorator", - }, - ], "key": Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 5, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 2, + "line": 2, }, }, "name": "bar", "range": Array [ - 53, - 56, + 14, + 17, ], "type": "Identifier", }, - "kind": "get", + "kind": "method", "loc": Object { "end": Object { - "column": 42, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 18, - 80, + 14, + 49, ], - "static": true, + "static": false, "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, + "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, }, - }, - "range": Array [ - 68, - 72, ], - "type": "ThisExpression", - }, - "property": Object { + "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": 39, - "line": 3, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 3, + "column": 7, + "line": 2, }, }, - "name": "_bar", "range": Array [ - 73, - 77, + 19, + 32, ], - "type": "Identifier", + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, }, "range": Array [ - 68, - 77, + 18, + 32, ], - "type": "MemberExpression", + "type": "Decorator", + }, + ], + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, }, + }, + "range": Array [ + 33, + 45, + ], + "type": "ArrayPattern", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 40, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 23, - "line": 3, + "column": 28, + "line": 2, }, }, "range": Array [ - 61, - 78, + 40, + 45, ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 3, - }, - "start": Object { - "column": 21, - "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 [ - 59, - 80, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 42, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "params": Array [], + ], "range": Array [ - 56, - 80, + 17, + 49, ], "type": "FunctionExpression", }, @@ -75182,23 +82787,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { - "column": 12, + "column": 10, "line": 1, }, }, "range": Array [ - 12, - 82, + 10, + 51, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { @@ -75206,17 +82811,17 @@ Object { "line": 1, }, }, - "name": "Other", + "name": "Foo", "range": Array [ 6, - 11, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -75225,7 +82830,7 @@ Object { }, "range": Array [ 0, - 82, + 51, ], "superClass": null, "type": "ClassDeclaration", @@ -75233,7 +82838,7 @@ Object { ], "loc": Object { "end": Object { - "column": 1, + "column": 0, "line": 4, }, "start": Object { @@ -75243,7 +82848,7 @@ Object { }, "range": Array [ 0, - 82, + 52, ], "sourceType": "script", "tokens": Array [ @@ -75268,7 +82873,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { @@ -75278,25 +82883,25 @@ Object { }, "range": Array [ 6, - 11, + 9, ], "type": "Identifier", - "value": "Other", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 1, }, "start": Object { - "column": 12, + "column": 10, "line": 1, }, }, "range": Array [ - 12, - 13, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -75308,49 +82913,31 @@ Object { "line": 2, }, "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "@", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, + "column": 2, "line": 2, }, }, "range": Array [ - 19, - 22, + 14, + 17, ], "type": "Identifier", - "value": "foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 2, }, "start": Object { - "column": 8, + "column": 5, "line": 2, }, }, "range": Array [ - 22, - 23, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -75358,20 +82945,20 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 2, }, "start": Object { - "column": 9, + "column": 6, "line": 2, }, }, "range": Array [ - 23, - 24, + 18, + 19, ], "type": "Punctuator", - "value": "{", + "value": "@", }, Object { "loc": Object { @@ -75380,16 +82967,16 @@ Object { "line": 2, }, "start": Object { - "column": 11, + "column": 7, "line": 2, }, }, "range": Array [ - 25, - 28, + 19, + 26, ], "type": "Identifier", - "value": "baz", + "value": "special", }, Object { "loc": Object { @@ -75403,26 +82990,26 @@ Object { }, }, "range": Array [ - 28, - 29, + 26, + 27, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 19, "line": 2, }, "start": Object { - "column": 16, + "column": 15, "line": 2, }, }, "range": Array [ - 30, - 34, + 27, + 31, ], "type": "Boolean", "value": "true", @@ -75430,89 +83017,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 20, "line": 2, }, "start": Object { - "column": 21, + "column": 19, "line": 2, }, }, "range": Array [ - 35, - 36, + 31, + 32, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 22, "line": 2, }, "start": Object { - "column": 22, + "column": 21, "line": 2, }, }, "range": Array [ - 36, - 37, + 33, + 34, ], "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 49, - 52, - ], - "type": "Identifier", - "value": "get", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 26, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 23, + "line": 2, }, }, "range": Array [ - 53, - 56, + 35, + 38, ], "type": "Identifier", "value": "bar", @@ -75520,256 +83071,165 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "range": Array [ - 56, - 57, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 3, - }, - }, - "range": Array [ - 57, - 58, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 3, + "column": 28, + "line": 2, }, "start": Object { - "column": 21, - "line": 3, + "column": 27, + "line": 2, }, }, "range": Array [ - 59, - 60, + 39, + 40, ], "type": "Punctuator", - "value": "{", + "value": "]", }, 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, + "line": 2, }, "start": Object { - "column": 34, - "line": 3, + "column": 28, + "line": 2, }, }, "range": Array [ - 72, - 73, + 40, + 41, ], "type": "Punctuator", - "value": ".", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 35, - "line": 3, + "column": 30, + "line": 2, }, }, "range": Array [ - 73, - 77, + 42, + 45, ], "type": "Identifier", - "value": "_bar", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 3, + "column": 34, + "line": 2, }, "start": Object { - "column": 39, - "line": 3, + "column": 33, + "line": 2, }, }, "range": Array [ - 77, - 78, + 45, + 46, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 3, + "column": 36, + "line": 2, }, "start": Object { - "column": 41, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 79, - 80, + 47, + 48, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 0, - "line": 4, + "column": 36, + "line": 2, }, }, "range": Array [ - 81, - 82, + 48, + 49, ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 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", - }, - ], + "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-decorator-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 15, + "line": 2, }, "start": Object { - "column": 8, - "line": 3, + "column": 4, + "line": 2, }, }, - "name": "z", + "name": "constructor", "range": Array [ - 30, + 20, 31, ], "type": "Identifier", }, - "kind": "get", + "kind": "constructor", "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { "column": 4, @@ -75777,8 +83237,8 @@ Object { }, }, "range": Array [ - 14, - 53, + 20, + 113, ], "static": false, "type": "MethodDefinition", @@ -75787,22 +83247,80 @@ Object { "body": Object { "body": Array [ Object { - "argument": Object { - "computed": false, + "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": 28, + "column": 33, "line": 3, }, "start": Object { - "column": 21, + "column": 8, "line": 3, }, }, - "object": Object { + "operator": "=", + "range": Array [ + 81, + 106, + ], + "right": Object { + "computed": false, "loc": Object { "end": Object { - "column": 25, + "column": 33, "line": 3, }, "start": Object { @@ -75810,66 +83328,80 @@ Object { "line": 3, }, }, - "range": Array [ - 43, - 47, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 3, + "object": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, }, - "start": Object { - "column": 26, - "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", }, - "name": "_z", "range": Array [ - 48, - 50, + 94, + 106, ], - "type": "Identifier", + "type": "MemberExpression", }, - "range": Array [ - 43, - 50, - ], - "type": "MemberExpression", + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 29, + "column": 34, "line": 3, }, "start": Object { - "column": 14, + "column": 8, "line": 3, }, }, "range": Array [ - 36, - 51, + 81, + 107, ], - "type": "ReturnStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { - "column": 12, - "line": 3, + "column": 55, + "line": 2, }, }, "range": Array [ - 34, - 53, + 71, + 113, ], "type": "BlockStatement", }, @@ -75878,18 +83410,163 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { - "column": 9, - "line": 3, + "column": 15, + "line": 2, }, }, - "params": Array [], + "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": 53, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "name": "config", + "range": Array [ + 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 [ 31, - 53, + 113, ], "type": "FunctionExpression", }, @@ -75898,23 +83575,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, "range": Array [ - 8, - 55, + 14, + 115, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 1, }, "start": Object { @@ -75922,208 +83599,334 @@ Object { "line": 1, }, }, - "name": "P", + "name": "Service", "range": Array [ 6, - 7, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 115, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 116, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "value": "Service", + }, + 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": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + "value": "constructor", + }, + 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": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 0, - 55, + 33, + 39, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "Inject", }, - }, - "range": Array [ - 0, - 55, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 24, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 23, + "line": 2, }, }, "range": Array [ - 0, - 5, + 39, + 40, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 34, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 24, + "line": 2, }, }, "range": Array [ - 6, - 7, + 40, + 50, ], "type": "Identifier", - "value": "P", + "value": "APP_CONFIG", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 35, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 34, + "line": 2, }, }, "range": Array [ - 8, - 9, + 50, + 51, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 42, "line": 2, }, "start": Object { - "column": 4, + "column": 36, "line": 2, }, }, "range": Array [ - 14, - 15, + 52, + 58, ], - "type": "Punctuator", - "value": "@", + "type": "Identifier", + "value": "config", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 43, "line": 2, }, "start": Object { - "column": 5, + "column": 42, "line": 2, }, }, "range": Array [ - 15, - 21, + 58, + 59, ], - "type": "Identifier", - "value": "hidden", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 53, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 44, + "line": 2, }, }, "range": Array [ - 26, - 29, + 60, + 69, ], "type": "Identifier", - "value": "get", + "value": "AppConfig", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 54, + "line": 2, }, "start": Object { - "column": 8, - "line": 3, + "column": 53, + "line": 2, }, }, "range": Array [ - 30, - 31, + 69, + 70, ], - "type": "Identifier", - "value": "z", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 56, + "line": 2, }, "start": Object { - "column": 9, - "line": 3, + "column": 55, + "line": 2, }, }, "range": Array [ - 31, - 32, + 71, + 72, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 3, }, "start": Object { - "column": 10, + "column": 8, "line": 3, }, }, "range": Array [ - 32, - 33, + 81, + 85, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { @@ -76137,11 +83940,29 @@ Object { }, }, "range": Array [ - 34, - 35, + 85, + 86, ], "type": "Punctuator", - "value": "{", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "value": "title", }, Object { "loc": Object { @@ -76150,21 +83971,21 @@ Object { "line": 3, }, "start": Object { - "column": 14, + "column": 19, "line": 3, }, }, "range": Array [ - 36, - 42, + 92, + 93, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 27, "line": 3, }, "start": Object { @@ -76173,26 +83994,26 @@ Object { }, }, "range": Array [ - 43, - 47, + 94, + 100, ], - "type": "Keyword", - "value": "this", + "type": "Identifier", + "value": "config", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 28, "line": 3, }, "start": Object { - "column": 25, + "column": 27, "line": 3, }, }, "range": Array [ - 47, - 48, + 100, + 101, ], "type": "Punctuator", "value": ".", @@ -76200,35 +84021,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 33, "line": 3, }, "start": Object { - "column": 26, + "column": 28, "line": 3, }, }, "range": Array [ - 48, - 50, + 101, + 106, ], "type": "Identifier", - "value": "_z", + "value": "title", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 34, "line": 3, }, "start": Object { - "column": 28, + "column": 33, "line": 3, }, }, "range": Array [ - 50, - 51, + 106, + 107, ], "type": "Punctuator", "value": ";", @@ -76236,17 +84057,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { - "column": 30, - "line": 3, + "column": 4, + "line": 4, }, }, "range": Array [ - 52, - 53, + 112, + 113, ], "type": "Punctuator", "value": "}", @@ -76255,16 +84076,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { "column": 0, - "line": 4, + "line": 5, }, }, "range": Array [ - 54, - 55, + 114, + 115, ], "type": "Punctuator", "value": "}", @@ -76274,7 +84095,7 @@ Object { } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -76282,66 +84103,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": 7, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 4, + "line": 2, }, }, - "name": "y", + "name": "bar", "range": Array [ - 43, - 44, + 16, + 19, ], "type": "Identifier", }, - "kind": "set", + "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 38, + "line": 2, }, "start": Object { "column": 4, @@ -76349,135 +84133,28 @@ Object { }, }, "range": Array [ - 17, - 76, + 16, + 50, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 58, - 62, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, - }, - }, - "name": "_y", - "range": Array [ - 63, - 65, - ], - "type": "Identifier", - }, - "range": Array [ - 58, - 65, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "operator": "=", - "range": Array [ - 58, - 69, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "name": "a", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 58, - 70, - ], - "type": "ExpressionStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 38, + "line": 2, }, "start": Object { - "column": 20, - "line": 3, + "column": 36, + "line": 2, }, }, "range": Array [ 48, - 76, + 50, ], "type": "BlockStatement", }, @@ -76486,37 +84163,146 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 38, + "line": 2, }, "start": Object { - "column": 16, - "line": 3, + "column": 7, + "line": 2, }, }, "params": Array [ Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 34, + ], + "type": "Decorator", + }, + ], "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 34, + "line": 2, }, "start": Object { - "column": 17, - "line": 3, + "column": 23, + "line": 2, }, }, - "name": "a", + "name": "baz", "range": Array [ - 45, + 35, 46, ], "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + }, }, ], "range": Array [ - 44, - 76, + 19, + 50, ], "type": "FunctionExpression", }, @@ -76525,23 +84311,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 3, }, "start": Object { - "column": 11, + "column": 10, "line": 1, }, }, "range": Array [ - 11, - 78, + 10, + 52, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 9, "line": 1, }, "start": Object { @@ -76549,17 +84335,17 @@ Object { "line": 1, }, }, - "name": "User", + "name": "Foo", "range": Array [ 6, - 10, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 3, }, "start": Object { "column": 0, @@ -76568,7 +84354,7 @@ Object { }, "range": Array [ 0, - 78, + 52, ], "superClass": null, "type": "ClassDeclaration", @@ -76576,8 +84362,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -76586,7 +84372,7 @@ Object { }, "range": Array [ 0, - 78, + 53, ], "sourceType": "script", "tokens": Array [ @@ -76611,7 +84397,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 9, "line": 1, }, "start": Object { @@ -76621,25 +84407,25 @@ Object { }, "range": Array [ 6, - 10, + 9, ], "type": "Identifier", - "value": "User", + "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": "{", @@ -76647,7 +84433,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 2, }, "start": Object { @@ -76656,98 +84442,80 @@ Object { }, }, "range": Array [ - 17, - 18, + 16, + 19, ], - "type": "Punctuator", - "value": "@", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 2, }, "start": Object { - "column": 5, + "column": 7, "line": 2, }, }, "range": Array [ - 18, - 27, - ], - "type": "Identifier", - "value": "adminonly", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 32, - 38, + 19, + 20, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 9, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 8, + "line": 2, }, }, "range": Array [ - 39, - 42, + 20, + 21, ], - "type": "Identifier", - "value": "set", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 3, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 9, + "line": 2, }, }, "range": Array [ - 43, - 44, + 21, + 28, ], "type": "Identifier", - "value": "y", + "value": "special", }, Object { "loc": Object { "end": Object { "column": 17, - "line": 3, + "line": 2, }, "start": Object { "column": 16, - "line": 3, + "line": 2, }, }, "range": Array [ - 44, - 45, + 28, + 29, ], "type": "Punctuator", "value": "(", @@ -76755,421 +84523,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 21, + "line": 2, }, "start": Object { "column": 17, - "line": 3, + "line": 2, }, }, "range": Array [ - 45, - 46, + 29, + 33, ], - "type": "Identifier", - "value": "a", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 22, + "line": 2, }, "start": Object { - "column": 18, - "line": 3, - }, - }, - "range": Array [ - 46, - 47, - ], - "type": "Punctuator", - "value": ")", - }, - 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, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 58, - 62, - ], - "type": "Keyword", - "value": "this", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 62, - 63, - ], - "type": "Punctuator", - "value": ".", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, - }, - }, - "range": Array [ - 63, - 65, - ], - "type": "Identifier", - "value": "_y", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 16, - "line": 4, + "line": 2, }, }, "range": Array [ - 66, - 67, + 33, + 34, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 26, + "line": 2, }, "start": Object { - "column": 18, - "line": 4, + "column": 23, + "line": 2, }, }, "range": Array [ - 68, - 69, + 35, + 38, ], "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, - }, - "range": Array [ - 69, - 70, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "range": Array [ - 75, - 76, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 6, - }, - }, - "range": Array [ - 77, - 78, - ], - "type": "Punctuator", - "value": "}", + "value": "baz", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 18, - 20, - ], - "type": "ClassBody", - }, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "sealed", - "range": Array [ - 1, - 7, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 7, - ], - "type": "Decorator", - }, - ], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "name": "Qux", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 12, + "column": 27, "line": 2, }, "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 20, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 20, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 0, - 1, + 38, + 39, ], "type": "Punctuator", - "value": "@", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 34, + "line": 2, }, "start": Object { - "column": 1, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 1, - 7, + 40, + 46, ], "type": "Identifier", - "value": "sealed", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 35, "line": 2, }, "start": Object { - "column": 0, + "column": 34, "line": 2, }, }, "range": Array [ - 8, - 13, + 46, + 47, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 37, "line": 2, }, "start": Object { - "column": 6, + "column": 36, "line": 2, }, }, "range": Array [ - 14, - 17, + 48, + 49, ], - "type": "Identifier", - "value": "Qux", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 38, "line": 2, }, "start": Object { - "column": 10, + "column": 37, "line": 2, }, }, "range": Array [ - 18, - 19, + 49, + 50, ], "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 [ - 19, - 20, + 51, + 52, ], "type": "Punctuator", "value": "}", @@ -77179,183 +84687,257 @@ Object { } `; -exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, - }, - "range": Array [ - 56, - 58, - ], - "type": "ClassBody", - }, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 63, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 45, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 43, + "line": 2, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { + "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 [ + 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": 12, + "column": 29, "line": 2, }, "start": Object { - "column": 4, + "column": 15, "line": 2, }, }, - "name": "selector", "range": Array [ - 17, - 25, + 33, + 47, ], - "type": "Identifier", + "type": "Decorator", }, - "kind": "init", + ], + "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": 19, + "column": 41, "line": 2, }, "start": Object { - "column": 4, + "column": 33, "line": 2, }, }, - "method": false, "range": Array [ - 17, - 32, + 51, + 59, ], - "shorthand": false, - "type": "Property", - "value": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 19, + "column": 41, "line": 2, }, "start": Object { - "column": 14, + "column": 35, "line": 2, }, }, "range": Array [ - 27, - 32, + 53, + 59, ], - "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, + 32, + 63, ], - "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": 16, + "line": 1, }, - "range": Array [ - 0, - 36, - ], - "type": "Decorator", }, - ], + "range": Array [ + 16, + 65, + ], + "type": "ClassBody", + }, "id": Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 15, + "line": 1, }, "start": Object { "column": 6, - "line": 4, + "line": 1, }, }, - "name": "FooComponent", + "name": "StaticFoo", "range": Array [ - 43, - 55, + 6, + 15, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 21, - "line": 4, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -77364,7 +84946,7 @@ Object { }, "range": Array [ 0, - 58, + 65, ], "superClass": null, "type": "ClassDeclaration", @@ -77372,7 +84954,7 @@ Object { ], "loc": Object { "end": Object { - "column": 21, + "column": 0, "line": 4, }, "start": Object { @@ -77382,14 +84964,14 @@ Object { }, "range": Array [ 0, - 58, + 66, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -77399,241 +84981,313 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 10, + 6, + 15, ], "type": "Identifier", - "value": "Component", + "value": "StaticFoo", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 17, "line": 1, }, "start": Object { - "column": 10, + "column": 16, "line": 1, }, }, "range": Array [ - 10, - 11, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, }, "start": Object { "column": 11, - "line": 1, + "line": 2, }, }, "range": Array [ - 11, - 12, + 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": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 16, "line": 2, }, "start": Object { - "column": 4, + "column": 15, "line": 2, }, }, "range": Array [ - 17, - 25, + 33, + 34, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, ], "type": "Identifier", - "value": "selector", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 24, "line": 2, }, "start": Object { - "column": 12, + "column": 23, "line": 2, }, }, "range": Array [ - 25, - 26, + 41, + 42, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 28, "line": 2, }, "start": Object { - "column": 14, + "column": 24, "line": 2, }, }, "range": Array [ - 27, - 32, + 42, + 46, ], - "type": "String", - "value": "'foo'", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 29, "line": 2, }, "start": Object { - "column": 19, + "column": 28, "line": 2, }, }, "range": Array [ - 32, - 33, + 46, + 47, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 30, + "line": 2, }, }, "range": Array [ - 34, - 35, + 48, + 51, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 41, + "line": 2, }, "start": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 35, - 36, + 53, + 59, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 42, + "line": 2, }, "start": Object { - "column": 0, - "line": 4, + "column": 41, + "line": 2, }, }, "range": Array [ - 37, - 42, + 59, + 60, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 44, + "line": 2, }, "start": Object { - "column": 6, - "line": 4, + "column": 43, + "line": 2, }, }, "range": Array [ - 43, - 55, + 61, + 62, ], - "type": "Identifier", - "value": "FooComponent", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 4, + "column": 45, + "line": 2, }, "start": Object { - "column": 19, - "line": 4, + "column": 44, + "line": 2, }, }, "range": Array [ - 56, - 57, + 62, + 63, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 4, + "column": 1, + "line": 3, }, "start": Object { - "column": 20, - "line": 4, + "column": 0, + "line": 3, }, }, "range": Array [ - 57, - 58, + 64, + 65, ], "type": "Punctuator", "value": "}", @@ -77643,7 +85297,7 @@ Object { } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -77651,104 +85305,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": 9, + "line": 2, }, "start": Object { "column": 4, - "line": 3, + "line": 2, }, }, - "name": "instanceMethod", + "name": "greet", "range": Array [ - 35, - 49, + 20, + 25, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { "column": 4, @@ -77756,28 +85335,138 @@ Object { }, }, "range": Array [ - 14, - 54, + 20, + 95, ], "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": 23, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { - "column": 21, - "line": 3, + "column": 34, + "line": 2, }, }, "range": Array [ - 52, - 54, + 50, + 95, ], "type": "BlockStatement", }, @@ -77786,18 +85475,108 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { - "column": 18, - "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", }, @@ -77806,23 +85585,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 { @@ -77830,277 +85609,403 @@ Object { "line": 1, }, }, - "name": "B", + "name": "Greeter", "range": Array [ 6, - 7, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 98, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 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 [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "Identifier", + "value": "greet", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 0, - 56, + 25, + 26, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 0, - 57, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 0, - 5, + 26, + 27, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 6, - 7, + 27, + 35, ], "type": "Identifier", - "value": "B", + "value": "required", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 24, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 8, - 9, + 36, + 40, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 25, "line": 2, }, "start": Object { - "column": 4, + "column": 24, "line": 2, }, }, "range": Array [ - 14, - 15, + 40, + 41, ], "type": "Punctuator", - "value": "@", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 32, "line": 2, }, "start": Object { - "column": 5, + "column": 26, "line": 2, }, }, "range": Array [ - 15, - 23, + 42, + 48, ], "type": "Identifier", - "value": "onlyRead", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 33, "line": 2, }, "start": Object { - "column": 13, + "column": 32, "line": 2, }, }, "range": Array [ - 23, - 24, + 48, + 49, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 35, "line": 2, }, "start": Object { - "column": 14, + "column": 34, "line": 2, }, }, "range": Array [ - 24, - 29, + 50, + 51, ], - "type": "Boolean", - "value": "false", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 19, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 29, - 30, + 60, + 66, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 3, }, "start": Object { - "column": 4, + "column": 15, "line": 3, }, }, "range": Array [ - 35, - 49, + 67, + 75, ], - "type": "Identifier", - "value": "instanceMethod", + "type": "String", + "value": "\\"Hello \\"", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 25, "line": 3, }, "start": Object { - "column": 18, + "column": 24, "line": 3, }, }, "range": Array [ - 49, - 50, + 76, + 77, ], "type": "Punctuator", - "value": "(", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 30, "line": 3, }, "start": Object { - "column": 19, + "column": 26, "line": 3, }, }, "range": Array [ - 50, - 51, + 78, + 82, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 32, "line": 3, }, "start": Object { - "column": 21, + "column": 31, "line": 3, }, }, "range": Array [ - 52, - 53, + 83, + 84, ], "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 [ - 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": "}", @@ -78109,16 +86014,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": "}", @@ -78128,7 +86033,7 @@ Object { } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -78136,153 +86041,278 @@ Object { "body": Array [ Object { "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { + "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": 14, - "line": 2, + "column": 36, + "line": 3, }, "start": Object { - "column": 9, - "line": 2, + "column": 15, + "line": 3, }, }, + "operator": "+", "range": Array [ - 19, - 24, + 80, + 101, ], - "raw": "false", - "type": "Literal", - "value": false, + "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", }, - ], - "callee": Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 37, + "line": 3, }, "start": Object { - "column": 5, - "line": 2, + "column": 8, + "line": 3, }, }, - "name": "Foo", "range": Array [ - 15, - 18, + 73, + 102, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, + "type": "ReturnStatement", }, - "range": Array [ - 15, - 25, - ], - "type": "CallExpression", - }, + ], "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 4, + "column": 41, "line": 2, }, }, "range": Array [ - 14, - 25, + 63, + 108, ], - "type": "Decorator", + "type": "BlockStatement", }, - ], - "key": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { - "column": 11, - "line": 3, + "column": 16, + "line": 2, }, }, - "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, + "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, + }, }, - "start": Object { - "column": 26, - "line": 3, + "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", + }, }, }, - "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, + 38, + 108, ], "type": "FunctionExpression", }, @@ -78291,23 +86321,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { - "column": 8, + "column": 20, "line": 1, }, }, "range": Array [ - 8, - 56, + 20, + 110, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 19, "line": 1, }, "start": Object { @@ -78315,17 +86345,17 @@ Object { "line": 1, }, }, - "name": "C", + "name": "StaticGreeter", "range": Array [ 6, - 7, + 19, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 5, }, "start": Object { "column": 0, @@ -78334,7 +86364,7 @@ Object { }, "range": Array [ 0, - 56, + 110, ], "superClass": null, "type": "ClassDeclaration", @@ -78343,7 +86373,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 6, }, "start": Object { "column": 0, @@ -78352,7 +86382,7 @@ Object { }, "range": Array [ 0, - 57, + 111, ], "sourceType": "script", "tokens": Array [ @@ -78377,7 +86407,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 19, "line": 1, }, "start": Object { @@ -78387,25 +86417,25 @@ Object { }, "range": Array [ 6, - 7, + 19, ], "type": "Identifier", - "value": "C", + "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": "{", @@ -78413,7 +86443,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 2, }, "start": Object { @@ -78422,44 +86452,44 @@ Object { }, }, "range": Array [ - 14, - 15, + 26, + 32, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 16, "line": 2, }, "start": Object { - "column": 5, + "column": 11, "line": 2, }, }, "range": Array [ - 15, - 18, + 33, + 38, ], "type": "Identifier", - "value": "Foo", + "value": "greet", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 17, "line": 2, }, "start": Object { - "column": 8, + "column": 16, "line": 2, }, }, "range": Array [ - 18, - 19, + 38, + 39, ], "type": "Punctuator", "value": "(", @@ -78467,138 +86497,66 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 2, }, "start": Object { - "column": 9, + "column": 17, "line": 2, }, }, "range": Array [ - 19, - 24, + 39, + 40, ], - "type": "Boolean", - "value": "false", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 26, "line": 2, }, "start": Object { - "column": 14, + "column": 18, "line": 2, }, }, "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 37, - 49, + 40, + 48, ], "type": "Identifier", - "value": "staticMethod", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "Punctuator", - "value": "(", + "value": "required", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 31, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { "column": 27, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, + "line": 2, }, }, "range": Array [ - 52, + 49, 53, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 32, + "line": 2, }, "start": Object { - "column": 27, - "line": 3, + "column": 31, + "line": 2, }, }, "range": Array [ @@ -78606,397 +86564,202 @@ Object { 54, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 39, + "line": 2, }, "start": Object { - "column": 0, - "line": 4, + "column": 33, + "line": 2, }, }, "range": Array [ 55, - 56, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "onlyRead", - "range": Array [ - 15, - 23, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 23, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "instanceMethod", - "range": Array [ - 28, - 42, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 47, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 45, - 47, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 42, - 47, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 49, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 49, + 61, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "string", }, - }, - "range": Array [ - 0, - 50, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 40, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 39, + "line": 2, }, }, "range": Array [ - 0, - 5, + 61, + 62, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 42, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 41, + "line": 2, }, }, "range": Array [ - 6, - 7, + 63, + 64, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { "column": 8, - "line": 1, + "line": 3, }, }, "range": Array [ - 8, - 9, + 73, + 79, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 23, + "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 15, + "line": 3, }, }, "range": Array [ - 14, - 15, + 80, + 88, ], - "type": "Punctuator", - "value": "@", + "type": "String", + "value": "\\"Hello \\"", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 25, + "line": 3, }, "start": Object { - "column": 5, - "line": 2, + "column": 24, + "line": 3, }, }, "range": Array [ - 15, - 23, + 89, + 90, ], - "type": "Identifier", - "value": "onlyRead", + "type": "Punctuator", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 3, }, "start": Object { - "column": 4, + "column": 26, "line": 3, }, }, "range": Array [ - 28, - 42, + 91, + 95, ], "type": "Identifier", - "value": "instanceMethod", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 32, "line": 3, }, "start": Object { - "column": 18, + "column": 31, "line": 3, }, }, "range": Array [ - 42, - 43, + 96, + 97, ], "type": "Punctuator", - "value": "(", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 36, "line": 3, }, "start": Object { - "column": 19, + "column": 33, "line": 3, }, }, "range": Array [ - 43, - 44, + 98, + 101, ], - "type": "Punctuator", - "value": ")", + "type": "String", + "value": "\\"!\\"", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 37, "line": 3, }, "start": Object { - "column": 21, + "column": 36, "line": 3, }, }, "range": Array [ - 45, - 46, + 101, + 102, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { - "column": 22, - "line": 3, + "column": 4, + "line": 4, }, }, "range": Array [ - 46, - 47, + 107, + 108, ], "type": "Punctuator", "value": "}", @@ -79005,16 +86768,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": "}", @@ -79024,7 +86787,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 { @@ -79032,77 +86795,40 @@ Object { "body": Array [ Object { "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Decorator", - }, - ], "key": Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 5, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 2, + "line": 2, }, }, - "name": "staticMethod", + "name": "bar", "range": Array [ - 30, - 42, + 14, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ 14, - 47, + 49, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, @@ -79110,17 +86836,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 45, 47, + 49, ], "type": "BlockStatement", }, @@ -79129,18 +86855,204 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 23, - "line": 3, + "column": 5, + "line": 2, }, }, - "params": Array [], + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 32, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 32, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "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 [ + 33, + 45, + ], + "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 [ - 42, - 47, + 17, + 49, ], "type": "FunctionExpression", }, @@ -79149,23 +87061,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 { @@ -79173,17 +87085,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, @@ -79192,7 +87104,7 @@ Object { }, "range": Array [ 0, - 49, + 51, ], "superClass": null, "type": "ClassDeclaration", @@ -79201,7 +87113,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -79210,7 +87122,7 @@ Object { }, "range": Array [ 0, - 50, + 52, ], "sourceType": "script", "tokens": Array [ @@ -79235,7 +87147,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -79245,25 +87157,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": "{", @@ -79271,107 +87183,233 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "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, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, "line": 2, }, "start": Object { - "column": 4, + "column": 21, "line": 2, }, }, "range": Array [ - 14, - 15, + 33, + 34, ], "type": "Punctuator", - "value": "@", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 26, "line": 2, }, "start": Object { - "column": 5, + "column": 23, "line": 2, }, }, "range": Array [ - 15, - 18, + 35, + 38, ], "type": "Identifier", - "value": "Foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 28, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 27, + "line": 2, }, }, "range": Array [ - 23, - 29, + 39, + 40, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 29, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 28, + "line": 2, }, }, "range": Array [ - 30, - 42, + 40, + 41, ], - "type": "Identifier", - "value": "staticMethod", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 23, - "line": 3, + "column": 30, + "line": 2, }, }, "range": Array [ 42, - 43, + 45, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 34, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, + "column": 33, + "line": 2, }, }, "range": Array [ - 43, - 44, + 45, + 46, ], "type": "Punctuator", "value": ")", @@ -79379,17 +87417,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 36, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 45, - 46, + 47, + 48, ], "type": "Punctuator", "value": "{", @@ -79397,17 +87435,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 27, - "line": 3, + "column": 36, + "line": 2, }, }, "range": Array [ - 46, - 47, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -79416,16 +87454,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, - "line": 4, + "line": 3, }, }, "range": Array [ - 48, - 49, + 50, + 51, ], "type": "Punctuator", "value": "}", @@ -79435,7 +87473,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -79446,198 +87484,55 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 15, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, - "name": "constructor", + "name": "bar", "range": Array [ - 20, - 31, + 14, + 17, ], "type": "Identifier", }, - "kind": "constructor", + "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 113, + 14, + 48, ], "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", - }, - ], + "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", }, @@ -79646,16 +87541,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 { @@ -79663,146 +87576,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", }, @@ -79811,23 +87706,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 115, + 10, + 50, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -79835,17 +87730,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, @@ -79854,7 +87749,7 @@ Object { }, "range": Array [ 0, - 115, + 50, ], "superClass": null, "type": "ClassDeclaration", @@ -79863,447 +87758,321 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 116, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 13, - ], - "type": "Identifier", - "value": "Service", - }, - 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": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 20, - 31, - ], - "type": "Identifier", - "value": "constructor", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "(", + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 32, - 33, + 0, + 5, ], - "type": "Punctuator", - "value": "@", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 33, - 39, + 6, + 9, ], "type": "Identifier", - "value": "Inject", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 39, - 40, + 10, + 11, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 5, "line": 2, }, "start": Object { - "column": 24, + "column": 2, "line": 2, }, }, "range": Array [ - 40, - 50, + 14, + 17, ], "type": "Identifier", - "value": "APP_CONFIG", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 6, "line": 2, }, "start": Object { - "column": 34, + "column": 5, "line": 2, }, }, "range": Array [ - 50, - 51, + 17, + 18, ], "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 2, - }, - "start": Object { - "column": 36, - "line": 2, - }, - }, - "range": Array [ - 52, - 58, - ], - "type": "Identifier", - "value": "config", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 7, "line": 2, }, "start": Object { - "column": 42, + "column": 6, "line": 2, }, }, "range": Array [ - 58, - 59, + 18, + 19, ], "type": "Punctuator", - "value": ":", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 53, + "column": 14, "line": 2, }, "start": Object { - "column": 44, + "column": 7, "line": 2, }, }, "range": Array [ - 60, - 69, + 19, + 26, ], "type": "Identifier", - "value": "AppConfig", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 54, + "column": 15, "line": 2, }, "start": Object { - "column": 53, + "column": 14, "line": 2, }, }, "range": Array [ - 69, - 70, + 26, + 27, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 19, "line": 2, }, "start": Object { - "column": 55, + "column": 15, "line": 2, }, }, "range": Array [ - 71, - 72, + 27, + 31, ], - "type": "Punctuator", - "value": "{", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 20, + "line": 2, }, "start": Object { - "column": 8, - "line": 3, + "column": 19, + "line": 2, }, }, "range": Array [ - 81, - 85, + 31, + 32, ], - "type": "Keyword", - "value": "this", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 24, + "line": 2, }, "start": Object { - "column": 12, - "line": 3, + "column": 21, + "line": 2, }, }, "range": Array [ - 85, - 86, + 33, + 36, ], "type": "Punctuator", - "value": ".", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 27, + "line": 2, }, "start": Object { - "column": 13, - "line": 3, + "column": 24, + "line": 2, }, }, "range": Array [ - 86, - 91, + 36, + 39, ], "type": "Identifier", - "value": "title", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 3, + "column": 28, + "line": 2, }, "start": Object { - "column": 19, - "line": 3, + "column": 27, + "line": 2, }, }, "range": Array [ - 92, - 93, + 39, + 40, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 32, + "line": 2, }, "start": Object { - "column": 21, - "line": 3, + "column": 29, + "line": 2, }, }, "range": Array [ - 94, - 100, + 41, + 44, ], "type": "Identifier", - "value": "config", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 27, - "line": 3, + "column": 32, + "line": 2, }, }, "range": Array [ - 100, - 101, + 44, + 45, ], "type": "Punctuator", - "value": ".", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 3, + "column": 35, + "line": 2, }, "start": Object { - "column": 28, - "line": 3, - }, - }, - "range": Array [ - 101, - 106, - ], - "type": "Identifier", - "value": "title", - }, - Object { - "loc": Object { - "end": Object { "column": 34, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, + "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": "}", @@ -80312,16 +88081,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": "}", @@ -80331,7 +88100,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 { @@ -80339,28 +88108,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 { @@ -80369,201 +88192,162 @@ Object { }, }, "range": Array [ - 16, - 50, + 26, + 40, ], "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 36, - "line": 2, - }, - }, - "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": 22, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 20, - 34, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 34, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 35, - 46, - ], - "type": "Identifier", - "typeAnnotation": Object { + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 26, - "line": 2, + "column": 5, + "line": 3, }, }, + "name": "Output", "range": Array [ - 38, 46, + 52, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 40, - 46, - ], - "type": "TSNumberKeyword", + "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 [ - 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 { @@ -80571,17 +88355,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, @@ -80590,7 +88374,7 @@ Object { }, "range": Array [ 0, - 52, + 88, ], "superClass": null, "type": "ClassDeclaration", @@ -80598,8 +88382,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -80608,7 +88392,7 @@ Object { }, "range": Array [ 0, - 53, + 88, ], "sourceType": "script", "tokens": Array [ @@ -80633,7 +88417,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 19, "line": 1, }, "start": Object { @@ -80643,25 +88427,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": "{", @@ -80669,7 +88453,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 2, }, "start": Object { @@ -80678,26 +88462,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": "(", @@ -80705,89 +88507,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 2, }, "start": Object { - "column": 8, + "column": 11, "line": 2, }, }, "range": Array [ - 20, - 21, + 33, + 34, ], "type": "Punctuator", - "value": "@", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 2, }, "start": Object { - "column": 9, + "column": 13, "line": 2, }, }, "range": Array [ - 21, - 28, + 35, + 39, ], "type": "Identifier", - "value": "special", + "value": "data", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 2, }, "start": Object { - "column": 16, + "column": 17, "line": 2, }, }, "range": Array [ - 28, - 29, + 39, + 40, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 17, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 29, - 33, + 45, + 46, ], - "type": "Boolean", - "value": "true", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 21, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 33, - 34, + 46, + 52, + ], + "type": "Identifier", + "value": "Output", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, ], "type": "Punctuator", "value": ")", @@ -80795,125 +88633,143 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 9, + "line": 4, }, "start": Object { - "column": 23, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 35, - 38, + 59, + 64, ], "type": "Identifier", - "value": "baz", + "value": "click", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 11, + "line": 4, }, "start": Object { - "column": 26, - "line": 2, + "column": 10, + "line": 4, }, }, "range": Array [ - 38, - 39, + 65, + 66, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 15, + "line": 4, }, "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 67, + 70, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { "column": 28, - "line": 2, + "line": 4, + }, + "start": Object { + "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": "}", @@ -80922,240 +88778,260 @@ Object { "type": "Program", } `; - -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 29, - 32, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 45, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 22, - 63, - ], - "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 [ - 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", - }, + +exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 2, }, "start": Object { - "column": 15, + "column": 18, "line": 2, }, }, "range": Array [ - 33, - 47, + 28, + 32, ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 41, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, + "raw": "true", + "type": "Literal", + "value": true, }, - }, - "name": "baz", - "range": Array [ - 48, - 59, ], - "type": "Identifier", - "typeAnnotation": Object { + "callee": Object { "loc": Object { "end": Object { - "column": 41, + "column": 17, "line": 2, }, "start": Object { - "column": 33, + "column": 5, "line": 2, }, }, + "name": "configurable", "range": Array [ - 51, - 59, + 15, + 27, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 33, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 33, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "name": "prop1", + "range": Array [ + 41, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 47, + ], + "static": true, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { "loc": Object { "end": Object { - "column": 41, - "line": 2, + "column": 23, + "line": 4, }, "start": Object { - "column": 35, - "line": 2, + "column": 18, + "line": 4, }, }, "range": Array [ - 53, - 59, + 67, + 72, ], - "type": "TSNumberKeyword", + "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 [ - 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 { @@ -81163,17 +89039,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, @@ -81182,7 +89058,7 @@ Object { }, "range": Array [ 0, - 65, + 93, ], "superClass": null, "type": "ClassDeclaration", @@ -81190,8 +89066,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 4, + "column": 1, + "line": 6, }, "start": Object { "column": 0, @@ -81200,7 +89076,7 @@ Object { }, "range": Array [ 0, - 66, + 93, ], "sourceType": "script", "tokens": Array [ @@ -81225,7 +89101,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 1, }, "start": Object { @@ -81235,25 +89111,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": "{", @@ -81261,7 +89137,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 5, "line": 2, }, "start": Object { @@ -81270,44 +89146,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": "(", @@ -81315,20 +89191,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 { @@ -81337,61 +89213,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, }, }, @@ -81400,76 +89276,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": ")", @@ -81477,53 +89371,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": "}", @@ -81533,7 +89445,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 { @@ -81541,29 +89453,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, @@ -81571,251 +89519,87 @@ Object { }, }, "range": Array [ - 20, - 95, + 14, + 21, ], "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", + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, }, - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, + "start": Object { + "column": 5, + "line": 3, }, - "range": Array [ - 60, - 89, - ], - "type": "ReturnStatement", }, - ], + "name": "bar", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 8, + "line": 3, }, "start": Object { - "column": 34, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 50, - 95, + 26, + 30, ], - "type": "BlockStatement", + "type": "Decorator", }, - "expression": false, - "generator": false, - "id": null, + ], + "key": Object { "loc": Object { "end": Object { "column": 5, "line": 4, }, "start": Object { - "column": 9, - "line": 2, + "column": 4, + "line": 4, }, }, - "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", - }, - }, - }, - ], + "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 { @@ -81824,20 +89608,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 { @@ -81845,10 +89629,10 @@ Object { "line": 1, }, }, - "name": "Greeter", + "name": "B", "range": Array [ 6, - 13, + 7, ], "type": "Identifier", }, @@ -81864,7 +89648,7 @@ Object { }, "range": Array [ 0, - 97, + 39, ], "superClass": null, "type": "ClassDeclaration", @@ -81872,8 +89656,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 6, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -81882,7 +89666,7 @@ Object { }, "range": Array [ 0, - 98, + 39, ], "sourceType": "script", "tokens": Array [ @@ -81907,7 +89691,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 7, "line": 1, }, "start": Object { @@ -81917,25 +89701,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": "{", @@ -81943,7 +89727,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 2, }, "start": Object { @@ -81952,44 +89736,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": "@", @@ -81997,254 +89745,128 @@ 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, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 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": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, + "column": 8, "line": 2, }, "start": Object { - "column": 26, + "column": 5, "line": 2, }, }, "range": Array [ - 42, - 48, + 15, + 18, ], "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": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 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": "foo", }, Object { "loc": Object { - "end": Object { - "column": 25, - "line": 3, + "end": Object { + "column": 10, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, + "column": 9, + "line": 2, }, }, "range": Array [ - 76, - 77, + 19, + 20, ], - "type": "Punctuator", - "value": "+", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 11, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 10, + "line": 2, }, }, "range": Array [ - 78, - 82, + 20, + 21, ], - "type": "Identifier", - "value": "name", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 5, "line": 3, }, "start": Object { - "column": 31, + "column": 4, "line": 3, }, }, "range": Array [ - 83, - 84, + 26, + 27, ], "type": "Punctuator", - "value": "+", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 8, "line": 3, }, "start": Object { - "column": 33, + "column": 5, "line": 3, }, }, "range": Array [ - 85, - 88, + 27, + 30, ], - "type": "String", - "value": "\\"!\\"", + "type": "Identifier", + "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 { @@ -82258,8 +89880,8 @@ Object { }, }, "range": Array [ - 96, - 97, + 38, + 39, ], "type": "Punctuator", "value": "}", @@ -82269,7 +89891,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/property-decorators/property-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -82277,29 +89899,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": "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": 16, + "column": 17, "line": 2, }, "start": Object { - "column": 11, + "column": 16, "line": 2, }, }, - "name": "greet", + "name": "a", "range": Array [ - 33, - 38, + 26, + 27, ], "type": "Identifier", }, - "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 18, + "line": 2, }, "start": Object { "column": 4, @@ -82307,251 +89965,87 @@ Object { }, }, "range": Array [ - 26, - 108, + 14, + 28, ], "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", + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, }, - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, + "start": Object { + "column": 5, + "line": 3, }, - "range": Array [ - 73, - 102, - ], - "type": "ReturnStatement", }, - ], + "name": "qux", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 8, + "line": 3, }, "start": Object { - "column": 41, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 63, - 108, + 33, + 37, ], - "type": "BlockStatement", + "type": "Decorator", }, - "expression": false, - "generator": false, - "id": null, + ], + "key": Object { "loc": Object { "end": Object { - "column": 5, + "column": 12, "line": 4, }, "start": Object { - "column": 16, - "line": 2, + "column": 11, + "line": 4, }, }, - "params": Array [ - Object { - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "required", - "range": Array [ - 40, - 48, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 39, - 48, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "name": "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", - }, - }, - }, - ], + "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 { @@ -82560,20 +90054,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 { @@ -82581,10 +90075,10 @@ Object { "line": 1, }, }, - "name": "StaticGreeter", + "name": "C", "range": Array [ 6, - 19, + 7, ], "type": "Identifier", }, @@ -82600,7 +90094,7 @@ Object { }, "range": Array [ 0, - 110, + 53, ], "superClass": null, "type": "ClassDeclaration", @@ -82618,7 +90112,7 @@ Object { }, "range": Array [ 0, - 111, + 54, ], "sourceType": "script", "tokens": Array [ @@ -82643,7 +90137,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 7, "line": 1, }, "start": Object { @@ -82653,25 +90147,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": "{", @@ -82679,7 +90173,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 5, "line": 2, }, "start": Object { @@ -82688,332 +90182,357 @@ Object { }, }, "range": Array [ - 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, + 14, + 15, ], "type": "Punctuator", - "value": "(", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 2, }, "start": Object { - "column": 17, + "column": 5, "line": 2, }, }, "range": Array [ - 39, - 40, + 15, + 18, ], - "type": "Punctuator", - "value": "@", + "type": "Identifier", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 2, }, "start": Object { - "column": 18, + "column": 9, "line": 2, }, }, "range": Array [ - 40, - 48, + 19, + 25, ], - "type": "Identifier", - "value": "required", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 17, "line": 2, }, "start": Object { - "column": 27, + "column": 16, "line": 2, }, }, "range": Array [ - 49, - 53, + 26, + 27, ], "type": "Identifier", - "value": "name", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 18, "line": 2, }, "start": Object { - "column": 31, + "column": 17, "line": 2, }, }, "range": Array [ - 53, - 54, + 27, + 28, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 33, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 55, - 61, + 33, + 34, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 2, + "column": 8, + "line": 3, }, "start": Object { - "column": 39, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 61, - 62, + 34, + 37, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "qux", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 2, + "column": 10, + "line": 4, }, "start": Object { - "column": 41, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 63, - 64, + 42, + 48, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 12, + "line": 4, }, "start": Object { - "column": 8, - "line": 3, + "column": 11, + "line": 4, }, }, "range": Array [ - 73, - 79, + 49, + 50, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 13, + "line": 4, }, "start": Object { - "column": 15, - "line": 3, + "column": 12, + "line": 4, }, }, "range": Array [ - 80, - 88, + 50, + 51, ], - "type": "String", - "value": "\\"Hello \\"", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 1, + "line": 5, }, "start": Object { - "column": 24, - "line": 3, + "column": 0, + "line": 5, }, }, "range": Array [ - 89, - 90, + 52, + 53, ], "type": "Punctuator", - "value": "+", + "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": 30, + "column": 1, "line": 3, }, "start": Object { - "column": 26, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 91, - 95, + 0, + 22, ], - "type": "Identifier", - "value": "name", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 5, + "line": 1, }, "start": Object { - "column": 31, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 96, - 97, + 0, + 5, ], - "type": "Punctuator", - "value": "+", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 3, + "column": 9, + "line": 1, }, "start": Object { - "column": 33, - "line": 3, + "column": 6, + "line": 1, }, }, "range": Array [ - 98, - 101, + 6, + 9, ], - "type": "String", - "value": "\\"!\\"", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 36, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 101, - 102, + 10, + 17, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 19, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 18, + "line": 1, }, }, "range": Array [ - 107, - 108, + 18, + 19, ], "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, + 21, + 22, ], "type": "Punctuator", "value": "}", @@ -83023,254 +90542,274 @@ Object { } `; -exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = ` +exports[`typescript fixtures/errorRecovery/class-empty-extends-implements.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, + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - 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", - }, + "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": 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, - }, + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, }, - "range": Array [ - 67, - 85, - ], - "type": "NewExpression", }, + "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, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 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": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 17, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "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 { @@ -83278,17 +90817,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, @@ -83297,16 +90837,33 @@ 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", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -83315,7 +90872,7 @@ Object { }, "range": Array [ 0, - 88, + 38, ], "sourceType": "script", "tokens": Array [ @@ -83340,7 +90897,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { @@ -83350,349 +90907,563 @@ 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": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 35, - 39, + 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", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 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": "}", @@ -83702,295 +91473,108 @@ 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", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -83999,14 +91583,14 @@ Object { }, "range": Array [ 0, - 93, + 20, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -84016,55 +91600,55 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "@", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 4, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 7, + 1, + 4, ], "type": "Identifier", - "value": "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, }, }, @@ -84072,77 +91656,282 @@ 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 [ - 28, - 32, + 17, + 18, ], - "type": "Boolean", - "value": "true", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 2, }, "start": Object { - "column": 22, + "column": 13, "line": 2, }, }, "range": Array [ - 32, - 33, + 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", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "M", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 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": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, ], "type": "Punctuator", "value": ")", @@ -84150,71 +91939,243 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 9, "line": 2, }, "start": Object { - "column": 24, + "column": 0, "line": 2, }, }, "range": Array [ - 34, - 40, + 8, + 17, ], "type": "Keyword", - "value": "static", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 11, "line": 2, }, "start": Object { - "column": 31, + "column": 10, "line": 2, }, }, "range": Array [ - 41, - 46, + 18, + 19, ], "type": "Identifier", - "value": "prop1", + "value": "M", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 13, "line": 2, }, "start": Object { - "column": 36, + "column": 12, "line": 2, }, }, "range": Array [ - 46, - 47, + 20, + 21, ], "type": "Punctuator", - "value": ";", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/decorator-on-variable.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "VariableDeclarator", + }, + ], + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 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", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "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": "@", @@ -84222,35 +92183,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": "(", @@ -84258,35 +92219,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": ")", @@ -84294,275 +92237,197 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 5, + "line": 2, }, "start": Object { - "column": 4, - "line": 5, + "column": 0, + "line": 2, }, }, "range": Array [ - 78, - 84, + 8, + 13, ], "type": "Keyword", - "value": "static", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 7, + "line": 2, }, "start": Object { - "column": 11, - "line": 5, + "column": 6, + "line": 2, }, }, "range": Array [ - 85, - 90, + 14, + 15, ], "type": "Identifier", - "value": "prop2", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 5, + "column": 9, + "line": 2, }, "start": Object { - "column": 16, - "line": 5, + "column": 8, + "line": 2, }, }, "range": Array [ - 90, - 91, + 16, + 17, ], "type": "Punctuator", - "value": ";", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 11, + "line": 2, }, "start": Object { - "column": 0, - "line": 6, + "column": 10, + "line": 2, }, }, "range": Array [ - 92, - 93, + 18, + 19, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "1", }, ], "type": "Program", } `; -exports[`typescript fixtures/decorators/property-decorators/property-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-arguments.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": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, + }, + "name": "foo", + "range": Array [ + 6, + 16, ], - "key": Object { + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { "column": 9, - "line": 2, + "line": 1, }, }, - "name": "x", "range": Array [ - 19, - 20, + 9, + 16, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 21, - ], - "static": false, - "type": "ClassProperty", - "value": null, - }, - Object { - "computed": false, - "decorators": Array [ - Object { - "expression": Object { + "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": 8, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 5, - "line": 3, + "column": 11, + "line": 1, }, }, - "name": "bar", + "name": "Foo", "range": Array [ - 27, - 30, + 11, + 14, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, }, + "params": Array [], + "range": Array [ + 14, + 16, + ], + "type": "TSTypeParameterInstantiation", }, - "range": Array [ - 26, - 30, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "name": "y", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 6, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 3, }, }, - "range": Array [ - 26, - 37, - ], - "static": false, - "type": "ClassProperty", - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 39, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, }, - "start": Object { - "column": 6, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", }, - "name": "B", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 16, + "line": 1, }, "start": Object { "column": 0, @@ -84571,16 +92436,15 @@ Object { }, "range": Array [ 0, - 39, + 16, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 16, + "line": 1, }, "start": Object { "column": 0, @@ -84589,7 +92453,7 @@ Object { }, "range": Array [ 0, - 39, + 16, ], "sourceType": "script", "tokens": Array [ @@ -84609,12 +92473,12 @@ Object { 5, ], "type": "Keyword", - "value": "class", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -84624,391 +92488,354 @@ Object { }, "range": Array [ 6, - 7, + 9, ], "type": "Identifier", - "value": "B", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 9, "line": 1, }, }, "range": Array [ - 8, 9, + 10, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "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", }, }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "@", - }, - Object { "loc": Object { "end": Object { "column": 8, - "line": 2, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 15, - 18, + 0, + 8, ], - "type": "Identifier", - "value": "foo", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 3, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 19, - 20, + 0, + 3, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 4, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 3, + "line": 1, }, }, "range": Array [ - 20, - 21, + 3, + 4, ], "type": "Punctuator", - "value": ";", + "value": "<", }, Object { "loc": Object { "end": Object { "column": 5, - "line": 3, + "line": 1, }, "start": Object { "column": 4, - "line": 3, + "line": 1, }, }, "range": Array [ - 26, - 27, + 4, + 5, ], "type": "Punctuator", - "value": "@", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 6, + "line": 1, }, "start": Object { "column": 5, - "line": 3, + "line": 1, }, }, "range": Array [ - 27, - 30, + 5, + 6, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - "value": "y", - }, - Object { - "loc": Object { - "end": Object { "column": 6, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, + "line": 1, }, }, "range": Array [ - 36, - 37, + 6, + 7, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 8, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 7, + "line": 1, }, }, "range": Array [ - 38, - 39, + 7, + 8, ], "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-new-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": 7, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "start": Object { + "column": 4, + "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 [ + 4, + 7, + ], + "type": "Identifier", }, - "range": Array [ - 8, - 53, - ], - "type": "ClassBody", - }, - "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 0, "line": 1, }, }, - "name": "C", "range": Array [ - 6, - 7, + 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": 5, + "column": 11, + "line": 1, }, "start": Object { "column": 0, @@ -85017,16 +92844,15 @@ Object { }, "range": Array [ 0, - 53, + 11, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -85035,14 +92861,14 @@ Object { }, "range": Array [ 0, - 54, + 12, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -85052,10 +92878,10 @@ Object { }, "range": Array [ 0, - 5, + 3, ], "type": "Keyword", - "value": "class", + "value": "new", }, Object { "loc": Object { @@ -85064,16 +92890,34 @@ Object { "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, + 4, 7, ], "type": "Identifier", - "value": "C", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { @@ -85091,202 +92935,284 @@ Object { 9, ], "type": "Punctuator", - "value": "{", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Punctuator", - "value": "@", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 15, + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/empty-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f1", + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, 18, ], - "type": "Identifier", - "value": "baz", + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 13, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 19, - 25, + 0, + 8, ], "type": "Keyword", - "value": "static", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 26, - 27, + 9, + 11, ], "type": "Identifier", - "value": "a", + "value": "f1", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 27, - 28, + 11, + 12, ], "type": "Punctuator", - "value": ";", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 13, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 12, + "line": 1, }, }, "range": Array [ - 33, - 34, + 12, + 13, ], "type": "Punctuator", - "value": "@", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - "value": "qux", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 14, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 13, + "line": 1, }, }, "range": Array [ - 42, - 48, + 13, + 14, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 15, + "line": 1, }, "start": Object { - "column": 11, - "line": 4, + "column": 14, + "line": 1, }, }, "range": Array [ - 49, - 50, + 14, + 15, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 12, - "line": 4, + "column": 16, + "line": 1, }, }, "range": Array [ - 50, - 51, + 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 [ - 52, - 53, + 17, + 18, ], "type": "Punctuator", "value": "}", @@ -85296,68 +93222,89 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/class-empty-extends.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": 18, + "column": 16, "line": 1, }, }, "range": Array [ + 16, 18, - 22, ], - "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", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 22, + 18, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 13, + ], + "type": "TSTypeParameterDeclaration", + }, }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -85366,14 +93313,14 @@ Object { }, "range": Array [ 0, - 23, + 19, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -85383,61 +93330,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": 19, + "column": 13, "line": 1, }, "start": Object { - "column": 18, + "column": 12, "line": 1, }, }, "range": Array [ - 18, - 19, + 12, + 13, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 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, ], "type": "Punctuator", "value": "{", @@ -85445,17 +93446,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 [ - 21, - 22, + 17, + 18, ], "type": "Punctuator", "value": "}", @@ -85465,25 +93466,122 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/class-empty-extends-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": 1, "line": 3, }, "start": Object { - "column": 33, + "column": 10, "line": 1, }, }, "range": Array [ - 33, - 37, + 10, + 34, ], "type": "ClassBody", }, @@ -85498,50 +93596,13 @@ Object { "line": 1, }, }, - "name": "Foo", + "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": 1, @@ -85554,7 +93615,7 @@ Object { }, "range": Array [ 0, - 37, + 34, ], "superClass": null, "type": "ClassDeclaration", @@ -85569,120 +93630,192 @@ Object { "column": 0, "line": 1, }, - }, - "range": Array [ - 0, - 38, - ], - "sourceType": "script", - "tokens": Array [ + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 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": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 0, - 5, + 25, + 26, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 6, - 9, + 26, + 27, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 10, - 17, + 27, + 28, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 18, 28, + 29, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 29, - 32, + 30, + 31, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 33, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 33, - 34, + 31, + 32, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { @@ -85696,8 +93829,8 @@ Object { }, }, "range": Array [ - 36, - 37, + 33, + 34, ], "type": "Punctuator", "value": "}", @@ -85707,51 +93840,110 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/class-extends-empty-implements.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 1, + "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", }, - }, - "range": Array [ - 33, - 37, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 12, + 27, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 20, + 22, + ], + "type": "TSTypeParameterDeclaration", + }, }, - "start": Object { - "column": 6, - "line": 1, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "range": Array [ + 6, + 27, + ], + "type": "VariableDeclarator", }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "implements": Array [], + ], + "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 27, + "line": 1, }, "start": Object { "column": 0, @@ -85760,33 +93952,15 @@ Object { }, "range": Array [ 0, - 37, + 27, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 18, - 21, - ], - "type": "Identifier", - }, - "type": "ClassDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -85795,7 +93969,7 @@ Object { }, "range": Array [ 0, - 38, + 28, ], "sourceType": "script", "tokens": Array [ @@ -85815,7 +93989,7 @@ Object { 5, ], "type": "Keyword", - "value": "class", + "value": "const", }, Object { "loc": Object { @@ -85833,12 +94007,12 @@ Object { 9, ], "type": "Identifier", - "value": "Foo", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { @@ -85848,10 +94022,28 @@ Object { }, "range": Array [ 10, - 17, + 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": "extends", + "value": "function", }, Object { "loc": Object { @@ -85860,21 +94052,39 @@ Object { "line": 1, }, "start": Object { - "column": 18, + "column": 20, "line": 1, }, }, "range": Array [ - 18, + 20, 21, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 32, + "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 { @@ -85884,25 +94094,43 @@ Object { }, "range": Array [ 22, - 32, + 23, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 24, "line": 1, }, "start": Object { - "column": 33, + "column": 23, "line": 1, }, }, "range": Array [ - 33, - 34, + 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": "{", @@ -85910,17 +94138,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 27, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 26, + "line": 1, }, }, "range": Array [ - 36, - 37, + 26, + 27, ], "type": "Punctuator", "value": "}", @@ -85930,87 +94158,147 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/class-multiple-implements.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-method.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [], + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "test", + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "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", + }, + }, + }, + ], "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 34, + "column": 10, "line": 1, }, }, "range": Array [ - 34, - 36, + 10, + 27, ], "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, - }, + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "range": Array [ - 19, - 20, - ], - "type": "TSClassImplements", }, - ], + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -86019,7 +94307,7 @@ Object { }, "range": Array [ 0, - 36, + 27, ], "superClass": null, "type": "ClassDeclaration", @@ -86028,7 +94316,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -86037,7 +94325,7 @@ Object { }, "range": Array [ 0, - 37, + 28, ], "sourceType": "script", "tokens": Array [ @@ -86062,7 +94350,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -86072,321 +94360,169 @@ Object { }, "range": Array [ 6, - 7, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 18, - ], - "type": "Keyword", - "value": "implements", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, + 9, ], "type": "Identifier", - "value": "b", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 11, "line": 1, }, "start": Object { - "column": 21, + "column": 10, "line": 1, }, }, "range": Array [ - 21, - 31, + 10, + 11, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 32, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 32, - 33, + 14, + 18, ], "type": "Identifier", - "value": "c", + "value": "test", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 34, - "line": 1, + "column": 6, + "line": 2, }, }, "range": Array [ - 34, - 35, + 18, + 19, ], "type": "Punctuator", - "value": "{", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 35, - 36, + 19, + 20, ], "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": 14, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 0, - 14, - ], - "type": "TSEnumDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "value": ">", }, - }, - "range": Array [ - 0, - 14, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 0, - 1, + 20, + 21, ], "type": "Punctuator", - "value": "@", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 4, - ], - "type": "Identifier", - "value": "dec", - }, - Object { - "loc": Object { - "end": Object { "column": 9, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "line": 2, }, }, "range": Array [ - 5, - 9, + 21, + 22, ], - "type": "Keyword", - "value": "enum", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 10, - 11, + 23, + 24, ], - "type": "Identifier", - "value": "E", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 13, - "line": 1, + "line": 2, }, "start": Object { "column": 12, - "line": 1, + "line": 2, }, }, "range": Array [ - 12, - 13, + 24, + 25, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 13, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 13, - 14, + 26, + 27, ], "type": "Punctuator", "value": "}", @@ -86396,220 +94532,149 @@ Object { } `; -exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.src 1`] = ` +exports[`typescript fixtures/errorRecovery/empty-type-parameters-in-method-signature.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, + 18, + 22, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 1, - "line": 1, + "column": 2, + "line": 2, }, }, + "params": Array [], "range": Array [ - 1, - 7, + 18, + 27, ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "TSMethodSignature", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 22, + 24, + ], + "type": "TSTypeParameterDeclaration", }, }, - "range": Array [ - 0, - 7, - ], - "type": "Decorator", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, }, - ], + "range": Array [ + 14, + 29, + ], + "type": "TSInterfaceBody", + }, "id": Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { "column": 10, - "line": 2, + "line": 1, }, }, - "name": "M", + "name": "foo", "range": Array [ - 18, - 19, + 10, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 22, - ], - "type": "TSInterfaceDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 22, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 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": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 6, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, + "line": 3, }, "start": Object { - "column": 6, + "column": 0, "line": 1, }, }, "range": Array [ - 6, - 7, + 0, + 29, ], - "type": "Punctuator", - "value": ")", + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { "column": 9, - "line": 2, + "line": 1, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 8, - 17, + 0, + 9, ], "type": "Keyword", "value": "interface", @@ -86617,35 +94682,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { "column": 10, - "line": 2, + "line": 1, }, }, "range": Array [ - 18, - 19, + 10, + 13, ], "type": "Identifier", - "value": "M", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 20, - 21, + 14, + 15, ], "type": "Punctuator", "value": "{", @@ -86653,279 +94718,128 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 6, "line": 2, }, "start": Object { - "column": 13, + "column": 2, "line": 2, }, }, "range": Array [ - 21, + 18, 22, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "test", }, - ], - "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": 16, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 6, + "line": 2, }, }, "range": Array [ - 0, - 16, + 22, + 23, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "<", }, - }, - "range": Array [ - 0, - 16, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 0, - 5, + 23, + 24, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 1, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 6, - 9, + 24, + 25, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 10, - "line": 1, + "line": 2, }, "start": Object { "column": 9, - "line": 1, + "line": 2, }, }, "range": Array [ - 9, - 10, + 25, + 26, ], "type": "Punctuator", - "value": ":", + "value": ")", }, 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": 15, - "line": 1, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 14, - 15, + 26, + 27, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 15, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 15, - 16, + 28, + 29, ], "type": "Punctuator", - "value": ">", + "value": "}", }, ], "type": "Program", @@ -86961,7 +94875,7 @@ Object { "line": 1, }, "start": Object { - "column": 63, + "column": 7, "line": 1, }, }, @@ -87088,7 +95002,7 @@ Object { }, ], "range": Array [ - 63, + 7, 72, ], "type": "TSEnumDeclaration", @@ -94859,6 +102773,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 [ @@ -99514,131 +107430,563 @@ Object { "line": 1, }, }, - "range": Array [ - 9, - 231, - ], - "type": "TSModuleBlock", + "range": Array [ + 9, + 231, + ], + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 31, + 44, + ], + "type": "String", + "value": "'hello world'", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "range": Array [ + 49, + 55, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, }, - "name": "A", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", }, + "range": Array [ + 56, + 61, + ], + "type": "Keyword", + "value": "class", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 12, + "column": 22, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 4, }, }, "range": Array [ - 0, - 231, + 62, + 67, ], - "type": "TSModuleDeclaration", + "type": "Identifier", + "value": "Point", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 12, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 89, + ], + "type": "Identifier", + "value": "constructor", }, - }, - "range": Array [ - 0, - 231, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 20, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 19, + "line": 5, }, }, "range": Array [ - 0, - 6, + 89, + 90, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, ], "type": "Identifier", - "value": "module", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 29, + "line": 5, }, "start": Object { - "column": 7, - "line": 1, + "column": 28, + "line": 5, }, }, "range": Array [ - 7, - 8, + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 100, + 106, ], "type": "Identifier", - "value": "A", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 37, + "line": 5, }, "start": Object { - "column": 9, - "line": 1, + "column": 36, + "line": 5, }, }, "range": Array [ - 9, - 10, + 106, + 107, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 108, + 114, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 46, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 126, + 127, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 58, + "line": 5, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "}", + }, Object { "loc": Object { "end": Object { "column": 10, - "line": 3, + "line": 7, }, "start": Object { "column": 4, - "line": 3, + "line": 7, }, }, "range": Array [ - 16, - 22, + 140, + 146, ], "type": "Keyword", "value": "export", @@ -99646,593 +107994,932 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 17, + "line": 7, }, "start": Object { "column": 11, - "line": 3, + "line": 7, }, }, "range": Array [ - 23, - 26, + 147, + 153, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 166, + 172, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 173, + 182, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "range": Array [ + 183, + 185, + ], + "type": "Identifier", + "value": "Id", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 8, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 200, + 204, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 24, + "line": 9, }, "start": Object { - "column": 15, - "line": 3, + "column": 18, + "line": 9, }, }, "range": Array [ - 27, - 28, + 206, + 212, ], "type": "Identifier", - "value": "x", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 9, }, "start": Object { - "column": 17, - "line": 3, + "column": 24, + "line": 9, }, }, "range": Array [ - 29, - 30, + 212, + 213, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 9, + "line": 10, }, "start": Object { - "column": 19, - "line": 3, + "column": 8, + "line": 10, }, }, "range": Array [ - 31, - 44, + 222, + 223, ], - "type": "String", - "value": "'hello world'", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 5, + "line": 11, }, "start": Object { "column": 4, - "line": 4, + "line": 11, }, }, "range": Array [ - 49, - 55, + 228, + 229, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 1, + "line": 12, }, "start": Object { - "column": 11, - "line": 4, + "column": 0, + "line": 12, }, }, "range": Array [ - 56, - 61, + 230, + 231, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +Object { + "body": Array [ Object { + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "raw": "\\"hot-new-module\\"", + "type": "Literal", + "value": "hot-new-module", + }, "loc": Object { "end": Object { - "column": 22, - "line": 4, + "column": 32, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 62, - 67, + 0, + 32, ], - "type": "Identifier", - "value": "Point", + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { - "column": 23, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 68, - 69, + 0, + 7, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 5, + "column": 14, + "line": 1, }, "start": Object { "column": 8, - "line": 5, + "line": 1, }, }, "range": Array [ - 78, - 89, + 8, + 14, ], "type": "Identifier", - "value": "constructor", + "value": "module", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 5, + "column": 31, + "line": 1, }, "start": Object { - "column": 19, - "line": 5, + "column": 15, + "line": 1, }, }, "range": Array [ - 89, - 90, + 15, + 31, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"hot-new-module\\"", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 5, + "column": 32, + "line": 1, }, "start": Object { - "column": 20, - "line": 5, + "column": 31, + "line": 1, }, }, "range": Array [ - 90, - 96, + 31, + 32, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/array-type.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 28, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 27, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 97, - 98, + 0, + 19, ], - "type": "Identifier", - "value": "x", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "TSArrayType", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 29, - "line": 5, + "column": 4, + "line": 1, }, "start": Object { - "column": 28, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 98, - 99, + 0, + 4, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 5, + "column": 8, + "line": 1, }, "start": Object { - "column": 30, - "line": 5, + "column": 5, + "line": 1, }, }, "range": Array [ - 100, - 106, + 5, + 8, ], "type": "Identifier", - "value": "number", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 5, + "column": 10, + "line": 1, }, "start": Object { - "column": 36, - "line": 5, + "column": 9, + "line": 1, }, }, "range": Array [ - 106, - 107, + 9, + 10, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 5, + "column": 17, + "line": 1, }, "start": Object { - "column": 38, - "line": 5, + "column": 11, + "line": 1, }, }, "range": Array [ - 108, - 114, + 11, + 17, ], - "type": "Keyword", - "value": "public", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 5, + "column": 18, + "line": 1, }, "start": Object { - "column": 45, - "line": 5, + "column": 17, + "line": 1, }, }, "range": Array [ - 115, - 116, + 17, + 18, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 46, - "line": 5, + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/conditional.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", + }, + "type": "TSConditionalType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 116, - 117, ], - "type": "Punctuator", - "value": ":", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { "column": 48, - "line": 5, - }, - }, - "range": Array [ - 118, - 124, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 5, + "line": 1, }, "start": Object { - "column": 54, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 124, - 125, + 0, + 48, ], - "type": "Punctuator", - "value": ")", + "type": "VariableDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 5, - }, - "start": Object { - "column": 56, - "line": 5, - }, - }, - "range": Array [ - 126, - 127, - ], - "type": "Punctuator", - "value": "{", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, - Object { - "loc": Object { - "end": Object { - "column": 59, - "line": 5, - }, - "start": Object { - "column": 58, - "line": 5, - }, - }, - "range": Array [ - 128, - 129, - ], - "type": "Punctuator", - "value": "}", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 3, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 134, - 135, + 0, + 3, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 7, + "column": 5, + "line": 1, }, "start": Object { "column": 4, - "line": 7, + "line": 1, }, }, "range": Array [ - 140, - 146, + 4, + 5, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 7, + "column": 6, + "line": 1, }, "start": Object { - "column": 11, - "line": 7, + "column": 5, + "line": 1, }, }, "range": Array [ - 147, - 153, + 5, + 6, ], - "type": "Identifier", - "value": "module", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 7, + "column": 13, + "line": 1, }, "start": Object { - "column": 18, - "line": 7, + "column": 7, + "line": 1, }, }, "range": Array [ - 154, - 155, + 7, + 13, ], "type": "Identifier", - "value": "B", + "value": "number", }, Object { "loc": Object { "end": Object { "column": 21, - "line": 7, + "line": 1, }, "start": Object { - "column": 20, - "line": 7, - }, - }, - "range": Array [ - 156, - 157, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { "column": 14, - "line": 8, - }, - "start": Object { - "column": 8, - "line": 8, - }, - }, - "range": Array [ - 166, - 172, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 8, - }, - "start": Object { - "column": 15, - "line": 8, + "line": 1, }, }, "range": Array [ - 173, - 182, + 14, + 21, ], "type": "Keyword", - "value": "interface", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 8, + "column": 28, + "line": 1, }, "start": Object { - "column": 25, - "line": 8, + "column": 22, + "line": 1, }, }, "range": Array [ - 183, - 185, + 22, + 28, ], "type": "Identifier", - "value": "Id", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 8, + "column": 30, + "line": 1, }, "start": Object { - "column": 28, - "line": 8, + "column": 29, + "line": 1, }, }, "range": Array [ - 186, - 187, + 29, + 30, ], "type": "Punctuator", - "value": "{", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 9, + "column": 38, + "line": 1, }, "start": Object { - "column": 12, - "line": 9, + "column": 31, + "line": 1, }, }, "range": Array [ - 200, - 204, + 31, + 38, ], "type": "Identifier", - "value": "name", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 9, + "column": 40, + "line": 1, }, "start": Object { - "column": 16, - "line": 9, + "column": 39, + "line": 1, }, }, "range": Array [ - 204, - 205, + 39, + 40, ], "type": "Punctuator", "value": ":", @@ -100240,17 +108927,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 9, + "column": 47, + "line": 1, }, "start": Object { - "column": 18, - "line": 9, + "column": 41, + "line": 1, }, }, "range": Array [ - 206, - 212, + 41, + 47, ], "type": "Identifier", "value": "string", @@ -100258,141 +108945,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 9, + "column": 48, + "line": 1, }, "start": Object { - "column": 24, - "line": 9, + "column": 47, + "line": 1, }, }, "range": Array [ - 212, - 213, + 47, + 48, ], "type": "Punctuator", "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 10, - }, - "start": Object { - "column": 8, - "line": 10, - }, - }, - "range": Array [ - 222, - 223, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 11, - }, - "start": Object { - "column": 4, - "line": 11, - }, - }, - "range": Array [ - 228, - 229, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 12, - }, - "start": Object { - "column": 0, - "line": 12, - }, - }, - "range": Array [ - 230, - 231, - ], - "type": "Punctuator", - "value": "}", - }, ], "type": "Program", } `; -exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer.src 1`] = ` Object { "body": Array [ Object { - "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 31, + "column": 12, "line": 1, }, "start": Object { - "column": 15, + "column": 5, "line": 1, }, }, + "name": "Element", "range": Array [ - 15, - 31, + 5, + 12, ], - "raw": "\\"hot-new-module\\"", - "type": "Literal", - "value": "hot-new-module", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "Identifier", }, - "range": Array [ - 0, - 32, - ], - "type": "TSModuleDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 33, - ], - "sourceType": "script", - "tokens": Array [ - Object { "loc": Object { "end": Object { - "column": 7, + "column": 48, "line": 1, }, "start": Object { @@ -100402,140 +108999,270 @@ Object { }, "range": Array [ 0, - 7, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 14, + 48, ], - "type": "Identifier", - "value": "module", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 15, - 31, - ], - "type": "String", - "value": "\\"hot-new-module\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, + "extendsType": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 37, + ], + "type": "TSParenthesizedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 39, + ], + "type": "TSArrayType", }, - "start": Object { - "column": 31, - "line": 1, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/array-type.src 1`] = ` -Object { - "body": Array [ - Object { - "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 47, "line": 1, }, "start": Object { - "column": 5, + "column": 18, "line": 1, }, }, - "name": "Foo", "range": Array [ - 5, - 8, + 18, + 47, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 19, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "elementType": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 17, + "column": 43, "line": 1, }, "start": Object { - "column": 11, + "column": 42, "line": 1, }, }, "range": Array [ - 11, - 17, + 42, + 43, ], - "type": "TSStringKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, }, + "type": "TSConditionalType", + }, + "typeParameters": Object { "loc": Object { "end": Object { - "column": 19, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 14, + ], + "type": "TSTypeParameter", + }, + ], "range": Array [ - 11, - 19, + 12, + 15, ], - "type": "TSArrayType", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -100551,7 +109278,7 @@ Object { }, "range": Array [ 0, - 20, + 49, ], "sourceType": "script", "tokens": Array [ @@ -100576,7 +109303,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -100586,64 +109313,82 @@ Object { }, "range": Array [ 5, - 8, + 12, ], "type": "Identifier", - "value": "Foo", + "value": "Element", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 1, }, "start": Object { - "column": 9, + "column": 12, "line": 1, }, }, "range": Array [ - 9, - 10, + 12, + 13, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 14, "line": 1, }, "start": Object { - "column": 11, + "column": 13, "line": 1, }, }, "range": Array [ - 11, - 17, + 13, + 14, ], "type": "Identifier", - "value": "string", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 15, "line": 1, }, "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { "column": 17, "line": 1, }, + "start": Object { + "column": 16, + "line": 1, + }, }, "range": Array [ + 16, 17, - 18, ], "type": "Punctuator", - "value": "[", + "value": "=", }, Object { "loc": Object { @@ -100660,314 +109405,149 @@ Object { 18, 19, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "T", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/conditional.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 47, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 13, - ], - "type": "TSNumberKeyword", - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 47, - ], - "type": "TSStringKeyword", - }, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 47, - ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 38, - ], - "type": "TSBooleanKeyword", - }, - "type": "TSConditionalType", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 47, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", "loc": Object { "end": Object { - "column": 48, + "column": 27, "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, - 48, + 20, + 27, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "extends", }, - }, - "range": Array [ - 0, - 49, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 29, "line": 1, }, "start": Object { - "column": 0, + "column": 28, "line": 1, }, }, "range": Array [ - 0, - 3, + 28, + 29, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 34, "line": 1, }, "start": Object { - "column": 4, + "column": 29, "line": 1, }, }, "range": Array [ - 4, - 5, + 29, + 34, ], "type": "Identifier", - "value": "x", + "value": "infer", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 36, "line": 1, }, "start": Object { - "column": 5, + "column": 35, "line": 1, }, }, "range": Array [ - 5, - 6, + 35, + 36, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 37, "line": 1, }, "start": Object { - "column": 7, + "column": 36, "line": 1, }, }, "range": Array [ - 7, - 13, + 36, + 37, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 14, + "column": 37, "line": 1, }, }, "range": Array [ - 14, - 21, + 37, + 38, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 39, "line": 1, }, "start": Object { - "column": 22, + "column": 38, "line": 1, }, }, - "range": Array [ - 22, - 28, + "range": Array [ + 38, + 39, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 41, "line": 1, }, "start": Object { - "column": 29, + "column": 40, "line": 1, }, }, "range": Array [ - 29, - 30, + 40, + 41, ], "type": "Punctuator", "value": "?", @@ -100975,35 +109555,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 43, "line": 1, }, "start": Object { - "column": 31, + "column": 42, "line": 1, }, }, "range": Array [ - 31, - 38, + 42, + 43, ], "type": "Identifier", - "value": "boolean", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 45, "line": 1, }, "start": Object { - "column": 39, + "column": 44, "line": 1, }, }, "range": Array [ - 39, - 40, + 44, + 45, ], "type": "Punctuator", "value": ":", @@ -101015,16 +109595,16 @@ Object { "line": 1, }, "start": Object { - "column": 41, + "column": 46, "line": 1, }, }, "range": Array [ - 41, + 46, 47, ], "type": "Identifier", - "value": "string", + "value": "T", }, Object { "loc": Object { @@ -101049,14 +109629,14 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { @@ -101064,17 +109644,17 @@ Object { "line": 1, }, }, - "name": "Element", + "name": "Unpacked", "range": Array [ 5, - 12, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { "column": 0, @@ -101083,41 +109663,41 @@ Object { }, "range": Array [ 0, - 48, + 126, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "checkType": Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 19, + 21, + 22, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "name": "T", "range": Array [ - 18, - 19, + 21, + 22, ], "type": "Identifier", }, @@ -101126,67 +109706,67 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 37, + 31, + 40, ], "type": "TSParenthesizedType", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 29, - 36, + 32, + 39, ], "type": "TSInferType", "typeParameter": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "name": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "name": "U", "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Identifier", }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "TSTypeParameter", }, @@ -101194,100 +109774,432 @@ Object { }, "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 39, + 31, + 42, ], "type": "TSArrayType", }, "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 70, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + }, + "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "T", + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + }, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 109, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "Promise", + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 108, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + }, + "range": Array [ + 107, + 108, + ], + "type": "TSTypeParameter", + }, + }, + ], + "range": Array [ + 100, + 109, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 124, + 125, + ], + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 125, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + }, + }, + "type": "TSConditionalType", + }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 46, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 46, - 47, + 53, + 125, ], - "type": "TSTypeReference", - "typeName": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 25, + "line": 3, }, "start": Object { - "column": 46, - "line": 1, + "column": 24, + "line": 3, }, }, - "name": "T", "range": Array [ - 46, - 47, + 73, + 74, ], - "type": "Identifier", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + }, }, + "type": "TSConditionalType", }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, - "range": Array [ - 18, - 47, + "range": Array [ + 21, + 125, ], "trueType": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 42, - 43, + 45, + 46, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "name": "U", "range": Array [ - 42, - 43, + 45, + 46, ], "type": "Identifier", }, @@ -101297,11 +110209,11 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, @@ -101309,42 +110221,42 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "name": "T", "range": Array [ - 13, 14, + 15, ], "type": "Identifier", }, "range": Array [ - 13, 14, + 15, ], "type": "TSTypeParameter", }, ], "range": Array [ - 12, - 15, + 13, + 16, ], "type": "TSTypeParameterDeclaration", }, @@ -101353,7 +110265,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 6, }, "start": Object { "column": 0, @@ -101362,7 +110274,7 @@ Object { }, "range": Array [ 0, - 49, + 127, ], "sourceType": "script", "tokens": Array [ @@ -101387,7 +110299,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { @@ -101397,25 +110309,25 @@ Object { }, "range": Array [ 5, - 12, + 13, ], "type": "Identifier", - "value": "Element", + "value": "Unpacked", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], "type": "Punctuator", "value": "<", @@ -101423,17 +110335,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, ], "type": "Identifier", "value": "T", @@ -101441,17 +110353,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, 15, + 16, ], "type": "Punctuator", "value": ">", @@ -101459,17 +110371,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 16, + "column": 17, "line": 1, }, }, "range": Array [ - 16, 17, + 18, ], "type": "Punctuator", "value": "=", @@ -101477,17 +110389,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 19, + 21, + 22, ], "type": "Identifier", "value": "T", @@ -101495,17 +110407,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 20, - 27, + 23, + 30, ], "type": "Keyword", "value": "extends", @@ -101513,17 +110425,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 29, + 31, + 32, ], "type": "Punctuator", "value": "(", @@ -101531,17 +110443,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 29, - 34, + 32, + 37, ], "type": "Identifier", "value": "infer", @@ -101549,17 +110461,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Identifier", "value": "U", @@ -101567,17 +110479,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 36, - 37, + 39, + 40, ], "type": "Punctuator", "value": ")", @@ -101585,17 +110497,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 37, - 38, + 40, + 41, ], "type": "Punctuator", "value": "[", @@ -101603,17 +110515,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 38, - 39, + 41, + 42, ], "type": "Punctuator", "value": "]", @@ -101621,17 +110533,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 40, - "line": 1, + "column": 24, + "line": 2, }, }, "range": Array [ - 40, - 41, + 43, + 44, ], "type": "Punctuator", "value": "?", @@ -101639,17 +110551,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 42, - 43, + 45, + 46, ], "type": "Identifier", "value": "U", @@ -101657,17 +110569,323 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 44, - "line": 1, + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 55, + 62, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 85, + 92, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + "value": "Promise", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 37, + "line": 4, }, }, "range": Array [ - 44, - 45, + 114, + 115, ], "type": "Punctuator", "value": ":", @@ -101675,17 +110893,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 46, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 46, - 47, + 124, + 125, ], "type": "Identifier", "value": "T", @@ -101693,17 +110911,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, }, "range": Array [ - 47, - 48, + 125, + 126, ], "type": "Punctuator", "value": ";", @@ -101713,14 +110931,14 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -101728,17 +110946,17 @@ Object { "line": 1, }, }, - "name": "Unpacked", + "name": "Foo", "range": Array [ 5, - 13, + 8, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 63, + "line": 1, }, "start": Object { "column": 0, @@ -101747,543 +110965,336 @@ Object { }, "range": Array [ 0, - 126, + 63, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "checkType": Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "name": "T", "range": Array [ - 21, - 22, + 14, + 15, ], "type": "Identifier", }, }, "extendsType": Object { - "elementType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 40, - ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 32, - 39, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": "U", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "range": Array [ - 38, - 39, - ], - "type": "TSTypeParameter", - }, - }, - }, "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 50, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 42, - ], - "type": "TSArrayType", - }, - "falseType": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 63, - 70, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "name": "U", - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - }, - "range": Array [ - 69, - 70, - ], - "type": "TSTypeParameter", + "column": 24, + "line": 1, }, }, - "falseType": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "TSTypeReference", - "typeName": Object { + "members": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 27, + "line": 1, }, "start": Object { - "column": 6, - "line": 4, + "column": 26, + "line": 1, }, }, - "name": "T", + "name": "a", "range": Array [ - 83, - 84, + 26, + 27, ], "type": "Identifier", }, - }, - "extendsType": Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 37, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 26, + "line": 1, }, }, "range": Array [ - 93, - 109, + 26, + 37, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 27, + "line": 1, }, }, - "name": "Promise", "range": Array [ - 93, - 100, + 27, + 36, ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 4, - }, - "start": Object { - "column": 23, - "line": 4, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 4, + "column": 35, + "line": 1, }, }, - "range": Array [ - 101, - 108, - ], - "type": "TSInferType", - "typeParameter": Object { + "name": Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 4, - }, - "start": Object { - "column": 30, - "line": 4, - }, + "column": 35, + "line": 1, }, - "name": "U", - "range": Array [ - 107, - 108, - ], - "type": "Identifier", }, + "name": "U", "range": Array [ - 107, - 108, + 35, + 36, ], - "type": "TSTypeParameter", + "type": "Identifier", }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", }, - ], - "range": Array [ - 100, - 109, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 5, }, }, - "range": Array [ - 124, - 125, - ], - "type": "TSTypeReference", - "typeName": Object { + }, + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 39, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 38, + "line": 1, }, }, - "name": "T", + "name": "b", "range": Array [ - 124, - 125, + 38, + 39, ], "type": "Identifier", }, - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 125, - ], - "trueType": Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 112, - 113, + 38, + 48, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "range": Array [ + 47, + 48, + ], + "type": "TSTypeParameter", }, }, - "name": "U", - "range": Array [ - 112, - 113, - ], - "type": "Identifier", }, }, - "type": "TSConditionalType", - }, + ], + "range": Array [ + 24, + 50, + ], + "type": "TSTypeLiteral", + }, + "falseType": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 57, + "line": 1, }, }, "range": Array [ - 53, - 125, + 57, + 62, ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "range": Array [ - 73, - 74, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "name": "U", - "range": Array [ - 73, - 74, - ], - "type": "Identifier", - }, - }, - "type": "TSConditionalType", + "type": "TSNeverKeyword", }, "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 125, + 14, + 62, ], "trueType": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 53, + "line": 1, }, }, "range": Array [ - 45, - 46, + 53, + 54, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 53, + "line": 1, }, }, "name": "U", "range": Array [ - 45, - 46, + 53, + 54, ], "type": "Identifier", }, @@ -102293,11 +111304,11 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, @@ -102305,42 +111316,42 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "name": "T", "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Identifier", }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "TSTypeParameter", }, ], "range": Array [ - 13, - 16, + 8, + 11, ], "type": "TSTypeParameterDeclaration", }, @@ -102349,7 +111360,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -102358,7 +111369,7 @@ Object { }, "range": Array [ 0, - 127, + 64, ], "sourceType": "script", "tokens": Array [ @@ -102383,7 +111394,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -102393,25 +111404,25 @@ Object { }, "range": Array [ 5, - 13, + 8, ], "type": "Identifier", - "value": "Unpacked", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, "range": Array [ - 13, - 14, + 8, + 9, ], "type": "Punctuator", "value": "<", @@ -102419,17 +111430,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Identifier", "value": "T", @@ -102437,17 +111448,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 15, + "column": 10, "line": 1, }, }, "range": Array [ - 15, - 16, + 10, + 11, ], "type": "Punctuator", "value": ">", @@ -102455,17 +111466,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", "value": "=", @@ -102473,17 +111484,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], "type": "Identifier", "value": "T", @@ -102491,179 +111502,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ + 16, 23, - 30, ], "type": "Keyword", "value": "extends", }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 32, - 37, - ], - "type": "Identifier", - "value": "infer", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 40, - 41, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": "]", - }, Object { "loc": Object { "end": Object { "column": 25, - "line": 2, + "line": 1, }, "start": Object { "column": 24, - "line": 2, + "line": 1, }, }, "range": Array [ - 43, - 44, + 24, + 25, ], "type": "Punctuator", - "value": "?", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 27, - "line": 2, + "line": 1, }, "start": Object { "column": 26, - "line": 2, + "line": 1, }, }, "range": Array [ - 45, - 46, + 26, + 27, ], "type": "Identifier", - "value": "U", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 28, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ - 47, - 48, + 27, + 28, ], "type": "Punctuator", "value": ":", @@ -102671,53 +111574,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 55, - 62, - ], - "type": "Keyword", - "value": "extends", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 29, + "line": 1, }, }, "range": Array [ - 63, - 68, + 29, + 34, ], "type": "Identifier", "value": "infer", @@ -102725,53 +111592,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 3, - }, - }, - "range": Array [ - 71, - 72, - ], - "type": "Punctuator", - "value": "?", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 3, + "column": 35, + "line": 1, }, }, "range": Array [ - 73, - 74, + 35, + 36, ], "type": "Identifier", "value": "U", @@ -102779,107 +111610,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 37, + "line": 1, }, "start": Object { - "column": 26, - "line": 3, + "column": 36, + "line": 1, }, }, "range": Array [ - 75, - 76, + 36, + 37, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 85, - 92, - ], - "type": "Keyword", - "value": "extends", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 39, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 93, - 100, + 38, + 39, ], "type": "Identifier", - "value": "Promise", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 40, + "line": 1, }, "start": Object { - "column": 23, - "line": 4, + "column": 39, + "line": 1, }, }, "range": Array [ - 100, - 101, + 39, + 40, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 4, + "column": 46, + "line": 1, }, "start": Object { - "column": 24, - "line": 4, + "column": 41, + "line": 1, }, }, "range": Array [ - 101, - 106, + 41, + 46, ], "type": "Identifier", "value": "infer", @@ -102887,17 +111682,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, + "column": 47, + "line": 1, }, }, "range": Array [ - 107, - 108, + 47, + 48, ], "type": "Identifier", "value": "U", @@ -102905,35 +111700,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 50, + "line": 1, }, "start": Object { - "column": 31, - "line": 4, + "column": 49, + "line": 1, }, }, "range": Array [ - 108, - 109, + 49, + 50, ], "type": "Punctuator", - "value": ">", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 4, + "column": 52, + "line": 1, }, "start": Object { - "column": 33, - "line": 4, + "column": 51, + "line": 1, }, }, "range": Array [ - 110, - 111, + 51, + 52, ], "type": "Punctuator", "value": "?", @@ -102941,17 +111736,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 54, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 53, + "line": 1, }, }, "range": Array [ - 112, - 113, + 53, + 54, ], "type": "Identifier", "value": "U", @@ -102959,17 +111754,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 4, + "column": 56, + "line": 1, }, "start": Object { - "column": 37, - "line": 4, + "column": 55, + "line": 1, }, }, "range": Array [ - 114, - 115, + 55, + 56, ], "type": "Punctuator", "value": ":", @@ -102977,35 +111772,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 57, + "line": 1, }, }, "range": Array [ - 124, - 125, + 57, + 62, ], "type": "Identifier", - "value": "T", + "value": "never", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 63, + "line": 1, }, "start": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, }, "range": Array [ - 125, - 126, + 62, + 63, ], "type": "Punctuator", "value": ";", @@ -103015,430 +111810,166 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = ` +exports[`typescript fixtures/types/conditional-with-null.src 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 63, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 63, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeReference", - "typeName": Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 45, "line": 1, }, "start": Object { - "column": 14, + "column": 4, "line": 1, }, }, - "name": "T", + "name": "x", "range": Array [ - 14, - 15, + 4, + 45, ], "type": "Identifier", - }, - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 1, }, "start": Object { - "column": 26, + "column": 5, "line": 1, }, }, "range": Array [ - 26, - 37, + 5, + 45, ], - "type": "TSPropertySignature", + "type": "TSTypeAnnotation", "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 36, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "checkType": Object { "loc": Object { "end": Object { - "column": 36, + "column": 13, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 36, + 7, + 13, ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", + "start": Object { + "column": 22, + "line": 1, }, - "range": Array [ - 35, - 36, - ], - "type": "TSTypeParameter", }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", }, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, }, + "range": Array [ + 41, + 45, + ], + "type": "TSNullKeyword", }, - "name": "b", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 48, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 48, + "column": 45, "line": 1, }, "start": Object { - "column": 39, + "column": 7, "line": 1, }, }, "range": Array [ - 39, - 48, + 7, + 45, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 41, + "column": 38, "line": 1, - }, - }, - "range": Array [ - 41, - 48, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 47, - 48, - ], - "type": "Identifier", - }, - "range": Array [ - 47, - 48, - ], - "type": "TSTypeParameter", - }, - }, - }, - }, - ], - "range": Array [ - 24, - 50, - ], - "type": "TSTypeLiteral", - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 57, - "line": 1, - }, - }, - "range": Array [ - 57, - 62, - ], - "type": "TSNeverKeyword", - }, - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 62, - ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - }, - "type": "TSConditionalType", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", }, + "type": "TSConditionalType", }, - "name": "T", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, - "range": Array [ - 9, - 10, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 8, - 11, - ], - "type": "TSTypeParameterDeclaration", + "init": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", }, ], "loc": Object { @@ -103453,14 +111984,14 @@ Object { }, "range": Array [ 0, - 64, + 47, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 3, "line": 1, }, "start": Object { @@ -103470,15 +112001,33 @@ Object { }, "range": Array [ 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ 4, + 5, ], "type": "Identifier", - "value": "type", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -103488,169 +112037,461 @@ Object { }, "range": Array [ 5, - 8, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, ], "type": "Identifier", - "value": "Foo", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 21, "line": 1, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, "range": Array [ - 8, - 9, + 14, + 21, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 28, "line": 1, }, "start": Object { - "column": 9, + "column": 22, "line": 1, }, }, "range": Array [ - 9, - 10, + 22, + 28, ], "type": "Identifier", - "value": "T", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 30, "line": 1, }, "start": Object { - "column": 10, + "column": 29, "line": 1, }, }, "range": Array [ - 10, - 11, + 29, + 30, ], "type": "Punctuator", - "value": ">", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 38, "line": 1, }, "start": Object { - "column": 12, + "column": 31, "line": 1, }, }, "range": Array [ - 12, - 13, + 31, + 38, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 40, "line": 1, }, "start": Object { - "column": 14, + "column": 39, "line": 1, }, }, "range": Array [ - 14, - 15, + 39, + 40, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 45, "line": 1, }, "start": Object { - "column": 16, + "column": 41, "line": 1, }, }, "range": Array [ - 16, - 23, + 41, + 45, ], "type": "Keyword", - "value": "extends", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 46, "line": 1, }, "start": Object { - "column": 24, + "column": 45, "line": 1, }, }, "range": Array [ - 24, - 25, + 45, + 46, ], "type": "Punctuator", - "value": "{", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 4, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 42, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 42, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 27, + "column": 3, "line": 1, }, "start": Object { - "column": 26, + "column": 0, "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, ], "type": "Identifier", - "value": "a", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 6, "line": 1, }, "start": Object { - "column": 27, + "column": 5, "line": 1, }, }, "range": Array [ - 27, - 28, + 5, + 6, ], "type": "Punctuator", "value": ":", @@ -103658,233 +112499,251 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 10, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 34, + 7, + 10, ], - "type": "Identifier", - "value": "infer", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 12, "line": 1, }, "start": Object { - "column": 35, + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, "line": 1, }, }, "range": Array [ - 35, - 36, + 12, + 13, ], "type": "Identifier", - "value": "U", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 14, "line": 1, }, "start": Object { - "column": 36, + "column": 13, "line": 1, }, }, "range": Array [ - 36, - 37, + 13, + 14, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 21, "line": 1, }, "start": Object { - "column": 38, + "column": 15, "line": 1, }, }, "range": Array [ - 38, - 39, + 15, + 21, ], "type": "Identifier", - "value": "b", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 22, "line": 1, }, "start": Object { - "column": 39, + "column": 21, "line": 1, }, }, "range": Array [ - 39, - 40, + 21, + 22, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 24, "line": 1, }, "start": Object { - "column": 41, + "column": 23, "line": 1, }, }, "range": Array [ - 41, - 46, + 23, + 24, ], "type": "Identifier", - "value": "infer", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 25, "line": 1, }, "start": Object { - "column": 47, + "column": 24, "line": 1, }, }, "range": Array [ - 47, - 48, + 24, + 25, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 50, + "column": 26, "line": 1, }, "start": Object { - "column": 49, + "column": 25, "line": 1, }, }, "range": Array [ - 49, - 50, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 52, + "column": 33, "line": 1, }, "start": Object { - "column": 51, + "column": 27, "line": 1, }, }, "range": Array [ - 51, - 52, + 27, + 33, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 54, + "column": 34, "line": 1, }, "start": Object { - "column": 53, + "column": 33, "line": 1, }, }, "range": Array [ - 53, - 54, + 33, + 34, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 37, "line": 1, }, "start": Object { - "column": 55, + "column": 35, "line": 1, }, }, "range": Array [ - 55, - 56, + 35, + 37, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 62, + "column": 42, "line": 1, }, "start": Object { - "column": 57, + "column": 38, "line": 1, }, }, "range": Array [ - 57, - 62, + 38, + 42, ], - "type": "Identifier", - "value": "never", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 63, + "column": 43, "line": 1, }, "start": Object { - "column": 62, + "column": 42, "line": 1, }, }, "range": Array [ - 62, - 63, + 42, + 43, ], "type": "Punctuator", "value": ";", @@ -103894,7 +112753,7 @@ Object { } `; -exports[`typescript fixtures/types/conditional-with-null.src 1`] = ` +exports[`typescript fixtures/types/constructor-generic.src 1`] = ` Object { "body": Array [ Object { @@ -103903,7 +112762,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -103911,16 +112770,16 @@ Object { "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ 4, - 45, + 25, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -103930,100 +112789,210 @@ Object { }, "range": Array [ 5, - 45, + 25, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, }, - "range": Array [ - 7, - 13, - ], - "type": "TSNumberKeyword", }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, }, - "start": Object { - "column": 22, - "line": 1, + "name": "a", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + }, }, }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - "falseType": Object { + ], + "range": Array [ + 7, + 25, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { - "column": 41, + "column": 21, "line": 1, }, }, "range": Array [ - 41, - 45, + 21, + 25, ], - "type": "TSNullKeyword", - }, - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, }, }, - "range": Array [ - 7, - 45, - ], - "trueType": Object { + "type": "TSConstructorType", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 38, + "column": 14, "line": 1, }, "start": Object { - "column": 31, + "column": 11, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "range": Array [ + 12, + 13, + ], + "type": "TSTypeParameter", + }, + ], "range": Array [ - 31, - 38, + 11, + 14, ], - "type": "TSBooleanKeyword", + "type": "TSTypeParameterDeclaration", }, - "type": "TSConditionalType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -104033,7 +113002,7 @@ Object { }, "range": Array [ 4, - 45, + 25, ], "type": "VariableDeclarator", }, @@ -104041,7 +113010,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 46, + "column": 26, "line": 1, }, "start": Object { @@ -104051,7 +113020,7 @@ Object { }, "range": Array [ 0, - 46, + 26, ], "type": "VariableDeclaration", }, @@ -104068,7 +113037,7 @@ Object { }, "range": Array [ 0, - 47, + 27, ], "sourceType": "script", "tokens": Array [ @@ -104106,7 +113075,7 @@ Object { 5, ], "type": "Identifier", - "value": "x", + "value": "f", }, Object { "loc": Object { @@ -104129,7 +113098,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { @@ -104139,15 +113108,69 @@ Object { }, "range": Array [ 7, + 10, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, 13, ], "type": "Identifier", - "value": "number", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, "line": 1, }, "start": Object { @@ -104157,115 +113180,133 @@ Object { }, "range": Array [ 14, - 21, + 15, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 16, "line": 1, }, "start": Object { - "column": 22, + "column": 15, "line": 1, }, }, "range": Array [ - 22, - 28, + 15, + 16, ], "type": "Identifier", - "value": "string", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 17, "line": 1, }, "start": Object { - "column": 29, + "column": 16, "line": 1, }, }, "range": Array [ - 29, - 30, + 16, + 17, ], "type": "Punctuator", - "value": "?", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 19, "line": 1, }, "start": Object { - "column": 31, + "column": 18, "line": 1, }, }, "range": Array [ - 31, - 38, + 18, + 19, ], "type": "Identifier", - "value": "boolean", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 20, "line": 1, }, "start": Object { - "column": 39, + "column": 19, "line": 1, }, }, "range": Array [ - 39, - 40, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 23, "line": 1, }, "start": Object { - "column": 41, + "column": 21, "line": 1, }, }, "range": Array [ - 41, - 45, + 21, + 23, ], - "type": "Keyword", - "value": "null", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 25, "line": 1, }, "start": Object { - "column": 45, + "column": 24, "line": 1, }, }, "range": Array [ - 45, - 46, + 24, + 25, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -104275,7 +113316,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor.src 1`] = ` +exports[`typescript fixtures/types/constructor-in-generic.src 1`] = ` Object { "body": Array [ Object { @@ -104284,7 +113325,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -104292,16 +113333,16 @@ Object { "line": 1, }, }, - "name": "f", + "name": "x", "range": Array [ 4, - 42, + 30, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -104311,13 +113352,13 @@ Object { }, "range": Array [ 5, - 42, + 30, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -104325,28 +113366,45 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "range": Array [ + 7, + 30, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "a", - "range": Array [ - 12, - 21, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { @@ -104354,130 +113412,61 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 13, - 21, + 29, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { - "column": 15, + "column": 20, "line": 1, }, }, "range": Array [ - 15, - 21, + 20, + 29, ], - "type": "TSNumberKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "b", - "optional": true, - "range": Array [ - 23, - 33, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 33, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, }, + "range": Array [ + 23, + 29, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 27, - 33, - ], - "type": "TSNumberKeyword", }, + "type": "TSConstructorType", }, - }, - ], - "range": Array [ - 7, - 42, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, + ], "range": Array [ - 35, - 42, + 12, + 30, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 42, - ], - "type": "TSVoidKeyword", - }, + "type": "TSTypeParameterInstantiation", }, - "type": "TSConstructorType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -104487,7 +113476,7 @@ Object { }, "range": Array [ 4, - 42, + 30, ], "type": "VariableDeclarator", }, @@ -104495,7 +113484,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 43, + "column": 31, "line": 1, }, "start": Object { @@ -104505,7 +113494,7 @@ Object { }, "range": Array [ 0, - 43, + 31, ], "type": "VariableDeclaration", }, @@ -104522,7 +113511,7 @@ Object { }, "range": Array [ 0, - 44, + 32, ], "sourceType": "script", "tokens": Array [ @@ -104560,7 +113549,7 @@ Object { 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { @@ -104583,7 +113572,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -104593,28 +113582,10 @@ Object { }, "range": Array [ 7, - 10, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { @@ -104631,13 +113602,13 @@ Object { 12, 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { @@ -104647,187 +113618,115 @@ Object { }, "range": Array [ 13, - 14, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 21, + 16, ], - "type": "Identifier", - "value": "number", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 18, "line": 1, }, "start": Object { - "column": 21, + "column": 17, "line": 1, }, }, "range": Array [ - 21, - 22, + 17, + 18, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - "value": "b", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 19, "line": 1, }, "start": Object { - "column": 24, + "column": 18, "line": 1, }, }, "range": Array [ - 24, - 25, + 18, + 19, ], "type": "Punctuator", - "value": "?", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 22, "line": 1, }, "start": Object { - "column": 25, + "column": 20, "line": 1, }, }, "range": Array [ - 25, - 26, + 20, + 22, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 29, "line": 1, }, "start": Object { - "column": 27, + "column": 23, "line": 1, }, }, "range": Array [ - 27, - 33, + 23, + 29, ], "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": ")", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 30, "line": 1, }, "start": Object { - "column": 35, + "column": 29, "line": 1, }, }, "range": Array [ - 35, - 37, + 29, + 30, ], "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 42, - ], - "type": "Keyword", - "value": "void", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 31, "line": 1, }, "start": Object { - "column": 42, + "column": 30, "line": 1, }, }, "range": Array [ - 42, - 43, + 30, + 31, ], "type": "Punctuator", "value": ";", @@ -104837,7 +113736,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-generic.src 1`] = ` +exports[`typescript fixtures/types/constructor-with-rest.src 1`] = ` Object { "body": Array [ Object { @@ -104846,7 +113745,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -104857,13 +113756,13 @@ Object { "name": "f", "range": Array [ 4, - 25, + 35, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -104873,13 +113772,13 @@ Object { }, "range": Array [ 5, - 25, + 35, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -104889,194 +113788,138 @@ Object { }, "params": Array [ Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 19, - ], - "type": "Identifier", - "typeAnnotation": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, + "name": "a", "range": Array [ + 15, 16, - 19, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - }, - }, - }, - ], - "range": Array [ - 7, - 25, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + "type": "Identifier", }, - }, - "range": Array [ - 21, - 25, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 26, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 26, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 24, - 25, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSConstructorType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "params": Array [ - Object { + "type": "RestElement", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 16, "line": 1, }, }, - "name": Object { + "range": Array [ + 16, + 26, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "TSNumberKeyword", + }, "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 18, "line": 1, }, }, - "name": "T", "range": Array [ - 12, - 13, + 18, + 26, ], - "type": "Identifier", + "type": "TSArrayType", }, - "range": Array [ - 12, - 13, - ], - "type": "TSTypeParameter", }, - ], + }, + ], + "range": Array [ + 7, + 35, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, "range": Array [ - 11, - 14, + 28, + 35, ], - "type": "TSTypeParameterDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSConstructorType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -105086,7 +113929,7 @@ Object { }, "range": Array [ 4, - 25, + 35, ], "type": "VariableDeclarator", }, @@ -105094,7 +113937,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { @@ -105104,7 +113947,7 @@ Object { }, "range": Array [ 0, - 26, + 36, ], "type": "VariableDeclaration", }, @@ -105121,7 +113964,7 @@ Object { }, "range": Array [ 0, - 27, + 37, ], "sourceType": "script", "tokens": Array [ @@ -105213,12 +114056,12 @@ Object { 12, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { @@ -105228,115 +114071,115 @@ Object { }, "range": Array [ 12, - 13, + 15, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { - "column": 13, + "column": 15, "line": 1, }, }, "range": Array [ - 13, - 14, + 15, + 16, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 14, + "column": 16, "line": 1, }, }, "range": Array [ - 14, - 15, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 1, }, "start": Object { - "column": 15, + "column": 18, "line": 1, }, }, "range": Array [ - 15, - 16, + 18, + 24, ], "type": "Identifier", - "value": "a", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 1, }, "start": Object { - "column": 16, + "column": 24, "line": 1, }, }, "range": Array [ - 16, - 17, + 24, + 25, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 26, "line": 1, }, "start": Object { - "column": 18, + "column": 25, "line": 1, }, }, "range": Array [ - 18, - 19, + 25, + 26, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 27, "line": 1, }, "start": Object { - "column": 19, + "column": 26, "line": 1, }, }, "range": Array [ - 19, - 20, + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -105344,17 +114187,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 30, "line": 1, }, "start": Object { - "column": 21, + "column": 28, "line": 1, }, }, "range": Array [ - 21, - 23, + 28, + 30, ], "type": "Punctuator", "value": "=>", @@ -105362,35 +114205,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { - "column": 24, + "column": 31, "line": 1, }, }, "range": Array [ - 24, - 25, + 31, + 35, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { - "column": 25, + "column": 35, "line": 1, }, }, "range": Array [ - 25, - 26, + 35, + 36, ], "type": "Punctuator", "value": ";", @@ -105400,7 +114243,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-in-generic.src 1`] = ` +exports[`typescript fixtures/types/function.src 1`] = ` Object { "body": Array [ Object { @@ -105409,7 +114252,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -105417,16 +114260,16 @@ Object { "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ 4, - 30, + 38, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -105436,13 +114279,13 @@ Object { }, "range": Array [ 5, - 30, + 38, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -105450,107 +114293,159 @@ Object { "line": 1, }, }, - "range": Array [ - 7, - 30, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - "start": Object { - "column": 7, - "line": 1, + "name": "a", + "range": Array [ + 8, + 17, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, }, }, - "name": "Array", - "range": Array [ - 7, - 12, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "name": "b", + "optional": true, + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 29, "line": 1, }, "start": Object { - "column": 13, + "column": 21, "line": 1, }, }, - "params": Array [], "range": Array [ - 13, + 21, 29, ], - "returnType": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 29, "line": 1, }, "start": Object { - "column": 20, + "column": 23, "line": 1, }, }, "range": Array [ - 20, + 23, 29, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 29, - ], - "type": "TSStringKeyword", - }, + "type": "TSNumberKeyword", }, - "type": "TSConstructorType", }, - ], + }, + ], + "range": Array [ + 7, + 38, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, "range": Array [ - 12, - 30, + 31, + 38, ], - "type": "TSTypeParameterInstantiation", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -105560,7 +114455,7 @@ Object { }, "range": Array [ 4, - 30, + 38, ], "type": "VariableDeclarator", }, @@ -105568,7 +114463,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { @@ -105578,7 +114473,7 @@ Object { }, "range": Array [ 0, - 31, + 39, ], "type": "VariableDeclaration", }, @@ -105595,7 +114490,7 @@ Object { }, "range": Array [ 0, - 32, + 40, ], "sourceType": "script", "tokens": Array [ @@ -105633,7 +114528,7 @@ Object { 5, ], "type": "Identifier", - "value": "x", + "value": "f", }, Object { "loc": Object { @@ -105656,7 +114551,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { @@ -105666,46 +114561,64 @@ Object { }, "range": Array [ 7, - 12, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, ], "type": "Identifier", - "value": "Array", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { - "column": 12, + "column": 9, "line": 1, }, }, "range": Array [ - 12, - 13, + 9, + 10, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { - "column": 13, + "column": 11, "line": 1, }, }, "range": Array [ - 13, - 16, + 11, + 17, ], - "type": "Keyword", - "value": "new", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { @@ -105723,30 +114636,30 @@ Object { 18, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { - "column": 18, + "column": 19, "line": 1, }, }, "range": Array [ - 18, 19, + 20, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 21, "line": 1, }, "start": Object { @@ -105756,10 +114669,28 @@ Object { }, "range": Array [ 20, + 21, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, 22, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { @@ -105777,7 +114708,7 @@ Object { 29, ], "type": "Identifier", - "value": "string", + "value": "number", }, Object { "loc": Object { @@ -105794,23 +114725,59 @@ Object { 29, 30, ], - "type": "Punctuator", - "value": ">", + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { - "column": 30, + "column": 38, "line": 1, }, }, "range": Array [ - 30, - 31, + 38, + 39, ], "type": "Punctuator", "value": ";", @@ -105820,7 +114787,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-with-rest.src 1`] = ` +exports[`typescript fixtures/types/function-generic.src 1`] = ` Object { "body": Array [ Object { @@ -105829,7 +114796,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -105840,13 +114807,13 @@ Object { "name": "f", "range": Array [ 4, - 35, + 21, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -105856,13 +114823,13 @@ Object { }, "range": Array [ 5, - 35, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -105872,138 +114839,194 @@ Object { }, "params": Array [ Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, + "name": "a", "range": Array [ - 12, - 26, + 11, + 15, ], - "type": "RestElement", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 16, + "column": 12, "line": 1, }, }, "range": Array [ - 16, - 26, + 12, + 15, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { - "elementType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 24, + "column": 15, "line": 1, }, "start": Object { - "column": 18, + "column": 14, "line": 1, }, }, + "name": "T", "range": Array [ - 18, - 24, + 14, + 15, ], - "type": "TSNumberKeyword", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "type": "Identifier", }, - "range": Array [ - 18, - 26, - ], - "type": "TSArrayType", }, }, }, ], "range": Array [ 7, - 35, + 21, ], "returnType": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 35, + 17, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 35, + 20, + 21, ], - "type": "TSVoidKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, }, }, - "type": "TSConstructorType", + "type": "TSFunctionType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, }, "init": null, "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -106013,7 +115036,7 @@ Object { }, "range": Array [ 4, - 35, + 21, ], "type": "VariableDeclarator", }, @@ -106021,7 +115044,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { @@ -106031,7 +115054,7 @@ Object { }, "range": Array [ 0, - 36, + 22, ], "type": "VariableDeclaration", }, @@ -106048,7 +115071,7 @@ Object { }, "range": Array [ 0, - 37, + 23, ], "sourceType": "script", "tokens": Array [ @@ -106109,7 +115132,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { @@ -106119,151 +115142,133 @@ Object { }, "range": Array [ 7, - 10, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, + 8, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { - "column": 12, + "column": 8, "line": 1, }, }, "range": Array [ - 12, - 15, + 8, + 9, ], - "type": "Punctuator", - "value": "...", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { - "column": 15, + "column": 9, "line": 1, }, }, "range": Array [ - 15, - 16, + 9, + 10, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 11, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 12, "line": 1, }, "start": Object { - "column": 18, + "column": 11, "line": 1, }, }, "range": Array [ - 18, - 24, + 11, + 12, ], "type": "Identifier", - "value": "number", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 13, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 13, ], "type": "Punctuator", - "value": "[", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 25, + "column": 14, "line": 1, }, }, "range": Array [ - 25, - 26, + 14, + 15, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 16, "line": 1, }, "start": Object { - "column": 26, + "column": 15, "line": 1, }, }, "range": Array [ - 26, - 27, + 15, + 16, ], "type": "Punctuator", "value": ")", @@ -106271,17 +115276,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 19, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 30, + 17, + 19, ], "type": "Punctuator", "value": "=>", @@ -106289,35 +115294,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 35, + 20, + 21, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { - "column": 35, + "column": 21, "line": 1, }, }, "range": Array [ - 35, - 36, + 21, + 22, ], "type": "Punctuator", "value": ";", @@ -106327,7 +115332,7 @@ Object { } `; -exports[`typescript fixtures/types/function.src 1`] = ` +exports[`typescript fixtures/types/function-in-generic.src 1`] = ` Object { "body": Array [ Object { @@ -106336,7 +115341,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -106344,16 +115349,16 @@ Object { "line": 1, }, }, - "name": "f", + "name": "x", "range": Array [ 4, - 38, + 24, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -106363,13 +115368,13 @@ Object { }, "range": Array [ 5, - 38, + 24, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -106377,159 +115382,107 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "range": Array [ + 7, + 24, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "a", - "range": Array [ - 8, - 17, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 17, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 17, - ], - "type": "TSNumberKeyword", - }, + "start": Object { + "column": 7, + "line": 1, }, }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, + "name": "Array", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, }, - "name": "b", - "optional": true, - "range": Array [ - 19, - 29, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, + "params": Array [], "range": Array [ - 21, - 29, + 13, + 23, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 23, + "column": 16, "line": 1, }, }, "range": Array [ + 16, 23, - 29, ], - "type": "TSNumberKeyword", - }, - }, - }, - ], - "range": Array [ - 7, - 38, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 34, - 38, - ], - "type": "TSVoidKeyword", - }, + ], + "range": Array [ + 12, + 24, + ], + "type": "TSTypeParameterInstantiation", }, - "type": "TSFunctionType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -106539,7 +115492,7 @@ Object { }, "range": Array [ 4, - 38, + 24, ], "type": "VariableDeclarator", }, @@ -106547,7 +115500,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 39, + "column": 25, "line": 1, }, "start": Object { @@ -106557,7 +115510,7 @@ Object { }, "range": Array [ 0, - 39, + 25, ], "type": "VariableDeclaration", }, @@ -106574,7 +115527,7 @@ Object { }, "range": Array [ 0, - 40, + 26, ], "sourceType": "script", "tokens": Array [ @@ -106612,7 +115565,7 @@ Object { 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { @@ -106635,7 +115588,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -106645,64 +115598,64 @@ Object { }, "range": Array [ 7, - 8, + 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { - "column": 8, + "column": 12, "line": 1, }, }, "range": Array [ - 8, - 9, + 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 13, "line": 1, }, }, "range": Array [ - 9, - 10, + 13, + 14, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 14, "line": 1, }, }, "range": Array [ - 11, - 17, + 14, + 15, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -106711,21 +115664,21 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 16, "line": 1, }, }, "range": Array [ - 17, + 16, 18, ], "type": "Punctuator", - "value": ",", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 23, "line": 1, }, "start": Object { @@ -106735,51 +115688,15 @@ Object { }, "range": Array [ 19, - 20, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": "?", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, + 23, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 24, "line": 1, }, "start": Object { @@ -106789,358 +115706,195 @@ Object { }, "range": Array [ 23, - 29, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, + 24, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 25, "line": 1, }, "start": Object { - "column": 31, + "column": 24, "line": 1, }, }, "range": Array [ - 31, - 33, + 24, + 25, ], "type": "Punctuator", - "value": "=>", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/function-with-array-destruction.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", }, - "range": Array [ - 34, - 38, - ], - "type": "Keyword", - "value": "void", - }, - Object { "loc": Object { "end": Object { - "column": 39, + "column": 28, "line": 1, }, "start": Object { - "column": 38, + "column": 0, "line": 1, }, }, "range": Array [ - 38, - 39, + 0, + 28, ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/function-generic.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "f", "range": Array [ - 4, - 21, + 12, + 20, ], - "type": "Identifier", + "type": "ArrayPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 5, + "column": 15, "line": 1, }, }, "range": Array [ - 5, - 21, + 15, + 20, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 11, - 15, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 15, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - }, - }, - }, - ], "range": Array [ - 7, - 21, + 17, + 20, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 21, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSFunctionType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - "range": Array [ - 8, - 9, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 7, - 10, - ], - "type": "TSTypeParameterDeclaration", - }, + "type": "TSAnyKeyword", }, }, }, - "init": null, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, "range": Array [ - 4, - 21, + 22, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "TSFunctionType", + }, }, ], "loc": Object { @@ -107155,14 +115909,14 @@ Object { }, "range": Array [ 0, - 23, + 29, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -107172,33 +115926,15 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Keyword", - "value": "let", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ 4, - 5, ], "type": "Identifier", - "value": "f", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -107208,46 +115944,10 @@ Object { }, "range": Array [ 5, - 6, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ 8, - 9, ], "type": "Identifier", - "value": "T", + "value": "foo", }, Object { "loc": Object { @@ -107265,22 +115965,22 @@ Object { 10, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, 11, + 12, ], "type": "Punctuator", "value": "(", @@ -107288,38 +115988,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, "range": Array [ - 11, 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -107336,8 +116036,8 @@ Object { 14, 15, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -107355,12 +116055,12 @@ Object { 16, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { @@ -107370,10 +116070,10 @@ Object { }, "range": Array [ 17, - 19, + 20, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { @@ -107390,213 +116090,250 @@ Object { 20, 21, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 24, "line": 1, }, "start": Object { - "column": 21, + "column": 22, "line": 1, }, }, "range": Array [ - 21, 22, + 24, ], "type": "Punctuator", - "value": ";", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", }, ], "type": "Program", } `; -exports[`typescript fixtures/types/function-in-generic.src 1`] = ` +exports[`typescript fixtures/types/function-with-object-destruction.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 24, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "x", - "range": Array [ - 4, - 24, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", }, - }, - "range": Array [ - 5, - 24, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, + "method": false, "range": Array [ - 7, - 24, + 13, + 14, ], - "type": "TSTypeReference", - "typeName": Object { + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, - "name": "Array", + "name": "a", "range": Array [ - 7, - 12, + 13, + 14, ], "type": "Identifier", }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 13, - 23, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 23, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 23, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSFunctionType", - }, - ], - "range": Array [ - 12, - 24, - ], - "type": "TSTypeParameterInstantiation", }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", }, }, }, - "init": null, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 24, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, "range": Array [ - 4, - 24, + 22, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 0, - 25, - ], - "type": "VariableDeclaration", }, ], "loc": Object { @@ -107611,14 +116348,14 @@ Object { }, "range": Array [ 0, - 26, + 29, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -107628,46 +116365,46 @@ Object { }, "range": Array [ 0, - 3, + 4, ], - "type": "Keyword", - "value": "let", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 5, "line": 1, }, }, "range": Array [ - 4, 5, + 8, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 6, + 9, + 10, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { @@ -107676,16 +116413,16 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 11, "line": 1, }, }, "range": Array [ - 7, + 11, 12, ], - "type": "Identifier", - "value": "Array", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -107703,7 +116440,7 @@ Object { 13, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { @@ -107720,8 +116457,8 @@ Object { 13, 14, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -107739,43 +116476,61 @@ Object { 15, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 18, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 20, "line": 1, }, "start": Object { - "column": 19, + "column": 17, "line": 1, }, }, "range": Array [ - 19, - 23, + 17, + 20, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -107784,34 +116539,34 @@ Object { "line": 1, }, "start": Object { - "column": 23, + "column": 22, "line": 1, }, }, "range": Array [ - 23, + 22, 24, ], "type": "Punctuator", - "value": ">", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 28, "line": 1, }, "start": Object { - "column": 24, + "column": 25, "line": 1, }, }, "range": Array [ - 24, 25, + 28, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "any", }, ], "type": "Program", diff --git a/packages/typescript-estree/tests/lib/comments.ts b/packages/typescript-estree/tests/lib/comments.ts index e469c39f00ef..63b53ce9047d 100644 --- a/packages/typescript-estree/tests/lib/comments.ts +++ b/packages/typescript-estree/tests/lib/comments.ts @@ -8,10 +8,11 @@ import { readFileSync } from 'fs'; import glob from 'glob'; import { extname } from 'path'; -import { ParserOptions } from '../../src/temp-types-based-on-js-source'; +import { ParserOptions } from '../../src/parser-options'; import { createSnapshotTestBlock, - formatSnapshotName + formatSnapshotName, + isJSXFileType } from '../../tools/test-utils'; //------------------------------------------------------------------------------ @@ -35,7 +36,7 @@ describe('Comments', () => { range: true, tokens: true, comment: true, - jsx: fileExtension === '.js' + jsx: isJSXFileType(fileExtension) }; it( formatSnapshotName(filename, FIXTURES_DIR, fileExtension), diff --git a/packages/typescript-estree/tests/lib/convert.ts b/packages/typescript-estree/tests/lib/convert.ts new file mode 100644 index 000000000000..6fb1077a4714 --- /dev/null +++ b/packages/typescript-estree/tests/lib/convert.ts @@ -0,0 +1,152 @@ +import { Converter } from '../../src/convert'; +import ts from 'typescript'; + +describe('convert', () => { + function convertCode(code: string): ts.SourceFile { + return ts.createSourceFile( + 'text.ts', + code, + ts.ScriptTarget.ESNext, + true, + ts.ScriptKind.TSX + ); + } + + it('deeplyCopy should convert node correctly', () => { + const ast = convertCode('type foo = ?foo | ?(() => void)?'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect(instance.convertProgram()).toMatchSnapshot(); + }); + + it('deeplyCopy should convert node with decorators correctly', () => { + const ast = convertCode('@test class foo {}'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect((instance as any).deeplyCopy(ast.statements[0])).toMatchSnapshot(); + }); + + it('deeplyCopy should convert node with type parameters correctly', () => { + const ast = convertCode('class foo {}'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect((instance as any).deeplyCopy(ast.statements[0])).toMatchSnapshot(); + }); + + it('deeplyCopy should convert node with type arguments correctly', () => { + const ast = convertCode('new foo()'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect( + (instance as any).deeplyCopy((ast.statements[0] as any).expression) + ).toMatchSnapshot(); + }); + + it('deeplyCopy should convert array of nodes', () => { + const ast = convertCode('new foo()'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect((instance as any).deeplyCopy(ast)).toMatchSnapshot(); + }); + + it('deeplyCopy should fail on unknown node', () => { + const ast = convertCode('type foo = ?foo | ?(() => void)?'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: true, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect(() => instance.convertProgram()).toThrow( + 'Unknown AST_NODE_TYPE: "TSJSDocNullableType"' + ); + }); + + it('nodeMaps should contain basic nodes', () => { + const ast = convertCode(` + 'test'; + 2; + class foo {}; + type bar = {}; + `); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: true + }); + instance.convertProgram(); + const maps = instance.getASTMaps(); + + function checkMaps(child: any) { + child.forEachChild((node: any) => { + if ( + node.kind !== ts.SyntaxKind.EndOfFileToken && + node.kind !== ts.SyntaxKind.JsxAttributes && + node.kind !== ts.SyntaxKind.VariableDeclaration + ) { + expect(node).toBe( + maps.esTreeNodeToTSNodeMap.get(maps.tsNodeToESTreeNodeMap.get(node)) + ); + } + checkMaps(node); + }); + } + + expect(ast).toBe( + maps.esTreeNodeToTSNodeMap.get(maps.tsNodeToESTreeNodeMap.get(ast)) + ); + checkMaps(ast); + }); + + it('nodeMaps should contain jsx nodes', () => { + const ast = convertCode(``); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: true + }); + instance.convertProgram(); + const maps = instance.getASTMaps(); + + function checkMaps(child: any) { + child.forEachChild((node: any) => { + if ( + node.kind !== ts.SyntaxKind.EndOfFileToken && + node.kind !== ts.SyntaxKind.JsxAttributes + ) { + expect(node).toBe( + maps.esTreeNodeToTSNodeMap.get(maps.tsNodeToESTreeNodeMap.get(node)) + ); + } + checkMaps(node); + }); + } + + expect(ast).toBe( + maps.esTreeNodeToTSNodeMap.get(maps.tsNodeToESTreeNodeMap.get(ast)) + ); + checkMaps(ast); + }); +}); diff --git a/packages/typescript-estree/tests/lib/javascript.ts b/packages/typescript-estree/tests/lib/javascript.ts index aca646998b3b..d254f8fd612c 100644 --- a/packages/typescript-estree/tests/lib/javascript.ts +++ b/packages/typescript-estree/tests/lib/javascript.ts @@ -7,7 +7,7 @@ */ import { readFileSync } from 'fs'; import glob from 'glob'; -import { ParserOptions } from '../../src/temp-types-based-on-js-source'; +import { ParserOptions } from '../../src/parser-options'; import { createSnapshotTestBlock, formatSnapshotName diff --git a/packages/typescript-estree/tests/lib/jsx.ts b/packages/typescript-estree/tests/lib/jsx.ts index 4f2963fa04ff..b887911ab008 100644 --- a/packages/typescript-estree/tests/lib/jsx.ts +++ b/packages/typescript-estree/tests/lib/jsx.ts @@ -7,12 +7,12 @@ */ import { readFileSync } from 'fs'; import glob from 'glob'; -import { ParserOptions } from '../../src/temp-types-based-on-js-source'; +import { ParserOptions } from '../../src/parser-options'; import { createSnapshotTestBlock, formatSnapshotName } from '../../tools/test-utils'; -import filesWithKnownIssues from '../../../typescript-eslint-shared-fixtures/jsx-known-issues'; +import filesWithKnownIssues from '../../../shared-fixtures/jsx-known-issues'; //------------------------------------------------------------------------------ // Setup diff --git a/packages/typescript-estree/tests/lib/parse.ts b/packages/typescript-estree/tests/lib/parse.ts index cbb9bebfd052..60aee02b1a06 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -6,7 +6,8 @@ * MIT License */ import * as parser from '../../src/parser'; -import { ParserOptions } from '../../src/temp-types-based-on-js-source'; +import * as astConverter from '../../src/ast-converter'; +import { ParserOptions } from '../../src/parser-options'; import { createSnapshotTestBlock } from '../../tools/test-utils'; //------------------------------------------------------------------------------ @@ -16,8 +17,8 @@ import { createSnapshotTestBlock } from '../../tools/test-utils'; describe('parse()', () => { describe('basic functionality', () => { it('should parse an empty string', () => { - expect((parser as any).parse('').body).toEqual([]); - expect(parser.parse('', {} as any).body).toEqual([]); + expect(parser.parse('').body).toEqual([]); + expect(parser.parse('', {}).body).toEqual([]); }); }); @@ -33,7 +34,7 @@ describe('parse()', () => { describe('general', () => { const code = 'let foo = bar;'; - const config = { + const config: ParserOptions = { comment: true, tokens: true, range: true, @@ -42,7 +43,98 @@ describe('parse()', () => { it( 'output tokens, comments, locs, and ranges when called with those options', - createSnapshotTestBlock(code, config as ParserOptions) + createSnapshotTestBlock(code, config) ); }); + + describe('non string code', () => { + const code = (12345 as any) as string; + const config: ParserOptions = { + comment: true, + tokens: true, + range: true, + loc: true + }; + + it( + 'should correctly convert code to a string for parse()', + createSnapshotTestBlock(code, config) + ); + + it( + 'should correctly convert code to a string for parseAndGenerateServices()', + createSnapshotTestBlock(code, config, true) + ); + }); + + describe('loggerFn should be propagated to ast-converter', () => { + it('output tokens, comments, locs, and ranges when called with those options', () => { + const spy = jest.spyOn(astConverter, 'default'); + + const loggerFn = jest.fn(() => true); + + parser.parse('let foo = bar;', { + loggerFn, + comment: true, + tokens: true, + range: true, + loc: true + }); + + expect(spy).toHaveBeenCalledWith( + expect.any(Object), + { + code: 'let foo = bar;', + comment: true, + comments: [], + errorOnTypeScriptSyntacticAndSemanticIssues: false, + errorOnUnknownASTType: false, + extraFileExtensions: [], + jsx: false, + loc: true, + log: loggerFn, + projects: [], + range: true, + strict: false, + tokens: expect.any(Array), + tsconfigRootDir: expect.any(String), + useJSXTextNode: false + }, + false + ); + }); + }); + + describe('errorOnTypeScriptSyntacticAndSemanticIssues', () => { + const code = '@test const foo = 2'; + const options: ParserOptions = { + comment: true, + tokens: true, + range: true, + loc: true, + errorOnTypeScriptSyntacticAndSemanticIssues: true + }; + + it('should throw on invalid option when used in parse', () => { + expect(() => { + parser.parse(code, options); + }).toThrow( + `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()` + ); + }); + + it('should not throw when used in parseAndGenerateServices', () => { + expect(() => { + parser.parseAndGenerateServices(code, options); + }).not.toThrow( + `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()` + ); + }); + + it('should error on invalid code', () => { + expect(() => { + parser.parseAndGenerateServices(code, options); + }).toThrow('Decorators are not valid here.'); + }); + }); }); diff --git a/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.ts b/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.ts index 8231b96185df..2cd5555bce71 100644 --- a/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.ts +++ b/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.ts @@ -8,7 +8,7 @@ import { readFileSync } from 'fs'; import glob from 'glob'; import * as parser from '../../src/parser'; import { extname } from 'path'; -import { formatSnapshotName } from '../../tools/test-utils'; +import { formatSnapshotName, isJSXFileType } from '../../tools/test-utils'; //------------------------------------------------------------------------------ // Setup @@ -30,12 +30,13 @@ describe('Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" testFiles.forEach(filename => { const code = readFileSync(filename, 'utf8'); const fileExtension = extname(filename); - const config = { + const config: parser.ParserOptions = { loc: true, range: true, tokens: true, errorOnUnknownASTType: true, - errorOnTypeScriptSyntacticAndSemanticIssues: true + errorOnTypeScriptSyntacticAndSemanticIssues: true, + jsx: isJSXFileType(fileExtension) }; it(formatSnapshotName(filename, FIXTURES_DIR, fileExtension), () => { expect.assertions(1); diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index eb5af8677e97..126ad35879b6 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -11,12 +11,18 @@ import { readFileSync } from 'fs'; import glob from 'glob'; import { extname, join, resolve } from 'path'; import ts from 'typescript'; -import { ParserOptions } from '../../src/temp-types-based-on-js-source'; +import { ParserOptions } from '../../src/parser-options'; import { createSnapshotTestBlock, formatSnapshotName, parseCodeAndGenerateServices } from '../../tools/test-utils'; +import { parseAndGenerateServices } from '../../src/parser'; +import { + VariableDeclaration, + ClassDeclaration, + ClassProperty +} from '../../src/typedefs'; //------------------------------------------------------------------------------ // Setup @@ -59,6 +65,23 @@ describe('semanticInfo', () => { ); }); + it(`should handle "project": "./tsconfig.json" and "project": ["./tsconfig.json"] the same`, () => { + const filename = testFiles[0]; + const code = readFileSync(filename, 'utf8'); + const options = createOptions(filename); + const optionsProjectString = { + ...options, + project: './tsconfig.json' + }; + const optionsProjectArray = { + ...options, + project: ['./tsconfig.json'] + }; + expect(parseAndGenerateServices(code, optionsProjectString)).toEqual( + parseAndGenerateServices(code, optionsProjectArray) + ); + }); + // case-specific tests it('isolated-file tests', () => { const fileName = resolve(FIXTURES_DIR, 'isolated-file.src.ts'); @@ -83,6 +106,29 @@ describe('semanticInfo', () => { testIsolatedFile(parseResult); }); + it('non-existent-estree-nodes tests', () => { + const fileName = resolve(FIXTURES_DIR, 'non-existent-estree-nodes.src.ts'); + const parseResult = parseCodeAndGenerateServices( + readFileSync(fileName, 'utf8'), + createOptions(fileName) + ); + + expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap'); + const binaryExpression = (parseResult.ast.body[0] as VariableDeclaration) + .declarations[0].init!; + const tsBinaryExpression = parseResult.services.esTreeNodeToTSNodeMap!.get( + binaryExpression + ); + expect(tsBinaryExpression.kind).toEqual(ts.SyntaxKind.BinaryExpression); + + const computedPropertyString = ((parseResult.ast + .body[1] as ClassDeclaration).body.body[0] as ClassProperty).key; + const tsComputedPropertyString = parseResult.services.esTreeNodeToTSNodeMap!.get( + computedPropertyString + ); + expect(tsComputedPropertyString.kind).toEqual(ts.SyntaxKind.StringLiteral); + }); + it('imported-file tests', () => { const fileName = resolve(FIXTURES_DIR, 'import-file.src.ts'); const parseResult = parseCodeAndGenerateServices( @@ -105,10 +151,10 @@ describe('semanticInfo', () => { arrayBoundName ); expect(tsArrayBoundName).toBeDefined(); - checkNumberArrayType(checker, tsArrayBoundName); + checkNumberArrayType(checker, tsArrayBoundName!); expect( - parseResult.services.tsNodeToESTreeNodeMap!.get(tsArrayBoundName) + parseResult.services.tsNodeToESTreeNodeMap!.get(tsArrayBoundName!) ).toBe(arrayBoundName); }); @@ -131,9 +177,9 @@ describe('semanticInfo', () => { ); expect(tsBoundName).toBeDefined(); - checkNumberArrayType(checker, tsBoundName); + checkNumberArrayType(checker, tsBoundName!); - expect(parseResult.services.tsNodeToESTreeNodeMap!.get(tsBoundName)).toBe( + expect(parseResult.services.tsNodeToESTreeNodeMap!.get(tsBoundName!)).toBe( boundName ); }); @@ -161,7 +207,7 @@ describe('semanticInfo', () => { badConfig.project = './tsconfigs.json'; expect(() => parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig) - ).toThrowError(/File .+tsconfigs\.json' not found/); + ).toThrow(/File .+tsconfigs\.json' not found/); }); it('fail to read project file', () => { @@ -170,7 +216,7 @@ describe('semanticInfo', () => { badConfig.project = '.'; expect(() => parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig) - ).toThrowError(/File .+semanticInfo' not found/); + ).toThrow(/File .+semanticInfo' not found/); }); it('malformed project file', () => { diff --git a/packages/typescript-estree/tests/lib/tsx.ts b/packages/typescript-estree/tests/lib/tsx.ts index 8d4230a2c91f..c9409877b84f 100644 --- a/packages/typescript-estree/tests/lib/tsx.ts +++ b/packages/typescript-estree/tests/lib/tsx.ts @@ -7,10 +7,11 @@ import { readFileSync } from 'fs'; import glob from 'glob'; import { extname } from 'path'; -import { ParserOptions } from '../../src/temp-types-based-on-js-source'; +import { ParserOptions } from '../../src/parser-options'; import { createSnapshotTestBlock, - formatSnapshotName + formatSnapshotName, + isJSXFileType } from '../../tools/test-utils'; //------------------------------------------------------------------------------ @@ -28,16 +29,17 @@ const testFiles = glob.sync(`${FIXTURES_DIR}/**/*.src.tsx`); describe('TSX', () => { testFiles.forEach(filename => { const code = readFileSync(filename, 'utf8'); + const fileExtension = extname(filename); const config: ParserOptions = { loc: true, range: true, tokens: true, errorOnUnknownASTType: true, useJSXTextNode: true, - jsx: true + jsx: isJSXFileType(fileExtension) }; it( - formatSnapshotName(filename, FIXTURES_DIR, extname(filename)), + formatSnapshotName(filename, FIXTURES_DIR, fileExtension), createSnapshotTestBlock(code, config) ); }); diff --git a/packages/typescript-estree/tests/lib/typescript.ts b/packages/typescript-estree/tests/lib/typescript.ts index dabfac14def4..2ccd8cb9786b 100644 --- a/packages/typescript-estree/tests/lib/typescript.ts +++ b/packages/typescript-estree/tests/lib/typescript.ts @@ -8,10 +8,11 @@ import { readFileSync } from 'fs'; import glob from 'glob'; import { extname } from 'path'; -import { ParserOptions } from '../../src/temp-types-based-on-js-source'; +import { ParserOptions } from '../../src/parser-options'; import { createSnapshotTestBlock, - formatSnapshotName + formatSnapshotName, + isJSXFileType } from '../../tools/test-utils'; //------------------------------------------------------------------------------ @@ -29,14 +30,16 @@ const testFiles = glob.sync(`${FIXTURES_DIR}/**/*.src.ts`); describe('typescript', () => { testFiles.forEach(filename => { const code = readFileSync(filename, 'utf8'); + const fileExtension = extname(filename); const config: ParserOptions = { loc: true, range: true, tokens: true, - errorOnUnknownASTType: true + errorOnUnknownASTType: true, + jsx: isJSXFileType(fileExtension) }; it( - formatSnapshotName(filename, FIXTURES_DIR, extname(filename)), + formatSnapshotName(filename, FIXTURES_DIR, fileExtension), createSnapshotTestBlock(code, config) ); }); diff --git a/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts b/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts new file mode 100644 index 000000000000..565b997c35fc --- /dev/null +++ b/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts @@ -0,0 +1,22 @@ +import semver from 'semver'; +import * as parser from '../../src/parser'; + +jest.mock('semver'); + +describe('Warn on unsupported TypeScript version', () => { + afterEach(() => { + jest.resetModules(); + jest.resetAllMocks(); + }); + + it('should warn the user if they are using an unsupported TypeScript version', () => { + (semver.satisfies as jest.Mock).mockReturnValue(false); + jest.spyOn(console, 'log').mockImplementation(); + parser.parse(''); + expect(console.log).toHaveBeenCalledWith( + expect.stringContaining( + 'WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree' + ) + ); + }); +}); diff --git a/packages/typescript-estree/tools/test-utils.ts b/packages/typescript-estree/tools/test-utils.ts index dc507d78e1e8..d06d229a36ed 100644 --- a/packages/typescript-estree/tools/test-utils.ts +++ b/packages/typescript-estree/tools/test-utils.ts @@ -6,7 +6,7 @@ * MIT License */ import * as parser from '../src/parser'; -import { ParserOptions } from '../src/temp-types-based-on-js-source'; +import { ParserOptions } from '../src/parser-options'; /** * Returns a raw copy of the given AST @@ -36,6 +36,7 @@ export function parseCodeAndGenerateServices( * and which performs an assertion on the snapshot for the given code and config. * @param {string} code The source code to parse * @param {ParserOptions} config the parser configuration + * @param {boolean} generateServices Flag determining whether to generate ast maps and program or not * @returns {jest.ProvidesCallback} callback for Jest it() block */ export function createSnapshotTestBlock( @@ -79,3 +80,14 @@ export function formatSnapshotName( .replace(fixturesDir + '/', '') .replace(fileExtension, '')}`; } + +/** + * Check if file extension is one used for jsx + * @param fileType + */ +export function isJSXFileType(fileType: string): boolean { + if (fileType.startsWith('.')) { + fileType = fileType.slice(1); + } + return fileType === 'js' || fileType === 'jsx' || fileType === 'tsx'; +} diff --git a/tests/integration/docker-compose.yml b/tests/integration/docker-compose.yml index 2c2e4c241db5..086f3e76485d 100644 --- a/tests/integration/docker-compose.yml +++ b/tests/integration/docker-compose.yml @@ -9,11 +9,11 @@ services: # but apply an empty volume for the package tests, we don't need those. - ../../package.json/:/usr/root-package.json - ./utils/:/usr/utils - - ../../packages/typescript-eslint-parser/dist/:/usr/parser + - ../../packages/parser/:/usr/parser - /usr/parser/tests - ../../packages/typescript-estree/:/usr/typescript-estree - /usr/typescript-estree/tests - - ../../packages/eslint-plugin-typescript/:/usr/eslint-plugin + - ../../packages/eslint-plugin/:/usr/eslint-plugin - /usr/eslint-plugin/tests - ../../packages/eslint-plugin-tslint/:/usr/eslint-plugin-tslint - /usr/eslint-plugin-tslint/tests diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.yml b/tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.yml index 90a1f7a0acf8..1e7fd8888744 100644 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.yml +++ b/tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.yml @@ -1,25 +1,25 @@ root: true -# Local version of typescript-eslint-parser -parser: /usr/parser/parser.js +# Local version of @typescript-eslint/parser +parser: '@typescript-eslint/parser' plugins: -# Should resolve local version of @typescript-eslint/eslint-plugin -- typescript -# Should resolve local version of @typescript-eslint/eslint-plugin-tslint -- tslint +# Local version of @typescript-eslint/eslint-plugin +- '@typescript-eslint' +# Local version of @typescript-eslint/eslint-plugin-tslint +- '@typescript-eslint/tslint' env: es6: true node: true extends: -- plugin:typescript/recommended +- plugin:@typescript-eslint/recommended parserOptions: sourceType: module ecmaFeatures: jsx: false project: /usr/linked/tsconfig.json rules: - tslint/config: + '@typescript-eslint/tslint/config': - error - rules: semicolon: [true, 'always'] diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap b/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap index 331ae0c462d6..a4df7d29fe6d 100644 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap +++ b/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap @@ -15,9 +15,8 @@ Array [ "line": 1, "message": "'noSemi' is assigned a value but never used.", "nodeType": "Identifier", - "ruleId": "typescript/no-unused-vars", + "ruleId": "@typescript-eslint/no-unused-vars", "severity": 1, - "source": "const noSemi = true", }, Object { "column": 20, @@ -26,9 +25,8 @@ Array [ "line": 1, "message": "Missing semicolon (tslint:semicolon)", "nodeType": null, - "ruleId": "tslint/config", + "ruleId": "@typescript-eslint/tslint/config", "severity": 2, - "source": "const noSemi = true", }, ], "source": "const noSemi = true diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh b/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh index f9804fa8767f..dbd94edf768b 100755 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh +++ b/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh @@ -6,6 +6,12 @@ node /usr/utils/generate-package-json.js # Install dependencies npm install +# Use the local volumes for our own packages +npm install $(npm pack /usr/typescript-estree | tail -1) +npm install $(npm pack /usr/parser | tail -1) +npm install $(npm pack /usr/eslint-plugin-tslint | tail -1) +npm install $(npm pack /usr/eslint-plugin | tail -1) + # Run the linting # (the "|| true" helps make sure that we run our tests on failed linting runs as well) npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.ts || true diff --git a/tests/integration/utils/generate-package-json.js b/tests/integration/utils/generate-package-json.js index 03dd6a55c386..1f08f53b1ea5 100644 --- a/tests/integration/utils/generate-package-json.js +++ b/tests/integration/utils/generate-package-json.js @@ -10,19 +10,13 @@ const testPackageJSON = { devDependencies: { eslint: rootPackageJSON.devDependencies.eslint, typescript: rootPackageJSON.devDependencies.typescript, - tslint: '^5.11.0', + tslint: rootPackageJSON.devDependencies.tslint, /** * TEMP: Bump jest to ahead of our stable usage in the monorepo, * we need the bleeding edge snapshotResolver option */ // jest: rootPackageJSON.devDependencies.jest, - jest: '24.0.0-alpha.12', - /** - * Use the local volumes for our own packages - */ - 'eslint-plugin-typescript': 'file:/usr/eslint-plugin', - 'eslint-plugin-tslint': 'file:/usr/eslint-plugin-tslint', - 'typescript-estree': 'file:/usr/typescript-estree' + jest: '24.0.0-alpha.12' } }; diff --git a/yarn.lock b/yarn.lock index 1597cb6dbb27..95f575e0097c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,10 +18,10 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.2.3.tgz#32f5df65744b70888d17872ec106b02434ba1489" - integrity sha512-0LyEcVlfCoFmci8mXx8A5oIkpkOgyo8dRHtxBnK9RRBwxO2+JZPNsqtVEZQ7mJFPxnXF9lfmU24mHOPI0qnlkA== +"@babel/parser@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.2.tgz#95cdeddfc3992a6ca2a1315191c1679ca32c55cd" + integrity sha512-QzNUC2RO1gadg+fs21fi0Uu0OuGNzRKEmgCxoLNzbCdoprLwjfmZwzUrpUNfJPaVRwBpDY47A17yYEGWyRelnQ== "@commitlint/cli@^7.1.2", "@commitlint/cli@^7.3.2": version "7.3.2" @@ -163,6 +163,20 @@ babel-runtime "6.26.0" execa "0.9.0" +"@iamstarkov/listr-update-renderer@0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@iamstarkov/listr-update-renderer/-/listr-update-renderer-0.4.1.tgz#d7c48092a2dcf90fd672b6c8b458649cb350c77e" + integrity sha512-IJyxQWsYDEkf8C8QthBn5N8tIUR9V9je6j3sMIpAkonaadjbvxmRC6RAhpa3RKxndhNnU2M6iNbtJwd7usQYIA== + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + elegant-spinner "^1.0.1" + figures "^1.7.0" + indent-string "^3.0.0" + log-symbols "^1.0.2" + log-update "^2.3.0" + strip-ansi "^3.0.1" + "@lerna/add@3.10.5": version "3.10.5" resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.10.5.tgz#10dcd1069eee18a84432f826a38d6791af8a2fef" @@ -802,7 +816,7 @@ "@types/estree" "*" "@types/json-schema" "*" -"@types/estree@*", "@types/estree@^0.0.39": +"@types/estree@*": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== @@ -898,13 +912,6 @@ acorn-globals@^4.1.0: acorn "^6.0.1" acorn-walk "^6.0.1" -acorn-jsx@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" - integrity sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s= - dependencies: - acorn "^3.0.4" - acorn-jsx@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" @@ -915,12 +922,7 @@ acorn-walk@^6.0.1: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.1.1.tgz#d363b66f5fac5f018ff9c3a1e7b6f8e310cc3913" integrity sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw== -acorn@^3.0.4: - version "3.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" - integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= - -acorn@^5.5.0, acorn@^5.5.3: +acorn@^5.5.3: version "5.7.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== @@ -944,21 +946,6 @@ agentkeepalive@^3.4.1: dependencies: humanize-ms "^1.2.1" -ajv-keywords@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" - integrity sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I= - -ajv@^5.2.3, ajv@^5.3.0: - version "5.5.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" - integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= - dependencies: - co "^4.6.0" - fast-deep-equal "^1.0.0" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.3.0" - ajv@^6.5.3, ajv@^6.5.5, ajv@^6.6.1: version "6.7.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.7.0.tgz#e3ce7bb372d6577bb1839f1dfdfcbf5ad2948d96" @@ -1630,11 +1617,6 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4 escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chardet@^0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" - integrity sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I= - chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" @@ -1650,6 +1632,11 @@ ci-info@^1.5.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.6.0.tgz#2ca20dbb9ceb32d4524a683303313f0304b1e497" integrity sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A== +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + circular-json@^0.3.1: version "0.3.3" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" @@ -1951,6 +1938,15 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= +cosmiconfig@5.0.6: + version "5.0.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39" + integrity sha512-6DWfizHriCrFWURP1/qyhsiFvYdlJzbCzmtFWh744+KyWsJo5+kPzUZZaMRSSItoYc0pxFX7gEO7ZC1/gN/7AQ== + dependencies: + is-directory "^0.3.1" + js-yaml "^3.9.0" + parse-json "^4.0.0" + cosmiconfig@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc" @@ -1961,7 +1957,7 @@ cosmiconfig@^4.0.0: parse-json "^4.0.0" require-from-string "^2.0.1" -cosmiconfig@^5.0.2: +cosmiconfig@^5.0.2, cosmiconfig@^5.0.7: version "5.0.7" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.7.tgz#39826b292ee0d78eda137dfa3173bd1c21a43b04" integrity sha512-PcLqxTKiDmNT6pSpy4N6KtuPwb53W+2tzNvwOZw0WH9N6O0vLIBq0x8aj8Oj75ere4YcGi48bDFCL+3fRJdlNA== @@ -1971,7 +1967,7 @@ cosmiconfig@^5.0.2: js-yaml "^3.9.0" parse-json "^4.0.0" -cross-spawn@^5.0.1, cross-spawn@^5.1.0: +cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= @@ -2168,6 +2164,18 @@ define-property@^2.0.2: is-descriptor "^1.0.2" isobject "^3.0.1" +del@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/del/-/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5" + integrity sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU= + dependencies: + globby "^6.1.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + p-map "^1.1.1" + pify "^3.0.0" + rimraf "^2.2.8" + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" @@ -2336,7 +2344,7 @@ es6-promisify@^5.0.0: dependencies: es6-promise "^4.0.3" -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.4, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= @@ -2365,13 +2373,15 @@ eslint-docs@^0.2.6: ora "^3.0.0" read-pkg-up "^4.0.0" -eslint-scope@^3.7.1: - version "3.7.3" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.3.tgz#bb507200d3d17f60247636160b4826284b108535" - integrity sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA== - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" +eslint-plugin-eslint-plugin@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-2.0.1.tgz#d275434969dbde3da1d4cb7a121dc8d88457c786" + integrity sha512-kJ5TZsRJH/xYstG07v3YeOy/W5SDAEzV+bvvoL0aiG1HtqDmg4mJvNPnn/JngANMmsx8oXlJrIcBTCpJzm+9kg== + +eslint-plugin-jest@^22.2.2: + version "22.2.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.2.2.tgz#2a80d70a20c27dfb1503a6f32cdcb647fe5476df" + integrity sha512-hnWgh9o39VJfz6lJEyQJdTW7dN2yynlGkmPOlU/oMHh+d7WVMsJP1GeDTB520VCDljEdKExCwD5IBpQIUl4mJg== eslint-scope@^4.0.0: version "4.0.0" @@ -2391,49 +2401,48 @@ eslint-visitor-keys@^1.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== -eslint@^4.19.1: - version "4.19.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" - integrity sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ== +eslint@^5.12.1: + version "5.12.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.12.1.tgz#5ca9931fb9029d04e7be92b03ce3b58edfac7e3b" + integrity sha512-54NV+JkTpTu0d8+UYSA8mMKAG4XAsaOrozA9rCW7tgneg1mevcL7wIotPC+fZ0SkWwdhNqoXoxnQCTBp7UvTsg== dependencies: - ajv "^5.3.0" - babel-code-frame "^6.22.0" + "@babel/code-frame" "^7.0.0" + ajv "^6.5.3" chalk "^2.1.0" - concat-stream "^1.6.0" - cross-spawn "^5.1.0" - debug "^3.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" doctrine "^2.1.0" - eslint-scope "^3.7.1" + eslint-scope "^4.0.0" + eslint-utils "^1.3.1" eslint-visitor-keys "^1.0.0" - espree "^3.5.4" - esquery "^1.0.0" + espree "^5.0.0" + esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^2.0.0" functional-red-black-tree "^1.0.1" glob "^7.1.2" - globals "^11.0.1" - ignore "^3.3.3" + globals "^11.7.0" + ignore "^4.0.6" + import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^3.0.6" - is-resolvable "^1.0.0" - js-yaml "^3.9.1" + inquirer "^6.1.0" + js-yaml "^3.12.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.4" - minimatch "^3.0.2" + lodash "^4.17.5" + minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" path-is-inside "^1.0.2" pluralize "^7.0.0" progress "^2.0.0" - regexpp "^1.0.1" - require-uncached "^1.0.3" - semver "^5.3.0" + regexpp "^2.0.1" + semver "^5.5.1" strip-ansi "^4.0.0" - strip-json-comments "~2.0.1" - table "4.0.2" - text-table "~0.2.0" + strip-json-comments "^2.0.1" + table "^5.0.2" + text-table "^0.2.0" eslint@^5.9.0: version "5.12.0" @@ -2478,14 +2487,6 @@ eslint@^5.9.0: table "^5.0.2" text-table "^0.2.0" -espree@^3.5.4: - version "3.5.4" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" - integrity sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A== - dependencies: - acorn "^5.5.0" - acorn-jsx "^3.0.0" - espree@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.0.tgz#fc7f984b62b36a0f543b13fb9cd7b9f4a7f5b65c" @@ -2505,7 +2506,7 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.0.0, esquery@^1.0.1: +esquery@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== @@ -2536,7 +2537,7 @@ exec-sh@^0.2.0: dependencies: merge "^1.2.0" -execa@0.9.0, execa@^0.9.0: +execa@0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/execa/-/execa-0.9.0.tgz#adb7ce62cf985071f60580deb4a88b9e34712d01" integrity sha512-BbUMBiX4hqiHZUA5+JujIjNb6TyAlp2D5KLheMjMluwOuzcnylDL4AxZYLLn1n2AGB49eSWwyKvvEQoRpnAtmA== @@ -2639,15 +2640,6 @@ extend@~3.0.2: resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== -external-editor@^2.0.4: - version "2.2.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" - integrity sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A== - dependencies: - chardet "^0.4.0" - iconv-lite "^0.4.17" - tmp "^0.0.33" - external-editor@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" @@ -2688,11 +2680,6 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= -fast-deep-equal@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" - integrity sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ= - fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" @@ -2948,6 +2935,15 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= +g-status@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/g-status/-/g-status-2.0.2.tgz#270fd32119e8fc9496f066fe5fe88e0a6bc78b97" + integrity sha512-kQoE9qH+T1AHKgSSD0Hkv98bobE90ILQcXAF4wvGgsr7uFqNvwmh8j+Lq3l0RVt3E3HjSbv2B9biEGcEtpHLCA== + dependencies: + arrify "^1.0.1" + matcher "^1.0.0" + simple-git "^1.85.0" + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -3017,6 +3013,11 @@ get-stdin@^4.0.1: resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" @@ -3145,7 +3146,7 @@ global-dirs@^0.1.0: dependencies: ini "^1.3.4" -globals@^11.0.1, globals@^11.7.0: +globals@^11.7.0: version "11.10.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.10.0.tgz#1e09776dffda5e01816b3bb4077c8b59c24eaa50" integrity sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ== @@ -3155,6 +3156,17 @@ globals@^9.18.0: resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== +globby@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" + integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw= + dependencies: + array-union "^1.0.1" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + globby@^8.0.1: version "8.0.2" resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.2.tgz#5697619ccd95c5275dbb2d6faa42087c1a941d8d" @@ -3324,16 +3336,23 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@0.14.3: - version "0.14.3" - resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3" - integrity sha512-e21wivqHpstpoiWA/Yi8eFti8E+sQDSS53cpJsPptPs295QTOQR0ZwnHo2TXy1XOpZFD9rPOd3NpmqTK6uMLJA== +husky@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/husky/-/husky-1.3.1.tgz#26823e399300388ca2afff11cfa8a86b0033fae0" + integrity sha512-86U6sVVVf4b5NYSZ0yvv88dRgBSSXXmHaiq5pP4KDj5JVzdwKgBjEtUPOm8hcoytezFwbU+7gotXNhpHdystlg== dependencies: - is-ci "^1.0.10" - normalize-path "^1.0.0" - strip-indent "^2.0.0" - -iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: + cosmiconfig "^5.0.7" + execa "^1.0.0" + find-up "^3.0.0" + get-stdin "^6.0.0" + is-ci "^2.0.0" + pkg-dir "^3.0.0" + please-upgrade-node "^3.1.1" + read-pkg "^4.0.1" + run-node "^1.0.0" + slash "^2.0.0" + +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -3352,7 +3371,7 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" -ignore@^3.3.3, ignore@^3.3.5: +ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== @@ -3435,26 +3454,6 @@ init-package-json@^1.10.3: validate-npm-package-license "^3.0.1" validate-npm-package-name "^3.0.0" -inquirer@^3.0.6: - version "3.3.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" - integrity sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ== - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^2.0.4" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rx-lite "^4.0.8" - rx-lite-aggregates "^4.0.8" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - inquirer@^6.1.0, inquirer@^6.2.0: version "6.2.1" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.1.tgz#9943fc4882161bdb0b0c9276769c75b32dbfcd52" @@ -3544,6 +3543,13 @@ is-ci@^1.0.10: dependencies: ci-info "^1.5.0" +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -3696,6 +3702,25 @@ is-observable@^1.1.0: dependencies: symbol-observable "^1.1.0" +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + integrity sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0= + +is-path-in-cwd@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" + integrity sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ== + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" + integrity sha1-jvW33lBDej/cprToZe96pVy0gDY= + dependencies: + path-is-inside "^1.0.1" + is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" @@ -3735,11 +3760,6 @@ is-regexp@^1.0.0: resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= -is-resolvable@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" - integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg== - is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -4203,7 +4223,7 @@ js-tokens@^3.0.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= -js-yaml@^3.12.0, js-yaml@^3.7.0, js-yaml@^3.9.0, js-yaml@^3.9.1: +js-yaml@^3.12.0, js-yaml@^3.7.0, js-yaml@^3.9.0: version "3.12.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.1.tgz#295c8632a18a23e054cf5c9d3cecafe678167600" integrity sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA== @@ -4258,11 +4278,6 @@ json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1: resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== -json-schema-traverse@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" - integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A= - json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -4500,22 +4515,25 @@ libnpmteam@^1.0.1: get-stream "^4.0.0" npm-registry-fetch "^3.8.0" -lint-staged@7.3.0: - version "7.3.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-7.3.0.tgz#90ff33e5ca61ed3dbac35b6f6502dbefdc0db58d" - integrity sha512-AXk40M9DAiPi7f4tdJggwuKIViUplYtVj1os1MVEteW7qOkU50EOehayCfO9TsoGK24o/EsWb41yrEgfJDDjCw== +lint-staged@8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-8.1.0.tgz#dbc3ae2565366d8f20efb9f9799d076da64863f2" + integrity sha512-yfSkyJy7EuVsaoxtUSEhrD81spdJOe/gMTGea3XaV7HyoRhTb9Gdlp6/JppRZERvKSEYXP9bjcmq6CA5oL2lYQ== dependencies: + "@iamstarkov/listr-update-renderer" "0.4.1" chalk "^2.3.1" commander "^2.14.1" - cosmiconfig "^5.0.2" + cosmiconfig "5.0.6" debug "^3.1.0" dedent "^0.7.0" - execa "^0.9.0" + del "^3.0.0" + execa "^1.0.0" find-parent-dir "^0.3.0" + g-status "^2.0.2" is-glob "^4.0.0" is-windows "^1.0.2" jest-validate "^23.5.0" - listr "^0.14.1" + listr "^0.14.2" lodash "^4.17.5" log-symbols "^2.2.0" micromatch "^3.1.8" @@ -4524,7 +4542,7 @@ lint-staged@7.3.0: path-is-inside "^1.0.2" pify "^3.0.0" please-upgrade-node "^3.0.2" - staged-git-files "1.1.1" + staged-git-files "1.1.2" string-argv "^0.0.2" stringify-object "^3.2.2" @@ -4557,7 +4575,7 @@ listr-verbose-renderer@^0.5.0: date-fns "^1.27.2" figures "^2.0.0" -listr@^0.14.1: +listr@^0.14.2: version "0.14.3" resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.3.tgz#2fea909604e434be464c50bddba0d496928fa586" integrity sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA== @@ -4667,7 +4685,7 @@ lodash.unescape@4.0.1: resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw= -lodash@4.17.11, lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0: +lodash@4.17.11, lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== @@ -4795,6 +4813,13 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" +matcher@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/matcher/-/matcher-1.1.1.tgz#51d8301e138f840982b338b116bb0c09af62c1c2" + integrity sha512-+BmqxWIubKTRKNWx/ahnCkk3mG8m7OturVlqq6HiojGJTd5hVYbgZm6WzcYPCoB+KBT4Vd6R7WSRG2OADNaCjg== + dependencies: + escape-string-regexp "^1.0.4" + math-random@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" @@ -4934,7 +4959,7 @@ mimic-fn@^1.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: +minimatch@^3.0.0, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -5190,11 +5215,6 @@ normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package- semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" - integrity sha1-MtDkcvkf80VwHBWoMRAY07CpA3k= - normalize-path@^2.0.1, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" @@ -5716,7 +5736,14 @@ pkg-dir@^2.0.0: dependencies: find-up "^2.1.0" -please-upgrade-node@^3.0.2: +pkg-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== + dependencies: + find-up "^3.0.0" + +please-upgrade-node@^3.0.2, please-upgrade-node@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac" integrity sha512-KY1uHnQ2NlQHqIJQpnh/i54rKkuxCEBx+voJIS/Mvb+L2iYd2NMotwduhKTMjfC1uKoX3VXOxLjIYG66dfJTVQ== @@ -5967,6 +5994,15 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" +read-pkg@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237" + integrity sha1-ljYlN48+HE1IyFhytabsfV0JMjc= + dependencies: + normalize-package-data "^2.3.2" + parse-json "^4.0.0" + pify "^3.0.0" + read@1, read@~1.0.1: version "1.0.7" resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" @@ -6045,11 +6081,6 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexpp@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" - integrity sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw== - regexpp@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" @@ -6216,7 +6247,7 @@ right-pad@^1.0.1: resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0" integrity sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA= -rimraf@2, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3, rimraf@~2.6.2: +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3, rimraf@~2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -6235,6 +6266,11 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" +run-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" + integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== + run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" @@ -6242,18 +6278,6 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rx-lite-aggregates@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" - integrity sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74= - dependencies: - rx-lite "*" - -rx-lite@*, rx-lite@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" - integrity sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ= - rxjs@^6.1.0, rxjs@^6.3.3: version "6.3.3" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz#3c6a7fa420e844a81390fb1158a9ec614f4bad55" @@ -6366,6 +6390,13 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= +simple-git@^1.85.0: + version "1.107.0" + resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.107.0.tgz#12cffaf261c14d6f450f7fdb86c21ccee968b383" + integrity sha512-t4OK1JRlp4ayKRfcW6owrWcRVLyHRUlhGd0uN6ZZTqfDq8a5XpcUdOKiGRNobHEuMtNqzp0vcJNvhYWwh5PsQA== + dependencies: + debug "^4.0.1" + sisteransi@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-0.1.1.tgz#5431447d5f7d1675aac667ccd0b865a4994cb3ce" @@ -6376,18 +6407,16 @@ slash@^1.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" integrity sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU= -slice-ansi@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" - integrity sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg== - dependencies: - is-fullwidth-code-point "^2.0.0" - slice-ansi@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.0.0.tgz#5373bdb8559b45676e8541c66916cdd6251612e7" @@ -6580,10 +6609,10 @@ stack-utils@^1.0.1: resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== -staged-git-files@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.1.tgz#37c2218ef0d6d26178b1310719309a16a59f8f7b" - integrity sha512-H89UNKr1rQJvI1c/PIR3kiAMBV23yvR7LItZiV74HWZwzt7f3YHuujJ9nJZlt58WlFox7XQsOahexwk7nTe69A== +staged-git-files@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.2.tgz#4326d33886dc9ecfa29a6193bf511ba90a46454b" + integrity sha512-0Eyrk6uXW6tg9PYkhi/V/J4zHp33aNyi2hOCmhFLqLTIhbgqWn5jlSzI+IU0VqrZq6+DbHcabQl/WP6P3BG0QA== static-extend@^0.1.1: version "0.1.2" @@ -6755,18 +6784,6 @@ symbol-tree@^3.2.2: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" integrity sha1-rifbOPZgp64uHDt9G8KQgZuFGeY= -table@4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" - integrity sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA== - dependencies: - ajv "^5.2.3" - ajv-keywords "^2.1.0" - chalk "^2.1.0" - lodash "^4.17.4" - slice-ansi "1.0.0" - string-width "^2.1.1" - table@^5.0.2: version "5.2.1" resolved "https://registry.yarnpkg.com/table/-/table-5.2.1.tgz#e78463702b1be9f7131c39860bcfb1b81114c2a1" @@ -6832,7 +6849,7 @@ text-extensions@^1.0.0: resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== -text-table@^0.2.0, text-table@~0.2.0: +text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= @@ -7008,6 +7025,13 @@ tsutils@^2.27.2: dependencies: tslib "^1.8.1" +tsutils@^3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.7.0.tgz#f97bdd2f109070bd1865467183e015b25734b477" + integrity sha512-n+e+3q7Jx2kfZw7tjfI9axEIWBY0sFMOlC+1K70X0SeXpO/UYSB+PN+E9tIJNqViB7oiXQdqD7dNchnvoneZew== + dependencies: + tslib "^1.8.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -7032,10 +7056,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@~3.2.1: - version "3.2.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5" - integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg== +"typescript@>=3.2.1 <3.4.0": + version "3.3.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.1.tgz#6de14e1db4b8a006ac535e482c8ba018c55f750b" + integrity sha512-cTmIDFW7O0IHbn1DPYjkiebHxwtCMU+eTy30ZtJNBPF9j2O1ITu5XH2YnBeVRKWHqF+3JQwWJv0Q0aUgX8W7IA== uglify-js@^3.1.4: version "3.4.9"