diff --git a/.dprint.jsonc b/.dprint.jsonc index 98a8c53f8e5c4..88316e24f849b 100644 --- a/.dprint.jsonc +++ b/.dprint.jsonc @@ -30,6 +30,7 @@ "importDeclaration.sortNamedImports": "maintain" }, "prettier": { + "newLineKind": "lf", "associations": [ "**/*.{yaml,yml}" ], @@ -55,8 +56,8 @@ ], // Note: if adding new languages, make sure settings.template.json is updated too. "plugins": [ - "https://plugins.dprint.dev/typescript-0.88.3.wasm", - "https://plugins.dprint.dev/json-0.19.0.wasm", - "https://plugins.dprint.dev/prettier-0.27.0.json@3557a62b4507c55a47d8cde0683195b14d13c41dda66d0f0b0e111aed107e2fe" + "https://plugins.dprint.dev/typescript-0.88.8.wasm", + "https://plugins.dprint.dev/json-0.19.1.wasm", + "https://plugins.dprint.dev/prettier-0.32.1.json@19aa403ef0862ba8c41164e3dc6f84c0b7a66c2b11e42726b23dd25e6302ada9" ] } diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 9526309bdc220..e4d4b1f671420 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,15 +1,15 @@ ---- -blank_issues_enabled: false -contact_links: - - about: 'Please ask and answer usage questions on Stack Overflow.' - name: Question - url: 'https://stackoverflow.com/questions/tagged/typescript' - - about: 'Alternatively, you can use the TypeScript Community Discord.' - name: Chat - url: 'https://discord.gg/typescript' - - about: 'Please check the FAQ before filing new issues' - name: 'TypeScript FAQ' - url: 'https://github.com/microsoft/TypeScript/wiki/FAQ' - - about: 'Please raise issues about the site on its own repo.' - name: Website - url: 'https://github.com/microsoft/TypeScript-Website/issues/new' +--- +blank_issues_enabled: false +contact_links: + - about: 'Please ask and answer usage questions on Stack Overflow.' + name: Question + url: 'https://stackoverflow.com/questions/tagged/typescript' + - about: 'Alternatively, you can use the TypeScript Community Discord.' + name: Chat + url: 'https://discord.gg/typescript' + - about: 'Please check the FAQ before filing new issues' + name: 'TypeScript FAQ' + url: 'https://github.com/microsoft/TypeScript/wiki/FAQ' + - about: 'Please raise issues about the site on its own repo.' + name: Website + url: 'https://github.com/microsoft/TypeScript-Website/issues/new' diff --git a/.github/workflows/accept-baselines-fix-lints.yaml b/.github/workflows/accept-baselines-fix-lints.yaml index b382f3fde9a30..a5d301f1485aa 100644 --- a/.github/workflows/accept-baselines-fix-lints.yaml +++ b/.github/workflows/accept-baselines-fix-lints.yaml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - name: Configure Git, Run Tests, Update Baselines, Apply Fixes run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67551fb65f4f8..d7e88b7f40fd5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Use node version ${{ matrix.node-version }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: node-version: ${{ matrix.node-version }} check-latest: true @@ -56,7 +56,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: node-version: '*' check-latest: true @@ -70,7 +70,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: node-version: '*' check-latest: true @@ -91,7 +91,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: node-version: '*' check-latest: true @@ -108,7 +108,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: node-version: '*' check-latest: true @@ -123,7 +123,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: node-version: '*' check-latest: true @@ -171,7 +171,7 @@ jobs: path: base ref: ${{ github.base_ref }} - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: node-version: '*' check-latest: true @@ -205,7 +205,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: node-version: '*' check-latest: true @@ -222,7 +222,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: node-version: '*' check-latest: true @@ -242,7 +242,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: node-version: '*' check-latest: true diff --git a/.github/workflows/close-issues.yml b/.github/workflows/close-issues.yml index f3321ebaa05a4..159d6101f4c32 100644 --- a/.github/workflows/close-issues.yml +++ b/.github/workflows/close-issues.yml @@ -1,49 +1,49 @@ -name: Close issues - -on: - schedule: - - cron: '0 1 * * *' - workflow_dispatch: - -permissions: - contents: read - -# Ensure scripts are run with pipefail. See: -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference -defaults: - run: - shell: bash - -jobs: - close-issues: - runs-on: ubuntu-latest - if: github.repository == 'microsoft/TypeScript' - permissions: - contents: read # Apparently required to create issues - issues: write - - steps: - - name: Close issues - env: - GH_TOKEN: ${{ secrets.TS_BOT_GITHUB_TOKEN }} - run: | - DATE=$(date --date='2 days ago' --iso-8601) - - close_issues() { - echo "Closing issues marked as '$1'." - for issue in $(gh issue list --limit 100 --label "$1" --repo ${{ github.repository }} --state open --search "updated:<$DATE" --json number --jq '.[].number'); do - echo "Closing https://github.com/${{ github.repository }}/issues/$issue" - gh issue close $issue --repo ${{ github.repository }} --reason "not planned" --comment "This issue has been marked as \"$1\" and has seen no recent activity. It has been automatically closed for house-keeping purposes." - done - } - - close_issues "Duplicate" - close_issues "Unactionable" - close_issues "Not a Defect" - close_issues "External" - close_issues "Working as Intended" - close_issues "Question" - close_issues "Out of Scope" - close_issues "Declined" - close_issues "Won't Fix" - close_issues "Too Complex" +name: Close issues + +on: + schedule: + - cron: '0 1 * * *' + workflow_dispatch: + +permissions: + contents: read + +# Ensure scripts are run with pipefail. See: +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference +defaults: + run: + shell: bash + +jobs: + close-issues: + runs-on: ubuntu-latest + if: github.repository == 'microsoft/TypeScript' + permissions: + contents: read # Apparently required to create issues + issues: write + + steps: + - name: Close issues + env: + GH_TOKEN: ${{ secrets.TS_BOT_GITHUB_TOKEN }} + run: | + DATE=$(date --date='2 days ago' --iso-8601) + + close_issues() { + echo "Closing issues marked as '$1'." + for issue in $(gh issue list --limit 100 --label "$1" --repo ${{ github.repository }} --state open --search "updated:<$DATE" --json number --jq '.[].number'); do + echo "Closing https://github.com/${{ github.repository }}/issues/$issue" + gh issue close $issue --repo ${{ github.repository }} --reason "not planned" --comment "This issue has been marked as \"$1\" and has seen no recent activity. It has been automatically closed for house-keeping purposes." + done + } + + close_issues "Duplicate" + close_issues "Unactionable" + close_issues "Not a Defect" + close_issues "External" + close_issues "Working as Intended" + close_issues "Question" + close_issues "Out of Scope" + close_issues "Declined" + close_issues "Won't Fix" + close_issues "Too Complex" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index dcb27e10c1236..c7791363afe31 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 + uses: github/codeql-action/init@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12 with: config-file: ./.github/codeql/codeql-configuration.yml # Override language selection by uncommenting this and choosing your languages @@ -56,7 +56,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below). - name: Autobuild - uses: github/codeql-action/autobuild@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 + uses: github/codeql-action/autobuild@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -70,4 +70,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 + uses: github/codeql-action/analyze@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12 diff --git a/.github/workflows/error-deltas-watchdog.yaml b/.github/workflows/error-deltas-watchdog.yaml index 86aee16a71556..2d74e1fb9e30f 100644 --- a/.github/workflows/error-deltas-watchdog.yaml +++ b/.github/workflows/error-deltas-watchdog.yaml @@ -1,45 +1,45 @@ -name: 'typescript-error-deltas Watchdog' - -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * 3' # Every Wednesday - -permissions: - contents: read - -# Ensure scripts are run with pipefail. See: -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference -defaults: - run: - shell: bash - -jobs: - check-for-recent: - runs-on: ubuntu-latest - if: github.repository == 'microsoft/TypeScript' - permissions: - contents: read # Apparently required to create issues - issues: write - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TAGS: '@navya9singh @RyanCavanaugh @DanielRosenwasser' - steps: - - name: NewErrors - run: | # --json and --jq prints exactly one issue number per line of output - DATE=$(date --date="7 days ago" --iso-8601) - gh issue list --repo microsoft/typescript --search "[NewErrors] created:>=$DATE" --state all --json number --jq ".[].number" \ - | grep -qe "[0-9]" \ - || gh issue create --repo ${{ github.repository }} --title "No NewErrors issue since $DATE" --body "$TAGS Please check the [pipeline](https://typescript.visualstudio.com/TypeScript/_build?definitionId=48)." - - name: ServerErrors TS - run: | - DATE=$(date --date="7 days ago" --iso-8601) - gh issue list --repo microsoft/typescript --search "[ServerErrors][TypeScript] created:>=$DATE" --state all --json number --jq ".[].number" \ - | grep -qe "[0-9]" \ - || gh issue create --repo ${{ github.repository }} --title "No TypeScript ServerErrors issue since $DATE" --body "$TAGS Please check the [pipeline](https://typescript.visualstudio.com/TypeScript/_build?definitionId=59)." - - name: ServerErrors JS - run: | - DATE=$(date --date="7 days ago" --iso-8601) - gh issue list --repo microsoft/typescript --search "[ServerErrors][JavaScript] created:>=$DATE" --state all --json number --jq ".[].number" \ - | grep -qe "[0-9]" \ - || gh issue create --repo ${{ github.repository }} --title "No JavaScript ServerErrors issue since $DATE" --body "$TAGS Please check the [pipeline](https://typescript.visualstudio.com/TypeScript/_build?definitionId=58)." +name: 'typescript-error-deltas Watchdog' + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * 3' # Every Wednesday + +permissions: + contents: read + +# Ensure scripts are run with pipefail. See: +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference +defaults: + run: + shell: bash + +jobs: + check-for-recent: + runs-on: ubuntu-latest + if: github.repository == 'microsoft/TypeScript' + permissions: + contents: read # Apparently required to create issues + issues: write + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAGS: '@navya9singh @RyanCavanaugh @DanielRosenwasser' + steps: + - name: NewErrors + run: | # --json and --jq prints exactly one issue number per line of output + DATE=$(date --date="7 days ago" --iso-8601) + gh issue list --repo microsoft/typescript --search "[NewErrors] created:>=$DATE" --state all --json number --jq ".[].number" \ + | grep -qe "[0-9]" \ + || gh issue create --repo ${{ github.repository }} --title "No NewErrors issue since $DATE" --body "$TAGS Please check the [pipeline](https://typescript.visualstudio.com/TypeScript/_build?definitionId=48)." + - name: ServerErrors TS + run: | + DATE=$(date --date="7 days ago" --iso-8601) + gh issue list --repo microsoft/typescript --search "[ServerErrors][TypeScript] created:>=$DATE" --state all --json number --jq ".[].number" \ + | grep -qe "[0-9]" \ + || gh issue create --repo ${{ github.repository }} --title "No TypeScript ServerErrors issue since $DATE" --body "$TAGS Please check the [pipeline](https://typescript.visualstudio.com/TypeScript/_build?definitionId=59)." + - name: ServerErrors JS + run: | + DATE=$(date --date="7 days ago" --iso-8601) + gh issue list --repo microsoft/typescript --search "[ServerErrors][JavaScript] created:>=$DATE" --state all --json number --jq ".[].number" \ + | grep -qe "[0-9]" \ + || gh issue create --repo ${{ github.repository }} --title "No JavaScript ServerErrors issue since $DATE" --body "$TAGS Please check the [pipeline](https://typescript.visualstudio.com/TypeScript/_build?definitionId=58)." diff --git a/.github/workflows/new-release-branch.yaml b/.github/workflows/new-release-branch.yaml index fd38d8bf1d264..99a0c05576cab 100644 --- a/.github/workflows/new-release-branch.yaml +++ b/.github/workflows/new-release-branch.yaml @@ -1,52 +1,52 @@ -name: New Release Branch - -on: - repository_dispatch: - types: [new-release-branch] - -permissions: - contents: read - -# Ensure scripts are run with pipefail. See: -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference -defaults: - run: - shell: bash - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ - fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none. - token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 - - run: | - npm --version - # corepack enable npm - npm install -g $(jq -r '.packageManager' < package.json) - npm --version - - run: | - git checkout -b ${{ github.event.client_payload.branch_name }} - sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json - sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts - sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts - sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts - sed -i -e 's/const version\(: string\)\{0,1\} = `${versionMajorMinor}.0-.*`/const version = `${versionMajorMinor}.0-${{ github.event.client_payload.core_tag || 'dev' }}`/g' src/compiler/corePublic.ts - npm ci - npm install # update package-lock.json to ensure the version bump is included - npx hereby LKG - npm test - git diff - git add package.json package-lock.json - git add src/compiler/corePublic.ts - git add tests/baselines/reference/api/typescript.d.ts - git add tests/baselines/reference/api/tsserverlibrary.d.ts - git add --force ./lib - git config user.email "typescriptbot@microsoft.com" - git config user.name "TypeScript Bot" - git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG' - git push --set-upstream origin ${{ github.event.client_payload.branch_name }} +name: New Release Branch + +on: + repository_dispatch: + types: [new-release-branch] + +permissions: + contents: read + +# Ensure scripts are run with pipefail. See: +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ + fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none. + token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 + - run: | + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) + npm --version + - run: | + git checkout -b ${{ github.event.client_payload.branch_name }} + sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json + sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts + sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts + sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts + sed -i -e 's/const version\(: string\)\{0,1\} = `${versionMajorMinor}.0-.*`/const version = `${versionMajorMinor}.0-${{ github.event.client_payload.core_tag || 'dev' }}`/g' src/compiler/corePublic.ts + npm ci + npm install # update package-lock.json to ensure the version bump is included + npx hereby LKG + npm test + git diff + git add package.json package-lock.json + git add src/compiler/corePublic.ts + git add tests/baselines/reference/api/typescript.d.ts + git add tests/baselines/reference/api/tsserverlibrary.d.ts + git add --force ./lib + git config user.email "typescriptbot@microsoft.com" + git config user.name "TypeScript Bot" + git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG' + git push --set-upstream origin ${{ github.event.client_payload.branch_name }} diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 00664d82cbb8c..b81409194b6a3 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -1,46 +1,46 @@ -name: Publish Nightly - -on: - schedule: - - cron: '0 7 * * *' - # enable users to manually trigger with workflow_dispatch - workflow_dispatch: {} - repository_dispatch: - types: [publish-nightly] - -permissions: - contents: read - -# Ensure scripts are run with pipefail. See: -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference -defaults: - run: - shell: bash - -jobs: - build: - runs-on: ubuntu-latest - if: github.repository == 'microsoft/TypeScript' - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 - with: - # Use NODE_AUTH_TOKEN environment variable to authenticate to this registry. - registry-url: https://registry.npmjs.org/ - - run: | - npm --version - # corepack enable npm - npm install -g $(jq -r '.packageManager' < package.json) - npm --version - - name: Setup and publish nightly - run: | - npm whoami - npm ci - npx hereby configure-nightly - npx hereby LKG - npx hereby runtests-parallel - npx hereby clean - npm publish --tag next - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} +name: Publish Nightly + +on: + schedule: + - cron: '0 7 * * *' + # enable users to manually trigger with workflow_dispatch + workflow_dispatch: {} + repository_dispatch: + types: [publish-nightly] + +permissions: + contents: read + +# Ensure scripts are run with pipefail. See: +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + if: github.repository == 'microsoft/TypeScript' + + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 + with: + # Use NODE_AUTH_TOKEN environment variable to authenticate to this registry. + registry-url: https://registry.npmjs.org/ + - run: | + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) + npm --version + - name: Setup and publish nightly + run: | + npm whoami + npm ci + npx hereby configure-nightly + npx hereby LKG + npx hereby runtests-parallel + npx hereby clean + npm publish --tag next + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.github/workflows/pr-modified-files.yml b/.github/workflows/pr-modified-files.yml index 09841f73fc6b3..1784558ec02bb 100644 --- a/.github/workflows/pr-modified-files.yml +++ b/.github/workflows/pr-modified-files.yml @@ -1,136 +1,136 @@ -name: Check modified files -on: - # For security reasons, we have to use pull_request_target here. - # This differs from pull_request in that it runs at the _base_ of the PR, - # e.g. main. This allows us to access secrets. In this workflow, we should - # never actually clone the PR, as it may contain malicious code. - # https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ - pull_request_target: - branches: - - main - -# We only ever need one of these running on a single PR. -# Just let the newest one complete if there are multiple running. -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -permissions: - contents: read - -# Ensure scripts are run with pipefail. See: -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference -defaults: - run: - shell: bash - -jobs: - manage-prs: - runs-on: ubuntu-latest - if: github.repository == 'microsoft/TypeScript' - - # No need to set explicit permissions; we are using typescript-bot's token, not github-actions' token. - - env: - GH_TOKEN: ${{ secrets.TS_BOT_GITHUB_TOKEN }} - - steps: - - name: Check if PR author is in pr_owners.txt - id: pr_owner - run: | - curl -s https://raw.githubusercontent.com/microsoft/TypeScript/main/.github/pr_owners.txt > pr_owners.txt - if grep -Fxq -m1 "${{ github.event.pull_request.user.login }}" pr_owners.txt; then - echo "pr_owner=true" >> "$GITHUB_OUTPUT" - else - echo "pr_owner=false" >> "$GITHUB_OUTPUT" - fi - - - name: Create scripts - run: | - cat > is_changed.sh <<'EOF' - #!/bin/bash - FILENAME=changed_files.txt - if [ ! -f $FILENAME ]; then - # The gh command only returns info for the first 100 files. To get - # the rest, we have to use the graphql API. See: - # https://github.com/cli/cli/issues/5368#issuecomment-1344253654 - gh api graphql -f query=' - query($endCursor: String) { - repository(owner: "microsoft", name: "TypeScript") { - pullRequest(number: ${{ github.event.pull_request.number }}) { - files(first: 100, after: $endCursor) { - pageInfo{ hasNextPage, endCursor } - nodes { - path - } - } - } - } - }' --paginate --jq '.data.repository.pullRequest.files.nodes.[].path' > $FILENAME - fi - for file in "$@"; do - grep -Fxq -m1 "$file" $FILENAME && exit 0 - done - exit 1 - EOF - chmod +x is_changed.sh - - cat > already_commented.sh <<'EOF' - #!/bin/bash - FILENAME=bot_comments.txt - if [ ! -f $FILENAME ]; then - gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} \ - --json 'comments' --jq '.comments[] | select(.author.login == "typescript-bot") | .body' > $FILENAME - fi - exec grep -Fq -m1 "$1" $FILENAME - EOF - chmod +x already_commented.sh - - - name: Generated DOM files - if: steps.pr_owner.outputs.pr_owner == 'false' - run: | - if ./is_changed.sh "src/lib/dom.generated.d.ts" \ - "src/lib/dom.iterable.generated.d.ts" \ - "src/lib/webworker.generated.d.ts" \ - "src/lib/webworker.iterable.generated.d.ts"; then - MESSAGE="It looks like you've sent a pull request to update some generated declaration files related to the DOM." - MESSAGE+=" These files aren't meant to be edited by hand, as they are synchronized with files in" - MESSAGE+=" [the TypeScript-DOM-lib-generator repository](https://github.com/microsoft/TypeScript-DOM-lib-generator)." - MESSAGE+=" You can [read more here](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md#contributing-libdts-fixes)." - MESSAGE+=" For house-keeping purposes, this pull request will be closed." - - gh pr close ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --comment "$MESSAGE" - exit 1 # Stop the pipeline; we just closed the PR. - fi - - - name: Check if PR modifies protocol.ts - run: | - if ./is_changed.sh "src/server/protocol.ts"; then - MESSAGE="Thanks for the PR! It looks like you've changed the TSServer protocol in some way." - MESSAGE+=" Please ensure that any changes here don't break consumers of the current TSServer API." - MESSAGE+=" For some extra review, we'll ping @sheetalkamat, @mjbvz, @zkat, and @joj for you." - MESSAGE+=" Feel free to loop in other consumers/maintainers if necessary." - - if ./already_commented.sh "It looks like you've changed the TSServer protocol in some way."; then - echo "Already commented." - else - gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "$MESSAGE" - fi - fi - - - name: Check for breaking changes - run: | - if ./is_changed.sh "tests/baselines/reference/api/typescript.d.ts" \ - "tests/baselines/reference/api/tsserverlibrary.d.ts"; then - MESSAGE="Looks like you're introducing a change to the public API surface area." - MESSAGE+=" If this includes breaking changes, please document them" - MESSAGE+=" [on our wiki's API Breaking Changes page](https://github.com/microsoft/TypeScript/wiki/API-Breaking-Changes)." - MESSAGE+=$'\n\n' - MESSAGE+="Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up." - - if ./already_commented.sh "Looks like you're introducing a change to the public API surface area."; then - echo "Already commented." - else - gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "$MESSAGE" - fi - fi +name: Check modified files +on: + # For security reasons, we have to use pull_request_target here. + # This differs from pull_request in that it runs at the _base_ of the PR, + # e.g. main. This allows us to access secrets. In this workflow, we should + # never actually clone the PR, as it may contain malicious code. + # https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ + pull_request_target: + branches: + - main + +# We only ever need one of these running on a single PR. +# Just let the newest one complete if there are multiple running. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +# Ensure scripts are run with pipefail. See: +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference +defaults: + run: + shell: bash + +jobs: + manage-prs: + runs-on: ubuntu-latest + if: github.repository == 'microsoft/TypeScript' + + # No need to set explicit permissions; we are using typescript-bot's token, not github-actions' token. + + env: + GH_TOKEN: ${{ secrets.TS_BOT_GITHUB_TOKEN }} + + steps: + - name: Check if PR author is in pr_owners.txt + id: pr_owner + run: | + curl -s https://raw.githubusercontent.com/microsoft/TypeScript/main/.github/pr_owners.txt > pr_owners.txt + if grep -Fxq -m1 "${{ github.event.pull_request.user.login }}" pr_owners.txt; then + echo "pr_owner=true" >> "$GITHUB_OUTPUT" + else + echo "pr_owner=false" >> "$GITHUB_OUTPUT" + fi + + - name: Create scripts + run: | + cat > is_changed.sh <<'EOF' + #!/bin/bash + FILENAME=changed_files.txt + if [ ! -f $FILENAME ]; then + # The gh command only returns info for the first 100 files. To get + # the rest, we have to use the graphql API. See: + # https://github.com/cli/cli/issues/5368#issuecomment-1344253654 + gh api graphql -f query=' + query($endCursor: String) { + repository(owner: "microsoft", name: "TypeScript") { + pullRequest(number: ${{ github.event.pull_request.number }}) { + files(first: 100, after: $endCursor) { + pageInfo{ hasNextPage, endCursor } + nodes { + path + } + } + } + } + }' --paginate --jq '.data.repository.pullRequest.files.nodes.[].path' > $FILENAME + fi + for file in "$@"; do + grep -Fxq -m1 "$file" $FILENAME && exit 0 + done + exit 1 + EOF + chmod +x is_changed.sh + + cat > already_commented.sh <<'EOF' + #!/bin/bash + FILENAME=bot_comments.txt + if [ ! -f $FILENAME ]; then + gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} \ + --json 'comments' --jq '.comments[] | select(.author.login == "typescript-bot") | .body' > $FILENAME + fi + exec grep -Fq -m1 "$1" $FILENAME + EOF + chmod +x already_commented.sh + + - name: Generated DOM files + if: steps.pr_owner.outputs.pr_owner == 'false' + run: | + if ./is_changed.sh "src/lib/dom.generated.d.ts" \ + "src/lib/dom.iterable.generated.d.ts" \ + "src/lib/webworker.generated.d.ts" \ + "src/lib/webworker.iterable.generated.d.ts"; then + MESSAGE="It looks like you've sent a pull request to update some generated declaration files related to the DOM." + MESSAGE+=" These files aren't meant to be edited by hand, as they are synchronized with files in" + MESSAGE+=" [the TypeScript-DOM-lib-generator repository](https://github.com/microsoft/TypeScript-DOM-lib-generator)." + MESSAGE+=" You can [read more here](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md#contributing-libdts-fixes)." + MESSAGE+=" For house-keeping purposes, this pull request will be closed." + + gh pr close ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --comment "$MESSAGE" + exit 1 # Stop the pipeline; we just closed the PR. + fi + + - name: Check if PR modifies protocol.ts + run: | + if ./is_changed.sh "src/server/protocol.ts"; then + MESSAGE="Thanks for the PR! It looks like you've changed the TSServer protocol in some way." + MESSAGE+=" Please ensure that any changes here don't break consumers of the current TSServer API." + MESSAGE+=" For some extra review, we'll ping @sheetalkamat, @mjbvz, @zkat, and @joj for you." + MESSAGE+=" Feel free to loop in other consumers/maintainers if necessary." + + if ./already_commented.sh "It looks like you've changed the TSServer protocol in some way."; then + echo "Already commented." + else + gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "$MESSAGE" + fi + fi + + - name: Check for breaking changes + run: | + if ./is_changed.sh "tests/baselines/reference/api/typescript.d.ts" \ + "tests/baselines/reference/api/tsserverlibrary.d.ts"; then + MESSAGE="Looks like you're introducing a change to the public API surface area." + MESSAGE+=" If this includes breaking changes, please document them" + MESSAGE+=" [on our wiki's API Breaking Changes page](https://github.com/microsoft/TypeScript/wiki/API-Breaking-Changes)." + MESSAGE+=$'\n\n' + MESSAGE+="Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up." + + if ./already_commented.sh "Looks like you're introducing a change to the public API surface area."; then + echo "Already commented." + else + gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "$MESSAGE" + fi + fi diff --git a/.github/workflows/release-branch-artifact.yaml b/.github/workflows/release-branch-artifact.yaml index 24be83d5a44c8..ed4552496dbe2 100644 --- a/.github/workflows/release-branch-artifact.yaml +++ b/.github/workflows/release-branch-artifact.yaml @@ -1,47 +1,47 @@ -name: Create Releasable Package Drop - -on: - push: - branches: - - release-* - -permissions: - contents: read - -# Ensure scripts are run with pipefail. See: -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference -defaults: - run: - shell: bash - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 - - run: | - npm --version - # corepack enable npm - npm install -g $(jq -r '.packageManager' < package.json) - npm --version - - name: npm install and test - run: | - npm ci - npm test - - name: Installing browsers - run: npx playwright install --with-deps - - name: Validate the browser can import TypeScript - run: npx hereby test-browser-integration - - name: LKG, clean, and pack - run: | - npx hereby LKG - npx hereby clean - npm pack ./ - mv typescript-*.tgz typescript.tgz - - name: Upload built tarfile - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 - with: - name: tgz - path: typescript.tgz +name: Create Releasable Package Drop + +on: + push: + branches: + - release-* + +permissions: + contents: read + +# Ensure scripts are run with pipefail. See: +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 + - run: | + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) + npm --version + - name: npm install and test + run: | + npm ci + npm test + - name: Installing browsers + run: npx playwright install --with-deps + - name: Validate the browser can import TypeScript + run: npx hereby test-browser-integration + - name: LKG, clean, and pack + run: | + npx hereby LKG + npx hereby clean + npm pack ./ + mv typescript-*.tgz typescript.tgz + - name: Upload built tarfile + uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 + with: + name: tgz + path: typescript.tgz diff --git a/.github/workflows/rich-navigation.yml b/.github/workflows/rich-navigation.yml index 3dfbe6695a4f6..badc34d74bd1d 100644 --- a/.github/workflows/rich-navigation.yml +++ b/.github/workflows/rich-navigation.yml @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - name: Install dependencies run: npm ci diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 6367f8fcd7bb1..22e69e6df74d8 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -47,7 +47,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: 'Upload artifact' - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 with: name: SARIF file path: results.sarif @@ -55,6 +55,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: 'Upload to code-scanning' - uses: github/codeql-action/upload-sarif@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 + uses: github/codeql-action/upload-sarif@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12 with: sarif_file: results.sarif diff --git a/.github/workflows/set-version.yaml b/.github/workflows/set-version.yaml index 11d57994f3dd7..cf490ad79d931 100644 --- a/.github/workflows/set-version.yaml +++ b/.github/workflows/set-version.yaml @@ -1,56 +1,56 @@ -name: Set branch version - -on: - repository_dispatch: - types: [set-version] - -permissions: - contents: read - -# Ensure scripts are run with pipefail. See: -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference -defaults: - run: - shell: bash - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ github.event.client_payload.branch_name }} - token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 - - run: | - npm --version - # corepack enable npm - npm install -g $(jq -r '.packageManager' < package.json) - npm --version - # notably, this is essentially the same script as `new-release-branch.yaml` (with fewer inputs), but it assumes the branch already exists - # do note that executing the transform below will prevent the `configurePrerelease` script from running on the source, as it makes the - # `version` identifier no longer match the regex it uses - # required client_payload members: - # branch_name - the target branch - # package_version - the full version string (eg, `3.9.1-rc` or `3.9.2`) - # core_major_minor - the major.minor pair associated with the desired package_version (eg, `3.9` for `3.9.3`) - - run: | - sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json - sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts - sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts - sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts - sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts - npm ci - npm install # update package-lock.json to ensure the version bump is included - npx hereby LKG - npm test - git diff - git add package.json package-lock.json - git add src/compiler/corePublic.ts - git add tests/baselines/reference/api/typescript.d.ts - git add tests/baselines/reference/api/tsserverlibrary.d.ts - git add --force ./lib - git config user.email "typescriptbot@microsoft.com" - git config user.name "TypeScript Bot" - git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG' - git push +name: Set branch version + +on: + repository_dispatch: + types: [set-version] + +permissions: + contents: read + +# Ensure scripts are run with pipefail. See: +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ github.event.client_payload.branch_name }} + token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 + - run: | + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) + npm --version + # notably, this is essentially the same script as `new-release-branch.yaml` (with fewer inputs), but it assumes the branch already exists + # do note that executing the transform below will prevent the `configurePrerelease` script from running on the source, as it makes the + # `version` identifier no longer match the regex it uses + # required client_payload members: + # branch_name - the target branch + # package_version - the full version string (eg, `3.9.1-rc` or `3.9.2`) + # core_major_minor - the major.minor pair associated with the desired package_version (eg, `3.9` for `3.9.3`) + - run: | + sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json + sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts + sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts + sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts + sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts + npm ci + npm install # update package-lock.json to ensure the version bump is included + npx hereby LKG + npm test + git diff + git add package.json package-lock.json + git add src/compiler/corePublic.ts + git add tests/baselines/reference/api/typescript.d.ts + git add tests/baselines/reference/api/tsserverlibrary.d.ts + git add --force ./lib + git config user.email "typescriptbot@microsoft.com" + git config user.name "TypeScript Bot" + git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG' + git push diff --git a/.github/workflows/sync-branch.yaml b/.github/workflows/sync-branch.yaml index 3a40e9b9a97d2..309de471fa6b5 100644 --- a/.github/workflows/sync-branch.yaml +++ b/.github/workflows/sync-branch.yaml @@ -1,44 +1,44 @@ -name: Sync branch with master - -on: - repository_dispatch: - types: [sync-branch] - workflow_dispatch: - inputs: - branch_name: - description: 'Target Branch Name' - required: true - -permissions: - contents: read - -# Ensure scripts are run with pipefail. See: -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference -defaults: - run: - shell: bash - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ github.event.inputs.branch_name || github.event.client_payload.branch_name }} - filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ - fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none. - token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} - # required client_payload members: - # branch_name - the target branch - - run: | - git config user.email "typescriptbot@microsoft.com" - git config user.name "TypeScript Bot" - git fetch origin main - git merge origin/main --no-ff - npm ci - npx hereby LKG - git add --force ./lib - git commit -m 'Update LKG' - git push +name: Sync branch with master + +on: + repository_dispatch: + types: [sync-branch] + workflow_dispatch: + inputs: + branch_name: + description: 'Target Branch Name' + required: true + +permissions: + contents: read + +# Ensure scripts are run with pipefail. See: +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ github.event.inputs.branch_name || github.event.client_payload.branch_name }} + filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ + fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none. + token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} + # required client_payload members: + # branch_name - the target branch + - run: | + git config user.email "typescriptbot@microsoft.com" + git config user.name "TypeScript Bot" + git fetch origin main + git merge origin/main --no-ff + npm ci + npx hereby LKG + git add --force ./lib + git commit -m 'Update LKG' + git push diff --git a/.github/workflows/twoslash-repros.yaml b/.github/workflows/twoslash-repros.yaml index bafe8950f341b..c11f4a9c12ec3 100644 --- a/.github/workflows/twoslash-repros.yaml +++ b/.github/workflows/twoslash-repros.yaml @@ -40,7 +40,7 @@ jobs: fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none. - if: ${{ !github.event.inputs.bisect }} uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - uses: microsoft/TypeScript-Twoslash-Repro-Action@80178415feb0ebd3ed88d09e263a7cb8c8d6e1d2 # master with: github-token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/update-package-lock.yaml b/.github/workflows/update-package-lock.yaml index 5b0613cc30505..ef83b693fde29 100644 --- a/.github/workflows/update-package-lock.yaml +++ b/.github/workflows/update-package-lock.yaml @@ -1,52 +1,53 @@ -name: Update package-lock.json - -on: - schedule: - # This is probably 6am UTC, which is 10pm PST or 11pm PDT - # Alternatively, 6am local is also fine - - cron: '0 6 * * *' - workflow_dispatch: {} - -permissions: - contents: read - -# Ensure scripts are run with pipefail. See: -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference -defaults: - run: - shell: bash - -jobs: - build: - runs-on: ubuntu-latest - if: github.repository == 'microsoft/TypeScript' - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 - with: - node-version: 16 - - run: | - npm --version - # corepack enable npm - npm install -g $(jq -r '.packageManager' < package.json) - npm --version - - - name: Update package-lock.json and push - run: | - rm package-lock.json - npm install - - if git diff --exit-code --name-only package-lock.json; then - echo "No change." - else - npm test - npx hereby LKG - git config user.email "typescriptbot@microsoft.com" - git config user.name "TypeScript Bot" - git add -f package-lock.json - git commit -m "Update package-lock.json" - git push - fi +name: Update package-lock.json + +on: + schedule: + # This is probably 6am UTC, which is 10pm PST or 11pm PDT + # Alternatively, 6am local is also fine + - cron: '0 6 * * *' + workflow_dispatch: {} + +permissions: + contents: read + +# Ensure scripts are run with pipefail. See: +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + if: github.repository == 'microsoft/TypeScript' + + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 + with: + node-version: '*' + check-latest: true + - run: | + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) + npm --version + + - name: Update package-lock.json and push + run: | + rm package-lock.json + npm install + + if git diff --exit-code --name-only package-lock.json; then + echo "No change." + else + npm test + npx hereby LKG + git config user.email "typescriptbot@microsoft.com" + git config user.name "TypeScript Bot" + git add -f package-lock.json + git commit -m "Update package-lock.json" + git push + fi diff --git a/.gulp.js b/.gulp.js index 009d8b66adda4..b167b3a3628d8 100644 --- a/.gulp.js +++ b/.gulp.js @@ -1,14 +1,8 @@ const cp = require("child_process"); const path = require("path"); -const chalk = require("chalk"); const argv = process.argv.slice(2); -// --tasks-simple is used by VS Code to infer a task list; try and keep that working. -if (!argv.includes("--tasks-simple")) { - console.error(chalk.yellowBright("Warning: using gulp shim; please consider running hereby directly.")); -} - const args = [ ...process.execArgv, path.join(__dirname, "node_modules", "hereby", "bin", "hereby.js"), diff --git a/package-lock.json b/package-lock.json index 669a85602ca53..4e5578da633f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "chalk": "^4.1.2", "chokidar": "^3.5.3", "diff": "^5.1.0", - "dprint": "^0.42.3", + "dprint": "^0.45.0", "esbuild": "^0.19.0", "eslint": "^8.22.0", "eslint-formatter-autolinkable-stylish": "^1.2.0", @@ -52,7 +52,7 @@ "playwright": "^1.38.0", "source-map-support": "^0.5.21", "tslib": "^2.5.0", - "typescript": "^5.3.2", + "typescript": "5.4.0-dev.20231206", "which": "^2.0.2" }, "engines": { @@ -75,9 +75,9 @@ "dev": true }, "node_modules/@dprint/darwin-arm64": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.42.5.tgz", - "integrity": "sha512-3bBBlaAXQ9WTC+jvd2/iyj7cVp0G58/v5R7+YADUl5K9xF+Ah+xLFm6xw4Iwq+zsYaWDimRmLnM5iRSJC9qv1Q==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.45.0.tgz", + "integrity": "sha512-pkSSmixIKXr5t32bhXIUbpIBm8F8uhsJcUUvfkFNsRbQvNwRp71ribZpE8dKl0ZFOlAFeWD6WLE8smp/QtiGUA==", "cpu": [ "arm64" ], @@ -88,9 +88,9 @@ ] }, "node_modules/@dprint/darwin-x64": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.42.5.tgz", - "integrity": "sha512-gwx6lODOckU3xGv0zVFad/SMMtwBleiBAzm3UVw/WkGiCVo3XrIZ6EdLr4zCmB4A2R+SOxODU70WtONCF0dGnQ==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.45.0.tgz", + "integrity": "sha512-PHcXSrRO53KH9N+YPbPtr40NnDo2t7hO7KLMfl2ktRNLjrmKg6F8XDDsr2C7Z11k3jyEEU2Jq8hhpaKHwNapmQ==", "cpu": [ "x64" ], @@ -101,9 +101,9 @@ ] }, "node_modules/@dprint/linux-arm64-glibc": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.42.5.tgz", - "integrity": "sha512-ijJm+zOxHK3Chnis3y5kVzvBr21Ugyodqpz1chClNWkaR+0/BYDik+lxZVrbxZw8gxqPu8iisOceCQQC42Bkzg==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.45.0.tgz", + "integrity": "sha512-NgIpvZHpiQaY4DxSygxknxBtvKE2KLK9dEbUNKNE098yTHhGq7ouPsoM7RtsO34RHJ3tEZLLJEuBHn20XP8LMg==", "cpu": [ "arm64" ], @@ -114,9 +114,9 @@ ] }, "node_modules/@dprint/linux-arm64-musl": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.42.5.tgz", - "integrity": "sha512-OLbJgv14AvJRVBi+ZCXBH0rsMSIdCZi/z1hCTRUb901VB2OVf81k5vvBn7HS5S9wMQ2HIG8GFOyckBg0qhEgAQ==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.45.0.tgz", + "integrity": "sha512-Y8p+FC0RNyKCGQjy99Uh1LSPrlQtUTvo4brdvU1THF3pyWu6Bg1p6NiP5a6SjE/6t9CMKZJz39zPreQtnDkSDA==", "cpu": [ "arm64" ], @@ -127,9 +127,9 @@ ] }, "node_modules/@dprint/linux-x64-glibc": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.42.5.tgz", - "integrity": "sha512-tWh1kMbTi/lxS6hQJCDnriZonzGYN6FcN2AqF1C/TdRNjacFVvQnxZTdHPLJbgw0mSujHPinl3NtvllZ9CwVqA==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.45.0.tgz", + "integrity": "sha512-u03NCZIpJhE5gIl9Q7jNL4sOPBFd/8BLVBiuLoLtbiTZQ+NNudHKgGNATJBU67q1MKpqKnt8/gQm139cJkHhrw==", "cpu": [ "x64" ], @@ -140,9 +140,9 @@ ] }, "node_modules/@dprint/linux-x64-musl": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.42.5.tgz", - "integrity": "sha512-GObJlhUqQpaXKRMTUUEkdYgWgS1aVyMUQZFn3dBmLycl4F2gXWxKgYB6R47ESVeejsEvE9fTTuxlpK6fOHjaKQ==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.45.0.tgz", + "integrity": "sha512-DQN8LPtxismkeU1X+sQywa80kWwCBcpQh9fXoJcvTEHrgzHBqbG2SEsUZpM12oKEua1KE/iBh+vgZ+4I3TdI2A==", "cpu": [ "x64" ], @@ -153,9 +153,9 @@ ] }, "node_modules/@dprint/win32-x64": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.42.5.tgz", - "integrity": "sha512-N2N1FlmbEFbH/WqoKGdsZplBpfq9qdhfkJHQH1poVG3KxqT0dq01oqAfnC3ZQaSBoBrBfp5GyRtj7KwCxdqxXA==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.45.0.tgz", + "integrity": "sha512-aZHIWG2jIlEp4BER1QG6YYqPd6TxT9S77AeUkWJixNiMEo+33mPRVCBcugRWI/WJWveX8yWFVXkToORtnSFeEA==", "cpu": [ "x64" ], @@ -165,10 +165,26 @@ "win32" ] }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz", + "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/android-arm": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.8.tgz", - "integrity": "sha512-31E2lxlGM1KEfivQl8Yf5aYU/mflz9g06H6S15ITUFQueMFtFjESRMoDSkvMo8thYvLBax+VKTPlpnx+sPicOA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz", + "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==", "cpu": [ "arm" ], @@ -182,9 +198,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.8.tgz", - "integrity": "sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz", + "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==", "cpu": [ "arm64" ], @@ -198,9 +214,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.8.tgz", - "integrity": "sha512-rdqqYfRIn4jWOp+lzQttYMa2Xar3OK9Yt2fhOhzFXqg0rVWEfSclJvZq5fZslnz6ypHvVf3CT7qyf0A5pM682A==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz", + "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==", "cpu": [ "x64" ], @@ -214,9 +230,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.8.tgz", - "integrity": "sha512-RQw9DemMbIq35Bprbboyf8SmOr4UXsRVxJ97LgB55VKKeJOOdvsIPy0nFyF2l8U+h4PtBx/1kRf0BelOYCiQcw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz", + "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==", "cpu": [ "arm64" ], @@ -230,9 +246,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.8.tgz", - "integrity": "sha512-3sur80OT9YdeZwIVgERAysAbwncom7b4bCI2XKLjMfPymTud7e/oY4y+ci1XVp5TfQp/bppn7xLw1n/oSQY3/Q==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz", + "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==", "cpu": [ "x64" ], @@ -246,9 +262,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.8.tgz", - "integrity": "sha512-WAnPJSDattvS/XtPCTj1tPoTxERjcTpH6HsMr6ujTT+X6rylVe8ggxk8pVxzf5U1wh5sPODpawNicF5ta/9Tmw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz", + "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==", "cpu": [ "arm64" ], @@ -262,9 +278,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.8.tgz", - "integrity": "sha512-ICvZyOplIjmmhjd6mxi+zxSdpPTKFfyPPQMQTK/w+8eNK6WV01AjIztJALDtwNNfFhfZLux0tZLC+U9nSyA5Zg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz", + "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==", "cpu": [ "x64" ], @@ -278,9 +294,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.8.tgz", - "integrity": "sha512-H4vmI5PYqSvosPaTJuEppU9oz1dq2A7Mr2vyg5TF9Ga+3+MGgBdGzcyBP7qK9MrwFQZlvNyJrvz6GuCaj3OukQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz", + "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==", "cpu": [ "arm" ], @@ -294,9 +310,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.8.tgz", - "integrity": "sha512-z1zMZivxDLHWnyGOctT9JP70h0beY54xDDDJt4VpTX+iwA77IFsE1vCXWmprajJGa+ZYSqkSbRQ4eyLCpCmiCQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz", + "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==", "cpu": [ "arm64" ], @@ -310,9 +326,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.8.tgz", - "integrity": "sha512-1a8suQiFJmZz1khm/rDglOc8lavtzEMRo0v6WhPgxkrjcU0LkHj+TwBrALwoz/OtMExvsqbbMI0ChyelKabSvQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz", + "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==", "cpu": [ "ia32" ], @@ -326,9 +342,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.8.tgz", - "integrity": "sha512-fHZWS2JJxnXt1uYJsDv9+b60WCc2RlvVAy1F76qOLtXRO+H4mjt3Tr6MJ5l7Q78X8KgCFudnTuiQRBhULUyBKQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz", + "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==", "cpu": [ "loong64" ], @@ -342,9 +358,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.8.tgz", - "integrity": "sha512-Wy/z0EL5qZYLX66dVnEg9riiwls5IYnziwuju2oUiuxVc+/edvqXa04qNtbrs0Ukatg5HEzqT94Zs7J207dN5Q==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz", + "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==", "cpu": [ "mips64el" ], @@ -358,9 +374,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.8.tgz", - "integrity": "sha512-ETaW6245wK23YIEufhMQ3HSeHO7NgsLx8gygBVldRHKhOlD1oNeNy/P67mIh1zPn2Hr2HLieQrt6tWrVwuqrxg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz", + "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==", "cpu": [ "ppc64" ], @@ -374,9 +390,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.8.tgz", - "integrity": "sha512-T2DRQk55SgoleTP+DtPlMrxi/5r9AeFgkhkZ/B0ap99zmxtxdOixOMI570VjdRCs9pE4Wdkz7JYrsPvsl7eESg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz", + "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==", "cpu": [ "riscv64" ], @@ -390,9 +406,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.8.tgz", - "integrity": "sha512-NPxbdmmo3Bk7mbNeHmcCd7R7fptJaczPYBaELk6NcXxy7HLNyWwCyDJ/Xx+/YcNH7Im5dHdx9gZ5xIwyliQCbg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz", + "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==", "cpu": [ "s390x" ], @@ -406,9 +422,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.8.tgz", - "integrity": "sha512-lytMAVOM3b1gPypL2TRmZ5rnXl7+6IIk8uB3eLsV1JwcizuolblXRrc5ShPrO9ls/b+RTp+E6gbsuLWHWi2zGg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz", + "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==", "cpu": [ "x64" ], @@ -422,9 +438,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.8.tgz", - "integrity": "sha512-hvWVo2VsXz/8NVt1UhLzxwAfo5sioj92uo0bCfLibB0xlOmimU/DeAEsQILlBQvkhrGjamP0/el5HU76HAitGw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz", + "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==", "cpu": [ "x64" ], @@ -438,9 +454,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.8.tgz", - "integrity": "sha512-/7Y7u77rdvmGTxR83PgaSvSBJCC2L3Kb1M/+dmSIvRvQPXXCuC97QAwMugBNG0yGcbEGfFBH7ojPzAOxfGNkwQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz", + "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==", "cpu": [ "x64" ], @@ -454,9 +470,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.8.tgz", - "integrity": "sha512-9Lc4s7Oi98GqFA4HzA/W2JHIYfnXbUYgekUP/Sm4BG9sfLjyv6GKKHKKVs83SMicBF2JwAX6A1PuOLMqpD001w==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz", + "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==", "cpu": [ "x64" ], @@ -470,9 +486,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.8.tgz", - "integrity": "sha512-rq6WzBGjSzihI9deW3fC2Gqiak68+b7qo5/3kmB6Gvbh/NYPA0sJhrnp7wgV4bNwjqM+R2AApXGxMO7ZoGhIJg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz", + "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==", "cpu": [ "arm64" ], @@ -486,9 +502,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.8.tgz", - "integrity": "sha512-AIAbverbg5jMvJznYiGhrd3sumfwWs8572mIJL5NQjJa06P8KfCPWZQ0NwZbPQnbQi9OWSZhFVSUWjjIrn4hSw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz", + "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==", "cpu": [ "ia32" ], @@ -502,9 +518,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.8.tgz", - "integrity": "sha512-bfZ0cQ1uZs2PqpulNL5j/3w+GDhP36k1K5c38QdQg+Swy51jFZWWeIkteNsufkQxp986wnqRRsb/bHbY1WQ7TA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz", + "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==", "cpu": [ "x64" ], @@ -590,10 +606,32 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@eslint/js": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", - "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -613,6 +651,28 @@ "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -951,9 +1011,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", - "integrity": "sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==", + "version": "20.10.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.8.tgz", + "integrity": "sha512-f8nQs3cLxbAFc00vEU59yf9UyGUftkPaLGfvbVOIDdx2i1b8epBqj2aNGyP19fiyXWvlmZ7qC1XLjAzw/OKIeA==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -981,16 +1041,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.2.tgz", - "integrity": "sha512-3+9OGAWHhk4O1LlcwLBONbdXsAhLjyCFogJY/cWy2lxdVJ2JrcTF2pTGMaLl2AE7U1l31n8Py4a8bx5DLf/0dQ==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz", + "integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.13.2", - "@typescript-eslint/type-utils": "6.13.2", - "@typescript-eslint/utils": "6.13.2", - "@typescript-eslint/visitor-keys": "6.13.2", + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/type-utils": "6.18.1", + "@typescript-eslint/utils": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -1016,15 +1076,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.2.tgz", - "integrity": "sha512-MUkcC+7Wt/QOGeVlM8aGGJZy1XV5YKjTpq9jK6r6/iLsGXhBVaGP5N0UYvFsu9BFlSpwY9kMretzdBH01rkRXg==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.18.1.tgz", + "integrity": "sha512-zct/MdJnVaRRNy9e84XnVtRv9Vf91/qqe+hZJtKanjojud4wAVy/7lXxJmMyX6X6J+xc6c//YEWvpeif8cAhWA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.13.2", - "@typescript-eslint/types": "6.13.2", - "@typescript-eslint/typescript-estree": "6.13.2", - "@typescript-eslint/visitor-keys": "6.13.2", + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/typescript-estree": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", "debug": "^4.3.4" }, "engines": { @@ -1044,13 +1104,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.2.tgz", - "integrity": "sha512-CXQA0xo7z6x13FeDYCgBkjWzNqzBn8RXaE3QVQVIUm74fWJLkJkaHmHdKStrxQllGh6Q4eUGyNpMe0b1hMkXFA==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz", + "integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.13.2", - "@typescript-eslint/visitor-keys": "6.13.2" + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1061,13 +1121,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.2.tgz", - "integrity": "sha512-Qr6ssS1GFongzH2qfnWKkAQmMUyZSyOr0W54nZNU1MDfo+U4Mv3XveeLZzadc/yq8iYhQZHYT+eoXJqnACM1tw==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz", + "integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.13.2", - "@typescript-eslint/utils": "6.13.2", + "@typescript-eslint/typescript-estree": "6.18.1", + "@typescript-eslint/utils": "6.18.1", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1088,9 +1148,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.2.tgz", - "integrity": "sha512-7sxbQ+EMRubQc3wTfTsycgYpSujyVbI1xw+3UMRUcrhSy+pN09y/lWzeKDbvhoqcRbHdc+APLs/PWYi/cisLPg==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz", + "integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1101,16 +1161,17 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.2.tgz", - "integrity": "sha512-SuD8YLQv6WHnOEtKv8D6HZUzOub855cfPnPMKvdM/Bh1plv1f7Q/0iFUDLKKlxHcEstQnaUU4QZskgQq74t+3w==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz", + "integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.13.2", - "@typescript-eslint/visitor-keys": "6.13.2", + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", + "minimatch": "9.0.3", "semver": "^7.5.4", "ts-api-utils": "^1.0.1" }, @@ -1128,17 +1189,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.2.tgz", - "integrity": "sha512-b9Ptq4eAZUym4idijCRzl61oPCwwREcfDI8xGk751Vhzig5fFZR9CyzDz4Sp/nxSLBYxUPyh4QdIDqWykFhNmQ==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz", + "integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.13.2", - "@typescript-eslint/types": "6.13.2", - "@typescript-eslint/typescript-estree": "6.13.2", + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/typescript-estree": "6.18.1", "semver": "^7.5.4" }, "engines": { @@ -1153,12 +1214,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.2.tgz", - "integrity": "sha512-OGznFs0eAQXJsp+xSd6k/O1UbFi/K/L7WjqeRoFE7vadjAF9y0uppXhYNQNEqygjou782maGClOoZwPqF0Drlw==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz", + "integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.13.2", + "@typescript-eslint/types": "6.18.1", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -1176,9 +1237,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1323,13 +1384,12 @@ } }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { @@ -1418,9 +1478,9 @@ } }, "node_modules/chai": { - "version": "4.3.10", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.0.tgz", + "integrity": "sha512-x9cHNq1uvkCdU+5xTkNh5WtgD4e4yDFCsp9jVc7N7qVeKeftv3gO/ZrviX5d+3ZfxdYnZXZYujjRInu1RogU6A==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", @@ -1756,22 +1816,22 @@ } }, "node_modules/dprint": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.42.5.tgz", - "integrity": "sha512-GvC3Hpsm/GKBZe6UjOZVKLb3u86puWc2lm+F+Bqgkk4fjQ9tpvZhENFra9al1rz01qfxsc3+6JZN/E9eJIME5Q==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.45.0.tgz", + "integrity": "sha512-3444h7V47XoA16qgIWjw3CV/Eo/rQbT/XTGlbJ/6vJ+apQyuo0+M3Ai0GS3wu7X9HBUDcA0zIHA3mOxWNz6toA==", "dev": true, "hasInstallScript": true, "bin": { "dprint": "bin.js" }, "optionalDependencies": { - "@dprint/darwin-arm64": "0.42.5", - "@dprint/darwin-x64": "0.42.5", - "@dprint/linux-arm64-glibc": "0.42.5", - "@dprint/linux-arm64-musl": "0.42.5", - "@dprint/linux-x64-glibc": "0.42.5", - "@dprint/linux-x64-musl": "0.42.5", - "@dprint/win32-x64": "0.42.5" + "@dprint/darwin-arm64": "0.45.0", + "@dprint/darwin-x64": "0.45.0", + "@dprint/linux-arm64-glibc": "0.45.0", + "@dprint/linux-arm64-musl": "0.45.0", + "@dprint/linux-x64-glibc": "0.45.0", + "@dprint/linux-x64-musl": "0.45.0", + "@dprint/win32-x64": "0.45.0" } }, "node_modules/emoji-regex": { @@ -1781,9 +1841,9 @@ "dev": true }, "node_modules/esbuild": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.8.tgz", - "integrity": "sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", + "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==", "dev": true, "hasInstallScript": true, "bin": { @@ -1793,28 +1853,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.19.8", - "@esbuild/android-arm64": "0.19.8", - "@esbuild/android-x64": "0.19.8", - "@esbuild/darwin-arm64": "0.19.8", - "@esbuild/darwin-x64": "0.19.8", - "@esbuild/freebsd-arm64": "0.19.8", - "@esbuild/freebsd-x64": "0.19.8", - "@esbuild/linux-arm": "0.19.8", - "@esbuild/linux-arm64": "0.19.8", - "@esbuild/linux-ia32": "0.19.8", - "@esbuild/linux-loong64": "0.19.8", - "@esbuild/linux-mips64el": "0.19.8", - "@esbuild/linux-ppc64": "0.19.8", - "@esbuild/linux-riscv64": "0.19.8", - "@esbuild/linux-s390x": "0.19.8", - "@esbuild/linux-x64": "0.19.8", - "@esbuild/netbsd-x64": "0.19.8", - "@esbuild/openbsd-x64": "0.19.8", - "@esbuild/sunos-x64": "0.19.8", - "@esbuild/win32-arm64": "0.19.8", - "@esbuild/win32-ia32": "0.19.8", - "@esbuild/win32-x64": "0.19.8" + "@esbuild/aix-ppc64": "0.19.11", + "@esbuild/android-arm": "0.19.11", + "@esbuild/android-arm64": "0.19.11", + "@esbuild/android-x64": "0.19.11", + "@esbuild/darwin-arm64": "0.19.11", + "@esbuild/darwin-x64": "0.19.11", + "@esbuild/freebsd-arm64": "0.19.11", + "@esbuild/freebsd-x64": "0.19.11", + "@esbuild/linux-arm": "0.19.11", + "@esbuild/linux-arm64": "0.19.11", + "@esbuild/linux-ia32": "0.19.11", + "@esbuild/linux-loong64": "0.19.11", + "@esbuild/linux-mips64el": "0.19.11", + "@esbuild/linux-ppc64": "0.19.11", + "@esbuild/linux-riscv64": "0.19.11", + "@esbuild/linux-s390x": "0.19.11", + "@esbuild/linux-x64": "0.19.11", + "@esbuild/netbsd-x64": "0.19.11", + "@esbuild/openbsd-x64": "0.19.11", + "@esbuild/sunos-x64": "0.19.11", + "@esbuild/win32-arm64": "0.19.11", + "@esbuild/win32-ia32": "0.19.11", + "@esbuild/win32-x64": "0.19.11" } }, "node_modules/escalade": { @@ -1839,15 +1900,15 @@ } }, "node_modules/eslint": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", - "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.55.0", + "@eslint/js": "8.56.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -1964,6 +2025,16 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/eslint/node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -1976,6 +2047,18 @@ "node": ">=10.13.0" } }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", @@ -2070,9 +2153,9 @@ "dev": true }, "node_modules/fast-xml-parser": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.2.tgz", - "integrity": "sha512-rmrXUXwbJedoXkStenj1kkljNF7ugn5ZjR9FJcwmCfcCbtOMDghPajbc+Tck6vE6F5XsDmx+Pr2le9fw8+pXBg==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.3.tgz", + "integrity": "sha512-coV/D1MhrShMvU6D0I+VAK3umz6hUaxxhL0yp/9RjfiYUfAv14rDhGQL+PLForhMdr0wq3PiV07WtkkNjJjNHg==", "dev": true, "funding": [ { @@ -2101,9 +2184,9 @@ } }, "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -2319,15 +2402,6 @@ "node": ">= 6" } }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/glob/node_modules/minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", @@ -2341,9 +2415,9 @@ } }, "node_modules/globals": { - "version": "13.23.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", - "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -2460,9 +2534,9 @@ } }, "node_modules/hereby": { - "version": "1.8.8", - "resolved": "https://registry.npmjs.org/hereby/-/hereby-1.8.8.tgz", - "integrity": "sha512-JODg65HcHqH1l5vnmFA2DvBzg0lZZlixA31ZvLh6Eoi4Rg6mb6/mY3Lh88+BTukEvwLjmar4EDx/y+JeUaA3zA==", + "version": "1.8.9", + "resolved": "https://registry.npmjs.org/hereby/-/hereby-1.8.9.tgz", + "integrity": "sha512-BM/Btsy77GGhuHujCdr2e0jBh3ubrjJcq8M2E/BGQ0O8M9K2uB1PfVSh/LtItAuf9TFe0l8XStaKugMjbYgs4Q==", "dev": true, "dependencies": { "command-line-usage": "^6.1.3", @@ -2840,15 +2914,18 @@ } }, "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/minimist": { @@ -2935,6 +3012,16 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/mocha/node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/mocha/node_modules/glob/node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2959,15 +3046,6 @@ "node": ">=10" } }, - "node_modules/mocha/node_modules/minimatch/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/mocha/node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -3414,6 +3492,16 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/rimraf/node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -3434,6 +3522,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -3670,6 +3770,16 @@ "node": ">=8" } }, + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/test-exclude/node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -3690,6 +3800,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -3786,9 +3908,9 @@ } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.4.0-dev.20231206", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.0-dev.20231206.tgz", + "integrity": "sha512-bKJ5+3jwj4qTzNg7C97rCVLgyyYuzjYh/Pf0zlpOyyq9vpI3TVLO09d1gQ8jS5M+BSLONojTijei0KHmFoBezw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -3849,9 +3971,9 @@ } }, "node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz", + "integrity": "sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ==", "dev": true, "engines": { "node": ">= 8" @@ -4014,205 +4136,212 @@ "dev": true }, "@dprint/darwin-arm64": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.42.5.tgz", - "integrity": "sha512-3bBBlaAXQ9WTC+jvd2/iyj7cVp0G58/v5R7+YADUl5K9xF+Ah+xLFm6xw4Iwq+zsYaWDimRmLnM5iRSJC9qv1Q==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.45.0.tgz", + "integrity": "sha512-pkSSmixIKXr5t32bhXIUbpIBm8F8uhsJcUUvfkFNsRbQvNwRp71ribZpE8dKl0ZFOlAFeWD6WLE8smp/QtiGUA==", "dev": true, "optional": true }, "@dprint/darwin-x64": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.42.5.tgz", - "integrity": "sha512-gwx6lODOckU3xGv0zVFad/SMMtwBleiBAzm3UVw/WkGiCVo3XrIZ6EdLr4zCmB4A2R+SOxODU70WtONCF0dGnQ==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.45.0.tgz", + "integrity": "sha512-PHcXSrRO53KH9N+YPbPtr40NnDo2t7hO7KLMfl2ktRNLjrmKg6F8XDDsr2C7Z11k3jyEEU2Jq8hhpaKHwNapmQ==", "dev": true, "optional": true }, "@dprint/linux-arm64-glibc": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.42.5.tgz", - "integrity": "sha512-ijJm+zOxHK3Chnis3y5kVzvBr21Ugyodqpz1chClNWkaR+0/BYDik+lxZVrbxZw8gxqPu8iisOceCQQC42Bkzg==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.45.0.tgz", + "integrity": "sha512-NgIpvZHpiQaY4DxSygxknxBtvKE2KLK9dEbUNKNE098yTHhGq7ouPsoM7RtsO34RHJ3tEZLLJEuBHn20XP8LMg==", "dev": true, "optional": true }, "@dprint/linux-arm64-musl": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.42.5.tgz", - "integrity": "sha512-OLbJgv14AvJRVBi+ZCXBH0rsMSIdCZi/z1hCTRUb901VB2OVf81k5vvBn7HS5S9wMQ2HIG8GFOyckBg0qhEgAQ==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.45.0.tgz", + "integrity": "sha512-Y8p+FC0RNyKCGQjy99Uh1LSPrlQtUTvo4brdvU1THF3pyWu6Bg1p6NiP5a6SjE/6t9CMKZJz39zPreQtnDkSDA==", "dev": true, "optional": true }, "@dprint/linux-x64-glibc": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.42.5.tgz", - "integrity": "sha512-tWh1kMbTi/lxS6hQJCDnriZonzGYN6FcN2AqF1C/TdRNjacFVvQnxZTdHPLJbgw0mSujHPinl3NtvllZ9CwVqA==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.45.0.tgz", + "integrity": "sha512-u03NCZIpJhE5gIl9Q7jNL4sOPBFd/8BLVBiuLoLtbiTZQ+NNudHKgGNATJBU67q1MKpqKnt8/gQm139cJkHhrw==", "dev": true, "optional": true }, "@dprint/linux-x64-musl": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.42.5.tgz", - "integrity": "sha512-GObJlhUqQpaXKRMTUUEkdYgWgS1aVyMUQZFn3dBmLycl4F2gXWxKgYB6R47ESVeejsEvE9fTTuxlpK6fOHjaKQ==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.45.0.tgz", + "integrity": "sha512-DQN8LPtxismkeU1X+sQywa80kWwCBcpQh9fXoJcvTEHrgzHBqbG2SEsUZpM12oKEua1KE/iBh+vgZ+4I3TdI2A==", "dev": true, "optional": true }, "@dprint/win32-x64": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.42.5.tgz", - "integrity": "sha512-N2N1FlmbEFbH/WqoKGdsZplBpfq9qdhfkJHQH1poVG3KxqT0dq01oqAfnC3ZQaSBoBrBfp5GyRtj7KwCxdqxXA==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.45.0.tgz", + "integrity": "sha512-aZHIWG2jIlEp4BER1QG6YYqPd6TxT9S77AeUkWJixNiMEo+33mPRVCBcugRWI/WJWveX8yWFVXkToORtnSFeEA==", + "dev": true, + "optional": true + }, + "@esbuild/aix-ppc64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz", + "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==", "dev": true, "optional": true }, "@esbuild/android-arm": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.8.tgz", - "integrity": "sha512-31E2lxlGM1KEfivQl8Yf5aYU/mflz9g06H6S15ITUFQueMFtFjESRMoDSkvMo8thYvLBax+VKTPlpnx+sPicOA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz", + "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==", "dev": true, "optional": true }, "@esbuild/android-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.8.tgz", - "integrity": "sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz", + "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==", "dev": true, "optional": true }, "@esbuild/android-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.8.tgz", - "integrity": "sha512-rdqqYfRIn4jWOp+lzQttYMa2Xar3OK9Yt2fhOhzFXqg0rVWEfSclJvZq5fZslnz6ypHvVf3CT7qyf0A5pM682A==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz", + "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==", "dev": true, "optional": true }, "@esbuild/darwin-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.8.tgz", - "integrity": "sha512-RQw9DemMbIq35Bprbboyf8SmOr4UXsRVxJ97LgB55VKKeJOOdvsIPy0nFyF2l8U+h4PtBx/1kRf0BelOYCiQcw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz", + "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==", "dev": true, "optional": true }, "@esbuild/darwin-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.8.tgz", - "integrity": "sha512-3sur80OT9YdeZwIVgERAysAbwncom7b4bCI2XKLjMfPymTud7e/oY4y+ci1XVp5TfQp/bppn7xLw1n/oSQY3/Q==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz", + "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==", "dev": true, "optional": true }, "@esbuild/freebsd-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.8.tgz", - "integrity": "sha512-WAnPJSDattvS/XtPCTj1tPoTxERjcTpH6HsMr6ujTT+X6rylVe8ggxk8pVxzf5U1wh5sPODpawNicF5ta/9Tmw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz", + "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==", "dev": true, "optional": true }, "@esbuild/freebsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.8.tgz", - "integrity": "sha512-ICvZyOplIjmmhjd6mxi+zxSdpPTKFfyPPQMQTK/w+8eNK6WV01AjIztJALDtwNNfFhfZLux0tZLC+U9nSyA5Zg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz", + "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==", "dev": true, "optional": true }, "@esbuild/linux-arm": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.8.tgz", - "integrity": "sha512-H4vmI5PYqSvosPaTJuEppU9oz1dq2A7Mr2vyg5TF9Ga+3+MGgBdGzcyBP7qK9MrwFQZlvNyJrvz6GuCaj3OukQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz", + "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==", "dev": true, "optional": true }, "@esbuild/linux-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.8.tgz", - "integrity": "sha512-z1zMZivxDLHWnyGOctT9JP70h0beY54xDDDJt4VpTX+iwA77IFsE1vCXWmprajJGa+ZYSqkSbRQ4eyLCpCmiCQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz", + "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==", "dev": true, "optional": true }, "@esbuild/linux-ia32": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.8.tgz", - "integrity": "sha512-1a8suQiFJmZz1khm/rDglOc8lavtzEMRo0v6WhPgxkrjcU0LkHj+TwBrALwoz/OtMExvsqbbMI0ChyelKabSvQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz", + "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==", "dev": true, "optional": true }, "@esbuild/linux-loong64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.8.tgz", - "integrity": "sha512-fHZWS2JJxnXt1uYJsDv9+b60WCc2RlvVAy1F76qOLtXRO+H4mjt3Tr6MJ5l7Q78X8KgCFudnTuiQRBhULUyBKQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz", + "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==", "dev": true, "optional": true }, "@esbuild/linux-mips64el": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.8.tgz", - "integrity": "sha512-Wy/z0EL5qZYLX66dVnEg9riiwls5IYnziwuju2oUiuxVc+/edvqXa04qNtbrs0Ukatg5HEzqT94Zs7J207dN5Q==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz", + "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==", "dev": true, "optional": true }, "@esbuild/linux-ppc64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.8.tgz", - "integrity": "sha512-ETaW6245wK23YIEufhMQ3HSeHO7NgsLx8gygBVldRHKhOlD1oNeNy/P67mIh1zPn2Hr2HLieQrt6tWrVwuqrxg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz", + "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==", "dev": true, "optional": true }, "@esbuild/linux-riscv64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.8.tgz", - "integrity": "sha512-T2DRQk55SgoleTP+DtPlMrxi/5r9AeFgkhkZ/B0ap99zmxtxdOixOMI570VjdRCs9pE4Wdkz7JYrsPvsl7eESg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz", + "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==", "dev": true, "optional": true }, "@esbuild/linux-s390x": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.8.tgz", - "integrity": "sha512-NPxbdmmo3Bk7mbNeHmcCd7R7fptJaczPYBaELk6NcXxy7HLNyWwCyDJ/Xx+/YcNH7Im5dHdx9gZ5xIwyliQCbg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz", + "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==", "dev": true, "optional": true }, "@esbuild/linux-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.8.tgz", - "integrity": "sha512-lytMAVOM3b1gPypL2TRmZ5rnXl7+6IIk8uB3eLsV1JwcizuolblXRrc5ShPrO9ls/b+RTp+E6gbsuLWHWi2zGg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz", + "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==", "dev": true, "optional": true }, "@esbuild/netbsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.8.tgz", - "integrity": "sha512-hvWVo2VsXz/8NVt1UhLzxwAfo5sioj92uo0bCfLibB0xlOmimU/DeAEsQILlBQvkhrGjamP0/el5HU76HAitGw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz", + "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==", "dev": true, "optional": true }, "@esbuild/openbsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.8.tgz", - "integrity": "sha512-/7Y7u77rdvmGTxR83PgaSvSBJCC2L3Kb1M/+dmSIvRvQPXXCuC97QAwMugBNG0yGcbEGfFBH7ojPzAOxfGNkwQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz", + "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==", "dev": true, "optional": true }, "@esbuild/sunos-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.8.tgz", - "integrity": "sha512-9Lc4s7Oi98GqFA4HzA/W2JHIYfnXbUYgekUP/Sm4BG9sfLjyv6GKKHKKVs83SMicBF2JwAX6A1PuOLMqpD001w==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz", + "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==", "dev": true, "optional": true }, "@esbuild/win32-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.8.tgz", - "integrity": "sha512-rq6WzBGjSzihI9deW3fC2Gqiak68+b7qo5/3kmB6Gvbh/NYPA0sJhrnp7wgV4bNwjqM+R2AApXGxMO7ZoGhIJg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz", + "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==", "dev": true, "optional": true }, "@esbuild/win32-ia32": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.8.tgz", - "integrity": "sha512-AIAbverbg5jMvJznYiGhrd3sumfwWs8572mIJL5NQjJa06P8KfCPWZQ0NwZbPQnbQi9OWSZhFVSUWjjIrn4hSw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz", + "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==", "dev": true, "optional": true }, "@esbuild/win32-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.8.tgz", - "integrity": "sha512-bfZ0cQ1uZs2PqpulNL5j/3w+GDhP36k1K5c38QdQg+Swy51jFZWWeIkteNsufkQxp986wnqRRsb/bHbY1WQ7TA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz", + "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==", "dev": true, "optional": true }, @@ -4272,12 +4401,33 @@ "js-yaml": "^4.1.0", "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } } }, "@eslint/js": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", - "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", "dev": true }, "@humanwhocodes/config-array": { @@ -4289,6 +4439,27 @@ "@humanwhocodes/object-schema": "^2.0.1", "debug": "^4.1.1", "minimatch": "^3.0.5" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } } }, "@humanwhocodes/module-importer": { @@ -4565,9 +4736,9 @@ "dev": true }, "@types/node": { - "version": "20.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", - "integrity": "sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==", + "version": "20.10.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.8.tgz", + "integrity": "sha512-f8nQs3cLxbAFc00vEU59yf9UyGUftkPaLGfvbVOIDdx2i1b8epBqj2aNGyP19fiyXWvlmZ7qC1XLjAzw/OKIeA==", "dev": true, "requires": { "undici-types": "~5.26.4" @@ -4595,16 +4766,16 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.2.tgz", - "integrity": "sha512-3+9OGAWHhk4O1LlcwLBONbdXsAhLjyCFogJY/cWy2lxdVJ2JrcTF2pTGMaLl2AE7U1l31n8Py4a8bx5DLf/0dQ==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz", + "integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==", "dev": true, "requires": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.13.2", - "@typescript-eslint/type-utils": "6.13.2", - "@typescript-eslint/utils": "6.13.2", - "@typescript-eslint/visitor-keys": "6.13.2", + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/type-utils": "6.18.1", + "@typescript-eslint/utils": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -4614,83 +4785,84 @@ } }, "@typescript-eslint/parser": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.2.tgz", - "integrity": "sha512-MUkcC+7Wt/QOGeVlM8aGGJZy1XV5YKjTpq9jK6r6/iLsGXhBVaGP5N0UYvFsu9BFlSpwY9kMretzdBH01rkRXg==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.18.1.tgz", + "integrity": "sha512-zct/MdJnVaRRNy9e84XnVtRv9Vf91/qqe+hZJtKanjojud4wAVy/7lXxJmMyX6X6J+xc6c//YEWvpeif8cAhWA==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "6.13.2", - "@typescript-eslint/types": "6.13.2", - "@typescript-eslint/typescript-estree": "6.13.2", - "@typescript-eslint/visitor-keys": "6.13.2", + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/typescript-estree": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.2.tgz", - "integrity": "sha512-CXQA0xo7z6x13FeDYCgBkjWzNqzBn8RXaE3QVQVIUm74fWJLkJkaHmHdKStrxQllGh6Q4eUGyNpMe0b1hMkXFA==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz", + "integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==", "dev": true, "requires": { - "@typescript-eslint/types": "6.13.2", - "@typescript-eslint/visitor-keys": "6.13.2" + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1" } }, "@typescript-eslint/type-utils": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.2.tgz", - "integrity": "sha512-Qr6ssS1GFongzH2qfnWKkAQmMUyZSyOr0W54nZNU1MDfo+U4Mv3XveeLZzadc/yq8iYhQZHYT+eoXJqnACM1tw==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz", + "integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "6.13.2", - "@typescript-eslint/utils": "6.13.2", + "@typescript-eslint/typescript-estree": "6.18.1", + "@typescript-eslint/utils": "6.18.1", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" } }, "@typescript-eslint/types": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.2.tgz", - "integrity": "sha512-7sxbQ+EMRubQc3wTfTsycgYpSujyVbI1xw+3UMRUcrhSy+pN09y/lWzeKDbvhoqcRbHdc+APLs/PWYi/cisLPg==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz", + "integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.2.tgz", - "integrity": "sha512-SuD8YLQv6WHnOEtKv8D6HZUzOub855cfPnPMKvdM/Bh1plv1f7Q/0iFUDLKKlxHcEstQnaUU4QZskgQq74t+3w==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz", + "integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==", "dev": true, "requires": { - "@typescript-eslint/types": "6.13.2", - "@typescript-eslint/visitor-keys": "6.13.2", + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", + "minimatch": "9.0.3", "semver": "^7.5.4", "ts-api-utils": "^1.0.1" } }, "@typescript-eslint/utils": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.2.tgz", - "integrity": "sha512-b9Ptq4eAZUym4idijCRzl61oPCwwREcfDI8xGk751Vhzig5fFZR9CyzDz4Sp/nxSLBYxUPyh4QdIDqWykFhNmQ==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz", + "integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.13.2", - "@typescript-eslint/types": "6.13.2", - "@typescript-eslint/typescript-estree": "6.13.2", + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/typescript-estree": "6.18.1", "semver": "^7.5.4" } }, "@typescript-eslint/visitor-keys": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.2.tgz", - "integrity": "sha512-OGznFs0eAQXJsp+xSd6k/O1UbFi/K/L7WjqeRoFE7vadjAF9y0uppXhYNQNEqygjou782maGClOoZwPqF0Drlw==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz", + "integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==", "dev": true, "requires": { - "@typescript-eslint/types": "6.13.2", + "@typescript-eslint/types": "6.18.1", "eslint-visitor-keys": "^3.4.1" } }, @@ -4701,9 +4873,9 @@ "dev": true }, "acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true }, "acorn-jsx": { @@ -4809,13 +4981,12 @@ "dev": true }, "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "braces": { @@ -4883,9 +5054,9 @@ "dev": true }, "chai": { - "version": "4.3.10", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.0.tgz", + "integrity": "sha512-x9cHNq1uvkCdU+5xTkNh5WtgD4e4yDFCsp9jVc7N7qVeKeftv3gO/ZrviX5d+3ZfxdYnZXZYujjRInu1RogU6A==", "dev": true, "requires": { "assertion-error": "^1.1.0", @@ -5143,18 +5314,18 @@ } }, "dprint": { - "version": "0.42.5", - "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.42.5.tgz", - "integrity": "sha512-GvC3Hpsm/GKBZe6UjOZVKLb3u86puWc2lm+F+Bqgkk4fjQ9tpvZhENFra9al1rz01qfxsc3+6JZN/E9eJIME5Q==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.45.0.tgz", + "integrity": "sha512-3444h7V47XoA16qgIWjw3CV/Eo/rQbT/XTGlbJ/6vJ+apQyuo0+M3Ai0GS3wu7X9HBUDcA0zIHA3mOxWNz6toA==", "dev": true, "requires": { - "@dprint/darwin-arm64": "0.42.5", - "@dprint/darwin-x64": "0.42.5", - "@dprint/linux-arm64-glibc": "0.42.5", - "@dprint/linux-arm64-musl": "0.42.5", - "@dprint/linux-x64-glibc": "0.42.5", - "@dprint/linux-x64-musl": "0.42.5", - "@dprint/win32-x64": "0.42.5" + "@dprint/darwin-arm64": "0.45.0", + "@dprint/darwin-x64": "0.45.0", + "@dprint/linux-arm64-glibc": "0.45.0", + "@dprint/linux-arm64-musl": "0.45.0", + "@dprint/linux-x64-glibc": "0.45.0", + "@dprint/linux-x64-musl": "0.45.0", + "@dprint/win32-x64": "0.45.0" } }, "emoji-regex": { @@ -5164,33 +5335,34 @@ "dev": true }, "esbuild": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.8.tgz", - "integrity": "sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w==", - "dev": true, - "requires": { - "@esbuild/android-arm": "0.19.8", - "@esbuild/android-arm64": "0.19.8", - "@esbuild/android-x64": "0.19.8", - "@esbuild/darwin-arm64": "0.19.8", - "@esbuild/darwin-x64": "0.19.8", - "@esbuild/freebsd-arm64": "0.19.8", - "@esbuild/freebsd-x64": "0.19.8", - "@esbuild/linux-arm": "0.19.8", - "@esbuild/linux-arm64": "0.19.8", - "@esbuild/linux-ia32": "0.19.8", - "@esbuild/linux-loong64": "0.19.8", - "@esbuild/linux-mips64el": "0.19.8", - "@esbuild/linux-ppc64": "0.19.8", - "@esbuild/linux-riscv64": "0.19.8", - "@esbuild/linux-s390x": "0.19.8", - "@esbuild/linux-x64": "0.19.8", - "@esbuild/netbsd-x64": "0.19.8", - "@esbuild/openbsd-x64": "0.19.8", - "@esbuild/sunos-x64": "0.19.8", - "@esbuild/win32-arm64": "0.19.8", - "@esbuild/win32-ia32": "0.19.8", - "@esbuild/win32-x64": "0.19.8" + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", + "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==", + "dev": true, + "requires": { + "@esbuild/aix-ppc64": "0.19.11", + "@esbuild/android-arm": "0.19.11", + "@esbuild/android-arm64": "0.19.11", + "@esbuild/android-x64": "0.19.11", + "@esbuild/darwin-arm64": "0.19.11", + "@esbuild/darwin-x64": "0.19.11", + "@esbuild/freebsd-arm64": "0.19.11", + "@esbuild/freebsd-x64": "0.19.11", + "@esbuild/linux-arm": "0.19.11", + "@esbuild/linux-arm64": "0.19.11", + "@esbuild/linux-ia32": "0.19.11", + "@esbuild/linux-loong64": "0.19.11", + "@esbuild/linux-mips64el": "0.19.11", + "@esbuild/linux-ppc64": "0.19.11", + "@esbuild/linux-riscv64": "0.19.11", + "@esbuild/linux-s390x": "0.19.11", + "@esbuild/linux-x64": "0.19.11", + "@esbuild/netbsd-x64": "0.19.11", + "@esbuild/openbsd-x64": "0.19.11", + "@esbuild/sunos-x64": "0.19.11", + "@esbuild/win32-arm64": "0.19.11", + "@esbuild/win32-ia32": "0.19.11", + "@esbuild/win32-x64": "0.19.11" } }, "escalade": { @@ -5206,15 +5378,15 @@ "dev": true }, "eslint": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", - "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.55.0", + "@eslint/js": "8.56.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -5251,6 +5423,16 @@ "text-table": "^0.2.0" }, "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -5259,6 +5441,15 @@ "requires": { "is-glob": "^4.0.3" } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } } } }, @@ -5381,9 +5572,9 @@ "dev": true }, "fast-xml-parser": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.2.tgz", - "integrity": "sha512-rmrXUXwbJedoXkStenj1kkljNF7ugn5ZjR9FJcwmCfcCbtOMDghPajbc+Tck6vE6F5XsDmx+Pr2le9fw8+pXBg==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.3.tgz", + "integrity": "sha512-coV/D1MhrShMvU6D0I+VAK3umz6hUaxxhL0yp/9RjfiYUfAv14rDhGQL+PLForhMdr0wq3PiV07WtkkNjJjNHg==", "dev": true, "requires": { "strnum": "^1.0.5" @@ -5396,9 +5587,9 @@ "dev": true }, "fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -5540,15 +5731,6 @@ "once": "^1.3.0" }, "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, "minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", @@ -5570,9 +5752,9 @@ } }, "globals": { - "version": "13.23.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", - "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -5650,9 +5832,9 @@ "dev": true }, "hereby": { - "version": "1.8.8", - "resolved": "https://registry.npmjs.org/hereby/-/hereby-1.8.8.tgz", - "integrity": "sha512-JODg65HcHqH1l5vnmFA2DvBzg0lZZlixA31ZvLh6Eoi4Rg6mb6/mY3Lh88+BTukEvwLjmar4EDx/y+JeUaA3zA==", + "version": "1.8.9", + "resolved": "https://registry.npmjs.org/hereby/-/hereby-1.8.9.tgz", + "integrity": "sha512-BM/Btsy77GGhuHujCdr2e0jBh3ubrjJcq8M2E/BGQ0O8M9K2uB1PfVSh/LtItAuf9TFe0l8XStaKugMjbYgs4Q==", "dev": true, "requires": { "command-line-usage": "^6.1.3", @@ -5933,12 +6115,12 @@ } }, "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" } }, "minimist": { @@ -5996,6 +6178,16 @@ "path-is-absolute": "^1.0.0" }, "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -6014,17 +6206,6 @@ "dev": true, "requires": { "brace-expansion": "^2.0.1" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - } } }, "supports-color": { @@ -6316,6 +6497,16 @@ "glob": "^7.1.3" }, "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -6329,6 +6520,15 @@ "once": "^1.3.0", "path-is-absolute": "^1.0.0" } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } } } }, @@ -6495,6 +6695,16 @@ "minimatch": "^3.0.4" }, "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -6508,6 +6718,15 @@ "once": "^1.3.0", "path-is-absolute": "^1.0.0" } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } } } }, @@ -6584,9 +6803,9 @@ } }, "typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.4.0-dev.20231206", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.0-dev.20231206.tgz", + "integrity": "sha512-bKJ5+3jwj4qTzNg7C97rCVLgyyYuzjYh/Pf0zlpOyyq9vpI3TVLO09d1gQ8jS5M+BSLONojTijei0KHmFoBezw==", "dev": true }, "typical": { @@ -6634,9 +6853,9 @@ } }, "web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz", + "integrity": "sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ==", "dev": true }, "webidl-conversions": { diff --git a/package.json b/package.json index bea908972e9a3..4b008e5cc70e9 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "chalk": "^4.1.2", "chokidar": "^3.5.3", "diff": "^5.1.0", - "dprint": "^0.42.3", + "dprint": "^0.45.0", "esbuild": "^0.19.0", "eslint": "^8.22.0", "eslint-formatter-autolinkable-stylish": "^1.2.0", @@ -78,7 +78,7 @@ "playwright": "^1.38.0", "source-map-support": "^0.5.21", "tslib": "^2.5.0", - "typescript": "^5.3.2", + "typescript": "5.4.0-dev.20231206", "which": "^2.0.2" }, "overrides": { @@ -91,7 +91,6 @@ "build:compiler": "hereby local", "build:tests": "hereby tests", "build:tests:notypecheck": "hereby tests --no-typecheck", - "start": "node lib/tsc", "clean": "hereby clean", "gulp": "hereby", "lint": "hereby lint", diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c98e5743478ef..4f80bcb783442 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -476,6 +476,7 @@ import { isCallOrNewExpression, isCallSignatureDeclaration, isCatchClause, + isCatchClauseVariableDeclaration, isCatchClauseVariableDeclarationOrBindingElement, isCheckJsEnabledForFile, isClassDeclaration, @@ -667,7 +668,6 @@ import { isOutermostOptionalChain, isParameter, isParameterDeclaration, - isParameterOrCatchClauseVariable, isParameterPropertyDeclaration, isParenthesizedExpression, isParenthesizedTypeNode, @@ -735,6 +735,7 @@ import { isTypeNode, isTypeNodeKind, isTypeOfExpression, + isTypeOnlyImportDeclaration, isTypeOnlyImportOrExportDeclaration, isTypeOperatorNode, isTypeParameterDeclaration, @@ -967,6 +968,7 @@ import { skipParentheses, skipTrivia, skipTypeChecking, + skipTypeParentheses, some, SourceFile, SpreadAssignment, @@ -2047,6 +2049,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { var noConstraintType = createAnonymousType(/*symbol*/ undefined, emptySymbols, emptyArray, emptyArray, emptyArray); var circularConstraintType = createAnonymousType(/*symbol*/ undefined, emptySymbols, emptyArray, emptyArray, emptyArray); var resolvingDefaultType = createAnonymousType(/*symbol*/ undefined, emptySymbols, emptyArray, emptyArray, emptyArray); + var resolvingApparentMappedType = createAnonymousType(/*symbol*/ undefined, emptySymbols, emptyArray, emptyArray, emptyArray); var markerSuperType = createTypeParameter(); var markerSubType = createTypeParameter(); @@ -3602,6 +3605,19 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ); } } + + // Look at 'compilerOptions.isolatedModules' and not 'getIsolatedModules(...)' (which considers 'verbatimModuleSyntax') + // here because 'verbatimModuleSyntax' will already have an error for importing a type without 'import type'. + if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & SymbolFlags.Value) === SymbolFlags.Value) { + const isGlobal = lookup(globals, name, meaning) === result; + const nonValueSymbol = isGlobal && isSourceFile(lastLocation!) && lastLocation.locals && lookup(lastLocation.locals, name, ~SymbolFlags.Value); + if (nonValueSymbol) { + const importDecl = nonValueSymbol.declarations?.find(d => d.kind === SyntaxKind.ImportSpecifier || d.kind === SyntaxKind.ImportClause || d.kind === SyntaxKind.NamespaceImport || d.kind === SyntaxKind.ImportEqualsDeclaration); + if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) { + error(importDecl, Diagnostics.Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled, unescapeLeadingUnderscores(name)); + } + } + } }); } return result; @@ -5586,6 +5602,44 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const container = getParentOfSymbol(symbol); // Type parameters end up in the `members` lists but are not externally visible if (container && !(symbol.flags & SymbolFlags.TypeParameter)) { + return getWithAlternativeContainers(container); + } + const candidates = mapDefined(symbol.declarations, d => { + if (!isAmbientModule(d) && d.parent) { + // direct children of a module + if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) { + return getSymbolOfDeclaration(d.parent as Declaration); + } + // export ='d member of an ambient module + if (isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfDeclaration(d.parent.parent)) === symbol) { + return getSymbolOfDeclaration(d.parent.parent); + } + } + if (isClassExpression(d) && isBinaryExpression(d.parent) && d.parent.operatorToken.kind === SyntaxKind.EqualsToken && isAccessExpression(d.parent.left) && isEntityNameExpression(d.parent.left.expression)) { + if (isModuleExportsAccessExpression(d.parent.left) || isExportsIdentifier(d.parent.left.expression)) { + return getSymbolOfDeclaration(getSourceFileOfNode(d)); + } + checkExpressionCached(d.parent.left.expression); + return getNodeLinks(d.parent.left.expression).resolvedSymbol; + } + }); + if (!length(candidates)) { + return undefined; + } + const containers = mapDefined(candidates, candidate => getAliasForSymbolInContainer(candidate, symbol) ? candidate : undefined); + + let bestContainers: Symbol[] = []; + let alternativeContainers: Symbol[] = []; + + for (const container of containers) { + const [bestMatch, ...rest] = getWithAlternativeContainers(container); + bestContainers = append(bestContainers, bestMatch); + alternativeContainers = addRange(alternativeContainers, rest); + } + + return concatenate(bestContainers, alternativeContainers); + + function getWithAlternativeContainers(container: Symbol) { const additionalContainers = mapDefined(container.declarations, fileSymbolIfFileSymbolExportEqualsContainer); const reexportContainers = enclosingDeclaration && getAlternativeContainingModules(symbol, enclosingDeclaration); const objectLiteralContainer = getVariableDeclarationOfObjectLiteral(container, meaning); @@ -5614,29 +5668,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { res = addRange(res, reexportContainers); return res; } - const candidates = mapDefined(symbol.declarations, d => { - if (!isAmbientModule(d) && d.parent) { - // direct children of a module - if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) { - return getSymbolOfDeclaration(d.parent as Declaration); - } - // export ='d member of an ambient module - if (isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfDeclaration(d.parent.parent)) === symbol) { - return getSymbolOfDeclaration(d.parent.parent); - } - } - if (isClassExpression(d) && isBinaryExpression(d.parent) && d.parent.operatorToken.kind === SyntaxKind.EqualsToken && isAccessExpression(d.parent.left) && isEntityNameExpression(d.parent.left.expression)) { - if (isModuleExportsAccessExpression(d.parent.left) || isExportsIdentifier(d.parent.left.expression)) { - return getSymbolOfDeclaration(getSourceFileOfNode(d)); - } - checkExpressionCached(d.parent.left.expression); - return getNodeLinks(d.parent.left.expression).resolvedSymbol; - } - }); - if (!length(candidates)) { - return undefined; - } - return mapDefined(candidates, candidate => getAliasForSymbolInContainer(candidate, symbol) ? candidate : undefined); function fileSymbolIfFileSymbolExportEqualsContainer(d: Declaration) { return container && getFileSymbolIfFileSymbolExportEqualsContainer(d, container); @@ -5688,6 +5719,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { * Checks if two symbols, through aliasing and/or merging, refer to the same thing */ function getSymbolIfSameReference(s1: Symbol, s2: Symbol) { + if (s1.flags & SymbolFlags.TypeAlias && s2.declarations?.find(isTypeAlias)) { + s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2; + } + if (s2.flags & SymbolFlags.TypeAlias && s1.declarations?.find(isTypeAlias)) { + s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1; + } if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) { return s1; } @@ -6185,12 +6222,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function hasVisibleDeclarations(symbol: Symbol, shouldComputeAliasToMakeVisible: boolean): SymbolVisibilityResult | undefined { let aliasesToMakeVisible: LateVisibilityPaintedStatement[] | undefined; + let bindingElementToMakeVisible: BindingElement | undefined; if (!every(filter(symbol.declarations, d => d.kind !== SyntaxKind.Identifier), getIsDeclarationVisible)) { return undefined; } - return { accessibility: SymbolAccessibility.Accessible, aliasesToMakeVisible }; + return { accessibility: SymbolAccessibility.Accessible, aliasesToMakeVisible, bindingElementToMakeVisible }; function getIsDeclarationVisible(declaration: Declaration) { + if (isBindingElement(declaration) && findAncestor(declaration, isParameter)) { + bindingElementToMakeVisible = declaration; + } if (!isDeclarationVisible(declaration)) { // Mark the unexported alias as visible if its parent is visible // because these kind of aliases can be used to name types in declaration file @@ -9725,6 +9766,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve const specifier = (node.parent.parent as ExportDeclaration).moduleSpecifier; + if (specifier && (node as ExportSpecifier).propertyName?.escapedText === InternalSymbolName.Default) { + verbatimTargetName = InternalSymbolName.Default; + } // targetName is only used when the target is local, as otherwise the target is an alias that points at // another file serializeExportSpecifier( @@ -14457,15 +14501,32 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function getApparentTypeOfMappedType(type: MappedType) { - return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type)); + if (type.resolvedApparentType) { + if (type.resolvedApparentType === resolvingApparentMappedType) { + return type.resolvedApparentType = type; + } + return type.resolvedApparentType; + } + type.resolvedApparentType = resolvingApparentMappedType; + return type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type); } function getResolvedApparentTypeOfMappedType(type: MappedType) { - const typeVariable = getHomomorphicTypeVariable(type); - if (typeVariable && !type.declaration.nameType) { - const constraint = getConstraintOfTypeParameter(typeVariable); + const mappedType = type.target as MappedType || type; + const typeVariable = getHomomorphicTypeVariable(mappedType); + if (typeVariable && !mappedType.declaration.nameType) { + let constraint: Type | undefined; + if (!type.target) { + constraint = getConstraintOfTypeParameter(typeVariable); + } + else { + const modifiersConstraint = getConstraintOfType(getModifiersTypeFromMappedType(type)); + if (modifiersConstraint) { + constraint = getApparentType(modifiersConstraint); + } + } if (constraint && everyType(constraint, isArrayOrTupleType)) { - return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper)); + return instantiateType(mappedType, prependTypeMapping(typeVariable, constraint, mappedType.mapper)); } } return type; @@ -14609,6 +14670,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { clone.parent = singleProp.valueDeclaration?.symbol?.parent; clone.links.containingType = containingType; clone.links.mapper = links?.mapper; + clone.links.writeType = getWriteTypeOfSymbol(singleProp); return clone; } else { @@ -17025,7 +17087,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const typeVariables: TypeVariable[] = []; // First collect a list of the type variables occurring in constraining intersections. for (const type of types) { - if (getObjectFlags(type) & ObjectFlags.IsConstrainedTypeVariable) { + if (type.flags & TypeFlags.Intersection && getObjectFlags(type) & ObjectFlags.IsConstrainedTypeVariable) { const index = (type as IntersectionType).types[0].flags & TypeFlags.TypeVariable ? 0 : 1; pushIfUnique(typeVariables, (type as IntersectionType).types[index]); } @@ -17037,7 +17099,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const primitives: Type[] = []; // First collect the primitive types from the constraining intersections. for (const type of types) { - if (getObjectFlags(type) & ObjectFlags.IsConstrainedTypeVariable) { + if (type.flags & TypeFlags.Intersection && getObjectFlags(type) & ObjectFlags.IsConstrainedTypeVariable) { const index = (type as IntersectionType).types[0].flags & TypeFlags.TypeVariable ? 0 : 1; if ((type as IntersectionType).types[index] === typeVariable) { insertType(primitives, (type as IntersectionType).types[1 - index]); @@ -17052,7 +17114,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { while (i > 0) { i--; const type = types[i]; - if (getObjectFlags(type) & ObjectFlags.IsConstrainedTypeVariable) { + if (type.flags & TypeFlags.Intersection && getObjectFlags(type) & ObjectFlags.IsConstrainedTypeVariable) { const index = (type as IntersectionType).types[0].flags & TypeFlags.TypeVariable ? 0 : 1; if ((type as IntersectionType).types[index] === typeVariable && containsType(primitives, (type as IntersectionType).types[1 - index])) { orderedRemoveItemAt(types, i); @@ -18510,7 +18572,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p; } - function isSimpleTupleType(node: TypeNode) { + function isSimpleTupleType(node: TypeNode): boolean { return isTupleTypeNode(node) && length(node.elements) > 0 && !some(node.elements, e => isOptionalTypeNode(e) || isRestTypeNode(e) || isNamedTupleMember(e) && !!(e.questionToken || e.dotDotDotToken)); } @@ -18541,11 +18603,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (checkType === wildcardType || extendsType === wildcardType) { return wildcardType; } + const checkTypeNode = skipTypeParentheses(root.node.checkType); + const extendsTypeNode = skipTypeParentheses(root.node.extendsType); // When the check and extends types are simple tuple types of the same arity, we defer resolution of the // conditional type when any tuple elements are generic. This is such that non-distributable conditional // types can be written `[X] extends [Y] ? ...` and be deferred similarly to `X extends Y ? ...`. - const checkTuples = isSimpleTupleType(root.node.checkType) && isSimpleTupleType(root.node.extendsType) && - length((root.node.checkType as TupleTypeNode).elements) === length((root.node.extendsType as TupleTypeNode).elements); + const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && + length((checkTypeNode as TupleTypeNode).elements) === length((extendsTypeNode as TupleTypeNode).elements); const checkTypeDeferred = isDeferredType(checkType, checkTuples); let combinedMapper: TypeMapper | undefined; if (root.inferTypeParameters) { @@ -19106,6 +19170,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function getESSymbolLikeTypeForNode(node: Node) { + if (isInJSFile(node) && isJSDocTypeExpression(node)) { + const host = getJSDocHost(node); + if (host) { + node = getSingleVariableOfVariableStatement(host) || host; + } + } if (isValidESSymbolDeclaration(node)) { const symbol = isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode((node as BinaryExpression).left) : getSymbolOfNode(node); if (symbol) { @@ -20882,12 +20952,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return !!(entry & RelationComparisonResult.Succeeded); } const targetEnumType = getTypeOfSymbol(targetSymbol); - for (const property of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) { - if (property.flags & SymbolFlags.EnumMember) { - const targetProperty = getPropertyOfType(targetEnumType, property.escapedName); + for (const sourceProperty of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) { + if (sourceProperty.flags & SymbolFlags.EnumMember) { + const targetProperty = getPropertyOfType(targetEnumType, sourceProperty.escapedName); if (!targetProperty || !(targetProperty.flags & SymbolFlags.EnumMember)) { if (errorReporter) { - errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property), typeToString(getDeclaredTypeOfSymbol(targetSymbol), /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType)); + errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(sourceProperty), typeToString(getDeclaredTypeOfSymbol(targetSymbol), /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType)); enumRelation.set(id, RelationComparisonResult.Failed | RelationComparisonResult.Reported); } else { @@ -20895,6 +20965,46 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } return false; } + const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, SyntaxKind.EnumMember)!); + const targetValue = getEnumMemberValue(getDeclarationOfKind(targetProperty, SyntaxKind.EnumMember)!); + if (sourceValue !== targetValue) { + const sourceIsString = typeof sourceValue === "string"; + const targetIsString = typeof targetValue === "string"; + + // If we have 2 enums with *known* values that differ, they are incompatible. + if (sourceValue !== undefined && targetValue !== undefined) { + if (!errorReporter) { + enumRelation.set(id, RelationComparisonResult.Failed); + } + else { + const escapedSource = sourceIsString ? `"${escapeString(sourceValue)}"` : sourceValue; + const escapedTarget = targetIsString ? `"${escapeString(targetValue)}"` : targetValue; + errorReporter(Diagnostics.Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given, symbolName(targetSymbol), symbolName(targetProperty), escapedTarget, escapedSource); + enumRelation.set(id, RelationComparisonResult.Failed | RelationComparisonResult.Reported); + } + return false; + } + + // At this point we know that at least one of the values is 'undefined'. + // This may mean that we have an opaque member from an ambient enum declaration, + // or that we were not able to calculate it (which is basically an error). + // + // Either way, we can assume that it's numeric. + // If the other is a string, we have a mismatch in types. + if (sourceIsString || targetIsString) { + if (!errorReporter) { + enumRelation.set(id, RelationComparisonResult.Failed); + } + else { + const knownStringValue = sourceValue ?? targetValue; + Debug.assert(typeof knownStringValue === "string"); + const escapedValue = `"${escapeString(knownStringValue)}"`; + errorReporter(Diagnostics.One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value, symbolName(targetSymbol), symbolName(targetProperty), escapedValue); + enumRelation.set(id, RelationComparisonResult.Failed | RelationComparisonResult.Reported); + } + return false; + } + } } } enumRelation.set(id, RelationComparisonResult.Succeeded); @@ -22159,6 +22269,18 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return result; } + function getApparentMappedTypeKeys(nameType: Type, targetType: MappedType) { + const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType)); + const mappedKeys: Type[] = []; + forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType( + modifiersType, + TypeFlags.StringOrNumberLiteralOrUnique, + /*stringsOnly*/ false, + t => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t))), + ); + return getUnionType(mappedKeys); + } + function structuredTypeRelatedToWorker(source: Type, target: Type, reportErrors: boolean, intersectionState: IntersectionState, saveErrorInfo: ReturnType): Ternary { let result: Ternary; let originalErrorInfo: DiagnosticMessageChain | undefined; @@ -22272,7 +22394,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // This is a carve-out in comparability to essentially forbid comparing a type parameter // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!) let constraint = getConstraintOfTypeParameter(source); - if (constraint && hasNonCircularBaseConstraint(source)) { + if (constraint) { while (constraint && someType(constraint, c => !!(c.flags & TypeFlags.TypeParameter))) { if (result = isRelatedTo(constraint, target, RecursionFlags.Source, /*reportErrors*/ false)) { return result; @@ -22322,16 +22444,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (nameType && isMappedTypeWithKeyofConstraintDeclaration(targetType)) { // we need to get the apparent mappings and union them with the generic mappings, since some properties may be // missing from the `constraintType` which will otherwise be mapped in the object - const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType)); - const mappedKeys: Type[] = []; - forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType( - modifiersType, - TypeFlags.StringOrNumberLiteralOrUnique, - /*stringsOnly*/ false, - t => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t))), - ); + const mappedKeys = getApparentMappedTypeKeys(nameType, targetType); // We still need to include the non-apparent (and thus still generic) keys in the target side of the comparison (in case they're in the source side) - targetKeys = getUnionType([...mappedKeys, nameType]); + targetKeys = getUnionType([mappedKeys, nameType]); } else { targetKeys = nameType || constraintType; @@ -22524,9 +22639,23 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } else if (sourceFlags & TypeFlags.Index) { - if (result = isRelatedTo(keyofConstraintType, target, RecursionFlags.Source, reportErrors)) { + const isDeferredMappedIndex = shouldDeferIndexType((source as IndexType).type, (source as IndexType).indexFlags) && getObjectFlags((source as IndexType).type) & ObjectFlags.Mapped; + if (result = isRelatedTo(keyofConstraintType, target, RecursionFlags.Source, reportErrors && !isDeferredMappedIndex)) { return result; } + if (isDeferredMappedIndex) { + const mappedType = (source as IndexType).type as MappedType; + const nameType = getNameTypeFromMappedType(mappedType); + // Unlike on the target side, on the source side we do *not* include the generic part of the `nameType`, since that comes from a + // (potentially anonymous) mapped type local type parameter, so that'd never assign outside the mapped type body, but we still want to + // allow assignments of index types of identical (or similar enough) mapped types. + // eg, `keyof {[X in keyof A]: Obj[X]}` should be assignable to `keyof {[Y in keyof A]: Tup[Y]}` because both map over the same set of keys (`keyof A`). + // Without this source-side breakdown, a `keyof {[X in keyof A]: Obj[X]}` style type won't be assignable to anything except itself, which is much too strict. + const sourceMappedKeys = nameType && isMappedTypeWithKeyofConstraintDeclaration(mappedType) ? getApparentMappedTypeKeys(nameType, mappedType) : (nameType || getConstraintTypeFromMappedType(mappedType)); + if (result = isRelatedTo(sourceMappedKeys, target, RecursionFlags.Source, reportErrors)) { + return result; + } + } } else if (sourceFlags & TypeFlags.TemplateLiteral && !(targetFlags & TypeFlags.Object)) { if (!(targetFlags & TypeFlags.TemplateLiteral)) { @@ -25497,6 +25626,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } else { source = getReducedType(source); + if (isGenericMappedType(source) && isGenericMappedType(target)) { + invokeOnce(source, target, inferFromGenericMappedTypes); + } if (!(priority & InferencePriority.NoConstraints && source.flags & (TypeFlags.Intersection | TypeFlags.Instantiable))) { const apparentSource = getApparentType(source); // getApparentType can return _any_ type, since an indexed access or conditional may simplify to any other type. @@ -25534,6 +25666,19 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { priority = savePriority; } + // Ensure an inference action is performed only once for the given source and target types. + // This includes two things: + // Avoiding inferring between the same pair of source and target types, + // and avoiding circularly inferring between source and target types. + // For an example of the last, consider if we are inferring between source type + // `type Deep = { next: Deep> }` and target type `type Loop = { next: Loop }`. + // We would then infer between the types of the `next` property: `Deep>` = `{ next: Deep>> }` and `Loop` = `{ next: Loop }`. + // We will then infer again between the types of the `next` property: + // `Deep>>` and `Loop`, and so on, such that we would be forever inferring + // between instantiations of the same types `Deep` and `Loop`. + // In particular, we would be inferring from increasingly deep instantiations of `Deep` to `Loop`, + // such that we would go on inferring forever, even though we would never infer + // between the same pair of types. function invokeOnce(source: Source, target: Target, action: (source: Source, target: Target) => void) { const key = source.id + "," + target.id; const status = visited && visited.get(key); @@ -25841,6 +25986,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } + function inferFromGenericMappedTypes(source: MappedType, target: MappedType) { + // The source and target types are generic types { [P in S]: X } and { [P in T]: Y }, so we infer + // from S to T and from X to Y. + inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target)); + inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); + const sourceNameType = getNameTypeFromMappedType(source); + const targetNameType = getNameTypeFromMappedType(target); + if (sourceNameType && targetNameType) inferFromTypes(sourceNameType, targetNameType); + } + function inferFromObjectTypes(source: Type, target: Type) { if ( getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && ( @@ -25852,13 +26007,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return; } if (isGenericMappedType(source) && isGenericMappedType(target)) { - // The source and target types are generic types { [P in S]: X } and { [P in T]: Y }, so we infer - // from S to T and from X to Y. - inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target)); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); - const sourceNameType = getNameTypeFromMappedType(source); - const targetNameType = getNameTypeFromMappedType(target); - if (sourceNameType && targetNameType) inferFromTypes(sourceNameType, targetNameType); + inferFromGenericMappedTypes(source, target); } if (getObjectFlags(target) & ObjectFlags.Mapped && !(target as MappedType).declaration.nameType) { const constraintType = getConstraintTypeFromMappedType(target as MappedType); @@ -26191,6 +26340,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return compilerOptions.types ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode; + case "Bun": + return compilerOptions.types + ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig + : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun; case "Map": case "Set": case "Promise": @@ -27406,7 +27559,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { case SyntaxKind.Identifier: if (!isThisInTypeQuery(node)) { const symbol = getResolvedSymbol(node as Identifier); - return isConstantVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); + return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol); } break; case SyntaxKind.PropertyAccessExpression: @@ -27416,7 +27569,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { case SyntaxKind.ObjectBindingPattern: case SyntaxKind.ArrayBindingPattern: const rootDeclaration = getRootDeclaration(node.parent); - return isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration); + return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) + ? !isSomeSymbolAssigned(rootDeclaration) + : isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration); } return false; } @@ -28683,10 +28838,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Check if a parameter or catch variable is assigned anywhere function isSymbolAssigned(symbol: Symbol) { - if (!symbol.valueDeclaration) { + return !isPastLastAssignment(symbol, /*location*/ undefined); + } + + // Return true if there are no assignments to the given symbol or if the given location + // is past the last assignment to the symbol. + function isPastLastAssignment(symbol: Symbol, location: Node | undefined) { + const parent = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile); + if (!parent) { return false; } - const parent = getRootDeclaration(symbol.valueDeclaration).parent; const links = getNodeLinks(parent); if (!(links.flags & NodeCheckFlags.AssignmentsMarked)) { links.flags |= NodeCheckFlags.AssignmentsMarked; @@ -28694,31 +28855,116 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { markNodeAssignments(parent); } } - return symbol.isAssigned || false; + return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos; + } + + // Check if a parameter or catch variable (or their bindings elements) is assigned anywhere + function isSomeSymbolAssigned(rootDeclaration: Node) { + Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration)); + return isSomeSymbolAssignedWorker(rootDeclaration.name); + } + + function isSomeSymbolAssignedWorker(node: BindingName): boolean { + if (node.kind === SyntaxKind.Identifier) { + return isSymbolAssigned(getSymbolOfDeclaration(node.parent as Declaration)); + } + + return some(node.elements, e => e.kind !== SyntaxKind.OmittedExpression && isSomeSymbolAssignedWorker(e.name)); } function hasParentWithAssignmentsMarked(node: Node) { - return !!findAncestor(node.parent, node => (isFunctionLike(node) || isCatchClause(node)) && !!(getNodeLinks(node).flags & NodeCheckFlags.AssignmentsMarked)); + return !!findAncestor(node.parent, node => isFunctionOrSourceFile(node) && !!(getNodeLinks(node).flags & NodeCheckFlags.AssignmentsMarked)); } + function isFunctionOrSourceFile(node: Node) { + return isFunctionLikeDeclaration(node) || isSourceFile(node); + } + + // For all assignments within the given root node, record the last assignment source position for all + // referenced parameters and mutable local variables. When assignments occur in nested functions or + // references occur in export specifiers, record Number.MAX_VALUE as the assignment position. When + // assignments occur in compound statements, record the ending source position of the compound statement + // as the assignment position (this is more conservative than full control flow analysis, but requires + // only a single walk over the AST). function markNodeAssignments(node: Node) { - if (node.kind === SyntaxKind.Identifier) { - if (isAssignmentTarget(node)) { - const symbol = getResolvedSymbol(node as Identifier); - if (isParameterOrCatchClauseVariable(symbol)) { - symbol.isAssigned = true; + switch (node.kind) { + case SyntaxKind.Identifier: + if (isAssignmentTarget(node)) { + const symbol = getResolvedSymbol(node as Identifier); + if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) { + const referencingFunction = findAncestor(node, isFunctionOrSourceFile); + const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile); + symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration!) : Number.MAX_VALUE; + } } - } + return; + case SyntaxKind.ExportSpecifier: + const exportDeclaration = (node as ExportSpecifier).parent.parent; + if (!(node as ExportSpecifier).isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) { + const symbol = resolveEntityName((node as ExportSpecifier).propertyName || (node as ExportSpecifier).name, SymbolFlags.Value, /*ignoreErrors*/ true, /*dontResolveAlias*/ true); + if (symbol && isParameterOrMutableLocalVariable(symbol)) { + symbol.lastAssignmentPos = Number.MAX_VALUE; + } + } + return; + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.EnumDeclaration: + return; } - else { - forEachChild(node, markNodeAssignments); + if (isTypeNode(node)) { + return; + } + forEachChild(node, markNodeAssignments); + } + + // Extend the position of the given assignment target node to the end of any intervening variable statement, + // expression statement, compound statement, or class declaration occurring between the node and the given + // declaration node. + function extendAssignmentPosition(node: Node, declaration: Declaration) { + let pos = node.pos; + while (node && node.pos > declaration.pos) { + switch (node.kind) { + case SyntaxKind.VariableStatement: + case SyntaxKind.ExpressionStatement: + case SyntaxKind.IfStatement: + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + case SyntaxKind.ForStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: + case SyntaxKind.WithStatement: + case SyntaxKind.SwitchStatement: + case SyntaxKind.TryStatement: + case SyntaxKind.ClassDeclaration: + pos = node.end; + } + node = node.parent; } + return pos; } function isConstantVariable(symbol: Symbol) { return symbol.flags & SymbolFlags.Variable && (getDeclarationNodeFlagsFromSymbol(symbol) & NodeFlags.Constant) !== 0; } + function isParameterOrMutableLocalVariable(symbol: Symbol) { + // Return true if symbol is a parameter, a catch clause variable, or a mutable local variable + const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration); + return !!declaration && ( + isParameter(declaration) || + isVariableDeclaration(declaration) && (isCatchClause(declaration.parent) || isMutableLocalVariableDeclaration(declaration)) + ); + } + + function isMutableLocalVariableDeclaration(declaration: VariableDeclaration) { + // Return true if symbol is a non-exported and non-global `let` variable + return !!(declaration.parent.flags & NodeFlags.Let) && !( + getCombinedModifierFlags(declaration) & ModifierFlags.Export || + declaration.parent.parent.kind === SyntaxKind.VariableStatement && isGlobalSourceFile(declaration.parent.parent.parent) + ); + } + function parameterInitializerContainsUndefined(declaration: ParameterDeclaration): boolean { const links = getNodeLinks(declaration); @@ -28880,7 +29126,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const parentType = getTypeForBindingElementParent(parent, CheckMode.Normal); const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~NodeCheckFlags.InCheckIdentifier; - if (parentTypeConstraint && parentTypeConstraint.flags & TypeFlags.Union && !(rootDeclaration.kind === SyntaxKind.Parameter && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & TypeFlags.Union && !(rootDeclaration.kind === SyntaxKind.Parameter && isSomeSymbolAssigned(rootDeclaration))) { const pattern = declaration.parent; const narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & TypeFlags.Never) { @@ -28920,7 +29166,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const contextualSignature = getContextualSignature(func); if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) { const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), getInferenceContext(func)?.nonFixingMapper)); - if (restType.flags & TypeFlags.Union && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) { + if (restType.flags & TypeFlags.Union && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) { const narrowedType = getFlowTypeOfReference(func, restType, restType, /*flowContainer*/ undefined, location.flowNode); const index = func.parameters.indexOf(declaration) - (getThisParameter(func) ? 1 : 0); return getIndexedAccessType(narrowedType, getNumberLiteralType(index)); @@ -29069,13 +29315,19 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const isModuleExports = symbol.flags & SymbolFlags.ModuleExports; const typeIsAutomatic = type === autoType || type === autoArrayType; const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === SyntaxKind.NonNullExpression; - // When the control flow originates in a function expression or arrow function and we are referencing - // a const variable or parameter from an outer function, we extend the origin of the control flow - // analysis to include the immediately enclosing function. + // When the control flow originates in a function expression, arrow function, method, or accessor, and + // we are referencing a closed-over const variable or parameter or mutable local variable past its last + // assignment, we extend the origin of the control flow analysis to include the immediately enclosing + // control flow container. while ( - flowContainer !== declarationContainer && (flowContainer.kind === SyntaxKind.FunctionExpression || - flowContainer.kind === SyntaxKind.ArrowFunction || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && - (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol)) + flowContainer !== declarationContainer && ( + flowContainer.kind === SyntaxKind.FunctionExpression || + flowContainer.kind === SyntaxKind.ArrowFunction || + isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer) + ) && ( + isConstantVariable(localOrExportSymbol) && type !== autoArrayType || + isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node) + ) ) { flowContainer = getControlFlowContainer(flowContainer); } @@ -31038,7 +31290,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const inDestructuringPattern = isAssignmentTarget(node); const inConstContext = isConstContext(node); const contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); - const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, isTupleLikeType); + const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, t => isTupleLikeType(t) || isGenericMappedType(t) && !t.nameType && !!getHomomorphicTypeVariable(t.target as MappedType || t)); + let hasOmittedExpression = false; for (let i = 0; i < elementCount; i++) { const e = elements[i]; @@ -39322,7 +39575,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const modifiers = getTypeParameterModifiers(typeParameter) & (ModifierFlags.In | ModifierFlags.Out); if (modifiers) { const symbol = getSymbolOfDeclaration(node.parent); - if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (ObjectFlags.Anonymous | ObjectFlags.Mapped))) { + if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (ObjectFlags.Reference | ObjectFlags.Anonymous | ObjectFlags.Mapped))) { error(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types); } else if (modifiers === ModifierFlags.In || modifiers === ModifierFlags.Out) { @@ -46949,9 +47202,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { case AssignmentDeclarationKind.ExportsProperty: case AssignmentDeclarationKind.PrototypeProperty: return getSymbolOfNode(entityName.parent); + case AssignmentDeclarationKind.Property: + if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) { + return undefined; + } + // falls through case AssignmentDeclarationKind.ThisProperty: case AssignmentDeclarationKind.ModuleExports: - case AssignmentDeclarationKind.Property: return getSymbolOfDeclaration(entityName.parent.parent as BinaryExpression); } } @@ -48778,11 +49035,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } switch (modifier.kind) { - case SyntaxKind.ConstKeyword: + case SyntaxKind.ConstKeyword: { if (node.kind !== SyntaxKind.EnumDeclaration && node.kind !== SyntaxKind.TypeParameter) { return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(SyntaxKind.ConstKeyword)); } - const parent = node.parent; + const parent = (isJSDocTemplateTag(node.parent) && getEffectiveJSDocHost(node.parent)) || node.parent; if ( node.kind === SyntaxKind.TypeParameter && !(isFunctionLikeDeclaration(parent) || isClassLike(parent) || isFunctionTypeNode(parent) || isConstructorTypeNode(parent) || isCallSignatureDeclaration(parent) || isConstructSignatureDeclaration(parent) || isMethodSignature(parent)) @@ -48790,6 +49047,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class, tokenToString(modifier.kind)); } break; + } case SyntaxKind.OverrideKeyword: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & ModifierFlags.Override) { @@ -49068,10 +49326,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { break; case SyntaxKind.InKeyword: - case SyntaxKind.OutKeyword: + case SyntaxKind.OutKeyword: { const inOutFlag = modifier.kind === SyntaxKind.InKeyword ? ModifierFlags.In : ModifierFlags.Out; const inOutText = modifier.kind === SyntaxKind.InKeyword ? "in" : "out"; - if (node.kind !== SyntaxKind.TypeParameter || !(isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent))) { + const parent = isJSDocTemplateTag(node.parent) && (getEffectiveJSDocHost(node.parent) || find(getJSDocRoot(node.parent)?.tags, isJSDocTypedefTag)) || node.parent; + if (node.kind !== SyntaxKind.TypeParameter || parent && !(isInterfaceDeclaration(parent) || isClassLike(parent) || isTypeAliasDeclaration(parent) || isJSDocTypedefTag(parent))) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -49082,6 +49341,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } flags |= inOutFlag; break; + } } } } @@ -50697,7 +50957,7 @@ export function signatureHasLiteralTypes(s: Signature) { return !!(s.flags & SignatureFlags.HasLiteralTypes); } -function createBasicNodeBuilderModuleSpecifierResolutionHost(host: TypeCheckerHost): ModuleSpecifierResolutionHost & { getCommonSourceDirectory(): string; } { +function createBasicNodeBuilderModuleSpecifierResolutionHost(host: TypeCheckerHost): ModuleSpecifierResolutionHost { return { getCommonSourceDirectory: !!(host as Program).getCommonSourceDirectory ? () => (host as Program).getCommonSourceDirectory() : () => "", getCurrentDirectory: () => host.getCurrentDirectory(), diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 64546188a88f4..6d29b82bed704 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -15,6 +15,7 @@ import { CommandLineOptionOfListType, CompilerOptions, CompilerOptionsValue, + computedOptions, ConfigFileSpecs, containsPath, convertToRelativePath, @@ -103,6 +104,7 @@ import { removeTrailingDirectorySeparator, returnTrue, ScriptTarget, + some, startsWith, StringLiteral, SyntaxKind, @@ -160,9 +162,11 @@ const libEntries: [string, string][] = [ // Host only ["dom", "lib.dom.d.ts"], ["dom.iterable", "lib.dom.iterable.d.ts"], + ["dom.asynciterable", "lib.dom.asynciterable.d.ts"], ["webworker", "lib.webworker.d.ts"], ["webworker.importscripts", "lib.webworker.importscripts.d.ts"], ["webworker.iterable", "lib.webworker.iterable.d.ts"], + ["webworker.asynciterable", "lib.webworker.asynciterable.d.ts"], ["scripthost", "lib.scripthost.d.ts"], // ES2015 Or ESNext By-feature options ["es2015.core", "lib.es2015.core.d.ts"], @@ -2475,9 +2479,10 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi ), f => getRelativePathFromFile(getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), getNormalizedAbsolutePath(f, host.getCurrentDirectory()), getCanonicalFileName), ); - const optionMap = serializeCompilerOptions(configParseResult.options, { configFilePath: getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames }); + const pathOptions = { configFilePath: getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames }; + const optionMap = serializeCompilerOptions(configParseResult.options, pathOptions); const watchOptionMap = configParseResult.watchOptions && serializeWatchOptions(configParseResult.watchOptions); - const config = { + const config: TSConfig & { watchOptions?: object; } = { compilerOptions: { ...optionMapToObject(optionMap), showConfig: undefined, @@ -2500,6 +2505,19 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi } : {}), compileOnSave: !!configParseResult.compileOnSave ? true : undefined, }; + + const providedKeys = new Set(optionMap.keys()); + const impliedCompilerOptions: Record = {}; + for (const option in computedOptions) { + if (!providedKeys.has(option) && some(computedOptions[option as keyof typeof computedOptions].dependencies, dep => providedKeys.has(dep))) { + const implied = computedOptions[option as keyof typeof computedOptions].computeValue(configParseResult.options); + const defaultValue = computedOptions[option as keyof typeof computedOptions].computeValue({}); + if (implied !== defaultValue) { + impliedCompilerOptions[option] = computedOptions[option as keyof typeof computedOptions].computeValue(configParseResult.options); + } + } + } + assign(config.compilerOptions, optionMapToObject(serializeCompilerOptions(impliedCompilerOptions, pathOptions))); return config; } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 21eae040ba922..9738920df7527 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -2400,9 +2400,13 @@ function levenshteinWithMax(s1: string, s2: string, max: number): number | undef } /** @internal */ -export function endsWith(str: string, suffix: string): boolean { +export function endsWith(str: string, suffix: string, ignoreCase?: boolean): boolean { const expectedPos = str.length - suffix.length; - return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos; + return expectedPos >= 0 && ( + ignoreCase + ? equateStringsCaseInsensitive(str.slice(expectedPos), suffix) + : str.indexOf(suffix, expectedPos) === expectedPos + ); } /** @internal */ @@ -2579,8 +2583,10 @@ export function findBestPatternMatch(values: readonly T[], getPattern: (value } /** @internal */ -export function startsWith(str: string, prefix: string): boolean { - return str.lastIndexOf(prefix, 0) === 0; +export function startsWith(str: string, prefix: string, ignoreCase?: boolean): boolean { + return ignoreCase + ? equateStringsCaseInsensitive(str.slice(0, prefix.length), prefix) + : str.lastIndexOf(prefix, 0) === 0; } /** @internal */ diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 80c55bd7ef277..1979557243abb 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3731,6 +3731,18 @@ "category": "Error", "code": 2865 }, + "Import '{0}' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled.": { + "category": "Error", + "code": 2866 + }, + "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`.": { + "category": "Error", + "code": 2867 + }, + "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig.": { + "category": "Error", + "code": 2868 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -4164,6 +4176,14 @@ "category": "Error", "code": 4124 }, + "Each declaration of '{0}.{1}' differs in its value, where '{2}' was expected but '{3}' was given.": { + "category": "Error", + "code": 4125 + }, + "One value of '{0}.{1}' is the string '{2}', and the other is assumed to be an unknown numeric value.": { + "category": "Error", + "code": 4126 + }, "The current host does not support the '{0}' option.": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 9e8f97a248c7e..3afb23c6df378 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -583,35 +583,50 @@ export function getOutputExtension(fileName: string, options: CompilerOptions): Extension.Js; } -function getOutputPathWithoutChangingExt(inputFileName: string, configFile: ParsedCommandLine, ignoreCase: boolean, outputDir: string | undefined, getCommonSourceDirectory?: () => string) { +function getOutputPathWithoutChangingExt( + inputFileName: string, + ignoreCase: boolean, + outputDir: string | undefined, + getCommonSourceDirectory: () => string, +): string { return outputDir ? resolvePath( outputDir, - getRelativePathFromDirectory(getCommonSourceDirectory ? getCommonSourceDirectory() : getCommonSourceDirectoryOfConfig(configFile, ignoreCase), inputFileName, ignoreCase), + getRelativePathFromDirectory(getCommonSourceDirectory(), inputFileName, ignoreCase), ) : inputFileName; } /** @internal */ -export function getOutputDeclarationFileName(inputFileName: string, configFile: ParsedCommandLine, ignoreCase: boolean, getCommonSourceDirectory?: () => string) { +export function getOutputDeclarationFileName(inputFileName: string, configFile: ParsedCommandLine, ignoreCase: boolean, getCommonSourceDirectory = () => getCommonSourceDirectoryOfConfig(configFile, ignoreCase)) { + return getOutputDeclarationFileNameWorker(inputFileName, configFile.options, ignoreCase, getCommonSourceDirectory); +} + +/** @internal */ +export function getOutputDeclarationFileNameWorker(inputFileName: string, options: CompilerOptions, ignoreCase: boolean, getCommonSourceDirectory: () => string) { return changeExtension( - getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory), + getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.declarationDir || options.outDir, getCommonSourceDirectory), getDeclarationEmitExtensionForPath(inputFileName), ); } -function getOutputJSFileName(inputFileName: string, configFile: ParsedCommandLine, ignoreCase: boolean, getCommonSourceDirectory?: () => string) { +function getOutputJSFileName(inputFileName: string, configFile: ParsedCommandLine, ignoreCase: boolean, getCommonSourceDirectory = () => getCommonSourceDirectoryOfConfig(configFile, ignoreCase)) { if (configFile.options.emitDeclarationOnly) return undefined; const isJsonFile = fileExtensionIs(inputFileName, Extension.Json); - const outputFileName = changeExtension( - getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), - getOutputExtension(inputFileName, configFile.options), - ); + const outputFileName = getOutputJSFileNameWorker(inputFileName, configFile.options, ignoreCase, getCommonSourceDirectory); return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== Comparison.EqualTo ? outputFileName : undefined; } +/** @internal */ +export function getOutputJSFileNameWorker(inputFileName: string, options: CompilerOptions, ignoreCase: boolean, getCommonSourceDirectory: () => string): string { + return changeExtension( + getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.outDir, getCommonSourceDirectory), + getOutputExtension(inputFileName, options), + ); +} + function createAddOutput() { let outputs: string[] | undefined; return { addOutput, getOutputs }; @@ -3592,7 +3607,14 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri function willEmitLeadingNewLine(node: Expression): boolean { if (!currentSourceFile) return false; - if (some(getLeadingCommentRanges(currentSourceFile.text, node.pos), commentWillEmitNewLine)) return true; + const leadingCommentRanges = getLeadingCommentRanges(currentSourceFile.text, node.pos); + if (leadingCommentRanges) { + const parseNode = getParseTreeNode(node); + if (parseNode && isParenthesizedExpression(parseNode.parent)) { + return true; + } + } + if (some(leadingCommentRanges, commentWillEmitNewLine)) return true; if (some(getSyntheticLeadingComments(node), commentWillEmitNewLine)) return true; if (isPartiallyEmittedExpression(node)) { if (node.pos !== node.expression.pos) { diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 67f821b09213b..19714503230c6 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -3,6 +3,7 @@ import { appendIfUnique, arrayIsEqualTo, changeAnyExtension, + changeFullExtension, CharacterCodes, combinePaths, CommandLineOption, @@ -41,7 +42,6 @@ import { GetCanonicalFileName, getCommonSourceDirectory, getCompilerOptionValue, - getDeclarationEmitExtensionForPath, getDirectoryPath, GetEffectiveTypeRootsHost, getEmitModuleKind, @@ -915,6 +915,11 @@ export function isPackageJsonInfo(entry: PackageJsonInfoCacheEntry | undefined): return !!(entry as PackageJsonInfo | undefined)?.contents; } +/** @internal */ +export function isMissingPackageJsonInfo(entry: PackageJsonInfoCacheEntry | undefined): entry is MissingPackageJsonInfo { + return !!entry && !(entry as PackageJsonInfo).contents; +} + export interface PackageJsonInfoCache { /** @internal */ getPackageJsonInfo(packageJsonPath: string): PackageJsonInfoCacheEntry | undefined; /** @internal */ setPackageJsonInfo(packageJsonPath: string, info: PackageJsonInfoCacheEntry): void; @@ -2286,9 +2291,7 @@ function loadEntrypointsFromExportMap( extensionsToExtensionsArray(extensions), /*excludes*/ undefined, [ - isDeclarationFileName(target) - ? replaceFirstStar(target, "**/*") - : changeAnyExtension(replaceFirstStar(target, "**/*"), getDeclarationEmitExtensionForPath(target)), + changeFullExtension(replaceFirstStar(target, "**/*"), ".*"), ], ).forEach(entry => { entrypoints = appendIfUnique(entrypoints, { diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 2dddc47d30c69..1da0c9e834be3 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -42,6 +42,8 @@ import { getModuleSpecifierEndingPreference, getNodeModulePathParts, getNormalizedAbsolutePath, + getOutputDeclarationFileNameWorker, + getOutputJSFileNameWorker, getOwnKeys, getPackageJsonTypesVersionsPaths, getPackageNameFromTypesPackageName, @@ -49,18 +51,21 @@ import { getRelativePathFromDirectory, getRelativePathToDirectoryOrUrl, getResolvePackageJsonExports, + getResolvePackageJsonImports, getSourceFileOfModule, getSupportedExtensions, getTextOfIdentifierOrLiteral, hasJSFileExtension, hasTSFileExtension, hostGetCanonicalFileName, + hostUsesCaseSensitiveFileNames, Identifier, isAmbientModule, isApplicableVersionedTypesKey, isDeclarationFileName, isExternalModuleAugmentation, isExternalModuleNameRelative, + isMissingPackageJsonInfo, isModuleBlock, isModuleDeclaration, isNonGlobalAmbientModule, @@ -107,6 +112,7 @@ import { SymbolFlags, toPath, tryGetExtensionFromPath, + tryParseJson, tryParsePatterns, TypeChecker, UserPreferences, @@ -485,7 +491,7 @@ function getLocalModuleSpecifier(moduleFileName: string, info: Info, compilerOpt const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode); const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions); - if (!baseUrl && !paths || relativePreference === RelativePreference.Relative) { + if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === RelativePreference.Relative) { return pathsOnly ? undefined : relativePath; } @@ -495,12 +501,14 @@ function getLocalModuleSpecifier(moduleFileName: string, info: Info, compilerOpt return pathsOnly ? undefined : relativePath; } - const fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions); + const fromPackageJsonImports = pathsOnly ? undefined : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode); + + const fromPaths = pathsOnly || fromPackageJsonImports === undefined ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : undefined; if (pathsOnly) { return fromPaths; } - const maybeNonRelative = fromPaths === undefined && baseUrl !== undefined ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths; + const maybeNonRelative = fromPackageJsonImports ?? (fromPaths === undefined && baseUrl !== undefined ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths); if (!maybeNonRelative) { return relativePath; } @@ -567,8 +575,8 @@ function getNearestAncestorDirectoryWithPackageJson(host: ModuleSpecifierResolut if (host.getNearestAncestorDirectoryWithPackageJson) { return host.getNearestAncestorDirectoryWithPackageJson(fileName); } - return !!forEachAncestorDirectory(fileName, directory => { - return host.fileExists(combinePaths(directory, "package.json")) ? true : undefined; + return forEachAncestorDirectory(fileName, directory => { + return host.fileExists(combinePaths(directory, "package.json")) ? directory : undefined; }); } @@ -843,64 +851,79 @@ const enum MatchingMode { Pattern, } -function tryGetModuleNameFromExports(options: CompilerOptions, targetFilePath: string, packageDirectory: string, packageName: string, exports: unknown, conditions: string[], mode = MatchingMode.Exact): { moduleFileToTry: string; } | undefined { +function tryGetModuleNameFromExportsOrImports(options: CompilerOptions, host: ModuleSpecifierResolutionHost, targetFilePath: string, packageDirectory: string, packageName: string, exports: unknown, conditions: string[], mode: MatchingMode, isImports: boolean): { moduleFileToTry: string; } | undefined { if (typeof exports === "string") { + const ignoreCase = !hostUsesCaseSensitiveFileNames(host); + const getCommonSourceDirectory = () => host.getCommonSourceDirectory(); + const outputFile = isImports && getOutputJSFileNameWorker(targetFilePath, options, ignoreCase, getCommonSourceDirectory); + const declarationFile = isImports && getOutputDeclarationFileNameWorker(targetFilePath, options, ignoreCase, getCommonSourceDirectory); + const pathOrPattern = getNormalizedAbsolutePath(combinePaths(packageDirectory, exports), /*currentDirectory*/ undefined); const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : undefined; + switch (mode) { case MatchingMode.Exact: - if (comparePaths(targetFilePath, pathOrPattern) === Comparison.EqualTo || (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === Comparison.EqualTo)) { + if ( + extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern, ignoreCase) === Comparison.EqualTo || + comparePaths(targetFilePath, pathOrPattern, ignoreCase) === Comparison.EqualTo || + outputFile && comparePaths(outputFile, pathOrPattern, ignoreCase) === Comparison.EqualTo || + declarationFile && comparePaths(declarationFile, pathOrPattern, ignoreCase) === Comparison.EqualTo + ) { return { moduleFileToTry: packageName }; } break; case MatchingMode.Directory: - if (containsPath(pathOrPattern, targetFilePath)) { + if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) { + const fragment = getRelativePathFromDirectory(pathOrPattern, extensionSwappedTarget, /*ignoreCase*/ false); + return { moduleFileToTry: getNormalizedAbsolutePath(combinePaths(combinePaths(packageName, exports), fragment), /*currentDirectory*/ undefined) }; + } + if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) { const fragment = getRelativePathFromDirectory(pathOrPattern, targetFilePath, /*ignoreCase*/ false); return { moduleFileToTry: getNormalizedAbsolutePath(combinePaths(combinePaths(packageName, exports), fragment), /*currentDirectory*/ undefined) }; } + if (outputFile && containsPath(pathOrPattern, outputFile, ignoreCase)) { + const fragment = getRelativePathFromDirectory(pathOrPattern, outputFile, /*ignoreCase*/ false); + return { moduleFileToTry: combinePaths(packageName, fragment) }; + } + if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) { + const fragment = getRelativePathFromDirectory(pathOrPattern, declarationFile, /*ignoreCase*/ false); + return { moduleFileToTry: combinePaths(packageName, fragment) }; + } break; case MatchingMode.Pattern: const starPos = pathOrPattern.indexOf("*"); const leadingSlice = pathOrPattern.slice(0, starPos); const trailingSlice = pathOrPattern.slice(starPos + 1); - if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) { + if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) { + const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length); + return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) }; + } + if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) { const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length); return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) }; } - if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) { - const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length); + if (outputFile && startsWith(outputFile, leadingSlice, ignoreCase) && endsWith(outputFile, trailingSlice, ignoreCase)) { + const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length); + return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) }; + } + if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) { + const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length); return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) }; } break; } } else if (Array.isArray(exports)) { - return forEach(exports, e => tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions)); + return forEach(exports, e => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports)); } else if (typeof exports === "object" && exports !== null) { // eslint-disable-line no-null/no-null - if (allKeysStartWithDot(exports as MapLike)) { - // sub-mappings - // 3 cases: - // * directory mappings (legacyish, key ends with / (technically allows index/extension resolution under cjs mode)) - // * pattern mappings (contains a *) - // * exact mappings (no *, does not end with /) - return forEach(getOwnKeys(exports as MapLike), k => { - const subPackageName = getNormalizedAbsolutePath(combinePaths(packageName, k), /*currentDirectory*/ undefined); - const mode = endsWith(k, "/") ? MatchingMode.Directory - : k.includes("*") ? MatchingMode.Pattern - : MatchingMode.Exact; - return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, (exports as MapLike)[k], conditions, mode); - }); - } - else { - // conditional mapping - for (const key of getOwnKeys(exports as MapLike)) { - if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) { - const subTarget = (exports as MapLike)[key]; - const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode); - if (result) { - return result; - } + // conditional mapping + for (const key of getOwnKeys(exports as MapLike)) { + if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) { + const subTarget = (exports as MapLike)[key]; + const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports); + if (result) { + return result; } } } @@ -908,6 +931,53 @@ function tryGetModuleNameFromExports(options: CompilerOptions, targetFilePath: s return undefined; } +function tryGetModuleNameFromExports(options: CompilerOptions, host: ModuleSpecifierResolutionHost, targetFilePath: string, packageDirectory: string, packageName: string, exports: unknown, conditions: string[]): { moduleFileToTry: string; } | undefined { + if (typeof exports === "object" && exports !== null && !Array.isArray(exports) && allKeysStartWithDot(exports as MapLike)) { // eslint-disable-line no-null/no-null + // sub-mappings + // 3 cases: + // * directory mappings (legacyish, key ends with / (technically allows index/extension resolution under cjs mode)) + // * pattern mappings (contains a *) + // * exact mappings (no *, does not end with /) + return forEach(getOwnKeys(exports as MapLike), k => { + const subPackageName = getNormalizedAbsolutePath(combinePaths(packageName, k), /*currentDirectory*/ undefined); + const mode = endsWith(k, "/") ? MatchingMode.Directory + : k.includes("*") ? MatchingMode.Pattern + : MatchingMode.Exact; + return tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, subPackageName, (exports as MapLike)[k], conditions, mode, /*isImports*/ false); + }); + } + return tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions, MatchingMode.Exact, /*isImports*/ false); +} + +function tryGetModuleNameFromPackageJsonImports(moduleFileName: string, sourceDirectory: string, options: CompilerOptions, host: ModuleSpecifierResolutionHost, importMode: ResolutionMode) { + if (!host.readFile || !getResolvePackageJsonImports(options)) { + return undefined; + } + + const ancestorDirectoryWithPackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory); + if (!ancestorDirectoryWithPackageJson) { + return undefined; + } + const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json"); + const cachedPackageJson = host.getPackageJsonInfoCache?.()?.getPackageJsonInfo(packageJsonPath); + if (isMissingPackageJsonInfo(cachedPackageJson) || !host.fileExists(packageJsonPath)) { + return undefined; + } + const packageJsonContent = cachedPackageJson?.contents.packageJsonContent || tryParseJson(host.readFile(packageJsonPath)!); + const imports = packageJsonContent?.imports; + if (!imports) { + return undefined; + } + const conditions = getConditions(options, importMode); + return forEach(getOwnKeys(imports as MapLike), k => { + if (!startsWith(k, "#") || k === "#" || startsWith(k, "#/")) return undefined; + const mode = endsWith(k, "/") ? MatchingMode.Directory + : k.includes("*") ? MatchingMode.Pattern + : MatchingMode.Exact; + return tryGetModuleNameFromExportsOrImports(options, host, moduleFileName, ancestorDirectoryWithPackageJson, k, (imports as MapLike)[k], conditions, mode, /*isImports*/ true); + })?.moduleFileToTry; +} + function tryGetModuleNameFromRootDirs(rootDirs: readonly string[], moduleFileName: string, sourceDirectory: string, getCanonicalFileName: (file: string) => string, allowedEndings: readonly ModuleSpecifierEnding[], compilerOptions: CompilerOptions): string | undefined { const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); if (normalizedTargetPaths === undefined) { @@ -995,7 +1065,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCan let maybeBlockedByTypesVersions = false; const cachedPackageJson = host.getPackageJsonInfoCache?.()?.getPackageJsonInfo(packageJsonPath); if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) { - const packageJsonContent = cachedPackageJson?.contents.packageJsonContent || JSON.parse(host.readFile!(packageJsonPath)!); + const packageJsonContent: Record | undefined = cachedPackageJson?.contents.packageJsonContent || tryParseJson(host.readFile!(packageJsonPath)!); const importMode = overrideMode || importingSourceFile.impliedNodeFormat; if (getResolvePackageJsonExports(options)) { // The package name that we found in node_modules could be different from the package @@ -1004,20 +1074,17 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCan const nodeModulesDirectoryName = packageRootPath.substring(parts.topLevelPackageNameIndex + 1); const packageName = getPackageNameFromTypesPackageName(nodeModulesDirectoryName); const conditions = getConditions(options, importMode); - const fromExports = packageJsonContent.exports - ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName, packageJsonContent.exports, conditions) + const fromExports = packageJsonContent?.exports + ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName, packageJsonContent.exports, conditions) : undefined; if (fromExports) { - const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) - ? fromExports - : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) }; - return { ...withJsExtension, verbatimFromExports: true }; + return { ...fromExports, verbatimFromExports: true }; } - if (packageJsonContent.exports) { + if (packageJsonContent?.exports) { return { moduleFileToTry: path, blockedByExports: true }; } } - const versionPaths = packageJsonContent.typesVersions + const versionPaths = packageJsonContent?.typesVersions ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : undefined; if (versionPaths) { @@ -1037,7 +1104,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCan } } // If the file is the main module, it can be imported by the package name - const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js"; + const mainFileRelative = packageJsonContent?.typings || packageJsonContent?.types || packageJsonContent?.main || "index.js"; if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths!.paths), mainFileRelative))) { // The 'main' file is also subject to mapping through typesVersions, and we couldn't come up with a path // explicitly through typesVersions, so if it matches a key in typesVersions now, it's not reachable. @@ -1052,7 +1119,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCan return { packageRootPath, moduleFileToTry }; } else if ( - packageJsonContent.type !== "module" && + packageJsonContent?.type !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index bdd80887cda66..2f411c435492a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -85,7 +85,6 @@ import { Extension, ExternalModuleReference, fileExtensionIs, - fileExtensionIsOneOf, findIndex, firstOrUndefined, forEach, @@ -99,6 +98,7 @@ import { FunctionOrConstructorTypeNode, FunctionTypeNode, GetAccessorDeclaration, + getAnyExtensionFromPath, getBaseFileName, getBinaryOperatorPrecedence, getFullWidth, @@ -9710,8 +9710,9 @@ namespace Parser { if (isBracketed) { skipWhitespace(); } - const name = parseJSDocIdentifierName(Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces); + const modifiers = parseModifiers(/*allowDecorators*/ false, /*permitConstAsModifier*/ true); + const name = parseJSDocIdentifierName(Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces); let defaultType: TypeNode | undefined; if (isBracketed) { skipWhitespace(); @@ -9723,7 +9724,7 @@ namespace Parser { if (nodeIsMissing(name)) { return undefined; } - return finishNode(factory.createTypeParameterDeclaration(/*modifiers*/ undefined, name, /*constraint*/ undefined, defaultType), typeParameterPos); + return finishNode(factory.createTypeParameterDeclaration(modifiers, name, /*constraint*/ undefined, defaultType), typeParameterPos); } function parseTemplateTagTypeParameters() { @@ -10432,7 +10433,22 @@ namespace IncrementalParser { /** @internal */ export function isDeclarationFileName(fileName: string): boolean { - return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions) || (fileExtensionIs(fileName, Extension.Ts) && getBaseFileName(fileName).includes(".d.")); + return getDeclarationFileExtension(fileName) !== undefined; +} + +/** @internal */ +export function getDeclarationFileExtension(fileName: string): string | undefined { + const standardExtension = getAnyExtensionFromPath(fileName, supportedDeclarationExtensions, /*ignoreCase*/ false); + if (standardExtension) { + return standardExtension; + } + if (fileExtensionIs(fileName, Extension.Ts)) { + const index = getBaseFileName(fileName).lastIndexOf(".d."); + if (index >= 0) { + return fileName.substring(index); + } + } + return undefined; } function parseResolutionMode(mode: string | undefined, pos: number, end: number, reportDiagnostic: PragmaDiagnosticReporter): ResolutionMode { diff --git a/src/compiler/path.ts b/src/compiler/path.ts index 685f28158901a..8c7f75f816a8b 100644 --- a/src/compiler/path.ts +++ b/src/compiler/path.ts @@ -9,6 +9,7 @@ import { equateStringsCaseInsensitive, equateStringsCaseSensitive, GetCanonicalFileName, + getDeclarationFileExtension, getStringComparer, identity, lastOrUndefined, @@ -756,6 +757,25 @@ export function changeAnyExtension(path: string, ext: string, extensions?: strin return pathext ? path.slice(0, path.length - pathext.length) + (startsWith(ext, ".") ? ext : "." + ext) : path; } +/** + * @internal + * Like `changeAnyExtension`, but declaration file extensions are recognized + * and replaced starting from the `.d`. + * + * ```ts + * changeAnyExtension("file.d.ts", ".js") === "file.d.js" + * changeFullExtension("file.d.ts", ".js") === "file.js" + * ``` + */ +export function changeFullExtension(path: string, newExtension: string) { + const declarationExtension = getDeclarationFileExtension(path); + if (declarationExtension) { + return path.slice(0, path.length - declarationExtension.length) + + (startsWith(newExtension, ".") ? newExtension : ("." + newExtension)); + } + return changeAnyExtension(path, newExtension); +} + //// Path Comparisons // check path for these segments: '', '.'. '..' diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b92bfa27b6576..6dd6cb6de43fe 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -254,6 +254,7 @@ import { parseJsonSourceFileConfigFileContent, parseNodeFactory, Path, + pathContainsNodeModules, pathIsAbsolute, pathIsRelative, Program, @@ -1307,13 +1308,13 @@ export function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCom * A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the * `options` parameter. * - * @param fileName The normalized absolute path to check the format of (it need not exist on disk) + * @param fileName The file name to check the format of (it need not exist on disk) * @param [packageJsonInfoCache] A cache for package file lookups - it's best to have a cache when this function is called often * @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data * @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution` * @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format */ -export function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode { +export function getImpliedNodeFormatForFile(fileName: string, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode { const result = getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options); return typeof result === "object" ? result.impliedNodeFormat : result; } @@ -4039,7 +4040,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const isFromNodeModulesSearch = resolution.isExternalLibraryImport; const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension); - const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile; + const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile && (!resolution.originalPath || pathContainsNodeModules(resolution.resolvedFileName)); const resolvedFileName = resolution.resolvedFileName; if (isFromNodeModulesSearch) { diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 0f3479133ec55..95bcc19820ff0 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -47,10 +47,12 @@ import { factory, FileReference, filter, + findAncestor, flatMap, flatten, forEach, FunctionDeclaration, + FunctionExpression, FunctionTypeNode, GeneratedIdentifierFlags, GetAccessorDeclaration, @@ -66,6 +68,7 @@ import { getLineAndCharacterOfPosition, getNameOfDeclaration, getNormalizedAbsolutePath, + getOriginalNode, getOriginalNodeId, getOutputPathsFor, getParseTreeNode, @@ -132,6 +135,7 @@ import { isModifier, isModuleDeclaration, isOmittedExpression, + isParameter, isPrivateIdentifier, isPropertySignature, isSemicolonClassElement, @@ -153,6 +157,7 @@ import { isVarAwaitUsing, isVariableDeclaration, isVarUsing, + JSDocFunctionType, last, LateBoundDeclaration, LateVisibilityPaintedStatement, @@ -184,6 +189,7 @@ import { pathContainsNodeModules, pathIsRelative, PropertyDeclaration, + PropertyName, PropertySignature, pushIfUnique, removeAllComments, @@ -296,6 +302,7 @@ export function transformDeclarations(context: TransformationContext) { let lateStatementReplacementMap: Map>; let suppressNewDiagnosticContexts: boolean; let exportedModulesFromDeclarationEmit: Symbol[] | undefined; + const usedBindingElementAliases = new Map>(); const { factory } = context; const host = context.getEmitHost(); @@ -361,7 +368,7 @@ export function transformDeclarations(context: TransformationContext) { function handleSymbolAccessibilityError(symbolAccessibilityResult: SymbolAccessibilityResult) { if (symbolAccessibilityResult.accessibility === SymbolAccessibility.Accessible) { // Add aliases back onto the possible imports list if they're not there so we can try them again with updated visibility info - if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { + if (symbolAccessibilityResult.aliasesToMakeVisible) { if (!lateMarkedStatements) { lateMarkedStatements = symbolAccessibilityResult.aliasesToMakeVisible; } @@ -371,6 +378,17 @@ export function transformDeclarations(context: TransformationContext) { } } } + if (symbolAccessibilityResult.bindingElementToMakeVisible) { + const bindingElement = symbolAccessibilityResult.bindingElementToMakeVisible; + const parameter = findAncestor(bindingElement, isParameter); + Debug.assert(parameter !== undefined); + const parent = getOriginalNode(parameter.parent); + let aliases = usedBindingElementAliases.get(parent); + if (!aliases) { + usedBindingElementAliases.set(parent, aliases = new Map()); + } + aliases.set(getOriginalNode(bindingElement), bindingElement.name); + } // TODO: Do all these accessibility checks inside/after the first pass in the checker when declarations are enabled, if possible } @@ -617,6 +635,11 @@ export function transformDeclarations(context: TransformationContext) { function mapReferencesIntoArray(references: FileReference[], outputFilePath: string): (file: SourceFile) => void { return file => { + if (exportedModulesFromDeclarationEmit?.includes(file.symbol)) { + // Already have an import declaration resolving to this file + return; + } + let declFileName: string; if (file.isDeclarationFile) { // Neither decl files or js should have their refs changed declFileName = file.fileName; @@ -708,8 +731,9 @@ export function transformDeclarations(context: TransformationContext) { if (elem.propertyName && isComputedPropertyName(elem.propertyName) && isEntityNameExpression(elem.propertyName.expression)) { checkEntityNameVisibility(elem.propertyName.expression, enclosingDeclaration); } - if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) { - // Unnecessary property renaming is forbidden in types, so remove renaming + + if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !isIdentifierANonContextualKeyword(elem.propertyName)) { + // Remove rename. We will add it back if it used. return factory.updateBindingElement( elem, elem.dotDotDotToken, @@ -718,6 +742,7 @@ export function transformDeclarations(context: TransformationContext) { shouldPrintWithInitializer(elem) ? elem.initializer : undefined, ); } + return factory.updateBindingElement( elem, elem.dotDotDotToken, @@ -727,6 +752,171 @@ export function transformDeclarations(context: TransformationContext) { ); } } + type SignatureDeclarationWithUsableBindingAliases = Exclude; + function ensureBindingAliasesInParameterList(input: T, updatedNode: T): T; + function ensureBindingAliasesInParameterList(input: SignatureDeclarationWithUsableBindingAliases, updatedNode: SignatureDeclarationWithUsableBindingAliases) { + const original = getOriginalNode(input); + const params = updatedNode.parameters; + const aliases = usedBindingElementAliases.get(original); + if (!aliases) { + return updatedNode; + } + usedBindingElementAliases.delete(original); + const newParams = map(params, addUsedBindingPatternsToParameter); + const newParamsNodeArray = factory.createNodeArray(newParams, params.hasTrailingComma); + switch (updatedNode.kind) { + case SyntaxKind.MethodDeclaration: + return factory.updateMethodDeclaration( + updatedNode, + updatedNode.modifiers, + updatedNode.asteriskToken, + updatedNode.name, + updatedNode.questionToken, + updatedNode.typeParameters, + newParamsNodeArray, + updatedNode.type, + updatedNode.body, + ); + case SyntaxKind.Constructor: + return factory.updateConstructorDeclaration( + updatedNode, + updatedNode.modifiers, + newParamsNodeArray, + updatedNode.body, + ); + case SyntaxKind.GetAccessor: + return factory.updateGetAccessorDeclaration( + updatedNode, + updatedNode.modifiers, + updatedNode.name, + newParamsNodeArray, + updatedNode.type, + updatedNode.body, + ); + case SyntaxKind.SetAccessor: + return factory.updateSetAccessorDeclaration( + updatedNode, + updatedNode.modifiers, + updatedNode.name, + newParamsNodeArray, + updatedNode.body, + ); + case SyntaxKind.ArrowFunction: + return factory.updateArrowFunction( + updatedNode, + updatedNode.modifiers, + updatedNode.typeParameters, + newParamsNodeArray, + updatedNode.type, + updatedNode.equalsGreaterThanToken, + updatedNode.body, + ); + case SyntaxKind.FunctionDeclaration: + return factory.updateFunctionDeclaration( + updatedNode, + updatedNode.modifiers, + updatedNode.asteriskToken, + updatedNode.name, + updatedNode.typeParameters, + newParamsNodeArray, + updatedNode.type, + updatedNode.body, + ); + case SyntaxKind.CallSignature: + return factory.updateCallSignature( + updatedNode, + updatedNode.typeParameters, + newParamsNodeArray, + updatedNode.type, + ); + case SyntaxKind.MethodSignature: + return factory.updateMethodSignature( + updatedNode, + updatedNode.modifiers, + updatedNode.name, + updatedNode.questionToken, + updatedNode.typeParameters, + newParamsNodeArray, + updatedNode.type, + ); + + case SyntaxKind.ConstructSignature: + return factory.updateConstructSignature( + updatedNode, + updatedNode.typeParameters, + newParamsNodeArray, + updatedNode.type, + ); + case SyntaxKind.FunctionType: + return factory.updateFunctionTypeNode( + updatedNode, + updatedNode.typeParameters, + newParamsNodeArray, + updatedNode.type, + ); + case SyntaxKind.ConstructorType: + return factory.updateConstructorTypeNode( + updatedNode, + updatedNode.modifiers, + updatedNode.typeParameters, + newParamsNodeArray, + updatedNode.type, + ); + default: + Debug.assertNever(updatedNode); + } + + function addUsedBindingPatternsToParameter(p: ParameterDeclaration): ParameterDeclaration { + return factory.updateParameterDeclaration( + p, + p.modifiers, + p.dotDotDotToken, + addUsedBindingPatternAliases(p.name), + p.questionToken, + p.type, + p.initializer, + ); + } + function addUsedBindingPatternAliases(name: BindingName) { + if (name.kind === SyntaxKind.Identifier) { + return name; + } + else { + if (name.kind === SyntaxKind.ArrayBindingPattern) { + return factory.updateArrayBindingPattern(name, visitNodes(name.elements, visitBindingElement, isArrayBindingElement)); + } + else { + return factory.updateObjectBindingPattern(name, visitNodes(name.elements, visitBindingElement, isBindingElement)); + } + } + + function visitBindingElement(elem: T): T; + function visitBindingElement(elem: ArrayBindingElement): ArrayBindingElement { + if (elem.kind === SyntaxKind.OmittedExpression) { + return elem; + } + const usedAlias = aliases!.get(getOriginalNode(elem)); + // If alias is used and property name was removed by filterBindingPatternInitializersAndRenamings + // The alias can be preserved if it is a non contextual keyword. + if (usedAlias && !elem.propertyName) { + return factory.updateBindingElement( + elem, + elem.dotDotDotToken, + elem.name as PropertyName, + usedAlias, + elem.initializer, + ); + } + return factory.updateBindingElement( + elem, + elem.dotDotDotToken, + elem.propertyName, + addUsedBindingPatternAliases(elem.name), + elem.initializer, + ); + } + } + } function ensureParameter(p: ParameterDeclaration, modifierMask?: ModifierFlags, type?: TypeNode): ParameterDeclaration { let oldDiag: typeof getSymbolAccessibilityDiagnostic | undefined; @@ -1177,18 +1367,24 @@ export function transformDeclarations(context: TransformationContext) { return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } case SyntaxKind.ConstructSignature: - return cleanup(factory.updateConstructSignature( + return cleanup(ensureBindingAliasesInParameterList( input, - ensureTypeParams(input, input.typeParameters), - updateParamsList(input, input.parameters), - ensureType(input, input.type), + factory.updateConstructSignature( + input, + ensureTypeParams(input, input.typeParameters), + updateParamsList(input, input.parameters), + ensureType(input, input.type), + ), )); case SyntaxKind.Constructor: { // A constructor declaration may not have a type annotation - const ctor = factory.createConstructorDeclaration( - /*modifiers*/ ensureModifiers(input), - updateParamsList(input, input.parameters, ModifierFlags.None), - /*body*/ undefined, + const ctor = ensureBindingAliasesInParameterList( + input, + factory.createConstructorDeclaration( + /*modifiers*/ ensureModifiers(input), + updateParamsList(input, input.parameters, ModifierFlags.None), + /*body*/ undefined, + ), ); return cleanup(ctor); } @@ -1196,15 +1392,18 @@ export function transformDeclarations(context: TransformationContext) { if (isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } - const sig = factory.createMethodDeclaration( - ensureModifiers(input), - /*asteriskToken*/ undefined, - input.name, - input.questionToken, - ensureTypeParams(input, input.typeParameters), - updateParamsList(input, input.parameters), - ensureType(input, input.type), - /*body*/ undefined, + const sig = ensureBindingAliasesInParameterList( + input, + factory.createMethodDeclaration( + ensureModifiers(input), + /*asteriskToken*/ undefined, + input.name, + input.questionToken, + ensureTypeParams(input, input.typeParameters), + updateParamsList(input, input.parameters), + ensureType(input, input.type), + /*body*/ undefined, + ), ); return cleanup(sig); } @@ -1213,25 +1412,31 @@ export function transformDeclarations(context: TransformationContext) { return cleanup(/*returnValue*/ undefined); } const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input)); - return cleanup(factory.updateGetAccessorDeclaration( + return cleanup(ensureBindingAliasesInParameterList( input, - ensureModifiers(input), - input.name, - updateAccessorParamsList(input, hasEffectiveModifier(input, ModifierFlags.Private)), - ensureType(input, accessorType), - /*body*/ undefined, + factory.updateGetAccessorDeclaration( + input, + ensureModifiers(input), + input.name, + updateAccessorParamsList(input, hasEffectiveModifier(input, ModifierFlags.Private)), + ensureType(input, accessorType), + /*body*/ undefined, + ), )); } case SyntaxKind.SetAccessor: { if (isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } - return cleanup(factory.updateSetAccessorDeclaration( + return cleanup(ensureBindingAliasesInParameterList( input, - ensureModifiers(input), - input.name, - updateAccessorParamsList(input, hasEffectiveModifier(input, ModifierFlags.Private)), - /*body*/ undefined, + factory.updateSetAccessorDeclaration( + input, + ensureModifiers(input), + input.name, + updateAccessorParamsList(input, hasEffectiveModifier(input, ModifierFlags.Private)), + /*body*/ undefined, + ), )); } case SyntaxKind.PropertyDeclaration: @@ -1261,22 +1466,28 @@ export function transformDeclarations(context: TransformationContext) { if (isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } - return cleanup(factory.updateMethodSignature( + return cleanup(ensureBindingAliasesInParameterList( input, - ensureModifiers(input), - input.name, - input.questionToken, - ensureTypeParams(input, input.typeParameters), - updateParamsList(input, input.parameters), - ensureType(input, input.type), + factory.updateMethodSignature( + input, + ensureModifiers(input), + input.name, + input.questionToken, + ensureTypeParams(input, input.typeParameters), + updateParamsList(input, input.parameters), + ensureType(input, input.type), + ), )); } case SyntaxKind.CallSignature: { - return cleanup(factory.updateCallSignature( + return cleanup(ensureBindingAliasesInParameterList( input, - ensureTypeParams(input, input.typeParameters), - updateParamsList(input, input.parameters), - ensureType(input, input.type), + factory.updateCallSignature( + input, + ensureTypeParams(input, input.typeParameters), + updateParamsList(input, input.parameters), + ensureType(input, input.type), + ), )); } case SyntaxKind.IndexSignature: { @@ -1318,10 +1529,27 @@ export function transformDeclarations(context: TransformationContext) { return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } case SyntaxKind.FunctionType: { - return cleanup(factory.updateFunctionTypeNode(input, visitNodes(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode)))); + return cleanup(ensureBindingAliasesInParameterList( + input, + factory.updateFunctionTypeNode( + input, + visitNodes(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), + updateParamsList(input, input.parameters), + Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode)), + ), + )); } case SyntaxKind.ConstructorType: { - return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), visitNodes(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode)))); + return cleanup(ensureBindingAliasesInParameterList( + input, + factory.updateConstructorTypeNode( + input, + ensureModifiers(input), + visitNodes(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), + updateParamsList(input, input.parameters), + Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode)), + ), + )); } case SyntaxKind.ImportType: { if (!isLiteralImportTypeNode(input)) return cleanup(input); @@ -1528,15 +1756,18 @@ export function transformDeclarations(context: TransformationContext) { } case SyntaxKind.FunctionDeclaration: { // Generators lose their generator-ness, excepting their return type - const clean = cleanup(factory.updateFunctionDeclaration( + const clean = cleanup(ensureBindingAliasesInParameterList( input, - ensureModifiers(input), - /*asteriskToken*/ undefined, - input.name, - ensureTypeParams(input, input.typeParameters), - updateParamsList(input, input.parameters), - ensureType(input, input.type), - /*body*/ undefined, + factory.updateFunctionDeclaration( + input, + ensureModifiers(input), + /*asteriskToken*/ undefined, + input.name, + ensureTypeParams(input, input.typeParameters), + updateParamsList(input, input.parameters), + ensureType(input, input.type), + /*body*/ undefined, + ), )); if (clean && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) { const props = resolver.getPropertiesOfContainerFunction(input); diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index a356421c191ae..e164665379205 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -82,6 +82,7 @@ import { isClassThisAssignmentBlock, isCompoundAssignment, isComputedPropertyName, + isConstructorDeclaration, isDestructuringAssignment, isElementAccessExpression, isExportModifier, @@ -98,7 +99,6 @@ import { isMethodDeclaration, isMethodOrAccessor, isModifier, - isNamedClassElement, isNamedEvaluation, isObjectBindingOrAssignmentElement, isObjectLiteralElementLike, @@ -137,6 +137,7 @@ import { Node, NodeArray, NodeFlags, + nodeIsDecorated, nodeOrChildIsDecorated, ObjectLiteralElement, OmittedExpression, @@ -212,30 +213,38 @@ import { // 8. Non-static field (excl. auto-accessor) element decorators are applied // 9. Class decorators are applied // 10. Class binding is initialized -// 11. Static extra initializers are evaluated -// 12. Static fields are initialized and static blocks are evaluated +// 11. Static method extra initializers are evaluated +// 12. Static fields are initialized (incl. extra initializers) and static blocks are evaluated // 13. Class extra initializers are evaluated +// +// Class constructor evaluation order, as it pertains to this transformer: +// +// 1. Instance method extra initializers are evaluated +// 2. For each instance field/auto-accessor: +// a. The field is initialized and defined on the instance. +// b. Extra initializers for the field are evaluated. interface MemberInfo { - memberDecoratorsName: Identifier; // used in step 4.a - memberInitializersName?: Identifier; // used in step 12 and construction + memberDecoratorsName: Identifier; // used in class definition step 4.a + memberInitializersName?: Identifier; // used in class definition step 12 and constructor evaluation step 2.a + memberExtraInitializersName?: Identifier; // used in class definition step 12 and constructor evaluation step 2.b memberDescriptorName?: Identifier; } interface ClassInfo { class: ClassLikeDeclaration; - classDecoratorsName?: Identifier; // used in step 2 - classDescriptorName?: Identifier; // used in step 10 - classExtraInitializersName?: Identifier; // used in step 13 + classDecoratorsName?: Identifier; // used in class definition step 2 + classDescriptorName?: Identifier; // used in class definition step 10 + classExtraInitializersName?: Identifier; // used in class definition step 13 classThis?: Identifier; // `_classThis`, if needed. classSuper?: Identifier; // `_classSuper`, if needed. metadataReference: Identifier; - memberInfos?: Map; // used in step 4.a, 12, and construction + memberInfos?: Map; // used in class definition step 4.a, 12, and constructor evaluation - instanceExtraInitializersName: Identifier | undefined; // used in construction - staticExtraInitializersName: Identifier | undefined; // used in step 11 + instanceMethodExtraInitializersName?: Identifier | undefined; // used in constructor evaluation step 1 + staticMethodExtraInitializersName?: Identifier | undefined; // used in class definition step 11 staticNonFieldDecorationStatements?: Statement[]; nonStaticNonFieldDecorationStatements?: Statement[]; @@ -244,8 +253,10 @@ interface ClassInfo { hasStaticInitializers: boolean; hasNonAmbientInstanceFields: boolean; - hasInjectedInstanceInitializers?: boolean; hasStaticPrivateClassElements: boolean; + + pendingStaticInitializers?: Expression[]; + pendingInstanceInitializers?: Expression[]; } interface ClassLexicalEnvironmentStackEntry { @@ -566,22 +577,50 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc function createClassInfo(node: ClassLikeDeclaration): ClassInfo { const metadataReference = factory.createUniqueName("_metadata", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); - let instanceExtraInitializersName: Identifier | undefined; - let staticExtraInitializersName: Identifier | undefined; + let instanceMethodExtraInitializersName: Identifier | undefined; + let staticMethodExtraInitializersName: Identifier | undefined; let hasStaticInitializers = false; let hasNonAmbientInstanceFields = false; let hasStaticPrivateClassElements = false; + let classThis: Identifier | undefined; + let pendingStaticInitializers: Expression[] | undefined; + let pendingInstanceInitializers: Expression[] | undefined; // Before visiting we perform a first pass to collect information we'll need // as we descend. + if (nodeIsDecorated(/*useLegacyDecorators*/ false, node)) { + // We do not mark _classThis as FileLevel if it may be reused by class private fields, which requires the + // ability access the captured `_classThis` of outer scopes. + const needsUniqueClassThis = some(node.members, member => (isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member)); + classThis = factory.createUniqueName( + "_classThis", + needsUniqueClassThis ? + GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.ReservedInNestedScopes : + GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel, + ); + } + for (const member of node.members) { - if (isNamedClassElement(member) && nodeOrChildIsDecorated(/*useLegacyDecorators*/ false, member, node)) { + if (isMethodOrAccessor(member) && nodeOrChildIsDecorated(/*useLegacyDecorators*/ false, member, node)) { if (hasStaticModifier(member)) { - staticExtraInitializersName ??= factory.createUniqueName("_staticExtraInitializers", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); + if (!staticMethodExtraInitializersName) { + staticMethodExtraInitializersName = factory.createUniqueName("_staticExtraInitializers", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); + const initializer = emitHelpers().createRunInitializersHelper(classThis ?? factory.createThis(), staticMethodExtraInitializersName); + setSourceMapRange(initializer, node.name ?? moveRangePastDecorators(node)); + pendingStaticInitializers ??= []; + pendingStaticInitializers.push(initializer); + } } else { - instanceExtraInitializersName ??= factory.createUniqueName("_instanceExtraInitializers", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); + if (!instanceMethodExtraInitializersName) { + instanceMethodExtraInitializersName = factory.createUniqueName("_instanceExtraInitializers", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); + const initializer = emitHelpers().createRunInitializersHelper(factory.createThis(), instanceMethodExtraInitializersName); + setSourceMapRange(initializer, node.name ?? moveRangePastDecorators(node)); + pendingInstanceInitializers ??= []; + pendingInstanceInitializers.push(initializer); + } + instanceMethodExtraInitializersName ??= factory.createUniqueName("_instanceExtraInitializers", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); } } if (isClassStaticBlockDeclaration(member)) { @@ -604,8 +643,8 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc // exit early if possible if ( - staticExtraInitializersName && - instanceExtraInitializersName && + staticMethodExtraInitializersName && + instanceMethodExtraInitializersName && hasStaticInitializers && hasNonAmbientInstanceFields && hasStaticPrivateClassElements @@ -616,12 +655,15 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc return { class: node, + classThis, metadataReference, - instanceExtraInitializersName, - staticExtraInitializersName, + instanceMethodExtraInitializersName, + staticMethodExtraInitializersName, hasStaticInitializers, hasNonAmbientInstanceFields, hasStaticPrivateClassElements, + pendingStaticInitializers, + pendingInstanceInitializers, }; } @@ -655,15 +697,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc classInfo.classDecoratorsName = factory.createUniqueName("_classDecorators", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); classInfo.classDescriptorName = factory.createUniqueName("_classDescriptor", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); classInfo.classExtraInitializersName = factory.createUniqueName("_classExtraInitializers", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); - // We do not mark _classThis as FileLevel if it may be reused by class private fields, which requires the - // ability access the captured `_classThis` of outer scopes. - const needsUniqueClassThis = some(node.members, member => (isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member)); - classInfo.classThis = factory.createUniqueName( - "_classThis", - needsUniqueClassThis ? - GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.ReservedInNestedScopes : - GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel, - ); + Debug.assertIsDefined(classInfo.classThis); classDefinitionStatements.push( createLet(classInfo.classDecoratorsName, factory.createArrayLiteralExpression(classDecorators)), createLet(classInfo.classDescriptorName), @@ -718,7 +752,11 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc leadingBlockStatements = append(leadingBlockStatements, createMetadata(classInfo.metadataReference, classInfo.classSuper)); - let members = visitNodes(node.members, classElementVisitor, isClassElement); + // Since the constructor can appear anywhere in the class body and its transform depends on other class elements, + // we must first visit all non-constructor members, then visit the constructor, all while maintaining document order. + let members = node.members; + members = visitNodes(members, node => isConstructorDeclaration(node) ? node : classElementVisitor(node), isClassElement); + members = visitNodes(members, node => isConstructorDeclaration(node) ? classElementVisitor(node) : node, isClassElement); if (pendingExpressions) { let outerThis: Identifier | undefined; for (let expression of pendingExpressions) { @@ -751,7 +789,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc } exitClass(); - if (classInfo.instanceExtraInitializersName && !getFirstConstructorWithBody(node)) { + if (some(classInfo.pendingInstanceInitializers) && !getFirstConstructorWithBody(node)) { const initializerStatements = prepareConstructor(node, classInfo); if (initializerStatements) { const extendsClauseElement = getEffectiveBaseTypeNode(node); @@ -770,21 +808,21 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc } } - // Used in steps 5, 7, and 11 - if (classInfo.staticExtraInitializersName) { + // Used in class definition steps 5, 7, and 11 + if (classInfo.staticMethodExtraInitializersName) { classDefinitionStatements.push( - createLet(classInfo.staticExtraInitializersName, factory.createArrayLiteralExpression()), + createLet(classInfo.staticMethodExtraInitializersName, factory.createArrayLiteralExpression()), ); } - // Used in steps 6, 8, and during construction - if (classInfo.instanceExtraInitializersName) { + // Used in class definition steps 6, 8, and during construction + if (classInfo.instanceMethodExtraInitializersName) { classDefinitionStatements.push( - createLet(classInfo.instanceExtraInitializersName, factory.createArrayLiteralExpression()), + createLet(classInfo.instanceMethodExtraInitializersName, factory.createArrayLiteralExpression()), ); } - // Used in steps 7, 8, 12, and construction + // Used in class definition steps 7, 8, 12, and construction if (classInfo.memberInfos) { forEachEntry(classInfo.memberInfos, (memberInfo, member) => { if (isStatic(member)) { @@ -792,6 +830,9 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc if (memberInfo.memberInitializersName) { classDefinitionStatements.push(createLet(memberInfo.memberInitializersName, factory.createArrayLiteralExpression())); } + if (memberInfo.memberExtraInitializersName) { + classDefinitionStatements.push(createLet(memberInfo.memberExtraInitializersName, factory.createArrayLiteralExpression())); + } if (memberInfo.memberDescriptorName) { classDefinitionStatements.push(createLet(memberInfo.memberDescriptorName)); } @@ -799,7 +840,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc }); } - // Used in steps 7, 8, 12, and construction + // Used in class definition steps 7, 8, 12, and construction if (classInfo.memberInfos) { forEachEntry(classInfo.memberInfos, (memberInfo, member) => { if (!isStatic(member)) { @@ -807,6 +848,9 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc if (memberInfo.memberInitializersName) { classDefinitionStatements.push(createLet(memberInfo.memberInitializersName, factory.createArrayLiteralExpression())); } + if (memberInfo.memberExtraInitializersName) { + classDefinitionStatements.push(createLet(memberInfo.memberExtraInitializersName, factory.createArrayLiteralExpression())); + } if (memberInfo.memberDescriptorName) { classDefinitionStatements.push(createLet(memberInfo.memberDescriptorName)); } @@ -857,19 +901,21 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc leadingBlockStatements.push(factory.createExpressionStatement(classReferenceAssignment)); } - // if (metadata) Object.defineProperty(C, Symbol.metadata, { configurable: true, writable: true, value: metadata }); + // produces: + // if (metadata) Object.defineProperty(C, Symbol.metadata, { configurable: true, writable: true, value: metadata }); leadingBlockStatements.push(createSymbolMetadata(renamedClassThis, classInfo.metadataReference)); // 11. Static extra initializers are evaluated - if (classInfo.staticExtraInitializersName) { - const runStaticInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo.staticExtraInitializersName); - const runStaticInitializersStatement = factory.createExpressionStatement(runStaticInitializersHelper); - setSourceMapRange(runStaticInitializersStatement, node.name ?? moveRangePastDecorators(node)); - leadingBlockStatements = append(leadingBlockStatements, runStaticInitializersStatement); + // 12. Static fields are initialized (incl. extra initializers) and static blocks are evaluated + if (some(classInfo.pendingStaticInitializers)) { + for (const initializer of classInfo.pendingStaticInitializers) { + const initializerStatement = factory.createExpressionStatement(initializer); + setSourceMapRange(initializerStatement, getSourceMapRange(initializer)); + trailingBlockStatements = append(trailingBlockStatements, initializerStatement); + } + classInfo.pendingStaticInitializers = undefined; } - // 12. Static fields are initialized and static blocks are evaluated - // 13. Class extra initializers are evaluated if (classInfo.classExtraInitializersName) { const runClassInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo.classExtraInitializersName); @@ -1097,20 +1143,18 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc // fields, we'll inject the `__runInitializers()` call for these extra initializers into the initializer of // the first class member that will be initialized. However, if the class does not contain any fields that // we can piggyback on, we need to synthesize a `__runInitializers()` call in the constructor instead. - if (classInfo.instanceExtraInitializersName && !classInfo.hasNonAmbientInstanceFields) { + if (some(classInfo.pendingInstanceInitializers)) { // If there are instance extra initializers we need to add them to the body along with any // field initializers const statements: Statement[] = []; statements.push( factory.createExpressionStatement( - emitHelpers().createRunInitializersHelper( - factory.createThis(), - classInfo.instanceExtraInitializersName, - ), + factory.inlineExpressions(classInfo.pendingInstanceInitializers), ), ); + classInfo.pendingInstanceInitializers = undefined; return statements; } } @@ -1199,6 +1243,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc let referencedName: Expression | undefined; let name: PropertyName | undefined; let initializersName: Identifier | undefined; + let extraInitializersName: Identifier | undefined; let thisArg: Identifier | undefined; let descriptorName: Identifier | undefined; if (!classInfo) { @@ -1281,24 +1326,25 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc metadata: classInfo.metadataReference, }; - const extraInitializers = isStatic(member) ? - classInfo.staticExtraInitializersName ??= factory.createUniqueName("_staticExtraInitializers", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel) : - classInfo.instanceExtraInitializersName ??= factory.createUniqueName("_instanceExtraInitializers", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); - if (isMethodOrAccessor(member)) { - // __esDecorate(this, null, _static_member_decorators, { kind: "method", name: "...", static: true, private: false, access: { ... } }, _staticExtraInitializers); - // __esDecorate(this, null, _member_decorators, { kind: "method", name: "...", static: false, private: false, access: { ... } }, _instanceExtraInitializers); - // __esDecorate(this, null, _static_member_decorators, { kind: "getter", name: "...", static: true, private: false, access: { ... } }, _staticExtraInitializers); - // __esDecorate(this, null, _member_decorators, { kind: "getter", name: "...", static: false, private: false, access: { ... } }, _instanceExtraInitializers); - // __esDecorate(this, null, _static_member_decorators, { kind: "setter", name: "...", static: true, private: false, access: { ... } }, _staticExtraInitializers); - // __esDecorate(this, null, _member_decorators, { kind: "setter", name: "...", static: false, private: false, access: { ... } }, _instanceExtraInitializers); - - // __esDecorate(this, _static_member_descriptor = { value() { ... } }, _static_member_decorators, { kind: "method", name: "...", static: true, private: true, access: { ... } }, _staticExtraInitializers); - // __esDecorate(this, _member_descriptor = { value() { ... } }, _member_decorators, { kind: "method", name: "...", static: false, private: true, access: { ... } }, _instanceExtraInitializers); - // __esDecorate(this, _static_member_descriptor = { get() { ... } }, _static_member_decorators, { kind: "getter", name: "...", static: true, private: true, access: { ... } }, _staticExtraInitializers); - // __esDecorate(this, _member_descriptor = { get() { ... } }, _member_decorators, { kind: "getter", name: "...", static: false, private: true, access: { ... } }, _instanceExtraInitializers); - // __esDecorate(this, _static_member_descriptor = { set() { ... } }, _static_member_decorators, { kind: "setter", name: "...", static: true, private: true, access: { ... } }, _staticExtraInitializers); - // __esDecorate(this, _member_descriptor = { set() { ... } }, _member_decorators, { kind: "setter", name: "...", static: false, private: true, access: { ... } }, _instanceExtraInitializers); + // produces (public elements): + // __esDecorate(this, null, _static_member_decorators, { kind: "method", name: "...", static: true, private: false, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, null, _member_decorators, { kind: "method", name: "...", static: false, private: false, access: { ... } }, _instanceExtraInitializers); + // __esDecorate(this, null, _static_member_decorators, { kind: "getter", name: "...", static: true, private: false, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, null, _member_decorators, { kind: "getter", name: "...", static: false, private: false, access: { ... } }, _instanceExtraInitializers); + // __esDecorate(this, null, _static_member_decorators, { kind: "setter", name: "...", static: true, private: false, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, null, _member_decorators, { kind: "setter", name: "...", static: false, private: false, access: { ... } }, _instanceExtraInitializers); + + // produces (private elements): + // __esDecorate(this, _static_member_descriptor = { value() { ... } }, _static_member_decorators, { kind: "method", name: "...", static: true, private: true, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, _member_descriptor = { value() { ... } }, _member_decorators, { kind: "method", name: "...", static: false, private: true, access: { ... } }, _instanceExtraInitializers); + // __esDecorate(this, _static_member_descriptor = { get() { ... } }, _static_member_decorators, { kind: "getter", name: "...", static: true, private: true, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, _member_descriptor = { get() { ... } }, _member_decorators, { kind: "getter", name: "...", static: false, private: true, access: { ... } }, _instanceExtraInitializers); + // __esDecorate(this, _static_member_descriptor = { set() { ... } }, _static_member_decorators, { kind: "setter", name: "...", static: true, private: true, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, _member_descriptor = { set() { ... } }, _member_decorators, { kind: "setter", name: "...", static: false, private: true, access: { ... } }, _instanceExtraInitializers); + + const methodExtraInitializersName = isStatic(member) ? classInfo.staticMethodExtraInitializersName : classInfo.instanceMethodExtraInitializersName; + Debug.assertIsDefined(methodExtraInitializersName); let descriptor: Expression | undefined; if (isPrivateIdentifierClassElementDeclaration(member) && createDescriptor) { @@ -1307,13 +1353,14 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc descriptor = factory.createAssignment(descriptorName, descriptor); } - const esDecorateExpression = emitHelpers().createESDecorateHelper(factory.createThis(), descriptor ?? factory.createNull(), memberDecoratorsName, context, factory.createNull(), extraInitializers); + const esDecorateExpression = emitHelpers().createESDecorateHelper(factory.createThis(), descriptor ?? factory.createNull(), memberDecoratorsName, context, factory.createNull(), methodExtraInitializersName); const esDecorateStatement = factory.createExpressionStatement(esDecorateExpression); setSourceMapRange(esDecorateStatement, moveRangePastDecorators(member)); statements.push(esDecorateStatement); } else if (isPropertyDeclaration(member)) { initializersName = memberInfo.memberInitializersName ??= createHelperVariable(member, "initializers"); + extraInitializersName = memberInfo.memberExtraInitializersName ??= createHelperVariable(member, "extraInitializers"); if (isStatic(member)) { thisArg = classInfo.classThis; @@ -1326,8 +1373,9 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc descriptor = factory.createAssignment(descriptorName, descriptor); } - // _static_field_initializers = __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "...", static: true, private: ..., access: { ... } }, _staticExtraInitializers); - // _field_initializers = __esDecorate(null, null, _member_decorators, { kind: "field", name: "...", static: false, private: ..., access: { ... } }, _instanceExtraInitializers); + // produces: + // _static_field_initializers = __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "...", static: true, private: ..., access: { ... } }, _staticExtraInitializers); + // _field_initializers = __esDecorate(null, null, _member_decorators, { kind: "field", name: "...", static: false, private: ..., access: { ... } }, _instanceExtraInitializers); const esDecorateExpression = emitHelpers().createESDecorateHelper( isAutoAccessorPropertyDeclaration(member) ? factory.createThis() : @@ -1336,7 +1384,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc memberDecoratorsName, context, initializersName, - extraInitializers, + extraInitializersName, ); const esDecorateStatement = factory.createExpressionStatement(esDecorateExpression); setSourceMapRange(esDecorateStatement, moveRangePastDecorators(member)); @@ -1356,7 +1404,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc setEmitFlags(name, EmitFlags.NoLeadingComments); } - return { modifiers, referencedName, name, initializersName, descriptorName, thisArg }; + return { modifiers, referencedName, name, initializersName, extraInitializersName, descriptorName, thisArg }; } function visitMethodDeclaration(node: MethodDeclaration) { @@ -1404,10 +1452,10 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc } } - function visitClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration) { + function visitClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration): VisitResult { enterClassElement(node); - let result: ClassStaticBlockDeclaration; + let result: VisitResult; if (isClassNamedEvaluationHelperBlock(node)) { result = visitEachChild(node, visitor, context); } @@ -1418,8 +1466,26 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc classThis = savedClassThis; } else { - if (classInfo) classInfo.hasStaticInitializers = true; - result = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context); + result = node; + if (classInfo) { + classInfo.hasStaticInitializers = true; + if (some(classInfo.pendingStaticInitializers)) { + // If we tried to inject the pending initializers into the current block, we might run into + // variable name collisions due to sharing this blocks scope. To avoid this, we inject a new + // static block that contains the pending initializers that precedes this block. + const statements: Statement[] = []; + for (const initializer of classInfo.pendingStaticInitializers) { + const initializerStatement = factory.createExpressionStatement(initializer); + setSourceMapRange(initializerStatement, getSourceMapRange(initializer)); + statements.push(initializerStatement); + } + const body = factory.createBlock(statements, /*multiLine*/ true); + const staticBlock = factory.createClassStaticBlockDeclaration(body); + result = [staticBlock, result]; + classInfo.pendingStaticInitializers = undefined; + } + } } exitClassElement(); @@ -1445,7 +1511,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc // a. Let _value_ be ? NamedEvaluation of |Initializer| with argument _functionObject_.[[ClassFieldInitializerName]]. // ... - const { modifiers, name, initializersName, descriptorName, thisArg } = partialTransformClassElement(node, classInfo, hasAccessorModifier(node) ? createAccessorPropertyDescriptorObject : undefined); + const { modifiers, name, initializersName, extraInitializersName, descriptorName, thisArg } = partialTransformClassElement(node, classInfo, hasAccessorModifier(node) ? createAccessorPropertyDescriptorObject : undefined); startLexicalEnvironment(); @@ -1458,19 +1524,6 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc ); } - if (!isStatic(node) && classInfo?.instanceExtraInitializersName && !classInfo?.hasInjectedInstanceInitializers) { - // for the first non-static field initializer, inject a call to `__runInitializers`. - classInfo.hasInjectedInstanceInitializers = true; - initializer ??= factory.createVoidZero(); - initializer = factory.createParenthesizedExpression(factory.createComma( - emitHelpers().createRunInitializersHelper( - factory.createThis(), - classInfo.instanceExtraInitializersName, - ), - initializer, - )); - } - if (isStatic(node) && classInfo && initializer) { classInfo.hasStaticInitializers = true; } @@ -1483,6 +1536,33 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc ]); } + if (classInfo) { + if (isStatic(node)) { + initializer = injectPendingInitializers(classInfo, /*isStatic*/ true, initializer); + if (extraInitializersName) { + classInfo.pendingStaticInitializers ??= []; + classInfo.pendingStaticInitializers.push( + emitHelpers().createRunInitializersHelper( + classInfo.classThis ?? factory.createThis(), + extraInitializersName, + ), + ); + } + } + else { + initializer = injectPendingInitializers(classInfo, /*isStatic*/ false, initializer); + if (extraInitializersName) { + classInfo.pendingInstanceInitializers ??= []; + classInfo.pendingInstanceInitializers.push( + emitHelpers().createRunInitializersHelper( + factory.createThis(), + extraInitializersName, + ), + ); + } + } + } + exitClassElement(); if (hasAccessorModifier(node) && descriptorName) { @@ -2116,21 +2196,47 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc return factory.updatePartiallyEmittedExpression(node, expression); } - function injectPendingExpressions(expression: Expression) { + function injectPendingExpressionsCommon(pendingExpressions: Expression[] | undefined, expression: Expression | undefined) { if (some(pendingExpressions)) { - if (isParenthesizedExpression(expression)) { - pendingExpressions.push(expression.expression); - expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(pendingExpressions)); + if (expression) { + if (isParenthesizedExpression(expression)) { + pendingExpressions.push(expression.expression); + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(pendingExpressions)); + } + else { + pendingExpressions.push(expression); + expression = factory.inlineExpressions(pendingExpressions); + } } else { - pendingExpressions.push(expression); expression = factory.inlineExpressions(pendingExpressions); } - pendingExpressions = undefined; } return expression; } + function injectPendingExpressions(expression: Expression) { + const result = injectPendingExpressionsCommon(pendingExpressions, expression); + Debug.assertIsDefined(result); + if (result !== expression) { + pendingExpressions = undefined; + } + return result; + } + + function injectPendingInitializers(classInfo: ClassInfo, isStatic: boolean, expression: Expression | undefined) { + const result = injectPendingExpressionsCommon(isStatic ? classInfo.pendingStaticInitializers : classInfo.pendingInstanceInitializers, expression); + if (result !== expression) { + if (isStatic) { + classInfo.pendingStaticInitializers = undefined; + } + else { + classInfo.pendingInstanceInitializers = undefined; + } + } + return result; + } + /** * Transforms all of the decorators for a declaration into an array of expressions. * diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b55a308e91f65..23873de4824a8 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -916,6 +916,7 @@ export const enum JsxFlags { // dprint-ignore /** @internal */ export const enum RelationComparisonResult { + None = 0, Succeeded = 1 << 0, // Should be truthy Failed = 1 << 1, Reported = 1 << 2, @@ -5158,7 +5159,20 @@ export interface TypeChecker { /** @internal */ getPromiseLikeType(): Type; /** @internal */ getAsyncIterableType(): Type | undefined; - /** @internal */ isTypeAssignableTo(source: Type, target: Type): boolean; + /** + * Returns true if the "source" type is assignable to the "target" type. + * + * ```ts + * declare const abcLiteral: ts.Type; // Type of "abc" + * declare const stringType: ts.Type; // Type of string + * + * isTypeAssignableTo(abcLiteral, abcLiteral); // true; "abc" is assignable to "abc" + * isTypeAssignableTo(abcLiteral, stringType); // true; "abc" is assignable to string + * isTypeAssignableTo(stringType, abcLiteral); // false; string is not assignable to "abc" + * isTypeAssignableTo(stringType, stringType); // true; string is assignable to string + * ``` + */ + isTypeAssignableTo(source: Type, target: Type): boolean; /** @internal */ createAnonymousType(symbol: Symbol | undefined, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], indexInfos: IndexInfo[]): Type; /** @internal */ createSignature( declaration: SignatureDeclaration | undefined, @@ -5578,6 +5592,7 @@ export type LateVisibilityPaintedStatement = /** @internal */ export interface SymbolVisibilityResult { accessibility: SymbolAccessibility; + bindingElementToMakeVisible?: BindingElement; aliasesToMakeVisible?: LateVisibilityPaintedStatement[]; // aliases that need to have this symbol visible errorSymbolName?: string; // Optional symbol name that results in error errorNode?: Node; // optional node that results in error @@ -5810,8 +5825,8 @@ export interface Symbol { /** @internal */ exportSymbol?: Symbol; // Exported symbol associated with this symbol /** @internal */ constEnumOnlyModule: boolean | undefined; // True if module contains only const enums or other modules with only const enums /** @internal */ isReferenced?: SymbolFlags; // True if the symbol is referenced elsewhere. Keeps track of the meaning of a reference in case a symbol is both a type parameter and parameter. + /** @internal */ lastAssignmentPos?: number; // Source position of last node that assigns value to symbol /** @internal */ isReplaceableByMethod?: boolean; // Can this Javascript class property be replaced by a method symbol? - /** @internal */ isAssigned?: boolean; // True if the symbol is a parameter with assignments /** @internal */ assignmentDeclarationMembers?: Map; // detected late-bound assignment declarations associated with the symbol } @@ -9675,6 +9690,7 @@ export interface ModuleSpecifierResolutionHost { getProjectReferenceRedirect(fileName: string): string | undefined; isSourceOfProjectReferenceRedirect(fileName: string): boolean; getFileIncludeReasons(): MultiMap; + getCommonSourceDirectory(): string; } /** @internal */ @@ -10058,6 +10074,7 @@ export interface UserPreferences { readonly organizeImportsNumericCollation?: boolean; readonly organizeImportsAccentCollation?: boolean; readonly organizeImportsCaseFirst?: "upper" | "lower" | false; + readonly organizeImportsTypeOrder?: "first" | "last" | "inline"; readonly excludeLibrarySymbolsInNavTo?: boolean; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 68a538d7b9804..36fb67860a32b 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -282,6 +282,7 @@ import { isJSDoc, isJSDocAugmentsTag, isJSDocFunctionType, + isJSDocImplementsTag, isJSDocLinkLike, isJSDocMemberName, isJSDocNameReference, @@ -2452,7 +2453,7 @@ export function isPartOfTypeNode(node: Node): boolean { case SyntaxKind.VoidKeyword: return node.parent.kind !== SyntaxKind.VoidExpression; case SyntaxKind.ExpressionWithTypeArguments: - return isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); + return isPartOfTypeExpressionWithTypeArguments(node); case SyntaxKind.TypeParameter: return node.parent.kind === SyntaxKind.MappedType || node.parent.kind === SyntaxKind.InferType; @@ -2491,7 +2492,7 @@ export function isPartOfTypeNode(node: Node): boolean { } switch (parent.kind) { case SyntaxKind.ExpressionWithTypeArguments: - return isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); + return isPartOfTypeExpressionWithTypeArguments(parent); case SyntaxKind.TypeParameter: return node === (parent as TypeParameterDeclaration).constraint; case SyntaxKind.JSDocTemplateTag: @@ -2527,6 +2528,12 @@ export function isPartOfTypeNode(node: Node): boolean { return false; } +function isPartOfTypeExpressionWithTypeArguments(node: Node) { + return isJSDocImplementsTag(node.parent) + || isJSDocAugmentsTag(node.parent) + || isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); +} + /** @internal */ export function isChildOfNodeWithKind(node: Node, kind: SyntaxKind): boolean { while (node) { @@ -7484,6 +7491,16 @@ export function readJson(path: string, host: { readFile(fileName: string): strin return readJsonOrUndefined(path, host) || {}; } +/** @internal */ +export function tryParseJson(text: string) { + try { + return JSON.parse(text); + } + catch { + return undefined; + } +} + /** @internal */ export function directoryProbablyExists(directoryName: string, host: { directoryExists?: (directoryName: string) => boolean; }): boolean { // if host does not support 'directoryExists' assume that directory will exist @@ -8168,7 +8185,7 @@ function Symbol(this: Symbol, flags: SymbolFlags, name: __String) { this.exportSymbol = undefined; this.constEnumOnlyModule = undefined; this.isReferenced = undefined; - this.isAssigned = undefined; + this.lastAssignmentPos = undefined; (this as any).links = undefined; // used by TransientSymbol } @@ -8587,52 +8604,270 @@ export function getSetExternalModuleIndicator(options: CompilerOptions): (file: } } -/** @internal */ -export function getEmitScriptTarget(compilerOptions: { module?: CompilerOptions["module"]; target?: CompilerOptions["target"]; }): ScriptTarget { - return compilerOptions.target ?? - ((compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) || - (compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) || - ScriptTarget.ES5); +type CompilerOptionKeys = keyof { [K in keyof CompilerOptions as string extends K ? never : K]: any; }; +function createComputedCompilerOptions>( + options: { + [K in keyof T & CompilerOptionKeys | StrictOptionName]: { + dependencies: T[K]; + computeValue: (compilerOptions: Pick) => Exclude; + }; + }, +) { + return options; } /** @internal */ -export function getEmitModuleKind(compilerOptions: { module?: CompilerOptions["module"]; target?: CompilerOptions["target"]; }) { - return typeof compilerOptions.module === "number" ? - compilerOptions.module : - getEmitScriptTarget(compilerOptions) >= ScriptTarget.ES2015 ? ModuleKind.ES2015 : ModuleKind.CommonJS; -} +export const computedOptions = createComputedCompilerOptions({ + target: { + dependencies: ["module"], + computeValue: compilerOptions => { + return compilerOptions.target ?? + ((compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) || + (compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) || + ScriptTarget.ES5); + }, + }, + module: { + dependencies: ["target"], + computeValue: (compilerOptions): ModuleKind => { + return typeof compilerOptions.module === "number" ? + compilerOptions.module : + computedOptions.target.computeValue(compilerOptions) >= ScriptTarget.ES2015 ? ModuleKind.ES2015 : ModuleKind.CommonJS; + }, + }, + moduleResolution: { + dependencies: ["module", "target"], + computeValue: (compilerOptions): ModuleResolutionKind => { + let moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + switch (computedOptions.module.computeValue(compilerOptions)) { + case ModuleKind.CommonJS: + moduleResolution = ModuleResolutionKind.Node10; + break; + case ModuleKind.Node16: + moduleResolution = ModuleResolutionKind.Node16; + break; + case ModuleKind.NodeNext: + moduleResolution = ModuleResolutionKind.NodeNext; + break; + default: + moduleResolution = ModuleResolutionKind.Classic; + break; + } + } + return moduleResolution; + }, + }, + moduleDetection: { + dependencies: ["module", "target"], + computeValue: (compilerOptions): ModuleDetectionKind => { + return compilerOptions.moduleDetection || + (computedOptions.module.computeValue(compilerOptions) === ModuleKind.Node16 || + computedOptions.module.computeValue(compilerOptions) === ModuleKind.NodeNext ? ModuleDetectionKind.Force : ModuleDetectionKind.Auto); + }, + }, + isolatedModules: { + dependencies: ["verbatimModuleSyntax"], + computeValue: compilerOptions => { + return !!(compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax); + }, + }, + esModuleInterop: { + dependencies: ["module", "target"], + computeValue: (compilerOptions): boolean => { + if (compilerOptions.esModuleInterop !== undefined) { + return compilerOptions.esModuleInterop; + } + switch (computedOptions.module.computeValue(compilerOptions)) { + case ModuleKind.Node16: + case ModuleKind.NodeNext: + return true; + } + return false; + }, + }, + allowSyntheticDefaultImports: { + dependencies: ["module", "target", "moduleResolution"], + computeValue: (compilerOptions): boolean => { + if (compilerOptions.allowSyntheticDefaultImports !== undefined) { + return compilerOptions.allowSyntheticDefaultImports; + } + return computedOptions.esModuleInterop.computeValue(compilerOptions) + || computedOptions.module.computeValue(compilerOptions) === ModuleKind.System + || computedOptions.moduleResolution.computeValue(compilerOptions) === ModuleResolutionKind.Bundler; + }, + }, + resolvePackageJsonExports: { + dependencies: ["moduleResolution"], + computeValue: (compilerOptions): boolean => { + const moduleResolution = computedOptions.moduleResolution.computeValue(compilerOptions); + if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { + return false; + } + if (compilerOptions.resolvePackageJsonExports !== undefined) { + return compilerOptions.resolvePackageJsonExports; + } + switch (moduleResolution) { + case ModuleResolutionKind.Node16: + case ModuleResolutionKind.NodeNext: + case ModuleResolutionKind.Bundler: + return true; + } + return false; + }, + }, + resolvePackageJsonImports: { + dependencies: ["moduleResolution", "resolvePackageJsonExports"], + computeValue: (compilerOptions): boolean => { + const moduleResolution = computedOptions.moduleResolution.computeValue(compilerOptions); + if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { + return false; + } + if (compilerOptions.resolvePackageJsonExports !== undefined) { + return compilerOptions.resolvePackageJsonExports; + } + switch (moduleResolution) { + case ModuleResolutionKind.Node16: + case ModuleResolutionKind.NodeNext: + case ModuleResolutionKind.Bundler: + return true; + } + return false; + }, + }, + resolveJsonModule: { + dependencies: ["moduleResolution", "module", "target"], + computeValue: (compilerOptions): boolean => { + if (compilerOptions.resolveJsonModule !== undefined) { + return compilerOptions.resolveJsonModule; + } + return computedOptions.moduleResolution.computeValue(compilerOptions) === ModuleResolutionKind.Bundler; + }, + }, + declaration: { + dependencies: ["composite"], + computeValue: compilerOptions => { + return !!(compilerOptions.declaration || compilerOptions.composite); + }, + }, + preserveConstEnums: { + dependencies: ["isolatedModules", "verbatimModuleSyntax"], + computeValue: (compilerOptions): boolean => { + return !!(compilerOptions.preserveConstEnums || computedOptions.isolatedModules.computeValue(compilerOptions)); + }, + }, + incremental: { + dependencies: ["composite"], + computeValue: compilerOptions => { + return !!(compilerOptions.incremental || compilerOptions.composite); + }, + }, + declarationMap: { + dependencies: ["declaration", "composite"], + computeValue: (compilerOptions): boolean => { + return !!(compilerOptions.declarationMap && computedOptions.declaration.computeValue(compilerOptions)); + }, + }, + allowJs: { + dependencies: ["checkJs"], + computeValue: compilerOptions => { + return compilerOptions.allowJs === undefined ? !!compilerOptions.checkJs : compilerOptions.allowJs; + }, + }, + useDefineForClassFields: { + dependencies: ["target", "module"], + computeValue: (compilerOptions): boolean => { + return compilerOptions.useDefineForClassFields === undefined + ? computedOptions.target.computeValue(compilerOptions) >= ScriptTarget.ES2022 + : compilerOptions.useDefineForClassFields; + }, + }, + noImplicitAny: { + dependencies: ["strict"], + computeValue: compilerOptions => { + return getStrictOptionValue(compilerOptions, "noImplicitAny"); + }, + }, + noImplicitThis: { + dependencies: ["strict"], + computeValue: compilerOptions => { + return getStrictOptionValue(compilerOptions, "noImplicitThis"); + }, + }, + strictNullChecks: { + dependencies: ["strict"], + computeValue: compilerOptions => { + return getStrictOptionValue(compilerOptions, "strictNullChecks"); + }, + }, + strictFunctionTypes: { + dependencies: ["strict"], + computeValue: compilerOptions => { + return getStrictOptionValue(compilerOptions, "strictFunctionTypes"); + }, + }, + strictBindCallApply: { + dependencies: ["strict"], + computeValue: compilerOptions => { + return getStrictOptionValue(compilerOptions, "strictBindCallApply"); + }, + }, + strictPropertyInitialization: { + dependencies: ["strict"], + computeValue: compilerOptions => { + return getStrictOptionValue(compilerOptions, "strictPropertyInitialization"); + }, + }, + alwaysStrict: { + dependencies: ["strict"], + computeValue: compilerOptions => { + return getStrictOptionValue(compilerOptions, "alwaysStrict"); + }, + }, + useUnknownInCatchVariables: { + dependencies: ["strict"], + computeValue: compilerOptions => { + return getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables"); + }, + }, +}); /** @internal */ -export function emitModuleKindIsNonNodeESM(moduleKind: ModuleKind) { - return moduleKind >= ModuleKind.ES2015 && moduleKind <= ModuleKind.ESNext; -} - +export const getEmitScriptTarget = computedOptions.target.computeValue; /** @internal */ -export function getEmitModuleResolutionKind(compilerOptions: CompilerOptions) { - let moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - switch (getEmitModuleKind(compilerOptions)) { - case ModuleKind.CommonJS: - moduleResolution = ModuleResolutionKind.Node10; - break; - case ModuleKind.Node16: - moduleResolution = ModuleResolutionKind.Node16; - break; - case ModuleKind.NodeNext: - moduleResolution = ModuleResolutionKind.NodeNext; - break; - default: - moduleResolution = ModuleResolutionKind.Classic; - break; - } - } - return moduleResolution; -} +export const getEmitModuleKind = computedOptions.module.computeValue; +/** @internal */ +export const getEmitModuleResolutionKind = computedOptions.moduleResolution.computeValue; +/** @internal */ +export const getEmitModuleDetectionKind = computedOptions.moduleDetection.computeValue; +/** @internal */ +export const getIsolatedModules = computedOptions.isolatedModules.computeValue; +/** @internal */ +export const getESModuleInterop = computedOptions.esModuleInterop.computeValue; +/** @internal */ +export const getAllowSyntheticDefaultImports = computedOptions.allowSyntheticDefaultImports.computeValue; +/** @internal */ +export const getResolvePackageJsonExports = computedOptions.resolvePackageJsonExports.computeValue; +/** @internal */ +export const getResolvePackageJsonImports = computedOptions.resolvePackageJsonImports.computeValue; +/** @internal */ +export const getResolveJsonModule = computedOptions.resolveJsonModule.computeValue; +/** @internal */ +export const getEmitDeclarations = computedOptions.declaration.computeValue; +/** @internal */ +export const shouldPreserveConstEnums = computedOptions.preserveConstEnums.computeValue; +/** @internal */ +export const isIncrementalCompilation = computedOptions.incremental.computeValue; +/** @internal */ +export const getAreDeclarationMapsEnabled = computedOptions.declarationMap.computeValue; +/** @internal */ +export const getAllowJSCompilerOption = computedOptions.allowJs.computeValue; +/** @internal */ +export const getUseDefineForClassFields = computedOptions.useDefineForClassFields.computeValue; /** @internal */ -export function getEmitModuleDetectionKind(options: CompilerOptions) { - return options.moduleDetection || - (getEmitModuleKind(options) === ModuleKind.Node16 || getEmitModuleKind(options) === ModuleKind.NodeNext ? ModuleDetectionKind.Force : ModuleDetectionKind.Auto); +export function emitModuleKindIsNonNodeESM(moduleKind: ModuleKind) { + return moduleKind >= ModuleKind.ES2015 && moduleKind <= ModuleKind.ESNext; } /** @internal */ @@ -8652,11 +8887,6 @@ export function hasJsonModuleEmitEnabled(options: CompilerOptions) { } } -/** @internal */ -export function getIsolatedModules(options: CompilerOptions) { - return !!(options.isolatedModules || options.verbatimModuleSyntax); -} - /** @internal */ export function importNameElisionDisabled(options: CompilerOptions) { return options.verbatimModuleSyntax || options.isolatedModules && options.preserveValueImports; @@ -8672,34 +8902,6 @@ export function unusedLabelIsError(options: CompilerOptions): boolean { return options.allowUnusedLabels === false; } -/** @internal */ -export function getAreDeclarationMapsEnabled(options: CompilerOptions) { - return !!(getEmitDeclarations(options) && options.declarationMap); -} - -/** @internal */ -export function getESModuleInterop(compilerOptions: CompilerOptions) { - if (compilerOptions.esModuleInterop !== undefined) { - return compilerOptions.esModuleInterop; - } - switch (getEmitModuleKind(compilerOptions)) { - case ModuleKind.Node16: - case ModuleKind.NodeNext: - return true; - } - return undefined; -} - -/** @internal */ -export function getAllowSyntheticDefaultImports(compilerOptions: CompilerOptions) { - if (compilerOptions.allowSyntheticDefaultImports !== undefined) { - return compilerOptions.allowSyntheticDefaultImports; - } - return getESModuleInterop(compilerOptions) - || getEmitModuleKind(compilerOptions) === ModuleKind.System - || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Bundler; -} - /** @internal */ export function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution: ModuleResolutionKind): boolean { return moduleResolution >= ModuleResolutionKind.Node16 && moduleResolution <= ModuleResolutionKind.NodeNext @@ -8712,65 +8914,6 @@ export function shouldResolveJsRequire(compilerOptions: CompilerOptions): boolea return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Bundler; } -/** @internal */ -export function getResolvePackageJsonExports(compilerOptions: CompilerOptions) { - const moduleResolution = getEmitModuleResolutionKind(compilerOptions); - if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { - return false; - } - if (compilerOptions.resolvePackageJsonExports !== undefined) { - return compilerOptions.resolvePackageJsonExports; - } - switch (moduleResolution) { - case ModuleResolutionKind.Node16: - case ModuleResolutionKind.NodeNext: - case ModuleResolutionKind.Bundler: - return true; - } - return false; -} - -/** @internal */ -export function getResolvePackageJsonImports(compilerOptions: CompilerOptions) { - const moduleResolution = getEmitModuleResolutionKind(compilerOptions); - if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { - return false; - } - if (compilerOptions.resolvePackageJsonExports !== undefined) { - return compilerOptions.resolvePackageJsonExports; - } - switch (moduleResolution) { - case ModuleResolutionKind.Node16: - case ModuleResolutionKind.NodeNext: - case ModuleResolutionKind.Bundler: - return true; - } - return false; -} - -/** @internal */ -export function getResolveJsonModule(compilerOptions: CompilerOptions) { - if (compilerOptions.resolveJsonModule !== undefined) { - return compilerOptions.resolveJsonModule; - } - return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Bundler; -} - -/** @internal */ -export function getEmitDeclarations(compilerOptions: CompilerOptions): boolean { - return !!(compilerOptions.declaration || compilerOptions.composite); -} - -/** @internal */ -export function shouldPreserveConstEnums(compilerOptions: CompilerOptions): boolean { - return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions)); -} - -/** @internal */ -export function isIncrementalCompilation(options: CompilerOptions) { - return !!(options.incremental || options.composite); -} - /** @internal */ export type StrictOptionName = | "noImplicitAny" @@ -8787,16 +8930,6 @@ export function getStrictOptionValue(compilerOptions: CompilerOptions, flag: Str return compilerOptions[flag] === undefined ? !!compilerOptions.strict : !!compilerOptions[flag]; } -/** @internal */ -export function getAllowJSCompilerOption(compilerOptions: CompilerOptions): boolean { - return compilerOptions.allowJs === undefined ? !!compilerOptions.checkJs : compilerOptions.allowJs; -} - -/** @internal */ -export function getUseDefineForClassFields(compilerOptions: CompilerOptions): boolean { - return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) >= ScriptTarget.ES2022 : compilerOptions.useDefineForClassFields; -} - /** @internal */ export function getEmitStandardClassFields(compilerOptions: CompilerOptions) { return compilerOptions.useDefineForClassFields !== false && getEmitScriptTarget(compilerOptions) >= ScriptTarget.ES2022; @@ -10225,12 +10358,6 @@ export function isCatchClauseVariableDeclaration(node: Node) { return node.kind === SyntaxKind.VariableDeclaration && node.parent.kind === SyntaxKind.CatchClause; } -/** @internal */ -export function isParameterOrCatchClauseVariable(symbol: Symbol) { - const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration); - return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration)); -} - /** @internal */ export function isFunctionExpressionOrArrowFunction(node: Node): node is FunctionExpression | ArrowFunction { return node.kind === SyntaxKind.FunctionExpression || node.kind === SyntaxKind.ArrowFunction; diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 5763b24c6bde6..2842fd6896a5f 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -3521,10 +3521,12 @@ export class TestState { actualTextArray.push(text); // Undo changes to perform next fix - const span = change.textChanges[0].span; - const deletedText = originalContent.substr(span.start, change.textChanges[0].span.length); - const insertedText = change.textChanges[0].newText; - this.editScriptAndUpdateMarkers(fileName, span.start, span.start + insertedText.length, deletedText); + for (const textChange of change.textChanges) { + const span = textChange.span; + const deletedText = originalContent.slice(span.start, span.start + textChange.span.length); + const insertedText = textChange.newText; + this.editScriptAndUpdateMarkers(fileName, span.start, span.start + insertedText.length, deletedText); + } } if (expectedTextArray.length !== actualTextArray.length) { this.raiseError(`Expected ${expectedTextArray.length} import fixes, got ${actualTextArray.length}:\n\n${actualTextArray.join("\n\n" + "-".repeat(20) + "\n\n")}`); diff --git a/src/lib/dom.asynciterable.generated.d.ts b/src/lib/dom.asynciterable.generated.d.ts new file mode 100644 index 0000000000000..79f37534e6f5f --- /dev/null +++ b/src/lib/dom.asynciterable.generated.d.ts @@ -0,0 +1,10 @@ +///////////////////////////// +/// Window Async Iterable APIs +///////////////////////////// + +interface FileSystemDirectoryHandle { + [Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>; + entries(): AsyncIterableIterator<[string, FileSystemHandle]>; + keys(): AsyncIterableIterator; + values(): AsyncIterableIterator; +} diff --git a/src/lib/es2016.intl.d.ts b/src/lib/es2016.intl.d.ts index 38736a22e6b2d..67f478bb4eca8 100644 --- a/src/lib/es2016.intl.d.ts +++ b/src/lib/es2016.intl.d.ts @@ -9,5 +9,5 @@ declare namespace Intl { * @param locale A list of String values for which to get the canonical locale names * @returns An array containing the canonical and validated locale names. */ - function getCanonicalLocales(locale?: string | string[]): string[]; + function getCanonicalLocales(locale?: string | readonly string[]): string[]; } diff --git a/src/lib/es2018.full.d.ts b/src/lib/es2018.full.d.ts index e887270b82a2d..d62163124ea08 100644 --- a/src/lib/es2018.full.d.ts +++ b/src/lib/es2018.full.d.ts @@ -3,3 +3,4 @@ /// /// /// +/// diff --git a/src/lib/es2018.intl.d.ts b/src/lib/es2018.intl.d.ts index 8e0a27fe965d4..ee58de50e5c37 100644 --- a/src/lib/es2018.intl.d.ts +++ b/src/lib/es2018.intl.d.ts @@ -30,9 +30,9 @@ declare namespace Intl { } interface PluralRulesConstructor { - new (locales?: string | string[], options?: PluralRulesOptions): PluralRules; - (locales?: string | string[], options?: PluralRulesOptions): PluralRules; - supportedLocalesOf(locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; + new (locales?: string | readonly string[], options?: PluralRulesOptions): PluralRules; + (locales?: string | readonly string[], options?: PluralRulesOptions): PluralRules; + supportedLocalesOf(locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } const PluralRules: PluralRulesConstructor; diff --git a/src/lib/es2019.full.d.ts b/src/lib/es2019.full.d.ts index 2056578133ee8..64a0743f3ed5b 100644 --- a/src/lib/es2019.full.d.ts +++ b/src/lib/es2019.full.d.ts @@ -3,3 +3,4 @@ /// /// /// +/// diff --git a/src/lib/es2020.full.d.ts b/src/lib/es2020.full.d.ts index 0d4b6d45d55ad..713b0e0ac6699 100644 --- a/src/lib/es2020.full.d.ts +++ b/src/lib/es2020.full.d.ts @@ -3,3 +3,4 @@ /// /// /// +/// diff --git a/src/lib/es2021.full.d.ts b/src/lib/es2021.full.d.ts index c62d63ca7a13d..e0161df432c89 100644 --- a/src/lib/es2021.full.d.ts +++ b/src/lib/es2021.full.d.ts @@ -3,3 +3,4 @@ /// /// /// +/// diff --git a/src/lib/es2022.full.d.ts b/src/lib/es2022.full.d.ts index f7a8fdc84c167..25a823330e57a 100644 --- a/src/lib/es2022.full.d.ts +++ b/src/lib/es2022.full.d.ts @@ -3,3 +3,4 @@ /// /// /// +/// diff --git a/src/lib/es2023.full.d.ts b/src/lib/es2023.full.d.ts index f4246d530ee1f..1feb80a78d5f6 100644 --- a/src/lib/es2023.full.d.ts +++ b/src/lib/es2023.full.d.ts @@ -3,3 +3,4 @@ /// /// /// +/// diff --git a/src/lib/esnext.full.d.ts b/src/lib/esnext.full.d.ts index 70fc982b908bc..59df22c246efc 100644 --- a/src/lib/esnext.full.d.ts +++ b/src/lib/esnext.full.d.ts @@ -3,3 +3,4 @@ /// /// /// +/// diff --git a/src/lib/libs.json b/src/lib/libs.json index 0c7fd7d53e777..cde5256e8e573 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -15,9 +15,11 @@ // Host only "dom.generated", "dom.iterable.generated", + "dom.asynciterable.generated", "webworker.generated", "webworker.importscripts", "webworker.iterable.generated", + "webworker.asynciterable.generated", "scripthost", // By-feature options "es2015.core", @@ -90,8 +92,10 @@ "paths": { "dom.generated": "lib.dom.d.ts", "dom.iterable.generated": "lib.dom.iterable.d.ts", + "dom.asynciterable.generated": "lib.dom.asynciterable.d.ts", "webworker.generated": "lib.webworker.d.ts", "webworker.iterable.generated": "lib.webworker.iterable.d.ts", + "webworker.asynciterable.generated": "lib.webworker.asynciterable.d.ts", "es5.full": "lib.d.ts", "es2015.full": "lib.es6.d.ts" } diff --git a/src/lib/webworker.asynciterable.generated.d.ts b/src/lib/webworker.asynciterable.generated.d.ts new file mode 100644 index 0000000000000..7e5318ee9de25 --- /dev/null +++ b/src/lib/webworker.asynciterable.generated.d.ts @@ -0,0 +1,10 @@ +///////////////////////////// +/// Worker Async Iterable APIs +///////////////////////////// + +interface FileSystemDirectoryHandle { + [Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>; + entries(): AsyncIterableIterator<[string, FileSystemHandle]>; + keys(): AsyncIterableIterator; + values(): AsyncIterableIterator; +} diff --git a/src/server/protocol.ts b/src/server/protocol.ts index daa1738650b29..e0964cea6d9d6 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1336,6 +1336,7 @@ export interface RenameInfoSuccess { /** * Full display name of item to be renamed. + * If item to be renamed is a file, then this is the original text of the module specifer */ fullDisplayName: string; @@ -3642,6 +3643,13 @@ export interface UserPreferences { * Default: `false` */ readonly organizeImportsCaseFirst?: "upper" | "lower" | false; + /** + * Indicates where named type-only imports should sort. "inline" sorts named imports without regard to if the import is + * type-only. + * + * Default: `last` + */ + readonly organizeImportsTypeOrder?: "last" | "first" | "inline"; /** * Indicates whether {@link ReferencesResponseItem.lineText} is supported. diff --git a/src/services/callHierarchy.ts b/src/services/callHierarchy.ts index aa8373081f984..6b354cbde9d73 100644 --- a/src/services/callHierarchy.ts +++ b/src/services/callHierarchy.ts @@ -91,6 +91,7 @@ import { ParameterDeclaration, Program, PropertyAccessExpression, + PropertyDeclaration, SatisfiesExpression, SetAccessorDeclaration, skipTrivia, @@ -117,18 +118,27 @@ function isNamedExpression(node: Node): node is NamedExpression { } /** @internal */ -export type ConstNamedExpression = - | ClassExpression & { name: undefined; parent: VariableDeclaration & { name: Identifier; }; } - | FunctionExpression & { name: undefined; parent: VariableDeclaration & { name: Identifier; }; } - | ArrowFunction & { name: undefined; parent: VariableDeclaration & { name: Identifier; }; }; +export type VariableLike = + | VariableDeclaration + | PropertyDeclaration; -/** Indicates whether a node is a function, arrow, or class expression assigned to a constant variable. */ -function isConstNamedExpression(node: Node): node is ConstNamedExpression { +function isVariableLike(node: Node): node is VariableLike { + return isPropertyDeclaration(node) || isVariableDeclaration(node); +} + +/** @internal */ +export type AssignedExpression = + | ClassExpression & { name: undefined; parent: VariableLike & { name: Identifier; }; } + | FunctionExpression & { name: undefined; parent: VariableLike & { name: Identifier; }; } + | ArrowFunction & { name: undefined; parent: VariableLike & { name: Identifier; }; }; + +/** Indicates whether a node is a function, arrow, or class expression assigned to a constant variable or class property. */ +function isAssignedExpression(node: Node): node is AssignedExpression { return (isFunctionExpression(node) || isArrowFunction(node) || isClassExpression(node)) - && isVariableDeclaration(node.parent) + && isVariableLike(node.parent) && node === node.parent.initializer && isIdentifier(node.parent.name) - && !!(getCombinedNodeFlags(node.parent) & NodeFlags.Const); + && (!!(getCombinedNodeFlags(node.parent) & NodeFlags.Const) || isPropertyDeclaration(node.parent)); } /** @internal */ @@ -142,7 +152,7 @@ export type CallHierarchyDeclaration = | GetAccessorDeclaration | SetAccessorDeclaration | NamedExpression - | ConstNamedExpression; + | AssignedExpression; /** * Indicates whether a node could possibly be a call hierarchy declaration. @@ -179,14 +189,14 @@ function isValidCallHierarchyDeclaration(node: Node): node is CallHierarchyDecla || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node) || isNamedExpression(node) - || isConstNamedExpression(node); + || isAssignedExpression(node); } /** Gets the node that can be used as a reference to a call hierarchy declaration. */ function getCallHierarchyDeclarationReferenceNode(node: Exclude) { if (isSourceFile(node)) return node; if (isNamedDeclaration(node)) return node.name; - if (isConstNamedExpression(node)) return node.parent.name; + if (isAssignedExpression(node)) return node.parent.name; return Debug.checkDefined(node.modifiers && find(node.modifiers, isDefaultModifier)); } @@ -223,7 +233,7 @@ function getCallHierarchyItemName(program: Program, node: CallHierarchyDeclarati return { text: `${prefix}static {}`, pos, end }; } - const declName = isConstNamedExpression(node) ? node.parent.name : + const declName = isAssignedExpression(node) ? node.parent.name : Debug.checkDefined(getNameOfDeclaration(node), "Expected call hierarchy item to have a name"); let text = isIdentifier(declName) ? idText(declName) : @@ -248,7 +258,10 @@ function getCallHierarchyItemName(program: Program, node: CallHierarchyDeclarati } function getCallHierarchItemContainerName(node: CallHierarchyDeclaration): string | undefined { - if (isConstNamedExpression(node)) { + if (isAssignedExpression(node)) { + if (isPropertyDeclaration(node.parent) && isClassLike(node.parent.parent)) { + return isClassExpression(node.parent.parent) ? getAssignedName(node.parent.parent)?.getText() : node.parent.parent.name?.getText(); + } if (isModuleBlock(node.parent.parent.parent.parent) && isIdentifier(node.parent.parent.parent.parent.parent.name)) { return node.parent.parent.parent.parent.parent.name.getText(); } @@ -364,7 +377,7 @@ export function resolveCallHierarchyDeclaration(program: Program, location: Node const ancestor = findAncestor(location.parent, isValidCallHierarchyDeclaration); return ancestor && findImplementationOrAllInitialDeclarations(typeChecker, ancestor); } - if (isVariableDeclaration(location.parent) && location.parent.initializer && isConstNamedExpression(location.parent.initializer)) { + if (isVariableLike(location.parent) && location.parent.initializer && isAssignedExpression(location.parent.initializer)) { return location.parent.initializer; } return undefined; @@ -380,7 +393,7 @@ export function resolveCallHierarchyDeclaration(program: Program, location: Node continue; } // #39453 - if (isVariableDeclaration(location) && location.initializer && isConstNamedExpression(location.initializer)) { + if (isVariableDeclaration(location) && location.initializer && isAssignedExpression(location.initializer)) { return location.initializer; } if (!followingSymbol) { diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts index 3b9340f4e2bf3..9ef55283fd6cb 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -72,6 +72,7 @@ import { isTypeLiteralNode, JsxOpeningLikeElement, LanguageVariant, + lastOrUndefined, length, map, MethodDeclaration, @@ -584,22 +585,15 @@ function addEnumMemberDeclaration(changes: textChanges.ChangeTracker, checker: T const type = checker.getTypeAtLocation(member); return !!(type && type.flags & TypeFlags.StringLike); }); - + const sourceFile = parentDeclaration.getSourceFile(); const enumMember = factory.createEnumMember(token, hasStringInitializer ? factory.createStringLiteral(token.text) : undefined); - changes.replaceNode( - parentDeclaration.getSourceFile(), - parentDeclaration, - factory.updateEnumDeclaration( - parentDeclaration, - parentDeclaration.modifiers, - parentDeclaration.name, - concatenate(parentDeclaration.members, singleElementArray(enumMember)), - ), - { - leadingTriviaOption: textChanges.LeadingTriviaOption.IncludeAll, - trailingTriviaOption: textChanges.TrailingTriviaOption.Exclude, - }, - ); + const last = lastOrUndefined(parentDeclaration.members); + if (last) { + changes.insertNodeInListAfter(sourceFile, last, enumMember, parentDeclaration.members); + } + else { + changes.insertMemberAtStart(sourceFile, parentDeclaration, enumMember); + } } function addFunctionDeclaration(changes: textChanges.ChangeTracker, context: CodeFixContextBase, info: FunctionInfo | SignatureInfo) { @@ -674,7 +668,7 @@ function tryGetValueFromType(context: CodeFixContextBase, checker: TypeChecker, } if (type.flags & TypeFlags.EnumLike) { const enumMember = type.symbol.exports ? firstOrUndefinedIterator(type.symbol.exports.values()) : type.symbol; - const name = checker.symbolToExpression(type.symbol.parent ? type.symbol.parent : type.symbol, SymbolFlags.Value, /*enclosingDeclaration*/ undefined, /*flags*/ undefined); + const name = checker.symbolToExpression(type.symbol.parent ? type.symbol.parent : type.symbol, SymbolFlags.Value, /*enclosingDeclaration*/ undefined, /*flags*/ NodeBuilderFlags.UseFullyQualifiedType); return enumMember === undefined || name === undefined ? factory.createNumericLiteral(0) : factory.createPropertyAccessExpression(name, checker.symbolToString(enumMember)); } if (type.flags & TypeFlags.NumberLiteral) { diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 97c5bca540b54..22cd9693ab98f 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -53,6 +53,7 @@ import { getSourceFileOfNode, getSymbolId, getTokenAtPosition, + getTokenPosOfNode, getTypeKeywordOfTypeOnlyImport, getUniqueSymbolId, hostGetCanonicalFileName, @@ -1406,14 +1407,14 @@ function promoteFromTypeOnly( if (aliasDeclaration.parent.elements.length > 1 && sortKind) { const newSpecifier = factory.updateImportSpecifier(aliasDeclaration, /*isTypeOnly*/ false, aliasDeclaration.propertyName, aliasDeclaration.name); const comparer = OrganizeImports.getOrganizeImportsComparer(preferences, sortKind === SortKind.CaseInsensitive); - const insertionIndex = OrganizeImports.getImportSpecifierInsertionIndex(aliasDeclaration.parent.elements, newSpecifier, comparer); - if (aliasDeclaration.parent.elements.indexOf(aliasDeclaration) !== insertionIndex) { + const insertionIndex = OrganizeImports.getImportSpecifierInsertionIndex(aliasDeclaration.parent.elements, newSpecifier, comparer, preferences); + if (insertionIndex !== aliasDeclaration.parent.elements.indexOf(aliasDeclaration)) { changes.delete(sourceFile, aliasDeclaration); changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex); return aliasDeclaration; } } - changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken()!); + changes.deleteRange(sourceFile, { pos: getTokenPosOfNode(aliasDeclaration.getFirstToken()!), end: getTokenPosOfNode(aliasDeclaration.propertyName ?? aliasDeclaration.name) }); return aliasDeclaration; } else { @@ -1538,7 +1539,7 @@ function doAddExistingFix( // type-only, there's no need to ask for the insertion index - it's 0. const insertionIndex = promoteFromTypeOnly && !spec.isTypeOnly ? 0 - : OrganizeImports.getImportSpecifierInsertionIndex(existingSpecifiers, spec, comparer); + : OrganizeImports.getImportSpecifierInsertionIndex(existingSpecifiers, spec, comparer, preferences); changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings as NamedImports, insertionIndex); } } diff --git a/src/services/completions.ts b/src/services/completions.ts index 61f543100f5ee..155d048562b78 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -3424,7 +3424,6 @@ function getCompletionData( const semanticStart = timestamp(); let completionKind = CompletionKind.None; - let isNonContextualObjectLiteral = false; let hasUnresolvedAutoImports = false; // This also gets mutated in nested-functions after the return let symbols: Symbol[] = []; @@ -3894,8 +3893,6 @@ function getCompletionData( function shouldOfferImportCompletions(): boolean { // If already typing an import statement, provide completions for it. if (importStatementCompletion) return true; - // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols - if (isNonContextualObjectLiteral) return false; // If not already a module, must have modules enabled. if (!preferences.includeCompletionsForModuleExports) return false; // If already using ES modules, OK to continue using them. @@ -3946,7 +3943,7 @@ function getCompletionData( isFunctionLikeKind(parentKind); case SyntaxKind.EqualsToken: - return parentKind === SyntaxKind.TypeAliasDeclaration; + return parentKind === SyntaxKind.TypeAliasDeclaration || parentKind === SyntaxKind.TypeParameter; case SyntaxKind.AsKeyword: return parentKind === SyntaxKind.AsExpression; @@ -4340,7 +4337,6 @@ function getCompletionData( if (objectLikeContainer.flags & NodeFlags.InWithStatement) { return GlobalsSearch.Fail; } - isNonContextualObjectLiteral = true; return GlobalsSearch.Continue; } const completionsType = typeChecker.getContextualType(objectLikeContainer, ContextFlags.Completions); @@ -4353,7 +4349,6 @@ function getCompletionData( if (typeMembers.length === 0) { // Edge case: If NumberIndexType exists if (!hasNumberIndextype) { - isNonContextualObjectLiteral = true; return GlobalsSearch.Continue; } } diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 7c6f4bfe85cf7..73a6d2428ca5f 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -88,7 +88,7 @@ export function getAllRules(): RuleSpec[] { const functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments; // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([SyntaxKind.Identifier, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.ClassKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ImportKeyword]); + const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([SyntaxKind.Identifier, SyntaxKind.GreaterThanToken, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.ClassKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ImportKeyword]); // Place a space before open brace in a control flow construct const controlOpenBraceLeftTokenRange = tokenRangeFrom([SyntaxKind.CloseParenToken, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.DoKeyword, SyntaxKind.TryKeyword, SyntaxKind.FinallyKeyword, SyntaxKind.ElseKeyword, SyntaxKind.CatchKeyword]); diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 8ca6a6c7caebe..6f387271048dc 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -8,6 +8,7 @@ import { CompletionEntry, CompletionEntryDetails, Completions, + concatenate, ConstructorDeclaration, contains, Declaration, @@ -258,17 +259,21 @@ export function getJsDocTagsFromDeclarations(declarations?: Declaration[], check } for (const tag of tags) { infos.push({ name: tag.tagName.text, text: getCommentDisplayParts(tag, checker) }); - - if (isJSDocPropertyLikeTag(tag) && tag.isNameFirst && tag.typeExpression && isJSDocTypeLiteral(tag.typeExpression.type)) { - forEach(tag.typeExpression.type.jsDocPropertyTags, propTag => { - infos.push({ name: propTag.tagName.text, text: getCommentDisplayParts(propTag, checker) }); - }); - } + infos.push(...getJSDocPropertyTagsInfo(tryGetJSDocPropertyTags(tag), checker)); } }); return infos; } +function getJSDocPropertyTagsInfo(nodes: readonly JSDocTag[] | undefined, checker: TypeChecker | undefined): readonly JSDocTagInfo[] { + return flatMap(nodes, propTag => concatenate([{ name: propTag.tagName.text, text: getCommentDisplayParts(propTag, checker) }], getJSDocPropertyTagsInfo(tryGetJSDocPropertyTags(propTag), checker))); +} + +function tryGetJSDocPropertyTags(node: JSDocTag) { + return isJSDocPropertyLikeTag(node) && node.isNameFirst && node.typeExpression && + isJSDocTypeLiteral(node.typeExpression.type) ? node.typeExpression.type.jsDocPropertyTags : undefined; +} + function getDisplayPartsFromComment(comment: string | readonly JSDocComment[], checker: TypeChecker | undefined): SymbolDisplayPart[] { if (typeof comment === "string") { return [textPart(comment)]; diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 26a5f098967e1..167ca62982e94 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -84,6 +84,7 @@ import { isStatic, isStringLiteralLike, isStringOrNumericLiteralLike, + isTemplateLiteral, isToken, isVariableDeclaration, lastOrUndefined, @@ -1057,7 +1058,7 @@ function getFunctionOrClassName(node: FunctionExpression | FunctionDeclaration | return `${name} callback`; } - const args = cleanText(mapDefined(parent.arguments, a => isStringLiteralLike(a) ? a.getText(curSourceFile) : undefined).join(", ")); + const args = cleanText(mapDefined(parent.arguments, a => isStringLiteralLike(a) || isTemplateLiteral(a) ? a.getText(curSourceFile) : undefined).join(", ")); return `${name}(${args}) callback`; } } diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 777541679b7da..b9c2f7e89096f 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -23,8 +23,10 @@ import { flatMap, formatting, getNewLineOrDefaultFromHost, + getStringComparer, getUILocale, group, + groupBy, Identifier, identity, ImportClause, @@ -94,7 +96,7 @@ export function organizeImports( const processImportsOfSameModuleSpecifier = (importGroup: readonly ImportDeclaration[]) => { if (shouldRemove) importGroup = removeUnusedImports(importGroup, sourceFile, program); - if (shouldCombine) importGroup = coalesceImportsWorker(importGroup, comparer, sourceFile); + if (shouldCombine) importGroup = coalesceImportsWorker(importGroup, comparer, sourceFile, preferences); if (shouldSort) importGroup = stableSort(importGroup, (s1, s2) => compareImportsOrRequireStatements(s1, s2, comparer)); return importGroup; }; @@ -104,7 +106,7 @@ export function organizeImports( // Exports are always used if (mode !== OrganizeImportsMode.RemoveUnused) { // All of the old ExportDeclarations in the file, in syntactic order. - getTopLevelExportGroups(sourceFile).forEach(exportGroupDecl => organizeImportsWorker(exportGroupDecl, group => coalesceExportsWorker(group, comparer))); + getTopLevelExportGroups(sourceFile).forEach(exportGroupDecl => organizeImportsWorker(exportGroupDecl, group => coalesceExportsWorker(group, comparer, preferences))); } for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) { @@ -116,7 +118,7 @@ export function organizeImports( // Exports are always used if (mode !== OrganizeImportsMode.RemoveUnused) { const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration); - organizeImportsWorker(ambientModuleExportDecls, group => coalesceExportsWorker(group, comparer)); + organizeImportsWorker(ambientModuleExportDecls, group => coalesceExportsWorker(group, comparer, preferences)); } } @@ -310,12 +312,12 @@ function getExternalModuleName(specifier: Expression | undefined) { * @deprecated Only used for testing * @internal */ -export function coalesceImports(importGroup: readonly ImportDeclaration[], ignoreCase: boolean, sourceFile?: SourceFile): readonly ImportDeclaration[] { +export function coalesceImports(importGroup: readonly ImportDeclaration[], ignoreCase: boolean, sourceFile?: SourceFile, preferences?: UserPreferences): readonly ImportDeclaration[] { const comparer = getOrganizeImportsOrdinalStringComparer(ignoreCase); - return coalesceImportsWorker(importGroup, comparer, sourceFile); + return coalesceImportsWorker(importGroup, comparer, sourceFile, preferences); } -function coalesceImportsWorker(importGroup: readonly ImportDeclaration[], comparer: Comparer, sourceFile?: SourceFile): readonly ImportDeclaration[] { +function coalesceImportsWorker(importGroup: readonly ImportDeclaration[], comparer: Comparer, sourceFile?: SourceFile, preferences?: UserPreferences): readonly ImportDeclaration[] { if (importGroup.length === 0) { return importGroup; } @@ -374,7 +376,7 @@ function coalesceImportsWorker(importGroup: readonly ImportDeclaration[], compar newImportSpecifiers.push(...getNewImportSpecifiers(namedImports)); const sortedImportSpecifiers = factory.createNodeArray( - sortSpecifiers(newImportSpecifiers, comparer), + sortSpecifiers(newImportSpecifiers, comparer, preferences), firstNamedImport?.importClause.namedBindings.elements.hasTrailingComma, ); @@ -491,18 +493,17 @@ function getCategorizedImports(importGroup: readonly ImportDeclaration[]) { * @deprecated Only used for testing * @internal */ -export function coalesceExports(exportGroup: readonly ExportDeclaration[], ignoreCase: boolean) { +export function coalesceExports(exportGroup: readonly ExportDeclaration[], ignoreCase: boolean, preferences?: UserPreferences) { const comparer = getOrganizeImportsOrdinalStringComparer(ignoreCase); - return coalesceExportsWorker(exportGroup, comparer); + return coalesceExportsWorker(exportGroup, comparer, preferences); } -function coalesceExportsWorker(exportGroup: readonly ExportDeclaration[], comparer: Comparer) { +function coalesceExportsWorker(exportGroup: readonly ExportDeclaration[], comparer: Comparer, preferences?: UserPreferences) { if (exportGroup.length === 0) { return exportGroup; } const { exportWithoutClause, namedExports, typeOnlyExports } = getCategorizedExports(exportGroup); - const coalescedExports: ExportDeclaration[] = []; if (exportWithoutClause) { @@ -516,7 +517,7 @@ function coalesceExportsWorker(exportGroup: readonly ExportDeclaration[], compar const newExportSpecifiers: ExportSpecifier[] = []; newExportSpecifiers.push(...flatMap(exportGroup, i => i.exportClause && isNamedExports(i.exportClause) ? i.exportClause.elements : emptyArray)); - const sortedExportSpecifiers = sortSpecifiers(newExportSpecifiers, comparer); + const sortedExportSpecifiers = sortSpecifiers(newExportSpecifiers, comparer, preferences); const exportDecl = exportGroup[0]; coalescedExports.push( @@ -583,13 +584,20 @@ function updateImportDeclarationAndClause( ); } -function sortSpecifiers(specifiers: readonly T[], comparer: Comparer) { - return stableSort(specifiers, (s1, s2) => compareImportOrExportSpecifiers(s1, s2, comparer)); +function sortSpecifiers(specifiers: readonly T[], comparer: Comparer, preferences?: UserPreferences): readonly T[] { + return stableSort(specifiers, (s1, s2) => compareImportOrExportSpecifiers(s1, s2, comparer, preferences)); } /** @internal */ -export function compareImportOrExportSpecifiers(s1: T, s2: T, comparer: Comparer): Comparison { - return compareBooleans(s1.isTypeOnly, s2.isTypeOnly) || comparer(s1.name.text, s2.name.text); +export function compareImportOrExportSpecifiers(s1: T, s2: T, comparer: Comparer, preferences?: UserPreferences): Comparison { + switch (preferences?.organizeImportsTypeOrder) { + case "first": + return compareBooleans(s2.isTypeOnly, s1.isTypeOnly) || comparer(s1.name.text, s2.name.text); + case "inline": + return comparer(s1.name.text, s2.name.text); + default: + return compareBooleans(s1.isTypeOnly, s2.isTypeOnly) || comparer(s1.name.text, s2.name.text); + } } /** @@ -721,11 +729,51 @@ class ImportSpecifierSortingCache implements MemoizeCache<[readonly ImportSpecif /** @internal */ export const detectImportSpecifierSorting = memoizeCached((specifiers: readonly ImportSpecifier[], preferences: UserPreferences): SortKind => { - if (!arrayIsSorted(specifiers, (s1, s2) => compareBooleans(s1.isTypeOnly, s2.isTypeOnly))) { - return SortKind.None; + // If types are not sorted as specified, then imports are assumed to be unsorted. + // If there is no type sorting specification, we default to "last" and move on to case sensitivity detection. + switch (preferences.organizeImportsTypeOrder) { + case "first": + if (!arrayIsSorted(specifiers, (s1, s2) => compareBooleans(s2.isTypeOnly, s1.isTypeOnly))) return SortKind.None; + break; + case "inline": + if ( + !arrayIsSorted(specifiers, (s1, s2) => { + const comparer = getStringComparer(/*ignoreCase*/ true); + return comparer(s1.name.text, s2.name.text); + }) + ) { + return SortKind.None; + } + break; + default: + if (!arrayIsSorted(specifiers, (s1, s2) => compareBooleans(s1.isTypeOnly, s2.isTypeOnly))) return SortKind.None; + break; } + const collateCaseSensitive = getOrganizeImportsComparer(preferences, /*ignoreCase*/ false); const collateCaseInsensitive = getOrganizeImportsComparer(preferences, /*ignoreCase*/ true); + + if (preferences.organizeImportsTypeOrder !== "inline") { + const { type: regularImports, regular: typeImports } = groupBy(specifiers, s => s.isTypeOnly ? "type" : "regular"); + const regularCaseSensitivity = regularImports?.length + ? detectSortCaseSensitivity(regularImports, specifier => specifier.name.text, collateCaseSensitive, collateCaseInsensitive) + : undefined; + const typeCaseSensitivity = typeImports?.length + ? detectSortCaseSensitivity(typeImports, specifier => specifier.name.text ?? "", collateCaseSensitive, collateCaseInsensitive) + : undefined; + if (regularCaseSensitivity === undefined) { + return typeCaseSensitivity ?? SortKind.None; + } + if (typeCaseSensitivity === undefined) { + return regularCaseSensitivity; + } + if (regularCaseSensitivity === SortKind.None || typeCaseSensitivity === SortKind.None) { + return SortKind.None; + } + return typeCaseSensitivity & regularCaseSensitivity; + } + + // else inline return detectSortCaseSensitivity(specifiers, specifier => specifier.name.text, collateCaseSensitive, collateCaseInsensitive); }, new ImportSpecifierSortingCache()); @@ -736,8 +784,8 @@ export function getImportDeclarationInsertionIndex(sortedImports: readonly AnyIm } /** @internal */ -export function getImportSpecifierInsertionIndex(sortedImports: readonly ImportSpecifier[], newImport: ImportSpecifier, comparer: Comparer) { - const index = binarySearch(sortedImports, newImport, identity, (s1, s2) => compareImportOrExportSpecifiers(s1, s2, comparer)); +export function getImportSpecifierInsertionIndex(sortedImports: readonly ImportSpecifier[], newImport: ImportSpecifier, comparer: Comparer, preferences: UserPreferences) { + const index = binarySearch(sortedImports, newImport, identity, (s1, s2) => compareImportOrExportSpecifiers(s1, s2, comparer, preferences)); return index < 0 ? ~index : index; } diff --git a/src/services/refactors/extractType.ts b/src/services/refactors/extractType.ts index f8ddcaedbf098..e9d43a1a3c219 100644 --- a/src/services/refactors/extractType.ts +++ b/src/services/refactors/extractType.ts @@ -23,6 +23,7 @@ import { getRefactorContextSpan, getRenameLocation, getTokenAtPosition, + getTouchingToken, getUniqueName, ignoreSourceNewlines, isArray, @@ -173,14 +174,9 @@ type ExtractInfo = TypeAliasInfo | InterfaceInfo; function getRangeToExtract(context: RefactorContext, considerEmptySpans = true): ExtractInfo | RefactorErrorInfo | undefined { const { file, startPosition } = context; const isJS = isSourceFileJS(file); - const current = getTokenAtPosition(file, startPosition); const range = createTextRangeFromSpan(getRefactorContextSpan(context)); - const cursorRequest = range.pos === range.end && considerEmptySpans; - const overlappingRange = nodeOverlapsWithStartEnd(current, file, range.pos, range.end); - - const firstType = findAncestor(current, node => - node.parent && isTypeNode(node) && !rangeContainsSkipTrivia(range, node.parent, file) && - (cursorRequest || overlappingRange)); + const isCursorRequest = range.pos === range.end && considerEmptySpans; + const firstType = getFirstTypeAt(file, startPosition, range, isCursorRequest); if (!firstType || !isTypeNode(firstType)) return { error: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_type_node) }; const checker = context.program.getTypeChecker(); @@ -209,6 +205,24 @@ function getRangeToExtract(context: RefactorContext, considerEmptySpans = true): return { isJS, selection, enclosingNode, typeParameters, typeElements }; } +function getFirstTypeAt(file: SourceFile, startPosition: number, range: TextRange, isCursorRequest: boolean): Node | undefined { + const currentNodes = [ + () => getTokenAtPosition(file, startPosition), + () => getTouchingToken(file, startPosition, () => true), + ]; + for (const f of currentNodes) { + const current = f(); + const overlappingRange = nodeOverlapsWithStartEnd(current, file, range.pos, range.end); + const firstType = findAncestor(current, node => + node.parent && isTypeNode(node) && !rangeContainsSkipTrivia(range, node.parent, file) && + (isCursorRequest || overlappingRange)); + if (firstType) { + return firstType; + } + } + return undefined; +} + function flattenTypeLiteralNodeReference(checker: TypeChecker, selection: TypeNode | TypeNode[] | undefined): readonly TypeElement[] | undefined { if (!selection) return undefined; if (isArray(selection)) { diff --git a/src/services/refactors/moveToFile.ts b/src/services/refactors/moveToFile.ts index c1aa1d4bf5b43..d3801aabac74a 100644 --- a/src/services/refactors/moveToFile.ts +++ b/src/services/refactors/moveToFile.ts @@ -206,7 +206,7 @@ function doChange(context: RefactorContext, oldFile: SourceFile, targetFile: str else { const targetSourceFile = Debug.checkDefined(program.getSourceFile(targetFile)); const importAdder = codefix.createImportAdder(targetSourceFile, context.program, context.preferences, context.host); - getNewStatementsAndRemoveFromOldFile(oldFile, targetSourceFile, getUsageInfo(oldFile, toMove.all, checker, getExistingImports(targetSourceFile, checker)), changes, toMove, program, host, preferences, importAdder); + getNewStatementsAndRemoveFromOldFile(oldFile, targetSourceFile, getUsageInfo(oldFile, toMove.all, checker, getExistingLocals(targetSourceFile, toMove.all, checker)), changes, toMove, program, host, preferences, importAdder); } } @@ -996,7 +996,7 @@ function isPureImport(node: Node): boolean { } /** @internal */ -export function getUsageInfo(oldFile: SourceFile, toMove: readonly Statement[], checker: TypeChecker, existingTargetImports: ReadonlySet = new Set()): UsageInfo { +export function getUsageInfo(oldFile: SourceFile, toMove: readonly Statement[], checker: TypeChecker, existingTargetLocals: ReadonlySet = new Set()): UsageInfo { const movedSymbols = new Set(); const oldImportsNeededByTargetFile = new Map(); const targetFileImportsFromOldFile = new Set(); @@ -1020,7 +1020,7 @@ export function getUsageInfo(oldFile: SourceFile, toMove: readonly Statement[], if (!symbol.declarations) { return; } - if (existingTargetImports.has(skipAlias(symbol, checker))) { + if (existingTargetLocals.has(skipAlias(symbol, checker))) { unusedImportsFromOldFile.add(symbol); return; } @@ -1243,8 +1243,8 @@ function getOverloadRangeToMove(sourceFile: SourceFile, statement: Statement) { return undefined; } -function getExistingImports(sourceFile: SourceFile, checker: TypeChecker) { - const imports = new Set(); +function getExistingLocals(sourceFile: SourceFile, statements: readonly Statement[], checker: TypeChecker) { + const existingLocals = new Set(); for (const moduleSpecifier of sourceFile.imports) { const declaration = importFromModuleSpecifier(moduleSpecifier); if ( @@ -1254,7 +1254,7 @@ function getExistingImports(sourceFile: SourceFile, checker: TypeChecker) { for (const e of declaration.importClause.namedBindings.elements) { const symbol = checker.getSymbolAtLocation(e.propertyName || e.name); if (symbol) { - imports.add(skipAlias(symbol, checker)); + existingLocals.add(skipAlias(symbol, checker)); } } } @@ -1262,10 +1262,19 @@ function getExistingImports(sourceFile: SourceFile, checker: TypeChecker) { for (const e of declaration.parent.name.elements) { const symbol = checker.getSymbolAtLocation(e.propertyName || e.name); if (symbol) { - imports.add(skipAlias(symbol, checker)); + existingLocals.add(skipAlias(symbol, checker)); } } } } - return imports; + + for (const statement of statements) { + forEachReference(statement, checker, s => { + const symbol = skipAlias(s, checker); + if (symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration) === sourceFile) { + existingLocals.add(symbol); + } + }); + } + return existingLocals; } diff --git a/src/services/rename.ts b/src/services/rename.ts index 4083612dae428..1260fef23d5cc 100644 --- a/src/services/rename.ts +++ b/src/services/rename.ts @@ -185,17 +185,17 @@ function getRenameInfoForModule(node: StringLiteralLike, sourceFile: SourceFile, const moduleSourceFile = moduleSymbol.declarations && find(moduleSymbol.declarations, isSourceFile); if (!moduleSourceFile) return undefined; const withoutIndex = endsWith(node.text, "/index") || endsWith(node.text, "/index.js") ? undefined : tryRemoveSuffix(removeFileExtension(moduleSourceFile.fileName), "/index"); - const name = withoutIndex === undefined ? moduleSourceFile.fileName : withoutIndex; + const fileName = withoutIndex === undefined ? moduleSourceFile.fileName : withoutIndex; const kind = withoutIndex === undefined ? ScriptElementKind.moduleElement : ScriptElementKind.directory; const indexAfterLastSlash = node.text.lastIndexOf("/") + 1; // Span should only be the last component of the path. + 1 to account for the quote character. const triggerSpan = createTextSpan(node.getStart(sourceFile) + 1 + indexAfterLastSlash, node.text.length - indexAfterLastSlash); return { canRename: true, - fileToRename: name, + fileToRename: fileName, kind, - displayName: name, - fullDisplayName: name, + displayName: fileName, + fullDisplayName: node.text, kindModifiers: ScriptElementKindModifier.none, triggerSpan, }; diff --git a/src/services/services.ts b/src/services/services.ts index 812eafd2c940e..f08e2ab88580d 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3282,12 +3282,15 @@ export function getPropertySymbolsFromContextualType(node: ObjectLiteralElementW return symbol ? [symbol] : emptyArray; } - const discriminatedPropertySymbols = mapDefined(contextualType.types, t => (isObjectLiteralExpression(node.parent) || isJsxAttributes(node.parent)) && checker.isTypeInvalidDueToUnionDiscriminant(t, node.parent) ? undefined : t.getProperty(name)); + const filteredTypes = isObjectLiteralExpression(node.parent) || isJsxAttributes(node.parent) + ? filter(contextualType.types, t => !checker.isTypeInvalidDueToUnionDiscriminant(t, node.parent)) + : contextualType.types; + const discriminatedPropertySymbols = mapDefined(filteredTypes, t => t.getProperty(name)); if (unionSymbolOk && (discriminatedPropertySymbols.length === 0 || discriminatedPropertySymbols.length === contextualType.types.length)) { const symbol = contextualType.getProperty(name); if (symbol) return [symbol]; } - if (discriminatedPropertySymbols.length === 0) { + if (!filteredTypes.length && !discriminatedPropertySymbols.length) { // Bad discriminant -- do again without discriminating return mapDefined(contextualType.types, t => t.getProperty(name)); } diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 177e25b18d0e5..f15aff7173a18 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -25,6 +25,8 @@ import { EmitHint, EmitTextWriter, endsWith, + EnumDeclaration, + EnumMember, Expression, factory, FileTextChanges, @@ -843,7 +845,7 @@ export class ChangeTracker { }); } - public insertMemberAtStart(sourceFile: SourceFile, node: ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode, newElement: ClassElement | PropertySignature | MethodSignature): void { + public insertMemberAtStart(sourceFile: SourceFile, node: ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode | EnumDeclaration, newElement: ClassElement | PropertySignature | MethodSignature | EnumMember): void { this.insertNodeAtStartWorker(sourceFile, node, newElement); } @@ -851,7 +853,7 @@ export class ChangeTracker { this.insertNodeAtStartWorker(sourceFile, obj, newElement); } - private insertNodeAtStartWorker(sourceFile: SourceFile, node: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression | TypeLiteralNode, newElement: ClassElement | ObjectLiteralElementLike | PropertySignature | MethodSignature): void { + private insertNodeAtStartWorker(sourceFile: SourceFile, node: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression | TypeLiteralNode | EnumDeclaration, newElement: ClassElement | ObjectLiteralElementLike | PropertySignature | MethodSignature | EnumMember): void { const indentation = this.guessIndentationFromExistingMembers(sourceFile, node) ?? this.computeIndentationForNewMember(sourceFile, node); this.insertNodeAt(sourceFile, getMembersOrProperties(node).pos, newElement, this.getInsertNodeAtStartInsertOptions(sourceFile, node, indentation)); } @@ -860,7 +862,7 @@ export class ChangeTracker { * Tries to guess the indentation from the existing members of a class/interface/object. All members must be on * new lines and must share the same indentation. */ - private guessIndentationFromExistingMembers(sourceFile: SourceFile, node: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression | TypeLiteralNode) { + private guessIndentationFromExistingMembers(sourceFile: SourceFile, node: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression | TypeLiteralNode | EnumDeclaration) { let indentation: number | undefined; let lastRange: TextRange = node; for (const member of getMembersOrProperties(node)) { @@ -882,13 +884,13 @@ export class ChangeTracker { return indentation; } - private computeIndentationForNewMember(sourceFile: SourceFile, node: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression | TypeLiteralNode) { + private computeIndentationForNewMember(sourceFile: SourceFile, node: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression | TypeLiteralNode | EnumDeclaration) { const nodeStart = node.getStart(sourceFile); return formatting.SmartIndenter.findFirstNonWhitespaceColumn(getLineStartPositionForPosition(nodeStart, sourceFile), nodeStart, sourceFile, this.formatContext.options) + (this.formatContext.options.indentSize ?? 4); } - private getInsertNodeAtStartInsertOptions(sourceFile: SourceFile, node: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression | TypeLiteralNode, indentation: number): InsertNodeOptions { + private getInsertNodeAtStartInsertOptions(sourceFile: SourceFile, node: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression | TypeLiteralNode | EnumDeclaration, indentation: number): InsertNodeOptions { // Rules: // - Always insert leading newline. // - For object literals: @@ -1093,7 +1095,10 @@ export class ChangeTracker { const afterMinusOneStartLinePosition = getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile); multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition; } - if (hasCommentsBeforeLineBreak(sourceFile.text, after.end)) { + if ( + hasCommentsBeforeLineBreak(sourceFile.text, after.end) + || !positionsAreOnSameLine(containingList.pos, containingList.end, sourceFile) + ) { // in this case we'll always treat containing list as multiline multilineList = true; } @@ -1246,7 +1251,7 @@ function getClassOrObjectBraceEnds(cls: ClassLikeDeclaration | InterfaceDeclarat const close = findChildOfKind(cls, SyntaxKind.CloseBraceToken, sourceFile); return [open?.end, close?.end]; } -function getMembersOrProperties(node: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression | TypeLiteralNode): NodeArray { +function getMembersOrProperties(node: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression | TypeLiteralNode | EnumDeclaration): NodeArray { return isObjectLiteralExpression(node) ? node.properties : node.members; } diff --git a/src/services/types.ts b/src/services/types.ts index cfa61dc9195e8..9bb560af02ac9 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1291,6 +1291,10 @@ export interface RenameInfoSuccess { */ fileToRename?: string; displayName: string; + /** + * Full display name of item to be renamed. + * If item to be renamed is a file, then this is the original text of the module specifer + */ fullDisplayName: string; kind: ScriptElementKind; kindModifiers: string; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index bb505008bedb8..b48367739786d 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -362,6 +362,7 @@ import { tokenToString, toPath, tryCast, + tryParseJson, Type, TypeChecker, TypeFlags, @@ -2473,6 +2474,7 @@ export function createModuleSpecifierResolutionHost(program: Program, host: Lang isSourceOfProjectReferenceRedirect: fileName => program.isSourceOfProjectReferenceRedirect(fileName), getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson), getFileIncludeReasons: () => program.getFileIncludeReasons(), + getCommonSourceDirectory: () => program.getCommonSourceDirectory(), }; } @@ -2977,10 +2979,11 @@ export function buildLinkParts(link: JSDocLink | JSDocLinkCode | JSDocLinkPlain, } else { const symbol = checker?.getSymbolAtLocation(link.name); + const targetSymbol = symbol && checker ? getSymbolTarget(symbol, checker) : undefined; const suffix = findLinkNameEnd(link.text); const name = getTextOfNode(link.name) + link.text.slice(0, suffix); const text = skipSeparatorFromLinkText(link.text.slice(suffix)); - const decl = symbol?.valueDeclaration || symbol?.declarations?.[0]; + const decl = targetSymbol?.valueDeclaration || targetSymbol?.declarations?.[0]; if (decl) { parts.push(linkNamePart(name, decl)); if (text) parts.push(linkTextPart(text)); @@ -3895,15 +3898,6 @@ export function createPackageJsonImportFilter(fromFile: SourceFile, preferences: } } -function tryParseJson(text: string) { - try { - return JSON.parse(text); - } - catch { - return undefined; - } -} - /** @internal */ export function consumesNodeCoreModules(sourceFile: SourceFile): boolean { return some(sourceFile.imports, ({ text }) => JsTyping.nodeCoreModules.has(text)); diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts index a4c12a2d7dad8..7dcf1e1f33aa7 100644 --- a/src/testRunner/unittests/evaluation/esDecorators.ts +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -2183,14 +2183,6 @@ describe("unittests:: evaluation:: esDecorators", () => { "static method extra initializer evaluation 2b", "static method extra initializer evaluation 1a", "static method extra initializer evaluation 1b", - "static auto-accessor extra initializer evaluation 2a", - "static auto-accessor extra initializer evaluation 2b", - "static auto-accessor extra initializer evaluation 1a", - "static auto-accessor extra initializer evaluation 1b", - "static field extra initializer evaluation 2a", - "static field extra initializer evaluation 2b", - "static field extra initializer evaluation 1a", - "static field extra initializer evaluation 1b", // next, static initializers (i.e., fields, auto-accessors, and static blocks) are evaluated in document // order and applied to the replacement class: @@ -2198,9 +2190,18 @@ describe("unittests:: evaluation:: esDecorators", () => { "static field initializer evaluation", "static field injected initializer evaluation 1", "static field injected initializer evaluation 2", + "static field extra initializer evaluation 2a", + "static field extra initializer evaluation 2b", + "static field extra initializer evaluation 1a", + "static field extra initializer evaluation 1b", + "static auto-accessor initializer evaluation", "static auto-accessor injected initializer evaluation 1", "static auto-accessor injected initializer evaluation 2", + "static auto-accessor extra initializer evaluation 2a", + "static auto-accessor extra initializer evaluation 2b", + "static auto-accessor extra initializer evaluation 1a", + "static auto-accessor extra initializer evaluation 1b", // NOTE: at this point, static private fields will be installed (TODO: on the replacement class) // finally, class extra initializers are applied in the order they were added (i.e., methods before fields, @@ -2230,23 +2231,23 @@ describe("unittests:: evaluation:: esDecorators", () => { "instance method extra initializer evaluation 2b", "instance method extra initializer evaluation 1a", "instance method extra initializer evaluation 1b", - "instance auto-accessor extra initializer evaluation 2a", - "instance auto-accessor extra initializer evaluation 2b", - "instance auto-accessor extra initializer evaluation 1a", - "instance auto-accessor extra initializer evaluation 1b", - "instance field extra initializer evaluation 2a", - "instance field extra initializer evaluation 2b", - "instance field extra initializer evaluation 1a", - "instance field extra initializer evaluation 1b", // next, instance initializers (i.e., fields, auto-accessors, and static blocks) are evaluated in document // order: "instance field initializer evaluation", "instance field injected initializer evaluation 1", "instance field injected initializer evaluation 2", + "instance field extra initializer evaluation 2a", + "instance field extra initializer evaluation 2b", + "instance field extra initializer evaluation 1a", + "instance field extra initializer evaluation 1b", "instance auto-accessor initializer evaluation", "instance auto-accessor injected initializer evaluation 1", "instance auto-accessor injected initializer evaluation 2", + "instance auto-accessor extra initializer evaluation 2a", + "instance auto-accessor extra initializer evaluation 2b", + "instance auto-accessor extra initializer evaluation 1a", + "instance auto-accessor extra initializer evaluation 1b", // NOTE: at this point, instance private fields will be installed. // finally, statements in the constructor after the call to `super()` are evaluated: diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index be6809a0ade23..e2970ef0d84a1 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -239,10 +239,10 @@ describe("unittests:: services:: organizeImports", () => { assertListEqual(actualCoalescedExports, expectedCoalescedExports); }); - it("Sort specifiers - type-only", () => { + it("Sort specifiers - type-only-inline", () => { const sortedImports = parseImports(`import { type z, y, type x, c, type b, a } from "lib";`); - const actualCoalescedImports = ts.OrganizeImports.coalesceImports(sortedImports, /*ignoreCase*/ true); - const expectedCoalescedImports = parseImports(`import { a, c, y, type b, type x, type z } from "lib";`); + const actualCoalescedImports = ts.OrganizeImports.coalesceImports(sortedImports, /*ignoreCase*/ true, ts.getSourceFileOfNode(sortedImports[0]), { organizeImportsTypeOrder: "inline" }); + const expectedCoalescedImports = parseImports(`import { a, type b, c, type x, y, type z } from "lib";`); assertListEqual(actualCoalescedImports, expectedCoalescedImports); }); diff --git a/src/testRunner/unittests/tsserver/rename.ts b/src/testRunner/unittests/tsserver/rename.ts index 6ab02ae47b7b5..c967cf05a6a5f 100644 --- a/src/testRunner/unittests/tsserver/rename.ts +++ b/src/testRunner/unittests/tsserver/rename.ts @@ -193,4 +193,23 @@ describe("unittests:: tsserver:: rename", () => { }); baselineTsserverLogs("rename", "with symlinks and case difference", session); }); + + it("rename TS file with js extension", () => { + const aTs: File = { path: "/a.ts", content: "export const a = 1;" }; + const bTs: File = { path: "/b.ts", content: `import * as foo from './a.js';` }; + + const host = createServerHost([aTs, bTs]); + const session = new TestSession(host); + openFilesForSession([aTs, bTs], session); + + session.executeCommandSeq({ + command: ts.server.protocol.CommandTypes.Configure, + arguments: { preferences: { allowRenameOfImportPath: true } }, + }); + session.executeCommandSeq({ + command: ts.server.protocol.CommandTypes.Rename, + arguments: protocolFileLocationFromSubstring(bTs, "a.js"), + }); + baselineTsserverLogs("rename", "rename TS file with js extension", session); + }); }); diff --git a/tests/baselines/reference/allowJsCrossMonorepoPackage.symbols b/tests/baselines/reference/allowJsCrossMonorepoPackage.symbols new file mode 100644 index 0000000000000..dbdc37a135b01 --- /dev/null +++ b/tests/baselines/reference/allowJsCrossMonorepoPackage.symbols @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/allowJsCrossMonorepoPackage.ts] //// + +=== /packages/main/index.ts === +import { x } from "shared"; +>x : Symbol(x, Decl(index.ts, 0, 8)) + +=== /node_modules/pkg/index.d.ts === +export declare function pkg(): "pkg"; +>pkg : Symbol(pkg, Decl(index.d.ts, 0, 0)) + +=== /packages/shared/utils.js === +export { pkg } from "pkg"; +>pkg : Symbol(pkg, Decl(utils.js, 0, 8)) + +=== /packages/shared/index.js === +import { pkg } from "./utils.js"; +>pkg : Symbol(pkg, Decl(index.js, 0, 8)) + +export const x = pkg(); +>x : Symbol(x, Decl(index.js, 1, 12)) +>pkg : Symbol(pkg, Decl(index.js, 0, 8)) + diff --git a/tests/baselines/reference/allowJsCrossMonorepoPackage.trace.json b/tests/baselines/reference/allowJsCrossMonorepoPackage.trace.json new file mode 100644 index 0000000000000..17b86da7c4b24 --- /dev/null +++ b/tests/baselines/reference/allowJsCrossMonorepoPackage.trace.json @@ -0,0 +1,159 @@ +[ + "======== Resolving module 'shared' from '/packages/main/index.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Found 'package.json' at '/packages/main/package.json'.", + "Loading module 'shared' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Found 'package.json' at '/packages/main/node_modules/shared/package.json'.", + "Using 'exports' subpath '.' with target './index.js'.", + "File name '/packages/main/node_modules/shared/index.js' has a '.js' extension - stripping it.", + "File '/packages/main/node_modules/shared/index.ts' does not exist.", + "File '/packages/main/node_modules/shared/index.tsx' does not exist.", + "File '/packages/main/node_modules/shared/index.d.ts' does not exist.", + "Directory '/packages/main/node_modules/@types' does not exist, skipping all lookups in it.", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "File '/node_modules/shared.ts' does not exist.", + "File '/node_modules/shared.tsx' does not exist.", + "File '/node_modules/shared.d.ts' does not exist.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript, JSON.", + "File '/packages/main/node_modules/shared/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath '.' with target './index.js'.", + "File name '/packages/main/node_modules/shared/index.js' has a '.js' extension - stripping it.", + "File '/packages/main/node_modules/shared/index.js' exists - use it as a name resolution result.", + "Resolution of non-relative name failed; trying with modern Node resolution features disabled to see if npm library needs configuration update.", + "File '/packages/main/package.json' exists according to earlier cached lookups.", + "Loading module 'shared' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/packages/main/node_modules/shared/package.json' exists according to earlier cached lookups.", + "File '/packages/main/node_modules/shared.ts' does not exist.", + "File '/packages/main/node_modules/shared.tsx' does not exist.", + "File '/packages/main/node_modules/shared.d.ts' does not exist.", + "'package.json' does not have a 'typesVersions' field.", + "'package.json' does not have a 'typings' field.", + "'package.json' does not have a 'types' field.", + "'package.json' does not have a 'main' field.", + "File '/packages/main/node_modules/shared/index.ts' does not exist.", + "File '/packages/main/node_modules/shared/index.tsx' does not exist.", + "File '/packages/main/node_modules/shared/index.d.ts' does not exist.", + "Directory '/packages/main/node_modules/@types' does not exist, skipping all lookups in it.", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "File '/node_modules/shared.ts' does not exist.", + "File '/node_modules/shared.tsx' does not exist.", + "File '/node_modules/shared.d.ts' does not exist.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Resolving real path for '/packages/main/node_modules/shared/index.js', result '/packages/shared/index.js'.", + "======== Module name 'shared' was successfully resolved to '/packages/shared/index.js' with Package ID 'shared/index.js@1.0.0'. ========", + "======== Resolving module './utils.js' from '/packages/shared/index.js'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Loading module as file / folder, candidate module location '/packages/shared/utils.js', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File name '/packages/shared/utils.js' has a '.js' extension - stripping it.", + "File '/packages/shared/utils.ts' does not exist.", + "File '/packages/shared/utils.tsx' does not exist.", + "File '/packages/shared/utils.d.ts' does not exist.", + "File '/packages/shared/utils.js' exists - use it as a name resolution result.", + "======== Module name './utils.js' was successfully resolved to '/packages/shared/utils.js'. ========", + "======== Resolving module 'pkg' from '/packages/shared/utils.js'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Found 'package.json' at '/packages/shared/package.json'.", + "Loading module 'pkg' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/packages/shared/node_modules' does not exist, skipping all lookups in it.", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "File '/node_modules/pkg/package.json' does not exist.", + "File '/node_modules/pkg.ts' does not exist.", + "File '/node_modules/pkg.tsx' does not exist.", + "File '/node_modules/pkg.d.ts' does not exist.", + "File '/node_modules/pkg/index.ts' does not exist.", + "File '/node_modules/pkg/index.tsx' does not exist.", + "File '/node_modules/pkg/index.d.ts' exists - use it as a name resolution result.", + "Resolving real path for '/node_modules/pkg/index.d.ts', result '/node_modules/pkg/index.d.ts'.", + "======== Module name 'pkg' was successfully resolved to '/node_modules/pkg/index.d.ts'. ========", + "======== Resolving module '@typescript/lib-es5' from '/packages/main/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/packages/main/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es5' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators' from '/packages/main/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/packages/main/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators/legacy' from '/packages/main/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/packages/main/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom' from '/packages/main/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/packages/main/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom' was not resolved. ========", + "======== Resolving module '@typescript/lib-webworker/importscripts' from '/packages/main/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/packages/main/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "======== Resolving module '@typescript/lib-scripthost' from '/packages/main/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/packages/main/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/packages/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-scripthost' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/allowJsCrossMonorepoPackage.types b/tests/baselines/reference/allowJsCrossMonorepoPackage.types new file mode 100644 index 0000000000000..8a0ecbf103606 --- /dev/null +++ b/tests/baselines/reference/allowJsCrossMonorepoPackage.types @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/allowJsCrossMonorepoPackage.ts] //// + +=== /packages/main/index.ts === +import { x } from "shared"; +>x : "pkg" + +=== /node_modules/pkg/index.d.ts === +export declare function pkg(): "pkg"; +>pkg : () => "pkg" + +=== /packages/shared/utils.js === +export { pkg } from "pkg"; +>pkg : () => "pkg" + +=== /packages/shared/index.js === +import { pkg } from "./utils.js"; +>pkg : () => "pkg" + +export const x = pkg(); +>x : "pkg" +>pkg() : "pkg" +>pkg : () => "pkg" + diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 450444f4cc7af..fe1a414ef6f51 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1087,6 +1087,7 @@ declare namespace ts { displayName: string; /** * Full display name of item to be renamed. + * If item to be renamed is a file, then this is the original text of the module specifer */ fullDisplayName: string; /** @@ -2932,6 +2933,13 @@ declare namespace ts { * Default: `false` */ readonly organizeImportsCaseFirst?: "upper" | "lower" | false; + /** + * Indicates where named type-only imports should sort. "inline" sorts named imports without regard to if the import is + * type-only. + * + * Default: `last` + */ + readonly organizeImportsTypeOrder?: "last" | "first" | "inline"; /** * Indicates whether {@link ReferencesResponseItem.lineText} is supported. */ @@ -6831,6 +6839,20 @@ declare namespace ts { * is `never`. Instead, use `type.flags & TypeFlags.Never`. */ getNeverType(): Type; + /** + * Returns true if the "source" type is assignable to the "target" type. + * + * ```ts + * declare const abcLiteral: ts.Type; // Type of "abc" + * declare const stringType: ts.Type; // Type of string + * + * isTypeAssignableTo(abcLiteral, abcLiteral); // true; "abc" is assignable to "abc" + * isTypeAssignableTo(abcLiteral, stringType); // true; "abc" is assignable to string + * isTypeAssignableTo(stringType, abcLiteral); // false; string is not assignable to "abc" + * isTypeAssignableTo(stringType, stringType); // true; string is assignable to string + * ``` + */ + isTypeAssignableTo(source: Type, target: Type): boolean; /** * True if this type is the `Array` or `ReadonlyArray` type from lib.d.ts. * This function will _not_ return true if passed a type which @@ -8769,6 +8791,7 @@ declare namespace ts { readonly organizeImportsNumericCollation?: boolean; readonly organizeImportsAccentCollation?: boolean; readonly organizeImportsCaseFirst?: "upper" | "lower" | false; + readonly organizeImportsTypeOrder?: "first" | "last" | "inline"; readonly excludeLibrarySymbolsInNavTo?: boolean; } /** Represents a bigint literal value without requiring bigint support */ @@ -9899,13 +9922,13 @@ declare namespace ts { * A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the * `options` parameter. * - * @param fileName The normalized absolute path to check the format of (it need not exist on disk) + * @param fileName The file name to check the format of (it need not exist on disk) * @param [packageJsonInfoCache] A cache for package file lookups - it's best to have a cache when this function is called often * @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data * @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution` * @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format */ - function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode; + function getImpliedNodeFormatForFile(fileName: string, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode; /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' * that represent a compilation unit. @@ -11092,6 +11115,10 @@ declare namespace ts { */ fileToRename?: string; displayName: string; + /** + * Full display name of item to be renamed. + * If item to be renamed is a file, then this is the original text of the module specifer + */ fullDisplayName: string; kind: ScriptElementKind; kindModifiers: string; diff --git a/tests/baselines/reference/callHierarchyClassPropertyArrowFunction.callHierarchy.txt b/tests/baselines/reference/callHierarchyClassPropertyArrowFunction.callHierarchy.txt new file mode 100644 index 0000000000000..fbd7144cb46c0 --- /dev/null +++ b/tests/baselines/reference/callHierarchyClassPropertyArrowFunction.callHierarchy.txt @@ -0,0 +1,44 @@ +// === Call Hierarchy === +╭ name: callee +├ kind: function +├ containerName: C +├ file: /tests/cases/fourslash/callHierarchyClassPropertyArrowFunction.ts +├ span: +│ ╭ /tests/cases/fourslash/callHierarchyClassPropertyArrowFunction.ts:6:14-7:6 +│ │ 6: callee = () => { +│ │ ^^^^^^^ +│ │ 7: } +│ │ ^^^^^ +│ ╰ +├ selectionSpan: +│ ╭ /tests/cases/fourslash/callHierarchyClassPropertyArrowFunction.ts:6:5-6:11 +│ │ 6: callee = () => { +│ │ ^^^^^^ +│ ╰ +├ incoming: +│ ╭ from: +│ │ ╭ name: caller +│ │ ├ kind: function +│ │ ├ containerName: C +│ │ ├ file: /tests/cases/fourslash/callHierarchyClassPropertyArrowFunction.ts +│ │ ├ span: +│ │ │ ╭ /tests/cases/fourslash/callHierarchyClassPropertyArrowFunction.ts:2:14-4:6 +│ │ │ │ 2: caller = () => { +│ │ │ │ ^^^^^^^ +│ │ │ │ 3: this.callee(); +│ │ │ │ ^^^^^^^^^^^^^^^^^^^^^^ +│ │ │ │ 4: } +│ │ │ │ ^^^^^ +│ │ │ ╰ +│ │ ├ selectionSpan: +│ │ │ ╭ /tests/cases/fourslash/callHierarchyClassPropertyArrowFunction.ts:2:5-2:11 +│ │ │ │ 2: caller = () => { +│ │ │ │ ^^^^^^ +│ │ │ ╰ +│ │ ╰ incoming: none +│ ├ fromSpans: +│ │ ╭ /tests/cases/fourslash/callHierarchyClassPropertyArrowFunction.ts:3:14-3:20 +│ │ │ 3: this.callee(); +│ │ │ ^^^^^^ +│ ╰ ╰ +╰ outgoing: none diff --git a/tests/baselines/reference/commentEmitOnParenthesizedAssertionInReturnStatement.js b/tests/baselines/reference/commentEmitOnParenthesizedAssertionInReturnStatement.js new file mode 100644 index 0000000000000..bf3d947dca0fc --- /dev/null +++ b/tests/baselines/reference/commentEmitOnParenthesizedAssertionInReturnStatement.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/commentEmitOnParenthesizedAssertionInReturnStatement.ts] //// + +//// [commentEmitOnParenthesizedAssertionInReturnStatement.ts] +export class Foo { + client = { + getThing: () => Promise.resolve('') + } + + foo(): Promise { + return ( + /* TODO: Avoid using type assertions, please refactor. */ this.client + .getThing() as unknown as Promise + ); + } +} + + +//// [commentEmitOnParenthesizedAssertionInReturnStatement.js] +export class Foo { + client = { + getThing: () => Promise.resolve('') + }; + foo() { + return ( + /* TODO: Avoid using type assertions, please refactor. */ this.client + .getThing()); + } +} diff --git a/tests/baselines/reference/commentEmitOnParenthesizedAssertionInReturnStatement.symbols b/tests/baselines/reference/commentEmitOnParenthesizedAssertionInReturnStatement.symbols new file mode 100644 index 0000000000000..0a0b1f2d68de0 --- /dev/null +++ b/tests/baselines/reference/commentEmitOnParenthesizedAssertionInReturnStatement.symbols @@ -0,0 +1,35 @@ +//// [tests/cases/compiler/commentEmitOnParenthesizedAssertionInReturnStatement.ts] //// + +=== commentEmitOnParenthesizedAssertionInReturnStatement.ts === +export class Foo { +>Foo : Symbol(Foo, Decl(commentEmitOnParenthesizedAssertionInReturnStatement.ts, 0, 0)) + + client = { +>client : Symbol(Foo.client, Decl(commentEmitOnParenthesizedAssertionInReturnStatement.ts, 0, 18)) + + getThing: () => Promise.resolve('') +>getThing : Symbol(getThing, Decl(commentEmitOnParenthesizedAssertionInReturnStatement.ts, 1, 12)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + } + + foo(): Promise { +>foo : Symbol(Foo.foo, Decl(commentEmitOnParenthesizedAssertionInReturnStatement.ts, 3, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) + + return ( + /* TODO: Avoid using type assertions, please refactor. */ this.client +>this.client .getThing : Symbol(getThing, Decl(commentEmitOnParenthesizedAssertionInReturnStatement.ts, 1, 12)) +>this.client : Symbol(Foo.client, Decl(commentEmitOnParenthesizedAssertionInReturnStatement.ts, 0, 18)) +>this : Symbol(Foo, Decl(commentEmitOnParenthesizedAssertionInReturnStatement.ts, 0, 0)) +>client : Symbol(Foo.client, Decl(commentEmitOnParenthesizedAssertionInReturnStatement.ts, 0, 18)) + + .getThing() as unknown as Promise +>getThing : Symbol(getThing, Decl(commentEmitOnParenthesizedAssertionInReturnStatement.ts, 1, 12)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) + + ); + } +} + diff --git a/tests/baselines/reference/commentEmitOnParenthesizedAssertionInReturnStatement.types b/tests/baselines/reference/commentEmitOnParenthesizedAssertionInReturnStatement.types new file mode 100644 index 0000000000000..433932a4d9139 --- /dev/null +++ b/tests/baselines/reference/commentEmitOnParenthesizedAssertionInReturnStatement.types @@ -0,0 +1,42 @@ +//// [tests/cases/compiler/commentEmitOnParenthesizedAssertionInReturnStatement.ts] //// + +=== commentEmitOnParenthesizedAssertionInReturnStatement.ts === +export class Foo { +>Foo : Foo + + client = { +>client : { getThing: () => Promise; } +>{ getThing: () => Promise.resolve('') } : { getThing: () => Promise; } + + getThing: () => Promise.resolve('') +>getThing : () => Promise +>() => Promise.resolve('') : () => Promise +>Promise.resolve('') : Promise +>Promise.resolve : { (): Promise; (value: T): Promise>; (value: T_1 | PromiseLike): Promise>; } +>Promise : PromiseConstructor +>resolve : { (): Promise; (value: T): Promise>; (value: T_1 | PromiseLike): Promise>; } +>'' : "" + } + + foo(): Promise { +>foo : () => Promise + + return ( +>( /* TODO: Avoid using type assertions, please refactor. */ this.client .getThing() as unknown as Promise ) : Promise + + /* TODO: Avoid using type assertions, please refactor. */ this.client +>this.client .getThing() as unknown as Promise : Promise +>this.client .getThing() as unknown : unknown +>this.client .getThing() : Promise +>this.client .getThing : () => Promise +>this.client : { getThing: () => Promise; } +>this : this +>client : { getThing: () => Promise; } + + .getThing() as unknown as Promise +>getThing : () => Promise + + ); + } +} + diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js index 861ee1c19e548..68ab2d4176968 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: es7,0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js index 88eeb66c96a85..0e0b1480091fe 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: es7,0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js index 13eb3c36e402d..6942908118197 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: 0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with json api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with json api.js index 1587cd7b042ac..a5bb63eac24d9 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with json api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with json api.js @@ -30,5 +30,5 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with jsonSourceFile api.js index adc918672fcdd..18a774c865aa2 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with jsonSourceFile api.js @@ -30,7 +30,7 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -tsconfig.json:8:7 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +tsconfig.json:8:7 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. 8 ""    ~~ diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with json api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with json api.js index 431cadf048ea1..36d03b9fb774b 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with json api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with json api.js @@ -33,5 +33,5 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with jsonSourceFile api.js index cffd9b9d5aaea..089cd767e35d0 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with jsonSourceFile api.js @@ -33,7 +33,7 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -tsconfig.json:9:7 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +tsconfig.json:9:7 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. 9 ""    ~~ diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with json api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with json api.js index 12f6fd0d7bbc5..b1087ce9efa20 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with json api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with json api.js @@ -35,5 +35,5 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with jsonSourceFile api.js index eea74a169262f..50369fce5d9ac 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with jsonSourceFile api.js @@ -35,7 +35,7 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -tsconfig.json:10:7 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +tsconfig.json:10:7 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. 10 "incorrectLib"    ~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with json api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with json api.js index c9397df479ab2..8b7433122f6b7 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with json api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with json api.js @@ -30,5 +30,5 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with jsonSourceFile api.js index d4ebbca1e2805..1d680893a6bbf 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with jsonSourceFile api.js @@ -30,7 +30,7 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -tsconfig.json:8:7 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. +tsconfig.json:8:7 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'. 8 " "    ~~~~~ diff --git a/tests/baselines/reference/config/showConfig/Show TSConfig with compileOnSave and more/tsconfig.json b/tests/baselines/reference/config/showConfig/Show TSConfig with compileOnSave and more/tsconfig.json index 373e81d1f75f3..27dff8d0b2c57 100644 --- a/tests/baselines/reference/config/showConfig/Show TSConfig with compileOnSave and more/tsconfig.json +++ b/tests/baselines/reference/config/showConfig/Show TSConfig with compileOnSave and more/tsconfig.json @@ -3,7 +3,16 @@ "esModuleInterop": true, "target": "es5", "module": "commonjs", - "strict": true + "strict": true, + "allowSyntheticDefaultImports": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "strictBindCallApply": true, + "strictPropertyInitialization": true, + "alwaysStrict": true, + "useUnknownInCatchVariables": true }, "references": [ { diff --git a/tests/baselines/reference/config/showConfig/Show TSConfig with paths and more/tsconfig.json b/tests/baselines/reference/config/showConfig/Show TSConfig with paths and more/tsconfig.json index 30bcbb4fdd08b..28b3bd38f3d6c 100644 --- a/tests/baselines/reference/config/showConfig/Show TSConfig with paths and more/tsconfig.json +++ b/tests/baselines/reference/config/showConfig/Show TSConfig with paths and more/tsconfig.json @@ -25,7 +25,8 @@ }, "experimentalDecorators": true, "emitDecoratorMetadata": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true }, "include": [ "./src/**/*" diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/checkJs/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/checkJs/tsconfig.json index 21d7a1d2268bf..5e4dbf3f63b2a 100644 --- a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/checkJs/tsconfig.json +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/checkJs/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { - "checkJs": true + "checkJs": true, + "allowJs": true } } diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/composite/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/composite/tsconfig.json index 664df5f6051d5..67f3febd08537 100644 --- a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/composite/tsconfig.json +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/composite/tsconfig.json @@ -1,5 +1,7 @@ { "compilerOptions": { - "composite": true + "composite": true, + "declaration": true, + "incremental": true } } diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/isolatedModules/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/isolatedModules/tsconfig.json index 78df38c543900..8c42fc0fc0eaa 100644 --- a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/isolatedModules/tsconfig.json +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/isolatedModules/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { - "isolatedModules": true + "isolatedModules": true, + "preserveConstEnums": true } } diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/module/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/module/tsconfig.json index e7f1c93b4ccb7..6bd841bcf3291 100644 --- a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/module/tsconfig.json +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/module/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { - "module": "none" + "module": "none", + "moduleResolution": "classic" } } diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/strict/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/strict/tsconfig.json index 8dc142972f830..a94c9ac06ee71 100644 --- a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/strict/tsconfig.json +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/strict/tsconfig.json @@ -1,5 +1,13 @@ { "compilerOptions": { - "strict": true + "strict": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "strictBindCallApply": true, + "strictPropertyInitialization": true, + "alwaysStrict": true, + "useUnknownInCatchVariables": true } } diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/verbatimModuleSyntax/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/verbatimModuleSyntax/tsconfig.json index 5e2760d642d02..33dd85cb767d5 100644 --- a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/verbatimModuleSyntax/tsconfig.json +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/verbatimModuleSyntax/tsconfig.json @@ -1,5 +1,7 @@ { "compilerOptions": { - "verbatimModuleSyntax": true + "verbatimModuleSyntax": true, + "isolatedModules": true, + "preserveConstEnums": true } } diff --git a/tests/baselines/reference/controlFlowAliasedDiscriminants.errors.txt b/tests/baselines/reference/controlFlowAliasedDiscriminants.errors.txt index 81779d897385d..222ca0c5312b2 100644 --- a/tests/baselines/reference/controlFlowAliasedDiscriminants.errors.txt +++ b/tests/baselines/reference/controlFlowAliasedDiscriminants.errors.txt @@ -126,4 +126,14 @@ controlFlowAliasedDiscriminants.ts(98,19): error TS1360: Type 'string | number' resp.resp.data satisfies string; } } + + function bindingPatternInParameter({ data: data1, isSuccess: isSuccess1 }: UseQueryResult) { + const { data: data2, isSuccess: isSuccess2 } = useQuery(); + + const areSuccess = isSuccess1 && isSuccess2; + if (areSuccess) { + data1.toExponential(); + data2.toExponential(); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/controlFlowAliasedDiscriminants.js b/tests/baselines/reference/controlFlowAliasedDiscriminants.js index 0be7340f29f63..b848d5efca86e 100644 --- a/tests/baselines/reference/controlFlowAliasedDiscriminants.js +++ b/tests/baselines/reference/controlFlowAliasedDiscriminants.js @@ -104,9 +104,20 @@ type Nested = { resp.resp.data satisfies string; } } + +function bindingPatternInParameter({ data: data1, isSuccess: isSuccess1 }: UseQueryResult) { + const { data: data2, isSuccess: isSuccess2 } = useQuery(); + + const areSuccess = isSuccess1 && isSuccess2; + if (areSuccess) { + data1.toExponential(); + data2.toExponential(); + } +} //// [controlFlowAliasedDiscriminants.js] +"use strict"; function useQuery() { return { isSuccess: false, @@ -180,3 +191,12 @@ if (areSuccess) { resp.resp.data; } } +function bindingPatternInParameter(_a) { + var data1 = _a.data, isSuccess1 = _a.isSuccess; + var _b = useQuery(), data2 = _b.data, isSuccess2 = _b.isSuccess; + var areSuccess = isSuccess1 && isSuccess2; + if (areSuccess) { + data1.toExponential(); + data2.toExponential(); + } +} diff --git a/tests/baselines/reference/controlFlowAliasedDiscriminants.symbols b/tests/baselines/reference/controlFlowAliasedDiscriminants.symbols index 971b4be1c5c73..fab75c2bd92c2 100644 --- a/tests/baselines/reference/controlFlowAliasedDiscriminants.symbols +++ b/tests/baselines/reference/controlFlowAliasedDiscriminants.symbols @@ -325,3 +325,38 @@ type Nested = { } } +function bindingPatternInParameter({ data: data1, isSuccess: isSuccess1 }: UseQueryResult) { +>bindingPatternInParameter : Symbol(bindingPatternInParameter, Decl(controlFlowAliasedDiscriminants.ts, 102, 1)) +>data : Symbol(data, Decl(controlFlowAliasedDiscriminants.ts, 1, 21), Decl(controlFlowAliasedDiscriminants.ts, 4, 20)) +>data1 : Symbol(data1, Decl(controlFlowAliasedDiscriminants.ts, 104, 36)) +>isSuccess : Symbol(isSuccess, Decl(controlFlowAliasedDiscriminants.ts, 0, 26), Decl(controlFlowAliasedDiscriminants.ts, 3, 5)) +>isSuccess1 : Symbol(isSuccess1, Decl(controlFlowAliasedDiscriminants.ts, 104, 49)) +>UseQueryResult : Symbol(UseQueryResult, Decl(controlFlowAliasedDiscriminants.ts, 0, 0)) + + const { data: data2, isSuccess: isSuccess2 } = useQuery(); +>data : Symbol(data, Decl(controlFlowAliasedDiscriminants.ts, 1, 21), Decl(controlFlowAliasedDiscriminants.ts, 4, 20)) +>data2 : Symbol(data2, Decl(controlFlowAliasedDiscriminants.ts, 105, 9)) +>isSuccess : Symbol(isSuccess, Decl(controlFlowAliasedDiscriminants.ts, 0, 26), Decl(controlFlowAliasedDiscriminants.ts, 3, 5)) +>isSuccess2 : Symbol(isSuccess2, Decl(controlFlowAliasedDiscriminants.ts, 105, 22)) +>useQuery : Symbol(useQuery, Decl(controlFlowAliasedDiscriminants.ts, 6, 2)) + + const areSuccess = isSuccess1 && isSuccess2; +>areSuccess : Symbol(areSuccess, Decl(controlFlowAliasedDiscriminants.ts, 107, 7)) +>isSuccess1 : Symbol(isSuccess1, Decl(controlFlowAliasedDiscriminants.ts, 104, 49)) +>isSuccess2 : Symbol(isSuccess2, Decl(controlFlowAliasedDiscriminants.ts, 105, 22)) + + if (areSuccess) { +>areSuccess : Symbol(areSuccess, Decl(controlFlowAliasedDiscriminants.ts, 107, 7)) + + data1.toExponential(); +>data1.toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --)) +>data1 : Symbol(data1, Decl(controlFlowAliasedDiscriminants.ts, 104, 36)) +>toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --)) + + data2.toExponential(); +>data2.toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --)) +>data2 : Symbol(data2, Decl(controlFlowAliasedDiscriminants.ts, 105, 9)) +>toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --)) + } +} + diff --git a/tests/baselines/reference/controlFlowAliasedDiscriminants.types b/tests/baselines/reference/controlFlowAliasedDiscriminants.types index 5925a680bcc89..a22e71c309a38 100644 --- a/tests/baselines/reference/controlFlowAliasedDiscriminants.types +++ b/tests/baselines/reference/controlFlowAliasedDiscriminants.types @@ -376,3 +376,41 @@ type Nested = { } } +function bindingPatternInParameter({ data: data1, isSuccess: isSuccess1 }: UseQueryResult) { +>bindingPatternInParameter : ({ data: data1, isSuccess: isSuccess1 }: UseQueryResult) => void +>data : any +>data1 : number | undefined +>isSuccess : any +>isSuccess1 : boolean + + const { data: data2, isSuccess: isSuccess2 } = useQuery(); +>data : any +>data2 : number | undefined +>isSuccess : any +>isSuccess2 : boolean +>useQuery() : UseQueryResult +>useQuery : () => UseQueryResult + + const areSuccess = isSuccess1 && isSuccess2; +>areSuccess : boolean +>isSuccess1 && isSuccess2 : boolean +>isSuccess1 : boolean +>isSuccess2 : boolean + + if (areSuccess) { +>areSuccess : boolean + + data1.toExponential(); +>data1.toExponential() : string +>data1.toExponential : (fractionDigits?: number | undefined) => string +>data1 : number +>toExponential : (fractionDigits?: number | undefined) => string + + data2.toExponential(); +>data2.toExponential() : string +>data2.toExponential : (fractionDigits?: number | undefined) => string +>data2 : number +>toExponential : (fractionDigits?: number | undefined) => string + } +} + diff --git a/tests/baselines/reference/controlFlowAliasing.errors.txt b/tests/baselines/reference/controlFlowAliasing.errors.txt index c062509c6b643..b1dcf7be43f9c 100644 --- a/tests/baselines/reference/controlFlowAliasing.errors.txt +++ b/tests/baselines/reference/controlFlowAliasing.errors.txt @@ -14,10 +14,6 @@ controlFlowAliasing.ts(112,13): error TS2339: Property 'foo' does not exist on t Property 'foo' does not exist on type '{ kind: "bar"; bar: number; }'. controlFlowAliasing.ts(115,13): error TS2339: Property 'bar' does not exist on type '{ kind: "foo"; foo: string; } | { kind: "bar"; bar: number; }'. Property 'bar' does not exist on type '{ kind: "foo"; foo: string; }'. -controlFlowAliasing.ts(134,13): error TS2339: Property 'foo' does not exist on type '{ kind: "foo"; foo: string; } | { kind: "bar"; bar: number; }'. - Property 'foo' does not exist on type '{ kind: "bar"; bar: number; }'. -controlFlowAliasing.ts(137,13): error TS2339: Property 'bar' does not exist on type '{ kind: "foo"; foo: string; } | { kind: "bar"; bar: number; }'. - Property 'bar' does not exist on type '{ kind: "foo"; foo: string; }'. controlFlowAliasing.ts(154,19): error TS2339: Property 'foo' does not exist on type '{ kind: "foo"; foo: string; } | { kind: "bar"; bar: number; }'. Property 'foo' does not exist on type '{ kind: "bar"; bar: number; }'. controlFlowAliasing.ts(157,19): error TS2339: Property 'bar' does not exist on type '{ kind: "foo"; foo: string; } | { kind: "bar"; bar: number; }'. @@ -28,7 +24,7 @@ controlFlowAliasing.ts(280,5): error TS2448: Block-scoped variable 'a' used befo controlFlowAliasing.ts(280,5): error TS2454: Variable 'a' is used before being assigned. -==== controlFlowAliasing.ts (15 errors) ==== +==== controlFlowAliasing.ts (13 errors) ==== // Narrowing by aliased conditional expressions function f10(x: string | number) { @@ -186,16 +182,10 @@ controlFlowAliasing.ts(280,5): error TS2454: Variable 'a' is used before being a let obj = arg; const isFoo = obj.kind === 'foo'; if (isFoo) { - obj.foo; // Not narrowed because obj is mutable - ~~~ -!!! error TS2339: Property 'foo' does not exist on type '{ kind: "foo"; foo: string; } | { kind: "bar"; bar: number; }'. -!!! error TS2339: Property 'foo' does not exist on type '{ kind: "bar"; bar: number; }'. + obj.foo; } else { - obj.bar; // Not narrowed because obj is mutable - ~~~ -!!! error TS2339: Property 'bar' does not exist on type '{ kind: "foo"; foo: string; } | { kind: "bar"; bar: number; }'. -!!! error TS2339: Property 'bar' does not exist on type '{ kind: "foo"; foo: string; }'. + obj.bar; } } diff --git a/tests/baselines/reference/controlFlowAliasing.js b/tests/baselines/reference/controlFlowAliasing.js index de9b8ca84b43f..a37a261e2ac58 100644 --- a/tests/baselines/reference/controlFlowAliasing.js +++ b/tests/baselines/reference/controlFlowAliasing.js @@ -134,10 +134,10 @@ function f25(arg: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) { let obj = arg; const isFoo = obj.kind === 'foo'; if (isFoo) { - obj.foo; // Not narrowed because obj is mutable + obj.foo; } else { - obj.bar; // Not narrowed because obj is mutable + obj.bar; } } @@ -423,10 +423,10 @@ function f25(arg) { var obj = arg; var isFoo = obj.kind === 'foo'; if (isFoo) { - obj.foo; // Not narrowed because obj is mutable + obj.foo; } else { - obj.bar; // Not narrowed because obj is mutable + obj.bar; } } function f26(outer) { diff --git a/tests/baselines/reference/controlFlowAliasing.symbols b/tests/baselines/reference/controlFlowAliasing.symbols index b0de1519352c4..0fc737c2828d4 100644 --- a/tests/baselines/reference/controlFlowAliasing.symbols +++ b/tests/baselines/reference/controlFlowAliasing.symbols @@ -370,12 +370,16 @@ function f25(arg: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) { if (isFoo) { >isFoo : Symbol(isFoo, Decl(controlFlowAliasing.ts, 131, 9)) - obj.foo; // Not narrowed because obj is mutable + obj.foo; +>obj.foo : Symbol(foo, Decl(controlFlowAliasing.ts, 129, 32)) >obj : Symbol(obj, Decl(controlFlowAliasing.ts, 130, 7)) +>foo : Symbol(foo, Decl(controlFlowAliasing.ts, 129, 32)) } else { - obj.bar; // Not narrowed because obj is mutable + obj.bar; +>obj.bar : Symbol(bar, Decl(controlFlowAliasing.ts, 129, 63)) >obj : Symbol(obj, Decl(controlFlowAliasing.ts, 130, 7)) +>bar : Symbol(bar, Decl(controlFlowAliasing.ts, 129, 63)) } } diff --git a/tests/baselines/reference/controlFlowAliasing.types b/tests/baselines/reference/controlFlowAliasing.types index b93de24a3aaf9..ea5ee6edf01f3 100644 --- a/tests/baselines/reference/controlFlowAliasing.types +++ b/tests/baselines/reference/controlFlowAliasing.types @@ -440,16 +440,16 @@ function f25(arg: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) { if (isFoo) { >isFoo : boolean - obj.foo; // Not narrowed because obj is mutable ->obj.foo : any ->obj : { kind: "foo"; foo: string; } | { kind: "bar"; bar: number; } ->foo : any + obj.foo; +>obj.foo : string +>obj : { kind: "foo"; foo: string; } +>foo : string } else { - obj.bar; // Not narrowed because obj is mutable ->obj.bar : any ->obj : { kind: "foo"; foo: string; } | { kind: "bar"; bar: number; } ->bar : any + obj.bar; +>obj.bar : number +>obj : { kind: "bar"; bar: number; } +>bar : number } } diff --git a/tests/baselines/reference/controlFlowElementAccessNoCrash1.symbols b/tests/baselines/reference/controlFlowElementAccessNoCrash1.symbols new file mode 100644 index 0000000000000..62a7b6f08331e --- /dev/null +++ b/tests/baselines/reference/controlFlowElementAccessNoCrash1.symbols @@ -0,0 +1,81 @@ +//// [tests/cases/conformance/controlFlow/controlFlowElementAccessNoCrash1.ts] //// + +=== controlFlowElementAccessNoCrash1.ts === +interface TestTscEdit { +>TestTscEdit : Symbol(TestTscEdit, Decl(controlFlowElementAccessNoCrash1.ts, 0, 0)) + + caption: string; +>caption : Symbol(TestTscEdit.caption, Decl(controlFlowElementAccessNoCrash1.ts, 0, 23)) + + commandLineArgs?: readonly string[]; +>commandLineArgs : Symbol(TestTscEdit.commandLineArgs, Decl(controlFlowElementAccessNoCrash1.ts, 1, 18)) +} + +interface TestTscCompile { +>TestTscCompile : Symbol(TestTscCompile, Decl(controlFlowElementAccessNoCrash1.ts, 3, 1)) + + subScenario: string; +>subScenario : Symbol(TestTscCompile.subScenario, Decl(controlFlowElementAccessNoCrash1.ts, 5, 26)) + + commandLineArgs: readonly string[]; +>commandLineArgs : Symbol(TestTscCompile.commandLineArgs, Decl(controlFlowElementAccessNoCrash1.ts, 6, 22)) +} + +interface VerifyTscEditDiscrepanciesInput { +>VerifyTscEditDiscrepanciesInput : Symbol(VerifyTscEditDiscrepanciesInput, Decl(controlFlowElementAccessNoCrash1.ts, 8, 1)) + + index: number; +>index : Symbol(VerifyTscEditDiscrepanciesInput.index, Decl(controlFlowElementAccessNoCrash1.ts, 10, 43)) + + edits: readonly TestTscEdit[]; +>edits : Symbol(VerifyTscEditDiscrepanciesInput.edits, Decl(controlFlowElementAccessNoCrash1.ts, 11, 16)) +>TestTscEdit : Symbol(TestTscEdit, Decl(controlFlowElementAccessNoCrash1.ts, 0, 0)) + + commandLineArgs: TestTscCompile["commandLineArgs"]; +>commandLineArgs : Symbol(VerifyTscEditDiscrepanciesInput.commandLineArgs, Decl(controlFlowElementAccessNoCrash1.ts, 12, 32)) +>TestTscCompile : Symbol(TestTscCompile, Decl(controlFlowElementAccessNoCrash1.ts, 3, 1)) +} + +function testTscCompile(input: TestTscCompile) {} +>testTscCompile : Symbol(testTscCompile, Decl(controlFlowElementAccessNoCrash1.ts, 14, 1)) +>input : Symbol(input, Decl(controlFlowElementAccessNoCrash1.ts, 16, 24)) +>TestTscCompile : Symbol(TestTscCompile, Decl(controlFlowElementAccessNoCrash1.ts, 3, 1)) + +function verifyTscEditDiscrepancies({ +>verifyTscEditDiscrepancies : Symbol(verifyTscEditDiscrepancies, Decl(controlFlowElementAccessNoCrash1.ts, 16, 49)) + + index, +>index : Symbol(index, Decl(controlFlowElementAccessNoCrash1.ts, 18, 37)) + + edits, +>edits : Symbol(edits, Decl(controlFlowElementAccessNoCrash1.ts, 19, 8)) + + commandLineArgs, +>commandLineArgs : Symbol(commandLineArgs, Decl(controlFlowElementAccessNoCrash1.ts, 20, 8)) + +}: VerifyTscEditDiscrepanciesInput) { +>VerifyTscEditDiscrepanciesInput : Symbol(VerifyTscEditDiscrepanciesInput, Decl(controlFlowElementAccessNoCrash1.ts, 8, 1)) + + const { caption } = edits[index]; +>caption : Symbol(caption, Decl(controlFlowElementAccessNoCrash1.ts, 23, 9)) +>edits : Symbol(edits, Decl(controlFlowElementAccessNoCrash1.ts, 19, 8)) +>index : Symbol(index, Decl(controlFlowElementAccessNoCrash1.ts, 18, 37)) + + testTscCompile({ +>testTscCompile : Symbol(testTscCompile, Decl(controlFlowElementAccessNoCrash1.ts, 14, 1)) + + subScenario: caption, +>subScenario : Symbol(subScenario, Decl(controlFlowElementAccessNoCrash1.ts, 24, 18)) +>caption : Symbol(caption, Decl(controlFlowElementAccessNoCrash1.ts, 23, 9)) + + commandLineArgs: edits[index].commandLineArgs || commandLineArgs, +>commandLineArgs : Symbol(commandLineArgs, Decl(controlFlowElementAccessNoCrash1.ts, 25, 25)) +>edits[index].commandLineArgs : Symbol(TestTscEdit.commandLineArgs, Decl(controlFlowElementAccessNoCrash1.ts, 1, 18)) +>edits : Symbol(edits, Decl(controlFlowElementAccessNoCrash1.ts, 19, 8)) +>index : Symbol(index, Decl(controlFlowElementAccessNoCrash1.ts, 18, 37)) +>commandLineArgs : Symbol(TestTscEdit.commandLineArgs, Decl(controlFlowElementAccessNoCrash1.ts, 1, 18)) +>commandLineArgs : Symbol(commandLineArgs, Decl(controlFlowElementAccessNoCrash1.ts, 20, 8)) + + }); +} + diff --git a/tests/baselines/reference/controlFlowElementAccessNoCrash1.types b/tests/baselines/reference/controlFlowElementAccessNoCrash1.types new file mode 100644 index 0000000000000..29098ea2c1ddb --- /dev/null +++ b/tests/baselines/reference/controlFlowElementAccessNoCrash1.types @@ -0,0 +1,75 @@ +//// [tests/cases/conformance/controlFlow/controlFlowElementAccessNoCrash1.ts] //// + +=== controlFlowElementAccessNoCrash1.ts === +interface TestTscEdit { + caption: string; +>caption : string + + commandLineArgs?: readonly string[]; +>commandLineArgs : readonly string[] | undefined +} + +interface TestTscCompile { + subScenario: string; +>subScenario : string + + commandLineArgs: readonly string[]; +>commandLineArgs : readonly string[] +} + +interface VerifyTscEditDiscrepanciesInput { + index: number; +>index : number + + edits: readonly TestTscEdit[]; +>edits : readonly TestTscEdit[] + + commandLineArgs: TestTscCompile["commandLineArgs"]; +>commandLineArgs : readonly string[] +} + +function testTscCompile(input: TestTscCompile) {} +>testTscCompile : (input: TestTscCompile) => void +>input : TestTscCompile + +function verifyTscEditDiscrepancies({ +>verifyTscEditDiscrepancies : ({ index, edits, commandLineArgs, }: VerifyTscEditDiscrepanciesInput) => void + + index, +>index : number + + edits, +>edits : readonly TestTscEdit[] + + commandLineArgs, +>commandLineArgs : readonly string[] + +}: VerifyTscEditDiscrepanciesInput) { + const { caption } = edits[index]; +>caption : string +>edits[index] : TestTscEdit +>edits : readonly TestTscEdit[] +>index : number + + testTscCompile({ +>testTscCompile({ subScenario: caption, commandLineArgs: edits[index].commandLineArgs || commandLineArgs, }) : void +>testTscCompile : (input: TestTscCompile) => void +>{ subScenario: caption, commandLineArgs: edits[index].commandLineArgs || commandLineArgs, } : { subScenario: string; commandLineArgs: readonly string[]; } + + subScenario: caption, +>subScenario : string +>caption : string + + commandLineArgs: edits[index].commandLineArgs || commandLineArgs, +>commandLineArgs : readonly string[] +>edits[index].commandLineArgs || commandLineArgs : readonly string[] +>edits[index].commandLineArgs : readonly string[] | undefined +>edits[index] : TestTscEdit +>edits : readonly TestTscEdit[] +>index : number +>commandLineArgs : readonly string[] | undefined +>commandLineArgs : readonly string[] + + }); +} + diff --git a/tests/baselines/reference/declFileForExportedImport.js b/tests/baselines/reference/declFileForExportedImport.js index 38f991e0dad41..e1c25c7eac8d0 100644 --- a/tests/baselines/reference/declFileForExportedImport.js +++ b/tests/baselines/reference/declFileForExportedImport.js @@ -29,6 +29,5 @@ var z = exports.b.x; //// [declFileForExportedImport_0.d.ts] export declare var x: number; //// [declFileForExportedImport_1.d.ts] -/// export import a = require('./declFileForExportedImport_0'); export import b = a; diff --git a/tests/baselines/reference/declarationEmitBindingPatternsUnused.errors.txt b/tests/baselines/reference/declarationEmitBindingPatternsUnused.errors.txt new file mode 100644 index 0000000000000..84bfe180d0084 --- /dev/null +++ b/tests/baselines/reference/declarationEmitBindingPatternsUnused.errors.txt @@ -0,0 +1,132 @@ +declarationEmitBindingPatternsUnused.ts(85,35): error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? +declarationEmitBindingPatternsUnused.ts(89,41): error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? +declarationEmitBindingPatternsUnused.ts(95,11): error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? +declarationEmitBindingPatternsUnused.ts(96,15): error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? +declarationEmitBindingPatternsUnused.ts(97,16): error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? +declarationEmitBindingPatternsUnused.ts(98,12): error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? + + +==== declarationEmitBindingPatternsUnused.ts (6 errors) ==== + type Named = { name: string } + function notReferenced({ name: alias }: Named) { + + } + function notReferencedNestedAlias({ p: { name: alias } }: { p: Named }) { + } + function notReferencedArrayAlias([a, b, { name: alias }]: Named[]) { + } + + + + function referencedInCode({ name: alias }: Named) { + return alias; + } + + function referencedInSignarture({ name: alias }: Named): typeof alias { + return alias; + } + + function referencedInSignartureKeyword({ function: alias }: { function: string }): typeof alias { + return null!; + } + + function referencedInInferredType({ name: alias }: Named) { + type Named2 = { name: typeof alias } + return null! as Named2 + } + + function referencedInNestedFunction({ name: alias }: Named) { + return function(p: typeof alias) { + + } + } + + function referencedNestedAlias({ p: { name: alias } }: { p: Named }): typeof alias { + return alias; + } + + function referencedArrayAlias([a, b, { name: alias }]: Named[]): typeof alias { + return alias; + } + + + class NotReferencedClass { + constructor({ name: alias }: Named) { + } + set x({ name: alias }: Named) { + console.log(alias); + } + m({ name: alias }: Named) { + console.log(alias); + } + } + + class ReferencedInCodeClas { + constructor({ name: alias }: Named) { + console.log(alias); + } + set x({ name: alias }: Named) { + console.log(alias); + } + m({ name: alias }: Named) { + console.log(alias); + } + } + + class ReferencedInSignartureClass { + constructor({ name: alias }: Named, p: typeof alias) { + console.log(alias); + } + set x({ name: alias }: Named & { o: typeof alias }) { + + } + mReturnType({ name: alias }: Named): typeof alias { + return null! + } + mRerturnTypeNested({ name: alias }: Named): NonNullable { + return null! + } + mParameter({ name: alias }: Named, p: typeof alias) { + return null! + } + } + + let notReferencedFnType: ({ name: alias }: Named) => void; + ~~~~~ +!!! error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? + let referencedInSignartureReturnTypeFnType: ({ name: alias }: Named) => typeof alias; + let referencedInSignartureParamTypeFnType: ({ name: alias }: Named, p: typeof alias) => void; + + let notReferencedCtorType: new ({ name: alias }: Named) => void; + ~~~~~ +!!! error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? + let referencedInSignartureReturnTypeCtorType: new ({ name: alias }: Named) => typeof alias; + let referencedInSignartureParamTypeCtorType: new ({ name: alias }: Named, p: typeof alias) => void; + + + interface NotReferencedInterface { + ({ name: alias }: Named): void + ~~~~~ +!!! error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? + new ({ name: alias }: Named): void + ~~~~~ +!!! error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? + set x({ name: alias }: Named); + ~~~~~ +!!! error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? + m({ name: alias }: Named); + ~~~~~ +!!! error TS2842: 'alias' is an unused renaming of 'name'. Did you intend to use it as a type annotation? + } + + interface ReferencedInSignartureInterface { + ({ name: alias }: Named, p: typeof alias): void + ({ name: alias }: Named): typeof alias + + new ({ name: alias }: Named, p: typeof alias): void + new ({ name: alias }: Named): typeof alias + set x({ name: alias }: Named & { o: typeof alias }) + mReturnType({ name: alias }: Named): typeof alias; + mRerturnTypeNested({ name: alias }: Named): NonNullable; + mParameter({ name: alias }: Named, p: typeof alias); + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitBindingPatternsUnused.js b/tests/baselines/reference/declarationEmitBindingPatternsUnused.js new file mode 100644 index 0000000000000..79c2ea8520b8b --- /dev/null +++ b/tests/baselines/reference/declarationEmitBindingPatternsUnused.js @@ -0,0 +1,254 @@ +//// [tests/cases/compiler/declarationEmitBindingPatternsUnused.ts] //// + +//// [declarationEmitBindingPatternsUnused.ts] +type Named = { name: string } +function notReferenced({ name: alias }: Named) { + +} +function notReferencedNestedAlias({ p: { name: alias } }: { p: Named }) { +} +function notReferencedArrayAlias([a, b, { name: alias }]: Named[]) { +} + + + +function referencedInCode({ name: alias }: Named) { + return alias; +} + +function referencedInSignarture({ name: alias }: Named): typeof alias { + return alias; +} + +function referencedInSignartureKeyword({ function: alias }: { function: string }): typeof alias { + return null!; +} + +function referencedInInferredType({ name: alias }: Named) { + type Named2 = { name: typeof alias } + return null! as Named2 +} + +function referencedInNestedFunction({ name: alias }: Named) { + return function(p: typeof alias) { + + } +} + +function referencedNestedAlias({ p: { name: alias } }: { p: Named }): typeof alias { + return alias; +} + +function referencedArrayAlias([a, b, { name: alias }]: Named[]): typeof alias { + return alias; +} + + +class NotReferencedClass { + constructor({ name: alias }: Named) { + } + set x({ name: alias }: Named) { + console.log(alias); + } + m({ name: alias }: Named) { + console.log(alias); + } +} + +class ReferencedInCodeClas { + constructor({ name: alias }: Named) { + console.log(alias); + } + set x({ name: alias }: Named) { + console.log(alias); + } + m({ name: alias }: Named) { + console.log(alias); + } +} + +class ReferencedInSignartureClass { + constructor({ name: alias }: Named, p: typeof alias) { + console.log(alias); + } + set x({ name: alias }: Named & { o: typeof alias }) { + + } + mReturnType({ name: alias }: Named): typeof alias { + return null! + } + mRerturnTypeNested({ name: alias }: Named): NonNullable { + return null! + } + mParameter({ name: alias }: Named, p: typeof alias) { + return null! + } +} + +let notReferencedFnType: ({ name: alias }: Named) => void; +let referencedInSignartureReturnTypeFnType: ({ name: alias }: Named) => typeof alias; +let referencedInSignartureParamTypeFnType: ({ name: alias }: Named, p: typeof alias) => void; + +let notReferencedCtorType: new ({ name: alias }: Named) => void; +let referencedInSignartureReturnTypeCtorType: new ({ name: alias }: Named) => typeof alias; +let referencedInSignartureParamTypeCtorType: new ({ name: alias }: Named, p: typeof alias) => void; + + +interface NotReferencedInterface { + ({ name: alias }: Named): void + new ({ name: alias }: Named): void + set x({ name: alias }: Named); + m({ name: alias }: Named); +} + +interface ReferencedInSignartureInterface { + ({ name: alias }: Named, p: typeof alias): void + ({ name: alias }: Named): typeof alias + + new ({ name: alias }: Named, p: typeof alias): void + new ({ name: alias }: Named): typeof alias + set x({ name: alias }: Named & { o: typeof alias }) + mReturnType({ name: alias }: Named): typeof alias; + mRerturnTypeNested({ name: alias }: Named): NonNullable; + mParameter({ name: alias }: Named, p: typeof alias); +} + +//// [declarationEmitBindingPatternsUnused.js] +function notReferenced({ name: alias }) { +} +function notReferencedNestedAlias({ p: { name: alias } }) { +} +function notReferencedArrayAlias([a, b, { name: alias }]) { +} +function referencedInCode({ name: alias }) { + return alias; +} +function referencedInSignarture({ name: alias }) { + return alias; +} +function referencedInSignartureKeyword({ function: alias }) { + return null; +} +function referencedInInferredType({ name: alias }) { + return null; +} +function referencedInNestedFunction({ name: alias }) { + return function (p) { + }; +} +function referencedNestedAlias({ p: { name: alias } }) { + return alias; +} +function referencedArrayAlias([a, b, { name: alias }]) { + return alias; +} +class NotReferencedClass { + constructor({ name: alias }) { + } + set x({ name: alias }) { + console.log(alias); + } + m({ name: alias }) { + console.log(alias); + } +} +class ReferencedInCodeClas { + constructor({ name: alias }) { + console.log(alias); + } + set x({ name: alias }) { + console.log(alias); + } + m({ name: alias }) { + console.log(alias); + } +} +class ReferencedInSignartureClass { + constructor({ name: alias }, p) { + console.log(alias); + } + set x({ name: alias }) { + } + mReturnType({ name: alias }) { + return null; + } + mRerturnTypeNested({ name: alias }) { + return null; + } + mParameter({ name: alias }, p) { + return null; + } +} +let notReferencedFnType; +let referencedInSignartureReturnTypeFnType; +let referencedInSignartureParamTypeFnType; +let notReferencedCtorType; +let referencedInSignartureReturnTypeCtorType; +let referencedInSignartureParamTypeCtorType; + + +//// [declarationEmitBindingPatternsUnused.d.ts] +type Named = { + name: string; +}; +declare function notReferenced({ name }: Named): void; +declare function notReferencedNestedAlias({ p: { name } }: { + p: Named; +}): void; +declare function notReferencedArrayAlias([a, b, { name }]: Named[]): void; +declare function referencedInCode({ name }: Named): string; +declare function referencedInSignarture({ name: alias }: Named): typeof alias; +declare function referencedInSignartureKeyword({ function: alias }: { + function: string; +}): typeof alias; +declare function referencedInInferredType({ name: alias }: Named): { + name: typeof alias; +}; +declare function referencedInNestedFunction({ name: alias }: Named): (p: typeof alias) => void; +declare function referencedNestedAlias({ p: { name: alias } }: { + p: Named; +}): typeof alias; +declare function referencedArrayAlias([a, b, { name: alias }]: Named[]): typeof alias; +declare class NotReferencedClass { + constructor({ name }: Named); + set x({ name }: Named); + m({ name }: Named): void; +} +declare class ReferencedInCodeClas { + constructor({ name }: Named); + set x({ name }: Named); + m({ name }: Named): void; +} +declare class ReferencedInSignartureClass { + constructor({ name: alias }: Named, p: typeof alias); + set x({ name: alias }: Named & { + o: typeof alias; + }); + mReturnType({ name: alias }: Named): typeof alias; + mRerturnTypeNested({ name: alias }: Named): NonNullable; + mParameter({ name: alias }: Named, p: typeof alias): any; +} +declare let notReferencedFnType: ({ name }: Named) => void; +declare let referencedInSignartureReturnTypeFnType: ({ name: alias }: Named) => typeof alias; +declare let referencedInSignartureParamTypeFnType: ({ name: alias }: Named, p: typeof alias) => void; +declare let notReferencedCtorType: new ({ name }: Named) => void; +declare let referencedInSignartureReturnTypeCtorType: new ({ name: alias }: Named) => typeof alias; +declare let referencedInSignartureParamTypeCtorType: new ({ name: alias }: Named, p: typeof alias) => void; +interface NotReferencedInterface { + ({ name }: Named): void; + new ({ name }: Named): void; + set x({ name }: Named); + m({ name }: Named): any; +} +interface ReferencedInSignartureInterface { + ({ name: alias }: Named, p: typeof alias): void; + ({ name: alias }: Named): typeof alias; + new ({ name: alias }: Named, p: typeof alias): void; + new ({ name: alias }: Named): typeof alias; + set x({ name: alias }: Named & { + o: typeof alias; + }); + mReturnType({ name: alias }: Named): typeof alias; + mRerturnTypeNested({ name: alias }: Named): NonNullable; + mParameter({ name: alias }: Named, p: typeof alias): any; +} diff --git a/tests/baselines/reference/declarationEmitBindingPatternsUnused.symbols b/tests/baselines/reference/declarationEmitBindingPatternsUnused.symbols new file mode 100644 index 0000000000000..809cf5683cd21 --- /dev/null +++ b/tests/baselines/reference/declarationEmitBindingPatternsUnused.symbols @@ -0,0 +1,378 @@ +//// [tests/cases/compiler/declarationEmitBindingPatternsUnused.ts] //// + +=== declarationEmitBindingPatternsUnused.ts === +type Named = { name: string } +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) + +function notReferenced({ name: alias }: Named) { +>notReferenced : Symbol(notReferenced, Decl(declarationEmitBindingPatternsUnused.ts, 0, 29)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 1, 24)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + +} +function notReferencedNestedAlias({ p: { name: alias } }: { p: Named }) { +>notReferencedNestedAlias : Symbol(notReferencedNestedAlias, Decl(declarationEmitBindingPatternsUnused.ts, 3, 1)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 4, 59)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 4, 40)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 4, 59)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +} +function notReferencedArrayAlias([a, b, { name: alias }]: Named[]) { +>notReferencedArrayAlias : Symbol(notReferencedArrayAlias, Decl(declarationEmitBindingPatternsUnused.ts, 5, 1)) +>a : Symbol(a, Decl(declarationEmitBindingPatternsUnused.ts, 6, 34)) +>b : Symbol(b, Decl(declarationEmitBindingPatternsUnused.ts, 6, 36)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 6, 41)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +} + + + +function referencedInCode({ name: alias }: Named) { +>referencedInCode : Symbol(referencedInCode, Decl(declarationEmitBindingPatternsUnused.ts, 7, 1)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 11, 27)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + return alias; +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 11, 27)) +} + +function referencedInSignarture({ name: alias }: Named): typeof alias { +>referencedInSignarture : Symbol(referencedInSignarture, Decl(declarationEmitBindingPatternsUnused.ts, 13, 1)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 15, 33)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 15, 33)) + + return alias; +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 15, 33)) +} + +function referencedInSignartureKeyword({ function: alias }: { function: string }): typeof alias { +>referencedInSignartureKeyword : Symbol(referencedInSignartureKeyword, Decl(declarationEmitBindingPatternsUnused.ts, 17, 1)) +>function : Symbol(function, Decl(declarationEmitBindingPatternsUnused.ts, 19, 61)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 19, 40)) +>function : Symbol(function, Decl(declarationEmitBindingPatternsUnused.ts, 19, 61)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 19, 40)) + + return null!; +} + +function referencedInInferredType({ name: alias }: Named) { +>referencedInInferredType : Symbol(referencedInInferredType, Decl(declarationEmitBindingPatternsUnused.ts, 21, 1)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 23, 35)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + type Named2 = { name: typeof alias } +>Named2 : Symbol(Named2, Decl(declarationEmitBindingPatternsUnused.ts, 23, 59)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 24, 19)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 23, 35)) + + return null! as Named2 +>Named2 : Symbol(Named2, Decl(declarationEmitBindingPatternsUnused.ts, 23, 59)) +} + +function referencedInNestedFunction({ name: alias }: Named) { +>referencedInNestedFunction : Symbol(referencedInNestedFunction, Decl(declarationEmitBindingPatternsUnused.ts, 26, 1)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 28, 37)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + return function(p: typeof alias) { +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 29, 20)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 28, 37)) + + } +} + +function referencedNestedAlias({ p: { name: alias } }: { p: Named }): typeof alias { +>referencedNestedAlias : Symbol(referencedNestedAlias, Decl(declarationEmitBindingPatternsUnused.ts, 32, 1)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 34, 56)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 34, 37)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 34, 56)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 34, 37)) + + return alias; +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 34, 37)) +} + +function referencedArrayAlias([a, b, { name: alias }]: Named[]): typeof alias { +>referencedArrayAlias : Symbol(referencedArrayAlias, Decl(declarationEmitBindingPatternsUnused.ts, 36, 1)) +>a : Symbol(a, Decl(declarationEmitBindingPatternsUnused.ts, 38, 31)) +>b : Symbol(b, Decl(declarationEmitBindingPatternsUnused.ts, 38, 33)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 38, 38)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 38, 38)) + + return alias; +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 38, 38)) +} + + +class NotReferencedClass { +>NotReferencedClass : Symbol(NotReferencedClass, Decl(declarationEmitBindingPatternsUnused.ts, 40, 1)) + + constructor({ name: alias }: Named) { +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 44, 14)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + } + set x({ name: alias }: Named) { +>x : Symbol(NotReferencedClass.x, Decl(declarationEmitBindingPatternsUnused.ts, 45, 2)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 46, 8)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + console.log(alias); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 46, 8)) + } + m({ name: alias }: Named) { +>m : Symbol(NotReferencedClass.m, Decl(declarationEmitBindingPatternsUnused.ts, 48, 5)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 49, 4)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + console.log(alias); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 49, 4)) + } +} + +class ReferencedInCodeClas { +>ReferencedInCodeClas : Symbol(ReferencedInCodeClas, Decl(declarationEmitBindingPatternsUnused.ts, 52, 1)) + + constructor({ name: alias }: Named) { +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 55, 14)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + console.log(alias); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 55, 14)) + } + set x({ name: alias }: Named) { +>x : Symbol(ReferencedInCodeClas.x, Decl(declarationEmitBindingPatternsUnused.ts, 57, 2)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 58, 8)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + console.log(alias); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 58, 8)) + } + m({ name: alias }: Named) { +>m : Symbol(ReferencedInCodeClas.m, Decl(declarationEmitBindingPatternsUnused.ts, 60, 5)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 61, 4)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + console.log(alias); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 61, 4)) + } +} + +class ReferencedInSignartureClass { +>ReferencedInSignartureClass : Symbol(ReferencedInSignartureClass, Decl(declarationEmitBindingPatternsUnused.ts, 64, 1)) + + constructor({ name: alias }: Named, p: typeof alias) { +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 67, 14)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 67, 36)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 67, 14)) + + console.log(alias); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 67, 14)) + } + set x({ name: alias }: Named & { o: typeof alias }) { +>x : Symbol(ReferencedInSignartureClass.x, Decl(declarationEmitBindingPatternsUnused.ts, 69, 2)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 70, 8)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>o : Symbol(o, Decl(declarationEmitBindingPatternsUnused.ts, 70, 33)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 70, 8)) + + } + mReturnType({ name: alias }: Named): typeof alias { +>mReturnType : Symbol(ReferencedInSignartureClass.mReturnType, Decl(declarationEmitBindingPatternsUnused.ts, 72, 5)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 73, 14)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 73, 14)) + + return null! + } + mRerturnTypeNested({ name: alias }: Named): NonNullable { +>mRerturnTypeNested : Symbol(ReferencedInSignartureClass.mRerturnTypeNested, Decl(declarationEmitBindingPatternsUnused.ts, 75, 5)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 76, 21)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>NonNullable : Symbol(NonNullable, Decl(lib.es5.d.ts, --, --)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 76, 21)) + + return null! + } + mParameter({ name: alias }: Named, p: typeof alias) { +>mParameter : Symbol(ReferencedInSignartureClass.mParameter, Decl(declarationEmitBindingPatternsUnused.ts, 78, 5)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 79, 16)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 79, 38)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 79, 16)) + + return null! + } +} + +let notReferencedFnType: ({ name: alias }: Named) => void; +>notReferencedFnType : Symbol(notReferencedFnType, Decl(declarationEmitBindingPatternsUnused.ts, 84, 3)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 84, 27)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + +let referencedInSignartureReturnTypeFnType: ({ name: alias }: Named) => typeof alias; +>referencedInSignartureReturnTypeFnType : Symbol(referencedInSignartureReturnTypeFnType, Decl(declarationEmitBindingPatternsUnused.ts, 85, 3)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 85, 46)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 85, 46)) + +let referencedInSignartureParamTypeFnType: ({ name: alias }: Named, p: typeof alias) => void; +>referencedInSignartureParamTypeFnType : Symbol(referencedInSignartureParamTypeFnType, Decl(declarationEmitBindingPatternsUnused.ts, 86, 3)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 86, 45)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 86, 67)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 86, 45)) + +let notReferencedCtorType: new ({ name: alias }: Named) => void; +>notReferencedCtorType : Symbol(notReferencedCtorType, Decl(declarationEmitBindingPatternsUnused.ts, 88, 3)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 88, 33)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + +let referencedInSignartureReturnTypeCtorType: new ({ name: alias }: Named) => typeof alias; +>referencedInSignartureReturnTypeCtorType : Symbol(referencedInSignartureReturnTypeCtorType, Decl(declarationEmitBindingPatternsUnused.ts, 89, 3)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 89, 52)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 89, 52)) + +let referencedInSignartureParamTypeCtorType: new ({ name: alias }: Named, p: typeof alias) => void; +>referencedInSignartureParamTypeCtorType : Symbol(referencedInSignartureParamTypeCtorType, Decl(declarationEmitBindingPatternsUnused.ts, 90, 3)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 90, 52)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 90, 74)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 90, 52)) + + +interface NotReferencedInterface { +>NotReferencedInterface : Symbol(NotReferencedInterface, Decl(declarationEmitBindingPatternsUnused.ts, 90, 100)) + + ({ name: alias }: Named): void +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 94, 3)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + new ({ name: alias }: Named): void +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 95, 7)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + set x({ name: alias }: Named); +>x : Symbol(NotReferencedInterface.x, Decl(declarationEmitBindingPatternsUnused.ts, 95, 35)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 96, 8)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) + + m({ name: alias }: Named); +>m : Symbol(NotReferencedInterface.m, Decl(declarationEmitBindingPatternsUnused.ts, 96, 31)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 97, 4)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +} + +interface ReferencedInSignartureInterface { +>ReferencedInSignartureInterface : Symbol(ReferencedInSignartureInterface, Decl(declarationEmitBindingPatternsUnused.ts, 98, 1)) + + ({ name: alias }: Named, p: typeof alias): void +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 101, 3)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 101, 25)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 101, 3)) + + ({ name: alias }: Named): typeof alias +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 102, 3)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 102, 3)) + + new ({ name: alias }: Named, p: typeof alias): void +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 104, 7)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 104, 29)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 104, 7)) + + new ({ name: alias }: Named): typeof alias +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 105, 7)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 105, 7)) + + set x({ name: alias }: Named & { o: typeof alias }) +>x : Symbol(ReferencedInSignartureInterface.x, Decl(declarationEmitBindingPatternsUnused.ts, 105, 43)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 106, 8)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>o : Symbol(o, Decl(declarationEmitBindingPatternsUnused.ts, 106, 33)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 106, 8)) + + mReturnType({ name: alias }: Named): typeof alias; +>mReturnType : Symbol(ReferencedInSignartureInterface.mReturnType, Decl(declarationEmitBindingPatternsUnused.ts, 106, 52)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 107, 14)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 107, 14)) + + mRerturnTypeNested({ name: alias }: Named): NonNullable; +>mRerturnTypeNested : Symbol(ReferencedInSignartureInterface.mRerturnTypeNested, Decl(declarationEmitBindingPatternsUnused.ts, 107, 51)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 108, 21)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>NonNullable : Symbol(NonNullable, Decl(lib.es5.d.ts, --, --)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 108, 21)) + + mParameter({ name: alias }: Named, p: typeof alias); +>mParameter : Symbol(ReferencedInSignartureInterface.mParameter, Decl(declarationEmitBindingPatternsUnused.ts, 108, 71)) +>name : Symbol(name, Decl(declarationEmitBindingPatternsUnused.ts, 0, 14)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 109, 16)) +>Named : Symbol(Named, Decl(declarationEmitBindingPatternsUnused.ts, 0, 0)) +>p : Symbol(p, Decl(declarationEmitBindingPatternsUnused.ts, 109, 38)) +>alias : Symbol(alias, Decl(declarationEmitBindingPatternsUnused.ts, 109, 16)) +} diff --git a/tests/baselines/reference/declarationEmitBindingPatternsUnused.types b/tests/baselines/reference/declarationEmitBindingPatternsUnused.types new file mode 100644 index 0000000000000..32771df655b98 --- /dev/null +++ b/tests/baselines/reference/declarationEmitBindingPatternsUnused.types @@ -0,0 +1,346 @@ +//// [tests/cases/compiler/declarationEmitBindingPatternsUnused.ts] //// + +=== declarationEmitBindingPatternsUnused.ts === +type Named = { name: string } +>Named : { name: string; } +>name : string + +function notReferenced({ name: alias }: Named) { +>notReferenced : ({ name: alias }: Named) => void +>name : any +>alias : string + +} +function notReferencedNestedAlias({ p: { name: alias } }: { p: Named }) { +>notReferencedNestedAlias : ({ p: { name: alias } }: { p: Named;}) => void +>p : any +>name : any +>alias : string +>p : Named +} +function notReferencedArrayAlias([a, b, { name: alias }]: Named[]) { +>notReferencedArrayAlias : ([a, b, { name: alias }]: Named[]) => void +>a : Named +>b : Named +>name : any +>alias : string +} + + + +function referencedInCode({ name: alias }: Named) { +>referencedInCode : ({ name: alias }: Named) => string +>name : any +>alias : string + + return alias; +>alias : string +} + +function referencedInSignarture({ name: alias }: Named): typeof alias { +>referencedInSignarture : ({ name: alias }: Named) => typeof alias +>name : any +>alias : string +>alias : string + + return alias; +>alias : string +} + +function referencedInSignartureKeyword({ function: alias }: { function: string }): typeof alias { +>referencedInSignartureKeyword : ({ function: alias }: { function: string;}) => typeof alias +>function : any +>alias : string +>function : string +>alias : string + + return null!; +>null! : null +} + +function referencedInInferredType({ name: alias }: Named) { +>referencedInInferredType : ({ name: alias }: Named) => { name: typeof alias; } +>name : any +>alias : string + + type Named2 = { name: typeof alias } +>Named2 : { name: typeof alias; } +>name : string +>alias : string + + return null! as Named2 +>null! as Named2 : { name: string; } +>null! : null +} + +function referencedInNestedFunction({ name: alias }: Named) { +>referencedInNestedFunction : ({ name: alias }: Named) => (p: typeof alias) => void +>name : any +>alias : string + + return function(p: typeof alias) { +>function(p: typeof alias) { } : (p: typeof alias) => void +>p : string +>alias : string + + } +} + +function referencedNestedAlias({ p: { name: alias } }: { p: Named }): typeof alias { +>referencedNestedAlias : ({ p: { name: alias } }: { p: Named;}) => typeof alias +>p : any +>name : any +>alias : string +>p : Named +>alias : string + + return alias; +>alias : string +} + +function referencedArrayAlias([a, b, { name: alias }]: Named[]): typeof alias { +>referencedArrayAlias : ([a, b, { name: alias }]: Named[]) => typeof alias +>a : Named +>b : Named +>name : any +>alias : string +>alias : string + + return alias; +>alias : string +} + + +class NotReferencedClass { +>NotReferencedClass : NotReferencedClass + + constructor({ name: alias }: Named) { +>name : any +>alias : string + } + set x({ name: alias }: Named) { +>x : Named +>name : any +>alias : string + + console.log(alias); +>console.log(alias) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>alias : string + } + m({ name: alias }: Named) { +>m : ({ name: alias }: Named) => void +>name : any +>alias : string + + console.log(alias); +>console.log(alias) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>alias : string + } +} + +class ReferencedInCodeClas { +>ReferencedInCodeClas : ReferencedInCodeClas + + constructor({ name: alias }: Named) { +>name : any +>alias : string + + console.log(alias); +>console.log(alias) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>alias : string + } + set x({ name: alias }: Named) { +>x : Named +>name : any +>alias : string + + console.log(alias); +>console.log(alias) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>alias : string + } + m({ name: alias }: Named) { +>m : ({ name: alias }: Named) => void +>name : any +>alias : string + + console.log(alias); +>console.log(alias) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>alias : string + } +} + +class ReferencedInSignartureClass { +>ReferencedInSignartureClass : ReferencedInSignartureClass + + constructor({ name: alias }: Named, p: typeof alias) { +>name : any +>alias : string +>p : string +>alias : string + + console.log(alias); +>console.log(alias) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>alias : string + } + set x({ name: alias }: Named & { o: typeof alias }) { +>x : Named & { o: typeof alias; } +>name : any +>alias : string +>o : string +>alias : string + + } + mReturnType({ name: alias }: Named): typeof alias { +>mReturnType : ({ name: alias }: Named) => typeof alias +>name : any +>alias : string +>alias : string + + return null! +>null! : null + } + mRerturnTypeNested({ name: alias }: Named): NonNullable { +>mRerturnTypeNested : ({ name: alias }: Named) => NonNullable +>name : any +>alias : string +>alias : string + + return null! +>null! : null + } + mParameter({ name: alias }: Named, p: typeof alias) { +>mParameter : ({ name: alias }: Named, p: typeof alias) => any +>name : any +>alias : string +>p : string +>alias : string + + return null! +>null! : null + } +} + +let notReferencedFnType: ({ name: alias }: Named) => void; +>notReferencedFnType : ({ name: alias }: Named) => void +>name : any +>alias : string + +let referencedInSignartureReturnTypeFnType: ({ name: alias }: Named) => typeof alias; +>referencedInSignartureReturnTypeFnType : ({ name: alias }: Named) => string +>name : any +>alias : string +>alias : string + +let referencedInSignartureParamTypeFnType: ({ name: alias }: Named, p: typeof alias) => void; +>referencedInSignartureParamTypeFnType : ({ name: alias }: Named, p: string) => void +>name : any +>alias : string +>p : string +>alias : string + +let notReferencedCtorType: new ({ name: alias }: Named) => void; +>notReferencedCtorType : new ({ name: alias }: Named) => void +>name : any +>alias : string + +let referencedInSignartureReturnTypeCtorType: new ({ name: alias }: Named) => typeof alias; +>referencedInSignartureReturnTypeCtorType : new ({ name: alias }: Named) => string +>name : any +>alias : string +>alias : string + +let referencedInSignartureParamTypeCtorType: new ({ name: alias }: Named, p: typeof alias) => void; +>referencedInSignartureParamTypeCtorType : new ({ name: alias }: Named, p: string) => void +>name : any +>alias : string +>p : string +>alias : string + + +interface NotReferencedInterface { + ({ name: alias }: Named): void +>name : any +>alias : string + + new ({ name: alias }: Named): void +>name : any +>alias : string + + set x({ name: alias }: Named); +>x : Named +>name : any +>alias : string + + m({ name: alias }: Named); +>m : ({ name: alias }: Named) => any +>name : any +>alias : string +} + +interface ReferencedInSignartureInterface { + ({ name: alias }: Named, p: typeof alias): void +>name : any +>alias : string +>p : string +>alias : string + + ({ name: alias }: Named): typeof alias +>name : any +>alias : string +>alias : string + + new ({ name: alias }: Named, p: typeof alias): void +>name : any +>alias : string +>p : string +>alias : string + + new ({ name: alias }: Named): typeof alias +>name : any +>alias : string +>alias : string + + set x({ name: alias }: Named & { o: typeof alias }) +>x : Named & { o: typeof alias; } +>name : any +>alias : string +>o : string +>alias : string + + mReturnType({ name: alias }: Named): typeof alias; +>mReturnType : ({ name: alias }: Named) => typeof alias +>name : any +>alias : string +>alias : string + + mRerturnTypeNested({ name: alias }: Named): NonNullable; +>mRerturnTypeNested : ({ name: alias }: Named) => NonNullable +>name : any +>alias : string +>alias : string + + mParameter({ name: alias }: Named, p: typeof alias); +>mParameter : ({ name: alias }: Named, p: typeof alias) => any +>name : any +>alias : string +>p : string +>alias : string +} diff --git a/tests/baselines/reference/declarationEmitJsReExportDefault.js b/tests/baselines/reference/declarationEmitJsReExportDefault.js new file mode 100644 index 0000000000000..f575575ff96cf --- /dev/null +++ b/tests/baselines/reference/declarationEmitJsReExportDefault.js @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/declarationEmitJsReExportDefault.ts] //// + +//// [package.json] +{"name": "a", "version": "0.0.0"} +//// [index.d.ts] +export const a = 123; + +//// [index.mjs] +export {default as mod} from 'a'; + + + + +//// [index.d.mts] +export { default as mod } from "a"; diff --git a/tests/baselines/reference/declarationEmitNestedAnonymousMappedType.js b/tests/baselines/reference/declarationEmitNestedAnonymousMappedType.js new file mode 100644 index 0000000000000..990be7d639417 --- /dev/null +++ b/tests/baselines/reference/declarationEmitNestedAnonymousMappedType.js @@ -0,0 +1,26 @@ +//// [tests/cases/compiler/declarationEmitNestedAnonymousMappedType.ts] //// + +//// [declarationEmitNestedAnonymousMappedType.ts] +export function enumFromStrings() { + type Part1 = { + [key in keyof Members as Members[key] extends string + ? Members[key] + : never]: Members[key]; + }; + type Part2 = { [Property in keyof Part1]: Part1[Property] }; + return Object.create(null) as Part2; +} + + +//// [declarationEmitNestedAnonymousMappedType.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.enumFromStrings = void 0; +function enumFromStrings() { + return Object.create(null); +} +exports.enumFromStrings = enumFromStrings; + + +//// [declarationEmitNestedAnonymousMappedType.d.ts] +export declare function enumFromStrings(): { [Property in keyof { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }]: { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }[Property]; }; diff --git a/tests/baselines/reference/declarationEmitNestedAnonymousMappedType.symbols b/tests/baselines/reference/declarationEmitNestedAnonymousMappedType.symbols new file mode 100644 index 0000000000000..14ac1faaa8487 --- /dev/null +++ b/tests/baselines/reference/declarationEmitNestedAnonymousMappedType.symbols @@ -0,0 +1,39 @@ +//// [tests/cases/compiler/declarationEmitNestedAnonymousMappedType.ts] //// + +=== declarationEmitNestedAnonymousMappedType.ts === +export function enumFromStrings() { +>enumFromStrings : Symbol(enumFromStrings, Decl(declarationEmitNestedAnonymousMappedType.ts, 0, 0)) +>Members : Symbol(Members, Decl(declarationEmitNestedAnonymousMappedType.ts, 0, 32)) + + type Part1 = { +>Part1 : Symbol(Part1, Decl(declarationEmitNestedAnonymousMappedType.ts, 0, 76)) + + [key in keyof Members as Members[key] extends string +>key : Symbol(key, Decl(declarationEmitNestedAnonymousMappedType.ts, 2, 9)) +>Members : Symbol(Members, Decl(declarationEmitNestedAnonymousMappedType.ts, 0, 32)) +>Members : Symbol(Members, Decl(declarationEmitNestedAnonymousMappedType.ts, 0, 32)) +>key : Symbol(key, Decl(declarationEmitNestedAnonymousMappedType.ts, 2, 9)) + + ? Members[key] +>Members : Symbol(Members, Decl(declarationEmitNestedAnonymousMappedType.ts, 0, 32)) +>key : Symbol(key, Decl(declarationEmitNestedAnonymousMappedType.ts, 2, 9)) + + : never]: Members[key]; +>Members : Symbol(Members, Decl(declarationEmitNestedAnonymousMappedType.ts, 0, 32)) +>key : Symbol(key, Decl(declarationEmitNestedAnonymousMappedType.ts, 2, 9)) + + }; + type Part2 = { [Property in keyof Part1]: Part1[Property] }; +>Part2 : Symbol(Part2, Decl(declarationEmitNestedAnonymousMappedType.ts, 5, 6)) +>Property : Symbol(Property, Decl(declarationEmitNestedAnonymousMappedType.ts, 6, 20)) +>Part1 : Symbol(Part1, Decl(declarationEmitNestedAnonymousMappedType.ts, 0, 76)) +>Part1 : Symbol(Part1, Decl(declarationEmitNestedAnonymousMappedType.ts, 0, 76)) +>Property : Symbol(Property, Decl(declarationEmitNestedAnonymousMappedType.ts, 6, 20)) + + return Object.create(null) as Part2; +>Object.create : Symbol(ObjectConstructor.create, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>create : Symbol(ObjectConstructor.create, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Part2 : Symbol(Part2, Decl(declarationEmitNestedAnonymousMappedType.ts, 5, 6)) +} + diff --git a/tests/baselines/reference/declarationEmitNestedAnonymousMappedType.types b/tests/baselines/reference/declarationEmitNestedAnonymousMappedType.types new file mode 100644 index 0000000000000..393f26ed21c44 --- /dev/null +++ b/tests/baselines/reference/declarationEmitNestedAnonymousMappedType.types @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/declarationEmitNestedAnonymousMappedType.ts] //// + +=== declarationEmitNestedAnonymousMappedType.ts === +export function enumFromStrings() { +>enumFromStrings : () => { [Property in keyof { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }]: { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }[Property]; } + + type Part1 = { +>Part1 : { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; } + + [key in keyof Members as Members[key] extends string + ? Members[key] + : never]: Members[key]; + }; + type Part2 = { [Property in keyof Part1]: Part1[Property] }; +>Part2 : { [Property in keyof { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }]: { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }[Property]; } + + return Object.create(null) as Part2; +>Object.create(null) as Part2 : { [Property in keyof { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }]: { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }[Property]; } +>Object.create(null) : any +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap & ThisType): any; } +>Object : ObjectConstructor +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap & ThisType): any; } +} + diff --git a/tests/baselines/reference/declarationEmitRedundantTripleSlashModuleAugmentation.js b/tests/baselines/reference/declarationEmitRedundantTripleSlashModuleAugmentation.js new file mode 100644 index 0000000000000..5c46dfde8ec6a --- /dev/null +++ b/tests/baselines/reference/declarationEmitRedundantTripleSlashModuleAugmentation.js @@ -0,0 +1,40 @@ +//// [tests/cases/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.ts] //// + +//// [index.d.ts] +declare module "foo" { + export interface Original {} +} + +//// [augmentation.ts] +export interface FooOptions {} +declare module "foo" { + export interface Augmentation {} +} + +//// [index.ts] +import { Original, Augmentation } from "foo"; +import type { FooOptions } from "./augmentation"; +export interface _ { + original: Original; + augmentation: Augmentation; + options: FooOptions; +} + + + + +//// [augmentation.d.ts] +export interface FooOptions { +} +declare module "foo" { + interface Augmentation { + } +} +//// [index.d.ts] +import { Original, Augmentation } from "foo"; +import type { FooOptions } from "./augmentation"; +export interface _ { + original: Original; + augmentation: Augmentation; + options: FooOptions; +} diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.js b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.js new file mode 100644 index 0000000000000..73a3dd98d3901 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.js @@ -0,0 +1,273 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts] //// + +//// [useQuery-CPqkvEsh.d.ts] +type QueryKey = ReadonlyArray; + +interface Register {} + +type DefaultError = Register extends { + defaultError: infer TError; +} + ? TError + : Error; + +type ShouldRetryFunction = ( + failureCount: number, + error: TError, +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; + +type QueryFunctionContext< + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; + } + : { + queryKey: TQueryKey; + pageParam: TPageParam; + }; + +type QueryFunction< + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; + queryFn?: QueryFunction; + queryKey?: TQueryKey; + initialData?: TData; + initialDataUpdatedAt?: number | (() => number | undefined); +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; + refetchInterval?: number; + select?: (data: TQueryData) => TData; +} + +type UseQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +}; + +interface QueryObserverBaseResult { + data: TData | undefined; + dataUpdatedAt: number; + error: TError | null; + errorUpdatedAt: number; + failureCount: number; + failureReason: TError | null; + errorUpdateCount: number; + isError: boolean; + isFetched: boolean; + isFetchedAfterMount: boolean; + isFetching: boolean; + isLoading: boolean; + isPending: boolean; + isLoadingError: boolean; + isInitialLoading: boolean; + isPaused: boolean; + isPlaceholderData: boolean; + isRefetchError: boolean; + isRefetching: boolean; + isStale: boolean; + isSuccess: boolean; +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + status: "success"; +} + +type DefinedQueryObserverResult< + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { + value: T; +}; + +type UseBaseQueryReturnType< + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +}; + +type UseQueryReturnType = UseBaseQueryReturnType; + +declare function useQuery< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +): UseQueryReturnType; + +export { type UseQueryReturnType, useQuery }; + +//// [index.d.ts] +export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; + +//// [package.json] +{ + "name": "@tanstack/vue-query", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./build/modern/index.d.ts", + "default": "./build/modern/index.js" + }, + "require": { + "types": "./build/modern/index.d.cts", + "default": "./build/modern/index.cjs" + } + } + } +} + +//// [index.mts] +import { useQuery } from '@tanstack/vue-query' + +const baseUrl = 'https://api.publicapis.org/' + +interface IEntry { + API: string + Description: string + Auth: string + HTTPS: boolean + Cors: string + Link: string + Category: string +} + +const testApi = { + getEntries: (): Promise => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)) + } +} + +const entryKeys = { + all: ['entries'] as const, + list: () => [...entryKeys.all, 'list'] as const +} + +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }) +} + + +//// [index.mjs] +import { useQuery } from '@tanstack/vue-query'; +const baseUrl = 'https://api.publicapis.org/'; +const testApi = { + getEntries: () => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)); + } +}; +const entryKeys = { + all: ['entries'], + list: () => [...entryKeys.all, 'list'] +}; +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }); +}; + + +//// [index.d.mts] +interface IEntry { + API: string; + Description: string; + Auth: string; + HTTPS: boolean; + Cors: string; + Link: string; + Category: string; +} +export declare const useEntries: () => import("@tanstack/vue-query").UseQueryReturnType; +export {}; diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.symbols b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.symbols new file mode 100644 index 0000000000000..55642da2f56e4 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.symbols @@ -0,0 +1,653 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts] //// + +=== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts === +type QueryKey = ReadonlyArray; +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 3 more) + +interface Register {} +>Register : Symbol(Register, Decl(useQuery-CPqkvEsh.d.ts, 0, 39)) + +type DefaultError = Register extends { +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) +>Register : Symbol(Register, Decl(useQuery-CPqkvEsh.d.ts, 0, 39)) + + defaultError: infer TError; +>defaultError : Symbol(defaultError, Decl(useQuery-CPqkvEsh.d.ts, 4, 38)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 5, 21)) +} + ? TError +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 5, 21)) + + : Error; +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) + +type ShouldRetryFunction = ( +>ShouldRetryFunction : Symbol(ShouldRetryFunction, Decl(useQuery-CPqkvEsh.d.ts, 8, 10)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 10, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + failureCount: number, +>failureCount : Symbol(failureCount, Decl(useQuery-CPqkvEsh.d.ts, 10, 51)) + + error: TError, +>error : Symbol(error, Decl(useQuery-CPqkvEsh.d.ts, 11, 23)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 10, 25)) + +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; +>RetryValue : Symbol(RetryValue, Decl(useQuery-CPqkvEsh.d.ts, 13, 13)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 14, 16)) +>ShouldRetryFunction : Symbol(ShouldRetryFunction, Decl(useQuery-CPqkvEsh.d.ts, 8, 10)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 14, 16)) + +type QueryFunctionContext< +>QueryFunctionContext : Symbol(QueryFunctionContext, Decl(useQuery-CPqkvEsh.d.ts, 14, 73)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + +> = [TPageParam] extends [never] +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + + ? { + queryKey: TQueryKey; +>queryKey : Symbol(queryKey, Decl(useQuery-CPqkvEsh.d.ts, 20, 5)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) + } + : { + queryKey: TQueryKey; +>queryKey : Symbol(queryKey, Decl(useQuery-CPqkvEsh.d.ts, 23, 5)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) + + pageParam: TPageParam; +>pageParam : Symbol(pageParam, Decl(useQuery-CPqkvEsh.d.ts, 24, 26)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + + }; + +type QueryFunction< +>QueryFunction : Symbol(QueryFunction, Decl(useQuery-CPqkvEsh.d.ts, 26, 6)) + + T = unknown, +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 29, 14)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 30, 40)) + +> = (context: QueryFunctionContext) => T | Promise; +>context : Symbol(context, Decl(useQuery-CPqkvEsh.d.ts, 32, 5)) +>QueryFunctionContext : Symbol(QueryFunctionContext, Decl(useQuery-CPqkvEsh.d.ts, 14, 73)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 29, 14)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 30, 40)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) + +interface QueryOptions< +>QueryOptions : Symbol(QueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 32, 77)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 35, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 36, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 38, 40)) + +> { + retry?: RetryValue; +>retry : Symbol(QueryOptions.retry, Decl(useQuery-CPqkvEsh.d.ts, 40, 3)) +>RetryValue : Symbol(RetryValue, Decl(useQuery-CPqkvEsh.d.ts, 13, 13)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 35, 25)) + + queryFn?: QueryFunction; +>queryFn : Symbol(QueryOptions.queryFn, Decl(useQuery-CPqkvEsh.d.ts, 41, 29)) +>QueryFunction : Symbol(QueryFunction, Decl(useQuery-CPqkvEsh.d.ts, 26, 6)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 38, 40)) + + queryKey?: TQueryKey; +>queryKey : Symbol(QueryOptions.queryKey, Decl(useQuery-CPqkvEsh.d.ts, 42, 63)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) + + initialData?: TData; +>initialData : Symbol(QueryOptions.initialData, Decl(useQuery-CPqkvEsh.d.ts, 43, 23)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 36, 24)) + + initialDataUpdatedAt?: number | (() => number | undefined); +>initialDataUpdatedAt : Symbol(QueryOptions.initialDataUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 44, 22)) +} + +interface QueryObserverOptions< +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 49, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 50, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TQueryData = TQueryFnData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 52, 28)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 53, 40)) + +> extends QueryOptions< +>QueryOptions : Symbol(QueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 32, 77)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 49, 25)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) + + TQueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 52, 28)) + + TPageParam +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 53, 40)) + + > { + enabled?: boolean; +>enabled : Symbol(QueryObserverOptions.enabled, Decl(useQuery-CPqkvEsh.d.ts, 61, 5)) + + refetchInterval?: number; +>refetchInterval : Symbol(QueryObserverOptions.refetchInterval, Decl(useQuery-CPqkvEsh.d.ts, 62, 20)) + + select?: (data: TQueryData) => TData; +>select : Symbol(QueryObserverOptions.select, Decl(useQuery-CPqkvEsh.d.ts, 63, 27)) +>data : Symbol(data, Decl(useQuery-CPqkvEsh.d.ts, 64, 12)) +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 50, 24)) +} + +type UseQueryOptions< +>UseQueryOptions : Symbol(UseQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 65, 1)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TQueryData = TQueryFnData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +> = { + [Property in keyof QueryObserverOptions< +>Property : Symbol(Property, Decl(useQuery-CPqkvEsh.d.ts, 74, 3)) +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) + + TQueryKey +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) + + >]: QueryObserverOptions< +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) + + TQueryKey +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) + + >[Property]; +>Property : Symbol(Property, Decl(useQuery-CPqkvEsh.d.ts, 74, 3)) + +}; + +type UndefinedInitialQueryOptions< +>UndefinedInitialQueryOptions : Symbol(UndefinedInitialQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 87, 2)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 90, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 91, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 92, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +> = UseQueryOptions & { +>UseQueryOptions : Symbol(UseQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 65, 1)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 90, 25)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 91, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 92, 23)) + + initialData?: undefined; +>initialData : Symbol(initialData, Decl(useQuery-CPqkvEsh.d.ts, 94, 77)) + +}; + +interface QueryObserverBaseResult { +>QueryObserverBaseResult : Symbol(QueryObserverBaseResult, Decl(useQuery-CPqkvEsh.d.ts, 96, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 98, 34)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + data: TData | undefined; +>data : Symbol(QueryObserverBaseResult.data, Decl(useQuery-CPqkvEsh.d.ts, 98, 75)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 98, 34)) + + dataUpdatedAt: number; +>dataUpdatedAt : Symbol(QueryObserverBaseResult.dataUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 99, 26)) + + error: TError | null; +>error : Symbol(QueryObserverBaseResult.error, Decl(useQuery-CPqkvEsh.d.ts, 100, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) + + errorUpdatedAt: number; +>errorUpdatedAt : Symbol(QueryObserverBaseResult.errorUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 101, 23)) + + failureCount: number; +>failureCount : Symbol(QueryObserverBaseResult.failureCount, Decl(useQuery-CPqkvEsh.d.ts, 102, 25)) + + failureReason: TError | null; +>failureReason : Symbol(QueryObserverBaseResult.failureReason, Decl(useQuery-CPqkvEsh.d.ts, 103, 23)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) + + errorUpdateCount: number; +>errorUpdateCount : Symbol(QueryObserverBaseResult.errorUpdateCount, Decl(useQuery-CPqkvEsh.d.ts, 104, 31)) + + isError: boolean; +>isError : Symbol(QueryObserverBaseResult.isError, Decl(useQuery-CPqkvEsh.d.ts, 105, 27)) + + isFetched: boolean; +>isFetched : Symbol(QueryObserverBaseResult.isFetched, Decl(useQuery-CPqkvEsh.d.ts, 106, 19)) + + isFetchedAfterMount: boolean; +>isFetchedAfterMount : Symbol(QueryObserverBaseResult.isFetchedAfterMount, Decl(useQuery-CPqkvEsh.d.ts, 107, 21)) + + isFetching: boolean; +>isFetching : Symbol(QueryObserverBaseResult.isFetching, Decl(useQuery-CPqkvEsh.d.ts, 108, 31)) + + isLoading: boolean; +>isLoading : Symbol(QueryObserverBaseResult.isLoading, Decl(useQuery-CPqkvEsh.d.ts, 109, 22)) + + isPending: boolean; +>isPending : Symbol(QueryObserverBaseResult.isPending, Decl(useQuery-CPqkvEsh.d.ts, 110, 21)) + + isLoadingError: boolean; +>isLoadingError : Symbol(QueryObserverBaseResult.isLoadingError, Decl(useQuery-CPqkvEsh.d.ts, 111, 21)) + + isInitialLoading: boolean; +>isInitialLoading : Symbol(QueryObserverBaseResult.isInitialLoading, Decl(useQuery-CPqkvEsh.d.ts, 112, 26)) + + isPaused: boolean; +>isPaused : Symbol(QueryObserverBaseResult.isPaused, Decl(useQuery-CPqkvEsh.d.ts, 113, 28)) + + isPlaceholderData: boolean; +>isPlaceholderData : Symbol(QueryObserverBaseResult.isPlaceholderData, Decl(useQuery-CPqkvEsh.d.ts, 114, 20)) + + isRefetchError: boolean; +>isRefetchError : Symbol(QueryObserverBaseResult.isRefetchError, Decl(useQuery-CPqkvEsh.d.ts, 115, 29)) + + isRefetching: boolean; +>isRefetching : Symbol(QueryObserverBaseResult.isRefetching, Decl(useQuery-CPqkvEsh.d.ts, 116, 26)) + + isStale: boolean; +>isStale : Symbol(QueryObserverBaseResult.isStale, Decl(useQuery-CPqkvEsh.d.ts, 117, 24)) + + isSuccess: boolean; +>isSuccess : Symbol(QueryObserverBaseResult.isSuccess, Decl(useQuery-CPqkvEsh.d.ts, 118, 19)) +} + +interface QueryObserverSuccessResult +>QueryObserverSuccessResult : Symbol(QueryObserverSuccessResult, Decl(useQuery-CPqkvEsh.d.ts, 120, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 122, 53)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + extends QueryObserverBaseResult { +>QueryObserverBaseResult : Symbol(QueryObserverBaseResult, Decl(useQuery-CPqkvEsh.d.ts, 96, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 122, 53)) + + data: TData; +>data : Symbol(QueryObserverSuccessResult.data, Decl(useQuery-CPqkvEsh.d.ts, 123, 50)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) + + error: null; +>error : Symbol(QueryObserverSuccessResult.error, Decl(useQuery-CPqkvEsh.d.ts, 124, 14)) + + isError: false; +>isError : Symbol(QueryObserverSuccessResult.isError, Decl(useQuery-CPqkvEsh.d.ts, 125, 14)) + + isPending: false; +>isPending : Symbol(QueryObserverSuccessResult.isPending, Decl(useQuery-CPqkvEsh.d.ts, 126, 17)) + + isLoadingError: false; +>isLoadingError : Symbol(QueryObserverSuccessResult.isLoadingError, Decl(useQuery-CPqkvEsh.d.ts, 127, 19)) + + isRefetchError: false; +>isRefetchError : Symbol(QueryObserverSuccessResult.isRefetchError, Decl(useQuery-CPqkvEsh.d.ts, 128, 24)) + + isSuccess: true; +>isSuccess : Symbol(QueryObserverSuccessResult.isSuccess, Decl(useQuery-CPqkvEsh.d.ts, 129, 24)) + + status: "success"; +>status : Symbol(QueryObserverSuccessResult.status, Decl(useQuery-CPqkvEsh.d.ts, 130, 18)) +} + +type DefinedQueryObserverResult< +>DefinedQueryObserverResult : Symbol(DefinedQueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 132, 1)) + + TData = unknown, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 134, 32)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 135, 18)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + +> = QueryObserverSuccessResult; +>QueryObserverSuccessResult : Symbol(QueryObserverSuccessResult, Decl(useQuery-CPqkvEsh.d.ts, 120, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 134, 32)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 135, 18)) + +type QueryObserverResult< +>QueryObserverResult : Symbol(QueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 137, 46)) + + TData = unknown, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 138, 25)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 139, 18)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + +> = DefinedQueryObserverResult; +>DefinedQueryObserverResult : Symbol(DefinedQueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 132, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 138, 25)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 139, 18)) + +type ToRef = { +>ToRef : Symbol(ToRef, Decl(useQuery-CPqkvEsh.d.ts, 141, 46)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 143, 11)) + + value: T; +>value : Symbol(value, Decl(useQuery-CPqkvEsh.d.ts, 143, 17)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 143, 11)) + +}; + +type UseBaseQueryReturnType< +>UseBaseQueryReturnType : Symbol(UseBaseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 145, 2)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 147, 28)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 148, 8)) + + Result = QueryObserverResult, +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>QueryObserverResult : Symbol(QueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 137, 46)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 147, 28)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 148, 8)) + +> = { + [K in keyof Result]: K extends +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + + : ToRef[K]>; +>ToRef : Symbol(ToRef, Decl(useQuery-CPqkvEsh.d.ts, 141, 46)) +>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + +} & { + suspense: () => Promise; +>suspense : Symbol(suspense, Decl(useQuery-CPqkvEsh.d.ts, 158, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) + +}; + +type UseQueryReturnType = UseBaseQueryReturnType; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 160, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 162, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 162, 30)) +>UseBaseQueryReturnType : Symbol(UseBaseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 145, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 162, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 162, 30)) + +declare function useQuery< +>useQuery : Symbol(useQuery, Decl(useQuery-CPqkvEsh.d.ts, 162, 79)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 167, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +>( + options: UndefinedInitialQueryOptions, +>options : Symbol(options, Decl(useQuery-CPqkvEsh.d.ts, 169, 2)) +>UndefinedInitialQueryOptions : Symbol(UndefinedInitialQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 87, 2)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 167, 23)) + +): UseQueryReturnType; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 160, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) + +export { type UseQueryReturnType, useQuery }; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 173, 8)) +>useQuery : Symbol(useQuery, Decl(useQuery-CPqkvEsh.d.ts, 173, 33)) + +=== node_modules/@tanstack/vue-query/build/modern/index.d.ts === +export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(index.d.ts, 0, 8)) +>useQuery : Symbol(useQuery, Decl(index.d.ts, 0, 28)) + +=== src/index.mts === +import { useQuery } from '@tanstack/vue-query' +>useQuery : Symbol(useQuery, Decl(index.mts, 0, 8)) + +const baseUrl = 'https://api.publicapis.org/' +>baseUrl : Symbol(baseUrl, Decl(index.mts, 2, 5)) + +interface IEntry { +>IEntry : Symbol(IEntry, Decl(index.mts, 2, 45)) + + API: string +>API : Symbol(IEntry.API, Decl(index.mts, 4, 18)) + + Description: string +>Description : Symbol(IEntry.Description, Decl(index.mts, 5, 13)) + + Auth: string +>Auth : Symbol(IEntry.Auth, Decl(index.mts, 6, 21)) + + HTTPS: boolean +>HTTPS : Symbol(IEntry.HTTPS, Decl(index.mts, 7, 14)) + + Cors: string +>Cors : Symbol(IEntry.Cors, Decl(index.mts, 8, 16)) + + Link: string +>Link : Symbol(IEntry.Link, Decl(index.mts, 9, 14)) + + Category: string +>Category : Symbol(IEntry.Category, Decl(index.mts, 10, 14)) +} + +const testApi = { +>testApi : Symbol(testApi, Decl(index.mts, 14, 5)) + + getEntries: (): Promise => { +>getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>IEntry : Symbol(IEntry, Decl(index.mts, 2, 45)) + + return fetch(baseUrl + 'entries') +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>fetch(baseUrl + 'entries') .then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --)) +>baseUrl : Symbol(baseUrl, Decl(index.mts, 2, 5)) + + .then((res) => res.json()) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>res : Symbol(res, Decl(index.mts, 17, 13)) +>res.json : Symbol(Body.json, Decl(lib.dom.d.ts, --, --)) +>res : Symbol(res, Decl(index.mts, 17, 13)) +>json : Symbol(Body.json, Decl(lib.dom.d.ts, --, --)) + + .then((data) => data.entries) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>data : Symbol(data, Decl(index.mts, 18, 13)) +>data : Symbol(data, Decl(index.mts, 18, 13)) + + .catch((err) => console.log(err)) +>catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) +>err : Symbol(err, Decl(index.mts, 19, 14)) +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>err : Symbol(err, Decl(index.mts, 19, 14)) + } +} + +const entryKeys = { +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) + + all: ['entries'] as const, +>all : Symbol(all, Decl(index.mts, 23, 19)) +>const : Symbol(const) + + list: () => [...entryKeys.all, 'list'] as const +>list : Symbol(list, Decl(index.mts, 24, 28)) +>entryKeys.all : Symbol(all, Decl(index.mts, 23, 19)) +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) +>all : Symbol(all, Decl(index.mts, 23, 19)) +>const : Symbol(const) +} + +export const useEntries = () => { +>useEntries : Symbol(useEntries, Decl(index.mts, 28, 12)) + + return useQuery({ +>useQuery : Symbol(useQuery, Decl(index.mts, 0, 8)) + + queryKey: entryKeys.list(), +>queryKey : Symbol(queryKey, Decl(index.mts, 29, 19)) +>entryKeys.list : Symbol(list, Decl(index.mts, 24, 28)) +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) +>list : Symbol(list, Decl(index.mts, 24, 28)) + + queryFn: testApi.getEntries, +>queryFn : Symbol(queryFn, Decl(index.mts, 30, 31)) +>testApi.getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) +>testApi : Symbol(testApi, Decl(index.mts, 14, 5)) +>getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) + + select: (data) => data.slice(0, 10) +>select : Symbol(select, Decl(index.mts, 31, 32)) +>data : Symbol(data, Decl(index.mts, 32, 13)) +>data.slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --)) +>data : Symbol(data, Decl(index.mts, 32, 13)) +>slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --)) + + }) +} + diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types new file mode 100644 index 0000000000000..3e4b04385237a --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types @@ -0,0 +1,444 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts] //// + +=== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts === +type QueryKey = ReadonlyArray; +>QueryKey : readonly unknown[] + +interface Register {} + +type DefaultError = Register extends { +>DefaultError : Error + + defaultError: infer TError; +>defaultError : TError +} + ? TError + : Error; + +type ShouldRetryFunction = ( +>ShouldRetryFunction : ShouldRetryFunction + + failureCount: number, +>failureCount : number + + error: TError, +>error : TError + +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; +>RetryValue : RetryValue + +type QueryFunctionContext< +>QueryFunctionContext : QueryFunctionContext + + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; +>queryKey : TQueryKey + } + : { + queryKey: TQueryKey; +>queryKey : TQueryKey + + pageParam: TPageParam; +>pageParam : TPageParam + + }; + +type QueryFunction< +>QueryFunction : QueryFunction + + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; +>context : QueryFunctionContext + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; +>retry : RetryValue | undefined + + queryFn?: QueryFunction; +>queryFn : QueryFunction | undefined + + queryKey?: TQueryKey; +>queryKey : TQueryKey | undefined + + initialData?: TData; +>initialData : TData | undefined + + initialDataUpdatedAt?: number | (() => number | undefined); +>initialDataUpdatedAt : number | (() => number | undefined) | undefined +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; +>enabled : boolean | undefined + + refetchInterval?: number; +>refetchInterval : number | undefined + + select?: (data: TQueryData) => TData; +>select : ((data: TQueryData) => TData) | undefined +>data : TQueryData +} + +type UseQueryOptions< +>UseQueryOptions : UseQueryOptions + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< +>UndefinedInitialQueryOptions : UndefinedInitialQueryOptions + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +>initialData : undefined + +}; + +interface QueryObserverBaseResult { + data: TData | undefined; +>data : TData | undefined + + dataUpdatedAt: number; +>dataUpdatedAt : number + + error: TError | null; +>error : TError | null + + errorUpdatedAt: number; +>errorUpdatedAt : number + + failureCount: number; +>failureCount : number + + failureReason: TError | null; +>failureReason : TError | null + + errorUpdateCount: number; +>errorUpdateCount : number + + isError: boolean; +>isError : boolean + + isFetched: boolean; +>isFetched : boolean + + isFetchedAfterMount: boolean; +>isFetchedAfterMount : boolean + + isFetching: boolean; +>isFetching : boolean + + isLoading: boolean; +>isLoading : boolean + + isPending: boolean; +>isPending : boolean + + isLoadingError: boolean; +>isLoadingError : boolean + + isInitialLoading: boolean; +>isInitialLoading : boolean + + isPaused: boolean; +>isPaused : boolean + + isPlaceholderData: boolean; +>isPlaceholderData : boolean + + isRefetchError: boolean; +>isRefetchError : boolean + + isRefetching: boolean; +>isRefetching : boolean + + isStale: boolean; +>isStale : boolean + + isSuccess: boolean; +>isSuccess : boolean +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; +>data : TData + + error: null; +>error : null + + isError: false; +>isError : false +>false : false + + isPending: false; +>isPending : false +>false : false + + isLoadingError: false; +>isLoadingError : false +>false : false + + isRefetchError: false; +>isRefetchError : false +>false : false + + isSuccess: true; +>isSuccess : true +>true : true + + status: "success"; +>status : "success" +} + +type DefinedQueryObserverResult< +>DefinedQueryObserverResult : DefinedQueryObserverResult + + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< +>QueryObserverResult : QueryObserverResult + + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { +>ToRef : ToRef + + value: T; +>value : T + +}; + +type UseBaseQueryReturnType< +>UseBaseQueryReturnType : UseBaseQueryReturnType + + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +>suspense : () => Promise + +}; + +type UseQueryReturnType = UseBaseQueryReturnType; +>UseQueryReturnType : UseQueryReturnType + +declare function useQuery< +>useQuery : (options: UndefinedInitialQueryOptions) => UseQueryReturnType + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +>options : UndefinedInitialQueryOptions + +): UseQueryReturnType; + +export { type UseQueryReturnType, useQuery }; +>UseQueryReturnType : any +>useQuery : (options: UndefinedInitialQueryOptions) => UseQueryReturnType + +=== node_modules/@tanstack/vue-query/build/modern/index.d.ts === +export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; +>UseQueryReturnType : any +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType + +=== src/index.mts === +import { useQuery } from '@tanstack/vue-query' +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType + +const baseUrl = 'https://api.publicapis.org/' +>baseUrl : "https://api.publicapis.org/" +>'https://api.publicapis.org/' : "https://api.publicapis.org/" + +interface IEntry { + API: string +>API : string + + Description: string +>Description : string + + Auth: string +>Auth : string + + HTTPS: boolean +>HTTPS : boolean + + Cors: string +>Cors : string + + Link: string +>Link : string + + Category: string +>Category : string +} + +const testApi = { +>testApi : { getEntries: () => Promise; } +>{ getEntries: (): Promise => { return fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) }} : { getEntries: () => Promise; } + + getEntries: (): Promise => { +>getEntries : () => Promise +>(): Promise => { return fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) } : () => Promise + + return fetch(baseUrl + 'entries') +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) : Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) : Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then : (onfulfilled?: ((value: any) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) : Promise +>fetch(baseUrl + 'entries') .then : (onfulfilled?: ((value: Response) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') : Promise +>fetch : (input: RequestInfo | URL, init?: RequestInit | undefined) => Promise +>baseUrl + 'entries' : string +>baseUrl : "https://api.publicapis.org/" +>'entries' : "entries" + + .then((res) => res.json()) +>then : (onfulfilled?: ((value: Response) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>(res) => res.json() : (res: Response) => Promise +>res : Response +>res.json() : Promise +>res.json : () => Promise +>res : Response +>json : () => Promise + + .then((data) => data.entries) +>then : (onfulfilled?: ((value: any) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>(data) => data.entries : (data: any) => any +>data : any +>data.entries : any +>data : any +>entries : any + + .catch((err) => console.log(err)) +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>(err) => console.log(err) : (err: any) => void +>err : any +>console.log(err) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>err : any + } +} + +const entryKeys = { +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>{ all: ['entries'] as const, list: () => [...entryKeys.all, 'list'] as const} : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } + + all: ['entries'] as const, +>all : readonly ["entries"] +>['entries'] as const : readonly ["entries"] +>['entries'] : readonly ["entries"] +>'entries' : "entries" + + list: () => [...entryKeys.all, 'list'] as const +>list : () => readonly ["entries", "list"] +>() => [...entryKeys.all, 'list'] as const : () => readonly ["entries", "list"] +>[...entryKeys.all, 'list'] as const : readonly ["entries", "list"] +>[...entryKeys.all, 'list'] : readonly ["entries", "list"] +>...entryKeys.all : "entries" +>entryKeys.all : readonly ["entries"] +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>all : readonly ["entries"] +>'list' : "list" +} + +export const useEntries = () => { +>useEntries : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType +>() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType + + return useQuery({ +>useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType +>{ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) } : { queryKey: readonly ["entries", "list"]; queryFn: () => Promise; select: (data: IEntry[]) => IEntry[]; } + + queryKey: entryKeys.list(), +>queryKey : readonly ["entries", "list"] +>entryKeys.list() : readonly ["entries", "list"] +>entryKeys.list : () => readonly ["entries", "list"] +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>list : () => readonly ["entries", "list"] + + queryFn: testApi.getEntries, +>queryFn : () => Promise +>testApi.getEntries : () => Promise +>testApi : { getEntries: () => Promise; } +>getEntries : () => Promise + + select: (data) => data.slice(0, 10) +>select : (data: IEntry[]) => IEntry[] +>(data) => data.slice(0, 10) : (data: IEntry[]) => IEntry[] +>data : IEntry[] +>data.slice(0, 10) : IEntry[] +>data.slice : (start?: number | undefined, end?: number | undefined) => IEntry[] +>data : IEntry[] +>slice : (start?: number | undefined, end?: number | undefined) => IEntry[] +>0 : 0 +>10 : 10 + + }) +} + diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.js b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.js new file mode 100644 index 0000000000000..30edd83e29a80 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.js @@ -0,0 +1,273 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts] //// + +//// [useQuery-CPqkvEsh.d.ts] +type QueryKey = ReadonlyArray; + +interface Register {} + +type DefaultError = Register extends { + defaultError: infer TError; +} + ? TError + : Error; + +type ShouldRetryFunction = ( + failureCount: number, + error: TError, +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; + +type QueryFunctionContext< + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; + } + : { + queryKey: TQueryKey; + pageParam: TPageParam; + }; + +type QueryFunction< + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; + queryFn?: QueryFunction; + queryKey?: TQueryKey; + initialData?: TData; + initialDataUpdatedAt?: number | (() => number | undefined); +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; + refetchInterval?: number; + select?: (data: TQueryData) => TData; +} + +type UseQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +}; + +interface QueryObserverBaseResult { + data: TData | undefined; + dataUpdatedAt: number; + error: TError | null; + errorUpdatedAt: number; + failureCount: number; + failureReason: TError | null; + errorUpdateCount: number; + isError: boolean; + isFetched: boolean; + isFetchedAfterMount: boolean; + isFetching: boolean; + isLoading: boolean; + isPending: boolean; + isLoadingError: boolean; + isInitialLoading: boolean; + isPaused: boolean; + isPlaceholderData: boolean; + isRefetchError: boolean; + isRefetching: boolean; + isStale: boolean; + isSuccess: boolean; +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + status: "success"; +} + +type DefinedQueryObserverResult< + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { + value: T; +}; + +type UseBaseQueryReturnType< + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +}; + +type UseQueryReturnType = UseBaseQueryReturnType; + +declare function useQuery< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +): UseQueryReturnType; + +export { type UseQueryReturnType as b, useQuery as u }; + +//// [index.d.ts] +export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; + +//// [package.json] +{ + "name": "@tanstack/vue-query", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./build/modern/index.d.ts", + "default": "./build/modern/index.js" + }, + "require": { + "types": "./build/modern/index.d.cts", + "default": "./build/modern/index.cjs" + } + } + } +} + +//// [index.mts] +import { useQuery } from '@tanstack/vue-query' + +const baseUrl = 'https://api.publicapis.org/' + +interface IEntry { + API: string + Description: string + Auth: string + HTTPS: boolean + Cors: string + Link: string + Category: string +} + +const testApi = { + getEntries: (): Promise => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)) + } +} + +const entryKeys = { + all: ['entries'] as const, + list: () => [...entryKeys.all, 'list'] as const +} + +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }) +} + + +//// [index.mjs] +import { useQuery } from '@tanstack/vue-query'; +const baseUrl = 'https://api.publicapis.org/'; +const testApi = { + getEntries: () => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)); + } +}; +const entryKeys = { + all: ['entries'], + list: () => [...entryKeys.all, 'list'] +}; +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }); +}; + + +//// [index.d.mts] +interface IEntry { + API: string; + Description: string; + Auth: string; + HTTPS: boolean; + Cors: string; + Link: string; + Category: string; +} +export declare const useEntries: () => import("@tanstack/vue-query").UseQueryReturnType; +export {}; diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.symbols b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.symbols new file mode 100644 index 0000000000000..7bdc3450c2fc8 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.symbols @@ -0,0 +1,657 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts] //// + +=== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts === +type QueryKey = ReadonlyArray; +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 3 more) + +interface Register {} +>Register : Symbol(Register, Decl(useQuery-CPqkvEsh.d.ts, 0, 39)) + +type DefaultError = Register extends { +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) +>Register : Symbol(Register, Decl(useQuery-CPqkvEsh.d.ts, 0, 39)) + + defaultError: infer TError; +>defaultError : Symbol(defaultError, Decl(useQuery-CPqkvEsh.d.ts, 4, 38)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 5, 21)) +} + ? TError +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 5, 21)) + + : Error; +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) + +type ShouldRetryFunction = ( +>ShouldRetryFunction : Symbol(ShouldRetryFunction, Decl(useQuery-CPqkvEsh.d.ts, 8, 10)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 10, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + failureCount: number, +>failureCount : Symbol(failureCount, Decl(useQuery-CPqkvEsh.d.ts, 10, 51)) + + error: TError, +>error : Symbol(error, Decl(useQuery-CPqkvEsh.d.ts, 11, 23)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 10, 25)) + +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; +>RetryValue : Symbol(RetryValue, Decl(useQuery-CPqkvEsh.d.ts, 13, 13)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 14, 16)) +>ShouldRetryFunction : Symbol(ShouldRetryFunction, Decl(useQuery-CPqkvEsh.d.ts, 8, 10)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 14, 16)) + +type QueryFunctionContext< +>QueryFunctionContext : Symbol(QueryFunctionContext, Decl(useQuery-CPqkvEsh.d.ts, 14, 73)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + +> = [TPageParam] extends [never] +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + + ? { + queryKey: TQueryKey; +>queryKey : Symbol(queryKey, Decl(useQuery-CPqkvEsh.d.ts, 20, 5)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) + } + : { + queryKey: TQueryKey; +>queryKey : Symbol(queryKey, Decl(useQuery-CPqkvEsh.d.ts, 23, 5)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) + + pageParam: TPageParam; +>pageParam : Symbol(pageParam, Decl(useQuery-CPqkvEsh.d.ts, 24, 26)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + + }; + +type QueryFunction< +>QueryFunction : Symbol(QueryFunction, Decl(useQuery-CPqkvEsh.d.ts, 26, 6)) + + T = unknown, +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 29, 14)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 30, 40)) + +> = (context: QueryFunctionContext) => T | Promise; +>context : Symbol(context, Decl(useQuery-CPqkvEsh.d.ts, 32, 5)) +>QueryFunctionContext : Symbol(QueryFunctionContext, Decl(useQuery-CPqkvEsh.d.ts, 14, 73)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 29, 14)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 30, 40)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) + +interface QueryOptions< +>QueryOptions : Symbol(QueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 32, 77)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 35, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 36, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 38, 40)) + +> { + retry?: RetryValue; +>retry : Symbol(QueryOptions.retry, Decl(useQuery-CPqkvEsh.d.ts, 40, 3)) +>RetryValue : Symbol(RetryValue, Decl(useQuery-CPqkvEsh.d.ts, 13, 13)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 35, 25)) + + queryFn?: QueryFunction; +>queryFn : Symbol(QueryOptions.queryFn, Decl(useQuery-CPqkvEsh.d.ts, 41, 29)) +>QueryFunction : Symbol(QueryFunction, Decl(useQuery-CPqkvEsh.d.ts, 26, 6)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 38, 40)) + + queryKey?: TQueryKey; +>queryKey : Symbol(QueryOptions.queryKey, Decl(useQuery-CPqkvEsh.d.ts, 42, 63)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) + + initialData?: TData; +>initialData : Symbol(QueryOptions.initialData, Decl(useQuery-CPqkvEsh.d.ts, 43, 23)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 36, 24)) + + initialDataUpdatedAt?: number | (() => number | undefined); +>initialDataUpdatedAt : Symbol(QueryOptions.initialDataUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 44, 22)) +} + +interface QueryObserverOptions< +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 49, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 50, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TQueryData = TQueryFnData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 52, 28)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 53, 40)) + +> extends QueryOptions< +>QueryOptions : Symbol(QueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 32, 77)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 49, 25)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) + + TQueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 52, 28)) + + TPageParam +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 53, 40)) + + > { + enabled?: boolean; +>enabled : Symbol(QueryObserverOptions.enabled, Decl(useQuery-CPqkvEsh.d.ts, 61, 5)) + + refetchInterval?: number; +>refetchInterval : Symbol(QueryObserverOptions.refetchInterval, Decl(useQuery-CPqkvEsh.d.ts, 62, 20)) + + select?: (data: TQueryData) => TData; +>select : Symbol(QueryObserverOptions.select, Decl(useQuery-CPqkvEsh.d.ts, 63, 27)) +>data : Symbol(data, Decl(useQuery-CPqkvEsh.d.ts, 64, 12)) +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 50, 24)) +} + +type UseQueryOptions< +>UseQueryOptions : Symbol(UseQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 65, 1)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TQueryData = TQueryFnData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +> = { + [Property in keyof QueryObserverOptions< +>Property : Symbol(Property, Decl(useQuery-CPqkvEsh.d.ts, 74, 3)) +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) + + TQueryKey +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) + + >]: QueryObserverOptions< +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) + + TQueryKey +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) + + >[Property]; +>Property : Symbol(Property, Decl(useQuery-CPqkvEsh.d.ts, 74, 3)) + +}; + +type UndefinedInitialQueryOptions< +>UndefinedInitialQueryOptions : Symbol(UndefinedInitialQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 87, 2)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 90, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 91, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 92, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +> = UseQueryOptions & { +>UseQueryOptions : Symbol(UseQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 65, 1)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 90, 25)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 91, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 92, 23)) + + initialData?: undefined; +>initialData : Symbol(initialData, Decl(useQuery-CPqkvEsh.d.ts, 94, 77)) + +}; + +interface QueryObserverBaseResult { +>QueryObserverBaseResult : Symbol(QueryObserverBaseResult, Decl(useQuery-CPqkvEsh.d.ts, 96, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 98, 34)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + data: TData | undefined; +>data : Symbol(QueryObserverBaseResult.data, Decl(useQuery-CPqkvEsh.d.ts, 98, 75)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 98, 34)) + + dataUpdatedAt: number; +>dataUpdatedAt : Symbol(QueryObserverBaseResult.dataUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 99, 26)) + + error: TError | null; +>error : Symbol(QueryObserverBaseResult.error, Decl(useQuery-CPqkvEsh.d.ts, 100, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) + + errorUpdatedAt: number; +>errorUpdatedAt : Symbol(QueryObserverBaseResult.errorUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 101, 23)) + + failureCount: number; +>failureCount : Symbol(QueryObserverBaseResult.failureCount, Decl(useQuery-CPqkvEsh.d.ts, 102, 25)) + + failureReason: TError | null; +>failureReason : Symbol(QueryObserverBaseResult.failureReason, Decl(useQuery-CPqkvEsh.d.ts, 103, 23)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) + + errorUpdateCount: number; +>errorUpdateCount : Symbol(QueryObserverBaseResult.errorUpdateCount, Decl(useQuery-CPqkvEsh.d.ts, 104, 31)) + + isError: boolean; +>isError : Symbol(QueryObserverBaseResult.isError, Decl(useQuery-CPqkvEsh.d.ts, 105, 27)) + + isFetched: boolean; +>isFetched : Symbol(QueryObserverBaseResult.isFetched, Decl(useQuery-CPqkvEsh.d.ts, 106, 19)) + + isFetchedAfterMount: boolean; +>isFetchedAfterMount : Symbol(QueryObserverBaseResult.isFetchedAfterMount, Decl(useQuery-CPqkvEsh.d.ts, 107, 21)) + + isFetching: boolean; +>isFetching : Symbol(QueryObserverBaseResult.isFetching, Decl(useQuery-CPqkvEsh.d.ts, 108, 31)) + + isLoading: boolean; +>isLoading : Symbol(QueryObserverBaseResult.isLoading, Decl(useQuery-CPqkvEsh.d.ts, 109, 22)) + + isPending: boolean; +>isPending : Symbol(QueryObserverBaseResult.isPending, Decl(useQuery-CPqkvEsh.d.ts, 110, 21)) + + isLoadingError: boolean; +>isLoadingError : Symbol(QueryObserverBaseResult.isLoadingError, Decl(useQuery-CPqkvEsh.d.ts, 111, 21)) + + isInitialLoading: boolean; +>isInitialLoading : Symbol(QueryObserverBaseResult.isInitialLoading, Decl(useQuery-CPqkvEsh.d.ts, 112, 26)) + + isPaused: boolean; +>isPaused : Symbol(QueryObserverBaseResult.isPaused, Decl(useQuery-CPqkvEsh.d.ts, 113, 28)) + + isPlaceholderData: boolean; +>isPlaceholderData : Symbol(QueryObserverBaseResult.isPlaceholderData, Decl(useQuery-CPqkvEsh.d.ts, 114, 20)) + + isRefetchError: boolean; +>isRefetchError : Symbol(QueryObserverBaseResult.isRefetchError, Decl(useQuery-CPqkvEsh.d.ts, 115, 29)) + + isRefetching: boolean; +>isRefetching : Symbol(QueryObserverBaseResult.isRefetching, Decl(useQuery-CPqkvEsh.d.ts, 116, 26)) + + isStale: boolean; +>isStale : Symbol(QueryObserverBaseResult.isStale, Decl(useQuery-CPqkvEsh.d.ts, 117, 24)) + + isSuccess: boolean; +>isSuccess : Symbol(QueryObserverBaseResult.isSuccess, Decl(useQuery-CPqkvEsh.d.ts, 118, 19)) +} + +interface QueryObserverSuccessResult +>QueryObserverSuccessResult : Symbol(QueryObserverSuccessResult, Decl(useQuery-CPqkvEsh.d.ts, 120, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 122, 53)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + extends QueryObserverBaseResult { +>QueryObserverBaseResult : Symbol(QueryObserverBaseResult, Decl(useQuery-CPqkvEsh.d.ts, 96, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 122, 53)) + + data: TData; +>data : Symbol(QueryObserverSuccessResult.data, Decl(useQuery-CPqkvEsh.d.ts, 123, 50)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) + + error: null; +>error : Symbol(QueryObserverSuccessResult.error, Decl(useQuery-CPqkvEsh.d.ts, 124, 14)) + + isError: false; +>isError : Symbol(QueryObserverSuccessResult.isError, Decl(useQuery-CPqkvEsh.d.ts, 125, 14)) + + isPending: false; +>isPending : Symbol(QueryObserverSuccessResult.isPending, Decl(useQuery-CPqkvEsh.d.ts, 126, 17)) + + isLoadingError: false; +>isLoadingError : Symbol(QueryObserverSuccessResult.isLoadingError, Decl(useQuery-CPqkvEsh.d.ts, 127, 19)) + + isRefetchError: false; +>isRefetchError : Symbol(QueryObserverSuccessResult.isRefetchError, Decl(useQuery-CPqkvEsh.d.ts, 128, 24)) + + isSuccess: true; +>isSuccess : Symbol(QueryObserverSuccessResult.isSuccess, Decl(useQuery-CPqkvEsh.d.ts, 129, 24)) + + status: "success"; +>status : Symbol(QueryObserverSuccessResult.status, Decl(useQuery-CPqkvEsh.d.ts, 130, 18)) +} + +type DefinedQueryObserverResult< +>DefinedQueryObserverResult : Symbol(DefinedQueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 132, 1)) + + TData = unknown, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 134, 32)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 135, 18)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + +> = QueryObserverSuccessResult; +>QueryObserverSuccessResult : Symbol(QueryObserverSuccessResult, Decl(useQuery-CPqkvEsh.d.ts, 120, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 134, 32)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 135, 18)) + +type QueryObserverResult< +>QueryObserverResult : Symbol(QueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 137, 46)) + + TData = unknown, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 138, 25)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 139, 18)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + +> = DefinedQueryObserverResult; +>DefinedQueryObserverResult : Symbol(DefinedQueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 132, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 138, 25)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 139, 18)) + +type ToRef = { +>ToRef : Symbol(ToRef, Decl(useQuery-CPqkvEsh.d.ts, 141, 46)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 143, 11)) + + value: T; +>value : Symbol(value, Decl(useQuery-CPqkvEsh.d.ts, 143, 17)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 143, 11)) + +}; + +type UseBaseQueryReturnType< +>UseBaseQueryReturnType : Symbol(UseBaseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 145, 2)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 147, 28)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 148, 8)) + + Result = QueryObserverResult, +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>QueryObserverResult : Symbol(QueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 137, 46)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 147, 28)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 148, 8)) + +> = { + [K in keyof Result]: K extends +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + + : ToRef[K]>; +>ToRef : Symbol(ToRef, Decl(useQuery-CPqkvEsh.d.ts, 141, 46)) +>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + +} & { + suspense: () => Promise; +>suspense : Symbol(suspense, Decl(useQuery-CPqkvEsh.d.ts, 158, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) + +}; + +type UseQueryReturnType = UseBaseQueryReturnType; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 160, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 162, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 162, 30)) +>UseBaseQueryReturnType : Symbol(UseBaseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 145, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 162, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 162, 30)) + +declare function useQuery< +>useQuery : Symbol(useQuery, Decl(useQuery-CPqkvEsh.d.ts, 162, 79)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 167, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +>( + options: UndefinedInitialQueryOptions, +>options : Symbol(options, Decl(useQuery-CPqkvEsh.d.ts, 169, 2)) +>UndefinedInitialQueryOptions : Symbol(UndefinedInitialQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 87, 2)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 167, 23)) + +): UseQueryReturnType; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 160, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) + +export { type UseQueryReturnType as b, useQuery as u }; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 160, 2)) +>b : Symbol(b, Decl(useQuery-CPqkvEsh.d.ts, 173, 8)) +>useQuery : Symbol(useQuery, Decl(useQuery-CPqkvEsh.d.ts, 162, 79)) +>u : Symbol(u, Decl(useQuery-CPqkvEsh.d.ts, 173, 38)) + +=== node_modules/@tanstack/vue-query/build/modern/index.d.ts === +export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; +>b : Symbol(b, Decl(useQuery-CPqkvEsh.d.ts, 173, 8)) +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(index.d.ts, 0, 8)) +>u : Symbol(u, Decl(useQuery-CPqkvEsh.d.ts, 173, 38)) +>useQuery : Symbol(useQuery, Decl(index.d.ts, 0, 33)) + +=== src/index.mts === +import { useQuery } from '@tanstack/vue-query' +>useQuery : Symbol(useQuery, Decl(index.mts, 0, 8)) + +const baseUrl = 'https://api.publicapis.org/' +>baseUrl : Symbol(baseUrl, Decl(index.mts, 2, 5)) + +interface IEntry { +>IEntry : Symbol(IEntry, Decl(index.mts, 2, 45)) + + API: string +>API : Symbol(IEntry.API, Decl(index.mts, 4, 18)) + + Description: string +>Description : Symbol(IEntry.Description, Decl(index.mts, 5, 13)) + + Auth: string +>Auth : Symbol(IEntry.Auth, Decl(index.mts, 6, 21)) + + HTTPS: boolean +>HTTPS : Symbol(IEntry.HTTPS, Decl(index.mts, 7, 14)) + + Cors: string +>Cors : Symbol(IEntry.Cors, Decl(index.mts, 8, 16)) + + Link: string +>Link : Symbol(IEntry.Link, Decl(index.mts, 9, 14)) + + Category: string +>Category : Symbol(IEntry.Category, Decl(index.mts, 10, 14)) +} + +const testApi = { +>testApi : Symbol(testApi, Decl(index.mts, 14, 5)) + + getEntries: (): Promise => { +>getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>IEntry : Symbol(IEntry, Decl(index.mts, 2, 45)) + + return fetch(baseUrl + 'entries') +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>fetch(baseUrl + 'entries') .then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --)) +>baseUrl : Symbol(baseUrl, Decl(index.mts, 2, 5)) + + .then((res) => res.json()) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>res : Symbol(res, Decl(index.mts, 17, 13)) +>res.json : Symbol(Body.json, Decl(lib.dom.d.ts, --, --)) +>res : Symbol(res, Decl(index.mts, 17, 13)) +>json : Symbol(Body.json, Decl(lib.dom.d.ts, --, --)) + + .then((data) => data.entries) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>data : Symbol(data, Decl(index.mts, 18, 13)) +>data : Symbol(data, Decl(index.mts, 18, 13)) + + .catch((err) => console.log(err)) +>catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) +>err : Symbol(err, Decl(index.mts, 19, 14)) +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>err : Symbol(err, Decl(index.mts, 19, 14)) + } +} + +const entryKeys = { +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) + + all: ['entries'] as const, +>all : Symbol(all, Decl(index.mts, 23, 19)) +>const : Symbol(const) + + list: () => [...entryKeys.all, 'list'] as const +>list : Symbol(list, Decl(index.mts, 24, 28)) +>entryKeys.all : Symbol(all, Decl(index.mts, 23, 19)) +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) +>all : Symbol(all, Decl(index.mts, 23, 19)) +>const : Symbol(const) +} + +export const useEntries = () => { +>useEntries : Symbol(useEntries, Decl(index.mts, 28, 12)) + + return useQuery({ +>useQuery : Symbol(useQuery, Decl(index.mts, 0, 8)) + + queryKey: entryKeys.list(), +>queryKey : Symbol(queryKey, Decl(index.mts, 29, 19)) +>entryKeys.list : Symbol(list, Decl(index.mts, 24, 28)) +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) +>list : Symbol(list, Decl(index.mts, 24, 28)) + + queryFn: testApi.getEntries, +>queryFn : Symbol(queryFn, Decl(index.mts, 30, 31)) +>testApi.getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) +>testApi : Symbol(testApi, Decl(index.mts, 14, 5)) +>getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) + + select: (data) => data.slice(0, 10) +>select : Symbol(select, Decl(index.mts, 31, 32)) +>data : Symbol(data, Decl(index.mts, 32, 13)) +>data.slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --)) +>data : Symbol(data, Decl(index.mts, 32, 13)) +>slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --)) + + }) +} + diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types new file mode 100644 index 0000000000000..a0454cddfd856 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types @@ -0,0 +1,448 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts] //// + +=== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts === +type QueryKey = ReadonlyArray; +>QueryKey : readonly unknown[] + +interface Register {} + +type DefaultError = Register extends { +>DefaultError : Error + + defaultError: infer TError; +>defaultError : TError +} + ? TError + : Error; + +type ShouldRetryFunction = ( +>ShouldRetryFunction : ShouldRetryFunction + + failureCount: number, +>failureCount : number + + error: TError, +>error : TError + +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; +>RetryValue : RetryValue + +type QueryFunctionContext< +>QueryFunctionContext : QueryFunctionContext + + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; +>queryKey : TQueryKey + } + : { + queryKey: TQueryKey; +>queryKey : TQueryKey + + pageParam: TPageParam; +>pageParam : TPageParam + + }; + +type QueryFunction< +>QueryFunction : QueryFunction + + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; +>context : QueryFunctionContext + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; +>retry : RetryValue | undefined + + queryFn?: QueryFunction; +>queryFn : QueryFunction | undefined + + queryKey?: TQueryKey; +>queryKey : TQueryKey | undefined + + initialData?: TData; +>initialData : TData | undefined + + initialDataUpdatedAt?: number | (() => number | undefined); +>initialDataUpdatedAt : number | (() => number | undefined) | undefined +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; +>enabled : boolean | undefined + + refetchInterval?: number; +>refetchInterval : number | undefined + + select?: (data: TQueryData) => TData; +>select : ((data: TQueryData) => TData) | undefined +>data : TQueryData +} + +type UseQueryOptions< +>UseQueryOptions : UseQueryOptions + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< +>UndefinedInitialQueryOptions : UndefinedInitialQueryOptions + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +>initialData : undefined + +}; + +interface QueryObserverBaseResult { + data: TData | undefined; +>data : TData | undefined + + dataUpdatedAt: number; +>dataUpdatedAt : number + + error: TError | null; +>error : TError | null + + errorUpdatedAt: number; +>errorUpdatedAt : number + + failureCount: number; +>failureCount : number + + failureReason: TError | null; +>failureReason : TError | null + + errorUpdateCount: number; +>errorUpdateCount : number + + isError: boolean; +>isError : boolean + + isFetched: boolean; +>isFetched : boolean + + isFetchedAfterMount: boolean; +>isFetchedAfterMount : boolean + + isFetching: boolean; +>isFetching : boolean + + isLoading: boolean; +>isLoading : boolean + + isPending: boolean; +>isPending : boolean + + isLoadingError: boolean; +>isLoadingError : boolean + + isInitialLoading: boolean; +>isInitialLoading : boolean + + isPaused: boolean; +>isPaused : boolean + + isPlaceholderData: boolean; +>isPlaceholderData : boolean + + isRefetchError: boolean; +>isRefetchError : boolean + + isRefetching: boolean; +>isRefetching : boolean + + isStale: boolean; +>isStale : boolean + + isSuccess: boolean; +>isSuccess : boolean +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; +>data : TData + + error: null; +>error : null + + isError: false; +>isError : false +>false : false + + isPending: false; +>isPending : false +>false : false + + isLoadingError: false; +>isLoadingError : false +>false : false + + isRefetchError: false; +>isRefetchError : false +>false : false + + isSuccess: true; +>isSuccess : true +>true : true + + status: "success"; +>status : "success" +} + +type DefinedQueryObserverResult< +>DefinedQueryObserverResult : DefinedQueryObserverResult + + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< +>QueryObserverResult : QueryObserverResult + + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { +>ToRef : ToRef + + value: T; +>value : T + +}; + +type UseBaseQueryReturnType< +>UseBaseQueryReturnType : UseBaseQueryReturnType + + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +>suspense : () => Promise + +}; + +type UseQueryReturnType = UseBaseQueryReturnType; +>UseQueryReturnType : UseQueryReturnType + +declare function useQuery< +>useQuery : (options: UndefinedInitialQueryOptions) => UseQueryReturnType + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +>options : UndefinedInitialQueryOptions + +): UseQueryReturnType; + +export { type UseQueryReturnType as b, useQuery as u }; +>UseQueryReturnType : any +>b : any +>useQuery : (options: UndefinedInitialQueryOptions) => UseQueryReturnType +>u : (options: UndefinedInitialQueryOptions) => UseQueryReturnType + +=== node_modules/@tanstack/vue-query/build/modern/index.d.ts === +export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; +>b : any +>UseQueryReturnType : any +>u : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b + +=== src/index.mts === +import { useQuery } from '@tanstack/vue-query' +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b + +const baseUrl = 'https://api.publicapis.org/' +>baseUrl : "https://api.publicapis.org/" +>'https://api.publicapis.org/' : "https://api.publicapis.org/" + +interface IEntry { + API: string +>API : string + + Description: string +>Description : string + + Auth: string +>Auth : string + + HTTPS: boolean +>HTTPS : boolean + + Cors: string +>Cors : string + + Link: string +>Link : string + + Category: string +>Category : string +} + +const testApi = { +>testApi : { getEntries: () => Promise; } +>{ getEntries: (): Promise => { return fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) }} : { getEntries: () => Promise; } + + getEntries: (): Promise => { +>getEntries : () => Promise +>(): Promise => { return fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) } : () => Promise + + return fetch(baseUrl + 'entries') +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) : Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) : Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then : (onfulfilled?: ((value: any) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) : Promise +>fetch(baseUrl + 'entries') .then : (onfulfilled?: ((value: Response) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') : Promise +>fetch : (input: RequestInfo | URL, init?: RequestInit | undefined) => Promise +>baseUrl + 'entries' : string +>baseUrl : "https://api.publicapis.org/" +>'entries' : "entries" + + .then((res) => res.json()) +>then : (onfulfilled?: ((value: Response) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>(res) => res.json() : (res: Response) => Promise +>res : Response +>res.json() : Promise +>res.json : () => Promise +>res : Response +>json : () => Promise + + .then((data) => data.entries) +>then : (onfulfilled?: ((value: any) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>(data) => data.entries : (data: any) => any +>data : any +>data.entries : any +>data : any +>entries : any + + .catch((err) => console.log(err)) +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>(err) => console.log(err) : (err: any) => void +>err : any +>console.log(err) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>err : any + } +} + +const entryKeys = { +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>{ all: ['entries'] as const, list: () => [...entryKeys.all, 'list'] as const} : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } + + all: ['entries'] as const, +>all : readonly ["entries"] +>['entries'] as const : readonly ["entries"] +>['entries'] : readonly ["entries"] +>'entries' : "entries" + + list: () => [...entryKeys.all, 'list'] as const +>list : () => readonly ["entries", "list"] +>() => [...entryKeys.all, 'list'] as const : () => readonly ["entries", "list"] +>[...entryKeys.all, 'list'] as const : readonly ["entries", "list"] +>[...entryKeys.all, 'list'] : readonly ["entries", "list"] +>...entryKeys.all : "entries" +>entryKeys.all : readonly ["entries"] +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>all : readonly ["entries"] +>'list' : "list" +} + +export const useEntries = () => { +>useEntries : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b + + return useQuery({ +>useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>{ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) } : { queryKey: readonly ["entries", "list"]; queryFn: () => Promise; select: (data: IEntry[]) => IEntry[]; } + + queryKey: entryKeys.list(), +>queryKey : readonly ["entries", "list"] +>entryKeys.list() : readonly ["entries", "list"] +>entryKeys.list : () => readonly ["entries", "list"] +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>list : () => readonly ["entries", "list"] + + queryFn: testApi.getEntries, +>queryFn : () => Promise +>testApi.getEntries : () => Promise +>testApi : { getEntries: () => Promise; } +>getEntries : () => Promise + + select: (data) => data.slice(0, 10) +>select : (data: IEntry[]) => IEntry[] +>(data) => data.slice(0, 10) : (data: IEntry[]) => IEntry[] +>data : IEntry[] +>data.slice(0, 10) : IEntry[] +>data.slice : (start?: number | undefined, end?: number | undefined) => IEntry[] +>data : IEntry[] +>slice : (start?: number | undefined, end?: number | undefined) => IEntry[] +>0 : 0 +>10 : 10 + + }) +} + diff --git a/tests/baselines/reference/declarationEmitUsingTypeAlias1.js b/tests/baselines/reference/declarationEmitUsingTypeAlias1.js new file mode 100644 index 0000000000000..9bfe2999627b9 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingTypeAlias1.js @@ -0,0 +1,47 @@ +//// [tests/cases/compiler/declarationEmitUsingTypeAlias1.ts] //// + +//// [inner.d.ts] +export declare type Other = { other: string }; +export declare type SomeType = { arg: Other }; + +//// [index.d.ts] +export type OtherType = import('./inner').Other; +export type SomeType = import('./inner').SomeType; + +//// [package.json] +{ + "name": "some-dep", + "exports": { + ".": "./dist/index.js" + } +} + +//// [index.ts] +import { SomeType } from "some-dep"; + +export const foo = (thing: SomeType) => { + return thing; +}; + +export const bar = (thing: SomeType) => { + return thing.arg; +}; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.bar = exports.foo = void 0; +var foo = function (thing) { + return thing; +}; +exports.foo = foo; +var bar = function (thing) { + return thing.arg; +}; +exports.bar = bar; + + +//// [index.d.ts] +import { SomeType } from "some-dep"; +export declare const foo: (thing: SomeType) => import("some-dep").SomeType; +export declare const bar: (thing: SomeType) => import("some-dep").OtherType; diff --git a/tests/baselines/reference/declarationEmitUsingTypeAlias1.symbols b/tests/baselines/reference/declarationEmitUsingTypeAlias1.symbols new file mode 100644 index 0000000000000..55573f5c9aff2 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingTypeAlias1.symbols @@ -0,0 +1,46 @@ +//// [tests/cases/compiler/declarationEmitUsingTypeAlias1.ts] //// + +=== node_modules/some-dep/dist/inner.d.ts === +export declare type Other = { other: string }; +>Other : Symbol(Other, Decl(inner.d.ts, 0, 0)) +>other : Symbol(other, Decl(inner.d.ts, 0, 29)) + +export declare type SomeType = { arg: Other }; +>SomeType : Symbol(SomeType, Decl(inner.d.ts, 0, 46)) +>arg : Symbol(arg, Decl(inner.d.ts, 1, 32)) +>Other : Symbol(Other, Decl(inner.d.ts, 0, 0)) + +=== node_modules/some-dep/dist/index.d.ts === +export type OtherType = import('./inner').Other; +>OtherType : Symbol(OtherType, Decl(index.d.ts, 0, 0)) +>Other : Symbol(Other, Decl(inner.d.ts, 0, 0)) + +export type SomeType = import('./inner').SomeType; +>SomeType : Symbol(SomeType, Decl(index.d.ts, 0, 48)) +>SomeType : Symbol(SomeType, Decl(inner.d.ts, 0, 46)) + +=== src/index.ts === +import { SomeType } from "some-dep"; +>SomeType : Symbol(SomeType, Decl(index.ts, 0, 8)) + +export const foo = (thing: SomeType) => { +>foo : Symbol(foo, Decl(index.ts, 2, 12)) +>thing : Symbol(thing, Decl(index.ts, 2, 20)) +>SomeType : Symbol(SomeType, Decl(index.ts, 0, 8)) + + return thing; +>thing : Symbol(thing, Decl(index.ts, 2, 20)) + +}; + +export const bar = (thing: SomeType) => { +>bar : Symbol(bar, Decl(index.ts, 6, 12)) +>thing : Symbol(thing, Decl(index.ts, 6, 20)) +>SomeType : Symbol(SomeType, Decl(index.ts, 0, 8)) + + return thing.arg; +>thing.arg : Symbol(arg, Decl(inner.d.ts, 1, 32)) +>thing : Symbol(thing, Decl(index.ts, 6, 20)) +>arg : Symbol(arg, Decl(inner.d.ts, 1, 32)) + +}; diff --git a/tests/baselines/reference/declarationEmitUsingTypeAlias1.types b/tests/baselines/reference/declarationEmitUsingTypeAlias1.types new file mode 100644 index 0000000000000..f32f9775eea30 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingTypeAlias1.types @@ -0,0 +1,43 @@ +//// [tests/cases/compiler/declarationEmitUsingTypeAlias1.ts] //// + +=== node_modules/some-dep/dist/inner.d.ts === +export declare type Other = { other: string }; +>Other : { other: string; } +>other : string + +export declare type SomeType = { arg: Other }; +>SomeType : { arg: Other; } +>arg : Other + +=== node_modules/some-dep/dist/index.d.ts === +export type OtherType = import('./inner').Other; +>OtherType : import("node_modules/some-dep/dist/inner").Other + +export type SomeType = import('./inner').SomeType; +>SomeType : import("node_modules/some-dep/dist/inner").SomeType + +=== src/index.ts === +import { SomeType } from "some-dep"; +>SomeType : any + +export const foo = (thing: SomeType) => { +>foo : (thing: SomeType) => import("node_modules/some-dep/dist/inner").SomeType +>(thing: SomeType) => { return thing;} : (thing: SomeType) => import("node_modules/some-dep/dist/inner").SomeType +>thing : import("node_modules/some-dep/dist/inner").SomeType + + return thing; +>thing : import("node_modules/some-dep/dist/inner").SomeType + +}; + +export const bar = (thing: SomeType) => { +>bar : (thing: SomeType) => import("node_modules/some-dep/dist/inner").Other +>(thing: SomeType) => { return thing.arg;} : (thing: SomeType) => import("node_modules/some-dep/dist/inner").Other +>thing : import("node_modules/some-dep/dist/inner").SomeType + + return thing.arg; +>thing.arg : import("node_modules/some-dep/dist/inner").Other +>thing : import("node_modules/some-dep/dist/inner").SomeType +>arg : import("node_modules/some-dep/dist/inner").Other + +}; diff --git a/tests/baselines/reference/deferredConditionalTypes2.symbols b/tests/baselines/reference/deferredConditionalTypes2.symbols new file mode 100644 index 0000000000000..b3abb1b74ba1a --- /dev/null +++ b/tests/baselines/reference/deferredConditionalTypes2.symbols @@ -0,0 +1,117 @@ +//// [tests/cases/compiler/deferredConditionalTypes2.ts] //// + +=== deferredConditionalTypes2.ts === +// https://github.com/microsoft/TypeScript/issues/56270 + +type PositiveInfinity = 1e999; +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) + +type NegativeInfinity = -1e999; +>NegativeInfinity : Symbol(NegativeInfinity, Decl(deferredConditionalTypes2.ts, 2, 30)) + +export type IsEqual = (() => G extends A ? 1 : 2) extends < +>IsEqual : Symbol(IsEqual, Decl(deferredConditionalTypes2.ts, 3, 31)) +>A : Symbol(A, Decl(deferredConditionalTypes2.ts, 5, 20)) +>B : Symbol(B, Decl(deferredConditionalTypes2.ts, 5, 22)) +>G : Symbol(G, Decl(deferredConditionalTypes2.ts, 5, 30)) +>G : Symbol(G, Decl(deferredConditionalTypes2.ts, 5, 30)) +>A : Symbol(A, Decl(deferredConditionalTypes2.ts, 5, 20)) + + G, +>G : Symbol(G, Decl(deferredConditionalTypes2.ts, 5, 68)) + +>() => G extends B ? 1 : 2 +>G : Symbol(G, Decl(deferredConditionalTypes2.ts, 5, 68)) +>B : Symbol(B, Decl(deferredConditionalTypes2.ts, 5, 22)) + + ? true + : false; + +export type Add = [ +>Add : Symbol(Add, Decl(deferredConditionalTypes2.ts, 9, 10)) +>A : Symbol(A, Decl(deferredConditionalTypes2.ts, 11, 16)) +>B : Symbol(B, Decl(deferredConditionalTypes2.ts, 11, 33)) + + IsEqual, +>IsEqual : Symbol(IsEqual, Decl(deferredConditionalTypes2.ts, 3, 31)) +>A : Symbol(A, Decl(deferredConditionalTypes2.ts, 11, 16)) +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) + + IsEqual, +>IsEqual : Symbol(IsEqual, Decl(deferredConditionalTypes2.ts, 3, 31)) +>A : Symbol(A, Decl(deferredConditionalTypes2.ts, 11, 16)) +>NegativeInfinity : Symbol(NegativeInfinity, Decl(deferredConditionalTypes2.ts, 2, 30)) + + IsEqual, +>IsEqual : Symbol(IsEqual, Decl(deferredConditionalTypes2.ts, 3, 31)) +>B : Symbol(B, Decl(deferredConditionalTypes2.ts, 11, 33)) +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) + + IsEqual, +>IsEqual : Symbol(IsEqual, Decl(deferredConditionalTypes2.ts, 3, 31)) +>B : Symbol(B, Decl(deferredConditionalTypes2.ts, 11, 33)) +>NegativeInfinity : Symbol(NegativeInfinity, Decl(deferredConditionalTypes2.ts, 2, 30)) + +] extends infer R extends [boolean, boolean, boolean, boolean] +>R : Symbol(R, Decl(deferredConditionalTypes2.ts, 16, 15)) + + ? [true, false] extends ([R[0], R[3]]) +>R : Symbol(R, Decl(deferredConditionalTypes2.ts, 16, 15)) +>R : Symbol(R, Decl(deferredConditionalTypes2.ts, 16, 15)) + + ? PositiveInfinity +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) + + : "failed" + : never; + +export type AddWithoutParentheses = [ +>AddWithoutParentheses : Symbol(AddWithoutParentheses, Decl(deferredConditionalTypes2.ts, 20, 10)) +>A : Symbol(A, Decl(deferredConditionalTypes2.ts, 22, 34)) +>B : Symbol(B, Decl(deferredConditionalTypes2.ts, 22, 51)) + + IsEqual, +>IsEqual : Symbol(IsEqual, Decl(deferredConditionalTypes2.ts, 3, 31)) +>A : Symbol(A, Decl(deferredConditionalTypes2.ts, 22, 34)) +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) + + IsEqual, +>IsEqual : Symbol(IsEqual, Decl(deferredConditionalTypes2.ts, 3, 31)) +>A : Symbol(A, Decl(deferredConditionalTypes2.ts, 22, 34)) +>NegativeInfinity : Symbol(NegativeInfinity, Decl(deferredConditionalTypes2.ts, 2, 30)) + + IsEqual, +>IsEqual : Symbol(IsEqual, Decl(deferredConditionalTypes2.ts, 3, 31)) +>B : Symbol(B, Decl(deferredConditionalTypes2.ts, 22, 51)) +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) + + IsEqual, +>IsEqual : Symbol(IsEqual, Decl(deferredConditionalTypes2.ts, 3, 31)) +>B : Symbol(B, Decl(deferredConditionalTypes2.ts, 22, 51)) +>NegativeInfinity : Symbol(NegativeInfinity, Decl(deferredConditionalTypes2.ts, 2, 30)) + +] extends infer R extends [boolean, boolean, boolean, boolean] +>R : Symbol(R, Decl(deferredConditionalTypes2.ts, 27, 15)) + + ? [true, false] extends [R[0], R[3]] +>R : Symbol(R, Decl(deferredConditionalTypes2.ts, 27, 15)) +>R : Symbol(R, Decl(deferredConditionalTypes2.ts, 27, 15)) + + ? PositiveInfinity +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) + + : "failed" + : never; + +type AddTest0 = Add; +>AddTest0 : Symbol(AddTest0, Decl(deferredConditionalTypes2.ts, 31, 10)) +>Add : Symbol(Add, Decl(deferredConditionalTypes2.ts, 9, 10)) +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) + +type AddTest1 = AddWithoutParentheses; +>AddTest1 : Symbol(AddTest1, Decl(deferredConditionalTypes2.ts, 33, 56)) +>AddWithoutParentheses : Symbol(AddWithoutParentheses, Decl(deferredConditionalTypes2.ts, 20, 10)) +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) +>PositiveInfinity : Symbol(PositiveInfinity, Decl(deferredConditionalTypes2.ts, 0, 0)) + diff --git a/tests/baselines/reference/deferredConditionalTypes2.types b/tests/baselines/reference/deferredConditionalTypes2.types new file mode 100644 index 0000000000000..a14eb9574aa16 --- /dev/null +++ b/tests/baselines/reference/deferredConditionalTypes2.types @@ -0,0 +1,62 @@ +//// [tests/cases/compiler/deferredConditionalTypes2.ts] //// + +=== deferredConditionalTypes2.ts === +// https://github.com/microsoft/TypeScript/issues/56270 + +type PositiveInfinity = 1e999; +>PositiveInfinity : Infinity + +type NegativeInfinity = -1e999; +>NegativeInfinity : -Infinity +>-1e999 : -Infinity +>1e999 : Infinity + +export type IsEqual = (() => G extends A ? 1 : 2) extends < +>IsEqual : IsEqual + + G, +>() => G extends B ? 1 : 2 + ? true +>true : true + + : false; +>false : false + +export type Add = [ +>Add : [true, false] extends [IsEqual, IsEqual] ? Infinity : "failed" + + IsEqual, + IsEqual, + IsEqual, + IsEqual, +] extends infer R extends [boolean, boolean, boolean, boolean] + ? [true, false] extends ([R[0], R[3]]) +>true : true +>false : false + + ? PositiveInfinity + : "failed" + : never; + +export type AddWithoutParentheses = [ +>AddWithoutParentheses : [true, false] extends [IsEqual, IsEqual] ? Infinity : "failed" + + IsEqual, + IsEqual, + IsEqual, + IsEqual, +] extends infer R extends [boolean, boolean, boolean, boolean] + ? [true, false] extends [R[0], R[3]] +>true : true +>false : false + + ? PositiveInfinity + : "failed" + : never; + +type AddTest0 = Add; +>AddTest0 : Infinity + +type AddTest1 = AddWithoutParentheses; +>AddTest1 : Infinity + diff --git a/tests/baselines/reference/dependentDestructuredVariables.errors.txt b/tests/baselines/reference/dependentDestructuredVariables.errors.txt index 58fda3e63d75f..f6e2dd3d42745 100644 --- a/tests/baselines/reference/dependentDestructuredVariables.errors.txt +++ b/tests/baselines/reference/dependentDestructuredVariables.errors.txt @@ -443,4 +443,35 @@ dependentDestructuredVariables.ts(431,15): error TS2322: Type 'number' is not as !!! error TS2322: Type 'number' is not assignable to type 'never'. } } + + // https://github.com/microsoft/TypeScript/issues/56312 + + function parameterReassigned1([x, y]: [1, 2] | [3, 4]) { + if (Math.random()) { + x = 1; + } + if (y === 2) { + x; // 1 | 3 + } + } + + function parameterReassigned2([x, y]: [1, 2] | [3, 4]) { + if (Math.random()) { + y = 2; + } + if (y === 2) { + x; // 1 | 3 + } + } + + // https://github.com/microsoft/TypeScript/pull/56313#discussion_r1416482490 + + const parameterReassignedContextualRest1: (...args: [1, 2] | [3, 4]) => void = (x, y) => { + if (Math.random()) { + y = 2; + } + if (y === 2) { + x; // 1 | 3 + } + } \ No newline at end of file diff --git a/tests/baselines/reference/dependentDestructuredVariables.js b/tests/baselines/reference/dependentDestructuredVariables.js index ed1a7307e58b9..7d32808909bf7 100644 --- a/tests/baselines/reference/dependentDestructuredVariables.js +++ b/tests/baselines/reference/dependentDestructuredVariables.js @@ -434,6 +434,37 @@ function tooNarrow([x, y]: [1, 1] | [1, 2] | [1]) { const shouldNotBeOk: never = x; // Error } } + +// https://github.com/microsoft/TypeScript/issues/56312 + +function parameterReassigned1([x, y]: [1, 2] | [3, 4]) { + if (Math.random()) { + x = 1; + } + if (y === 2) { + x; // 1 | 3 + } +} + +function parameterReassigned2([x, y]: [1, 2] | [3, 4]) { + if (Math.random()) { + y = 2; + } + if (y === 2) { + x; // 1 | 3 + } +} + +// https://github.com/microsoft/TypeScript/pull/56313#discussion_r1416482490 + +const parameterReassignedContextualRest1: (...args: [1, 2] | [3, 4]) => void = (x, y) => { + if (Math.random()) { + y = 2; + } + if (y === 2) { + x; // 1 | 3 + } +} //// [dependentDestructuredVariables.js] @@ -766,6 +797,32 @@ function tooNarrow([x, y]) { const shouldNotBeOk = x; // Error } } +// https://github.com/microsoft/TypeScript/issues/56312 +function parameterReassigned1([x, y]) { + if (Math.random()) { + x = 1; + } + if (y === 2) { + x; // 1 | 3 + } +} +function parameterReassigned2([x, y]) { + if (Math.random()) { + y = 2; + } + if (y === 2) { + x; // 1 | 3 + } +} +// https://github.com/microsoft/TypeScript/pull/56313#discussion_r1416482490 +const parameterReassignedContextualRest1 = (x, y) => { + if (Math.random()) { + y = 2; + } + if (y === 2) { + x; // 1 | 3 + } +}; //// [dependentDestructuredVariables.d.ts] @@ -916,3 +973,6 @@ declare class Client { declare const bot: Client; declare function fz1([x, y]: [1, 2] | [3, 4] | [5]): void; declare function tooNarrow([x, y]: [1, 1] | [1, 2] | [1]): void; +declare function parameterReassigned1([x, y]: [1, 2] | [3, 4]): void; +declare function parameterReassigned2([x, y]: [1, 2] | [3, 4]): void; +declare const parameterReassignedContextualRest1: (...args: [1, 2] | [3, 4]) => void; diff --git a/tests/baselines/reference/dependentDestructuredVariables.symbols b/tests/baselines/reference/dependentDestructuredVariables.symbols index 8d4298cdb12c9..ae71b255d1a88 100644 --- a/tests/baselines/reference/dependentDestructuredVariables.symbols +++ b/tests/baselines/reference/dependentDestructuredVariables.symbols @@ -1100,3 +1100,71 @@ function tooNarrow([x, y]: [1, 1] | [1, 2] | [1]) { } } +// https://github.com/microsoft/TypeScript/issues/56312 + +function parameterReassigned1([x, y]: [1, 2] | [3, 4]) { +>parameterReassigned1 : Symbol(parameterReassigned1, Decl(dependentDestructuredVariables.ts, 432, 1)) +>x : Symbol(x, Decl(dependentDestructuredVariables.ts, 436, 31)) +>y : Symbol(y, Decl(dependentDestructuredVariables.ts, 436, 33)) + + if (Math.random()) { +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) + + x = 1; +>x : Symbol(x, Decl(dependentDestructuredVariables.ts, 436, 31)) + } + if (y === 2) { +>y : Symbol(y, Decl(dependentDestructuredVariables.ts, 436, 33)) + + x; // 1 | 3 +>x : Symbol(x, Decl(dependentDestructuredVariables.ts, 436, 31)) + } +} + +function parameterReassigned2([x, y]: [1, 2] | [3, 4]) { +>parameterReassigned2 : Symbol(parameterReassigned2, Decl(dependentDestructuredVariables.ts, 443, 1)) +>x : Symbol(x, Decl(dependentDestructuredVariables.ts, 445, 31)) +>y : Symbol(y, Decl(dependentDestructuredVariables.ts, 445, 33)) + + if (Math.random()) { +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) + + y = 2; +>y : Symbol(y, Decl(dependentDestructuredVariables.ts, 445, 33)) + } + if (y === 2) { +>y : Symbol(y, Decl(dependentDestructuredVariables.ts, 445, 33)) + + x; // 1 | 3 +>x : Symbol(x, Decl(dependentDestructuredVariables.ts, 445, 31)) + } +} + +// https://github.com/microsoft/TypeScript/pull/56313#discussion_r1416482490 + +const parameterReassignedContextualRest1: (...args: [1, 2] | [3, 4]) => void = (x, y) => { +>parameterReassignedContextualRest1 : Symbol(parameterReassignedContextualRest1, Decl(dependentDestructuredVariables.ts, 456, 5)) +>args : Symbol(args, Decl(dependentDestructuredVariables.ts, 456, 43)) +>x : Symbol(x, Decl(dependentDestructuredVariables.ts, 456, 80)) +>y : Symbol(y, Decl(dependentDestructuredVariables.ts, 456, 82)) + + if (Math.random()) { +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) + + y = 2; +>y : Symbol(y, Decl(dependentDestructuredVariables.ts, 456, 82)) + } + if (y === 2) { +>y : Symbol(y, Decl(dependentDestructuredVariables.ts, 456, 82)) + + x; // 1 | 3 +>x : Symbol(x, Decl(dependentDestructuredVariables.ts, 456, 80)) + } +} + diff --git a/tests/baselines/reference/dependentDestructuredVariables.types b/tests/baselines/reference/dependentDestructuredVariables.types index 25f18a848374b..0480bb1631c62 100644 --- a/tests/baselines/reference/dependentDestructuredVariables.types +++ b/tests/baselines/reference/dependentDestructuredVariables.types @@ -1263,3 +1263,87 @@ function tooNarrow([x, y]: [1, 1] | [1, 2] | [1]) { } } +// https://github.com/microsoft/TypeScript/issues/56312 + +function parameterReassigned1([x, y]: [1, 2] | [3, 4]) { +>parameterReassigned1 : ([x, y]: [1, 2] | [3, 4]) => void +>x : 1 | 3 +>y : 2 | 4 + + if (Math.random()) { +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number + + x = 1; +>x = 1 : 1 +>x : 1 | 3 +>1 : 1 + } + if (y === 2) { +>y === 2 : boolean +>y : 2 | 4 +>2 : 2 + + x; // 1 | 3 +>x : 1 | 3 + } +} + +function parameterReassigned2([x, y]: [1, 2] | [3, 4]) { +>parameterReassigned2 : ([x, y]: [1, 2] | [3, 4]) => void +>x : 1 | 3 +>y : 2 | 4 + + if (Math.random()) { +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number + + y = 2; +>y = 2 : 2 +>y : 2 | 4 +>2 : 2 + } + if (y === 2) { +>y === 2 : boolean +>y : 2 | 4 +>2 : 2 + + x; // 1 | 3 +>x : 1 | 3 + } +} + +// https://github.com/microsoft/TypeScript/pull/56313#discussion_r1416482490 + +const parameterReassignedContextualRest1: (...args: [1, 2] | [3, 4]) => void = (x, y) => { +>parameterReassignedContextualRest1 : (...args: [1, 2] | [3, 4]) => void +>args : [1, 2] | [3, 4] +>(x, y) => { if (Math.random()) { y = 2; } if (y === 2) { x; // 1 | 3 }} : (x: 1 | 3, y: 2 | 4) => void +>x : 1 | 3 +>y : 2 | 4 + + if (Math.random()) { +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number + + y = 2; +>y = 2 : 2 +>y : 2 | 4 +>2 : 2 + } + if (y === 2) { +>y === 2 : boolean +>y : 2 | 4 +>2 : 2 + + x; // 1 | 3 +>x : 1 | 3 + } +} + diff --git a/tests/baselines/reference/enumAssignmentCompat3.errors.txt b/tests/baselines/reference/enumAssignmentCompat3.errors.txt index efe726d5ddae1..9c10fd6b13d95 100644 --- a/tests/baselines/reference/enumAssignmentCompat3.errors.txt +++ b/tests/baselines/reference/enumAssignmentCompat3.errors.txt @@ -1,20 +1,26 @@ enumAssignmentCompat3.ts(68,1): error TS2322: Type 'Abcd.E' is not assignable to type 'First.E'. Property 'd' is missing in type 'First.E'. enumAssignmentCompat3.ts(70,1): error TS2322: Type 'Cd.E' is not assignable to type 'First.E'. - Property 'd' is missing in type 'First.E'. + Each declaration of 'E.c' differs in its value, where '2' was expected but '0' was given. enumAssignmentCompat3.ts(71,1): error TS2322: Type 'Nope' is not assignable to type 'E'. +enumAssignmentCompat3.ts(72,1): error TS2322: Type 'Decl.E' is not assignable to type 'First.E'. + Each declaration of 'E.c' differs in its value, where '2' was expected but '3' was given. enumAssignmentCompat3.ts(75,1): error TS2322: Type 'First.E' is not assignable to type 'Ab.E'. Property 'c' is missing in type 'Ab.E'. enumAssignmentCompat3.ts(76,1): error TS2322: Type 'First.E' is not assignable to type 'Cd.E'. Property 'a' is missing in type 'Cd.E'. enumAssignmentCompat3.ts(77,1): error TS2322: Type 'E' is not assignable to type 'Nope'. +enumAssignmentCompat3.ts(78,1): error TS2322: Type 'First.E' is not assignable to type 'Decl.E'. + Each declaration of 'E.c' differs in its value, where '3' was expected but '2' was given. enumAssignmentCompat3.ts(82,1): error TS2322: Type 'Const.E' is not assignable to type 'First.E'. enumAssignmentCompat3.ts(83,1): error TS2322: Type 'First.E' is not assignable to type 'Const.E'. enumAssignmentCompat3.ts(86,1): error TS2322: Type 'Merged.E' is not assignable to type 'First.E'. - Property 'd' is missing in type 'First.E'. + Each declaration of 'E.c' differs in its value, where '2' was expected but '3' was given. +enumAssignmentCompat3.ts(87,1): error TS2322: Type 'First.E' is not assignable to type 'Merged.E'. + Each declaration of 'E.c' differs in its value, where '3' was expected but '2' was given. -==== enumAssignmentCompat3.ts (9 errors) ==== +==== enumAssignmentCompat3.ts (12 errors) ==== namespace First { export enum E { a, b, c, @@ -90,11 +96,14 @@ enumAssignmentCompat3.ts(86,1): error TS2322: Type 'Merged.E' is not assignable abc = secondCd; // missing 'd' ~~~ !!! error TS2322: Type 'Cd.E' is not assignable to type 'First.E'. -!!! error TS2322: Property 'd' is missing in type 'First.E'. +!!! error TS2322: Each declaration of 'E.c' differs in its value, where '2' was expected but '0' was given. abc = nope; // nope! ~~~ !!! error TS2322: Type 'Nope' is not assignable to type 'E'. - abc = decl; // ok + abc = decl; // bad - value of 'c' differs between these enums + ~~~ +!!! error TS2322: Type 'Decl.E' is not assignable to type 'First.E'. +!!! error TS2322: Each declaration of 'E.c' differs in its value, where '2' was expected but '3' was given. secondAbc = abc; // ok secondAbcd = abc; // ok secondAb = abc; // missing 'c' @@ -108,7 +117,10 @@ enumAssignmentCompat3.ts(86,1): error TS2322: Type 'Merged.E' is not assignable nope = abc; // nope! ~~~~ !!! error TS2322: Type 'E' is not assignable to type 'Nope'. - decl = abc; // ok + decl = abc; // bad - value of 'c' differs between these enums + ~~~~ +!!! error TS2322: Type 'First.E' is not assignable to type 'Decl.E'. +!!! error TS2322: Each declaration of 'E.c' differs in its value, where '3' was expected but '2' was given. // const is only assignable to itself k = k; @@ -123,7 +135,10 @@ enumAssignmentCompat3.ts(86,1): error TS2322: Type 'Merged.E' is not assignable abc = merged; // missing 'd' ~~~ !!! error TS2322: Type 'Merged.E' is not assignable to type 'First.E'. -!!! error TS2322: Property 'd' is missing in type 'First.E'. - merged = abc; // ok +!!! error TS2322: Each declaration of 'E.c' differs in its value, where '2' was expected but '3' was given. + merged = abc; // bad - value of 'c' differs between these enums + ~~~~~~ +!!! error TS2322: Type 'First.E' is not assignable to type 'Merged.E'. +!!! error TS2322: Each declaration of 'E.c' differs in its value, where '3' was expected but '2' was given. abc = merged2; // ok merged2 = abc; // ok \ No newline at end of file diff --git a/tests/baselines/reference/enumAssignmentCompat3.js b/tests/baselines/reference/enumAssignmentCompat3.js index ac83fb96c317a..755ddb169cfec 100644 --- a/tests/baselines/reference/enumAssignmentCompat3.js +++ b/tests/baselines/reference/enumAssignmentCompat3.js @@ -72,13 +72,13 @@ abc = secondAbcd; // missing 'd' abc = secondAb; // ok abc = secondCd; // missing 'd' abc = nope; // nope! -abc = decl; // ok +abc = decl; // bad - value of 'c' differs between these enums secondAbc = abc; // ok secondAbcd = abc; // ok secondAb = abc; // missing 'c' secondCd = abc; // missing 'a' and 'b' nope = abc; // nope! -decl = abc; // ok +decl = abc; // bad - value of 'c' differs between these enums // const is only assignable to itself k = k; @@ -87,7 +87,7 @@ k = abc; // merged enums compare all their members abc = merged; // missing 'd' -merged = abc; // ok +merged = abc; // bad - value of 'c' differs between these enums abc = merged2; // ok merged2 = abc; // ok @@ -184,19 +184,19 @@ abc = secondAbcd; // missing 'd' abc = secondAb; // ok abc = secondCd; // missing 'd' abc = nope; // nope! -abc = decl; // ok +abc = decl; // bad - value of 'c' differs between these enums secondAbc = abc; // ok secondAbcd = abc; // ok secondAb = abc; // missing 'c' secondCd = abc; // missing 'a' and 'b' nope = abc; // nope! -decl = abc; // ok +decl = abc; // bad - value of 'c' differs between these enums // const is only assignable to itself k = k; abc = k; // error k = abc; // merged enums compare all their members abc = merged; // missing 'd' -merged = abc; // ok +merged = abc; // bad - value of 'c' differs between these enums abc = merged2; // ok merged2 = abc; // ok diff --git a/tests/baselines/reference/enumAssignmentCompat3.symbols b/tests/baselines/reference/enumAssignmentCompat3.symbols index 08b78e85f3a0d..00ee430fc60b3 100644 --- a/tests/baselines/reference/enumAssignmentCompat3.symbols +++ b/tests/baselines/reference/enumAssignmentCompat3.symbols @@ -200,7 +200,7 @@ abc = nope; // nope! >abc : Symbol(abc, Decl(enumAssignmentCompat3.ts, 56, 3)) >nope : Symbol(nope, Decl(enumAssignmentCompat3.ts, 61, 3)) -abc = decl; // ok +abc = decl; // bad - value of 'c' differs between these enums >abc : Symbol(abc, Decl(enumAssignmentCompat3.ts, 56, 3)) >decl : Symbol(decl, Decl(enumAssignmentCompat3.ts, 63, 3)) @@ -224,7 +224,7 @@ nope = abc; // nope! >nope : Symbol(nope, Decl(enumAssignmentCompat3.ts, 61, 3)) >abc : Symbol(abc, Decl(enumAssignmentCompat3.ts, 56, 3)) -decl = abc; // ok +decl = abc; // bad - value of 'c' differs between these enums >decl : Symbol(decl, Decl(enumAssignmentCompat3.ts, 63, 3)) >abc : Symbol(abc, Decl(enumAssignmentCompat3.ts, 56, 3)) @@ -246,7 +246,7 @@ abc = merged; // missing 'd' >abc : Symbol(abc, Decl(enumAssignmentCompat3.ts, 56, 3)) >merged : Symbol(merged, Decl(enumAssignmentCompat3.ts, 64, 3)) -merged = abc; // ok +merged = abc; // bad - value of 'c' differs between these enums >merged : Symbol(merged, Decl(enumAssignmentCompat3.ts, 64, 3)) >abc : Symbol(abc, Decl(enumAssignmentCompat3.ts, 56, 3)) diff --git a/tests/baselines/reference/enumAssignmentCompat3.types b/tests/baselines/reference/enumAssignmentCompat3.types index cc72b6777ba98..e1f98a739c8c9 100644 --- a/tests/baselines/reference/enumAssignmentCompat3.types +++ b/tests/baselines/reference/enumAssignmentCompat3.types @@ -196,7 +196,7 @@ abc = nope; // nope! >abc : First.E >nope : Abc.Nope -abc = decl; // ok +abc = decl; // bad - value of 'c' differs between these enums >abc = decl : Decl.E >abc : First.E >decl : Decl.E @@ -226,7 +226,7 @@ nope = abc; // nope! >nope : Abc.Nope >abc : First.E -decl = abc; // ok +decl = abc; // bad - value of 'c' differs between these enums >decl = abc : First.E >decl : Decl.E >abc : First.E @@ -253,7 +253,7 @@ abc = merged; // missing 'd' >abc : First.E >merged : Merged.E -merged = abc; // ok +merged = abc; // bad - value of 'c' differs between these enums >merged = abc : First.E >merged : Merged.E >abc : First.E diff --git a/tests/baselines/reference/enumAssignmentCompat6.errors.txt b/tests/baselines/reference/enumAssignmentCompat6.errors.txt new file mode 100644 index 0000000000000..6fa72a1d05f16 --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat6.errors.txt @@ -0,0 +1,115 @@ +f.ts(37,5): error TS2322: Type 'strings.DiagnosticCategory' is not assignable to type 'numerics.DiagnosticCategory'. + Each declaration of 'DiagnosticCategory.Warning' differs in its value, where '0' was expected but '"Warning"' was given. +f.ts(38,5): error TS2322: Type 'numerics.DiagnosticCategory' is not assignable to type 'strings.DiagnosticCategory'. + Each declaration of 'DiagnosticCategory.Warning' differs in its value, where '"Warning"' was expected but '0' was given. +f.ts(42,5): error TS2322: Type 'DiagnosticCategory' is not assignable to type 'DiagnosticCategory2'. +f.ts(43,5): error TS2322: Type 'DiagnosticCategory2' is not assignable to type 'DiagnosticCategory'. +f.ts(52,5): error TS2322: Type 'ambients.DiagnosticCategory' is not assignable to type 'strings.DiagnosticCategory'. + One value of 'DiagnosticCategory.Warning' is the string '"Warning"', and the other is assumed to be an unknown numeric value. +f.ts(53,5): error TS2322: Type 'strings.DiagnosticCategory' is not assignable to type 'ambients.DiagnosticCategory'. + One value of 'DiagnosticCategory.Warning' is the string '"Warning"', and the other is assumed to be an unknown numeric value. +f.ts(73,9): error TS2322: Type 'DiagnosticCategory' is not assignable to type 'import("f").DiagnosticCategory'. + Each declaration of 'DiagnosticCategory.Warning' differs in its value, where '0' was expected but '"Warning"' was given. +f.ts(74,9): error TS2322: Type 'import("f").DiagnosticCategory' is not assignable to type 'DiagnosticCategory'. + Each declaration of 'DiagnosticCategory.Warning' differs in its value, where '"Warning"' was expected but '0' was given. + + +==== f.ts (8 errors) ==== + // @filename a.ts + namespace numerics { + export enum DiagnosticCategory { + Warning, + Error, + Suggestion, + Message, + } + + export enum DiagnosticCategory2 { + Warning, + Error, + Suggestion, + Message, + } + } + + namespace strings { + export enum DiagnosticCategory { + Warning = "Warning", + Error = "Error", + Suggestion = "Suggestion", + Message = "Message", + } + } + + declare namespace ambients { + export enum DiagnosticCategory { + Warning, + Error, + Suggestion, + Message, + } + } + + function f(x: numerics.DiagnosticCategory, y: strings.DiagnosticCategory) { + x = y; + ~ +!!! error TS2322: Type 'strings.DiagnosticCategory' is not assignable to type 'numerics.DiagnosticCategory'. +!!! error TS2322: Each declaration of 'DiagnosticCategory.Warning' differs in its value, where '0' was expected but '"Warning"' was given. + y = x; + ~ +!!! error TS2322: Type 'numerics.DiagnosticCategory' is not assignable to type 'strings.DiagnosticCategory'. +!!! error TS2322: Each declaration of 'DiagnosticCategory.Warning' differs in its value, where '"Warning"' was expected but '0' was given. + } + + function g(x: numerics.DiagnosticCategory2, y: strings.DiagnosticCategory) { + x = y; + ~ +!!! error TS2322: Type 'DiagnosticCategory' is not assignable to type 'DiagnosticCategory2'. + y = x; + ~ +!!! error TS2322: Type 'DiagnosticCategory2' is not assignable to type 'DiagnosticCategory'. + } + + function h(x: numerics.DiagnosticCategory, y: ambients.DiagnosticCategory) { + x = y; + y = x; + } + + function i(x: strings.DiagnosticCategory, y: ambients.DiagnosticCategory) { + x = y; + ~ +!!! error TS2322: Type 'ambients.DiagnosticCategory' is not assignable to type 'strings.DiagnosticCategory'. +!!! error TS2322: One value of 'DiagnosticCategory.Warning' is the string '"Warning"', and the other is assumed to be an unknown numeric value. + y = x; + ~ +!!! error TS2322: Type 'strings.DiagnosticCategory' is not assignable to type 'ambients.DiagnosticCategory'. +!!! error TS2322: One value of 'DiagnosticCategory.Warning' is the string '"Warning"', and the other is assumed to be an unknown numeric value. + } + + export enum DiagnosticCategory { + Warning, + Error, + Suggestion, + Message, + } + + export let x: DiagnosticCategory; + + (() => { + enum DiagnosticCategory { + Warning = "Warning", + Error = "Error", + Suggestion = "Suggestion", + Message = "Message", + } + function f(y: DiagnosticCategory) { + x = y; + ~ +!!! error TS2322: Type 'DiagnosticCategory' is not assignable to type 'import("f").DiagnosticCategory'. +!!! error TS2322: Each declaration of 'DiagnosticCategory.Warning' differs in its value, where '0' was expected but '"Warning"' was given. + y = x; + ~ +!!! error TS2322: Type 'import("f").DiagnosticCategory' is not assignable to type 'DiagnosticCategory'. +!!! error TS2322: Each declaration of 'DiagnosticCategory.Warning' differs in its value, where '"Warning"' was expected but '0' was given. + } + })() \ No newline at end of file diff --git a/tests/baselines/reference/enumAssignmentCompat6.js b/tests/baselines/reference/enumAssignmentCompat6.js new file mode 100644 index 0000000000000..a8cde20aacf69 --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat6.js @@ -0,0 +1,148 @@ +//// [tests/cases/compiler/enumAssignmentCompat6.ts] //// + +//// [f.ts] +// @filename a.ts +namespace numerics { + export enum DiagnosticCategory { + Warning, + Error, + Suggestion, + Message, + } + + export enum DiagnosticCategory2 { + Warning, + Error, + Suggestion, + Message, + } +} + +namespace strings { + export enum DiagnosticCategory { + Warning = "Warning", + Error = "Error", + Suggestion = "Suggestion", + Message = "Message", + } +} + +declare namespace ambients { + export enum DiagnosticCategory { + Warning, + Error, + Suggestion, + Message, + } +} + +function f(x: numerics.DiagnosticCategory, y: strings.DiagnosticCategory) { + x = y; + y = x; +} + +function g(x: numerics.DiagnosticCategory2, y: strings.DiagnosticCategory) { + x = y; + y = x; +} + +function h(x: numerics.DiagnosticCategory, y: ambients.DiagnosticCategory) { + x = y; + y = x; +} + +function i(x: strings.DiagnosticCategory, y: ambients.DiagnosticCategory) { + x = y; + y = x; +} + +export enum DiagnosticCategory { + Warning, + Error, + Suggestion, + Message, +} + +export let x: DiagnosticCategory; + +(() => { + enum DiagnosticCategory { + Warning = "Warning", + Error = "Error", + Suggestion = "Suggestion", + Message = "Message", + } + function f(y: DiagnosticCategory) { + x = y; + y = x; + } +})() + +//// [f.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = exports.DiagnosticCategory = void 0; +// @filename a.ts +var numerics; +(function (numerics) { + var DiagnosticCategory; + (function (DiagnosticCategory) { + DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; + DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; + DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion"; + DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message"; + })(DiagnosticCategory = numerics.DiagnosticCategory || (numerics.DiagnosticCategory = {})); + var DiagnosticCategory2; + (function (DiagnosticCategory2) { + DiagnosticCategory2[DiagnosticCategory2["Warning"] = 0] = "Warning"; + DiagnosticCategory2[DiagnosticCategory2["Error"] = 1] = "Error"; + DiagnosticCategory2[DiagnosticCategory2["Suggestion"] = 2] = "Suggestion"; + DiagnosticCategory2[DiagnosticCategory2["Message"] = 3] = "Message"; + })(DiagnosticCategory2 = numerics.DiagnosticCategory2 || (numerics.DiagnosticCategory2 = {})); +})(numerics || (numerics = {})); +var strings; +(function (strings) { + var DiagnosticCategory; + (function (DiagnosticCategory) { + DiagnosticCategory["Warning"] = "Warning"; + DiagnosticCategory["Error"] = "Error"; + DiagnosticCategory["Suggestion"] = "Suggestion"; + DiagnosticCategory["Message"] = "Message"; + })(DiagnosticCategory = strings.DiagnosticCategory || (strings.DiagnosticCategory = {})); +})(strings || (strings = {})); +function f(x, y) { + x = y; + y = x; +} +function g(x, y) { + x = y; + y = x; +} +function h(x, y) { + x = y; + y = x; +} +function i(x, y) { + x = y; + y = x; +} +var DiagnosticCategory; +(function (DiagnosticCategory) { + DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; + DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; + DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion"; + DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message"; +})(DiagnosticCategory || (exports.DiagnosticCategory = DiagnosticCategory = {})); +(function () { + var DiagnosticCategory; + (function (DiagnosticCategory) { + DiagnosticCategory["Warning"] = "Warning"; + DiagnosticCategory["Error"] = "Error"; + DiagnosticCategory["Suggestion"] = "Suggestion"; + DiagnosticCategory["Message"] = "Message"; + })(DiagnosticCategory || (DiagnosticCategory = {})); + function f(y) { + exports.x = y; + y = exports.x; + } +})(); diff --git a/tests/baselines/reference/enumAssignmentCompat6.symbols b/tests/baselines/reference/enumAssignmentCompat6.symbols new file mode 100644 index 0000000000000..fcf2c4f1637f5 --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat6.symbols @@ -0,0 +1,202 @@ +//// [tests/cases/compiler/enumAssignmentCompat6.ts] //// + +=== f.ts === +// @filename a.ts +namespace numerics { +>numerics : Symbol(numerics, Decl(f.ts, 0, 0)) + + export enum DiagnosticCategory { +>DiagnosticCategory : Symbol(DiagnosticCategory, Decl(f.ts, 1, 20)) + + Warning, +>Warning : Symbol(DiagnosticCategory.Warning, Decl(f.ts, 2, 36)) + + Error, +>Error : Symbol(DiagnosticCategory.Error, Decl(f.ts, 3, 16)) + + Suggestion, +>Suggestion : Symbol(DiagnosticCategory.Suggestion, Decl(f.ts, 4, 14)) + + Message, +>Message : Symbol(DiagnosticCategory.Message, Decl(f.ts, 5, 19)) + } + + export enum DiagnosticCategory2 { +>DiagnosticCategory2 : Symbol(DiagnosticCategory2, Decl(f.ts, 7, 5)) + + Warning, +>Warning : Symbol(DiagnosticCategory2.Warning, Decl(f.ts, 9, 37)) + + Error, +>Error : Symbol(DiagnosticCategory2.Error, Decl(f.ts, 10, 16)) + + Suggestion, +>Suggestion : Symbol(DiagnosticCategory2.Suggestion, Decl(f.ts, 11, 14)) + + Message, +>Message : Symbol(DiagnosticCategory2.Message, Decl(f.ts, 12, 19)) + } +} + +namespace strings { +>strings : Symbol(strings, Decl(f.ts, 15, 1)) + + export enum DiagnosticCategory { +>DiagnosticCategory : Symbol(DiagnosticCategory, Decl(f.ts, 17, 19)) + + Warning = "Warning", +>Warning : Symbol(DiagnosticCategory.Warning, Decl(f.ts, 18, 36)) + + Error = "Error", +>Error : Symbol(DiagnosticCategory.Error, Decl(f.ts, 19, 28)) + + Suggestion = "Suggestion", +>Suggestion : Symbol(DiagnosticCategory.Suggestion, Decl(f.ts, 20, 24)) + + Message = "Message", +>Message : Symbol(DiagnosticCategory.Message, Decl(f.ts, 21, 34)) + } +} + +declare namespace ambients { +>ambients : Symbol(ambients, Decl(f.ts, 24, 1)) + + export enum DiagnosticCategory { +>DiagnosticCategory : Symbol(DiagnosticCategory, Decl(f.ts, 26, 28)) + + Warning, +>Warning : Symbol(DiagnosticCategory.Warning, Decl(f.ts, 27, 36)) + + Error, +>Error : Symbol(DiagnosticCategory.Error, Decl(f.ts, 28, 16)) + + Suggestion, +>Suggestion : Symbol(DiagnosticCategory.Suggestion, Decl(f.ts, 29, 14)) + + Message, +>Message : Symbol(DiagnosticCategory.Message, Decl(f.ts, 30, 19)) + } +} + +function f(x: numerics.DiagnosticCategory, y: strings.DiagnosticCategory) { +>f : Symbol(f, Decl(f.ts, 33, 1)) +>x : Symbol(x, Decl(f.ts, 35, 11)) +>numerics : Symbol(numerics, Decl(f.ts, 0, 0)) +>DiagnosticCategory : Symbol(numerics.DiagnosticCategory, Decl(f.ts, 1, 20)) +>y : Symbol(y, Decl(f.ts, 35, 42)) +>strings : Symbol(strings, Decl(f.ts, 15, 1)) +>DiagnosticCategory : Symbol(strings.DiagnosticCategory, Decl(f.ts, 17, 19)) + + x = y; +>x : Symbol(x, Decl(f.ts, 35, 11)) +>y : Symbol(y, Decl(f.ts, 35, 42)) + + y = x; +>y : Symbol(y, Decl(f.ts, 35, 42)) +>x : Symbol(x, Decl(f.ts, 35, 11)) +} + +function g(x: numerics.DiagnosticCategory2, y: strings.DiagnosticCategory) { +>g : Symbol(g, Decl(f.ts, 38, 1)) +>x : Symbol(x, Decl(f.ts, 40, 11)) +>numerics : Symbol(numerics, Decl(f.ts, 0, 0)) +>DiagnosticCategory2 : Symbol(numerics.DiagnosticCategory2, Decl(f.ts, 7, 5)) +>y : Symbol(y, Decl(f.ts, 40, 43)) +>strings : Symbol(strings, Decl(f.ts, 15, 1)) +>DiagnosticCategory : Symbol(strings.DiagnosticCategory, Decl(f.ts, 17, 19)) + + x = y; +>x : Symbol(x, Decl(f.ts, 40, 11)) +>y : Symbol(y, Decl(f.ts, 40, 43)) + + y = x; +>y : Symbol(y, Decl(f.ts, 40, 43)) +>x : Symbol(x, Decl(f.ts, 40, 11)) +} + +function h(x: numerics.DiagnosticCategory, y: ambients.DiagnosticCategory) { +>h : Symbol(h, Decl(f.ts, 43, 1)) +>x : Symbol(x, Decl(f.ts, 45, 11)) +>numerics : Symbol(numerics, Decl(f.ts, 0, 0)) +>DiagnosticCategory : Symbol(numerics.DiagnosticCategory, Decl(f.ts, 1, 20)) +>y : Symbol(y, Decl(f.ts, 45, 42)) +>ambients : Symbol(ambients, Decl(f.ts, 24, 1)) +>DiagnosticCategory : Symbol(ambients.DiagnosticCategory, Decl(f.ts, 26, 28)) + + x = y; +>x : Symbol(x, Decl(f.ts, 45, 11)) +>y : Symbol(y, Decl(f.ts, 45, 42)) + + y = x; +>y : Symbol(y, Decl(f.ts, 45, 42)) +>x : Symbol(x, Decl(f.ts, 45, 11)) +} + +function i(x: strings.DiagnosticCategory, y: ambients.DiagnosticCategory) { +>i : Symbol(i, Decl(f.ts, 48, 1)) +>x : Symbol(x, Decl(f.ts, 50, 11)) +>strings : Symbol(strings, Decl(f.ts, 15, 1)) +>DiagnosticCategory : Symbol(strings.DiagnosticCategory, Decl(f.ts, 17, 19)) +>y : Symbol(y, Decl(f.ts, 50, 41)) +>ambients : Symbol(ambients, Decl(f.ts, 24, 1)) +>DiagnosticCategory : Symbol(ambients.DiagnosticCategory, Decl(f.ts, 26, 28)) + + x = y; +>x : Symbol(x, Decl(f.ts, 50, 11)) +>y : Symbol(y, Decl(f.ts, 50, 41)) + + y = x; +>y : Symbol(y, Decl(f.ts, 50, 41)) +>x : Symbol(x, Decl(f.ts, 50, 11)) +} + +export enum DiagnosticCategory { +>DiagnosticCategory : Symbol(DiagnosticCategory, Decl(f.ts, 53, 1)) + + Warning, +>Warning : Symbol(DiagnosticCategory.Warning, Decl(f.ts, 55, 32)) + + Error, +>Error : Symbol(DiagnosticCategory.Error, Decl(f.ts, 56, 12)) + + Suggestion, +>Suggestion : Symbol(DiagnosticCategory.Suggestion, Decl(f.ts, 57, 10)) + + Message, +>Message : Symbol(DiagnosticCategory.Message, Decl(f.ts, 58, 15)) +} + +export let x: DiagnosticCategory; +>x : Symbol(x, Decl(f.ts, 62, 10)) +>DiagnosticCategory : Symbol(DiagnosticCategory, Decl(f.ts, 53, 1)) + +(() => { + enum DiagnosticCategory { +>DiagnosticCategory : Symbol(DiagnosticCategory, Decl(f.ts, 64, 8)) + + Warning = "Warning", +>Warning : Symbol(DiagnosticCategory.Warning, Decl(f.ts, 65, 29)) + + Error = "Error", +>Error : Symbol(DiagnosticCategory.Error, Decl(f.ts, 66, 28)) + + Suggestion = "Suggestion", +>Suggestion : Symbol(DiagnosticCategory.Suggestion, Decl(f.ts, 67, 24)) + + Message = "Message", +>Message : Symbol(DiagnosticCategory.Message, Decl(f.ts, 68, 34)) + } + function f(y: DiagnosticCategory) { +>f : Symbol(f, Decl(f.ts, 70, 5)) +>y : Symbol(y, Decl(f.ts, 71, 15)) +>DiagnosticCategory : Symbol(DiagnosticCategory, Decl(f.ts, 64, 8)) + + x = y; +>x : Symbol(x, Decl(f.ts, 62, 10)) +>y : Symbol(y, Decl(f.ts, 71, 15)) + + y = x; +>y : Symbol(y, Decl(f.ts, 71, 15)) +>x : Symbol(x, Decl(f.ts, 62, 10)) + } +})() diff --git a/tests/baselines/reference/enumAssignmentCompat6.types b/tests/baselines/reference/enumAssignmentCompat6.types new file mode 100644 index 0000000000000..ff464f41afb28 --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat6.types @@ -0,0 +1,214 @@ +//// [tests/cases/compiler/enumAssignmentCompat6.ts] //// + +=== f.ts === +// @filename a.ts +namespace numerics { +>numerics : typeof numerics + + export enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning, +>Warning : DiagnosticCategory.Warning + + Error, +>Error : DiagnosticCategory.Error + + Suggestion, +>Suggestion : DiagnosticCategory.Suggestion + + Message, +>Message : DiagnosticCategory.Message + } + + export enum DiagnosticCategory2 { +>DiagnosticCategory2 : DiagnosticCategory2 + + Warning, +>Warning : DiagnosticCategory2.Warning + + Error, +>Error : DiagnosticCategory2.Error + + Suggestion, +>Suggestion : DiagnosticCategory2.Suggestion + + Message, +>Message : DiagnosticCategory2.Message + } +} + +namespace strings { +>strings : typeof strings + + export enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning = "Warning", +>Warning : DiagnosticCategory.Warning +>"Warning" : "Warning" + + Error = "Error", +>Error : DiagnosticCategory.Error +>"Error" : "Error" + + Suggestion = "Suggestion", +>Suggestion : DiagnosticCategory.Suggestion +>"Suggestion" : "Suggestion" + + Message = "Message", +>Message : DiagnosticCategory.Message +>"Message" : "Message" + } +} + +declare namespace ambients { +>ambients : typeof ambients + + export enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning, +>Warning : DiagnosticCategory.Warning + + Error, +>Error : DiagnosticCategory.Error + + Suggestion, +>Suggestion : DiagnosticCategory.Suggestion + + Message, +>Message : DiagnosticCategory.Message + } +} + +function f(x: numerics.DiagnosticCategory, y: strings.DiagnosticCategory) { +>f : (x: numerics.DiagnosticCategory, y: strings.DiagnosticCategory) => void +>x : numerics.DiagnosticCategory +>numerics : any +>y : strings.DiagnosticCategory +>strings : any + + x = y; +>x = y : strings.DiagnosticCategory +>x : numerics.DiagnosticCategory +>y : strings.DiagnosticCategory + + y = x; +>y = x : numerics.DiagnosticCategory +>y : strings.DiagnosticCategory +>x : numerics.DiagnosticCategory +} + +function g(x: numerics.DiagnosticCategory2, y: strings.DiagnosticCategory) { +>g : (x: numerics.DiagnosticCategory2, y: strings.DiagnosticCategory) => void +>x : numerics.DiagnosticCategory2 +>numerics : any +>y : strings.DiagnosticCategory +>strings : any + + x = y; +>x = y : strings.DiagnosticCategory +>x : numerics.DiagnosticCategory2 +>y : strings.DiagnosticCategory + + y = x; +>y = x : numerics.DiagnosticCategory2 +>y : strings.DiagnosticCategory +>x : numerics.DiagnosticCategory2 +} + +function h(x: numerics.DiagnosticCategory, y: ambients.DiagnosticCategory) { +>h : (x: numerics.DiagnosticCategory, y: ambients.DiagnosticCategory) => void +>x : numerics.DiagnosticCategory +>numerics : any +>y : ambients.DiagnosticCategory +>ambients : any + + x = y; +>x = y : ambients.DiagnosticCategory +>x : numerics.DiagnosticCategory +>y : ambients.DiagnosticCategory + + y = x; +>y = x : numerics.DiagnosticCategory +>y : ambients.DiagnosticCategory +>x : numerics.DiagnosticCategory +} + +function i(x: strings.DiagnosticCategory, y: ambients.DiagnosticCategory) { +>i : (x: strings.DiagnosticCategory, y: ambients.DiagnosticCategory) => void +>x : strings.DiagnosticCategory +>strings : any +>y : ambients.DiagnosticCategory +>ambients : any + + x = y; +>x = y : ambients.DiagnosticCategory +>x : strings.DiagnosticCategory +>y : ambients.DiagnosticCategory + + y = x; +>y = x : strings.DiagnosticCategory +>y : ambients.DiagnosticCategory +>x : strings.DiagnosticCategory +} + +export enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning, +>Warning : DiagnosticCategory.Warning + + Error, +>Error : DiagnosticCategory.Error + + Suggestion, +>Suggestion : DiagnosticCategory.Suggestion + + Message, +>Message : DiagnosticCategory.Message +} + +export let x: DiagnosticCategory; +>x : DiagnosticCategory + +(() => { +>(() => { enum DiagnosticCategory { Warning = "Warning", Error = "Error", Suggestion = "Suggestion", Message = "Message", } function f(y: DiagnosticCategory) { x = y; y = x; }})() : void +>(() => { enum DiagnosticCategory { Warning = "Warning", Error = "Error", Suggestion = "Suggestion", Message = "Message", } function f(y: DiagnosticCategory) { x = y; y = x; }}) : () => void +>() => { enum DiagnosticCategory { Warning = "Warning", Error = "Error", Suggestion = "Suggestion", Message = "Message", } function f(y: DiagnosticCategory) { x = y; y = x; }} : () => void + + enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning = "Warning", +>Warning : DiagnosticCategory.Warning +>"Warning" : "Warning" + + Error = "Error", +>Error : DiagnosticCategory.Error +>"Error" : "Error" + + Suggestion = "Suggestion", +>Suggestion : DiagnosticCategory.Suggestion +>"Suggestion" : "Suggestion" + + Message = "Message", +>Message : DiagnosticCategory.Message +>"Message" : "Message" + } + function f(y: DiagnosticCategory) { +>f : (y: DiagnosticCategory) => void +>y : DiagnosticCategory + + x = y; +>x = y : DiagnosticCategory +>x : import("f").DiagnosticCategory +>y : DiagnosticCategory + + y = x; +>y = x : import("f").DiagnosticCategory +>y : DiagnosticCategory +>x : import("f").DiagnosticCategory + } +})() diff --git a/tests/baselines/reference/enumAssignmentCompat7.errors.txt b/tests/baselines/reference/enumAssignmentCompat7.errors.txt new file mode 100644 index 0000000000000..b829d9b65dcdd --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat7.errors.txt @@ -0,0 +1,42 @@ +enumAssignmentCompat7.ts(16,14): error TS2416: Property 'method' in type 'Derived' is not assignable to the same property in base type 'Base'. + Type '(param: second.E) => void' is not assignable to type '(param: first.E) => void'. + Types of parameters 'param' and 'param' are incompatible. + Type 'first.E' is not assignable to type 'second.E'. +enumAssignmentCompat7.ts(20,10): error TS2394: This overload signature is not compatible with its implementation signature. +enumAssignmentCompat7.ts(22,21): error TS2339: Property 'B' does not exist on type 'typeof E'. + + +==== enumAssignmentCompat7.ts (3 errors) ==== + namespace first { + export enum E { A = 1 } + } + + namespace second { + export enum E { A = 2 } + } + + class Base { + method(param: first.E) { + + } + } + + class Derived extends Base { + override method(param: second.E) { + ~~~~~~ +!!! error TS2416: Property 'method' in type 'Derived' is not assignable to the same property in base type 'Base'. +!!! error TS2416: Type '(param: second.E) => void' is not assignable to type '(param: first.E) => void'. +!!! error TS2416: Types of parameters 'param' and 'param' are incompatible. +!!! error TS2416: Type 'first.E' is not assignable to type 'second.E'. + } + } + + function overloadingFunction(): first.E + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 enumAssignmentCompat7.ts:21:10: The implementation signature is declared here. + function overloadingFunction(): second.E { + return second.E.B + ~ +!!! error TS2339: Property 'B' does not exist on type 'typeof E'. + } \ No newline at end of file diff --git a/tests/baselines/reference/enumAssignmentCompat7.js b/tests/baselines/reference/enumAssignmentCompat7.js new file mode 100644 index 0000000000000..4521732abed6d --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat7.js @@ -0,0 +1,77 @@ +//// [tests/cases/compiler/enumAssignmentCompat7.ts] //// + +//// [enumAssignmentCompat7.ts] +namespace first { + export enum E { A = 1 } +} + +namespace second { + export enum E { A = 2 } +} + +class Base { + method(param: first.E) { + + } +} + +class Derived extends Base { + override method(param: second.E) { + } +} + +function overloadingFunction(): first.E +function overloadingFunction(): second.E { + return second.E.B +} + +//// [enumAssignmentCompat7.js] +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var first; +(function (first) { + var E; + (function (E) { + E[E["A"] = 1] = "A"; + })(E = first.E || (first.E = {})); +})(first || (first = {})); +var second; +(function (second) { + var E; + (function (E) { + E[E["A"] = 2] = "A"; + })(E = second.E || (second.E = {})); +})(second || (second = {})); +var Base = /** @class */ (function () { + function Base() { + } + Base.prototype.method = function (param) { + }; + return Base; +}()); +var Derived = /** @class */ (function (_super) { + __extends(Derived, _super); + function Derived() { + return _super !== null && _super.apply(this, arguments) || this; + } + Derived.prototype.method = function (param) { + }; + return Derived; +}(Base)); +function overloadingFunction() { + return second.E.B; +} diff --git a/tests/baselines/reference/enumAssignmentCompat7.symbols b/tests/baselines/reference/enumAssignmentCompat7.symbols new file mode 100644 index 0000000000000..8cd0dd808a94a --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat7.symbols @@ -0,0 +1,58 @@ +//// [tests/cases/compiler/enumAssignmentCompat7.ts] //// + +=== enumAssignmentCompat7.ts === +namespace first { +>first : Symbol(first, Decl(enumAssignmentCompat7.ts, 0, 0)) + + export enum E { A = 1 } +>E : Symbol(E, Decl(enumAssignmentCompat7.ts, 0, 17)) +>A : Symbol(E.A, Decl(enumAssignmentCompat7.ts, 1, 19)) +} + +namespace second { +>second : Symbol(second, Decl(enumAssignmentCompat7.ts, 2, 1)) + + export enum E { A = 2 } +>E : Symbol(E, Decl(enumAssignmentCompat7.ts, 4, 18)) +>A : Symbol(E.A, Decl(enumAssignmentCompat7.ts, 5, 19)) +} + +class Base { +>Base : Symbol(Base, Decl(enumAssignmentCompat7.ts, 6, 1)) + + method(param: first.E) { +>method : Symbol(Base.method, Decl(enumAssignmentCompat7.ts, 8, 12)) +>param : Symbol(param, Decl(enumAssignmentCompat7.ts, 9, 11)) +>first : Symbol(first, Decl(enumAssignmentCompat7.ts, 0, 0)) +>E : Symbol(first.E, Decl(enumAssignmentCompat7.ts, 0, 17)) + + } +} + +class Derived extends Base { +>Derived : Symbol(Derived, Decl(enumAssignmentCompat7.ts, 12, 1)) +>Base : Symbol(Base, Decl(enumAssignmentCompat7.ts, 6, 1)) + + override method(param: second.E) { +>method : Symbol(Derived.method, Decl(enumAssignmentCompat7.ts, 14, 28)) +>param : Symbol(param, Decl(enumAssignmentCompat7.ts, 15, 20)) +>second : Symbol(second, Decl(enumAssignmentCompat7.ts, 2, 1)) +>E : Symbol(second.E, Decl(enumAssignmentCompat7.ts, 4, 18)) + } +} + +function overloadingFunction(): first.E +>overloadingFunction : Symbol(overloadingFunction, Decl(enumAssignmentCompat7.ts, 17, 1), Decl(enumAssignmentCompat7.ts, 19, 39)) +>first : Symbol(first, Decl(enumAssignmentCompat7.ts, 0, 0)) +>E : Symbol(first.E, Decl(enumAssignmentCompat7.ts, 0, 17)) + +function overloadingFunction(): second.E { +>overloadingFunction : Symbol(overloadingFunction, Decl(enumAssignmentCompat7.ts, 17, 1), Decl(enumAssignmentCompat7.ts, 19, 39)) +>second : Symbol(second, Decl(enumAssignmentCompat7.ts, 2, 1)) +>E : Symbol(second.E, Decl(enumAssignmentCompat7.ts, 4, 18)) + + return second.E.B +>second.E : Symbol(second.E, Decl(enumAssignmentCompat7.ts, 4, 18)) +>second : Symbol(second, Decl(enumAssignmentCompat7.ts, 2, 1)) +>E : Symbol(second.E, Decl(enumAssignmentCompat7.ts, 4, 18)) +} diff --git a/tests/baselines/reference/enumAssignmentCompat7.types b/tests/baselines/reference/enumAssignmentCompat7.types new file mode 100644 index 0000000000000..0445ae8147ac4 --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat7.types @@ -0,0 +1,58 @@ +//// [tests/cases/compiler/enumAssignmentCompat7.ts] //// + +=== enumAssignmentCompat7.ts === +namespace first { +>first : typeof first + + export enum E { A = 1 } +>E : E +>A : E.A +>1 : 1 +} + +namespace second { +>second : typeof second + + export enum E { A = 2 } +>E : E +>A : E.A +>2 : 2 +} + +class Base { +>Base : Base + + method(param: first.E) { +>method : (param: first.E) => void +>param : first.E +>first : any + + } +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + override method(param: second.E) { +>method : (param: second.E) => void +>param : second.E +>second : any + } +} + +function overloadingFunction(): first.E +>overloadingFunction : () => first.E +>first : any + +function overloadingFunction(): second.E { +>overloadingFunction : () => first.E +>second : any + + return second.E.B +>second.E.B : any +>second.E : typeof second.E +>second : typeof second +>E : typeof second.E +>B : any +} diff --git a/tests/baselines/reference/es2016IntlAPIs.types b/tests/baselines/reference/es2016IntlAPIs.types index 55ddd22d3b532..cb44b790047dc 100644 --- a/tests/baselines/reference/es2016IntlAPIs.types +++ b/tests/baselines/reference/es2016IntlAPIs.types @@ -9,9 +9,9 @@ console.log(Intl.getCanonicalLocales('EN-US')); >console : Console >log : (...data: any[]) => void >Intl.getCanonicalLocales('EN-US') : string[] ->Intl.getCanonicalLocales : (locale?: string | string[]) => string[] +>Intl.getCanonicalLocales : (locale?: string | readonly string[]) => string[] >Intl : typeof Intl ->getCanonicalLocales : (locale?: string | string[]) => string[] +>getCanonicalLocales : (locale?: string | readonly string[]) => string[] >'EN-US' : "EN-US" // Expected output: Array ["en-US"] @@ -22,9 +22,9 @@ console.log(Intl.getCanonicalLocales(['EN-US', 'Fr'])); >console : Console >log : (...data: any[]) => void >Intl.getCanonicalLocales(['EN-US', 'Fr']) : string[] ->Intl.getCanonicalLocales : (locale?: string | string[]) => string[] +>Intl.getCanonicalLocales : (locale?: string | readonly string[]) => string[] >Intl : typeof Intl ->getCanonicalLocales : (locale?: string | string[]) => string[] +>getCanonicalLocales : (locale?: string | readonly string[]) => string[] >['EN-US', 'Fr'] : string[] >'EN-US' : "EN-US" >'Fr' : "Fr" @@ -34,9 +34,9 @@ console.log(Intl.getCanonicalLocales(['EN-US', 'Fr'])); try { Intl.getCanonicalLocales('EN_US'); >Intl.getCanonicalLocales('EN_US') : string[] ->Intl.getCanonicalLocales : (locale?: string | string[]) => string[] +>Intl.getCanonicalLocales : (locale?: string | readonly string[]) => string[] >Intl : typeof Intl ->getCanonicalLocales : (locale?: string | string[]) => string[] +>getCanonicalLocales : (locale?: string | readonly string[]) => string[] >'EN_US' : "EN_US" } catch (err) { diff --git a/tests/baselines/reference/es2018IntlAPIs.types b/tests/baselines/reference/es2018IntlAPIs.types index b9631962c97d5..a66c377532125 100644 --- a/tests/baselines/reference/es2018IntlAPIs.types +++ b/tests/baselines/reference/es2018IntlAPIs.types @@ -25,11 +25,11 @@ console.log(Intl.PluralRules.supportedLocalesOf(locales, options).join(', ')); >Intl.PluralRules.supportedLocalesOf(locales, options).join(', ') : string >Intl.PluralRules.supportedLocalesOf(locales, options).join : (separator?: string) => string >Intl.PluralRules.supportedLocalesOf(locales, options) : string[] ->Intl.PluralRules.supportedLocalesOf : (locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }) => string[] +>Intl.PluralRules.supportedLocalesOf : (locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }) => string[] >Intl.PluralRules : Intl.PluralRulesConstructor >Intl : typeof Intl >PluralRules : Intl.PluralRulesConstructor ->supportedLocalesOf : (locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }) => string[] +>supportedLocalesOf : (locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }) => string[] >locales : string[] >options : { readonly localeMatcher: "lookup"; } >join : (separator?: string) => string diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js index 28403fa0f2783..6e098787886f4 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js @@ -137,22 +137,21 @@ let C = (() => { let _static_private_set_x_descriptor; let _static_private_y_decorators; let _static_private_y_initializers = []; + let _static_private_y_extraInitializers = []; let _static_private_z_decorators; let _static_private_z_initializers = []; + let _static_private_z_extraInitializers = []; let _static_private_z_descriptor; let _method_decorators; let _get_x_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; let _z_decorators; let _z_initializers = []; + let _z_extraInitializers = []; var C = _classThis = class { - constructor() { - /*13*/ - this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - _C_z_1_accessor_storage.set(this, __runInitializers(this, _z_initializers, 1)); - } /*4*/ method() { } /*7*/ @@ -162,6 +161,12 @@ let C = (() => { /*16*/ get z() { return __classPrivateFieldGet(this, _C_z_1_accessor_storage, "f"); } set z(value) { __classPrivateFieldSet(this, _C_z_1_accessor_storage, value, "f"); } + constructor() { + /*13*/ + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + _C_z_1_accessor_storage.set(this, (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1))); + __runInitializers(this, _z_extraInitializers); + } }; _C_z_1_accessor_storage = new WeakMap(); _C_method_get = function _C_method_get() { return _static_private_method_descriptor.value; }; @@ -185,22 +190,22 @@ let C = (() => { __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_method_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_x_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_x_set); } }, metadata: _metadata }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _static_private_z_extraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, get: obj => obj.x }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _z_extraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _static_private_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); })(); /*28*/ - _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; - _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }; + _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }; (() => { + __runInitializers(_classThis, _static_private_z_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); })(); return C = _classThis; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js index c878d18ab1ae1..d187a927e2334 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js @@ -137,16 +137,20 @@ let C = (() => { let _static_private_set_x_descriptor; let _static_private_y_decorators; let _static_private_y_initializers = []; + let _static_private_y_extraInitializers = []; let _static_private_z_decorators; let _static_private_z_initializers = []; + let _static_private_z_extraInitializers = []; let _static_private_z_descriptor; let _method_decorators; let _get_x_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; let _z_decorators; let _z_initializers = []; + let _z_extraInitializers = []; var C = class { static { _classThis = this; } static { __setFunctionName(this, "C"); } @@ -166,17 +170,16 @@ let C = (() => { __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_method_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_x_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_x_set); } }, metadata: _metadata }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _static_private_z_extraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, get: obj => obj.x }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _z_extraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _static_private_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); } /*4*/ method() { } @@ -186,18 +189,22 @@ let C = (() => { set x(value) { } /*13*/ y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - #z_accessor_storage = __runInitializers(this, _z_initializers, 1); + #z_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1)); /*16*/ get z() { return this.#z_accessor_storage; } set z(value) { this.#z_accessor_storage = value; } static { /*28*/ - _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }; } static { - _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }; + } + constructor() { + __runInitializers(this, _z_extraInitializers); } static { + __runInitializers(_classThis, _static_private_z_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); } }; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js index 43ab4e8de8cb0..625b665888e1d 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js @@ -137,22 +137,21 @@ let C = (() => { let _static_private_set_x_descriptor; let _static_private_y_decorators; let _static_private_y_initializers = []; + let _static_private_y_extraInitializers = []; let _static_private_z_decorators; let _static_private_z_initializers = []; + let _static_private_z_extraInitializers = []; let _static_private_z_descriptor; let _method_decorators; let _get_x_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; let _z_decorators; let _z_initializers = []; + let _z_extraInitializers = []; var C = _classThis = class { - constructor() { - /*13*/ - this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - _C_z_1_accessor_storage.set(this, __runInitializers(this, _z_initializers, 1)); - } /*4*/ method() { } /*7*/ @@ -162,6 +161,12 @@ let C = (() => { /*16*/ get z() { return __classPrivateFieldGet(this, _C_z_1_accessor_storage, "f"); } set z(value) { __classPrivateFieldSet(this, _C_z_1_accessor_storage, value, "f"); } + constructor() { + /*13*/ + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + _C_z_1_accessor_storage.set(this, (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1))); + __runInitializers(this, _z_extraInitializers); + } }; _C_z_1_accessor_storage = new WeakMap(); _C_method_get = function _C_method_get() { return _static_private_method_descriptor.value; }; @@ -185,22 +190,22 @@ let C = (() => { __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_method_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_x_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_x_set); } }, metadata: _metadata }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _static_private_z_extraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, get: obj => obj.x }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _z_extraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _static_private_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); })(); /*28*/ - _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; - _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }; + _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }; (() => { + __runInitializers(_classThis, _static_private_z_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); })(); return C = _classThis; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js index f9fa21082e542..cbb7239daf266 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js @@ -137,16 +137,20 @@ let C = (() => { let _static_private_set_x_descriptor; let _static_private_y_decorators; let _static_private_y_initializers = []; + let _static_private_y_extraInitializers = []; let _static_private_z_decorators; let _static_private_z_initializers = []; + let _static_private_z_extraInitializers = []; let _static_private_z_descriptor; let _method_decorators; let _get_x_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; let _z_decorators; let _z_initializers = []; + let _z_extraInitializers = []; var C = class { static { _classThis = this; } static { __setFunctionName(this, "C"); } @@ -166,17 +170,16 @@ let C = (() => { __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_method_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_x_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_x_set); } }, metadata: _metadata }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _static_private_z_extraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, get: obj => obj.x }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _z_extraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _static_private_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); } /*4*/ method() { } @@ -186,18 +189,22 @@ let C = (() => { set x(value) { } /*13*/ y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - #z_accessor_storage = __runInitializers(this, _z_initializers, 1); + #z_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1)); /*16*/ get z() { return this.#z_accessor_storage; } set z(value) { this.#z_accessor_storage = value; } static { /*28*/ - _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }; } static { - _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }; + } + constructor() { + __runInitializers(this, _z_extraInitializers); } static { + __runInitializers(_classThis, _static_private_z_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); } }; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js index 2bfad8c2f4f6d..9a30f48f2cfeb 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js @@ -17,18 +17,21 @@ const field3 = "field3"; let C = (() => { var _a; var _b; - let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; + let _field1_extraInitializers = []; let _member_decorators; let _member_initializers = []; + let _member_extraInitializers = []; let _member_decorators_1; let _member_initializers_1 = []; + let _member_extraInitializers_1 = []; return _a = class C { constructor() { - this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); - this["field2"] = __runInitializers(this, _member_initializers, 2); - this[_b] = __runInitializers(this, _member_initializers_1, 3); + this.field1 = __runInitializers(this, _field1_initializers, 1); + this["field2"] = (__runInitializers(this, _field1_extraInitializers), __runInitializers(this, _member_initializers, 2)); + this[_b] = (__runInitializers(this, _member_extraInitializers), __runInitializers(this, _member_initializers_1, 3)); + __runInitializers(this, _member_extraInitializers_1); } }, _field1_decorators = [dec(1)], @@ -37,9 +40,9 @@ let C = (() => { _b = __propKey(field3), (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _field1_extraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _member_extraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _member_initializers_1, _member_extraInitializers_1); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js index 5f74a53f3e20c..eb5a305ea63b4 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js @@ -17,33 +17,36 @@ const field3 = "field3"; let C = (() => { var _a; var _b; - let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; + let _field1_extraInitializers = []; let _member_decorators; let _member_initializers = []; + let _member_extraInitializers = []; let _member_decorators_1; let _member_initializers_1 = []; + let _member_extraInitializers_1 = []; return _a = class C { constructor() { Object.defineProperty(this, "field1", { enumerable: true, configurable: true, writable: true, - value: (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)) + value: __runInitializers(this, _field1_initializers, 1) }); Object.defineProperty(this, "field2", { enumerable: true, configurable: true, writable: true, - value: __runInitializers(this, _member_initializers, 2) + value: (__runInitializers(this, _field1_extraInitializers), __runInitializers(this, _member_initializers, 2)) }); Object.defineProperty(this, _b, { enumerable: true, configurable: true, writable: true, - value: __runInitializers(this, _member_initializers_1, 3) + value: (__runInitializers(this, _member_extraInitializers), __runInitializers(this, _member_initializers_1, 3)) }); + __runInitializers(this, _member_extraInitializers_1); } }, _field1_decorators = [dec(1)], @@ -52,9 +55,9 @@ let C = (() => { _b = __propKey(field3), (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _field1_extraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _member_extraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _member_initializers_1, _member_extraInitializers_1); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js index fc43f82333773..bed8a4f89cf1f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js @@ -16,26 +16,29 @@ class C { const field3 = "field3"; let C = (() => { var _a; - let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; + let _field1_extraInitializers = []; let _member_decorators; let _member_initializers = []; + let _member_extraInitializers = []; let _member_decorators_1; let _member_initializers_1 = []; + let _member_extraInitializers_1 = []; return class C { - constructor() { - this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); - this["field2"] = __runInitializers(this, _member_initializers, 2); - this[_a] = __runInitializers(this, _member_initializers_1, 3); - } static { _field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _field1_extraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _member_extraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _member_initializers_1, _member_extraInitializers_1); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } + constructor() { + this.field1 = __runInitializers(this, _field1_initializers, 1); + this["field2"] = (__runInitializers(this, _field1_extraInitializers), __runInitializers(this, _member_initializers, 2)); + this[_a] = (__runInitializers(this, _member_extraInitializers), __runInitializers(this, _member_initializers_1, 3)); + __runInitializers(this, _member_extraInitializers_1); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js index 347a71550f9b9..ca57211bbb7fa 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js @@ -16,23 +16,28 @@ class C { const field3 = "field3"; let C = (() => { var _a; - let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; + let _field1_extraInitializers = []; let _member_decorators; let _member_initializers = []; + let _member_extraInitializers = []; let _member_decorators_1; let _member_initializers_1 = []; + let _member_extraInitializers_1 = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _field1_extraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _member_extraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _member_initializers_1, _member_extraInitializers_1); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); - ["field2"] = __runInitializers(this, _member_initializers, 2); - [(_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3))] = __runInitializers(this, _member_initializers_1, 3); + field1 = __runInitializers(this, _field1_initializers, 1); + ["field2"] = (__runInitializers(this, _field1_extraInitializers), __runInitializers(this, _member_initializers, 2)); + [(_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3))] = (__runInitializers(this, _member_extraInitializers), __runInitializers(this, _member_initializers_1, 3)); + constructor() { + __runInitializers(this, _member_extraInitializers_1); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js index 1e75741eea5a5..fe2c28eb12957 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js @@ -17,18 +17,21 @@ var field3 = "field3"; var C = function () { var _a; var _b; - var _instanceExtraInitializers = []; var _field1_decorators; var _field1_initializers = []; + var _field1_extraInitializers = []; var _member_decorators; var _member_initializers = []; + var _member_extraInitializers = []; var _member_decorators_1; var _member_initializers_1 = []; + var _member_extraInitializers_1 = []; return _a = /** @class */ (function () { function C() { - this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); - this["field2"] = __runInitializers(this, _member_initializers, 2); - this[_b] = __runInitializers(this, _member_initializers_1, 3); + this.field1 = __runInitializers(this, _field1_initializers, 1); + this["field2"] = (__runInitializers(this, _field1_extraInitializers), __runInitializers(this, _member_initializers, 2)); + this[_b] = (__runInitializers(this, _member_extraInitializers), __runInitializers(this, _member_initializers_1, 3)); + __runInitializers(this, _member_extraInitializers_1); } return C; }()), @@ -38,9 +41,9 @@ var C = function () { _b = __propKey(field3), (function () { var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: function (obj) { return "field1" in obj; }, get: function (obj) { return obj.field1; }, set: function (obj, value) { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: function (obj) { return "field2" in obj; }, get: function (obj) { return obj["field2"]; }, set: function (obj, value) { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { has: function (obj) { return _b in obj; }, get: function (obj) { return obj[_b]; }, set: function (obj, value) { obj[_b] = value; } }, metadata: _metadata }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: function (obj) { return "field1" in obj; }, get: function (obj) { return obj.field1; }, set: function (obj, value) { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _field1_extraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: function (obj) { return "field2" in obj; }, get: function (obj) { return obj["field2"]; }, set: function (obj, value) { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _member_extraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { has: function (obj) { return _b in obj; }, get: function (obj) { return obj[_b]; }, set: function (obj, value) { obj[_b] = value; } }, metadata: _metadata }, _member_initializers_1, _member_extraInitializers_1); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js index 24d2e5bd006fa..6c8c7701bdf6e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js @@ -17,33 +17,36 @@ var field3 = "field3"; var C = function () { var _a; var _b; - var _instanceExtraInitializers = []; var _field1_decorators; var _field1_initializers = []; + var _field1_extraInitializers = []; var _member_decorators; var _member_initializers = []; + var _member_extraInitializers = []; var _member_decorators_1; var _member_initializers_1 = []; + var _member_extraInitializers_1 = []; return _a = /** @class */ (function () { function C() { Object.defineProperty(this, "field1", { enumerable: true, configurable: true, writable: true, - value: (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)) + value: __runInitializers(this, _field1_initializers, 1) }); Object.defineProperty(this, "field2", { enumerable: true, configurable: true, writable: true, - value: __runInitializers(this, _member_initializers, 2) + value: (__runInitializers(this, _field1_extraInitializers), __runInitializers(this, _member_initializers, 2)) }); Object.defineProperty(this, _b, { enumerable: true, configurable: true, writable: true, - value: __runInitializers(this, _member_initializers_1, 3) + value: (__runInitializers(this, _member_extraInitializers), __runInitializers(this, _member_initializers_1, 3)) }); + __runInitializers(this, _member_extraInitializers_1); } return C; }()), @@ -53,9 +56,9 @@ var C = function () { _b = __propKey(field3), (function () { var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: function (obj) { return "field1" in obj; }, get: function (obj) { return obj.field1; }, set: function (obj, value) { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: function (obj) { return "field2" in obj; }, get: function (obj) { return obj["field2"]; }, set: function (obj, value) { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { has: function (obj) { return _b in obj; }, get: function (obj) { return obj[_b]; }, set: function (obj, value) { obj[_b] = value; } }, metadata: _metadata }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: function (obj) { return "field1" in obj; }, get: function (obj) { return obj.field1; }, set: function (obj, value) { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _field1_extraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: function (obj) { return "field2" in obj; }, get: function (obj) { return obj["field2"]; }, set: function (obj, value) { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _member_extraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { has: function (obj) { return _b in obj; }, get: function (obj) { return obj[_b]; }, set: function (obj, value) { obj[_b] = value; } }, metadata: _metadata }, _member_initializers_1, _member_extraInitializers_1); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js index fc43f82333773..bed8a4f89cf1f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js @@ -16,26 +16,29 @@ class C { const field3 = "field3"; let C = (() => { var _a; - let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; + let _field1_extraInitializers = []; let _member_decorators; let _member_initializers = []; + let _member_extraInitializers = []; let _member_decorators_1; let _member_initializers_1 = []; + let _member_extraInitializers_1 = []; return class C { - constructor() { - this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); - this["field2"] = __runInitializers(this, _member_initializers, 2); - this[_a] = __runInitializers(this, _member_initializers_1, 3); - } static { _field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _field1_extraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _member_extraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _member_initializers_1, _member_extraInitializers_1); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } + constructor() { + this.field1 = __runInitializers(this, _field1_initializers, 1); + this["field2"] = (__runInitializers(this, _field1_extraInitializers), __runInitializers(this, _member_initializers, 2)); + this[_a] = (__runInitializers(this, _member_extraInitializers), __runInitializers(this, _member_initializers_1, 3)); + __runInitializers(this, _member_extraInitializers_1); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js index e4121674c1044..f8ca6d07bfced 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js @@ -17,31 +17,34 @@ const field3 = "field3"; let C = (() => { var _a, _C_field1_accessor_storage, _C__a_accessor_storage, _C__b_accessor_storage; var _b; - let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; + let _field1_extraInitializers = []; let _member_decorators; let _member_initializers = []; + let _member_extraInitializers = []; let _member_decorators_1; let _member_initializers_1 = []; + let _member_extraInitializers_1 = []; return _a = class C { - constructor() { - _C_field1_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1))); - _C__a_accessor_storage.set(this, __runInitializers(this, _member_initializers, 2)); - _C__b_accessor_storage.set(this, __runInitializers(this, _member_initializers_1, 3)); - } get field1() { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); } set field1(value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); } get [(_C_field1_accessor_storage = new WeakMap(), _C__a_accessor_storage = new WeakMap(), _C__b_accessor_storage = new WeakMap(), "field2")]() { return __classPrivateFieldGet(this, _C__a_accessor_storage, "f"); } set ["field2"](value) { __classPrivateFieldSet(this, _C__a_accessor_storage, value, "f"); } get [(_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _b = __propKey(field3))]() { return __classPrivateFieldGet(this, _C__b_accessor_storage, "f"); } set [_b](value) { __classPrivateFieldSet(this, _C__b_accessor_storage, value, "f"); } + constructor() { + _C_field1_accessor_storage.set(this, __runInitializers(this, _field1_initializers, 1)); + _C__a_accessor_storage.set(this, (__runInitializers(this, _field1_extraInitializers), __runInitializers(this, _member_initializers, 2))); + _C__b_accessor_storage.set(this, (__runInitializers(this, _member_extraInitializers), __runInitializers(this, _member_initializers_1, 3))); + __runInitializers(this, _member_extraInitializers_1); + } }, (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(_a, null, _field1_decorators, { kind: "accessor", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(_a, null, _member_decorators, { kind: "accessor", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _instanceExtraInitializers); - __esDecorate(_a, null, _member_decorators_1, { kind: "accessor", name: _b, static: false, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(_a, null, _field1_decorators, { kind: "accessor", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _field1_extraInitializers); + __esDecorate(_a, null, _member_decorators, { kind: "accessor", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _member_extraInitializers); + __esDecorate(_a, null, _member_decorators_1, { kind: "accessor", name: _b, static: false, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _member_initializers_1, _member_extraInitializers_1); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js index ea4e28865b2ab..26fd995bcfd4d 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js @@ -16,29 +16,34 @@ class C { const field3 = "field3"; let C = (() => { var _a; - let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; + let _field1_extraInitializers = []; let _member_decorators; let _member_initializers = []; + let _member_extraInitializers = []; let _member_decorators_1; let _member_initializers_1 = []; + let _member_extraInitializers_1 = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(this, null, _field1_decorators, { kind: "accessor", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(this, null, _member_decorators, { kind: "accessor", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _instanceExtraInitializers); - __esDecorate(this, null, _member_decorators_1, { kind: "accessor", name: _a, static: false, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(this, null, _field1_decorators, { kind: "accessor", name: "field1", static: false, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _field1_initializers, _field1_extraInitializers); + __esDecorate(this, null, _member_decorators, { kind: "accessor", name: "field2", static: false, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _member_initializers, _member_extraInitializers); + __esDecorate(this, null, _member_decorators_1, { kind: "accessor", name: _a, static: false, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _member_initializers_1, _member_extraInitializers_1); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - #field1_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); + #field1_accessor_storage = __runInitializers(this, _field1_initializers, 1); get field1() { return this.#field1_accessor_storage; } set field1(value) { this.#field1_accessor_storage = value; } - #_a_accessor_storage = __runInitializers(this, _member_initializers, 2); + #_a_accessor_storage = (__runInitializers(this, _field1_extraInitializers), __runInitializers(this, _member_initializers, 2)); get ["field2"]() { return this.#_a_accessor_storage; } set ["field2"](value) { this.#_a_accessor_storage = value; } - #_b_accessor_storage = __runInitializers(this, _member_initializers_1, 3); + #_b_accessor_storage = (__runInitializers(this, _member_extraInitializers), __runInitializers(this, _member_initializers_1, 3)); get [(_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3))]() { return this.#_b_accessor_storage; } set [_a](value) { this.#_b_accessor_storage = value; } + constructor() { + __runInitializers(this, _member_extraInitializers_1); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js index 37ab7eb44f87d..c01012fa9bfcd 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js @@ -11,19 +11,20 @@ class C { //// [esDecorators-classDeclaration-fields-nonStaticPrivate.js] let C = (() => { var _a, _C_field1; - let _instanceExtraInitializers = []; let _private_field1_decorators; let _private_field1_initializers = []; + let _private_field1_extraInitializers = []; return _a = class C { constructor() { - _C_field1.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0))); + _C_field1.set(this, __runInitializers(this, _private_field1_initializers, 0)); + __runInitializers(this, _private_field1_extraInitializers); } }, _C_field1 = new WeakMap(), (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _private_field1_decorators = [dec]; - __esDecorate(null, null, _private_field1_decorators, { kind: "field", name: "#field1", static: false, private: true, access: { has: obj => __classPrivateFieldIn(_C_field1, obj), get: obj => __classPrivateFieldGet(obj, _C_field1, "f"), set: (obj, value) => { __classPrivateFieldSet(obj, _C_field1, value, "f"); } }, metadata: _metadata }, _private_field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _private_field1_decorators, { kind: "field", name: "#field1", static: false, private: true, access: { has: obj => __classPrivateFieldIn(_C_field1, obj), get: obj => __classPrivateFieldGet(obj, _C_field1, "f"), set: (obj, value) => { __classPrivateFieldSet(obj, _C_field1, value, "f"); } }, metadata: _metadata }, _private_field1_initializers, _private_field1_extraInitializers); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js index 5be9b65bd6cad..c5ee185a42888 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js @@ -10,16 +10,19 @@ class C { //// [esDecorators-classDeclaration-fields-nonStaticPrivate.js] let C = (() => { - let _instanceExtraInitializers = []; let _private_field1_decorators; let _private_field1_initializers = []; + let _private_field1_extraInitializers = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _private_field1_decorators = [dec]; - __esDecorate(null, null, _private_field1_decorators, { kind: "field", name: "#field1", static: false, private: true, access: { has: obj => #field1 in obj, get: obj => obj.#field1, set: (obj, value) => { obj.#field1 = value; } }, metadata: _metadata }, _private_field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _private_field1_decorators, { kind: "field", name: "#field1", static: false, private: true, access: { has: obj => #field1 in obj, get: obj => obj.#field1, set: (obj, value) => { obj.#field1 = value; } }, metadata: _metadata }, _private_field1_initializers, _private_field1_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - #field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0)); + #field1 = __runInitializers(this, _private_field1_initializers, 0); + constructor() { + __runInitializers(this, _private_field1_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js index cb37ef49f90fe..3f1025856e94e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js @@ -11,14 +11,15 @@ class C { //// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.js] let C = (() => { var _C_instances, _a, _C_field1_accessor_storage, _C_field1_get, _C_field1_set; - let _instanceExtraInitializers = []; let _private_field1_decorators; let _private_field1_initializers = []; + let _private_field1_extraInitializers = []; let _private_field1_descriptor; return _a = class C { constructor() { _C_instances.add(this); - _C_field1_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0))); + _C_field1_accessor_storage.set(this, __runInitializers(this, _private_field1_initializers, 0)); + __runInitializers(this, _private_field1_extraInitializers); } }, _C_field1_accessor_storage = new WeakMap(), @@ -28,7 +29,7 @@ let C = (() => { (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _private_field1_decorators = [dec]; - __esDecorate(_a, _private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); }, "#field1", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); }, "#field1", "set") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { has: obj => __classPrivateFieldIn(_C_instances, obj), get: obj => __classPrivateFieldGet(obj, _C_instances, "a", _C_field1_get), set: (obj, value) => { __classPrivateFieldSet(obj, _C_instances, value, "a", _C_field1_set); } }, metadata: _metadata }, _private_field1_initializers, _instanceExtraInitializers); + __esDecorate(_a, _private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); }, "#field1", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); }, "#field1", "set") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { has: obj => __classPrivateFieldIn(_C_instances, obj), get: obj => __classPrivateFieldGet(obj, _C_instances, "a", _C_field1_get), set: (obj, value) => { __classPrivateFieldSet(obj, _C_instances, value, "a", _C_field1_set); } }, metadata: _metadata }, _private_field1_initializers, _private_field1_extraInitializers); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js index cd4fde08189e4..c658a261dd483 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js @@ -10,19 +10,22 @@ class C { //// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.js] let C = (() => { - let _instanceExtraInitializers = []; let _private_field1_decorators; let _private_field1_initializers = []; + let _private_field1_extraInitializers = []; let _private_field1_descriptor; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _private_field1_decorators = [dec]; - __esDecorate(this, _private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1", "get"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1", "set") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { has: obj => #field1 in obj, get: obj => obj.#field1, set: (obj, value) => { obj.#field1 = value; } }, metadata: _metadata }, _private_field1_initializers, _instanceExtraInitializers); + __esDecorate(this, _private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1", "get"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1", "set") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { has: obj => #field1 in obj, get: obj => obj.#field1, set: (obj, value) => { obj.#field1 = value; } }, metadata: _metadata }, _private_field1_initializers, _private_field1_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - #field1_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0)); + #field1_accessor_storage = __runInitializers(this, _private_field1_initializers, 0); get #field1() { return _private_field1_descriptor.get.call(this); } set #field1(value) { return _private_field1_descriptor.set.call(this, value); } + constructor() { + __runInitializers(this, _private_field1_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js index aace6373fbfcd..fbb1c1e8da69a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js @@ -17,13 +17,15 @@ const field3 = "field3"; let C = (() => { var _a; var _b; - let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; + let _static_field1_extraInitializers = []; let _static_member_decorators; let _static_member_initializers = []; + let _static_member_extraInitializers = []; let _static_member_decorators_1; let _static_member_initializers_1 = []; + let _static_member_extraInitializers_1 = []; return _a = class C { }, _static_field1_decorators = [dec(1)], @@ -32,14 +34,16 @@ let C = (() => { _b = __propKey(field3), (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _static_field1_extraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _static_member_initializers_1, _static_member_extraInitializers_1); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_a, _staticExtraInitializers); })(), _a.field1 = __runInitializers(_a, _static_field1_initializers, 1), - _a["field2"] = __runInitializers(_a, _static_member_initializers, 2), - _a[_b] = __runInitializers(_a, _static_member_initializers_1, 3), + _a["field2"] = (__runInitializers(_a, _static_field1_extraInitializers), __runInitializers(_a, _static_member_initializers, 2)), + _a[_b] = (__runInitializers(_a, _static_member_extraInitializers), __runInitializers(_a, _static_member_initializers_1, 3)), + (() => { + __runInitializers(_a, _static_member_extraInitializers_1); + })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js index c1b41b7fe36bd..f09ee49d39ab9 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js @@ -17,13 +17,15 @@ const field3 = "field3"; let C = (() => { var _a; var _b; - let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; + let _static_field1_extraInitializers = []; let _static_member_decorators; let _static_member_initializers = []; + let _static_member_extraInitializers = []; let _static_member_decorators_1; let _static_member_initializers_1 = []; + let _static_member_extraInitializers_1 = []; return _a = class C { }, _static_field1_decorators = [dec(1)], @@ -32,11 +34,10 @@ let C = (() => { _b = __propKey(field3), (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _static_field1_extraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _static_member_initializers_1, _static_member_extraInitializers_1); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_a, _staticExtraInitializers); })(), Object.defineProperty(_a, "field1", { enumerable: true, @@ -48,13 +49,16 @@ let C = (() => { enumerable: true, configurable: true, writable: true, - value: __runInitializers(_a, _static_member_initializers, 2) + value: (__runInitializers(_a, _static_field1_extraInitializers), __runInitializers(_a, _static_member_initializers, 2)) }), Object.defineProperty(_a, _b, { enumerable: true, configurable: true, writable: true, - value: __runInitializers(_a, _static_member_initializers_1, 3) + value: (__runInitializers(_a, _static_member_extraInitializers), __runInitializers(_a, _static_member_initializers_1, 3)) }), + (() => { + __runInitializers(_a, _static_member_extraInitializers_1); + })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js index 3a2c6e945361d..f57f24768729a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js @@ -16,25 +16,29 @@ class C { const field3 = "field3"; let C = (() => { var _a; - let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; + let _static_field1_extraInitializers = []; let _static_member_decorators; let _static_member_initializers = []; + let _static_member_extraInitializers = []; let _static_member_decorators_1; let _static_member_initializers_1 = []; + let _static_member_extraInitializers_1 = []; return class C { static { _static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _static_field1_extraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers_1, _static_member_extraInitializers_1); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(this, _staticExtraInitializers); } static { this.field1 = __runInitializers(this, _static_field1_initializers, 1); } - static { this["field2"] = __runInitializers(this, _static_member_initializers, 2); } - static { this[_a] = __runInitializers(this, _static_member_initializers_1, 3); } + static { this["field2"] = (__runInitializers(this, _static_field1_extraInitializers), __runInitializers(this, _static_member_initializers, 2)); } + static { this[_a] = (__runInitializers(this, _static_member_extraInitializers), __runInitializers(this, _static_member_initializers_1, 3)); } + static { + __runInitializers(this, _static_member_extraInitializers_1); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js index 51c678a8ff594..f44410851e42f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js @@ -16,24 +16,28 @@ class C { const field3 = "field3"; let C = (() => { var _a; - let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; + let _static_field1_extraInitializers = []; let _static_member_decorators; let _static_member_initializers = []; + let _static_member_extraInitializers = []; let _static_member_decorators_1; let _static_member_initializers_1 = []; + let _static_member_extraInitializers_1 = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _static_field1_extraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers_1, _static_member_extraInitializers_1); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(this, _staticExtraInitializers); } static field1 = __runInitializers(this, _static_field1_initializers, 1); - static ["field2"] = __runInitializers(this, _static_member_initializers, 2); - static [(_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3))] = __runInitializers(this, _static_member_initializers_1, 3); + static ["field2"] = (__runInitializers(this, _static_field1_extraInitializers), __runInitializers(this, _static_member_initializers, 2)); + static [(_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3))] = (__runInitializers(this, _static_member_extraInitializers), __runInitializers(this, _static_member_initializers_1, 3)); + static { + __runInitializers(this, _static_member_extraInitializers_1); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js index 834de06b274e8..d040c944fa38d 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js @@ -18,13 +18,15 @@ var field3 = "field3"; var C = function () { var _a; var _b; - var _staticExtraInitializers = []; var _static_field1_decorators; var _static_field1_initializers = []; + var _static_field1_extraInitializers = []; var _static_member_decorators; var _static_member_initializers = []; + var _static_member_extraInitializers = []; var _static_member_decorators_1; var _static_member_initializers_1 = []; + var _static_member_extraInitializers_1 = []; return _a = /** @class */ (function () { function C() { } @@ -36,14 +38,16 @@ var C = function () { _b = __propKey(field3), (function () { var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: function (obj) { return "field1" in obj; }, get: function (obj) { return obj.field1; }, set: function (obj, value) { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: function (obj) { return "field2" in obj; }, get: function (obj) { return obj["field2"]; }, set: function (obj, value) { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { has: function (obj) { return _b in obj; }, get: function (obj) { return obj[_b]; }, set: function (obj, value) { obj[_b] = value; } }, metadata: _metadata }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: function (obj) { return "field1" in obj; }, get: function (obj) { return obj.field1; }, set: function (obj, value) { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _static_field1_extraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: function (obj) { return "field2" in obj; }, get: function (obj) { return obj["field2"]; }, set: function (obj, value) { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { has: function (obj) { return _b in obj; }, get: function (obj) { return obj[_b]; }, set: function (obj, value) { obj[_b] = value; } }, metadata: _metadata }, _static_member_initializers_1, _static_member_extraInitializers_1); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_a, _staticExtraInitializers); })(), _a.field1 = __runInitializers(_a, _static_field1_initializers, 1), - _a["field2"] = __runInitializers(_a, _static_member_initializers, 2), - _a[_b] = __runInitializers(_a, _static_member_initializers_1, 3), + _a["field2"] = (__runInitializers(_a, _static_field1_extraInitializers), __runInitializers(_a, _static_member_initializers, 2)), + _a[_b] = (__runInitializers(_a, _static_member_extraInitializers), __runInitializers(_a, _static_member_initializers_1, 3)), + (function () { + __runInitializers(_a, _static_member_extraInitializers_1); + })(), _a; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js index b2765d6b5706a..dba3f2851a151 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js @@ -18,13 +18,15 @@ var field3 = "field3"; var C = function () { var _a; var _b; - var _staticExtraInitializers = []; var _static_field1_decorators; var _static_field1_initializers = []; + var _static_field1_extraInitializers = []; var _static_member_decorators; var _static_member_initializers = []; + var _static_member_extraInitializers = []; var _static_member_decorators_1; var _static_member_initializers_1 = []; + var _static_member_extraInitializers_1 = []; return _a = /** @class */ (function () { function C() { } @@ -36,11 +38,10 @@ var C = function () { _b = __propKey(field3), (function () { var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: function (obj) { return "field1" in obj; }, get: function (obj) { return obj.field1; }, set: function (obj, value) { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: function (obj) { return "field2" in obj; }, get: function (obj) { return obj["field2"]; }, set: function (obj, value) { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { has: function (obj) { return _b in obj; }, get: function (obj) { return obj[_b]; }, set: function (obj, value) { obj[_b] = value; } }, metadata: _metadata }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: function (obj) { return "field1" in obj; }, get: function (obj) { return obj.field1; }, set: function (obj, value) { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _static_field1_extraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: function (obj) { return "field2" in obj; }, get: function (obj) { return obj["field2"]; }, set: function (obj, value) { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { has: function (obj) { return _b in obj; }, get: function (obj) { return obj[_b]; }, set: function (obj, value) { obj[_b] = value; } }, metadata: _metadata }, _static_member_initializers_1, _static_member_extraInitializers_1); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_a, _staticExtraInitializers); })(), Object.defineProperty(_a, "field1", { enumerable: true, @@ -52,13 +53,16 @@ var C = function () { enumerable: true, configurable: true, writable: true, - value: __runInitializers(_a, _static_member_initializers, 2) + value: (__runInitializers(_a, _static_field1_extraInitializers), __runInitializers(_a, _static_member_initializers, 2)) }), Object.defineProperty(_a, _b, { enumerable: true, configurable: true, writable: true, - value: __runInitializers(_a, _static_member_initializers_1, 3) + value: (__runInitializers(_a, _static_member_extraInitializers), __runInitializers(_a, _static_member_initializers_1, 3)) }), + (function () { + __runInitializers(_a, _static_member_extraInitializers_1); + })(), _a; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js index 3a2c6e945361d..f57f24768729a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js @@ -16,25 +16,29 @@ class C { const field3 = "field3"; let C = (() => { var _a; - let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; + let _static_field1_extraInitializers = []; let _static_member_decorators; let _static_member_initializers = []; + let _static_member_extraInitializers = []; let _static_member_decorators_1; let _static_member_initializers_1 = []; + let _static_member_extraInitializers_1 = []; return class C { static { _static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _static_field1_extraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers_1, _static_member_extraInitializers_1); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(this, _staticExtraInitializers); } static { this.field1 = __runInitializers(this, _static_field1_initializers, 1); } - static { this["field2"] = __runInitializers(this, _static_member_initializers, 2); } - static { this[_a] = __runInitializers(this, _static_member_initializers_1, 3); } + static { this["field2"] = (__runInitializers(this, _static_field1_extraInitializers), __runInitializers(this, _static_member_initializers, 2)); } + static { this[_a] = (__runInitializers(this, _static_member_extraInitializers), __runInitializers(this, _static_member_initializers_1, 3)); } + static { + __runInitializers(this, _static_member_extraInitializers_1); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js index d2713fbf59fcc..5af39781a986d 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js @@ -25,13 +25,15 @@ const field3 = "field3"; let C = (() => { var _a, _C_field1_accessor_storage, _C__a_accessor_storage, _C__b_accessor_storage; var _b; - let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; + let _static_field1_extraInitializers = []; let _static_member_decorators; let _static_member_initializers = []; + let _static_member_extraInitializers = []; let _static_member_decorators_1; let _static_member_initializers_1 = []; + let _static_member_extraInitializers_1 = []; return _a = class C { static get field1() { return __classPrivateFieldGet(_a, _a, "f", _C_field1_accessor_storage); } static set field1(value) { __classPrivateFieldSet(_a, _a, value, "f", _C_field1_accessor_storage); } @@ -42,15 +44,17 @@ let C = (() => { }, (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(_a, null, _static_field1_decorators, { kind: "accessor", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(_a, null, _static_member_decorators, { kind: "accessor", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(_a, null, _static_member_decorators_1, { kind: "accessor", name: _b, static: true, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(_a, null, _static_field1_decorators, { kind: "accessor", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _static_field1_extraInitializers); + __esDecorate(_a, null, _static_member_decorators, { kind: "accessor", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); + __esDecorate(_a, null, _static_member_decorators_1, { kind: "accessor", name: _b, static: true, private: false, access: { has: obj => _b in obj, get: obj => obj[_b], set: (obj, value) => { obj[_b] = value; } }, metadata: _metadata }, _static_member_initializers_1, _static_member_extraInitializers_1); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_a, _staticExtraInitializers); })(), _C_field1_accessor_storage = { value: __runInitializers(_a, _static_field1_initializers, 1) }, - _C__a_accessor_storage = { value: __runInitializers(_a, _static_member_initializers, 2) }, - _C__b_accessor_storage = { value: __runInitializers(_a, _static_member_initializers_1, 3) }, + _C__a_accessor_storage = { value: (__runInitializers(_a, _static_field1_extraInitializers), __runInitializers(_a, _static_member_initializers, 2)) }, + _C__b_accessor_storage = { value: (__runInitializers(_a, _static_member_extraInitializers), __runInitializers(_a, _static_member_initializers_1, 3)) }, + (() => { + __runInitializers(_a, _static_member_extraInitializers_1); + })(), _a; })(); let D = (() => { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js index 12a84fd016301..7c2a8f23f0aa4 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js @@ -24,31 +24,35 @@ class D { const field3 = "field3"; let C = (() => { var _a; - let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; + let _static_field1_extraInitializers = []; let _static_member_decorators; let _static_member_initializers = []; + let _static_member_extraInitializers = []; let _static_member_decorators_1; let _static_member_initializers_1 = []; + let _static_member_extraInitializers_1 = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(this, null, _static_field1_decorators, { kind: "accessor", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(this, null, _static_member_decorators, { kind: "accessor", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(this, null, _static_member_decorators_1, { kind: "accessor", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(this, null, _static_field1_decorators, { kind: "accessor", name: "field1", static: true, private: false, access: { has: obj => "field1" in obj, get: obj => obj.field1, set: (obj, value) => { obj.field1 = value; } }, metadata: _metadata }, _static_field1_initializers, _static_field1_extraInitializers); + __esDecorate(this, null, _static_member_decorators, { kind: "accessor", name: "field2", static: true, private: false, access: { has: obj => "field2" in obj, get: obj => obj["field2"], set: (obj, value) => { obj["field2"] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); + __esDecorate(this, null, _static_member_decorators_1, { kind: "accessor", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers_1, _static_member_extraInitializers_1); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(this, _staticExtraInitializers); } static #field1_accessor_storage = __runInitializers(this, _static_field1_initializers, 1); static get field1() { return C.#field1_accessor_storage; } static set field1(value) { C.#field1_accessor_storage = value; } - static #_a_accessor_storage = __runInitializers(this, _static_member_initializers, 2); + static #_a_accessor_storage = (__runInitializers(this, _static_field1_extraInitializers), __runInitializers(this, _static_member_initializers, 2)); static get ["field2"]() { return C.#_a_accessor_storage; } static set ["field2"](value) { C.#_a_accessor_storage = value; } - static #_b_accessor_storage = __runInitializers(this, _static_member_initializers_1, 3); + static #_b_accessor_storage = (__runInitializers(this, _static_member_extraInitializers), __runInitializers(this, _static_member_initializers_1, 3)); static get [(_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3))]() { return C.#_b_accessor_storage; } static set [_a](value) { C.#_b_accessor_storage = value; } + static { + __runInitializers(this, _static_member_extraInitializers_1); + } }; })(); let D = (() => { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js index ef4c8e15a370e..3d0ade65e6ca7 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js @@ -20,19 +20,21 @@ class D { //// [esDecorators-classDeclaration-fields-staticPrivate.js] let C = (() => { var _a, _C_field1; - let _staticExtraInitializers = []; let _static_private_field1_decorators; let _static_private_field1_initializers = []; + let _static_private_field1_extraInitializers = []; return _a = class C { }, (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _static_private_field1_decorators = [dec]; - __esDecorate(null, null, _static_private_field1_decorators, { kind: "field", name: "#field1", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_a, obj), get: obj => __classPrivateFieldGet(obj, _a, "f", _C_field1), set: (obj, value) => { __classPrivateFieldSet(obj, _a, value, "f", _C_field1); } }, metadata: _metadata }, _static_private_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_private_field1_decorators, { kind: "field", name: "#field1", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_a, obj), get: obj => __classPrivateFieldGet(obj, _a, "f", _C_field1), set: (obj, value) => { __classPrivateFieldSet(obj, _a, value, "f", _C_field1); } }, metadata: _metadata }, _static_private_field1_initializers, _static_private_field1_extraInitializers); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_a, _staticExtraInitializers); })(), _C_field1 = { value: __runInitializers(_a, _static_private_field1_initializers, 0) }, + (() => { + __runInitializers(_a, _static_private_field1_extraInitializers); + })(), _a; })(); let D = (() => { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js index a16685c6c6088..0c970446b57d2 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js @@ -19,18 +19,20 @@ class D { //// [esDecorators-classDeclaration-fields-staticPrivate.js] let C = (() => { - let _staticExtraInitializers = []; let _static_private_field1_decorators; let _static_private_field1_initializers = []; + let _static_private_field1_extraInitializers = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _static_private_field1_decorators = [dec]; - __esDecorate(null, null, _static_private_field1_decorators, { kind: "field", name: "#field1", static: true, private: true, access: { has: obj => #field1 in obj, get: obj => obj.#field1, set: (obj, value) => { obj.#field1 = value; } }, metadata: _metadata }, _static_private_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_private_field1_decorators, { kind: "field", name: "#field1", static: true, private: true, access: { has: obj => #field1 in obj, get: obj => obj.#field1, set: (obj, value) => { obj.#field1 = value; } }, metadata: _metadata }, _static_private_field1_initializers, _static_private_field1_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(this, _staticExtraInitializers); } static #field1 = __runInitializers(this, _static_private_field1_initializers, 0); + static { + __runInitializers(this, _static_private_field1_extraInitializers); + } }; })(); let D = (() => { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js index da8fde6263e24..6ef8dd57ac4b3 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js @@ -20,9 +20,9 @@ class D { //// [esDecorators-classDeclaration-fields-staticPrivateAccessor.js] let C = (() => { var _a, _C_field1_accessor_storage, _C_field1_get, _C_field1_set; - let _staticExtraInitializers = []; let _static_private_field1_decorators; let _static_private_field1_initializers = []; + let _static_private_field1_extraInitializers = []; let _static_private_field1_descriptor; return _a = class C { }, @@ -31,11 +31,13 @@ let C = (() => { (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _static_private_field1_decorators = [dec]; - __esDecorate(_a, _static_private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_a, _a, "f", _C_field1_accessor_storage); }, "#field1", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_a, _a, value, "f", _C_field1_accessor_storage); }, "#field1", "set") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_a, obj), get: obj => __classPrivateFieldGet(obj, _a, "a", _C_field1_get), set: (obj, value) => { __classPrivateFieldSet(obj, _a, value, "a", _C_field1_set); } }, metadata: _metadata }, _static_private_field1_initializers, _staticExtraInitializers); + __esDecorate(_a, _static_private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_a, _a, "f", _C_field1_accessor_storage); }, "#field1", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_a, _a, value, "f", _C_field1_accessor_storage); }, "#field1", "set") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_a, obj), get: obj => __classPrivateFieldGet(obj, _a, "a", _C_field1_get), set: (obj, value) => { __classPrivateFieldSet(obj, _a, value, "a", _C_field1_set); } }, metadata: _metadata }, _static_private_field1_initializers, _static_private_field1_extraInitializers); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_a, _staticExtraInitializers); })(), _C_field1_accessor_storage = { value: __runInitializers(_a, _static_private_field1_initializers, 0) }, + (() => { + __runInitializers(_a, _static_private_field1_extraInitializers); + })(), _a; })(); let D = (() => { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js index 10b10964e1160..87534a6392bd0 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js @@ -19,21 +19,23 @@ class D { //// [esDecorators-classDeclaration-fields-staticPrivateAccessor.js] let C = (() => { - let _staticExtraInitializers = []; let _static_private_field1_decorators; let _static_private_field1_initializers = []; + let _static_private_field1_extraInitializers = []; let _static_private_field1_descriptor; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _static_private_field1_decorators = [dec]; - __esDecorate(this, _static_private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1", "get"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1", "set") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { has: obj => #field1 in obj, get: obj => obj.#field1, set: (obj, value) => { obj.#field1 = value; } }, metadata: _metadata }, _static_private_field1_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1", "get"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1", "set") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { has: obj => #field1 in obj, get: obj => obj.#field1, set: (obj, value) => { obj.#field1 = value; } }, metadata: _metadata }, _static_private_field1_initializers, _static_private_field1_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(this, _staticExtraInitializers); } static #field1_accessor_storage = __runInitializers(this, _static_private_field1_initializers, 0); static get #field1() { return _static_private_field1_descriptor.get.call(this); } static set #field1(value) { return _static_private_field1_descriptor.set.call(this, value); } + static { + __runInitializers(this, _static_private_field1_extraInitializers); + } }; })(); let D = (() => { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js index 06a8bd7717dd3..6264553c0a16f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js @@ -20,19 +20,22 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); // needs: __esDecorate, __runInitializers, __setFunctionName let C = (() => { - let _instanceExtraInitializers = []; let _private_x_decorators; let _private_x_initializers = []; + let _private_x_extraInitializers = []; let _private_x_descriptor; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _private_x_decorators = [dec]; - tslib_1.__esDecorate(this, _private_x_descriptor = { get: tslib_1.__setFunctionName(function () { return this.#x_accessor_storage; }, "#x", "get"), set: tslib_1.__setFunctionName(function (value) { this.#x_accessor_storage = value; }, "#x", "set") }, _private_x_decorators, { kind: "accessor", name: "#x", static: false, private: true, access: { has: obj => #x in obj, get: obj => obj.#x, set: (obj, value) => { obj.#x = value; } }, metadata: _metadata }, _private_x_initializers, _instanceExtraInitializers); + tslib_1.__esDecorate(this, _private_x_descriptor = { get: tslib_1.__setFunctionName(function () { return this.#x_accessor_storage; }, "#x", "get"), set: tslib_1.__setFunctionName(function (value) { this.#x_accessor_storage = value; }, "#x", "set") }, _private_x_decorators, { kind: "accessor", name: "#x", static: false, private: true, access: { has: obj => #x in obj, get: obj => obj.#x, set: (obj, value) => { obj.#x = value; } }, metadata: _metadata }, _private_x_initializers, _private_x_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - #x_accessor_storage = (tslib_1.__runInitializers(this, _instanceExtraInitializers), tslib_1.__runInitializers(this, _private_x_initializers, void 0)); + #x_accessor_storage = tslib_1.__runInitializers(this, _private_x_initializers, void 0); get #x() { return _private_x_descriptor.get.call(this); } set #x(value) { return _private_x_descriptor.set.call(this, value); } + constructor() { + tslib_1.__runInitializers(this, _private_x_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js index 5563ce1d5d58e..21922ff1f5830 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js @@ -20,16 +20,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); // needs: __esDecorate, __runInitializers let C = (() => { - let _instanceExtraInitializers = []; let _private_x_decorators; let _private_x_initializers = []; + let _private_x_extraInitializers = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _private_x_decorators = [dec]; - tslib_1.__esDecorate(null, null, _private_x_decorators, { kind: "field", name: "#x", static: false, private: true, access: { has: obj => #x in obj, get: obj => obj.#x, set: (obj, value) => { obj.#x = value; } }, metadata: _metadata }, _private_x_initializers, _instanceExtraInitializers); + tslib_1.__esDecorate(null, null, _private_x_decorators, { kind: "field", name: "#x", static: false, private: true, access: { has: obj => #x in obj, get: obj => obj.#x, set: (obj, value) => { obj.#x = value; } }, metadata: _metadata }, _private_x_initializers, _private_x_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - #x = (tslib_1.__runInitializers(this, _instanceExtraInitializers), tslib_1.__runInitializers(this, _private_x_initializers, void 0)); + #x = tslib_1.__runInitializers(this, _private_x_initializers, void 0); + constructor() { + tslib_1.__runInitializers(this, _private_x_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js index 5178ab9627a4f..3412f0c6460cc 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js @@ -22,18 +22,20 @@ const tslib_1 = require("tslib"); // needs: __esDecorate, __runInitializers, __propKey let C = (() => { var _a; - let _staticExtraInitializers = []; let _static_member_decorators; let _static_member_initializers = []; + let _static_member_extraInitializers = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - tslib_1.__esDecorate(this, null, _static_member_decorators, { kind: "accessor", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); + tslib_1.__esDecorate(this, null, _static_member_decorators, { kind: "accessor", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - tslib_1.__runInitializers(this, _staticExtraInitializers); } static #_a_accessor_storage = tslib_1.__runInitializers(this, _static_member_initializers, void 0); static get [(_static_member_decorators = [dec], _a = tslib_1.__propKey(x))]() { return C.#_a_accessor_storage; } static set [_a](value) { C.#_a_accessor_storage = value; } + static { + tslib_1.__runInitializers(this, _static_member_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js index 4bbc49981eff7..e9f9b96f733fb 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js @@ -22,16 +22,18 @@ const tslib_1 = require("tslib"); // needs: __esDecorate, __runInitializers, __propKey let C = (() => { var _a; - let _staticExtraInitializers = []; let _static_member_decorators; let _static_member_initializers = []; + let _static_member_extraInitializers = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - tslib_1.__esDecorate(null, null, _static_member_decorators, { kind: "field", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers, _staticExtraInitializers); + tslib_1.__esDecorate(null, null, _static_member_decorators, { kind: "field", name: _a, static: true, private: false, access: { has: obj => _a in obj, get: obj => obj[_a], set: (obj, value) => { obj[_a] = value; } }, metadata: _metadata }, _static_member_initializers, _static_member_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - tslib_1.__runInitializers(this, _staticExtraInitializers); } static [(_static_member_decorators = [dec], _a = tslib_1.__propKey(x))] = tslib_1.__runInitializers(this, _static_member_initializers, void 0); + static { + tslib_1.__runInitializers(this, _static_member_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js index defb6b21926f4..502c188c1cfaf 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js @@ -20,20 +20,22 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); // needs: __esDecorate, __runInitializers, __setFunctionName let C = (() => { - let _staticExtraInitializers = []; let _static_private_x_decorators; let _static_private_x_initializers = []; + let _static_private_x_extraInitializers = []; let _static_private_x_descriptor; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _static_private_x_decorators = [dec]; - tslib_1.__esDecorate(this, _static_private_x_descriptor = { get: tslib_1.__setFunctionName(function () { return this.#x_accessor_storage; }, "#x", "get"), set: tslib_1.__setFunctionName(function (value) { this.#x_accessor_storage = value; }, "#x", "set") }, _static_private_x_decorators, { kind: "accessor", name: "#x", static: true, private: true, access: { has: obj => #x in obj, get: obj => obj.#x, set: (obj, value) => { obj.#x = value; } }, metadata: _metadata }, _static_private_x_initializers, _staticExtraInitializers); + tslib_1.__esDecorate(this, _static_private_x_descriptor = { get: tslib_1.__setFunctionName(function () { return this.#x_accessor_storage; }, "#x", "get"), set: tslib_1.__setFunctionName(function (value) { this.#x_accessor_storage = value; }, "#x", "set") }, _static_private_x_decorators, { kind: "accessor", name: "#x", static: true, private: true, access: { has: obj => #x in obj, get: obj => obj.#x, set: (obj, value) => { obj.#x = value; } }, metadata: _metadata }, _static_private_x_initializers, _static_private_x_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - tslib_1.__runInitializers(this, _staticExtraInitializers); } static #x_accessor_storage = tslib_1.__runInitializers(this, _static_private_x_initializers, void 0); static get #x() { return _static_private_x_descriptor.get.call(this); } static set #x(value) { return _static_private_x_descriptor.set.call(this, value); } + static { + tslib_1.__runInitializers(this, _static_private_x_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js index 7a88c47383c54..e4f24c5cb9c70 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js @@ -20,17 +20,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); // needs: __esDecorate, __runInitializers let C = (() => { - let _staticExtraInitializers = []; let _static_private_x_decorators; let _static_private_x_initializers = []; + let _static_private_x_extraInitializers = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _static_private_x_decorators = [dec]; - tslib_1.__esDecorate(null, null, _static_private_x_decorators, { kind: "field", name: "#x", static: true, private: true, access: { has: obj => #x in obj, get: obj => obj.#x, set: (obj, value) => { obj.#x = value; } }, metadata: _metadata }, _static_private_x_initializers, _staticExtraInitializers); + tslib_1.__esDecorate(null, null, _static_private_x_decorators, { kind: "field", name: "#x", static: true, private: true, access: { has: obj => #x in obj, get: obj => obj.#x, set: (obj, value) => { obj.#x = value; } }, metadata: _metadata }, _static_private_x_initializers, _static_private_x_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - tslib_1.__runInitializers(this, _staticExtraInitializers); } static #x = tslib_1.__runInitializers(this, _static_private_x_initializers, void 0); + static { + tslib_1.__runInitializers(this, _static_private_x_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js index 87c16a27a4364..8e411fe4bfe38 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js @@ -45,19 +45,20 @@ let A = (() => { let _classDescriptor; let _classExtraInitializers = []; let _classThis; - let _instanceExtraInitializers = []; let _b_decorators; let _b_initializers = []; + let _b_extraInitializers = []; var A = _classThis = class { constructor() { - this.b = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _b_initializers, 2)); + this.b = __runInitializers(this, _b_initializers, 2); + __runInitializers(this, _b_extraInitializers); } }; __setFunctionName(_classThis, "A"); (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _b_decorators = [dec(_outerThis)]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _b_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); A = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); @@ -73,16 +74,16 @@ let B = (() => { let _classDescriptor; let _classExtraInitializers = []; let _classThis; - let _instanceExtraInitializers = []; let _b_decorators; let _b_initializers = []; + let _b_extraInitializers = []; var B = _classThis = class { constructor() { // @ts-ignore - this[_a] = (__runInitializers(this, _instanceExtraInitializers), 1); + this[_a] = 1; this.b = __runInitializers(this, _b_initializers, 2); // @ts-ignore - this[_b] = 3; + this[_b] = (__runInitializers(this, _b_extraInitializers), 3); } }; _a = f(this); @@ -90,7 +91,7 @@ let B = (() => { __setFunctionName(_classThis, "B"); (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _b_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); B = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); @@ -107,13 +108,14 @@ let C = (() => { let _classDescriptor; let _classExtraInitializers = []; let _classThis; - let _instanceExtraInitializers = []; let _b_decorators; let _b_initializers = []; + let _b_extraInitializers = []; var C = _classThis = class { constructor() { - _C_a.set(this, (__runInitializers(this, _instanceExtraInitializers), 1)); + _C_a.set(this, 1); this.b = __runInitializers(this, _b_initializers, 2); + __runInitializers(this, _b_extraInitializers); } }; _C_a = new WeakMap(); @@ -121,7 +123,7 @@ let C = (() => { (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _b_decorators = [dec(_outerThis_1, (x) => __classPrivateFieldGet(x, _C_a, "f"))]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _b_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js index 87c16a27a4364..8e411fe4bfe38 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js @@ -45,19 +45,20 @@ let A = (() => { let _classDescriptor; let _classExtraInitializers = []; let _classThis; - let _instanceExtraInitializers = []; let _b_decorators; let _b_initializers = []; + let _b_extraInitializers = []; var A = _classThis = class { constructor() { - this.b = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _b_initializers, 2)); + this.b = __runInitializers(this, _b_initializers, 2); + __runInitializers(this, _b_extraInitializers); } }; __setFunctionName(_classThis, "A"); (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _b_decorators = [dec(_outerThis)]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _b_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); A = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); @@ -73,16 +74,16 @@ let B = (() => { let _classDescriptor; let _classExtraInitializers = []; let _classThis; - let _instanceExtraInitializers = []; let _b_decorators; let _b_initializers = []; + let _b_extraInitializers = []; var B = _classThis = class { constructor() { // @ts-ignore - this[_a] = (__runInitializers(this, _instanceExtraInitializers), 1); + this[_a] = 1; this.b = __runInitializers(this, _b_initializers, 2); // @ts-ignore - this[_b] = 3; + this[_b] = (__runInitializers(this, _b_extraInitializers), 3); } }; _a = f(this); @@ -90,7 +91,7 @@ let B = (() => { __setFunctionName(_classThis, "B"); (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _b_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); B = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); @@ -107,13 +108,14 @@ let C = (() => { let _classDescriptor; let _classExtraInitializers = []; let _classThis; - let _instanceExtraInitializers = []; let _b_decorators; let _b_initializers = []; + let _b_extraInitializers = []; var C = _classThis = class { constructor() { - _C_a.set(this, (__runInitializers(this, _instanceExtraInitializers), 1)); + _C_a.set(this, 1); this.b = __runInitializers(this, _b_initializers, 2); + __runInitializers(this, _b_extraInitializers); } }; _C_a = new WeakMap(); @@ -121,7 +123,7 @@ let C = (() => { (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _b_decorators = [dec(_outerThis_1, (x) => __classPrivateFieldGet(x, _C_a, "f"))]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _b_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js index 764b7d3afcd06..d1ce061b8adad 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js @@ -45,21 +45,24 @@ let A = (() => { let _classDescriptor; let _classExtraInitializers = []; let _classThis; - let _instanceExtraInitializers = []; let _b_decorators; let _b_initializers = []; + let _b_extraInitializers = []; var A = class { static { _classThis = this; } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _b_decorators = [dec(_outerThis)]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _b_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); A = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); __runInitializers(_classThis, _classExtraInitializers); } - b = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _b_initializers, 2)); + b = __runInitializers(this, _b_initializers, 2); + constructor() { + __runInitializers(this, _b_extraInitializers); + } }; return A = _classThis; })(); @@ -70,24 +73,24 @@ let B = (() => { let _classDescriptor; let _classExtraInitializers = []; let _classThis; - let _instanceExtraInitializers = []; let _b_decorators; let _b_initializers = []; + let _b_extraInitializers = []; var B = class { static { _classThis = this; } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _b_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); B = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); __runInitializers(_classThis, _classExtraInitializers); } // @ts-ignore - [f(this)] = (__runInitializers(this, _instanceExtraInitializers), 1); + [f(this)] = 1; b = __runInitializers(this, _b_initializers, 2); // @ts-ignore - [(_b_decorators = [dec(this)], f(this))] = 3; + [(_b_decorators = [dec(this)], f(this))] = (__runInitializers(this, _b_extraInitializers), 3); }; return B = _classThis; })(); @@ -99,22 +102,25 @@ let C = (() => { let _classDescriptor; let _classExtraInitializers = []; let _classThis; - let _instanceExtraInitializers = []; let _b_decorators; let _b_initializers = []; + let _b_extraInitializers = []; var C = class { static { _classThis = this; } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _b_decorators = [dec(_outerThis_1, (x) => x.#a)]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { has: obj => "b" in obj, get: obj => obj.b, set: (obj, value) => { obj.b = value; } }, metadata: _metadata }, _b_initializers, _b_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); __runInitializers(_classThis, _classExtraInitializers); } - #a = (__runInitializers(this, _instanceExtraInitializers), 1); + #a = 1; b = __runInitializers(this, _b_initializers, 2); + constructor() { + __runInitializers(this, _b_extraInitializers); + } }; return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js index 17d39a63a018b..00424b7929ed6 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js @@ -22,7 +22,7 @@ let C = (() => { __esDecorate(this, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { has: obj => "speak" in obj, get: obj => obj.speak }, metadata: _metadata }, null, _instanceExtraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - message = (__runInitializers(this, _instanceExtraInitializers), void 0); + message = __runInitializers(this, _instanceExtraInitializers); constructor(message) { this.message = message; } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js index e5fbe0ee1a2a0..c5df07be4f1e6 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js @@ -49,6 +49,13 @@ class C { //// [esDecorators-classDeclaration-sourceMap.js] +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -76,13 +83,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; -var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); @@ -118,26 +118,31 @@ let C = (() => { let _static_private_set_x_descriptor; let _static_private_y_decorators; let _static_private_y_initializers = []; + let _static_private_y_extraInitializers = []; let _static_private_z_decorators; let _static_private_z_initializers = []; + let _static_private_z_extraInitializers = []; let _static_private_z_descriptor; let _method_decorators; let _get_x_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; let _z_decorators; let _z_initializers = []; + let _z_extraInitializers = []; var C = _classThis = class { - constructor() { - this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - _C_z_1_accessor_storage.set(this, __runInitializers(this, _z_initializers, 1)); - } method() { } get x() { return 1; } set x(value) { } get z() { return __classPrivateFieldGet(this, _C_z_1_accessor_storage, "f"); } set z(value) { __classPrivateFieldSet(this, _C_z_1_accessor_storage, value, "f"); } + constructor() { + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + _C_z_1_accessor_storage.set(this, (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1))); + __runInitializers(this, _z_extraInitializers); + } }; _C_z_1_accessor_storage = new WeakMap(); _C_method_get = function _C_method_get() { return _static_private_method_descriptor.value; }; @@ -161,21 +166,21 @@ let C = (() => { __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_method_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_x_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_x_set); } }, metadata: _metadata }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _static_private_z_extraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, get: obj => obj.x }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _z_extraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _static_private_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); })(); - _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; - _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }; + _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }; (() => { + __runInitializers(_classThis, _static_private_z_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); })(); return C = _classThis; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map index 7b84bdd3a4b8d..2d62dd58cc05b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map @@ -1,6 +1,6 @@ //// [esDecorators-classDeclaration-sourceMap.js.map] -{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;YAgBA,MAAC,kGAAG,CAAC,GAAC;YAIG,2EAAI,CAAC,GAAC;QAqBnB,CAAC;QArCG,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAQxB,IAAS,CAAC,yEAAK;QAAf,IAAS,CAAC,8EAAK;;;;;;;;;;;8BAlBd,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;6CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;QAfJ,+DAAA,yBAAA,cAAkB,CAAC,YAAA,uSAAA;QAInB,8DAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,4RAAA;QAI7B,8DAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,iTAAA;QAQhC,0DAAA,uBAAA,kGAAuB,cAAA,EAAvB,uBAAA,uGAAuB,cAAA,6YAAA;QApCvB,2KAAA,MAAM,6DAAK;QAIX,gKAAI,CAAC,6DAAgB;QAIrB,2KAAI,CAAC,wEAAmB;QAQxB,8JAAS,CAAC,6BAAD,CAAC,mFAAK;QAgBf,uZAAc;QApBd,qJAAA,CAAC,6BAAD,CAAC,mFAAK;QAfV,6KAwCC;;;QAxCK,wDAAC;;IAmCI,8EAAK,CAAC,GAAJ,CAAK;IAIE,+FAAK,CAAC,GAAJ,CAAK;;QAvCrB,uDAAC"} -//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fZXNEZWNvcmF0ZSA9ICh0aGlzICYmIHRoaXMuX19lc0RlY29yYXRlKSB8fCBmdW5jdGlvbiAoY3RvciwgZGVzY3JpcHRvckluLCBkZWNvcmF0b3JzLCBjb250ZXh0SW4sIGluaXRpYWxpemVycywgZXh0cmFJbml0aWFsaXplcnMpIHsNCiAgICBmdW5jdGlvbiBhY2NlcHQoZikgeyBpZiAoZiAhPT0gdm9pZCAwICYmIHR5cGVvZiBmICE9PSAiZnVuY3Rpb24iKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJGdW5jdGlvbiBleHBlY3RlZCIpOyByZXR1cm4gZjsgfQ0KICAgIHZhciBraW5kID0gY29udGV4dEluLmtpbmQsIGtleSA9IGtpbmQgPT09ICJnZXR0ZXIiID8gImdldCIgOiBraW5kID09PSAic2V0dGVyIiA/ICJzZXQiIDogInZhbHVlIjsNCiAgICB2YXIgdGFyZ2V0ID0gIWRlc2NyaXB0b3JJbiAmJiBjdG9yID8gY29udGV4dEluWyJzdGF0aWMiXSA/IGN0b3IgOiBjdG9yLnByb3RvdHlwZSA6IG51bGw7DQogICAgdmFyIGRlc2NyaXB0b3IgPSBkZXNjcmlwdG9ySW4gfHwgKHRhcmdldCA/IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IodGFyZ2V0LCBjb250ZXh0SW4ubmFtZSkgOiB7fSk7DQogICAgdmFyIF8sIGRvbmUgPSBmYWxzZTsNCiAgICBmb3IgKHZhciBpID0gZGVjb3JhdG9ycy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkgew0KICAgICAgICB2YXIgY29udGV4dCA9IHt9Ow0KICAgICAgICBmb3IgKHZhciBwIGluIGNvbnRleHRJbikgY29udGV4dFtwXSA9IHAgPT09ICJhY2Nlc3MiID8ge30gOiBjb250ZXh0SW5bcF07DQogICAgICAgIGZvciAodmFyIHAgaW4gY29udGV4dEluLmFjY2VzcykgY29udGV4dC5hY2Nlc3NbcF0gPSBjb250ZXh0SW4uYWNjZXNzW3BdOw0KICAgICAgICBjb250ZXh0LmFkZEluaXRpYWxpemVyID0gZnVuY3Rpb24gKGYpIHsgaWYgKGRvbmUpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCBhZGQgaW5pdGlhbGl6ZXJzIGFmdGVyIGRlY29yYXRpb24gaGFzIGNvbXBsZXRlZCIpOyBleHRyYUluaXRpYWxpemVycy5wdXNoKGFjY2VwdChmIHx8IG51bGwpKTsgfTsNCiAgICAgICAgdmFyIHJlc3VsdCA9ICgwLCBkZWNvcmF0b3JzW2ldKShraW5kID09PSAiYWNjZXNzb3IiID8geyBnZXQ6IGRlc2NyaXB0b3IuZ2V0LCBzZXQ6IGRlc2NyaXB0b3Iuc2V0IH0gOiBkZXNjcmlwdG9yW2tleV0sIGNvbnRleHQpOw0KICAgICAgICBpZiAoa2luZCA9PT0gImFjY2Vzc29yIikgew0KICAgICAgICAgICAgaWYgKHJlc3VsdCA9PT0gdm9pZCAwKSBjb250aW51ZTsNCiAgICAgICAgICAgIGlmIChyZXN1bHQgPT09IG51bGwgfHwgdHlwZW9mIHJlc3VsdCAhPT0gIm9iamVjdCIpIHRocm93IG5ldyBUeXBlRXJyb3IoIk9iamVjdCBleHBlY3RlZCIpOw0KICAgICAgICAgICAgaWYgKF8gPSBhY2NlcHQocmVzdWx0LmdldCkpIGRlc2NyaXB0b3IuZ2V0ID0gXzsNCiAgICAgICAgICAgIGlmIChfID0gYWNjZXB0KHJlc3VsdC5zZXQpKSBkZXNjcmlwdG9yLnNldCA9IF87DQogICAgICAgICAgICBpZiAoXyA9IGFjY2VwdChyZXN1bHQuaW5pdCkpIGluaXRpYWxpemVycy51bnNoaWZ0KF8pOw0KICAgICAgICB9DQogICAgICAgIGVsc2UgaWYgKF8gPSBhY2NlcHQocmVzdWx0KSkgew0KICAgICAgICAgICAgaWYgKGtpbmQgPT09ICJmaWVsZCIpIGluaXRpYWxpemVycy51bnNoaWZ0KF8pOw0KICAgICAgICAgICAgZWxzZSBkZXNjcmlwdG9yW2tleV0gPSBfOw0KICAgICAgICB9DQogICAgfQ0KICAgIGlmICh0YXJnZXQpIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0YXJnZXQsIGNvbnRleHRJbi5uYW1lLCBkZXNjcmlwdG9yKTsNCiAgICBkb25lID0gdHJ1ZTsNCn07DQp2YXIgX19ydW5Jbml0aWFsaXplcnMgPSAodGhpcyAmJiB0aGlzLl9fcnVuSW5pdGlhbGl6ZXJzKSB8fCBmdW5jdGlvbiAodGhpc0FyZywgaW5pdGlhbGl6ZXJzLCB2YWx1ZSkgew0KICAgIHZhciB1c2VWYWx1ZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAyOw0KICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaW5pdGlhbGl6ZXJzLmxlbmd0aDsgaSsrKSB7DQogICAgICAgIHZhbHVlID0gdXNlVmFsdWUgPyBpbml0aWFsaXplcnNbaV0uY2FsbCh0aGlzQXJnLCB2YWx1ZSkgOiBpbml0aWFsaXplcnNbaV0uY2FsbCh0aGlzQXJnKTsNCiAgICB9DQogICAgcmV0dXJuIHVzZVZhbHVlID8gdmFsdWUgOiB2b2lkIDA7DQp9Ow0KdmFyIF9fc2V0RnVuY3Rpb25OYW1lID0gKHRoaXMgJiYgdGhpcy5fX3NldEZ1bmN0aW9uTmFtZSkgfHwgZnVuY3Rpb24gKGYsIG5hbWUsIHByZWZpeCkgew0KICAgIGlmICh0eXBlb2YgbmFtZSA9PT0gInN5bWJvbCIpIG5hbWUgPSBuYW1lLmRlc2NyaXB0aW9uID8gIlsiLmNvbmNhdChuYW1lLmRlc2NyaXB0aW9uLCAiXSIpIDogIiI7DQogICAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShmLCAibmFtZSIsIHsgY29uZmlndXJhYmxlOiB0cnVlLCB2YWx1ZTogcHJlZml4ID8gIiIuY29uY2F0KHByZWZpeCwgIiAiLCBuYW1lKSA6IG5hbWUgfSk7DQp9Ow0KdmFyIF9fY2xhc3NQcml2YXRlRmllbGRHZXQgPSAodGhpcyAmJiB0aGlzLl9fY2xhc3NQcml2YXRlRmllbGRHZXQpIHx8IGZ1bmN0aW9uIChyZWNlaXZlciwgc3RhdGUsIGtpbmQsIGYpIHsNCiAgICBpZiAoa2luZCA9PT0gImEiICYmICFmKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIGFjY2Vzc29yIHdhcyBkZWZpbmVkIHdpdGhvdXQgYSBnZXR0ZXIiKTsNCiAgICBpZiAodHlwZW9mIHN0YXRlID09PSAiZnVuY3Rpb24iID8gcmVjZWl2ZXIgIT09IHN0YXRlIHx8ICFmIDogIXN0YXRlLmhhcyhyZWNlaXZlcikpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCByZWFkIHByaXZhdGUgbWVtYmVyIGZyb20gYW4gb2JqZWN0IHdob3NlIGNsYXNzIGRpZCBub3QgZGVjbGFyZSBpdCIpOw0KICAgIHJldHVybiBraW5kID09PSAibSIgPyBmIDoga2luZCA9PT0gImEiID8gZi5jYWxsKHJlY2VpdmVyKSA6IGYgPyBmLnZhbHVlIDogc3RhdGUuZ2V0KHJlY2VpdmVyKTsNCn07DQp2YXIgX19jbGFzc1ByaXZhdGVGaWVsZFNldCA9ICh0aGlzICYmIHRoaXMuX19jbGFzc1ByaXZhdGVGaWVsZFNldCkgfHwgZnVuY3Rpb24gKHJlY2VpdmVyLCBzdGF0ZSwgdmFsdWUsIGtpbmQsIGYpIHsNCiAgICBpZiAoa2luZCA9PT0gIm0iKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIG1ldGhvZCBpcyBub3Qgd3JpdGFibGUiKTsNCiAgICBpZiAoa2luZCA9PT0gImEiICYmICFmKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIGFjY2Vzc29yIHdhcyBkZWZpbmVkIHdpdGhvdXQgYSBzZXR0ZXIiKTsNCiAgICBpZiAodHlwZW9mIHN0YXRlID09PSAiZnVuY3Rpb24iID8gcmVjZWl2ZXIgIT09IHN0YXRlIHx8ICFmIDogIXN0YXRlLmhhcyhyZWNlaXZlcikpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCB3cml0ZSBwcml2YXRlIG1lbWJlciB0byBhbiBvYmplY3Qgd2hvc2UgY2xhc3MgZGlkIG5vdCBkZWNsYXJlIGl0Iik7DQogICAgcmV0dXJuIChraW5kID09PSAiYSIgPyBmLmNhbGwocmVjZWl2ZXIsIHZhbHVlKSA6IGYgPyBmLnZhbHVlID0gdmFsdWUgOiBzdGF0ZS5zZXQocmVjZWl2ZXIsIHZhbHVlKSksIHZhbHVlOw0KfTsNCnZhciBfX2NsYXNzUHJpdmF0ZUZpZWxkSW4gPSAodGhpcyAmJiB0aGlzLl9fY2xhc3NQcml2YXRlRmllbGRJbikgfHwgZnVuY3Rpb24oc3RhdGUsIHJlY2VpdmVyKSB7DQogICAgaWYgKHJlY2VpdmVyID09PSBudWxsIHx8ICh0eXBlb2YgcmVjZWl2ZXIgIT09ICJvYmplY3QiICYmIHR5cGVvZiByZWNlaXZlciAhPT0gImZ1bmN0aW9uIikpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCB1c2UgJ2luJyBvcGVyYXRvciBvbiBub24tb2JqZWN0Iik7DQogICAgcmV0dXJuIHR5cGVvZiBzdGF0ZSA9PT0gImZ1bmN0aW9uIiA/IHJlY2VpdmVyID09PSBzdGF0ZSA6IHN0YXRlLmhhcyhyZWNlaXZlcik7DQp9Ow0KbGV0IEMgPSAoKCkgPT4gew0KICAgIHZhciBfQ19tZXRob2RfZ2V0LCBfQ194X2dldCwgX0NfeF9zZXQsIF9DX3ksIF9DX3pfYWNjZXNzb3Jfc3RvcmFnZSwgX0Nfel9nZXQsIF9DX3pfc2V0LCBfQ196XzFfYWNjZXNzb3Jfc3RvcmFnZTsNCiAgICBsZXQgX2NsYXNzRGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgbGV0IF9jbGFzc0Rlc2NyaXB0b3I7DQogICAgbGV0IF9jbGFzc0V4dHJhSW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9jbGFzc1RoaXM7DQogICAgbGV0IF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfbWV0aG9kX2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVzY3JpcHRvcjsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX2dldF94X2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9nZXRfeF9kZXNjcmlwdG9yOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVjb3JhdG9yczsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3NldF94X2Rlc2NyaXB0b3I7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV95X2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV95X2luaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfel9kZWNvcmF0b3JzOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfel9pbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3pfZGVzY3JpcHRvcjsNCiAgICBsZXQgX21ldGhvZF9kZWNvcmF0b3JzOw0KICAgIGxldCBfZ2V0X3hfZGVjb3JhdG9yczsNCiAgICBsZXQgX3NldF94X2RlY29yYXRvcnM7DQogICAgbGV0IF95X2RlY29yYXRvcnM7DQogICAgbGV0IF95X2luaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfel9kZWNvcmF0b3JzOw0KICAgIGxldCBfel9pbml0aWFsaXplcnMgPSBbXTsNCiAgICB2YXIgQyA9IF9jbGFzc1RoaXMgPSBjbGFzcyB7DQogICAgICAgIGNvbnN0cnVjdG9yKCkgew0KICAgICAgICAgICAgdGhpcy55ID0gKF9fcnVuSW5pdGlhbGl6ZXJzKHRoaXMsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKSwgX19ydW5Jbml0aWFsaXplcnModGhpcywgX3lfaW5pdGlhbGl6ZXJzLCAxKSk7DQogICAgICAgICAgICBfQ196XzFfYWNjZXNzb3Jfc3RvcmFnZS5zZXQodGhpcywgX19ydW5Jbml0aWFsaXplcnModGhpcywgX3pfaW5pdGlhbGl6ZXJzLCAxKSk7DQogICAgICAgIH0NCiAgICAgICAgbWV0aG9kKCkgeyB9DQogICAgICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQ0KICAgICAgICBzZXQgeCh2YWx1ZSkgeyB9DQogICAgICAgIGdldCB6KCkgeyByZXR1cm4gX19jbGFzc1ByaXZhdGVGaWVsZEdldCh0aGlzLCBfQ196XzFfYWNjZXNzb3Jfc3RvcmFnZSwgImYiKTsgfQ0KICAgICAgICBzZXQgeih2YWx1ZSkgeyBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0KHRoaXMsIF9DX3pfMV9hY2Nlc3Nvcl9zdG9yYWdlLCB2YWx1ZSwgImYiKTsgfQ0KICAgIH07DQogICAgX0Nfel8xX2FjY2Vzc29yX3N0b3JhZ2UgPSBuZXcgV2Vha01hcCgpOw0KICAgIF9DX21ldGhvZF9nZXQgPSBmdW5jdGlvbiBfQ19tZXRob2RfZ2V0KCkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX21ldGhvZF9kZXNjcmlwdG9yLnZhbHVlOyB9Ow0KICAgIF9DX3hfZ2V0ID0gZnVuY3Rpb24gX0NfeF9nZXQoKSB7IHJldHVybiBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVzY3JpcHRvci5nZXQuY2FsbCh0aGlzKTsgfTsNCiAgICBfQ194X3NldCA9IGZ1bmN0aW9uIF9DX3hfc2V0KHZhbHVlKSB7IHJldHVybiBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVzY3JpcHRvci5zZXQuY2FsbCh0aGlzLCB2YWx1ZSk7IH07DQogICAgX0Nfel9nZXQgPSBmdW5jdGlvbiBfQ196X2dldCgpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3IuZ2V0LmNhbGwodGhpcyk7IH07DQogICAgX0Nfel9zZXQgPSBmdW5jdGlvbiBfQ196X3NldCh2YWx1ZSkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX3pfZGVzY3JpcHRvci5zZXQuY2FsbCh0aGlzLCB2YWx1ZSk7IH07DQogICAgX19zZXRGdW5jdGlvbk5hbWUoX2NsYXNzVGhpcywgIkMiKTsNCiAgICAoKCkgPT4gew0KICAgICAgICBjb25zdCBfbWV0YWRhdGEgPSB0eXBlb2YgU3ltYm9sID09PSAiZnVuY3Rpb24iICYmIFN5bWJvbC5tZXRhZGF0YSA/IE9iamVjdC5jcmVhdGUobnVsbCkgOiB2b2lkIDA7DQogICAgICAgIF9tZXRob2RfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9nZXRfeF9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgX3NldF94X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICBfeV9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgX3pfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9zdGF0aWNfcHJpdmF0ZV9nZXRfeF9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgX3N0YXRpY19wcml2YXRlX3NldF94X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICBfc3RhdGljX3ByaXZhdGVfeV9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgX3N0YXRpY19wcml2YXRlX3pfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9fZXNEZWNvcmF0ZShfY2xhc3NUaGlzLCBfc3RhdGljX3ByaXZhdGVfbWV0aG9kX2Rlc2NyaXB0b3IgPSB7IHZhbHVlOiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAoKSB7IH0sICIjbWV0aG9kIikgfSwgX3N0YXRpY19wcml2YXRlX21ldGhvZF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJtZXRob2QiLCBuYW1lOiAiI21ldGhvZCIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBnZXQ6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0KG9iaiwgX2NsYXNzVGhpcywgImEiLCBfQ19tZXRob2RfZ2V0KSB9LCBtZXRhZGF0YTogX21ldGFkYXRhIH0sIG51bGwsIF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fZXNEZWNvcmF0ZShfY2xhc3NUaGlzLCBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVzY3JpcHRvciA9IHsgZ2V0OiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAoKSB7IHJldHVybiAxOyB9LCAiI3giLCAiZ2V0IikgfSwgX3N0YXRpY19wcml2YXRlX2dldF94X2RlY29yYXRvcnMsIHsga2luZDogImdldHRlciIsIG5hbWU6ICIjeCIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBnZXQ6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0KG9iaiwgX2NsYXNzVGhpcywgImEiLCBfQ194X2dldCkgfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICBfX2VzRGVjb3JhdGUoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX3NldF94X2Rlc2NyaXB0b3IgPSB7IHNldDogX19zZXRGdW5jdGlvbk5hbWUoZnVuY3Rpb24gKHZhbHVlKSB7IH0sICIjeCIsICJzZXQiKSB9LCBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVjb3JhdG9ycywgeyBraW5kOiAic2V0dGVyIiwgbmFtZTogIiN4Iiwgc3RhdGljOiB0cnVlLCBwcml2YXRlOiB0cnVlLCBhY2Nlc3M6IHsgaGFzOiBvYmogPT4gX19jbGFzc1ByaXZhdGVGaWVsZEluKF9jbGFzc1RoaXMsIG9iaiksIHNldDogKG9iaiwgdmFsdWUpID0+IHsgX19jbGFzc1ByaXZhdGVGaWVsZFNldChvYmosIF9jbGFzc1RoaXMsIHZhbHVlLCAiYSIsIF9DX3hfc2V0KTsgfSB9LCBtZXRhZGF0YTogX21ldGFkYXRhIH0sIG51bGwsIF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fZXNEZWNvcmF0ZShfY2xhc3NUaGlzLCBfc3RhdGljX3ByaXZhdGVfel9kZXNjcmlwdG9yID0geyBnZXQ6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICgpIHsgcmV0dXJuIF9fY2xhc3NQcml2YXRlRmllbGRHZXQoX2NsYXNzVGhpcywgX2NsYXNzVGhpcywgImYiLCBfQ196X2FjY2Vzc29yX3N0b3JhZ2UpOyB9LCAiI3oiLCAiZ2V0IiksIHNldDogX19zZXRGdW5jdGlvbk5hbWUoZnVuY3Rpb24gKHZhbHVlKSB7IF9fY2xhc3NQcml2YXRlRmllbGRTZXQoX2NsYXNzVGhpcywgX2NsYXNzVGhpcywgdmFsdWUsICJmIiwgX0Nfel9hY2Nlc3Nvcl9zdG9yYWdlKTsgfSwgIiN6IiwgInNldCIpIH0sIF9zdGF0aWNfcHJpdmF0ZV96X2RlY29yYXRvcnMsIHsga2luZDogImFjY2Vzc29yIiwgbmFtZTogIiN6Iiwgc3RhdGljOiB0cnVlLCBwcml2YXRlOiB0cnVlLCBhY2Nlc3M6IHsgaGFzOiBvYmogPT4gX19jbGFzc1ByaXZhdGVGaWVsZEluKF9jbGFzc1RoaXMsIG9iaiksIGdldDogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRHZXQob2JqLCBfY2xhc3NUaGlzLCAiYSIsIF9DX3pfZ2V0KSwgc2V0OiAob2JqLCB2YWx1ZSkgPT4geyBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0KG9iaiwgX2NsYXNzVGhpcywgdmFsdWUsICJhIiwgX0Nfel9zZXQpOyB9IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgX3N0YXRpY19wcml2YXRlX3pfaW5pdGlhbGl6ZXJzLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICBfX2VzRGVjb3JhdGUoX2NsYXNzVGhpcywgbnVsbCwgX21ldGhvZF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJtZXRob2QiLCBuYW1lOiAibWV0aG9kIiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAibWV0aG9kIiBpbiBvYmosIGdldDogb2JqID0+IG9iai5tZXRob2QgfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fZXNEZWNvcmF0ZShfY2xhc3NUaGlzLCBudWxsLCBfZ2V0X3hfZGVjb3JhdG9ycywgeyBraW5kOiAiZ2V0dGVyIiwgbmFtZTogIngiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSwgYWNjZXNzOiB7IGhhczogb2JqID0+ICJ4IiBpbiBvYmosIGdldDogb2JqID0+IG9iai54IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgbnVsbCwgX2luc3RhbmNlRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICBfX2VzRGVjb3JhdGUoX2NsYXNzVGhpcywgbnVsbCwgX3NldF94X2RlY29yYXRvcnMsIHsga2luZDogInNldHRlciIsIG5hbWU6ICJ4Iiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAieCIgaW4gb2JqLCBzZXQ6IChvYmosIHZhbHVlKSA9PiB7IG9iai54ID0gdmFsdWU7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fZXNEZWNvcmF0ZShfY2xhc3NUaGlzLCBudWxsLCBfel9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJhY2Nlc3NvciIsIG5hbWU6ICJ6Iiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAieiIgaW4gb2JqLCBnZXQ6IG9iaiA9PiBvYmoueiwgc2V0OiAob2JqLCB2YWx1ZSkgPT4geyBvYmoueiA9IHZhbHVlOyB9IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgX3pfaW5pdGlhbGl6ZXJzLCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fZXNEZWNvcmF0ZShudWxsLCBudWxsLCBfc3RhdGljX3ByaXZhdGVfeV9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJmaWVsZCIsIG5hbWU6ICIjeSIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBnZXQ6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0KG9iaiwgX2NsYXNzVGhpcywgImYiLCBfQ195KSwgc2V0OiAob2JqLCB2YWx1ZSkgPT4geyBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0KG9iaiwgX2NsYXNzVGhpcywgdmFsdWUsICJmIiwgX0NfeSk7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBfc3RhdGljX3ByaXZhdGVfeV9pbml0aWFsaXplcnMsIF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fZXNEZWNvcmF0ZShudWxsLCBudWxsLCBfeV9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJmaWVsZCIsIG5hbWU6ICJ5Iiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAieSIgaW4gb2JqLCBnZXQ6IG9iaiA9PiBvYmoueSwgc2V0OiAob2JqLCB2YWx1ZSkgPT4geyBvYmoueSA9IHZhbHVlOyB9IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgX3lfaW5pdGlhbGl6ZXJzLCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fZXNEZWNvcmF0ZShudWxsLCBfY2xhc3NEZXNjcmlwdG9yID0geyB2YWx1ZTogX2NsYXNzVGhpcyB9LCBfY2xhc3NEZWNvcmF0b3JzLCB7IGtpbmQ6ICJjbGFzcyIsIG5hbWU6IF9jbGFzc1RoaXMubmFtZSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfY2xhc3NFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIEMgPSBfY2xhc3NUaGlzID0gX2NsYXNzRGVzY3JpcHRvci52YWx1ZTsNCiAgICAgICAgaWYgKF9tZXRhZGF0YSkgT2JqZWN0LmRlZmluZVByb3BlcnR5KF9jbGFzc1RoaXMsIFN5bWJvbC5tZXRhZGF0YSwgeyBlbnVtZXJhYmxlOiB0cnVlLCBjb25maWd1cmFibGU6IHRydWUsIHdyaXRhYmxlOiB0cnVlLCB2YWx1ZTogX21ldGFkYXRhIH0pOw0KICAgICAgICBfX3J1bkluaXRpYWxpemVycyhfY2xhc3NUaGlzLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgIH0pKCk7DQogICAgX0NfeSA9IHsgdmFsdWU6IF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9zdGF0aWNfcHJpdmF0ZV95X2luaXRpYWxpemVycywgMSkgfTsNCiAgICBfQ196X2FjY2Vzc29yX3N0b3JhZ2UgPSB7IHZhbHVlOiBfX3J1bkluaXRpYWxpemVycyhfY2xhc3NUaGlzLCBfc3RhdGljX3ByaXZhdGVfel9pbml0aWFsaXplcnMsIDEpIH07DQogICAgKCgpID0+IHsNCiAgICAgICAgX19ydW5Jbml0aWFsaXplcnMoX2NsYXNzVGhpcywgX2NsYXNzRXh0cmFJbml0aWFsaXplcnMpOw0KICAgIH0pKCk7DQogICAgcmV0dXJuIEMgPSBfY2xhc3NUaGlzOw0KfSkoKTsNCi8vIyBzb3VyY2VNYXBwaW5nVVJMPWVzRGVjb3JhdG9ycy1jbGFzc0RlY2xhcmF0aW9uLXNvdXJjZU1hcC5qcy5tYXA=,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0lBSU0sQ0FBQzs7NEJBRk4sR0FBRyxFQUNILEdBQUc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O1lBZ0JBLE1BQUMsa0dBQUcsQ0FBQyxHQUFDO1lBSUcsMkVBQUksQ0FBQyxHQUFDO1FBcUJuQixDQUFDO1FBckNHLE1BQU0sS0FBSSxDQUFDO1FBSVgsSUFBSSxDQUFDLEtBQUssT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBSXJCLElBQUksQ0FBQyxDQUFDLEtBQWEsSUFBSSxDQUFDO1FBUXhCLElBQVMsQ0FBQyx5RUFBSztRQUFmLElBQVMsQ0FBQyw4RUFBSzs7Ozs7Ozs7Ozs7OEJBbEJkLEdBQUcsRUFDSCxHQUFHOzZCQUdILEdBQUcsRUFDSCxHQUFHOzZCQUdILEdBQUcsRUFDSCxHQUFHO3lCQUdILEdBQUcsRUFDSCxHQUFHO3lCQUdILEdBQUcsRUFDSCxHQUFHOzZDQUdILEdBQUcsRUFDSCxHQUFHOzRDQUdILEdBQUcsRUFDSCxHQUFHOzRDQUdILEdBQUcsRUFDSCxHQUFHO3dDQUdILEdBQUcsRUFDSCxHQUFHO3dDQUdILEdBQUcsRUFDSCxHQUFHO1FBZkosK0RBQUEseUJBQUEsY0FBa0IsQ0FBQyxZQUFBLHVTQUFBO1FBSW5CLDhEQUFBLHVCQUFBLGNBQWtCLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxjQUFBLDRSQUFBO1FBSTdCLDhEQUFBLHVCQUFBLFVBQWMsS0FBYSxJQUFJLENBQUMsY0FBQSxpVEFBQTtRQVFoQywwREFBQSx1QkFBQSxrR0FBdUIsY0FBQSxFQUF2Qix1QkFBQSx1R0FBdUIsY0FBQSw2WUFBQTtRQXBDdkIsMktBQUEsTUFBTSw2REFBSztRQUlYLGdLQUFJLENBQUMsNkRBQWdCO1FBSXJCLDJLQUFJLENBQUMsd0VBQW1CO1FBUXhCLDhKQUFTLENBQUMsNkJBQUQsQ0FBQyxtRkFBSztRQWdCZix1WkFBYztRQXBCZCxxSkFBQSxDQUFDLDZCQUFELENBQUMsbUZBQUs7UUFmViw2S0F3Q0M7OztRQXhDSyx3REFBQzs7SUFtQ0ksOEVBQUssQ0FBQyxHQUFKLENBQUs7SUFJRSwrRkFBSyxDQUFDLEdBQUosQ0FBSzs7UUF2Q3JCLHVEQUFDIn0=,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7CgpAZGVjCkBkZWMKY2xhc3MgQyB7CiAgICBAZGVjCiAgICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAIA,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAQxB,IAAS,CAAC,yEAAK;QAAf,IAAS,CAAC,8EAAK;;YAJf,MAAC,IAfC,mDAAC,2CAeC,CAAC,GAAC;YAIG,2HAAI,CAAC,IAAC;;;;;;;;;;;;;8BAlBd,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;6CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;QAfJ,+DAAA,yBAAA,cAAkB,CAAC,YAAA,uSAAA;QAInB,8DAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,4RAAA;QAI7B,8DAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,iTAAA;QAQhC,0DAAA,uBAAA,kGAAuB,cAAA,EAAvB,uBAAA,uGAAuB,cAAA,wZAAA;QApCvB,2KAAA,MAAM,6DAAK;QAIX,gKAAI,CAAC,6DAAgB;QAIrB,2KAAI,CAAC,wEAAmB;QAQxB,8JAAS,CAAC,6BAAD,CAAC,6EAAK;QAgBf,kaAAc;QApBd,qJAAA,CAAC,6BAAD,CAAC,6EAAK;QAfV,6KAwCC;;;;IALU,iBAnCL,uDAAC,gEAmCS,CAAC,IAAJ,CAAK;IAIE,oKAAK,CAAC,IAAJ,CAAK;;;QAvCrB,uDAAC"} +//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fcnVuSW5pdGlhbGl6ZXJzID0gKHRoaXMgJiYgdGhpcy5fX3J1bkluaXRpYWxpemVycykgfHwgZnVuY3Rpb24gKHRoaXNBcmcsIGluaXRpYWxpemVycywgdmFsdWUpIHsNCiAgICB2YXIgdXNlVmFsdWUgPSBhcmd1bWVudHMubGVuZ3RoID4gMjsNCiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGluaXRpYWxpemVycy5sZW5ndGg7IGkrKykgew0KICAgICAgICB2YWx1ZSA9IHVzZVZhbHVlID8gaW5pdGlhbGl6ZXJzW2ldLmNhbGwodGhpc0FyZywgdmFsdWUpIDogaW5pdGlhbGl6ZXJzW2ldLmNhbGwodGhpc0FyZyk7DQogICAgfQ0KICAgIHJldHVybiB1c2VWYWx1ZSA/IHZhbHVlIDogdm9pZCAwOw0KfTsNCnZhciBfX2VzRGVjb3JhdGUgPSAodGhpcyAmJiB0aGlzLl9fZXNEZWNvcmF0ZSkgfHwgZnVuY3Rpb24gKGN0b3IsIGRlc2NyaXB0b3JJbiwgZGVjb3JhdG9ycywgY29udGV4dEluLCBpbml0aWFsaXplcnMsIGV4dHJhSW5pdGlhbGl6ZXJzKSB7DQogICAgZnVuY3Rpb24gYWNjZXB0KGYpIHsgaWYgKGYgIT09IHZvaWQgMCAmJiB0eXBlb2YgZiAhPT0gImZ1bmN0aW9uIikgdGhyb3cgbmV3IFR5cGVFcnJvcigiRnVuY3Rpb24gZXhwZWN0ZWQiKTsgcmV0dXJuIGY7IH0NCiAgICB2YXIga2luZCA9IGNvbnRleHRJbi5raW5kLCBrZXkgPSBraW5kID09PSAiZ2V0dGVyIiA/ICJnZXQiIDoga2luZCA9PT0gInNldHRlciIgPyAic2V0IiA6ICJ2YWx1ZSI7DQogICAgdmFyIHRhcmdldCA9ICFkZXNjcmlwdG9ySW4gJiYgY3RvciA/IGNvbnRleHRJblsic3RhdGljIl0gPyBjdG9yIDogY3Rvci5wcm90b3R5cGUgOiBudWxsOw0KICAgIHZhciBkZXNjcmlwdG9yID0gZGVzY3JpcHRvckluIHx8ICh0YXJnZXQgPyBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHRhcmdldCwgY29udGV4dEluLm5hbWUpIDoge30pOw0KICAgIHZhciBfLCBkb25lID0gZmFsc2U7DQogICAgZm9yICh2YXIgaSA9IGRlY29yYXRvcnMubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIHsNCiAgICAgICAgdmFyIGNvbnRleHQgPSB7fTsNCiAgICAgICAgZm9yICh2YXIgcCBpbiBjb250ZXh0SW4pIGNvbnRleHRbcF0gPSBwID09PSAiYWNjZXNzIiA/IHt9IDogY29udGV4dEluW3BdOw0KICAgICAgICBmb3IgKHZhciBwIGluIGNvbnRleHRJbi5hY2Nlc3MpIGNvbnRleHQuYWNjZXNzW3BdID0gY29udGV4dEluLmFjY2Vzc1twXTsNCiAgICAgICAgY29udGV4dC5hZGRJbml0aWFsaXplciA9IGZ1bmN0aW9uIChmKSB7IGlmIChkb25lKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJDYW5ub3QgYWRkIGluaXRpYWxpemVycyBhZnRlciBkZWNvcmF0aW9uIGhhcyBjb21wbGV0ZWQiKTsgZXh0cmFJbml0aWFsaXplcnMucHVzaChhY2NlcHQoZiB8fCBudWxsKSk7IH07DQogICAgICAgIHZhciByZXN1bHQgPSAoMCwgZGVjb3JhdG9yc1tpXSkoa2luZCA9PT0gImFjY2Vzc29yIiA/IHsgZ2V0OiBkZXNjcmlwdG9yLmdldCwgc2V0OiBkZXNjcmlwdG9yLnNldCB9IDogZGVzY3JpcHRvcltrZXldLCBjb250ZXh0KTsNCiAgICAgICAgaWYgKGtpbmQgPT09ICJhY2Nlc3NvciIpIHsNCiAgICAgICAgICAgIGlmIChyZXN1bHQgPT09IHZvaWQgMCkgY29udGludWU7DQogICAgICAgICAgICBpZiAocmVzdWx0ID09PSBudWxsIHx8IHR5cGVvZiByZXN1bHQgIT09ICJvYmplY3QiKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJPYmplY3QgZXhwZWN0ZWQiKTsNCiAgICAgICAgICAgIGlmIChfID0gYWNjZXB0KHJlc3VsdC5nZXQpKSBkZXNjcmlwdG9yLmdldCA9IF87DQogICAgICAgICAgICBpZiAoXyA9IGFjY2VwdChyZXN1bHQuc2V0KSkgZGVzY3JpcHRvci5zZXQgPSBfOw0KICAgICAgICAgICAgaWYgKF8gPSBhY2NlcHQocmVzdWx0LmluaXQpKSBpbml0aWFsaXplcnMudW5zaGlmdChfKTsNCiAgICAgICAgfQ0KICAgICAgICBlbHNlIGlmIChfID0gYWNjZXB0KHJlc3VsdCkpIHsNCiAgICAgICAgICAgIGlmIChraW5kID09PSAiZmllbGQiKSBpbml0aWFsaXplcnMudW5zaGlmdChfKTsNCiAgICAgICAgICAgIGVsc2UgZGVzY3JpcHRvcltrZXldID0gXzsNCiAgICAgICAgfQ0KICAgIH0NCiAgICBpZiAodGFyZ2V0KSBPYmplY3QuZGVmaW5lUHJvcGVydHkodGFyZ2V0LCBjb250ZXh0SW4ubmFtZSwgZGVzY3JpcHRvcik7DQogICAgZG9uZSA9IHRydWU7DQp9Ow0KdmFyIF9fc2V0RnVuY3Rpb25OYW1lID0gKHRoaXMgJiYgdGhpcy5fX3NldEZ1bmN0aW9uTmFtZSkgfHwgZnVuY3Rpb24gKGYsIG5hbWUsIHByZWZpeCkgew0KICAgIGlmICh0eXBlb2YgbmFtZSA9PT0gInN5bWJvbCIpIG5hbWUgPSBuYW1lLmRlc2NyaXB0aW9uID8gIlsiLmNvbmNhdChuYW1lLmRlc2NyaXB0aW9uLCAiXSIpIDogIiI7DQogICAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShmLCAibmFtZSIsIHsgY29uZmlndXJhYmxlOiB0cnVlLCB2YWx1ZTogcHJlZml4ID8gIiIuY29uY2F0KHByZWZpeCwgIiAiLCBuYW1lKSA6IG5hbWUgfSk7DQp9Ow0KdmFyIF9fY2xhc3NQcml2YXRlRmllbGRHZXQgPSAodGhpcyAmJiB0aGlzLl9fY2xhc3NQcml2YXRlRmllbGRHZXQpIHx8IGZ1bmN0aW9uIChyZWNlaXZlciwgc3RhdGUsIGtpbmQsIGYpIHsNCiAgICBpZiAoa2luZCA9PT0gImEiICYmICFmKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIGFjY2Vzc29yIHdhcyBkZWZpbmVkIHdpdGhvdXQgYSBnZXR0ZXIiKTsNCiAgICBpZiAodHlwZW9mIHN0YXRlID09PSAiZnVuY3Rpb24iID8gcmVjZWl2ZXIgIT09IHN0YXRlIHx8ICFmIDogIXN0YXRlLmhhcyhyZWNlaXZlcikpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCByZWFkIHByaXZhdGUgbWVtYmVyIGZyb20gYW4gb2JqZWN0IHdob3NlIGNsYXNzIGRpZCBub3QgZGVjbGFyZSBpdCIpOw0KICAgIHJldHVybiBraW5kID09PSAibSIgPyBmIDoga2luZCA9PT0gImEiID8gZi5jYWxsKHJlY2VpdmVyKSA6IGYgPyBmLnZhbHVlIDogc3RhdGUuZ2V0KHJlY2VpdmVyKTsNCn07DQp2YXIgX19jbGFzc1ByaXZhdGVGaWVsZFNldCA9ICh0aGlzICYmIHRoaXMuX19jbGFzc1ByaXZhdGVGaWVsZFNldCkgfHwgZnVuY3Rpb24gKHJlY2VpdmVyLCBzdGF0ZSwgdmFsdWUsIGtpbmQsIGYpIHsNCiAgICBpZiAoa2luZCA9PT0gIm0iKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIG1ldGhvZCBpcyBub3Qgd3JpdGFibGUiKTsNCiAgICBpZiAoa2luZCA9PT0gImEiICYmICFmKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIGFjY2Vzc29yIHdhcyBkZWZpbmVkIHdpdGhvdXQgYSBzZXR0ZXIiKTsNCiAgICBpZiAodHlwZW9mIHN0YXRlID09PSAiZnVuY3Rpb24iID8gcmVjZWl2ZXIgIT09IHN0YXRlIHx8ICFmIDogIXN0YXRlLmhhcyhyZWNlaXZlcikpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCB3cml0ZSBwcml2YXRlIG1lbWJlciB0byBhbiBvYmplY3Qgd2hvc2UgY2xhc3MgZGlkIG5vdCBkZWNsYXJlIGl0Iik7DQogICAgcmV0dXJuIChraW5kID09PSAiYSIgPyBmLmNhbGwocmVjZWl2ZXIsIHZhbHVlKSA6IGYgPyBmLnZhbHVlID0gdmFsdWUgOiBzdGF0ZS5zZXQocmVjZWl2ZXIsIHZhbHVlKSksIHZhbHVlOw0KfTsNCnZhciBfX2NsYXNzUHJpdmF0ZUZpZWxkSW4gPSAodGhpcyAmJiB0aGlzLl9fY2xhc3NQcml2YXRlRmllbGRJbikgfHwgZnVuY3Rpb24oc3RhdGUsIHJlY2VpdmVyKSB7DQogICAgaWYgKHJlY2VpdmVyID09PSBudWxsIHx8ICh0eXBlb2YgcmVjZWl2ZXIgIT09ICJvYmplY3QiICYmIHR5cGVvZiByZWNlaXZlciAhPT0gImZ1bmN0aW9uIikpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCB1c2UgJ2luJyBvcGVyYXRvciBvbiBub24tb2JqZWN0Iik7DQogICAgcmV0dXJuIHR5cGVvZiBzdGF0ZSA9PT0gImZ1bmN0aW9uIiA/IHJlY2VpdmVyID09PSBzdGF0ZSA6IHN0YXRlLmhhcyhyZWNlaXZlcik7DQp9Ow0KbGV0IEMgPSAoKCkgPT4gew0KICAgIHZhciBfQ19tZXRob2RfZ2V0LCBfQ194X2dldCwgX0NfeF9zZXQsIF9DX3ksIF9DX3pfYWNjZXNzb3Jfc3RvcmFnZSwgX0Nfel9nZXQsIF9DX3pfc2V0LCBfQ196XzFfYWNjZXNzb3Jfc3RvcmFnZTsNCiAgICBsZXQgX2NsYXNzRGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgbGV0IF9jbGFzc0Rlc2NyaXB0b3I7DQogICAgbGV0IF9jbGFzc0V4dHJhSW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9jbGFzc1RoaXM7DQogICAgbGV0IF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfbWV0aG9kX2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVzY3JpcHRvcjsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX2dldF94X2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9nZXRfeF9kZXNjcmlwdG9yOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVjb3JhdG9yczsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3NldF94X2Rlc2NyaXB0b3I7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV95X2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV95X2luaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfeV9leHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfel9kZWNvcmF0b3JzOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfel9pbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3pfZXh0cmFJbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3pfZGVzY3JpcHRvcjsNCiAgICBsZXQgX21ldGhvZF9kZWNvcmF0b3JzOw0KICAgIGxldCBfZ2V0X3hfZGVjb3JhdG9yczsNCiAgICBsZXQgX3NldF94X2RlY29yYXRvcnM7DQogICAgbGV0IF95X2RlY29yYXRvcnM7DQogICAgbGV0IF95X2luaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfeV9leHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfel9kZWNvcmF0b3JzOw0KICAgIGxldCBfel9pbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX3pfZXh0cmFJbml0aWFsaXplcnMgPSBbXTsNCiAgICB2YXIgQyA9IF9jbGFzc1RoaXMgPSBjbGFzcyB7DQogICAgICAgIG1ldGhvZCgpIHsgfQ0KICAgICAgICBnZXQgeCgpIHsgcmV0dXJuIDE7IH0NCiAgICAgICAgc2V0IHgodmFsdWUpIHsgfQ0KICAgICAgICBnZXQgeigpIHsgcmV0dXJuIF9fY2xhc3NQcml2YXRlRmllbGRHZXQodGhpcywgX0Nfel8xX2FjY2Vzc29yX3N0b3JhZ2UsICJmIik7IH0NCiAgICAgICAgc2V0IHoodmFsdWUpIHsgX19jbGFzc1ByaXZhdGVGaWVsZFNldCh0aGlzLCBfQ196XzFfYWNjZXNzb3Jfc3RvcmFnZSwgdmFsdWUsICJmIik7IH0NCiAgICAgICAgY29uc3RydWN0b3IoKSB7DQogICAgICAgICAgICB0aGlzLnkgPSAoX19ydW5Jbml0aWFsaXplcnModGhpcywgX2luc3RhbmNlRXh0cmFJbml0aWFsaXplcnMpLCBfX3J1bkluaXRpYWxpemVycyh0aGlzLCBfeV9pbml0aWFsaXplcnMsIDEpKTsNCiAgICAgICAgICAgIF9DX3pfMV9hY2Nlc3Nvcl9zdG9yYWdlLnNldCh0aGlzLCAoX19ydW5Jbml0aWFsaXplcnModGhpcywgX3lfZXh0cmFJbml0aWFsaXplcnMpLCBfX3J1bkluaXRpYWxpemVycyh0aGlzLCBfel9pbml0aWFsaXplcnMsIDEpKSk7DQogICAgICAgICAgICBfX3J1bkluaXRpYWxpemVycyh0aGlzLCBfel9leHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIH0NCiAgICB9Ow0KICAgIF9DX3pfMV9hY2Nlc3Nvcl9zdG9yYWdlID0gbmV3IFdlYWtNYXAoKTsNCiAgICBfQ19tZXRob2RfZ2V0ID0gZnVuY3Rpb24gX0NfbWV0aG9kX2dldCgpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVzY3JpcHRvci52YWx1ZTsgfTsNCiAgICBfQ194X2dldCA9IGZ1bmN0aW9uIF9DX3hfZ2V0KCkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX2dldF94X2Rlc2NyaXB0b3IuZ2V0LmNhbGwodGhpcyk7IH07DQogICAgX0NfeF9zZXQgPSBmdW5jdGlvbiBfQ194X3NldCh2YWx1ZSkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX3NldF94X2Rlc2NyaXB0b3Iuc2V0LmNhbGwodGhpcywgdmFsdWUpOyB9Ow0KICAgIF9DX3pfZ2V0ID0gZnVuY3Rpb24gX0Nfel9nZXQoKSB7IHJldHVybiBfc3RhdGljX3ByaXZhdGVfel9kZXNjcmlwdG9yLmdldC5jYWxsKHRoaXMpOyB9Ow0KICAgIF9DX3pfc2V0ID0gZnVuY3Rpb24gX0Nfel9zZXQodmFsdWUpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3Iuc2V0LmNhbGwodGhpcywgdmFsdWUpOyB9Ow0KICAgIF9fc2V0RnVuY3Rpb25OYW1lKF9jbGFzc1RoaXMsICJDIik7DQogICAgKCgpID0+IHsNCiAgICAgICAgY29uc3QgX21ldGFkYXRhID0gdHlwZW9mIFN5bWJvbCA9PT0gImZ1bmN0aW9uIiAmJiBTeW1ib2wubWV0YWRhdGEgPyBPYmplY3QuY3JlYXRlKG51bGwpIDogdm9pZCAwOw0KICAgICAgICBfbWV0aG9kX2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICBfZ2V0X3hfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9zZXRfeF9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgX3lfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF96X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICBfc3RhdGljX3ByaXZhdGVfbWV0aG9kX2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgX3N0YXRpY19wcml2YXRlX3lfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9zdGF0aWNfcHJpdmF0ZV96X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICBfX2VzRGVjb3JhdGUoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX21ldGhvZF9kZXNjcmlwdG9yID0geyB2YWx1ZTogX19zZXRGdW5jdGlvbk5hbWUoZnVuY3Rpb24gKCkgeyB9LCAiI21ldGhvZCIpIH0sIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVjb3JhdG9ycywgeyBraW5kOiAibWV0aG9kIiwgbmFtZTogIiNtZXRob2QiLCBzdGF0aWM6IHRydWUsIHByaXZhdGU6IHRydWUsIGFjY2VzczogeyBoYXM6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkSW4oX2NsYXNzVGhpcywgb2JqKSwgZ2V0OiBvYmogPT4gX19jbGFzc1ByaXZhdGVGaWVsZEdldChvYmosIF9jbGFzc1RoaXMsICJhIiwgX0NfbWV0aG9kX2dldCkgfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICBfX2VzRGVjb3JhdGUoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX2dldF94X2Rlc2NyaXB0b3IgPSB7IGdldDogX19zZXRGdW5jdGlvbk5hbWUoZnVuY3Rpb24gKCkgeyByZXR1cm4gMTsgfSwgIiN4IiwgImdldCIpIH0sIF9zdGF0aWNfcHJpdmF0ZV9nZXRfeF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJnZXR0ZXIiLCBuYW1lOiAiI3giLCBzdGF0aWM6IHRydWUsIHByaXZhdGU6IHRydWUsIGFjY2VzczogeyBoYXM6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkSW4oX2NsYXNzVGhpcywgb2JqKSwgZ2V0OiBvYmogPT4gX19jbGFzc1ByaXZhdGVGaWVsZEdldChvYmosIF9jbGFzc1RoaXMsICJhIiwgX0NfeF9nZXQpIH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgbnVsbCwgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKF9jbGFzc1RoaXMsIF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZXNjcmlwdG9yID0geyBzZXQ6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICh2YWx1ZSkgeyB9LCAiI3giLCAic2V0IikgfSwgX3N0YXRpY19wcml2YXRlX3NldF94X2RlY29yYXRvcnMsIHsga2luZDogInNldHRlciIsIG5hbWU6ICIjeCIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBzZXQ6IChvYmosIHZhbHVlKSA9PiB7IF9fY2xhc3NQcml2YXRlRmllbGRTZXQob2JqLCBfY2xhc3NUaGlzLCB2YWx1ZSwgImEiLCBfQ194X3NldCk7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICBfX2VzRGVjb3JhdGUoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX3pfZGVzY3JpcHRvciA9IHsgZ2V0OiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAoKSB7IHJldHVybiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0KF9jbGFzc1RoaXMsIF9jbGFzc1RoaXMsICJmIiwgX0Nfel9hY2Nlc3Nvcl9zdG9yYWdlKTsgfSwgIiN6IiwgImdldCIpLCBzZXQ6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICh2YWx1ZSkgeyBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0KF9jbGFzc1RoaXMsIF9jbGFzc1RoaXMsIHZhbHVlLCAiZiIsIF9DX3pfYWNjZXNzb3Jfc3RvcmFnZSk7IH0sICIjeiIsICJzZXQiKSB9LCBfc3RhdGljX3ByaXZhdGVfel9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJhY2Nlc3NvciIsIG5hbWU6ICIjeiIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBnZXQ6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0KG9iaiwgX2NsYXNzVGhpcywgImEiLCBfQ196X2dldCksIHNldDogKG9iaiwgdmFsdWUpID0+IHsgX19jbGFzc1ByaXZhdGVGaWVsZFNldChvYmosIF9jbGFzc1RoaXMsIHZhbHVlLCAiYSIsIF9DX3pfc2V0KTsgfSB9LCBtZXRhZGF0YTogX21ldGFkYXRhIH0sIF9zdGF0aWNfcHJpdmF0ZV96X2luaXRpYWxpemVycywgX3N0YXRpY19wcml2YXRlX3pfZXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICBfX2VzRGVjb3JhdGUoX2NsYXNzVGhpcywgbnVsbCwgX21ldGhvZF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJtZXRob2QiLCBuYW1lOiAibWV0aG9kIiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAibWV0aG9kIiBpbiBvYmosIGdldDogb2JqID0+IG9iai5tZXRob2QgfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fZXNEZWNvcmF0ZShfY2xhc3NUaGlzLCBudWxsLCBfZ2V0X3hfZGVjb3JhdG9ycywgeyBraW5kOiAiZ2V0dGVyIiwgbmFtZTogIngiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSwgYWNjZXNzOiB7IGhhczogb2JqID0+ICJ4IiBpbiBvYmosIGdldDogb2JqID0+IG9iai54IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgbnVsbCwgX2luc3RhbmNlRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICBfX2VzRGVjb3JhdGUoX2NsYXNzVGhpcywgbnVsbCwgX3NldF94X2RlY29yYXRvcnMsIHsga2luZDogInNldHRlciIsIG5hbWU6ICJ4Iiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAieCIgaW4gb2JqLCBzZXQ6IChvYmosIHZhbHVlKSA9PiB7IG9iai54ID0gdmFsdWU7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fZXNEZWNvcmF0ZShfY2xhc3NUaGlzLCBudWxsLCBfel9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJhY2Nlc3NvciIsIG5hbWU6ICJ6Iiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAieiIgaW4gb2JqLCBnZXQ6IG9iaiA9PiBvYmoueiwgc2V0OiAob2JqLCB2YWx1ZSkgPT4geyBvYmoueiA9IHZhbHVlOyB9IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgX3pfaW5pdGlhbGl6ZXJzLCBfel9leHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fZXNEZWNvcmF0ZShudWxsLCBudWxsLCBfc3RhdGljX3ByaXZhdGVfeV9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJmaWVsZCIsIG5hbWU6ICIjeSIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBnZXQ6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0KG9iaiwgX2NsYXNzVGhpcywgImYiLCBfQ195KSwgc2V0OiAob2JqLCB2YWx1ZSkgPT4geyBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0KG9iaiwgX2NsYXNzVGhpcywgdmFsdWUsICJmIiwgX0NfeSk7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBfc3RhdGljX3ByaXZhdGVfeV9pbml0aWFsaXplcnMsIF9zdGF0aWNfcHJpdmF0ZV95X2V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKG51bGwsIG51bGwsIF95X2RlY29yYXRvcnMsIHsga2luZDogImZpZWxkIiwgbmFtZTogInkiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSwgYWNjZXNzOiB7IGhhczogb2JqID0+ICJ5IiBpbiBvYmosIGdldDogb2JqID0+IG9iai55LCBzZXQ6IChvYmosIHZhbHVlKSA9PiB7IG9iai55ID0gdmFsdWU7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBfeV9pbml0aWFsaXplcnMsIF95X2V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKG51bGwsIF9jbGFzc0Rlc2NyaXB0b3IgPSB7IHZhbHVlOiBfY2xhc3NUaGlzIH0sIF9jbGFzc0RlY29yYXRvcnMsIHsga2luZDogImNsYXNzIiwgbmFtZTogX2NsYXNzVGhpcy5uYW1lLCBtZXRhZGF0YTogX21ldGFkYXRhIH0sIG51bGwsIF9jbGFzc0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgQyA9IF9jbGFzc1RoaXMgPSBfY2xhc3NEZXNjcmlwdG9yLnZhbHVlOw0KICAgICAgICBpZiAoX21ldGFkYXRhKSBPYmplY3QuZGVmaW5lUHJvcGVydHkoX2NsYXNzVGhpcywgU3ltYm9sLm1ldGFkYXRhLCB7IGVudW1lcmFibGU6IHRydWUsIGNvbmZpZ3VyYWJsZTogdHJ1ZSwgd3JpdGFibGU6IHRydWUsIHZhbHVlOiBfbWV0YWRhdGEgfSk7DQogICAgfSkoKTsNCiAgICBfQ195ID0geyB2YWx1ZTogKF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyksIF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9zdGF0aWNfcHJpdmF0ZV95X2luaXRpYWxpemVycywgMSkpIH07DQogICAgX0Nfel9hY2Nlc3Nvcl9zdG9yYWdlID0geyB2YWx1ZTogKF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9zdGF0aWNfcHJpdmF0ZV95X2V4dHJhSW5pdGlhbGl6ZXJzKSwgX19ydW5Jbml0aWFsaXplcnMoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX3pfaW5pdGlhbGl6ZXJzLCAxKSkgfTsNCiAgICAoKCkgPT4gew0KICAgICAgICBfX3J1bkluaXRpYWxpemVycyhfY2xhc3NUaGlzLCBfc3RhdGljX3ByaXZhdGVfel9leHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9jbGFzc0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICB9KSgpOw0KICAgIHJldHVybiBDID0gX2NsYXNzVGhpczsNCn0pKCk7DQovLyMgc291cmNlTWFwcGluZ1VSTD1lc0RlY29yYXRvcnMtY2xhc3NEZWNsYXJhdGlvbi1zb3VyY2VNYXAuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0lBSU0sQ0FBQzs7NEJBRk4sR0FBRyxFQUNILEdBQUc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O1FBSUEsTUFBTSxLQUFJLENBQUM7UUFJWCxJQUFJLENBQUMsS0FBSyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFJckIsSUFBSSxDQUFDLENBQUMsS0FBYSxJQUFJLENBQUM7UUFReEIsSUFBUyxDQUFDLHlFQUFLO1FBQWYsSUFBUyxDQUFDLDhFQUFLOztZQUpmLE1BQUMsSUFmQyxtREFBQywyQ0FlQyxDQUFDLEdBQUM7WUFJRywySEFBSSxDQUFDLElBQUM7Ozs7Ozs7Ozs7Ozs7OEJBbEJkLEdBQUcsRUFDSCxHQUFHOzZCQUdILEdBQUcsRUFDSCxHQUFHOzZCQUdILEdBQUcsRUFDSCxHQUFHO3lCQUdILEdBQUcsRUFDSCxHQUFHO3lCQUdILEdBQUcsRUFDSCxHQUFHOzZDQUdILEdBQUcsRUFDSCxHQUFHOzRDQUdILEdBQUcsRUFDSCxHQUFHOzRDQUdILEdBQUcsRUFDSCxHQUFHO3dDQUdILEdBQUcsRUFDSCxHQUFHO3dDQUdILEdBQUcsRUFDSCxHQUFHO1FBZkosK0RBQUEseUJBQUEsY0FBa0IsQ0FBQyxZQUFBLHVTQUFBO1FBSW5CLDhEQUFBLHVCQUFBLGNBQWtCLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxjQUFBLDRSQUFBO1FBSTdCLDhEQUFBLHVCQUFBLFVBQWMsS0FBYSxJQUFJLENBQUMsY0FBQSxpVEFBQTtRQVFoQywwREFBQSx1QkFBQSxrR0FBdUIsY0FBQSxFQUF2Qix1QkFBQSx1R0FBdUIsY0FBQSx3WkFBQTtRQXBDdkIsMktBQUEsTUFBTSw2REFBSztRQUlYLGdLQUFJLENBQUMsNkRBQWdCO1FBSXJCLDJLQUFJLENBQUMsd0VBQW1CO1FBUXhCLDhKQUFTLENBQUMsNkJBQUQsQ0FBQyw2RUFBSztRQWdCZixrYUFBYztRQXBCZCxxSkFBQSxDQUFDLDZCQUFELENBQUMsNkVBQUs7UUFmViw2S0F3Q0M7Ozs7SUFMVSxpQkFuQ0wsdURBQUMsZ0VBbUNTLENBQUMsSUFBSixDQUFLO0lBSUUsb0tBQUssQ0FBQyxJQUFKLENBQUs7OztRQXZDckIsdURBQUMifQ==,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7CgpAZGVjCkBkZWMKY2xhc3MgQyB7CiAgICBAZGVjCiAgICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== //// [esDecorators-classDeclaration-sourceMap.d.ts.map] {"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt index 67d4604820368..51ceedca9e400 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt @@ -8,6 +8,13 @@ sources: esDecorators-classDeclaration-sourceMap.ts emittedFile:esDecorators-classDeclaration-sourceMap.js sourceFile:esDecorators-classDeclaration-sourceMap.ts ------------------------------------------------------------------- +>>>var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { +>>> var useValue = arguments.length > 2; +>>> for (var i = 0; i < initializers.length; i++) { +>>> value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); +>>> } +>>> return useValue ? value : void 0; +>>>}; >>>var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { >>> function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } >>> var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -35,13 +42,6 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts >>> if (target) Object.defineProperty(target, contextIn.name, descriptor); >>> done = true; >>>}; ->>>var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { ->>> var useValue = arguments.length > 2; ->>> for (var i = 0; i < initializers.length; i++) { ->>> value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); ->>> } ->>> return useValue ? value : void 0; ->>>}; >>>var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { >>> if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; >>> return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); @@ -103,110 +103,36 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts >>> let _static_private_set_x_descriptor; >>> let _static_private_y_decorators; >>> let _static_private_y_initializers = []; +>>> let _static_private_y_extraInitializers = []; >>> let _static_private_z_decorators; >>> let _static_private_z_initializers = []; +>>> let _static_private_z_extraInitializers = []; >>> let _static_private_z_descriptor; >>> let _method_decorators; >>> let _get_x_decorators; >>> let _set_x_decorators; >>> let _y_decorators; >>> let _y_initializers = []; +>>> let _y_extraInitializers = []; >>> let _z_decorators; >>> let _z_initializers = []; +>>> let _z_extraInitializers = []; >>> var C = _classThis = class { ->>> constructor() { ->>> this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); -1 >^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^ -1 > - >class C { - > @dec - > @dec - > method() {} - > - > @dec - > @dec - > get x() { return 1; } - > - > @dec - > @dec - > set x(value: number) { } - > - > @dec - > @dec - > -2 > y -3 > = -4 > 1 -5 > ; -1 >Emitted(82, 13) Source(20, 5) + SourceIndex(0) -2 >Emitted(82, 19) Source(20, 6) + SourceIndex(0) -3 >Emitted(82, 117) Source(20, 9) + SourceIndex(0) -4 >Emitted(82, 118) Source(20, 10) + SourceIndex(0) -5 >Emitted(82, 121) Source(20, 11) + SourceIndex(0) ---- ->>> _C_z_1_accessor_storage.set(this, __runInitializers(this, _z_initializers, 1)); -1 >^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^ -1 > - > - > @dec - > @dec - > accessor -2 > z = -3 > 1 -4 > ; -1 >Emitted(83, 13) Source(24, 14) + SourceIndex(0) -2 >Emitted(83, 88) Source(24, 18) + SourceIndex(0) -3 >Emitted(83, 89) Source(24, 19) + SourceIndex(0) -4 >Emitted(83, 92) Source(24, 20) + SourceIndex(0) ---- ->>> } -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^-> -1 > - > - > @dec - > @dec - > static #method() {} - > - > @dec - > @dec - > static get #x() { return 1; } - > - > @dec - > @dec - > static set #x(value: number) { } - > - > @dec - > @dec - > static #y = 1; - > - > @dec - > @dec - > static accessor #z = 1; - > -2 > } -1 >Emitted(84, 9) Source(45, 1) + SourceIndex(0) -2 >Emitted(84, 10) Source(45, 2) + SourceIndex(0) ---- >>> method() { } -1->^^^^^^^^ +1 >^^^^^^^^ 2 > ^^^^^^ 3 > ^^^^^ 4 > ^ 5 > ^^^^^^^^^^-> -1-> +1 > + >class C { + > @dec + > @dec + > 2 > method 3 > () { 4 > } -1->Emitted(85, 9) Source(8, 5) + SourceIndex(0) +1 >Emitted(85, 9) Source(8, 5) + SourceIndex(0) 2 >Emitted(85, 15) Source(8, 11) + SourceIndex(0) 3 >Emitted(85, 20) Source(8, 15) + SourceIndex(0) 4 >Emitted(85, 21) Source(8, 16) + SourceIndex(0) @@ -309,6 +235,66 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 >Emitted(89, 14) Source(24, 15) + SourceIndex(0) 4 >Emitted(89, 92) Source(24, 20) + SourceIndex(0) --- +>>> constructor() { +>>> this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); +1 >^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^ +7 > ^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 > y +3 > +4 > C +5 > { + > @dec + > @dec + > method() {} + > + > @dec + > @dec + > get x() { return 1; } + > + > @dec + > @dec + > set x(value: number) { } + > + > @dec + > @dec + > y = +6 > 1 +7 > ; +1 >Emitted(91, 13) Source(20, 5) + SourceIndex(0) +2 >Emitted(91, 19) Source(20, 6) + SourceIndex(0) +3 >Emitted(91, 23) Source(5, 7) + SourceIndex(0) +4 >Emitted(91, 74) Source(5, 8) + SourceIndex(0) +5 >Emitted(91, 117) Source(20, 9) + SourceIndex(0) +6 >Emitted(91, 118) Source(20, 10) + SourceIndex(0) +7 >Emitted(91, 121) Source(20, 11) + SourceIndex(0) +--- +>>> _C_z_1_accessor_storage.set(this, (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1))); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^ +1-> + > + > @dec + > @dec + > accessor +2 > z = +3 > 1 +4 > ; +1->Emitted(92, 13) Source(24, 14) + SourceIndex(0) +2 >Emitted(92, 136) Source(24, 18) + SourceIndex(0) +3 >Emitted(92, 137) Source(24, 19) + SourceIndex(0) +4 >Emitted(92, 141) Source(24, 20) + SourceIndex(0) +--- +>>> __runInitializers(this, _z_extraInitializers); +>>> } >>> }; >>> _C_z_1_accessor_storage = new WeakMap(); >>> _C_method_get = function _C_method_get() { return _static_private_method_descriptor.value; }; @@ -330,10 +316,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1 >Emitted(100, 31) Source(6, 6) + SourceIndex(0) -2 >Emitted(100, 34) Source(6, 9) + SourceIndex(0) -3 >Emitted(100, 36) Source(7, 6) + SourceIndex(0) -4 >Emitted(100, 39) Source(7, 9) + SourceIndex(0) +1 >Emitted(105, 31) Source(6, 6) + SourceIndex(0) +2 >Emitted(105, 34) Source(6, 9) + SourceIndex(0) +3 >Emitted(105, 36) Source(7, 6) + SourceIndex(0) +4 >Emitted(105, 39) Source(7, 9) + SourceIndex(0) --- >>> _get_x_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -349,10 +335,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(101, 30) Source(10, 6) + SourceIndex(0) -2 >Emitted(101, 33) Source(10, 9) + SourceIndex(0) -3 >Emitted(101, 35) Source(11, 6) + SourceIndex(0) -4 >Emitted(101, 38) Source(11, 9) + SourceIndex(0) +1->Emitted(106, 30) Source(10, 6) + SourceIndex(0) +2 >Emitted(106, 33) Source(10, 9) + SourceIndex(0) +3 >Emitted(106, 35) Source(11, 6) + SourceIndex(0) +4 >Emitted(106, 38) Source(11, 9) + SourceIndex(0) --- >>> _set_x_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -367,10 +353,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(102, 30) Source(14, 6) + SourceIndex(0) -2 >Emitted(102, 33) Source(14, 9) + SourceIndex(0) -3 >Emitted(102, 35) Source(15, 6) + SourceIndex(0) -4 >Emitted(102, 38) Source(15, 9) + SourceIndex(0) +1->Emitted(107, 30) Source(14, 6) + SourceIndex(0) +2 >Emitted(107, 33) Source(14, 9) + SourceIndex(0) +3 >Emitted(107, 35) Source(15, 6) + SourceIndex(0) +4 >Emitted(107, 38) Source(15, 9) + SourceIndex(0) --- >>> _y_decorators = [dec, dec]; 1 >^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -386,10 +372,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1 >Emitted(103, 26) Source(18, 6) + SourceIndex(0) -2 >Emitted(103, 29) Source(18, 9) + SourceIndex(0) -3 >Emitted(103, 31) Source(19, 6) + SourceIndex(0) -4 >Emitted(103, 34) Source(19, 9) + SourceIndex(0) +1 >Emitted(108, 26) Source(18, 6) + SourceIndex(0) +2 >Emitted(108, 29) Source(18, 9) + SourceIndex(0) +3 >Emitted(108, 31) Source(19, 6) + SourceIndex(0) +4 >Emitted(108, 34) Source(19, 9) + SourceIndex(0) --- >>> _z_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -405,10 +391,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(104, 26) Source(22, 6) + SourceIndex(0) -2 >Emitted(104, 29) Source(22, 9) + SourceIndex(0) -3 >Emitted(104, 31) Source(23, 6) + SourceIndex(0) -4 >Emitted(104, 34) Source(23, 9) + SourceIndex(0) +1->Emitted(109, 26) Source(22, 6) + SourceIndex(0) +2 >Emitted(109, 29) Source(22, 9) + SourceIndex(0) +3 >Emitted(109, 31) Source(23, 6) + SourceIndex(0) +4 >Emitted(109, 34) Source(23, 9) + SourceIndex(0) --- >>> _static_private_method_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -424,10 +410,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(105, 46) Source(26, 6) + SourceIndex(0) -2 >Emitted(105, 49) Source(26, 9) + SourceIndex(0) -3 >Emitted(105, 51) Source(27, 6) + SourceIndex(0) -4 >Emitted(105, 54) Source(27, 9) + SourceIndex(0) +1->Emitted(110, 46) Source(26, 6) + SourceIndex(0) +2 >Emitted(110, 49) Source(26, 9) + SourceIndex(0) +3 >Emitted(110, 51) Source(27, 6) + SourceIndex(0) +4 >Emitted(110, 54) Source(27, 9) + SourceIndex(0) --- >>> _static_private_get_x_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -443,10 +429,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(106, 45) Source(30, 6) + SourceIndex(0) -2 >Emitted(106, 48) Source(30, 9) + SourceIndex(0) -3 >Emitted(106, 50) Source(31, 6) + SourceIndex(0) -4 >Emitted(106, 53) Source(31, 9) + SourceIndex(0) +1->Emitted(111, 45) Source(30, 6) + SourceIndex(0) +2 >Emitted(111, 48) Source(30, 9) + SourceIndex(0) +3 >Emitted(111, 50) Source(31, 6) + SourceIndex(0) +4 >Emitted(111, 53) Source(31, 9) + SourceIndex(0) --- >>> _static_private_set_x_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -461,10 +447,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(107, 45) Source(34, 6) + SourceIndex(0) -2 >Emitted(107, 48) Source(34, 9) + SourceIndex(0) -3 >Emitted(107, 50) Source(35, 6) + SourceIndex(0) -4 >Emitted(107, 53) Source(35, 9) + SourceIndex(0) +1->Emitted(112, 45) Source(34, 6) + SourceIndex(0) +2 >Emitted(112, 48) Source(34, 9) + SourceIndex(0) +3 >Emitted(112, 50) Source(35, 6) + SourceIndex(0) +4 >Emitted(112, 53) Source(35, 9) + SourceIndex(0) --- >>> _static_private_y_decorators = [dec, dec]; 1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -480,10 +466,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1 >Emitted(108, 41) Source(38, 6) + SourceIndex(0) -2 >Emitted(108, 44) Source(38, 9) + SourceIndex(0) -3 >Emitted(108, 46) Source(39, 6) + SourceIndex(0) -4 >Emitted(108, 49) Source(39, 9) + SourceIndex(0) +1 >Emitted(113, 41) Source(38, 6) + SourceIndex(0) +2 >Emitted(113, 44) Source(38, 9) + SourceIndex(0) +3 >Emitted(113, 46) Source(39, 6) + SourceIndex(0) +4 >Emitted(113, 49) Source(39, 9) + SourceIndex(0) --- >>> _static_private_z_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -499,10 +485,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(109, 41) Source(42, 6) + SourceIndex(0) -2 >Emitted(109, 44) Source(42, 9) + SourceIndex(0) -3 >Emitted(109, 46) Source(43, 6) + SourceIndex(0) -4 >Emitted(109, 49) Source(43, 9) + SourceIndex(0) +1->Emitted(114, 41) Source(42, 6) + SourceIndex(0) +2 >Emitted(114, 44) Source(42, 9) + SourceIndex(0) +3 >Emitted(114, 46) Source(43, 6) + SourceIndex(0) +4 >Emitted(114, 49) Source(43, 9) + SourceIndex(0) --- >>> __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_method_get) }, metadata: _metadata }, null, _staticExtraInitializers); 1->^^^^^^^^ @@ -519,13 +505,13 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 5 > } 6 > 7 > -1->Emitted(110, 9) Source(28, 5) + SourceIndex(0) -2 >Emitted(110, 72) Source(28, 5) + SourceIndex(0) -3 >Emitted(110, 97) Source(28, 5) + SourceIndex(0) -4 >Emitted(110, 111) Source(28, 23) + SourceIndex(0) -5 >Emitted(110, 112) Source(28, 24) + SourceIndex(0) -6 >Emitted(110, 124) Source(28, 24) + SourceIndex(0) -7 >Emitted(110, 419) Source(28, 24) + SourceIndex(0) +1->Emitted(115, 9) Source(28, 5) + SourceIndex(0) +2 >Emitted(115, 72) Source(28, 5) + SourceIndex(0) +3 >Emitted(115, 97) Source(28, 5) + SourceIndex(0) +4 >Emitted(115, 111) Source(28, 23) + SourceIndex(0) +5 >Emitted(115, 112) Source(28, 24) + SourceIndex(0) +6 >Emitted(115, 124) Source(28, 24) + SourceIndex(0) +7 >Emitted(115, 419) Source(28, 24) + SourceIndex(0) --- >>> __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_x_get) }, metadata: _metadata }, null, _staticExtraInitializers); 1 >^^^^^^^^ @@ -555,17 +541,17 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 9 > } 10> 11> -1 >Emitted(111, 9) Source(32, 5) + SourceIndex(0) -2 >Emitted(111, 71) Source(32, 5) + SourceIndex(0) -3 >Emitted(111, 94) Source(32, 5) + SourceIndex(0) -4 >Emitted(111, 108) Source(32, 23) + SourceIndex(0) -5 >Emitted(111, 115) Source(32, 30) + SourceIndex(0) -6 >Emitted(111, 116) Source(32, 31) + SourceIndex(0) -7 >Emitted(111, 117) Source(32, 32) + SourceIndex(0) -8 >Emitted(111, 118) Source(32, 33) + SourceIndex(0) -9 >Emitted(111, 119) Source(32, 34) + SourceIndex(0) -10>Emitted(111, 133) Source(32, 34) + SourceIndex(0) -11>Emitted(111, 417) Source(32, 34) + SourceIndex(0) +1 >Emitted(116, 9) Source(32, 5) + SourceIndex(0) +2 >Emitted(116, 71) Source(32, 5) + SourceIndex(0) +3 >Emitted(116, 94) Source(32, 5) + SourceIndex(0) +4 >Emitted(116, 108) Source(32, 23) + SourceIndex(0) +5 >Emitted(116, 115) Source(32, 30) + SourceIndex(0) +6 >Emitted(116, 116) Source(32, 31) + SourceIndex(0) +7 >Emitted(116, 117) Source(32, 32) + SourceIndex(0) +8 >Emitted(116, 118) Source(32, 33) + SourceIndex(0) +9 >Emitted(116, 119) Source(32, 34) + SourceIndex(0) +10>Emitted(116, 133) Source(32, 34) + SourceIndex(0) +11>Emitted(116, 417) Source(32, 34) + SourceIndex(0) --- >>> __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_x_set); } }, metadata: _metadata }, null, _staticExtraInitializers); 1->^^^^^^^^ @@ -577,7 +563,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ^ 8 > ^^^^^^^^^^^^^^ 9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -591,17 +577,17 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > } 8 > 9 > -1->Emitted(112, 9) Source(36, 5) + SourceIndex(0) -2 >Emitted(112, 71) Source(36, 5) + SourceIndex(0) -3 >Emitted(112, 94) Source(36, 5) + SourceIndex(0) -4 >Emitted(112, 104) Source(36, 19) + SourceIndex(0) -5 >Emitted(112, 109) Source(36, 32) + SourceIndex(0) -6 >Emitted(112, 113) Source(36, 36) + SourceIndex(0) -7 >Emitted(112, 114) Source(36, 37) + SourceIndex(0) -8 >Emitted(112, 128) Source(36, 37) + SourceIndex(0) -9 >Emitted(112, 433) Source(36, 37) + SourceIndex(0) +1->Emitted(117, 9) Source(36, 5) + SourceIndex(0) +2 >Emitted(117, 71) Source(36, 5) + SourceIndex(0) +3 >Emitted(117, 94) Source(36, 5) + SourceIndex(0) +4 >Emitted(117, 104) Source(36, 19) + SourceIndex(0) +5 >Emitted(117, 109) Source(36, 32) + SourceIndex(0) +6 >Emitted(117, 113) Source(36, 36) + SourceIndex(0) +7 >Emitted(117, 114) Source(36, 37) + SourceIndex(0) +8 >Emitted(117, 128) Source(36, 37) + SourceIndex(0) +9 >Emitted(117, 433) Source(36, 37) + SourceIndex(0) --- ->>> __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _staticExtraInitializers); +>>> __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _static_private_z_extraInitializers); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ @@ -611,7 +597,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ^^^^^^^^^^^^^^^^^^^^^^^ 8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 > ^^^^^^^^^^^^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -630,16 +616,16 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 8 > static accessor #z = 1; 9 > 10> -1->Emitted(113, 9) Source(44, 5) + SourceIndex(0) -2 >Emitted(113, 67) Source(44, 5) + SourceIndex(0) -3 >Emitted(113, 90) Source(44, 5) + SourceIndex(0) -4 >Emitted(113, 188) Source(44, 28) + SourceIndex(0) -5 >Emitted(113, 202) Source(44, 28) + SourceIndex(0) -6 >Emitted(113, 204) Source(44, 5) + SourceIndex(0) -7 >Emitted(113, 227) Source(44, 5) + SourceIndex(0) -8 >Emitted(113, 330) Source(44, 28) + SourceIndex(0) -9 >Emitted(113, 344) Source(44, 28) + SourceIndex(0) -10>Emitted(113, 741) Source(44, 28) + SourceIndex(0) +1->Emitted(118, 9) Source(44, 5) + SourceIndex(0) +2 >Emitted(118, 67) Source(44, 5) + SourceIndex(0) +3 >Emitted(118, 90) Source(44, 5) + SourceIndex(0) +4 >Emitted(118, 188) Source(44, 28) + SourceIndex(0) +5 >Emitted(118, 202) Source(44, 28) + SourceIndex(0) +6 >Emitted(118, 204) Source(44, 5) + SourceIndex(0) +7 >Emitted(118, 227) Source(44, 5) + SourceIndex(0) +8 >Emitted(118, 330) Source(44, 28) + SourceIndex(0) +9 >Emitted(118, 344) Source(44, 28) + SourceIndex(0) +10>Emitted(118, 752) Source(44, 28) + SourceIndex(0) --- >>> __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); 1 >^^^^^^^^ @@ -650,10 +636,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > 3 > method 4 > () {} -1 >Emitted(114, 9) Source(8, 5) + SourceIndex(0) -2 >Emitted(114, 180) Source(8, 5) + SourceIndex(0) -3 >Emitted(114, 186) Source(8, 11) + SourceIndex(0) -4 >Emitted(114, 247) Source(8, 16) + SourceIndex(0) +1 >Emitted(119, 9) Source(8, 5) + SourceIndex(0) +2 >Emitted(119, 180) Source(8, 5) + SourceIndex(0) +3 >Emitted(119, 186) Source(8, 11) + SourceIndex(0) +4 >Emitted(119, 247) Source(8, 16) + SourceIndex(0) --- >>> __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, get: obj => obj.x }, metadata: _metadata }, null, _instanceExtraInitializers); 1 >^^^^^^^^ @@ -669,17 +655,17 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > get 3 > x 4 > () { return 1; } -1 >Emitted(115, 9) Source(12, 5) + SourceIndex(0) -2 >Emitted(115, 169) Source(12, 9) + SourceIndex(0) -3 >Emitted(115, 170) Source(12, 10) + SourceIndex(0) -4 >Emitted(115, 231) Source(12, 26) + SourceIndex(0) +1 >Emitted(120, 9) Source(12, 5) + SourceIndex(0) +2 >Emitted(120, 169) Source(12, 9) + SourceIndex(0) +3 >Emitted(120, 170) Source(12, 10) + SourceIndex(0) +4 >Emitted(120, 231) Source(12, 26) + SourceIndex(0) --- >>> __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^ 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -688,19 +674,19 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > set 3 > x 4 > (value: number) { } -1->Emitted(116, 9) Source(16, 5) + SourceIndex(0) -2 >Emitted(116, 180) Source(16, 9) + SourceIndex(0) -3 >Emitted(116, 181) Source(16, 10) + SourceIndex(0) -4 >Emitted(116, 253) Source(16, 29) + SourceIndex(0) +1->Emitted(121, 9) Source(16, 5) + SourceIndex(0) +2 >Emitted(121, 180) Source(16, 9) + SourceIndex(0) +3 >Emitted(121, 181) Source(16, 10) + SourceIndex(0) +4 >Emitted(121, 253) Source(16, 29) + SourceIndex(0) --- ->>> __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _instanceExtraInitializers); +>>> __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _z_extraInitializers); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^ 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -715,16 +701,16 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 4 > 5 > z 6 > = 1; -1->Emitted(117, 9) Source(24, 5) + SourceIndex(0) -2 >Emitted(117, 167) Source(24, 14) + SourceIndex(0) -3 >Emitted(117, 168) Source(24, 15) + SourceIndex(0) -4 >Emitted(117, 197) Source(24, 14) + SourceIndex(0) -5 >Emitted(117, 198) Source(24, 15) + SourceIndex(0) -6 >Emitted(117, 281) Source(24, 20) + SourceIndex(0) +1->Emitted(122, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(122, 167) Source(24, 14) + SourceIndex(0) +3 >Emitted(122, 168) Source(24, 15) + SourceIndex(0) +4 >Emitted(122, 197) Source(24, 14) + SourceIndex(0) +5 >Emitted(122, 198) Source(24, 15) + SourceIndex(0) +6 >Emitted(122, 275) Source(24, 20) + SourceIndex(0) --- ->>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _staticExtraInitializers); +>>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _static_private_y_extraInitializers); 1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -743,28 +729,28 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > 2 > static #y = 1; -1->Emitted(118, 9) Source(40, 5) + SourceIndex(0) -2 >Emitted(118, 416) Source(40, 19) + SourceIndex(0) +1->Emitted(123, 9) Source(40, 5) + SourceIndex(0) +2 >Emitted(123, 427) Source(40, 19) + SourceIndex(0) --- ->>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); +>>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); 1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^ 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > 2 > 3 > y 4 > 5 > y 6 > = 1; -1 >Emitted(119, 9) Source(20, 5) + SourceIndex(0) -2 >Emitted(119, 158) Source(20, 5) + SourceIndex(0) -3 >Emitted(119, 159) Source(20, 6) + SourceIndex(0) -4 >Emitted(119, 188) Source(20, 5) + SourceIndex(0) -5 >Emitted(119, 189) Source(20, 6) + SourceIndex(0) -6 >Emitted(119, 272) Source(20, 11) + SourceIndex(0) +1 >Emitted(124, 9) Source(20, 5) + SourceIndex(0) +2 >Emitted(124, 158) Source(20, 5) + SourceIndex(0) +3 >Emitted(124, 159) Source(20, 6) + SourceIndex(0) +4 >Emitted(124, 188) Source(20, 5) + SourceIndex(0) +5 >Emitted(124, 189) Source(20, 6) + SourceIndex(0) +6 >Emitted(124, 266) Source(20, 11) + SourceIndex(0) --- >>> __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); 1 >^^^^^^^^ @@ -811,102 +797,101 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > static accessor #z = 1; > } -1 >Emitted(120, 9) Source(5, 1) + SourceIndex(0) -2 >Emitted(120, 182) Source(45, 2) + SourceIndex(0) +1 >Emitted(125, 9) Source(5, 1) + SourceIndex(0) +2 >Emitted(125, 182) Source(45, 2) + SourceIndex(0) --- >>> C = _classThis = _classDescriptor.value; >>> if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); ->>> __runInitializers(_classThis, _staticExtraInitializers); -1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 > -2 > C -1 >Emitted(123, 9) Source(5, 7) + SourceIndex(0) -2 >Emitted(123, 65) Source(5, 8) + SourceIndex(0) ---- >>> })(); ->>> _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; +>>> _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }; 1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^-> -1 > { - > @dec - > @dec - > method() {} - > - > @dec - > @dec - > get x() { return 1; } - > - > @dec - > @dec - > set x(value: number) { } - > - > @dec - > @dec - > y = 1; - > - > @dec - > @dec - > accessor z = 1; - > - > @dec - > @dec - > static #method() {} - > - > @dec - > @dec - > static get #x() { return 1; } - > - > @dec - > @dec - > static set #x(value: number) { } - > - > @dec - > @dec - > static -2 > #y = -3 > 1 -4 > -5 > = 1; -1 >Emitted(125, 5) Source(40, 12) + SourceIndex(0) -2 >Emitted(125, 83) Source(40, 17) + SourceIndex(0) -3 >Emitted(125, 84) Source(40, 18) + SourceIndex(0) -4 >Emitted(125, 87) Source(40, 14) + SourceIndex(0) -5 >Emitted(125, 88) Source(40, 19) + SourceIndex(0) +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 > +3 > C +4 > { + > @dec + > @dec + > method() {} + > + > @dec + > @dec + > get x() { return 1; } + > + > @dec + > @dec + > set x(value: number) { } + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > accessor z = 1; + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > static #y = +5 > 1 +6 > +7 > = 1; +1 >Emitted(129, 5) Source(40, 12) + SourceIndex(0) +2 >Emitted(129, 22) Source(5, 7) + SourceIndex(0) +3 >Emitted(129, 77) Source(5, 8) + SourceIndex(0) +4 >Emitted(129, 141) Source(40, 17) + SourceIndex(0) +5 >Emitted(129, 142) Source(40, 18) + SourceIndex(0) +6 >Emitted(129, 146) Source(40, 14) + SourceIndex(0) +7 >Emitted(129, 147) Source(40, 19) + SourceIndex(0) --- ->>> _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; +>>> _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }; 1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^ +5 > ^ 1-> > > @dec > @dec > static accessor 2 > #z = -3 > 1 -4 > -5 > = 1; -1->Emitted(126, 5) Source(44, 21) + SourceIndex(0) -2 >Emitted(126, 100) Source(44, 26) + SourceIndex(0) -3 >Emitted(126, 101) Source(44, 27) + SourceIndex(0) -4 >Emitted(126, 104) Source(44, 23) + SourceIndex(0) -5 >Emitted(126, 105) Source(44, 28) + SourceIndex(0) +3 > 1 +4 > +5 > = 1; +1->Emitted(130, 5) Source(44, 21) + SourceIndex(0) +2 >Emitted(130, 169) Source(44, 26) + SourceIndex(0) +3 >Emitted(130, 170) Source(44, 27) + SourceIndex(0) +4 >Emitted(130, 174) Source(44, 23) + SourceIndex(0) +5 >Emitted(130, 175) Source(44, 28) + SourceIndex(0) --- >>> (() => { +>>> __runInitializers(_classThis, _static_private_z_extraInitializers); >>> __runInitializers(_classThis, _classExtraInitializers); 1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > 2 > C -1 >Emitted(128, 9) Source(5, 7) + SourceIndex(0) -2 >Emitted(128, 64) Source(5, 8) + SourceIndex(0) +1 >Emitted(133, 9) Source(5, 7) + SourceIndex(0) +2 >Emitted(133, 64) Source(5, 8) + SourceIndex(0) --- >>> })(); >>> return C = _classThis; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js index 107a5bfe98f2d..b2487b3a07105 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js @@ -49,6 +49,13 @@ class C { //// [esDecorators-classDeclaration-sourceMap.js] +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -76,13 +83,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; -var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); @@ -118,16 +118,20 @@ let C = (() => { let _static_private_set_x_descriptor; let _static_private_y_decorators; let _static_private_y_initializers = []; + let _static_private_y_extraInitializers = []; let _static_private_z_decorators; let _static_private_z_initializers = []; + let _static_private_z_extraInitializers = []; let _static_private_z_descriptor; let _method_decorators; let _get_x_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; let _z_decorators; let _z_initializers = []; + let _z_extraInitializers = []; var C = class { static { _classThis = this; } static { __setFunctionName(this, "C"); } @@ -147,32 +151,35 @@ let C = (() => { __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_method_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_x_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_x_set); } }, metadata: _metadata }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _static_private_z_extraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, get: obj => obj.x }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _z_extraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _static_private_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); } method() { } get x() { return 1; } set x(value) { } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - #z_accessor_storage = __runInitializers(this, _z_initializers, 1); + #z_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1)); get z() { return this.#z_accessor_storage; } set z(value) { this.#z_accessor_storage = value; } static { - _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }; } static { - _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }; + } + constructor() { + __runInitializers(this, _z_extraInitializers); } static { + __runInitializers(_classThis, _static_private_z_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); } }; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map index 6c3ad708bb5fd..2db1e0f3b12f3 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map @@ -1,6 +1,6 @@ //// [esDecorators-classDeclaration-sourceMap.js.map] -{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAEC,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;iDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;YAfJ,yDAAA,yBAAA,cAAkB,CAAC,YAAA,uSAAA;YAInB,wDAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,4RAAA;YAI7B,wDAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,iTAAA;YAQhC,oDAAA,uBAAA,4FAAuB,cAAA,EAAvB,uBAAA,iGAAuB,cAAA,6YAAA;YApCvB,qKAAA,MAAM,6DAAK;YAIX,0JAAI,CAAC,6DAAgB;YAIrB,qKAAI,CAAC,wEAAmB;YAQxB,wJAAS,CAAC,6BAAD,CAAC,mFAAK;YAgBf,uZAAc;YApBd,qJAAA,CAAC,6BAAD,CAAC,mFAAK;YAfV,6KAwCC;;;YAxCK,wDAAC;;QAGH,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAIxB,CAAC,kGAAG,CAAC,GAAC;QAIN,+DAAa,CAAC,EAAC;QAAf,IAAS,CAAC,uCAAK;QAAf,IAAS,CAAC,6CAAK;;YAgBR,8EAAK,CAAC,GAAJ,CAAK;;;YAIE,+FAAK,CAAC,GAAJ,CAAK;;;YAvCrB,uDAAC"} -//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fZXNEZWNvcmF0ZSA9ICh0aGlzICYmIHRoaXMuX19lc0RlY29yYXRlKSB8fCBmdW5jdGlvbiAoY3RvciwgZGVzY3JpcHRvckluLCBkZWNvcmF0b3JzLCBjb250ZXh0SW4sIGluaXRpYWxpemVycywgZXh0cmFJbml0aWFsaXplcnMpIHsNCiAgICBmdW5jdGlvbiBhY2NlcHQoZikgeyBpZiAoZiAhPT0gdm9pZCAwICYmIHR5cGVvZiBmICE9PSAiZnVuY3Rpb24iKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJGdW5jdGlvbiBleHBlY3RlZCIpOyByZXR1cm4gZjsgfQ0KICAgIHZhciBraW5kID0gY29udGV4dEluLmtpbmQsIGtleSA9IGtpbmQgPT09ICJnZXR0ZXIiID8gImdldCIgOiBraW5kID09PSAic2V0dGVyIiA/ICJzZXQiIDogInZhbHVlIjsNCiAgICB2YXIgdGFyZ2V0ID0gIWRlc2NyaXB0b3JJbiAmJiBjdG9yID8gY29udGV4dEluWyJzdGF0aWMiXSA/IGN0b3IgOiBjdG9yLnByb3RvdHlwZSA6IG51bGw7DQogICAgdmFyIGRlc2NyaXB0b3IgPSBkZXNjcmlwdG9ySW4gfHwgKHRhcmdldCA/IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IodGFyZ2V0LCBjb250ZXh0SW4ubmFtZSkgOiB7fSk7DQogICAgdmFyIF8sIGRvbmUgPSBmYWxzZTsNCiAgICBmb3IgKHZhciBpID0gZGVjb3JhdG9ycy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkgew0KICAgICAgICB2YXIgY29udGV4dCA9IHt9Ow0KICAgICAgICBmb3IgKHZhciBwIGluIGNvbnRleHRJbikgY29udGV4dFtwXSA9IHAgPT09ICJhY2Nlc3MiID8ge30gOiBjb250ZXh0SW5bcF07DQogICAgICAgIGZvciAodmFyIHAgaW4gY29udGV4dEluLmFjY2VzcykgY29udGV4dC5hY2Nlc3NbcF0gPSBjb250ZXh0SW4uYWNjZXNzW3BdOw0KICAgICAgICBjb250ZXh0LmFkZEluaXRpYWxpemVyID0gZnVuY3Rpb24gKGYpIHsgaWYgKGRvbmUpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCBhZGQgaW5pdGlhbGl6ZXJzIGFmdGVyIGRlY29yYXRpb24gaGFzIGNvbXBsZXRlZCIpOyBleHRyYUluaXRpYWxpemVycy5wdXNoKGFjY2VwdChmIHx8IG51bGwpKTsgfTsNCiAgICAgICAgdmFyIHJlc3VsdCA9ICgwLCBkZWNvcmF0b3JzW2ldKShraW5kID09PSAiYWNjZXNzb3IiID8geyBnZXQ6IGRlc2NyaXB0b3IuZ2V0LCBzZXQ6IGRlc2NyaXB0b3Iuc2V0IH0gOiBkZXNjcmlwdG9yW2tleV0sIGNvbnRleHQpOw0KICAgICAgICBpZiAoa2luZCA9PT0gImFjY2Vzc29yIikgew0KICAgICAgICAgICAgaWYgKHJlc3VsdCA9PT0gdm9pZCAwKSBjb250aW51ZTsNCiAgICAgICAgICAgIGlmIChyZXN1bHQgPT09IG51bGwgfHwgdHlwZW9mIHJlc3VsdCAhPT0gIm9iamVjdCIpIHRocm93IG5ldyBUeXBlRXJyb3IoIk9iamVjdCBleHBlY3RlZCIpOw0KICAgICAgICAgICAgaWYgKF8gPSBhY2NlcHQocmVzdWx0LmdldCkpIGRlc2NyaXB0b3IuZ2V0ID0gXzsNCiAgICAgICAgICAgIGlmIChfID0gYWNjZXB0KHJlc3VsdC5zZXQpKSBkZXNjcmlwdG9yLnNldCA9IF87DQogICAgICAgICAgICBpZiAoXyA9IGFjY2VwdChyZXN1bHQuaW5pdCkpIGluaXRpYWxpemVycy51bnNoaWZ0KF8pOw0KICAgICAgICB9DQogICAgICAgIGVsc2UgaWYgKF8gPSBhY2NlcHQocmVzdWx0KSkgew0KICAgICAgICAgICAgaWYgKGtpbmQgPT09ICJmaWVsZCIpIGluaXRpYWxpemVycy51bnNoaWZ0KF8pOw0KICAgICAgICAgICAgZWxzZSBkZXNjcmlwdG9yW2tleV0gPSBfOw0KICAgICAgICB9DQogICAgfQ0KICAgIGlmICh0YXJnZXQpIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0YXJnZXQsIGNvbnRleHRJbi5uYW1lLCBkZXNjcmlwdG9yKTsNCiAgICBkb25lID0gdHJ1ZTsNCn07DQp2YXIgX19ydW5Jbml0aWFsaXplcnMgPSAodGhpcyAmJiB0aGlzLl9fcnVuSW5pdGlhbGl6ZXJzKSB8fCBmdW5jdGlvbiAodGhpc0FyZywgaW5pdGlhbGl6ZXJzLCB2YWx1ZSkgew0KICAgIHZhciB1c2VWYWx1ZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAyOw0KICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaW5pdGlhbGl6ZXJzLmxlbmd0aDsgaSsrKSB7DQogICAgICAgIHZhbHVlID0gdXNlVmFsdWUgPyBpbml0aWFsaXplcnNbaV0uY2FsbCh0aGlzQXJnLCB2YWx1ZSkgOiBpbml0aWFsaXplcnNbaV0uY2FsbCh0aGlzQXJnKTsNCiAgICB9DQogICAgcmV0dXJuIHVzZVZhbHVlID8gdmFsdWUgOiB2b2lkIDA7DQp9Ow0KdmFyIF9fc2V0RnVuY3Rpb25OYW1lID0gKHRoaXMgJiYgdGhpcy5fX3NldEZ1bmN0aW9uTmFtZSkgfHwgZnVuY3Rpb24gKGYsIG5hbWUsIHByZWZpeCkgew0KICAgIGlmICh0eXBlb2YgbmFtZSA9PT0gInN5bWJvbCIpIG5hbWUgPSBuYW1lLmRlc2NyaXB0aW9uID8gIlsiLmNvbmNhdChuYW1lLmRlc2NyaXB0aW9uLCAiXSIpIDogIiI7DQogICAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShmLCAibmFtZSIsIHsgY29uZmlndXJhYmxlOiB0cnVlLCB2YWx1ZTogcHJlZml4ID8gIiIuY29uY2F0KHByZWZpeCwgIiAiLCBuYW1lKSA6IG5hbWUgfSk7DQp9Ow0KdmFyIF9fY2xhc3NQcml2YXRlRmllbGRJbiA9ICh0aGlzICYmIHRoaXMuX19jbGFzc1ByaXZhdGVGaWVsZEluKSB8fCBmdW5jdGlvbihzdGF0ZSwgcmVjZWl2ZXIpIHsNCiAgICBpZiAocmVjZWl2ZXIgPT09IG51bGwgfHwgKHR5cGVvZiByZWNlaXZlciAhPT0gIm9iamVjdCIgJiYgdHlwZW9mIHJlY2VpdmVyICE9PSAiZnVuY3Rpb24iKSkgdGhyb3cgbmV3IFR5cGVFcnJvcigiQ2Fubm90IHVzZSAnaW4nIG9wZXJhdG9yIG9uIG5vbi1vYmplY3QiKTsNCiAgICByZXR1cm4gdHlwZW9mIHN0YXRlID09PSAiZnVuY3Rpb24iID8gcmVjZWl2ZXIgPT09IHN0YXRlIDogc3RhdGUuaGFzKHJlY2VpdmVyKTsNCn07DQp2YXIgX19jbGFzc1ByaXZhdGVGaWVsZEdldCA9ICh0aGlzICYmIHRoaXMuX19jbGFzc1ByaXZhdGVGaWVsZEdldCkgfHwgZnVuY3Rpb24gKHJlY2VpdmVyLCBzdGF0ZSwga2luZCwgZikgew0KICAgIGlmIChraW5kID09PSAiYSIgJiYgIWYpIHRocm93IG5ldyBUeXBlRXJyb3IoIlByaXZhdGUgYWNjZXNzb3Igd2FzIGRlZmluZWQgd2l0aG91dCBhIGdldHRlciIpOw0KICAgIGlmICh0eXBlb2Ygc3RhdGUgPT09ICJmdW5jdGlvbiIgPyByZWNlaXZlciAhPT0gc3RhdGUgfHwgIWYgOiAhc3RhdGUuaGFzKHJlY2VpdmVyKSkgdGhyb3cgbmV3IFR5cGVFcnJvcigiQ2Fubm90IHJlYWQgcHJpdmF0ZSBtZW1iZXIgZnJvbSBhbiBvYmplY3Qgd2hvc2UgY2xhc3MgZGlkIG5vdCBkZWNsYXJlIGl0Iik7DQogICAgcmV0dXJuIGtpbmQgPT09ICJtIiA/IGYgOiBraW5kID09PSAiYSIgPyBmLmNhbGwocmVjZWl2ZXIpIDogZiA/IGYudmFsdWUgOiBzdGF0ZS5nZXQocmVjZWl2ZXIpOw0KfTsNCnZhciBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0ID0gKHRoaXMgJiYgdGhpcy5fX2NsYXNzUHJpdmF0ZUZpZWxkU2V0KSB8fCBmdW5jdGlvbiAocmVjZWl2ZXIsIHN0YXRlLCB2YWx1ZSwga2luZCwgZikgew0KICAgIGlmIChraW5kID09PSAibSIpIHRocm93IG5ldyBUeXBlRXJyb3IoIlByaXZhdGUgbWV0aG9kIGlzIG5vdCB3cml0YWJsZSIpOw0KICAgIGlmIChraW5kID09PSAiYSIgJiYgIWYpIHRocm93IG5ldyBUeXBlRXJyb3IoIlByaXZhdGUgYWNjZXNzb3Igd2FzIGRlZmluZWQgd2l0aG91dCBhIHNldHRlciIpOw0KICAgIGlmICh0eXBlb2Ygc3RhdGUgPT09ICJmdW5jdGlvbiIgPyByZWNlaXZlciAhPT0gc3RhdGUgfHwgIWYgOiAhc3RhdGUuaGFzKHJlY2VpdmVyKSkgdGhyb3cgbmV3IFR5cGVFcnJvcigiQ2Fubm90IHdyaXRlIHByaXZhdGUgbWVtYmVyIHRvIGFuIG9iamVjdCB3aG9zZSBjbGFzcyBkaWQgbm90IGRlY2xhcmUgaXQiKTsNCiAgICByZXR1cm4gKGtpbmQgPT09ICJhIiA/IGYuY2FsbChyZWNlaXZlciwgdmFsdWUpIDogZiA/IGYudmFsdWUgPSB2YWx1ZSA6IHN0YXRlLnNldChyZWNlaXZlciwgdmFsdWUpKSwgdmFsdWU7DQp9Ow0KbGV0IEMgPSAoKCkgPT4gew0KICAgIHZhciBfQ19tZXRob2RfZ2V0LCBfQ194X2dldCwgX0NfeF9zZXQsIF9DX3ksIF9DX3pfYWNjZXNzb3Jfc3RvcmFnZSwgX0Nfel9nZXQsIF9DX3pfc2V0Ow0KICAgIGxldCBfY2xhc3NEZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICBsZXQgX2NsYXNzRGVzY3JpcHRvcjsNCiAgICBsZXQgX2NsYXNzRXh0cmFJbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX2NsYXNzVGhpczsNCiAgICBsZXQgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVjb3JhdG9yczsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX21ldGhvZF9kZXNjcmlwdG9yOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVjb3JhdG9yczsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX2dldF94X2Rlc2NyaXB0b3I7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZWNvcmF0b3JzOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVzY3JpcHRvcjsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3lfZGVjb3JhdG9yczsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3lfaW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV96X2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV96X2luaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfel9kZXNjcmlwdG9yOw0KICAgIGxldCBfbWV0aG9kX2RlY29yYXRvcnM7DQogICAgbGV0IF9nZXRfeF9kZWNvcmF0b3JzOw0KICAgIGxldCBfc2V0X3hfZGVjb3JhdG9yczsNCiAgICBsZXQgX3lfZGVjb3JhdG9yczsNCiAgICBsZXQgX3lfaW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF96X2RlY29yYXRvcnM7DQogICAgbGV0IF96X2luaXRpYWxpemVycyA9IFtdOw0KICAgIHZhciBDID0gY2xhc3Mgew0KICAgICAgICBzdGF0aWMgeyBfY2xhc3NUaGlzID0gdGhpczsgfQ0KICAgICAgICBzdGF0aWMgeyBfX3NldEZ1bmN0aW9uTmFtZSh0aGlzLCAiQyIpOyB9DQogICAgICAgIHN0YXRpYyB7IF9DX21ldGhvZF9nZXQgPSBmdW5jdGlvbiBfQ19tZXRob2RfZ2V0KCkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX21ldGhvZF9kZXNjcmlwdG9yLnZhbHVlOyB9LCBfQ194X2dldCA9IGZ1bmN0aW9uIF9DX3hfZ2V0KCkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX2dldF94X2Rlc2NyaXB0b3IuZ2V0LmNhbGwodGhpcyk7IH0sIF9DX3hfc2V0ID0gZnVuY3Rpb24gX0NfeF9zZXQodmFsdWUpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZXNjcmlwdG9yLnNldC5jYWxsKHRoaXMsIHZhbHVlKTsgfSwgX0Nfel9nZXQgPSBmdW5jdGlvbiBfQ196X2dldCgpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3IuZ2V0LmNhbGwodGhpcyk7IH0sIF9DX3pfc2V0ID0gZnVuY3Rpb24gX0Nfel9zZXQodmFsdWUpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3Iuc2V0LmNhbGwodGhpcywgdmFsdWUpOyB9OyB9DQogICAgICAgIHN0YXRpYyB7DQogICAgICAgICAgICBjb25zdCBfbWV0YWRhdGEgPSB0eXBlb2YgU3ltYm9sID09PSAiZnVuY3Rpb24iICYmIFN5bWJvbC5tZXRhZGF0YSA/IE9iamVjdC5jcmVhdGUobnVsbCkgOiB2b2lkIDA7DQogICAgICAgICAgICBfbWV0aG9kX2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX2dldF94X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX3NldF94X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX3lfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfel9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgICAgIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfc3RhdGljX3ByaXZhdGVfeV9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgICAgIF9zdGF0aWNfcHJpdmF0ZV96X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVzY3JpcHRvciA9IHsgdmFsdWU6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICgpIHsgfSwgIiNtZXRob2QiKSB9LCBfc3RhdGljX3ByaXZhdGVfbWV0aG9kX2RlY29yYXRvcnMsIHsga2luZDogIm1ldGhvZCIsIG5hbWU6ICIjbWV0aG9kIiwgc3RhdGljOiB0cnVlLCBwcml2YXRlOiB0cnVlLCBhY2Nlc3M6IHsgaGFzOiBvYmogPT4gX19jbGFzc1ByaXZhdGVGaWVsZEluKF9jbGFzc1RoaXMsIG9iaiksIGdldDogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRHZXQob2JqLCBfY2xhc3NUaGlzLCAiYSIsIF9DX21ldGhvZF9nZXQpIH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgbnVsbCwgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZSh0aGlzLCBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVzY3JpcHRvciA9IHsgZ2V0OiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAoKSB7IHJldHVybiAxOyB9LCAiI3giLCAiZ2V0IikgfSwgX3N0YXRpY19wcml2YXRlX2dldF94X2RlY29yYXRvcnMsIHsga2luZDogImdldHRlciIsIG5hbWU6ICIjeCIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBnZXQ6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0KG9iaiwgX2NsYXNzVGhpcywgImEiLCBfQ194X2dldCkgfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZXNjcmlwdG9yID0geyBzZXQ6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICh2YWx1ZSkgeyB9LCAiI3giLCAic2V0IikgfSwgX3N0YXRpY19wcml2YXRlX3NldF94X2RlY29yYXRvcnMsIHsga2luZDogInNldHRlciIsIG5hbWU6ICIjeCIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBzZXQ6IChvYmosIHZhbHVlKSA9PiB7IF9fY2xhc3NQcml2YXRlRmllbGRTZXQob2JqLCBfY2xhc3NUaGlzLCB2YWx1ZSwgImEiLCBfQ194X3NldCk7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3IgPSB7IGdldDogX19zZXRGdW5jdGlvbk5hbWUoZnVuY3Rpb24gKCkgeyByZXR1cm4gX19jbGFzc1ByaXZhdGVGaWVsZEdldCh0aGlzLCBfY2xhc3NUaGlzLCAiZiIsIF9DX3pfYWNjZXNzb3Jfc3RvcmFnZSk7IH0sICIjeiIsICJnZXQiKSwgc2V0OiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAodmFsdWUpIHsgX19jbGFzc1ByaXZhdGVGaWVsZFNldCh0aGlzLCBfY2xhc3NUaGlzLCB2YWx1ZSwgImYiLCBfQ196X2FjY2Vzc29yX3N0b3JhZ2UpOyB9LCAiI3oiLCAic2V0IikgfSwgX3N0YXRpY19wcml2YXRlX3pfZGVjb3JhdG9ycywgeyBraW5kOiAiYWNjZXNzb3IiLCBuYW1lOiAiI3oiLCBzdGF0aWM6IHRydWUsIHByaXZhdGU6IHRydWUsIGFjY2VzczogeyBoYXM6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkSW4oX2NsYXNzVGhpcywgb2JqKSwgZ2V0OiBvYmogPT4gX19jbGFzc1ByaXZhdGVGaWVsZEdldChvYmosIF9jbGFzc1RoaXMsICJhIiwgX0Nfel9nZXQpLCBzZXQ6IChvYmosIHZhbHVlKSA9PiB7IF9fY2xhc3NQcml2YXRlRmllbGRTZXQob2JqLCBfY2xhc3NUaGlzLCB2YWx1ZSwgImEiLCBfQ196X3NldCk7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBfc3RhdGljX3ByaXZhdGVfel9pbml0aWFsaXplcnMsIF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgICAgICBfX2VzRGVjb3JhdGUodGhpcywgbnVsbCwgX21ldGhvZF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJtZXRob2QiLCBuYW1lOiAibWV0aG9kIiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAibWV0aG9kIiBpbiBvYmosIGdldDogb2JqID0+IG9iai5tZXRob2QgfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgICAgICBfX2VzRGVjb3JhdGUodGhpcywgbnVsbCwgX2dldF94X2RlY29yYXRvcnMsIHsga2luZDogImdldHRlciIsIG5hbWU6ICJ4Iiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAieCIgaW4gb2JqLCBnZXQ6IG9iaiA9PiBvYmoueCB9LCBtZXRhZGF0YTogX21ldGFkYXRhIH0sIG51bGwsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZSh0aGlzLCBudWxsLCBfc2V0X3hfZGVjb3JhdG9ycywgeyBraW5kOiAic2V0dGVyIiwgbmFtZTogIngiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSwgYWNjZXNzOiB7IGhhczogb2JqID0+ICJ4IiBpbiBvYmosIHNldDogKG9iaiwgdmFsdWUpID0+IHsgb2JqLnggPSB2YWx1ZTsgfSB9LCBtZXRhZGF0YTogX21ldGFkYXRhIH0sIG51bGwsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZSh0aGlzLCBudWxsLCBfel9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJhY2Nlc3NvciIsIG5hbWU6ICJ6Iiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAieiIgaW4gb2JqLCBnZXQ6IG9iaiA9PiBvYmoueiwgc2V0OiAob2JqLCB2YWx1ZSkgPT4geyBvYmoueiA9IHZhbHVlOyB9IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgX3pfaW5pdGlhbGl6ZXJzLCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgICAgICBfX2VzRGVjb3JhdGUobnVsbCwgbnVsbCwgX3N0YXRpY19wcml2YXRlX3lfZGVjb3JhdG9ycywgeyBraW5kOiAiZmllbGQiLCBuYW1lOiAiI3kiLCBzdGF0aWM6IHRydWUsIHByaXZhdGU6IHRydWUsIGFjY2VzczogeyBoYXM6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkSW4oX2NsYXNzVGhpcywgb2JqKSwgZ2V0OiBvYmogPT4gX19jbGFzc1ByaXZhdGVGaWVsZEdldChvYmosIF9jbGFzc1RoaXMsICJmIiwgX0NfeSksIHNldDogKG9iaiwgdmFsdWUpID0+IHsgX19jbGFzc1ByaXZhdGVGaWVsZFNldChvYmosIF9jbGFzc1RoaXMsIHZhbHVlLCAiZiIsIF9DX3kpOyB9IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgX3N0YXRpY19wcml2YXRlX3lfaW5pdGlhbGl6ZXJzLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKG51bGwsIG51bGwsIF95X2RlY29yYXRvcnMsIHsga2luZDogImZpZWxkIiwgbmFtZTogInkiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSwgYWNjZXNzOiB7IGhhczogb2JqID0+ICJ5IiBpbiBvYmosIGdldDogb2JqID0+IG9iai55LCBzZXQ6IChvYmosIHZhbHVlKSA9PiB7IG9iai55ID0gdmFsdWU7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBfeV9pbml0aWFsaXplcnMsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZShudWxsLCBfY2xhc3NEZXNjcmlwdG9yID0geyB2YWx1ZTogX2NsYXNzVGhpcyB9LCBfY2xhc3NEZWNvcmF0b3JzLCB7IGtpbmQ6ICJjbGFzcyIsIG5hbWU6IF9jbGFzc1RoaXMubmFtZSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfY2xhc3NFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgICAgICBDID0gX2NsYXNzVGhpcyA9IF9jbGFzc0Rlc2NyaXB0b3IudmFsdWU7DQogICAgICAgICAgICBpZiAoX21ldGFkYXRhKSBPYmplY3QuZGVmaW5lUHJvcGVydHkoX2NsYXNzVGhpcywgU3ltYm9sLm1ldGFkYXRhLCB7IGVudW1lcmFibGU6IHRydWUsIGNvbmZpZ3VyYWJsZTogdHJ1ZSwgd3JpdGFibGU6IHRydWUsIHZhbHVlOiBfbWV0YWRhdGEgfSk7DQogICAgICAgICAgICBfX3J1bkluaXRpYWxpemVycyhfY2xhc3NUaGlzLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICB9DQogICAgICAgIG1ldGhvZCgpIHsgfQ0KICAgICAgICBnZXQgeCgpIHsgcmV0dXJuIDE7IH0NCiAgICAgICAgc2V0IHgodmFsdWUpIHsgfQ0KICAgICAgICB5ID0gKF9fcnVuSW5pdGlhbGl6ZXJzKHRoaXMsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKSwgX19ydW5Jbml0aWFsaXplcnModGhpcywgX3lfaW5pdGlhbGl6ZXJzLCAxKSk7DQogICAgICAgICN6X2FjY2Vzc29yX3N0b3JhZ2UgPSBfX3J1bkluaXRpYWxpemVycyh0aGlzLCBfel9pbml0aWFsaXplcnMsIDEpOw0KICAgICAgICBnZXQgeigpIHsgcmV0dXJuIHRoaXMuI3pfYWNjZXNzb3Jfc3RvcmFnZTsgfQ0KICAgICAgICBzZXQgeih2YWx1ZSkgeyB0aGlzLiN6X2FjY2Vzc29yX3N0b3JhZ2UgPSB2YWx1ZTsgfQ0KICAgICAgICBzdGF0aWMgew0KICAgICAgICAgICAgX0NfeSA9IHsgdmFsdWU6IF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9zdGF0aWNfcHJpdmF0ZV95X2luaXRpYWxpemVycywgMSkgfTsNCiAgICAgICAgfQ0KICAgICAgICBzdGF0aWMgew0KICAgICAgICAgICAgX0Nfel9hY2Nlc3Nvcl9zdG9yYWdlID0geyB2YWx1ZTogX19ydW5Jbml0aWFsaXplcnMoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX3pfaW5pdGlhbGl6ZXJzLCAxKSB9Ow0KICAgICAgICB9DQogICAgICAgIHN0YXRpYyB7DQogICAgICAgICAgICBfX3J1bkluaXRpYWxpemVycyhfY2xhc3NUaGlzLCBfY2xhc3NFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIH0NCiAgICB9Ow0KICAgIHJldHVybiBDID0gX2NsYXNzVGhpczsNCn0pKCk7DQovLyMgc291cmNlTWFwcGluZ1VSTD1lc0RlY29yYXRvcnMtY2xhc3NEZWNsYXJhdGlvbi1zb3VyY2VNYXAuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0lBSU0sQ0FBQzs7NEJBRk4sR0FBRyxFQUNILEdBQUc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztrQ0FFQyxHQUFHLEVBQ0gsR0FBRztpQ0FHSCxHQUFHLEVBQ0gsR0FBRztpQ0FHSCxHQUFHLEVBQ0gsR0FBRzs2QkFHSCxHQUFHLEVBQ0gsR0FBRzs2QkFHSCxHQUFHLEVBQ0gsR0FBRztpREFHSCxHQUFHLEVBQ0gsR0FBRztnREFHSCxHQUFHLEVBQ0gsR0FBRztnREFHSCxHQUFHLEVBQ0gsR0FBRzs0Q0FHSCxHQUFHLEVBQ0gsR0FBRzs0Q0FHSCxHQUFHLEVBQ0gsR0FBRztZQWZKLHlEQUFBLHlCQUFBLGNBQWtCLENBQUMsWUFBQSx1U0FBQTtZQUluQix3REFBQSx1QkFBQSxjQUFrQixPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsY0FBQSw0UkFBQTtZQUk3Qix3REFBQSx1QkFBQSxVQUFjLEtBQWEsSUFBSSxDQUFDLGNBQUEsaVRBQUE7WUFRaEMsb0RBQUEsdUJBQUEsNEZBQXVCLGNBQUEsRUFBdkIsdUJBQUEsaUdBQXVCLGNBQUEsNllBQUE7WUFwQ3ZCLHFLQUFBLE1BQU0sNkRBQUs7WUFJWCwwSkFBSSxDQUFDLDZEQUFnQjtZQUlyQixxS0FBSSxDQUFDLHdFQUFtQjtZQVF4Qix3SkFBUyxDQUFDLDZCQUFELENBQUMsbUZBQUs7WUFnQmYsdVpBQWM7WUFwQmQscUpBQUEsQ0FBQyw2QkFBRCxDQUFDLG1GQUFLO1lBZlYsNktBd0NDOzs7WUF4Q0ssd0RBQUM7O1FBR0gsTUFBTSxLQUFJLENBQUM7UUFJWCxJQUFJLENBQUMsS0FBSyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFJckIsSUFBSSxDQUFDLENBQUMsS0FBYSxJQUFJLENBQUM7UUFJeEIsQ0FBQyxrR0FBRyxDQUFDLEdBQUM7UUFJTiwrREFBYSxDQUFDLEVBQUM7UUFBZixJQUFTLENBQUMsdUNBQUs7UUFBZixJQUFTLENBQUMsNkNBQUs7O1lBZ0JSLDhFQUFLLENBQUMsR0FBSixDQUFLOzs7WUFJRSwrRkFBSyxDQUFDLEdBQUosQ0FBSzs7O1lBdkNyQix1REFBQyJ9,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7CgpAZGVjCkBkZWMKY2xhc3MgQyB7CiAgICBAZGVjCiAgICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAEC,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;iDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;YAfJ,yDAAA,yBAAA,cAAkB,CAAC,YAAA,uSAAA;YAInB,wDAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,4RAAA;YAI7B,wDAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,iTAAA;YAQhC,oDAAA,uBAAA,4FAAuB,cAAA,EAAvB,uBAAA,iGAAuB,cAAA,wZAAA;YApCvB,qKAAA,MAAM,6DAAK;YAIX,0JAAI,CAAC,6DAAgB;YAIrB,qKAAI,CAAC,wEAAmB;YAQxB,wJAAS,CAAC,6BAAD,CAAC,6EAAK;YAgBf,kaAAc;YApBd,qJAAA,CAAC,6BAAD,CAAC,6EAAK;YAfV,6KAwCC;;;;QArCG,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAIxB,CAAC,IAfC,mDAAC,2CAeC,CAAC,GAAC;QAIN,+GAAa,CAAC,GAAC;QAAf,IAAS,CAAC,uCAAK;QAAf,IAAS,CAAC,6CAAK;;YAgBR,iBAnCL,uDAAC,gEAmCS,CAAC,IAAJ,CAAK;;;YAIE,oKAAK,CAAC,IAAJ,CAAK;;;;;;;YAvCrB,uDAAC"} +//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fcnVuSW5pdGlhbGl6ZXJzID0gKHRoaXMgJiYgdGhpcy5fX3J1bkluaXRpYWxpemVycykgfHwgZnVuY3Rpb24gKHRoaXNBcmcsIGluaXRpYWxpemVycywgdmFsdWUpIHsNCiAgICB2YXIgdXNlVmFsdWUgPSBhcmd1bWVudHMubGVuZ3RoID4gMjsNCiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGluaXRpYWxpemVycy5sZW5ndGg7IGkrKykgew0KICAgICAgICB2YWx1ZSA9IHVzZVZhbHVlID8gaW5pdGlhbGl6ZXJzW2ldLmNhbGwodGhpc0FyZywgdmFsdWUpIDogaW5pdGlhbGl6ZXJzW2ldLmNhbGwodGhpc0FyZyk7DQogICAgfQ0KICAgIHJldHVybiB1c2VWYWx1ZSA/IHZhbHVlIDogdm9pZCAwOw0KfTsNCnZhciBfX2VzRGVjb3JhdGUgPSAodGhpcyAmJiB0aGlzLl9fZXNEZWNvcmF0ZSkgfHwgZnVuY3Rpb24gKGN0b3IsIGRlc2NyaXB0b3JJbiwgZGVjb3JhdG9ycywgY29udGV4dEluLCBpbml0aWFsaXplcnMsIGV4dHJhSW5pdGlhbGl6ZXJzKSB7DQogICAgZnVuY3Rpb24gYWNjZXB0KGYpIHsgaWYgKGYgIT09IHZvaWQgMCAmJiB0eXBlb2YgZiAhPT0gImZ1bmN0aW9uIikgdGhyb3cgbmV3IFR5cGVFcnJvcigiRnVuY3Rpb24gZXhwZWN0ZWQiKTsgcmV0dXJuIGY7IH0NCiAgICB2YXIga2luZCA9IGNvbnRleHRJbi5raW5kLCBrZXkgPSBraW5kID09PSAiZ2V0dGVyIiA/ICJnZXQiIDoga2luZCA9PT0gInNldHRlciIgPyAic2V0IiA6ICJ2YWx1ZSI7DQogICAgdmFyIHRhcmdldCA9ICFkZXNjcmlwdG9ySW4gJiYgY3RvciA/IGNvbnRleHRJblsic3RhdGljIl0gPyBjdG9yIDogY3Rvci5wcm90b3R5cGUgOiBudWxsOw0KICAgIHZhciBkZXNjcmlwdG9yID0gZGVzY3JpcHRvckluIHx8ICh0YXJnZXQgPyBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHRhcmdldCwgY29udGV4dEluLm5hbWUpIDoge30pOw0KICAgIHZhciBfLCBkb25lID0gZmFsc2U7DQogICAgZm9yICh2YXIgaSA9IGRlY29yYXRvcnMubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIHsNCiAgICAgICAgdmFyIGNvbnRleHQgPSB7fTsNCiAgICAgICAgZm9yICh2YXIgcCBpbiBjb250ZXh0SW4pIGNvbnRleHRbcF0gPSBwID09PSAiYWNjZXNzIiA/IHt9IDogY29udGV4dEluW3BdOw0KICAgICAgICBmb3IgKHZhciBwIGluIGNvbnRleHRJbi5hY2Nlc3MpIGNvbnRleHQuYWNjZXNzW3BdID0gY29udGV4dEluLmFjY2Vzc1twXTsNCiAgICAgICAgY29udGV4dC5hZGRJbml0aWFsaXplciA9IGZ1bmN0aW9uIChmKSB7IGlmIChkb25lKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJDYW5ub3QgYWRkIGluaXRpYWxpemVycyBhZnRlciBkZWNvcmF0aW9uIGhhcyBjb21wbGV0ZWQiKTsgZXh0cmFJbml0aWFsaXplcnMucHVzaChhY2NlcHQoZiB8fCBudWxsKSk7IH07DQogICAgICAgIHZhciByZXN1bHQgPSAoMCwgZGVjb3JhdG9yc1tpXSkoa2luZCA9PT0gImFjY2Vzc29yIiA/IHsgZ2V0OiBkZXNjcmlwdG9yLmdldCwgc2V0OiBkZXNjcmlwdG9yLnNldCB9IDogZGVzY3JpcHRvcltrZXldLCBjb250ZXh0KTsNCiAgICAgICAgaWYgKGtpbmQgPT09ICJhY2Nlc3NvciIpIHsNCiAgICAgICAgICAgIGlmIChyZXN1bHQgPT09IHZvaWQgMCkgY29udGludWU7DQogICAgICAgICAgICBpZiAocmVzdWx0ID09PSBudWxsIHx8IHR5cGVvZiByZXN1bHQgIT09ICJvYmplY3QiKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJPYmplY3QgZXhwZWN0ZWQiKTsNCiAgICAgICAgICAgIGlmIChfID0gYWNjZXB0KHJlc3VsdC5nZXQpKSBkZXNjcmlwdG9yLmdldCA9IF87DQogICAgICAgICAgICBpZiAoXyA9IGFjY2VwdChyZXN1bHQuc2V0KSkgZGVzY3JpcHRvci5zZXQgPSBfOw0KICAgICAgICAgICAgaWYgKF8gPSBhY2NlcHQocmVzdWx0LmluaXQpKSBpbml0aWFsaXplcnMudW5zaGlmdChfKTsNCiAgICAgICAgfQ0KICAgICAgICBlbHNlIGlmIChfID0gYWNjZXB0KHJlc3VsdCkpIHsNCiAgICAgICAgICAgIGlmIChraW5kID09PSAiZmllbGQiKSBpbml0aWFsaXplcnMudW5zaGlmdChfKTsNCiAgICAgICAgICAgIGVsc2UgZGVzY3JpcHRvcltrZXldID0gXzsNCiAgICAgICAgfQ0KICAgIH0NCiAgICBpZiAodGFyZ2V0KSBPYmplY3QuZGVmaW5lUHJvcGVydHkodGFyZ2V0LCBjb250ZXh0SW4ubmFtZSwgZGVzY3JpcHRvcik7DQogICAgZG9uZSA9IHRydWU7DQp9Ow0KdmFyIF9fc2V0RnVuY3Rpb25OYW1lID0gKHRoaXMgJiYgdGhpcy5fX3NldEZ1bmN0aW9uTmFtZSkgfHwgZnVuY3Rpb24gKGYsIG5hbWUsIHByZWZpeCkgew0KICAgIGlmICh0eXBlb2YgbmFtZSA9PT0gInN5bWJvbCIpIG5hbWUgPSBuYW1lLmRlc2NyaXB0aW9uID8gIlsiLmNvbmNhdChuYW1lLmRlc2NyaXB0aW9uLCAiXSIpIDogIiI7DQogICAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShmLCAibmFtZSIsIHsgY29uZmlndXJhYmxlOiB0cnVlLCB2YWx1ZTogcHJlZml4ID8gIiIuY29uY2F0KHByZWZpeCwgIiAiLCBuYW1lKSA6IG5hbWUgfSk7DQp9Ow0KdmFyIF9fY2xhc3NQcml2YXRlRmllbGRJbiA9ICh0aGlzICYmIHRoaXMuX19jbGFzc1ByaXZhdGVGaWVsZEluKSB8fCBmdW5jdGlvbihzdGF0ZSwgcmVjZWl2ZXIpIHsNCiAgICBpZiAocmVjZWl2ZXIgPT09IG51bGwgfHwgKHR5cGVvZiByZWNlaXZlciAhPT0gIm9iamVjdCIgJiYgdHlwZW9mIHJlY2VpdmVyICE9PSAiZnVuY3Rpb24iKSkgdGhyb3cgbmV3IFR5cGVFcnJvcigiQ2Fubm90IHVzZSAnaW4nIG9wZXJhdG9yIG9uIG5vbi1vYmplY3QiKTsNCiAgICByZXR1cm4gdHlwZW9mIHN0YXRlID09PSAiZnVuY3Rpb24iID8gcmVjZWl2ZXIgPT09IHN0YXRlIDogc3RhdGUuaGFzKHJlY2VpdmVyKTsNCn07DQp2YXIgX19jbGFzc1ByaXZhdGVGaWVsZEdldCA9ICh0aGlzICYmIHRoaXMuX19jbGFzc1ByaXZhdGVGaWVsZEdldCkgfHwgZnVuY3Rpb24gKHJlY2VpdmVyLCBzdGF0ZSwga2luZCwgZikgew0KICAgIGlmIChraW5kID09PSAiYSIgJiYgIWYpIHRocm93IG5ldyBUeXBlRXJyb3IoIlByaXZhdGUgYWNjZXNzb3Igd2FzIGRlZmluZWQgd2l0aG91dCBhIGdldHRlciIpOw0KICAgIGlmICh0eXBlb2Ygc3RhdGUgPT09ICJmdW5jdGlvbiIgPyByZWNlaXZlciAhPT0gc3RhdGUgfHwgIWYgOiAhc3RhdGUuaGFzKHJlY2VpdmVyKSkgdGhyb3cgbmV3IFR5cGVFcnJvcigiQ2Fubm90IHJlYWQgcHJpdmF0ZSBtZW1iZXIgZnJvbSBhbiBvYmplY3Qgd2hvc2UgY2xhc3MgZGlkIG5vdCBkZWNsYXJlIGl0Iik7DQogICAgcmV0dXJuIGtpbmQgPT09ICJtIiA/IGYgOiBraW5kID09PSAiYSIgPyBmLmNhbGwocmVjZWl2ZXIpIDogZiA/IGYudmFsdWUgOiBzdGF0ZS5nZXQocmVjZWl2ZXIpOw0KfTsNCnZhciBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0ID0gKHRoaXMgJiYgdGhpcy5fX2NsYXNzUHJpdmF0ZUZpZWxkU2V0KSB8fCBmdW5jdGlvbiAocmVjZWl2ZXIsIHN0YXRlLCB2YWx1ZSwga2luZCwgZikgew0KICAgIGlmIChraW5kID09PSAibSIpIHRocm93IG5ldyBUeXBlRXJyb3IoIlByaXZhdGUgbWV0aG9kIGlzIG5vdCB3cml0YWJsZSIpOw0KICAgIGlmIChraW5kID09PSAiYSIgJiYgIWYpIHRocm93IG5ldyBUeXBlRXJyb3IoIlByaXZhdGUgYWNjZXNzb3Igd2FzIGRlZmluZWQgd2l0aG91dCBhIHNldHRlciIpOw0KICAgIGlmICh0eXBlb2Ygc3RhdGUgPT09ICJmdW5jdGlvbiIgPyByZWNlaXZlciAhPT0gc3RhdGUgfHwgIWYgOiAhc3RhdGUuaGFzKHJlY2VpdmVyKSkgdGhyb3cgbmV3IFR5cGVFcnJvcigiQ2Fubm90IHdyaXRlIHByaXZhdGUgbWVtYmVyIHRvIGFuIG9iamVjdCB3aG9zZSBjbGFzcyBkaWQgbm90IGRlY2xhcmUgaXQiKTsNCiAgICByZXR1cm4gKGtpbmQgPT09ICJhIiA/IGYuY2FsbChyZWNlaXZlciwgdmFsdWUpIDogZiA/IGYudmFsdWUgPSB2YWx1ZSA6IHN0YXRlLnNldChyZWNlaXZlciwgdmFsdWUpKSwgdmFsdWU7DQp9Ow0KbGV0IEMgPSAoKCkgPT4gew0KICAgIHZhciBfQ19tZXRob2RfZ2V0LCBfQ194X2dldCwgX0NfeF9zZXQsIF9DX3ksIF9DX3pfYWNjZXNzb3Jfc3RvcmFnZSwgX0Nfel9nZXQsIF9DX3pfc2V0Ow0KICAgIGxldCBfY2xhc3NEZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICBsZXQgX2NsYXNzRGVzY3JpcHRvcjsNCiAgICBsZXQgX2NsYXNzRXh0cmFJbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX2NsYXNzVGhpczsNCiAgICBsZXQgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVjb3JhdG9yczsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX21ldGhvZF9kZXNjcmlwdG9yOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVjb3JhdG9yczsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX2dldF94X2Rlc2NyaXB0b3I7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZWNvcmF0b3JzOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVzY3JpcHRvcjsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3lfZGVjb3JhdG9yczsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3lfaW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV95X2V4dHJhSW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV96X2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV96X2luaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfel9leHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfel9kZXNjcmlwdG9yOw0KICAgIGxldCBfbWV0aG9kX2RlY29yYXRvcnM7DQogICAgbGV0IF9nZXRfeF9kZWNvcmF0b3JzOw0KICAgIGxldCBfc2V0X3hfZGVjb3JhdG9yczsNCiAgICBsZXQgX3lfZGVjb3JhdG9yczsNCiAgICBsZXQgX3lfaW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF95X2V4dHJhSW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF96X2RlY29yYXRvcnM7DQogICAgbGV0IF96X2luaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfel9leHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIHZhciBDID0gY2xhc3Mgew0KICAgICAgICBzdGF0aWMgeyBfY2xhc3NUaGlzID0gdGhpczsgfQ0KICAgICAgICBzdGF0aWMgeyBfX3NldEZ1bmN0aW9uTmFtZSh0aGlzLCAiQyIpOyB9DQogICAgICAgIHN0YXRpYyB7IF9DX21ldGhvZF9nZXQgPSBmdW5jdGlvbiBfQ19tZXRob2RfZ2V0KCkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX21ldGhvZF9kZXNjcmlwdG9yLnZhbHVlOyB9LCBfQ194X2dldCA9IGZ1bmN0aW9uIF9DX3hfZ2V0KCkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX2dldF94X2Rlc2NyaXB0b3IuZ2V0LmNhbGwodGhpcyk7IH0sIF9DX3hfc2V0ID0gZnVuY3Rpb24gX0NfeF9zZXQodmFsdWUpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZXNjcmlwdG9yLnNldC5jYWxsKHRoaXMsIHZhbHVlKTsgfSwgX0Nfel9nZXQgPSBmdW5jdGlvbiBfQ196X2dldCgpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3IuZ2V0LmNhbGwodGhpcyk7IH0sIF9DX3pfc2V0ID0gZnVuY3Rpb24gX0Nfel9zZXQodmFsdWUpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3Iuc2V0LmNhbGwodGhpcywgdmFsdWUpOyB9OyB9DQogICAgICAgIHN0YXRpYyB7DQogICAgICAgICAgICBjb25zdCBfbWV0YWRhdGEgPSB0eXBlb2YgU3ltYm9sID09PSAiZnVuY3Rpb24iICYmIFN5bWJvbC5tZXRhZGF0YSA/IE9iamVjdC5jcmVhdGUobnVsbCkgOiB2b2lkIDA7DQogICAgICAgICAgICBfbWV0aG9kX2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX2dldF94X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX3NldF94X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX3lfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfel9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgICAgIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfc3RhdGljX3ByaXZhdGVfeV9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgICAgIF9zdGF0aWNfcHJpdmF0ZV96X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVzY3JpcHRvciA9IHsgdmFsdWU6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICgpIHsgfSwgIiNtZXRob2QiKSB9LCBfc3RhdGljX3ByaXZhdGVfbWV0aG9kX2RlY29yYXRvcnMsIHsga2luZDogIm1ldGhvZCIsIG5hbWU6ICIjbWV0aG9kIiwgc3RhdGljOiB0cnVlLCBwcml2YXRlOiB0cnVlLCBhY2Nlc3M6IHsgaGFzOiBvYmogPT4gX19jbGFzc1ByaXZhdGVGaWVsZEluKF9jbGFzc1RoaXMsIG9iaiksIGdldDogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRHZXQob2JqLCBfY2xhc3NUaGlzLCAiYSIsIF9DX21ldGhvZF9nZXQpIH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgbnVsbCwgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZSh0aGlzLCBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVzY3JpcHRvciA9IHsgZ2V0OiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAoKSB7IHJldHVybiAxOyB9LCAiI3giLCAiZ2V0IikgfSwgX3N0YXRpY19wcml2YXRlX2dldF94X2RlY29yYXRvcnMsIHsga2luZDogImdldHRlciIsIG5hbWU6ICIjeCIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBnZXQ6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0KG9iaiwgX2NsYXNzVGhpcywgImEiLCBfQ194X2dldCkgfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZXNjcmlwdG9yID0geyBzZXQ6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICh2YWx1ZSkgeyB9LCAiI3giLCAic2V0IikgfSwgX3N0YXRpY19wcml2YXRlX3NldF94X2RlY29yYXRvcnMsIHsga2luZDogInNldHRlciIsIG5hbWU6ICIjeCIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBzZXQ6IChvYmosIHZhbHVlKSA9PiB7IF9fY2xhc3NQcml2YXRlRmllbGRTZXQob2JqLCBfY2xhc3NUaGlzLCB2YWx1ZSwgImEiLCBfQ194X3NldCk7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBudWxsLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3IgPSB7IGdldDogX19zZXRGdW5jdGlvbk5hbWUoZnVuY3Rpb24gKCkgeyByZXR1cm4gX19jbGFzc1ByaXZhdGVGaWVsZEdldCh0aGlzLCBfY2xhc3NUaGlzLCAiZiIsIF9DX3pfYWNjZXNzb3Jfc3RvcmFnZSk7IH0sICIjeiIsICJnZXQiKSwgc2V0OiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAodmFsdWUpIHsgX19jbGFzc1ByaXZhdGVGaWVsZFNldCh0aGlzLCBfY2xhc3NUaGlzLCB2YWx1ZSwgImYiLCBfQ196X2FjY2Vzc29yX3N0b3JhZ2UpOyB9LCAiI3oiLCAic2V0IikgfSwgX3N0YXRpY19wcml2YXRlX3pfZGVjb3JhdG9ycywgeyBraW5kOiAiYWNjZXNzb3IiLCBuYW1lOiAiI3oiLCBzdGF0aWM6IHRydWUsIHByaXZhdGU6IHRydWUsIGFjY2VzczogeyBoYXM6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkSW4oX2NsYXNzVGhpcywgb2JqKSwgZ2V0OiBvYmogPT4gX19jbGFzc1ByaXZhdGVGaWVsZEdldChvYmosIF9jbGFzc1RoaXMsICJhIiwgX0Nfel9nZXQpLCBzZXQ6IChvYmosIHZhbHVlKSA9PiB7IF9fY2xhc3NQcml2YXRlRmllbGRTZXQob2JqLCBfY2xhc3NUaGlzLCB2YWx1ZSwgImEiLCBfQ196X3NldCk7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBfc3RhdGljX3ByaXZhdGVfel9pbml0aWFsaXplcnMsIF9zdGF0aWNfcHJpdmF0ZV96X2V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZSh0aGlzLCBudWxsLCBfbWV0aG9kX2RlY29yYXRvcnMsIHsga2luZDogIm1ldGhvZCIsIG5hbWU6ICJtZXRob2QiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSwgYWNjZXNzOiB7IGhhczogb2JqID0+ICJtZXRob2QiIGluIG9iaiwgZ2V0OiBvYmogPT4gb2JqLm1ldGhvZCB9LCBtZXRhZGF0YTogX21ldGFkYXRhIH0sIG51bGwsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZSh0aGlzLCBudWxsLCBfZ2V0X3hfZGVjb3JhdG9ycywgeyBraW5kOiAiZ2V0dGVyIiwgbmFtZTogIngiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSwgYWNjZXNzOiB7IGhhczogb2JqID0+ICJ4IiBpbiBvYmosIGdldDogb2JqID0+IG9iai54IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgbnVsbCwgX2luc3RhbmNlRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIG51bGwsIF9zZXRfeF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJzZXR0ZXIiLCBuYW1lOiAieCIsIHN0YXRpYzogZmFsc2UsIHByaXZhdGU6IGZhbHNlLCBhY2Nlc3M6IHsgaGFzOiBvYmogPT4gIngiIGluIG9iaiwgc2V0OiAob2JqLCB2YWx1ZSkgPT4geyBvYmoueCA9IHZhbHVlOyB9IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgbnVsbCwgX2luc3RhbmNlRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIG51bGwsIF96X2RlY29yYXRvcnMsIHsga2luZDogImFjY2Vzc29yIiwgbmFtZTogInoiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSwgYWNjZXNzOiB7IGhhczogb2JqID0+ICJ6IiBpbiBvYmosIGdldDogb2JqID0+IG9iai56LCBzZXQ6IChvYmosIHZhbHVlKSA9PiB7IG9iai56ID0gdmFsdWU7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBfel9pbml0aWFsaXplcnMsIF96X2V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZShudWxsLCBudWxsLCBfc3RhdGljX3ByaXZhdGVfeV9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJmaWVsZCIsIG5hbWU6ICIjeSIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSwgYWNjZXNzOiB7IGhhczogb2JqID0+IF9fY2xhc3NQcml2YXRlRmllbGRJbihfY2xhc3NUaGlzLCBvYmopLCBnZXQ6IG9iaiA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0KG9iaiwgX2NsYXNzVGhpcywgImYiLCBfQ195KSwgc2V0OiAob2JqLCB2YWx1ZSkgPT4geyBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0KG9iaiwgX2NsYXNzVGhpcywgdmFsdWUsICJmIiwgX0NfeSk7IH0gfSwgbWV0YWRhdGE6IF9tZXRhZGF0YSB9LCBfc3RhdGljX3ByaXZhdGVfeV9pbml0aWFsaXplcnMsIF9zdGF0aWNfcHJpdmF0ZV95X2V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZShudWxsLCBudWxsLCBfeV9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJmaWVsZCIsIG5hbWU6ICJ5Iiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UsIGFjY2VzczogeyBoYXM6IG9iaiA9PiAieSIgaW4gb2JqLCBnZXQ6IG9iaiA9PiBvYmoueSwgc2V0OiAob2JqLCB2YWx1ZSkgPT4geyBvYmoueSA9IHZhbHVlOyB9IH0sIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgX3lfaW5pdGlhbGl6ZXJzLCBfeV9leHRyYUluaXRpYWxpemVycyk7DQogICAgICAgICAgICBfX2VzRGVjb3JhdGUobnVsbCwgX2NsYXNzRGVzY3JpcHRvciA9IHsgdmFsdWU6IF9jbGFzc1RoaXMgfSwgX2NsYXNzRGVjb3JhdG9ycywgeyBraW5kOiAiY2xhc3MiLCBuYW1lOiBfY2xhc3NUaGlzLm5hbWUsIG1ldGFkYXRhOiBfbWV0YWRhdGEgfSwgbnVsbCwgX2NsYXNzRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgQyA9IF9jbGFzc1RoaXMgPSBfY2xhc3NEZXNjcmlwdG9yLnZhbHVlOw0KICAgICAgICAgICAgaWYgKF9tZXRhZGF0YSkgT2JqZWN0LmRlZmluZVByb3BlcnR5KF9jbGFzc1RoaXMsIFN5bWJvbC5tZXRhZGF0YSwgeyBlbnVtZXJhYmxlOiB0cnVlLCBjb25maWd1cmFibGU6IHRydWUsIHdyaXRhYmxlOiB0cnVlLCB2YWx1ZTogX21ldGFkYXRhIH0pOw0KICAgICAgICB9DQogICAgICAgIG1ldGhvZCgpIHsgfQ0KICAgICAgICBnZXQgeCgpIHsgcmV0dXJuIDE7IH0NCiAgICAgICAgc2V0IHgodmFsdWUpIHsgfQ0KICAgICAgICB5ID0gKF9fcnVuSW5pdGlhbGl6ZXJzKHRoaXMsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKSwgX19ydW5Jbml0aWFsaXplcnModGhpcywgX3lfaW5pdGlhbGl6ZXJzLCAxKSk7DQogICAgICAgICN6X2FjY2Vzc29yX3N0b3JhZ2UgPSAoX19ydW5Jbml0aWFsaXplcnModGhpcywgX3lfZXh0cmFJbml0aWFsaXplcnMpLCBfX3J1bkluaXRpYWxpemVycyh0aGlzLCBfel9pbml0aWFsaXplcnMsIDEpKTsNCiAgICAgICAgZ2V0IHooKSB7IHJldHVybiB0aGlzLiN6X2FjY2Vzc29yX3N0b3JhZ2U7IH0NCiAgICAgICAgc2V0IHoodmFsdWUpIHsgdGhpcy4jel9hY2Nlc3Nvcl9zdG9yYWdlID0gdmFsdWU7IH0NCiAgICAgICAgc3RhdGljIHsNCiAgICAgICAgICAgIF9DX3kgPSB7IHZhbHVlOiAoX19ydW5Jbml0aWFsaXplcnMoX2NsYXNzVGhpcywgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzKSwgX19ydW5Jbml0aWFsaXplcnMoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX3lfaW5pdGlhbGl6ZXJzLCAxKSkgfTsNCiAgICAgICAgfQ0KICAgICAgICBzdGF0aWMgew0KICAgICAgICAgICAgX0Nfel9hY2Nlc3Nvcl9zdG9yYWdlID0geyB2YWx1ZTogKF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9zdGF0aWNfcHJpdmF0ZV95X2V4dHJhSW5pdGlhbGl6ZXJzKSwgX19ydW5Jbml0aWFsaXplcnMoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX3pfaW5pdGlhbGl6ZXJzLCAxKSkgfTsNCiAgICAgICAgfQ0KICAgICAgICBjb25zdHJ1Y3RvcigpIHsNCiAgICAgICAgICAgIF9fcnVuSW5pdGlhbGl6ZXJzKHRoaXMsIF96X2V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgfQ0KICAgICAgICBzdGF0aWMgew0KICAgICAgICAgICAgX19ydW5Jbml0aWFsaXplcnMoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX3pfZXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19ydW5Jbml0aWFsaXplcnMoX2NsYXNzVGhpcywgX2NsYXNzRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICB9DQogICAgfTsNCiAgICByZXR1cm4gQyA9IF9jbGFzc1RoaXM7DQp9KSgpOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmpzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0lBSU0sQ0FBQzs7NEJBRk4sR0FBRyxFQUNILEdBQUc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7a0NBRUMsR0FBRyxFQUNILEdBQUc7aUNBR0gsR0FBRyxFQUNILEdBQUc7aUNBR0gsR0FBRyxFQUNILEdBQUc7NkJBR0gsR0FBRyxFQUNILEdBQUc7NkJBR0gsR0FBRyxFQUNILEdBQUc7aURBR0gsR0FBRyxFQUNILEdBQUc7Z0RBR0gsR0FBRyxFQUNILEdBQUc7Z0RBR0gsR0FBRyxFQUNILEdBQUc7NENBR0gsR0FBRyxFQUNILEdBQUc7NENBR0gsR0FBRyxFQUNILEdBQUc7WUFmSix5REFBQSx5QkFBQSxjQUFrQixDQUFDLFlBQUEsdVNBQUE7WUFJbkIsd0RBQUEsdUJBQUEsY0FBa0IsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLGNBQUEsNFJBQUE7WUFJN0Isd0RBQUEsdUJBQUEsVUFBYyxLQUFhLElBQUksQ0FBQyxjQUFBLGlUQUFBO1lBUWhDLG9EQUFBLHVCQUFBLDRGQUF1QixjQUFBLEVBQXZCLHVCQUFBLGlHQUF1QixjQUFBLHdaQUFBO1lBcEN2QixxS0FBQSxNQUFNLDZEQUFLO1lBSVgsMEpBQUksQ0FBQyw2REFBZ0I7WUFJckIscUtBQUksQ0FBQyx3RUFBbUI7WUFReEIsd0pBQVMsQ0FBQyw2QkFBRCxDQUFDLDZFQUFLO1lBZ0JmLGthQUFjO1lBcEJkLHFKQUFBLENBQUMsNkJBQUQsQ0FBQyw2RUFBSztZQWZWLDZLQXdDQzs7OztRQXJDRyxNQUFNLEtBQUksQ0FBQztRQUlYLElBQUksQ0FBQyxLQUFLLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUlyQixJQUFJLENBQUMsQ0FBQyxLQUFhLElBQUksQ0FBQztRQUl4QixDQUFDLElBZkMsbURBQUMsMkNBZUMsQ0FBQyxHQUFDO1FBSU4sK0dBQWEsQ0FBQyxHQUFDO1FBQWYsSUFBUyxDQUFDLHVDQUFLO1FBQWYsSUFBUyxDQUFDLDZDQUFLOztZQWdCUixpQkFuQ0wsdURBQUMsZ0VBbUNTLENBQUMsSUFBSixDQUFLOzs7WUFJRSxvS0FBSyxDQUFDLElBQUosQ0FBSzs7Ozs7OztZQXZDckIsdURBQUMifQ==,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7CgpAZGVjCkBkZWMKY2xhc3MgQyB7CiAgICBAZGVjCiAgICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== //// [esDecorators-classDeclaration-sourceMap.d.ts.map] {"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt index 4fdfa66c408de..fe77eaedd8bbc 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt @@ -8,6 +8,13 @@ sources: esDecorators-classDeclaration-sourceMap.ts emittedFile:esDecorators-classDeclaration-sourceMap.js sourceFile:esDecorators-classDeclaration-sourceMap.ts ------------------------------------------------------------------- +>>>var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { +>>> var useValue = arguments.length > 2; +>>> for (var i = 0; i < initializers.length; i++) { +>>> value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); +>>> } +>>> return useValue ? value : void 0; +>>>}; >>>var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { >>> function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } >>> var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -35,13 +42,6 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts >>> if (target) Object.defineProperty(target, contextIn.name, descriptor); >>> done = true; >>>}; ->>>var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { ->>> var useValue = arguments.length > 2; ->>> for (var i = 0; i < initializers.length; i++) { ->>> value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); ->>> } ->>> return useValue ? value : void 0; ->>>}; >>>var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { >>> if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; >>> return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); @@ -103,16 +103,20 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts >>> let _static_private_set_x_descriptor; >>> let _static_private_y_decorators; >>> let _static_private_y_initializers = []; +>>> let _static_private_y_extraInitializers = []; >>> let _static_private_z_decorators; >>> let _static_private_z_initializers = []; +>>> let _static_private_z_extraInitializers = []; >>> let _static_private_z_descriptor; >>> let _method_decorators; >>> let _get_x_decorators; >>> let _set_x_decorators; >>> let _y_decorators; >>> let _y_initializers = []; +>>> let _y_extraInitializers = []; >>> let _z_decorators; >>> let _z_initializers = []; +>>> let _z_extraInitializers = []; >>> var C = class { >>> static { _classThis = this; } >>> static { __setFunctionName(this, "C"); } @@ -132,10 +136,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1 >Emitted(86, 35) Source(6, 6) + SourceIndex(0) -2 >Emitted(86, 38) Source(6, 9) + SourceIndex(0) -3 >Emitted(86, 40) Source(7, 6) + SourceIndex(0) -4 >Emitted(86, 43) Source(7, 9) + SourceIndex(0) +1 >Emitted(90, 35) Source(6, 6) + SourceIndex(0) +2 >Emitted(90, 38) Source(6, 9) + SourceIndex(0) +3 >Emitted(90, 40) Source(7, 6) + SourceIndex(0) +4 >Emitted(90, 43) Source(7, 9) + SourceIndex(0) --- >>> _get_x_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -151,10 +155,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(87, 34) Source(10, 6) + SourceIndex(0) -2 >Emitted(87, 37) Source(10, 9) + SourceIndex(0) -3 >Emitted(87, 39) Source(11, 6) + SourceIndex(0) -4 >Emitted(87, 42) Source(11, 9) + SourceIndex(0) +1->Emitted(91, 34) Source(10, 6) + SourceIndex(0) +2 >Emitted(91, 37) Source(10, 9) + SourceIndex(0) +3 >Emitted(91, 39) Source(11, 6) + SourceIndex(0) +4 >Emitted(91, 42) Source(11, 9) + SourceIndex(0) --- >>> _set_x_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -169,10 +173,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(88, 34) Source(14, 6) + SourceIndex(0) -2 >Emitted(88, 37) Source(14, 9) + SourceIndex(0) -3 >Emitted(88, 39) Source(15, 6) + SourceIndex(0) -4 >Emitted(88, 42) Source(15, 9) + SourceIndex(0) +1->Emitted(92, 34) Source(14, 6) + SourceIndex(0) +2 >Emitted(92, 37) Source(14, 9) + SourceIndex(0) +3 >Emitted(92, 39) Source(15, 6) + SourceIndex(0) +4 >Emitted(92, 42) Source(15, 9) + SourceIndex(0) --- >>> _y_decorators = [dec, dec]; 1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -188,10 +192,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1 >Emitted(89, 30) Source(18, 6) + SourceIndex(0) -2 >Emitted(89, 33) Source(18, 9) + SourceIndex(0) -3 >Emitted(89, 35) Source(19, 6) + SourceIndex(0) -4 >Emitted(89, 38) Source(19, 9) + SourceIndex(0) +1 >Emitted(93, 30) Source(18, 6) + SourceIndex(0) +2 >Emitted(93, 33) Source(18, 9) + SourceIndex(0) +3 >Emitted(93, 35) Source(19, 6) + SourceIndex(0) +4 >Emitted(93, 38) Source(19, 9) + SourceIndex(0) --- >>> _z_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -207,10 +211,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(90, 30) Source(22, 6) + SourceIndex(0) -2 >Emitted(90, 33) Source(22, 9) + SourceIndex(0) -3 >Emitted(90, 35) Source(23, 6) + SourceIndex(0) -4 >Emitted(90, 38) Source(23, 9) + SourceIndex(0) +1->Emitted(94, 30) Source(22, 6) + SourceIndex(0) +2 >Emitted(94, 33) Source(22, 9) + SourceIndex(0) +3 >Emitted(94, 35) Source(23, 6) + SourceIndex(0) +4 >Emitted(94, 38) Source(23, 9) + SourceIndex(0) --- >>> _static_private_method_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -226,10 +230,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(91, 50) Source(26, 6) + SourceIndex(0) -2 >Emitted(91, 53) Source(26, 9) + SourceIndex(0) -3 >Emitted(91, 55) Source(27, 6) + SourceIndex(0) -4 >Emitted(91, 58) Source(27, 9) + SourceIndex(0) +1->Emitted(95, 50) Source(26, 6) + SourceIndex(0) +2 >Emitted(95, 53) Source(26, 9) + SourceIndex(0) +3 >Emitted(95, 55) Source(27, 6) + SourceIndex(0) +4 >Emitted(95, 58) Source(27, 9) + SourceIndex(0) --- >>> _static_private_get_x_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -245,10 +249,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(92, 49) Source(30, 6) + SourceIndex(0) -2 >Emitted(92, 52) Source(30, 9) + SourceIndex(0) -3 >Emitted(92, 54) Source(31, 6) + SourceIndex(0) -4 >Emitted(92, 57) Source(31, 9) + SourceIndex(0) +1->Emitted(96, 49) Source(30, 6) + SourceIndex(0) +2 >Emitted(96, 52) Source(30, 9) + SourceIndex(0) +3 >Emitted(96, 54) Source(31, 6) + SourceIndex(0) +4 >Emitted(96, 57) Source(31, 9) + SourceIndex(0) --- >>> _static_private_set_x_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -263,10 +267,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(93, 49) Source(34, 6) + SourceIndex(0) -2 >Emitted(93, 52) Source(34, 9) + SourceIndex(0) -3 >Emitted(93, 54) Source(35, 6) + SourceIndex(0) -4 >Emitted(93, 57) Source(35, 9) + SourceIndex(0) +1->Emitted(97, 49) Source(34, 6) + SourceIndex(0) +2 >Emitted(97, 52) Source(34, 9) + SourceIndex(0) +3 >Emitted(97, 54) Source(35, 6) + SourceIndex(0) +4 >Emitted(97, 57) Source(35, 9) + SourceIndex(0) --- >>> _static_private_y_decorators = [dec, dec]; 1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -282,10 +286,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1 >Emitted(94, 45) Source(38, 6) + SourceIndex(0) -2 >Emitted(94, 48) Source(38, 9) + SourceIndex(0) -3 >Emitted(94, 50) Source(39, 6) + SourceIndex(0) -4 >Emitted(94, 53) Source(39, 9) + SourceIndex(0) +1 >Emitted(98, 45) Source(38, 6) + SourceIndex(0) +2 >Emitted(98, 48) Source(38, 9) + SourceIndex(0) +3 >Emitted(98, 50) Source(39, 6) + SourceIndex(0) +4 >Emitted(98, 53) Source(39, 9) + SourceIndex(0) --- >>> _static_private_z_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -301,10 +305,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > > @ 4 > dec -1->Emitted(95, 45) Source(42, 6) + SourceIndex(0) -2 >Emitted(95, 48) Source(42, 9) + SourceIndex(0) -3 >Emitted(95, 50) Source(43, 6) + SourceIndex(0) -4 >Emitted(95, 53) Source(43, 9) + SourceIndex(0) +1->Emitted(99, 45) Source(42, 6) + SourceIndex(0) +2 >Emitted(99, 48) Source(42, 9) + SourceIndex(0) +3 >Emitted(99, 50) Source(43, 6) + SourceIndex(0) +4 >Emitted(99, 53) Source(43, 9) + SourceIndex(0) --- >>> __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_method_get) }, metadata: _metadata }, null, _staticExtraInitializers); 1->^^^^^^^^^^^^ @@ -321,13 +325,13 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 5 > } 6 > 7 > -1->Emitted(96, 13) Source(28, 5) + SourceIndex(0) -2 >Emitted(96, 70) Source(28, 5) + SourceIndex(0) -3 >Emitted(96, 95) Source(28, 5) + SourceIndex(0) -4 >Emitted(96, 109) Source(28, 23) + SourceIndex(0) -5 >Emitted(96, 110) Source(28, 24) + SourceIndex(0) -6 >Emitted(96, 122) Source(28, 24) + SourceIndex(0) -7 >Emitted(96, 417) Source(28, 24) + SourceIndex(0) +1->Emitted(100, 13) Source(28, 5) + SourceIndex(0) +2 >Emitted(100, 70) Source(28, 5) + SourceIndex(0) +3 >Emitted(100, 95) Source(28, 5) + SourceIndex(0) +4 >Emitted(100, 109) Source(28, 23) + SourceIndex(0) +5 >Emitted(100, 110) Source(28, 24) + SourceIndex(0) +6 >Emitted(100, 122) Source(28, 24) + SourceIndex(0) +7 >Emitted(100, 417) Source(28, 24) + SourceIndex(0) --- >>> __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_x_get) }, metadata: _metadata }, null, _staticExtraInitializers); 1 >^^^^^^^^^^^^ @@ -357,17 +361,17 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 9 > } 10> 11> -1 >Emitted(97, 13) Source(32, 5) + SourceIndex(0) -2 >Emitted(97, 69) Source(32, 5) + SourceIndex(0) -3 >Emitted(97, 92) Source(32, 5) + SourceIndex(0) -4 >Emitted(97, 106) Source(32, 23) + SourceIndex(0) -5 >Emitted(97, 113) Source(32, 30) + SourceIndex(0) -6 >Emitted(97, 114) Source(32, 31) + SourceIndex(0) -7 >Emitted(97, 115) Source(32, 32) + SourceIndex(0) -8 >Emitted(97, 116) Source(32, 33) + SourceIndex(0) -9 >Emitted(97, 117) Source(32, 34) + SourceIndex(0) -10>Emitted(97, 131) Source(32, 34) + SourceIndex(0) -11>Emitted(97, 415) Source(32, 34) + SourceIndex(0) +1 >Emitted(101, 13) Source(32, 5) + SourceIndex(0) +2 >Emitted(101, 69) Source(32, 5) + SourceIndex(0) +3 >Emitted(101, 92) Source(32, 5) + SourceIndex(0) +4 >Emitted(101, 106) Source(32, 23) + SourceIndex(0) +5 >Emitted(101, 113) Source(32, 30) + SourceIndex(0) +6 >Emitted(101, 114) Source(32, 31) + SourceIndex(0) +7 >Emitted(101, 115) Source(32, 32) + SourceIndex(0) +8 >Emitted(101, 116) Source(32, 33) + SourceIndex(0) +9 >Emitted(101, 117) Source(32, 34) + SourceIndex(0) +10>Emitted(101, 131) Source(32, 34) + SourceIndex(0) +11>Emitted(101, 415) Source(32, 34) + SourceIndex(0) --- >>> __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_x_set); } }, metadata: _metadata }, null, _staticExtraInitializers); 1->^^^^^^^^^^^^ @@ -379,7 +383,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ^ 8 > ^^^^^^^^^^^^^^ 9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -393,17 +397,17 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > } 8 > 9 > -1->Emitted(98, 13) Source(36, 5) + SourceIndex(0) -2 >Emitted(98, 69) Source(36, 5) + SourceIndex(0) -3 >Emitted(98, 92) Source(36, 5) + SourceIndex(0) -4 >Emitted(98, 102) Source(36, 19) + SourceIndex(0) -5 >Emitted(98, 107) Source(36, 32) + SourceIndex(0) -6 >Emitted(98, 111) Source(36, 36) + SourceIndex(0) -7 >Emitted(98, 112) Source(36, 37) + SourceIndex(0) -8 >Emitted(98, 126) Source(36, 37) + SourceIndex(0) -9 >Emitted(98, 431) Source(36, 37) + SourceIndex(0) +1->Emitted(102, 13) Source(36, 5) + SourceIndex(0) +2 >Emitted(102, 69) Source(36, 5) + SourceIndex(0) +3 >Emitted(102, 92) Source(36, 5) + SourceIndex(0) +4 >Emitted(102, 102) Source(36, 19) + SourceIndex(0) +5 >Emitted(102, 107) Source(36, 32) + SourceIndex(0) +6 >Emitted(102, 111) Source(36, 36) + SourceIndex(0) +7 >Emitted(102, 112) Source(36, 37) + SourceIndex(0) +8 >Emitted(102, 126) Source(36, 37) + SourceIndex(0) +9 >Emitted(102, 431) Source(36, 37) + SourceIndex(0) --- ->>> __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _staticExtraInitializers); +>>> __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _static_private_z_extraInitializers); 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ @@ -413,7 +417,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ^^^^^^^^^^^^^^^^^^^^^^^ 8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 > ^^^^^^^^^^^^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -432,16 +436,16 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 8 > static accessor #z = 1; 9 > 10> -1->Emitted(99, 13) Source(44, 5) + SourceIndex(0) -2 >Emitted(99, 65) Source(44, 5) + SourceIndex(0) -3 >Emitted(99, 88) Source(44, 5) + SourceIndex(0) -4 >Emitted(99, 180) Source(44, 28) + SourceIndex(0) -5 >Emitted(99, 194) Source(44, 28) + SourceIndex(0) -6 >Emitted(99, 196) Source(44, 5) + SourceIndex(0) -7 >Emitted(99, 219) Source(44, 5) + SourceIndex(0) -8 >Emitted(99, 316) Source(44, 28) + SourceIndex(0) -9 >Emitted(99, 330) Source(44, 28) + SourceIndex(0) -10>Emitted(99, 727) Source(44, 28) + SourceIndex(0) +1->Emitted(103, 13) Source(44, 5) + SourceIndex(0) +2 >Emitted(103, 65) Source(44, 5) + SourceIndex(0) +3 >Emitted(103, 88) Source(44, 5) + SourceIndex(0) +4 >Emitted(103, 180) Source(44, 28) + SourceIndex(0) +5 >Emitted(103, 194) Source(44, 28) + SourceIndex(0) +6 >Emitted(103, 196) Source(44, 5) + SourceIndex(0) +7 >Emitted(103, 219) Source(44, 5) + SourceIndex(0) +8 >Emitted(103, 316) Source(44, 28) + SourceIndex(0) +9 >Emitted(103, 330) Source(44, 28) + SourceIndex(0) +10>Emitted(103, 738) Source(44, 28) + SourceIndex(0) --- >>> __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); 1 >^^^^^^^^^^^^ @@ -452,10 +456,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > 3 > method 4 > () {} -1 >Emitted(100, 13) Source(8, 5) + SourceIndex(0) -2 >Emitted(100, 178) Source(8, 5) + SourceIndex(0) -3 >Emitted(100, 184) Source(8, 11) + SourceIndex(0) -4 >Emitted(100, 245) Source(8, 16) + SourceIndex(0) +1 >Emitted(104, 13) Source(8, 5) + SourceIndex(0) +2 >Emitted(104, 178) Source(8, 5) + SourceIndex(0) +3 >Emitted(104, 184) Source(8, 11) + SourceIndex(0) +4 >Emitted(104, 245) Source(8, 16) + SourceIndex(0) --- >>> __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, get: obj => obj.x }, metadata: _metadata }, null, _instanceExtraInitializers); 1 >^^^^^^^^^^^^ @@ -471,17 +475,17 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > get 3 > x 4 > () { return 1; } -1 >Emitted(101, 13) Source(12, 5) + SourceIndex(0) -2 >Emitted(101, 167) Source(12, 9) + SourceIndex(0) -3 >Emitted(101, 168) Source(12, 10) + SourceIndex(0) -4 >Emitted(101, 229) Source(12, 26) + SourceIndex(0) +1 >Emitted(105, 13) Source(12, 5) + SourceIndex(0) +2 >Emitted(105, 167) Source(12, 9) + SourceIndex(0) +3 >Emitted(105, 168) Source(12, 10) + SourceIndex(0) +4 >Emitted(105, 229) Source(12, 26) + SourceIndex(0) --- >>> __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^ 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -490,19 +494,19 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > set 3 > x 4 > (value: number) { } -1->Emitted(102, 13) Source(16, 5) + SourceIndex(0) -2 >Emitted(102, 178) Source(16, 9) + SourceIndex(0) -3 >Emitted(102, 179) Source(16, 10) + SourceIndex(0) -4 >Emitted(102, 251) Source(16, 29) + SourceIndex(0) +1->Emitted(106, 13) Source(16, 5) + SourceIndex(0) +2 >Emitted(106, 178) Source(16, 9) + SourceIndex(0) +3 >Emitted(106, 179) Source(16, 10) + SourceIndex(0) +4 >Emitted(106, 251) Source(16, 29) + SourceIndex(0) --- ->>> __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _instanceExtraInitializers); +>>> __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _z_extraInitializers); 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^ 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -517,16 +521,16 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 4 > 5 > z 6 > = 1; -1->Emitted(103, 13) Source(24, 5) + SourceIndex(0) -2 >Emitted(103, 165) Source(24, 14) + SourceIndex(0) -3 >Emitted(103, 166) Source(24, 15) + SourceIndex(0) -4 >Emitted(103, 195) Source(24, 14) + SourceIndex(0) -5 >Emitted(103, 196) Source(24, 15) + SourceIndex(0) -6 >Emitted(103, 279) Source(24, 20) + SourceIndex(0) +1->Emitted(107, 13) Source(24, 5) + SourceIndex(0) +2 >Emitted(107, 165) Source(24, 14) + SourceIndex(0) +3 >Emitted(107, 166) Source(24, 15) + SourceIndex(0) +4 >Emitted(107, 195) Source(24, 14) + SourceIndex(0) +5 >Emitted(107, 196) Source(24, 15) + SourceIndex(0) +6 >Emitted(107, 273) Source(24, 20) + SourceIndex(0) --- ->>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _staticExtraInitializers); +>>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _static_private_y_extraInitializers); 1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -545,28 +549,28 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > 2 > static #y = 1; -1->Emitted(104, 13) Source(40, 5) + SourceIndex(0) -2 >Emitted(104, 420) Source(40, 19) + SourceIndex(0) +1->Emitted(108, 13) Source(40, 5) + SourceIndex(0) +2 >Emitted(108, 431) Source(40, 19) + SourceIndex(0) --- ->>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); +>>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); 1 >^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^ 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > 2 > 3 > y 4 > 5 > y 6 > = 1; -1 >Emitted(105, 13) Source(20, 5) + SourceIndex(0) -2 >Emitted(105, 162) Source(20, 5) + SourceIndex(0) -3 >Emitted(105, 163) Source(20, 6) + SourceIndex(0) -4 >Emitted(105, 192) Source(20, 5) + SourceIndex(0) -5 >Emitted(105, 193) Source(20, 6) + SourceIndex(0) -6 >Emitted(105, 276) Source(20, 11) + SourceIndex(0) +1 >Emitted(109, 13) Source(20, 5) + SourceIndex(0) +2 >Emitted(109, 162) Source(20, 5) + SourceIndex(0) +3 >Emitted(109, 163) Source(20, 6) + SourceIndex(0) +4 >Emitted(109, 192) Source(20, 5) + SourceIndex(0) +5 >Emitted(109, 193) Source(20, 6) + SourceIndex(0) +6 >Emitted(109, 270) Source(20, 11) + SourceIndex(0) --- >>> __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); 1 >^^^^^^^^^^^^ @@ -613,19 +617,11 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > static accessor #z = 1; > } -1 >Emitted(106, 13) Source(5, 1) + SourceIndex(0) -2 >Emitted(106, 186) Source(45, 2) + SourceIndex(0) +1 >Emitted(110, 13) Source(5, 1) + SourceIndex(0) +2 >Emitted(110, 186) Source(45, 2) + SourceIndex(0) --- >>> C = _classThis = _classDescriptor.value; >>> if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); ->>> __runInitializers(_classThis, _staticExtraInitializers); -1 >^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 > -2 > C -1 >Emitted(109, 13) Source(5, 7) + SourceIndex(0) -2 >Emitted(109, 69) Source(5, 8) + SourceIndex(0) ---- >>> } >>> method() { } 1 >^^^^^^^^ @@ -633,17 +629,14 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > ^^^^^ 4 > ^ 5 > ^^^^^^^^^^-> -1 > { - > @dec - > @dec - > +1 > 2 > method 3 > () { 4 > } -1 >Emitted(111, 9) Source(8, 5) + SourceIndex(0) -2 >Emitted(111, 15) Source(8, 11) + SourceIndex(0) -3 >Emitted(111, 20) Source(8, 15) + SourceIndex(0) -4 >Emitted(111, 21) Source(8, 16) + SourceIndex(0) +1 >Emitted(114, 9) Source(8, 5) + SourceIndex(0) +2 >Emitted(114, 15) Source(8, 11) + SourceIndex(0) +3 >Emitted(114, 20) Source(8, 15) + SourceIndex(0) +4 >Emitted(114, 21) Source(8, 16) + SourceIndex(0) --- >>> get x() { return 1; } 1->^^^^^^^^ @@ -668,15 +661,15 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ; 8 > 9 > } -1->Emitted(112, 9) Source(12, 5) + SourceIndex(0) -2 >Emitted(112, 13) Source(12, 9) + SourceIndex(0) -3 >Emitted(112, 14) Source(12, 10) + SourceIndex(0) -4 >Emitted(112, 19) Source(12, 15) + SourceIndex(0) -5 >Emitted(112, 26) Source(12, 22) + SourceIndex(0) -6 >Emitted(112, 27) Source(12, 23) + SourceIndex(0) -7 >Emitted(112, 28) Source(12, 24) + SourceIndex(0) -8 >Emitted(112, 29) Source(12, 25) + SourceIndex(0) -9 >Emitted(112, 30) Source(12, 26) + SourceIndex(0) +1->Emitted(115, 9) Source(12, 5) + SourceIndex(0) +2 >Emitted(115, 13) Source(12, 9) + SourceIndex(0) +3 >Emitted(115, 14) Source(12, 10) + SourceIndex(0) +4 >Emitted(115, 19) Source(12, 15) + SourceIndex(0) +5 >Emitted(115, 26) Source(12, 22) + SourceIndex(0) +6 >Emitted(115, 27) Source(12, 23) + SourceIndex(0) +7 >Emitted(115, 28) Source(12, 24) + SourceIndex(0) +8 >Emitted(115, 29) Source(12, 25) + SourceIndex(0) +9 >Emitted(115, 30) Source(12, 26) + SourceIndex(0) --- >>> set x(value) { } 1 >^^^^^^^^ @@ -698,52 +691,74 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 5 > value: number 6 > ) { 7 > } -1 >Emitted(113, 9) Source(16, 5) + SourceIndex(0) -2 >Emitted(113, 13) Source(16, 9) + SourceIndex(0) -3 >Emitted(113, 14) Source(16, 10) + SourceIndex(0) -4 >Emitted(113, 15) Source(16, 11) + SourceIndex(0) -5 >Emitted(113, 20) Source(16, 24) + SourceIndex(0) -6 >Emitted(113, 24) Source(16, 28) + SourceIndex(0) -7 >Emitted(113, 25) Source(16, 29) + SourceIndex(0) +1 >Emitted(116, 9) Source(16, 5) + SourceIndex(0) +2 >Emitted(116, 13) Source(16, 9) + SourceIndex(0) +3 >Emitted(116, 14) Source(16, 10) + SourceIndex(0) +4 >Emitted(116, 15) Source(16, 11) + SourceIndex(0) +5 >Emitted(116, 20) Source(16, 24) + SourceIndex(0) +6 >Emitted(116, 24) Source(16, 28) + SourceIndex(0) +7 >Emitted(116, 25) Source(16, 29) + SourceIndex(0) --- >>> y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); 1->^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^ +3 > ^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^ +7 > ^^^ +8 > ^^^^^^^^^^^^^-> 1-> > > @dec > @dec > 2 > y -3 > = -4 > 1 -5 > ; -1->Emitted(114, 9) Source(20, 5) + SourceIndex(0) -2 >Emitted(114, 10) Source(20, 6) + SourceIndex(0) -3 >Emitted(114, 108) Source(20, 9) + SourceIndex(0) -4 >Emitted(114, 109) Source(20, 10) + SourceIndex(0) -5 >Emitted(114, 112) Source(20, 11) + SourceIndex(0) +3 > +4 > C +5 > { + > @dec + > @dec + > method() {} + > + > @dec + > @dec + > get x() { return 1; } + > + > @dec + > @dec + > set x(value: number) { } + > + > @dec + > @dec + > y = +6 > 1 +7 > ; +1->Emitted(117, 9) Source(20, 5) + SourceIndex(0) +2 >Emitted(117, 10) Source(20, 6) + SourceIndex(0) +3 >Emitted(117, 14) Source(5, 7) + SourceIndex(0) +4 >Emitted(117, 65) Source(5, 8) + SourceIndex(0) +5 >Emitted(117, 108) Source(20, 9) + SourceIndex(0) +6 >Emitted(117, 109) Source(20, 10) + SourceIndex(0) +7 >Emitted(117, 112) Source(20, 11) + SourceIndex(0) --- ->>> #z_accessor_storage = __runInitializers(this, _z_initializers, 1); -1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^ -1 > +>>> #z_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1)); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^ +1-> > > @dec > @dec > 2 > accessor z = -3 > 1 -4 > ; -1 >Emitted(115, 9) Source(24, 5) + SourceIndex(0) -2 >Emitted(115, 72) Source(24, 18) + SourceIndex(0) -3 >Emitted(115, 73) Source(24, 19) + SourceIndex(0) -4 >Emitted(115, 75) Source(24, 20) + SourceIndex(0) +3 > 1 +4 > ; +1->Emitted(118, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(118, 120) Source(24, 18) + SourceIndex(0) +3 >Emitted(118, 121) Source(24, 19) + SourceIndex(0) +4 >Emitted(118, 124) Source(24, 20) + SourceIndex(0) --- >>> get z() { return this.#z_accessor_storage; } 1 >^^^^^^^^ @@ -755,10 +770,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > accessor 3 > z 4 > = 1; -1 >Emitted(116, 9) Source(24, 5) + SourceIndex(0) -2 >Emitted(116, 13) Source(24, 14) + SourceIndex(0) -3 >Emitted(116, 14) Source(24, 15) + SourceIndex(0) -4 >Emitted(116, 53) Source(24, 20) + SourceIndex(0) +1 >Emitted(119, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(119, 13) Source(24, 14) + SourceIndex(0) +3 >Emitted(119, 14) Source(24, 15) + SourceIndex(0) +4 >Emitted(119, 53) Source(24, 20) + SourceIndex(0) --- >>> set z(value) { this.#z_accessor_storage = value; } 1->^^^^^^^^ @@ -769,18 +784,20 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > accessor 3 > z 4 > = 1; -1->Emitted(117, 9) Source(24, 5) + SourceIndex(0) -2 >Emitted(117, 13) Source(24, 14) + SourceIndex(0) -3 >Emitted(117, 14) Source(24, 15) + SourceIndex(0) -4 >Emitted(117, 59) Source(24, 20) + SourceIndex(0) +1->Emitted(120, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(120, 13) Source(24, 14) + SourceIndex(0) +3 >Emitted(120, 14) Source(24, 15) + SourceIndex(0) +4 >Emitted(120, 59) Source(24, 20) + SourceIndex(0) --- >>> static { ->>> _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; +>>> _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }; 1 >^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^ +7 > ^ 1 > > > @dec @@ -798,48 +815,91 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > @dec > static -2 > #y = -3 > 1 -4 > -5 > = 1; -1 >Emitted(119, 13) Source(40, 12) + SourceIndex(0) -2 >Emitted(119, 91) Source(40, 17) + SourceIndex(0) -3 >Emitted(119, 92) Source(40, 18) + SourceIndex(0) -4 >Emitted(119, 95) Source(40, 14) + SourceIndex(0) -5 >Emitted(119, 96) Source(40, 19) + SourceIndex(0) +2 > +3 > C +4 > { + > @dec + > @dec + > method() {} + > + > @dec + > @dec + > get x() { return 1; } + > + > @dec + > @dec + > set x(value: number) { } + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > accessor z = 1; + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > static #y = +5 > 1 +6 > +7 > = 1; +1 >Emitted(122, 13) Source(40, 12) + SourceIndex(0) +2 >Emitted(122, 30) Source(5, 7) + SourceIndex(0) +3 >Emitted(122, 85) Source(5, 8) + SourceIndex(0) +4 >Emitted(122, 149) Source(40, 17) + SourceIndex(0) +5 >Emitted(122, 150) Source(40, 18) + SourceIndex(0) +6 >Emitted(122, 154) Source(40, 14) + SourceIndex(0) +7 >Emitted(122, 155) Source(40, 19) + SourceIndex(0) --- >>> } >>> static { ->>> _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; +>>> _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }; 1 >^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^ +5 > ^ 1 > > > @dec > @dec > static accessor 2 > #z = -3 > 1 -4 > -5 > = 1; -1 >Emitted(122, 13) Source(44, 21) + SourceIndex(0) -2 >Emitted(122, 108) Source(44, 26) + SourceIndex(0) -3 >Emitted(122, 109) Source(44, 27) + SourceIndex(0) -4 >Emitted(122, 112) Source(44, 23) + SourceIndex(0) -5 >Emitted(122, 113) Source(44, 28) + SourceIndex(0) +3 > 1 +4 > +5 > = 1; +1 >Emitted(125, 13) Source(44, 21) + SourceIndex(0) +2 >Emitted(125, 177) Source(44, 26) + SourceIndex(0) +3 >Emitted(125, 178) Source(44, 27) + SourceIndex(0) +4 >Emitted(125, 182) Source(44, 23) + SourceIndex(0) +5 >Emitted(125, 183) Source(44, 28) + SourceIndex(0) --- >>> } +>>> constructor() { +>>> __runInitializers(this, _z_extraInitializers); +>>> } >>> static { +>>> __runInitializers(_classThis, _static_private_z_extraInitializers); >>> __runInitializers(_classThis, _classExtraInitializers); 1 >^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > 2 > C -1 >Emitted(125, 13) Source(5, 7) + SourceIndex(0) -2 >Emitted(125, 68) Source(5, 8) + SourceIndex(0) +1 >Emitted(132, 13) Source(5, 7) + SourceIndex(0) +2 >Emitted(132, 68) Source(5, 8) + SourceIndex(0) --- >>> } >>> }; diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js index 3f5e06eebe75f..22d5cc52f88d8 100644 --- a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js @@ -102,22 +102,21 @@ class C { let _static_private_set_x_descriptor; let _static_private_y_decorators; let _static_private_y_initializers = []; + let _static_private_y_extraInitializers = []; let _static_private_z_decorators; let _static_private_z_initializers = []; + let _static_private_z_extraInitializers = []; let _static_private_z_descriptor; let _method_decorators; let _get_x_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; let _z_decorators; let _z_initializers = []; + let _z_extraInitializers = []; var C = (_classThis = class { - constructor() { - /*14*/ - this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - _C_z_1_accessor_storage.set(this, __runInitializers(this, _z_initializers, 1)); - } /*5*/ method() { } /*8*/ @@ -127,6 +126,12 @@ class C { /*17*/ get z() { return __classPrivateFieldGet(this, _C_z_1_accessor_storage, "f"); } set z(value) { __classPrivateFieldSet(this, _C_z_1_accessor_storage, value, "f"); } + constructor() { + /*14*/ + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + _C_z_1_accessor_storage.set(this, (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1))); + __runInitializers(this, _z_extraInitializers); + } }, _C_z_1_accessor_storage = new WeakMap(), _C_method_get = function _C_method_get() { return _static_private_method_descriptor.value; }, @@ -150,22 +155,22 @@ class C { __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_method_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_x_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_x_set); } }, metadata: _metadata }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _static_private_z_extraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, get: obj => obj.x }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _z_extraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _static_private_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); })(), /*29*/ - _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }, - _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }, + _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }, + _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }, (() => { + __runInitializers(_classThis, _static_private_z_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); })(), _classThis); diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js index 99b621087ec0b..164f96e3c1c5a 100644 --- a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js @@ -102,16 +102,20 @@ class C { let _static_private_set_x_descriptor; let _static_private_y_decorators; let _static_private_y_initializers = []; + let _static_private_y_extraInitializers = []; let _static_private_z_decorators; let _static_private_z_initializers = []; + let _static_private_z_extraInitializers = []; let _static_private_z_descriptor; let _method_decorators; let _get_x_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; let _z_decorators; let _z_initializers = []; + let _z_extraInitializers = []; var C = (_a = class { static { _classThis = this; } static { __setFunctionName(this, "C"); } @@ -131,17 +135,16 @@ class C { __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_method_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_x_get) }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_x_set); } }, metadata: _metadata }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _C_z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _C_z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "a", _C_z_get), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "a", _C_z_set); } }, metadata: _metadata }, _static_private_z_initializers, _static_private_z_extraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, get: obj => obj.x }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { has: obj => "z" in obj, get: obj => obj.z, set: (obj, value) => { obj.z = value; } }, metadata: _metadata }, _z_initializers, _z_extraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { has: obj => __classPrivateFieldIn(_classThis, obj), get: obj => __classPrivateFieldGet(obj, _classThis, "f", _C_y), set: (obj, value) => { __classPrivateFieldSet(obj, _classThis, value, "f", _C_y); } }, metadata: _metadata }, _static_private_y_initializers, _static_private_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); } /*5*/ method() { } @@ -151,24 +154,28 @@ class C { set x(value) { } /*14*/ y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - #z_accessor_storage = __runInitializers(this, _z_initializers, 1); + #z_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1)); /*17*/ get z() { return this.#z_accessor_storage; } set z(value) { this.#z_accessor_storage = value; } static { /*29*/ - _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }; } static { - _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }; + } + constructor() { + __runInitializers(this, _z_extraInitializers); } static { + __runInitializers(_classThis, _static_private_z_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); } }, /*29*/ - _C_y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }, - _C_z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }, + _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) }, + _C_z_accessor_storage = { value: (__runInitializers(_classThis, _static_private_y_extraInitializers), __runInitializers(_classThis, _static_private_z_initializers, 1)) }, _a); return C = _classThis; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js index 46dc89b57cd40..a733f1cd4daa8 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js @@ -53,18 +53,21 @@ x = (() => { return class_1 = _classThis; })(); x = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); // 13.15.2 RS: Evaluation @@ -88,18 +91,21 @@ x &&= (() => { return class_2 = _classThis; })(); x &&= (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); // 13.15.2 RS: Evaluation @@ -123,18 +129,21 @@ x ||= (() => { return class_3 = _classThis; })(); x ||= (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); // 13.15.2 RS: Evaluation @@ -158,17 +167,20 @@ x ??= (() => { return class_4 = _classThis; })(); x ??= (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js index 6b11f68aa06cc..2119eb472ee78 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js @@ -219,18 +219,21 @@ var _a, _b; { class C { static x = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); } @@ -238,18 +241,21 @@ var _a, _b; { class C { static "x" = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); } @@ -257,18 +263,21 @@ var _a, _b; { class C { static 0 = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "0"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); } @@ -276,18 +285,21 @@ var _a, _b; { class C { static ["x"] = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); } @@ -295,18 +307,21 @@ var _a, _b; { class C { static [0] = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "0"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); } @@ -338,18 +353,21 @@ var _a, _b; { class C { static __proto__ = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "__proto__"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); } @@ -357,18 +375,21 @@ var _a, _b; { class C { static "__proto__" = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "__proto__"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); } @@ -376,16 +397,15 @@ var _a, _b; // ensure nested named evaluation happens when field is also transformed { let C = (() => { - let _staticExtraInitializers = []; let _static_x_decorators; let _static_x_initializers = []; + let _static_x_extraInitializers = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _static_x_decorators = [dec]; - __esDecorate(null, null, _static_x_decorators, { kind: "field", name: "x", static: true, private: false, access: { has: obj => "x" in obj, get: obj => obj.x, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, _static_x_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_x_decorators, { kind: "field", name: "x", static: true, private: false, access: { has: obj => "x" in obj, get: obj => obj.x, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, _static_x_initializers, _static_x_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(this, _staticExtraInitializers); } static x = __runInitializers(this, _static_x_initializers, (() => { let _classDecorators = [dec]; @@ -405,6 +425,9 @@ var _a, _b; }; return class_10 = _classThis; })()); + static { + __runInitializers(this, _static_x_extraInitializers); + } }; })(); } diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js index cde64529091b4..58f9685b1bf21 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js @@ -35,17 +35,20 @@ declare let dec: any; return class_1 = _classThis; })()); ((() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })()); // No NamedEvaluation, class name @@ -67,16 +70,19 @@ declare let dec: any; return C = _classThis; })()); ((() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class C { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js index 198115a21b70a..ed72ed612181e 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js @@ -57,18 +57,21 @@ let x, f; return class_1 = _classThis; })() }); ({ x: (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })() }); ({ "x": (() => { @@ -90,18 +93,21 @@ let x, f; return class_2 = _classThis; })() }); ({ "x": (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })() }); ({ 0: (() => { @@ -123,18 +129,21 @@ let x, f; return class_3 = _classThis; })() }); ({ 0: (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "0"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })() }); ({ ["x"]: (() => { @@ -156,18 +165,21 @@ let x, f; return class_4 = _classThis; })() }); ({ ["x"]: (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })() }); ({ [0]: (() => { @@ -189,18 +201,21 @@ let x, f; return class_5 = _classThis; })() }); ({ [0]: (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "0"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })() }); ({ [_a = __propKey(f())]: (() => { @@ -222,18 +237,21 @@ let x, f; return class_6 = _classThis; })() }); ({ [_b = __propKey(f())]: (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, _b); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })() }); // __proto__ setters do not perform NamedEvaluation diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js index 434953267538e..d56d30b46f870 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js @@ -44,18 +44,21 @@ declare let dec: any; } { let x = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); } @@ -81,18 +84,21 @@ declare let dec: any; } { const x = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); } @@ -120,18 +126,21 @@ declare let dec: any; } { var x1 = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x1"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); } diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js index 93d7967224817..3b68a02e5fab0 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js @@ -45,18 +45,21 @@ declare let dec: any, obj: any; } { const [x = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })()] = obj; } @@ -84,18 +87,21 @@ declare let dec: any, obj: any; } { const { x = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })() } = obj; } @@ -121,18 +127,21 @@ declare let dec: any, obj: any; } { const { y: x = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })() } = obj; } diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js index f6172c9dda165..0c7884483dbe8 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js @@ -32,17 +32,20 @@ declare let dec: any, obj: any, x: any; return class_1 = _classThis; })() } = obj); ({ x = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })() } = obj); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js index 8f2fbefe304d8..37dd63a7c7370 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js @@ -32,17 +32,20 @@ declare let dec: any, obj: any, x: any; return class_1 = _classThis; })() } = obj); ({ y: x = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })() } = obj); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js index 5cd99dbc9e986..9ba9ca8cec8fd 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js @@ -32,17 +32,20 @@ declare let dec: any, obj: any, x: any; return class_1 = _classThis; })()] = obj; [x = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "x"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })()] = obj; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js index 783ecf48a89cd..7c127f0627089 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js @@ -41,17 +41,20 @@ export default ((() => { // 16.2.3.7 RS: Evaluation // ExportDeclaration : `export` `default` AssignmentExpression `;` export default ((() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { __setFunctionName(this, "default"); } static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js index 61380d45d4eb8..213f799c4e82d 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js @@ -33,16 +33,19 @@ module.exports = (() => { //// [b.js] "use strict"; module.exports = (() => { - let _instanceExtraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + y = __runInitializers(this, _y_initializers, void 0); + constructor() { + __runInitializers(this, _y_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js index 945225552e2c6..dd3d14be265ad 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js @@ -60,13 +60,16 @@ let C = (() => { let _static_set_x_decorators; let _static_y_decorators; let _static_y_initializers = []; + let _static_y_extraInitializers = []; let _method_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; var C = _classThis = class { constructor(x) { this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + __runInitializers(this, _y_extraInitializers); } method(x) { } set x(x) { } @@ -86,15 +89,15 @@ let C = (() => { __esDecorate(_classThis, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _static_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); })(); - _classThis.y = __runInitializers(_classThis, _static_y_initializers, void 0); + _classThis.y = (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_y_initializers, void 0)); (() => { + __runInitializers(_classThis, _static_y_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); })(); return C = _classThis; @@ -110,13 +113,16 @@ let C = (() => { let _static_set_x_decorators; let _static_y_decorators; let _static_y_initializers = []; + let _static_y_extraInitializers = []; let _method_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; var C = (_classThis = class { constructor(x) { this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + __runInitializers(this, _y_extraInitializers); } method(x) { } set x(x) { } @@ -136,15 +142,15 @@ let C = (() => { __esDecorate(_classThis, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _static_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); })(), - _classThis.y = __runInitializers(_classThis, _static_y_initializers, void 0), + _classThis.y = (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_y_initializers, void 0)), (() => { + __runInitializers(_classThis, _static_y_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); })(), _classThis); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js index 92756835a5540..3f6ed5f446e01 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js @@ -60,10 +60,12 @@ let C = (() => { let _static_set_x_decorators; let _static_y_decorators; let _static_y_initializers = []; + let _static_y_extraInitializers = []; let _method_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; var C = class { static { _classThis = this; } static { @@ -78,21 +80,23 @@ let C = (() => { __esDecorate(this, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _static_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); } - constructor(x) { } + constructor(x) { + __runInitializers(this, _y_extraInitializers); + } method(x) { } set x(x) { } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); static method(x) { } static set x(x) { } - static y = __runInitializers(_classThis, _static_y_initializers, void 0); + static y = (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_y_initializers, void 0)); static { + __runInitializers(_classThis, _static_y_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); } }; @@ -109,10 +113,12 @@ let C = (() => { let _static_set_x_decorators; let _static_y_decorators; let _static_y_initializers = []; + let _static_y_extraInitializers = []; let _method_decorators; let _set_x_decorators; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; var C = class { static { _classThis = this; } static { @@ -127,21 +133,23 @@ let C = (() => { __esDecorate(this, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: obj => "x" in obj, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _static_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); } - constructor(x) { } + constructor(x) { + __runInitializers(this, _y_extraInitializers); + } method(x) { } set x(x) { } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); static method(x) { } static set x(x) { } - static y = __runInitializers(_classThis, _static_y_initializers, void 0); + static y = (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_y_initializers, void 0)); static { + __runInitializers(_classThis, _static_y_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); } }; diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js index 844e1c973aad9..37e841960398c 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js @@ -60,13 +60,16 @@ var C = function () { var _static_set_x_decorators; var _static_y_decorators; var _static_y_initializers = []; + var _static_y_extraInitializers = []; var _method_decorators; var _set_x_decorators; var _y_decorators; var _y_initializers = []; + var _y_extraInitializers = []; var C = _classThis = /** @class */ (function () { function C_1(x) { this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + __runInitializers(this, _y_extraInitializers); } C_1.prototype.method = function (x) { }; Object.defineProperty(C_1.prototype, "x", { @@ -95,15 +98,15 @@ var C = function () { __esDecorate(_classThis, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { has: function (obj) { return "x" in obj; }, set: function (obj, value) { obj.x = value; } }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: function (obj) { return "method" in obj; }, get: function (obj) { return obj.method; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: function (obj) { return "x" in obj; }, set: function (obj, value) { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: function (obj) { return "y" in obj; }, get: function (obj) { return obj.y; }, set: function (obj, value) { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: function (obj) { return "y" in obj; }, get: function (obj) { return obj.y; }, set: function (obj, value) { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: function (obj) { return "y" in obj; }, get: function (obj) { return obj.y; }, set: function (obj, value) { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _static_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: function (obj) { return "y" in obj; }, get: function (obj) { return obj.y; }, set: function (obj, value) { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); })(); - _classThis.y = __runInitializers(_classThis, _static_y_initializers, void 0); + _classThis.y = (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_y_initializers, void 0)); (function () { + __runInitializers(_classThis, _static_y_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); })(); return C = _classThis; @@ -119,13 +122,16 @@ var C = function () { var _static_set_x_decorators; var _static_y_decorators; var _static_y_initializers = []; + var _static_y_extraInitializers = []; var _method_decorators; var _set_x_decorators; var _y_decorators; var _y_initializers = []; + var _y_extraInitializers = []; var C = (_classThis = /** @class */ (function () { function class_1(x) { this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + __runInitializers(this, _y_extraInitializers); } class_1.prototype.method = function (x) { }; Object.defineProperty(class_1.prototype, "x", { @@ -154,15 +160,15 @@ var C = function () { __esDecorate(_classThis, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { has: function (obj) { return "x" in obj; }, set: function (obj, value) { obj.x = value; } }, metadata: _metadata }, null, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { has: function (obj) { return "method" in obj; }, get: function (obj) { return obj.method; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { has: function (obj) { return "x" in obj; }, set: function (obj, value) { obj.x = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: function (obj) { return "y" in obj; }, get: function (obj) { return obj.y; }, set: function (obj, value) { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: function (obj) { return "y" in obj; }, get: function (obj) { return obj.y; }, set: function (obj, value) { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { has: function (obj) { return "y" in obj; }, get: function (obj) { return obj.y; }, set: function (obj, value) { obj.y = value; } }, metadata: _metadata }, _static_y_initializers, _static_y_extraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { has: function (obj) { return "y" in obj; }, get: function (obj) { return obj.y; }, set: function (obj, value) { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_classThis, _staticExtraInitializers); })(), - _classThis.y = __runInitializers(_classThis, _static_y_initializers, void 0), + _classThis.y = (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_y_initializers, void 0)), (function () { + __runInitializers(_classThis, _static_y_extraInitializers); __runInitializers(_classThis, _classExtraInitializers); })(), _classThis); diff --git a/tests/baselines/reference/esDecorators-preservesThis.js b/tests/baselines/reference/esDecorators-preservesThis.js index d8db1c2729a8a..4a0b8a4ab2412 100644 --- a/tests/baselines/reference/esDecorators-preservesThis.js +++ b/tests/baselines/reference/esDecorators-preservesThis.js @@ -41,6 +41,13 @@ class D extends DecoratorProvider { //// [esDecorators-preservesThis.js] // https://github.com/microsoft/TypeScript/issues/53752 +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -68,13 +75,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; -var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; // preserve `this` for access let C = (() => { var _a, _b, _c; diff --git a/tests/baselines/reference/esDecoratorsMetadata1(target=es2015).js b/tests/baselines/reference/esDecoratorsMetadata1(target=es2015).js index bd929d9ae520a..6d142d2a4d8d7 100644 --- a/tests/baselines/reference/esDecoratorsMetadata1(target=es2015).js +++ b/tests/baselines/reference/esDecoratorsMetadata1(target=es2015).js @@ -18,6 +18,13 @@ C[Symbol.metadata].b; // 'y' //// [foo.js] +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -45,13 +52,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; -var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); diff --git a/tests/baselines/reference/esDecoratorsMetadata1(target=es2022).js b/tests/baselines/reference/esDecoratorsMetadata1(target=es2022).js index 1f70d31859c1b..89829ed23d352 100644 --- a/tests/baselines/reference/esDecoratorsMetadata1(target=es2022).js +++ b/tests/baselines/reference/esDecoratorsMetadata1(target=es2022).js @@ -18,6 +18,13 @@ C[Symbol.metadata].b; // 'y' //// [foo.js] +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -45,13 +52,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; -var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; function meta(key, value) { return (_, context) => { context.metadata[key] = value; diff --git a/tests/baselines/reference/esDecoratorsMetadata2(target=es2015).js b/tests/baselines/reference/esDecoratorsMetadata2(target=es2015).js index 827cd38f1e8a2..c40e77507058f 100644 --- a/tests/baselines/reference/esDecoratorsMetadata2(target=es2015).js +++ b/tests/baselines/reference/esDecoratorsMetadata2(target=es2015).js @@ -26,6 +26,13 @@ D[Symbol.metadata].b; // 'z' //// [foo.js] +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -53,13 +60,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; -var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); diff --git a/tests/baselines/reference/esDecoratorsMetadata2(target=es2022).js b/tests/baselines/reference/esDecoratorsMetadata2(target=es2022).js index 01f6e2bcf2364..426bcfa0ef112 100644 --- a/tests/baselines/reference/esDecoratorsMetadata2(target=es2022).js +++ b/tests/baselines/reference/esDecoratorsMetadata2(target=es2022).js @@ -26,6 +26,13 @@ D[Symbol.metadata].b; // 'z' //// [foo.js] +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -53,13 +60,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; -var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; function meta(key, value) { return (_, context) => { context.metadata[key] = value; diff --git a/tests/baselines/reference/esDecoratorsMetadata4(target=es2015).js b/tests/baselines/reference/esDecoratorsMetadata4(target=es2015).js index ad33dcd9fe4fd..bad3be6e96a61 100644 --- a/tests/baselines/reference/esDecoratorsMetadata4(target=es2015).js +++ b/tests/baselines/reference/esDecoratorsMetadata4(target=es2015).js @@ -27,6 +27,13 @@ PRIVATE_METADATA.get(C[Symbol.metadata]).b; // 'y' //// [foo.js] +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -54,13 +61,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; -var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); diff --git a/tests/baselines/reference/esDecoratorsMetadata4(target=es2022).js b/tests/baselines/reference/esDecoratorsMetadata4(target=es2022).js index c15a982434312..587292e9250a1 100644 --- a/tests/baselines/reference/esDecoratorsMetadata4(target=es2022).js +++ b/tests/baselines/reference/esDecoratorsMetadata4(target=es2022).js @@ -27,6 +27,13 @@ PRIVATE_METADATA.get(C[Symbol.metadata]).b; // 'y' //// [foo.js] +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -54,13 +61,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; -var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; const PRIVATE_METADATA = new WeakMap(); function meta(key, value) { return (_, context) => { diff --git a/tests/baselines/reference/esDecoratorsMetadata5.js b/tests/baselines/reference/esDecoratorsMetadata5.js index e7144470d87c5..9aa3b7f70841e 100644 --- a/tests/baselines/reference/esDecoratorsMetadata5.js +++ b/tests/baselines/reference/esDecoratorsMetadata5.js @@ -8,6 +8,13 @@ class C { //// [foo.js] +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; @@ -35,13 +42,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; -var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; let C = (() => { let _instanceExtraInitializers = []; let _m_decorators; diff --git a/tests/baselines/reference/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.symbols b/tests/baselines/reference/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.symbols new file mode 100644 index 0000000000000..1d4d93ed814b4 --- /dev/null +++ b/tests/baselines/reference/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.symbols @@ -0,0 +1,92 @@ +//// [tests/cases/compiler/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts] //// + +=== homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts === +type HandleOptions = { +>HandleOptions : Symbol(HandleOptions, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 0, 0)) +>O : Symbol(O, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 0, 19)) + + [I in keyof O]: { +>I : Symbol(I, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 1, 3)) +>O : Symbol(O, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 0, 19)) + + value: O[I]; +>value : Symbol(value, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 1, 19)) +>O : Symbol(O, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 0, 19)) +>I : Symbol(I, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 1, 3)) + + }; +}; + +declare function func1< +>func1 : Symbol(func1, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 4, 2)) + + T extends Record, +>T : Symbol(T, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 6, 23)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) +>PropertyKey : Symbol(PropertyKey, Decl(lib.es5.d.ts, --, --)) + +>(fields: { +>fields : Symbol(fields, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 8, 2)) + + [K in keyof T]: { +>K : Symbol(K, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 9, 3)) +>T : Symbol(T, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 6, 23)) + + label: string; +>label : Symbol(label, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 9, 19)) + + options: [...HandleOptions]; +>options : Symbol(options, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 10, 18)) +>HandleOptions : Symbol(HandleOptions, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 0, 0)) +>T : Symbol(T, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 6, 23)) +>K : Symbol(K, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 9, 3)) + + }; +}): T; +>T : Symbol(T, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 6, 23)) + +const result = func1({ +>result : Symbol(result, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 15, 5)) +>func1 : Symbol(func1, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 4, 2)) + + prop: { +>prop : Symbol(prop, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 15, 22)) + + label: "first", +>label : Symbol(label, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 16, 9)) + + options: [ +>options : Symbol(options, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 17, 19)) + { + value: 123, +>value : Symbol(value, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 19, 7)) + + }, + { + value: "foo", +>value : Symbol(value, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 22, 7)) + + }, + ], + }, + other: { +>other : Symbol(other, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 26, 4)) + + label: "second", +>label : Symbol(label, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 27, 10)) + + options: [ +>options : Symbol(options, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 28, 20)) + { + value: "bar", +>value : Symbol(value, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 30, 7)) + + }, + { + value: true, +>value : Symbol(value, Decl(homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts, 33, 7)) + + }, + ], + }, +}); diff --git a/tests/baselines/reference/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.types b/tests/baselines/reference/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.types new file mode 100644 index 0000000000000..19d882824d22f --- /dev/null +++ b/tests/baselines/reference/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.types @@ -0,0 +1,95 @@ +//// [tests/cases/compiler/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts] //// + +=== homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts === +type HandleOptions = { +>HandleOptions : HandleOptions + + [I in keyof O]: { + value: O[I]; +>value : O[I] + + }; +}; + +declare function func1< +>func1 : >(fields: { [K in keyof T]: { label: string; options: [...HandleOptions]; }; }) => T + + T extends Record, +>(fields: { +>fields : { [K in keyof T]: { label: string; options: [...HandleOptions]; }; } + + [K in keyof T]: { + label: string; +>label : string + + options: [...HandleOptions]; +>options : [...HandleOptions] + + }; +}): T; + +const result = func1({ +>result : { prop: [number, string]; other: [string, boolean]; } +>func1({ prop: { label: "first", options: [ { value: 123, }, { value: "foo", }, ], }, other: { label: "second", options: [ { value: "bar", }, { value: true, }, ], },}) : { prop: [number, string]; other: [string, boolean]; } +>func1 : >(fields: { [K in keyof T]: { label: string; options: [...HandleOptions]; }; }) => T +>{ prop: { label: "first", options: [ { value: 123, }, { value: "foo", }, ], }, other: { label: "second", options: [ { value: "bar", }, { value: true, }, ], },} : { prop: { label: string; options: [{ value: number; }, { value: string; }]; }; other: { label: string; options: [{ value: string; }, { value: true; }]; }; } + + prop: { +>prop : { label: string; options: [{ value: number; }, { value: string; }]; } +>{ label: "first", options: [ { value: 123, }, { value: "foo", }, ], } : { label: string; options: [{ value: number; }, { value: string; }]; } + + label: "first", +>label : string +>"first" : "first" + + options: [ +>options : [{ value: number; }, { value: string; }] +>[ { value: 123, }, { value: "foo", }, ] : [{ value: number; }, { value: string; }] + { +>{ value: 123, } : { value: number; } + + value: 123, +>value : number +>123 : 123 + + }, + { +>{ value: "foo", } : { value: string; } + + value: "foo", +>value : string +>"foo" : "foo" + + }, + ], + }, + other: { +>other : { label: string; options: [{ value: string; }, { value: true; }]; } +>{ label: "second", options: [ { value: "bar", }, { value: true, }, ], } : { label: string; options: [{ value: string; }, { value: true; }]; } + + label: "second", +>label : string +>"second" : "second" + + options: [ +>options : [{ value: string; }, { value: true; }] +>[ { value: "bar", }, { value: true, }, ] : [{ value: string; }, { value: true; }] + { +>{ value: "bar", } : { value: string; } + + value: "bar", +>value : string +>"bar" : "bar" + + }, + { +>{ value: true, } : { value: true; } + + value: true, +>value : true +>true : true + + }, + ], + }, +}); diff --git a/tests/baselines/reference/implicitConstParameters.errors.txt b/tests/baselines/reference/implicitConstParameters.errors.txt index ffc18dbc49234..2be671d75de0d 100644 --- a/tests/baselines/reference/implicitConstParameters.errors.txt +++ b/tests/baselines/reference/implicitConstParameters.errors.txt @@ -1,8 +1,7 @@ -implicitConstParameters.ts(38,27): error TS18048: 'x' is possibly 'undefined'. implicitConstParameters.ts(44,27): error TS18048: 'x' is possibly 'undefined'. -==== implicitConstParameters.ts (2 errors) ==== +==== implicitConstParameters.ts (1 errors) ==== function doSomething(cb: () => void) { cb(); } @@ -38,11 +37,9 @@ implicitConstParameters.ts(44,27): error TS18048: 'x' is possibly 'undefined'. } function f4(x: string | undefined) { - x = "abc"; // causes x to be considered non-const + x = "abc"; if (x) { doSomething(() => x.length); - ~ -!!! error TS18048: 'x' is possibly 'undefined'. } } diff --git a/tests/baselines/reference/implicitConstParameters.js b/tests/baselines/reference/implicitConstParameters.js index 001a81d352df8..c14592085405a 100644 --- a/tests/baselines/reference/implicitConstParameters.js +++ b/tests/baselines/reference/implicitConstParameters.js @@ -36,7 +36,7 @@ function f3(x: string | undefined) { } function f4(x: string | undefined) { - x = "abc"; // causes x to be considered non-const + x = "abc"; if (x) { doSomething(() => x.length); } @@ -88,7 +88,7 @@ function f3(x) { } } function f4(x) { - x = "abc"; // causes x to be considered non-const + x = "abc"; if (x) { doSomething(function () { return x.length; }); } diff --git a/tests/baselines/reference/implicitConstParameters.symbols b/tests/baselines/reference/implicitConstParameters.symbols index 298355c44015a..16ba4c949c325 100644 --- a/tests/baselines/reference/implicitConstParameters.symbols +++ b/tests/baselines/reference/implicitConstParameters.symbols @@ -86,7 +86,7 @@ function f4(x: string | undefined) { >f4 : Symbol(f4, Decl(implicitConstParameters.ts, 32, 1)) >x : Symbol(x, Decl(implicitConstParameters.ts, 34, 12)) - x = "abc"; // causes x to be considered non-const + x = "abc"; >x : Symbol(x, Decl(implicitConstParameters.ts, 34, 12)) if (x) { diff --git a/tests/baselines/reference/implicitConstParameters.types b/tests/baselines/reference/implicitConstParameters.types index ef602acb7e11c..4b21f714f817e 100644 --- a/tests/baselines/reference/implicitConstParameters.types +++ b/tests/baselines/reference/implicitConstParameters.types @@ -103,7 +103,7 @@ function f4(x: string | undefined) { >f4 : (x: string | undefined) => void >x : string | undefined - x = "abc"; // causes x to be considered non-const + x = "abc"; >x = "abc" : "abc" >x : string | undefined >"abc" : "abc" @@ -116,7 +116,7 @@ function f4(x: string | undefined) { >doSomething : (cb: () => void) => void >() => x.length : () => number >x.length : number ->x : string | undefined +>x : string >length : number } } diff --git a/tests/baselines/reference/importDecl.js b/tests/baselines/reference/importDecl.js index c4062b62b1ac1..7ac30532e4564 100644 --- a/tests/baselines/reference/importDecl.js +++ b/tests/baselines/reference/importDecl.js @@ -210,9 +210,6 @@ export declare function foo(): d; import m4 = require("./importDecl_require"); export declare function foo2(): m4.d; //// [importDecl_1.d.ts] -/// -/// -/// /// /// import m4 = require("./importDecl_require"); diff --git a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js index cc87955019719..4f7fb42895a6a 100644 --- a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js +++ b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js @@ -32,6 +32,5 @@ export declare class B { id: number; } //// [importDeclarationUsedAsTypeQuery_1.d.ts] -/// import a = require('./importDeclarationUsedAsTypeQuery_require'); export declare var x: typeof a; diff --git a/tests/baselines/reference/inferringClassMembersFromAssignments6.symbols b/tests/baselines/reference/inferringClassMembersFromAssignments6.symbols index ebf4dbd28fcd0..adaa9b83f1c24 100644 --- a/tests/baselines/reference/inferringClassMembersFromAssignments6.symbols +++ b/tests/baselines/reference/inferringClassMembersFromAssignments6.symbols @@ -10,12 +10,12 @@ function Foonly() { self.x = 1 >self.x : Symbol(Foonly.x, Decl(inferringClassMembersFromAssignments6.js, 1, 19)) ->self : Symbol(Foonly.x, Decl(inferringClassMembersFromAssignments6.js, 1, 19)) +>self : Symbol(self, Decl(inferringClassMembersFromAssignments6.js, 1, 7)) >x : Symbol(Foonly.x, Decl(inferringClassMembersFromAssignments6.js, 1, 19)) self.m = function() { >self.m : Symbol(Foonly.m, Decl(inferringClassMembersFromAssignments6.js, 2, 14)) ->self : Symbol(Foonly.m, Decl(inferringClassMembersFromAssignments6.js, 2, 14)) +>self : Symbol(self, Decl(inferringClassMembersFromAssignments6.js, 1, 7)) >m : Symbol(Foonly.m, Decl(inferringClassMembersFromAssignments6.js, 2, 14)) console.log(self.x) @@ -39,7 +39,7 @@ Foonly.prototype.mreal = function() { self.y = 2 >self.y : Symbol(Foonly.y, Decl(inferringClassMembersFromAssignments6.js, 8, 19)) ->self : Symbol(Foonly.y, Decl(inferringClassMembersFromAssignments6.js, 8, 19)) +>self : Symbol(self, Decl(inferringClassMembersFromAssignments6.js, 8, 7)) >y : Symbol(Foonly.y, Decl(inferringClassMembersFromAssignments6.js, 8, 19)) } const foo = new Foonly() diff --git a/tests/baselines/reference/inferringClassMembersFromAssignments7.symbols b/tests/baselines/reference/inferringClassMembersFromAssignments7.symbols index f7a2ed3a77150..864bf5456e155 100644 --- a/tests/baselines/reference/inferringClassMembersFromAssignments7.symbols +++ b/tests/baselines/reference/inferringClassMembersFromAssignments7.symbols @@ -11,12 +11,12 @@ class C { self.x = 1 >self.x : Symbol(C.x, Decl(inferringClassMembersFromAssignments7.js, 2, 23)) ->self : Symbol(C.x, Decl(inferringClassMembersFromAssignments7.js, 2, 23)) +>self : Symbol(self, Decl(inferringClassMembersFromAssignments7.js, 2, 11)) >x : Symbol(C.x, Decl(inferringClassMembersFromAssignments7.js, 2, 23)) self.m = function() { >self.m : Symbol(C.m, Decl(inferringClassMembersFromAssignments7.js, 3, 18)) ->self : Symbol(C.m, Decl(inferringClassMembersFromAssignments7.js, 3, 18)) +>self : Symbol(self, Decl(inferringClassMembersFromAssignments7.js, 2, 11)) >m : Symbol(C.m, Decl(inferringClassMembersFromAssignments7.js, 3, 18)) console.log(self.x) @@ -37,7 +37,7 @@ class C { self.y = 2 >self.y : Symbol(C.y, Decl(inferringClassMembersFromAssignments7.js, 9, 23)) ->self : Symbol(C.y, Decl(inferringClassMembersFromAssignments7.js, 9, 23)) +>self : Symbol(self, Decl(inferringClassMembersFromAssignments7.js, 9, 11)) >y : Symbol(C.y, Decl(inferringClassMembersFromAssignments7.js, 9, 23)) } } diff --git a/tests/baselines/reference/isolatedModulesShadowGlobalTypeNotValue(isolatedmodules=false,verbatimmodulesyntax=true).errors.txt b/tests/baselines/reference/isolatedModulesShadowGlobalTypeNotValue(isolatedmodules=false,verbatimmodulesyntax=true).errors.txt new file mode 100644 index 0000000000000..09ca32e0905e6 --- /dev/null +++ b/tests/baselines/reference/isolatedModulesShadowGlobalTypeNotValue(isolatedmodules=false,verbatimmodulesyntax=true).errors.txt @@ -0,0 +1,67 @@ +bad.ts(1,10): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. +bad.ts(1,10): error TS1484: 'Date' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. +bad.ts(1,16): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. +bad.ts(1,16): error TS1484: 'Event' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. +good.ts(2,10): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. + + +==== ./types.ts (0 errors) ==== + export interface Date { + day: number; + month: number; + year: number; + } + + export namespace Event { + export type T = any; + } + +==== ./node.d.ts (0 errors) ==== + declare module 'node:console' { + global { + interface Console { + Console: console.ConsoleConstructor; + } + namespace console { + interface ConsoleConstructor { + prototype: Console; + new (): Console; + } + } + var console: Console; + } + export = globalThis.console; + } + +==== ./bad.ts (4 errors) ==== + import { Date, Event } from './types'; + ~~~~ +!!! error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. + ~~~~ +!!! error TS1484: 'Date' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. + ~~~~~ +!!! error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. + ~~~~~ +!!! error TS1484: 'Event' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. + function foo(a: Date) { + const b = new Date(a.year, a.month, a.day); + return b.getTime(); + } + function bar() { + return new Event('bar') as Event.T; + } + +==== ./good.ts (1 errors) ==== + import type { Date, Event } from './types'; + import { Console } from 'node:console'; + ~~~~~~~ +!!! error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. + function foo(a: Date) { + const b = new Date(a.year, a.month, a.day); + return b.getTime(); + } + function bar() { + return new Event('bar') as Event.T; + } + const baz: Console = new Console(); + \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesShadowGlobalTypeNotValue(isolatedmodules=true,verbatimmodulesyntax=false).errors.txt b/tests/baselines/reference/isolatedModulesShadowGlobalTypeNotValue(isolatedmodules=true,verbatimmodulesyntax=false).errors.txt new file mode 100644 index 0000000000000..2c91eac390a77 --- /dev/null +++ b/tests/baselines/reference/isolatedModulesShadowGlobalTypeNotValue(isolatedmodules=true,verbatimmodulesyntax=false).errors.txt @@ -0,0 +1,58 @@ +bad.ts(1,10): error TS2866: Import 'Date' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled. +bad.ts(1,16): error TS2866: Import 'Event' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled. + + +==== ./types.ts (0 errors) ==== + export interface Date { + day: number; + month: number; + year: number; + } + + export namespace Event { + export type T = any; + } + +==== ./node.d.ts (0 errors) ==== + declare module 'node:console' { + global { + interface Console { + Console: console.ConsoleConstructor; + } + namespace console { + interface ConsoleConstructor { + prototype: Console; + new (): Console; + } + } + var console: Console; + } + export = globalThis.console; + } + +==== ./bad.ts (2 errors) ==== + import { Date, Event } from './types'; + ~~~~ +!!! error TS2866: Import 'Date' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled. + ~~~~~ +!!! error TS2866: Import 'Event' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled. + function foo(a: Date) { + const b = new Date(a.year, a.month, a.day); + return b.getTime(); + } + function bar() { + return new Event('bar') as Event.T; + } + +==== ./good.ts (0 errors) ==== + import type { Date, Event } from './types'; + import { Console } from 'node:console'; + function foo(a: Date) { + const b = new Date(a.year, a.month, a.day); + return b.getTime(); + } + function bar() { + return new Event('bar') as Event.T; + } + const baz: Console = new Console(); + \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesShadowGlobalTypeNotValue(isolatedmodules=true,verbatimmodulesyntax=true).errors.txt b/tests/baselines/reference/isolatedModulesShadowGlobalTypeNotValue(isolatedmodules=true,verbatimmodulesyntax=true).errors.txt new file mode 100644 index 0000000000000..deb401b76857d --- /dev/null +++ b/tests/baselines/reference/isolatedModulesShadowGlobalTypeNotValue(isolatedmodules=true,verbatimmodulesyntax=true).errors.txt @@ -0,0 +1,73 @@ +bad.ts(1,10): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. +bad.ts(1,10): error TS1484: 'Date' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. +bad.ts(1,10): error TS2866: Import 'Date' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled. +bad.ts(1,16): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. +bad.ts(1,16): error TS1484: 'Event' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. +bad.ts(1,16): error TS2866: Import 'Event' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled. +good.ts(2,10): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. + + +==== ./types.ts (0 errors) ==== + export interface Date { + day: number; + month: number; + year: number; + } + + export namespace Event { + export type T = any; + } + +==== ./node.d.ts (0 errors) ==== + declare module 'node:console' { + global { + interface Console { + Console: console.ConsoleConstructor; + } + namespace console { + interface ConsoleConstructor { + prototype: Console; + new (): Console; + } + } + var console: Console; + } + export = globalThis.console; + } + +==== ./bad.ts (6 errors) ==== + import { Date, Event } from './types'; + ~~~~ +!!! error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. + ~~~~ +!!! error TS1484: 'Date' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. + ~~~~ +!!! error TS2866: Import 'Date' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled. + ~~~~~ +!!! error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. + ~~~~~ +!!! error TS1484: 'Event' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. + ~~~~~ +!!! error TS2866: Import 'Event' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled. + function foo(a: Date) { + const b = new Date(a.year, a.month, a.day); + return b.getTime(); + } + function bar() { + return new Event('bar') as Event.T; + } + +==== ./good.ts (1 errors) ==== + import type { Date, Event } from './types'; + import { Console } from 'node:console'; + ~~~~~~~ +!!! error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. + function foo(a: Date) { + const b = new Date(a.year, a.month, a.day); + return b.getTime(); + } + function bar() { + return new Event('bar') as Event.T; + } + const baz: Console = new Console(); + \ No newline at end of file diff --git a/tests/baselines/reference/jsdocLink3.baseline b/tests/baselines/reference/jsdocLink3.baseline index c3f9432976119..01c167788365a 100644 --- a/tests/baselines/reference/jsdocLink3.baseline +++ b/tests/baselines/reference/jsdocLink3.baseline @@ -83,10 +83,10 @@ "text": "C", "kind": "linkName", "target": { - "fileName": "/module1.ts", + "fileName": "/jsdocLink3.ts", "textSpan": { - "start": 9, - "length": 1 + "start": 0, + "length": 18 } } }, @@ -111,10 +111,10 @@ "text": "C", "kind": "linkName", "target": { - "fileName": "/module1.ts", + "fileName": "/jsdocLink3.ts", "textSpan": { - "start": 9, - "length": 1 + "start": 0, + "length": 18 } } }, @@ -134,10 +134,10 @@ "text": "C()", "kind": "linkName", "target": { - "fileName": "/module1.ts", + "fileName": "/jsdocLink3.ts", "textSpan": { - "start": 9, - "length": 1 + "start": 0, + "length": 18 } } }, @@ -157,10 +157,10 @@ "text": "C", "kind": "linkName", "target": { - "fileName": "/module1.ts", + "fileName": "/jsdocLink3.ts", "textSpan": { - "start": 9, - "length": 1 + "start": 0, + "length": 18 } } }, @@ -205,10 +205,10 @@ "text": "C", "kind": "linkName", "target": { - "fileName": "/module1.ts", + "fileName": "/jsdocLink3.ts", "textSpan": { - "start": 9, - "length": 1 + "start": 0, + "length": 18 } } }, diff --git a/tests/baselines/reference/jsdocLink6.baseline b/tests/baselines/reference/jsdocLink6.baseline new file mode 100644 index 0000000000000..c7fee2ac65b9f --- /dev/null +++ b/tests/baselines/reference/jsdocLink6.baseline @@ -0,0 +1,114 @@ +// === QuickInfo === +=== /b.ts === +// import A, { B } from "./a"; +// /** +// * {@link A} +// * {@link B} +// */ +// export default function f() { } +// ^ +// | ---------------------------------------------------------------------- +// | function f(): void +// | {@link A} +// | {@link B} +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/b.ts", + "position": 86, + "name": "" + }, + "item": { + "kind": "function", + "kindModifiers": "export", + "textSpan": { + "start": 86, + "length": 1 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "", + "kind": "text" + }, + { + "text": "{@link ", + "kind": "link" + }, + { + "text": "A", + "kind": "linkName", + "target": { + "fileName": "/a.ts", + "textSpan": { + "start": 0, + "length": 31 + } + } + }, + { + "text": "}", + "kind": "link" + }, + { + "text": "\n", + "kind": "text" + }, + { + "text": "{@link ", + "kind": "link" + }, + { + "text": "B", + "kind": "linkName", + "target": { + "fileName": "/a.ts", + "textSpan": { + "start": 32, + "length": 23 + } + } + }, + { + "text": "}", + "kind": "link" + } + ] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/jsdocTemplateTag6.symbols b/tests/baselines/reference/jsdocTemplateTag6.symbols new file mode 100644 index 0000000000000..105ba2b51f2ec --- /dev/null +++ b/tests/baselines/reference/jsdocTemplateTag6.symbols @@ -0,0 +1,192 @@ +//// [tests/cases/conformance/jsdoc/jsdocTemplateTag6.ts] //// + +=== a.js === +/** + * @template const T + * @param {T} x + * @returns {T} + */ +function f1(x) { +>f1 : Symbol(f1, Decl(a.js, 0, 0)) +>x : Symbol(x, Decl(a.js, 5, 12)) + + return x; +>x : Symbol(x, Decl(a.js, 5, 12)) +} +const t1 = f1("a"); +>t1 : Symbol(t1, Decl(a.js, 8, 5)) +>f1 : Symbol(f1, Decl(a.js, 0, 0)) + +const t2 = f1(["a", ["b", "c"]]); +>t2 : Symbol(t2, Decl(a.js, 9, 5)) +>f1 : Symbol(f1, Decl(a.js, 0, 0)) + +const t3 = f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); +>t3 : Symbol(t3, Decl(a.js, 10, 5)) +>f1 : Symbol(f1, Decl(a.js, 0, 0)) +>a : Symbol(a, Decl(a.js, 10, 15)) +>b : Symbol(b, Decl(a.js, 10, 21)) +>d : Symbol(d, Decl(a.js, 10, 29)) +>f : Symbol(f, Decl(a.js, 10, 49)) + +/** + * @template const T, U + * @param {T} x + * @returns {T} + */ +function f2(x) { +>f2 : Symbol(f2, Decl(a.js, 10, 63)) +>x : Symbol(x, Decl(a.js, 17, 12)) + + return x; +>x : Symbol(x, Decl(a.js, 17, 12)) + +}; +const t4 = f2('a'); +>t4 : Symbol(t4, Decl(a.js, 20, 5)) +>f2 : Symbol(f2, Decl(a.js, 10, 63)) + +const t5 = f2(['a', ['b', 'c']]); +>t5 : Symbol(t5, Decl(a.js, 21, 5)) +>f2 : Symbol(f2, Decl(a.js, 10, 63)) + +const t6 = f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); +>t6 : Symbol(t6, Decl(a.js, 22, 5)) +>f2 : Symbol(f2, Decl(a.js, 10, 63)) +>a : Symbol(a, Decl(a.js, 22, 15)) +>b : Symbol(b, Decl(a.js, 22, 21)) +>d : Symbol(d, Decl(a.js, 22, 29)) +>f : Symbol(f, Decl(a.js, 22, 49)) + +/** + * @template const T + * @param {T} x + * @returns {T[]} + */ +function f3(x) { +>f3 : Symbol(f3, Decl(a.js, 22, 63)) +>x : Symbol(x, Decl(a.js, 29, 12)) + + return [x]; +>x : Symbol(x, Decl(a.js, 29, 12)) +} +const t7 = f3("hello"); +>t7 : Symbol(t7, Decl(a.js, 32, 5)) +>f3 : Symbol(f3, Decl(a.js, 22, 63)) + +const t8 = f3("hello"); +>t8 : Symbol(t8, Decl(a.js, 33, 5)) +>f3 : Symbol(f3, Decl(a.js, 22, 63)) + +/** + * @template const T + * @param {[T, T]} x + * @returns {T} + */ +function f4(x) { +>f4 : Symbol(f4, Decl(a.js, 33, 23)) +>x : Symbol(x, Decl(a.js, 40, 12)) + + return x[0]; +>x : Symbol(x, Decl(a.js, 40, 12)) +>0 : Symbol(0) +} +const t9 = f4([[1, "x"], [2, "y"]]); +>t9 : Symbol(t9, Decl(a.js, 43, 5)) +>f4 : Symbol(f4, Decl(a.js, 33, 23)) + +const t10 = f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]); +>t10 : Symbol(t10, Decl(a.js, 44, 5)) +>f4 : Symbol(f4, Decl(a.js, 33, 23)) +>a : Symbol(a, Decl(a.js, 44, 17)) +>b : Symbol(b, Decl(a.js, 44, 23)) +>a : Symbol(a, Decl(a.js, 44, 35)) +>b : Symbol(b, Decl(a.js, 44, 41)) + +/** + * @template const T + * @param {{ x: T, y: T}} obj + * @returns {T} + */ +function f5(obj) { +>f5 : Symbol(f5, Decl(a.js, 44, 53)) +>obj : Symbol(obj, Decl(a.js, 51, 12)) + + return obj.x; +>obj.x : Symbol(x, Decl(a.js, 48, 12)) +>obj : Symbol(obj, Decl(a.js, 51, 12)) +>x : Symbol(x, Decl(a.js, 48, 12)) +} +const t11 = f5({ x: [1, "x"], y: [2, "y"] }); +>t11 : Symbol(t11, Decl(a.js, 54, 5)) +>f5 : Symbol(f5, Decl(a.js, 44, 53)) +>x : Symbol(x, Decl(a.js, 54, 16)) +>y : Symbol(y, Decl(a.js, 54, 29)) + +const t12 = f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }); +>t12 : Symbol(t12, Decl(a.js, 55, 5)) +>f5 : Symbol(f5, Decl(a.js, 44, 53)) +>x : Symbol(x, Decl(a.js, 55, 16)) +>a : Symbol(a, Decl(a.js, 55, 21)) +>b : Symbol(b, Decl(a.js, 55, 27)) +>y : Symbol(y, Decl(a.js, 55, 37)) +>a : Symbol(a, Decl(a.js, 55, 42)) +>b : Symbol(b, Decl(a.js, 55, 48)) + +/** + * @template const T + */ +class C { +>C : Symbol(C, Decl(a.js, 55, 61)) + + /** + * @param {T} x + */ + constructor(x) {} +>x : Symbol(x, Decl(a.js, 64, 16)) + + /** + * @template const U + * @param {U} x + */ + foo(x) { +>foo : Symbol(C.foo, Decl(a.js, 64, 21)) +>x : Symbol(x, Decl(a.js, 70, 8)) + + return x; +>x : Symbol(x, Decl(a.js, 70, 8)) + } +} + +const t13 = new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); +>t13 : Symbol(t13, Decl(a.js, 75, 5)) +>C : Symbol(C, Decl(a.js, 55, 61)) +>a : Symbol(a, Decl(a.js, 75, 19)) +>b : Symbol(b, Decl(a.js, 75, 25)) +>d : Symbol(d, Decl(a.js, 75, 33)) +>f : Symbol(f, Decl(a.js, 75, 53)) + +const t14 = t13.foo(["a", ["b", "c"]]); +>t14 : Symbol(t14, Decl(a.js, 76, 5)) +>t13.foo : Symbol(C.foo, Decl(a.js, 64, 21)) +>t13 : Symbol(t13, Decl(a.js, 75, 5)) +>foo : Symbol(C.foo, Decl(a.js, 64, 21)) + +/** + * @template {readonly unknown[]} const T + * @param {T} args + * @returns {T} + */ +function f6(...args) { +>f6 : Symbol(f6, Decl(a.js, 76, 39)) +>args : Symbol(args, Decl(a.js, 83, 12)) + + return args; +>args : Symbol(args, Decl(a.js, 83, 12)) +} +const t15 = f6(1, 'b', { a: 1, b: 'x' }); +>t15 : Symbol(t15, Decl(a.js, 86, 5)) +>f6 : Symbol(f6, Decl(a.js, 76, 39)) +>a : Symbol(a, Decl(a.js, 86, 24)) +>b : Symbol(b, Decl(a.js, 86, 30)) + diff --git a/tests/baselines/reference/jsdocTemplateTag6.types b/tests/baselines/reference/jsdocTemplateTag6.types new file mode 100644 index 0000000000000..2ba325b685609 --- /dev/null +++ b/tests/baselines/reference/jsdocTemplateTag6.types @@ -0,0 +1,288 @@ +//// [tests/cases/conformance/jsdoc/jsdocTemplateTag6.ts] //// + +=== a.js === +/** + * @template const T + * @param {T} x + * @returns {T} + */ +function f1(x) { +>f1 : (x: T) => T +>x : T + + return x; +>x : T +} +const t1 = f1("a"); +>t1 : "a" +>f1("a") : "a" +>f1 : (x: T) => T +>"a" : "a" + +const t2 = f1(["a", ["b", "c"]]); +>t2 : readonly ["a", readonly ["b", "c"]] +>f1(["a", ["b", "c"]]) : readonly ["a", readonly ["b", "c"]] +>f1 : (x: T) => T +>["a", ["b", "c"]] : ["a", ["b", "c"]] +>"a" : "a" +>["b", "c"] : ["b", "c"] +>"b" : "b" +>"c" : "c" + +const t3 = f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); +>t3 : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } +>f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } +>f1 : (x: T) => T +>{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } +>a : 1 +>1 : 1 +>b : "c" +>"c" : "c" +>d : ["e", 2, true, { f: "g"; }] +>["e", 2, true, { f: "g" }] : ["e", 2, true, { f: "g"; }] +>"e" : "e" +>2 : 2 +>true : true +>{ f: "g" } : { f: "g"; } +>f : "g" +>"g" : "g" + +/** + * @template const T, U + * @param {T} x + * @returns {T} + */ +function f2(x) { +>f2 : (x: T) => T +>x : T + + return x; +>x : T + +}; +const t4 = f2('a'); +>t4 : "a" +>f2('a') : "a" +>f2 : (x: T) => T +>'a' : "a" + +const t5 = f2(['a', ['b', 'c']]); +>t5 : readonly ["a", readonly ["b", "c"]] +>f2(['a', ['b', 'c']]) : readonly ["a", readonly ["b", "c"]] +>f2 : (x: T) => T +>['a', ['b', 'c']] : ["a", ["b", "c"]] +>'a' : "a" +>['b', 'c'] : ["b", "c"] +>'b' : "b" +>'c' : "c" + +const t6 = f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); +>t6 : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } +>f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } +>f2 : (x: T) => T +>{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } +>a : 1 +>1 : 1 +>b : "c" +>"c" : "c" +>d : ["e", 2, true, { f: "g"; }] +>["e", 2, true, { f: "g" }] : ["e", 2, true, { f: "g"; }] +>"e" : "e" +>2 : 2 +>true : true +>{ f: "g" } : { f: "g"; } +>f : "g" +>"g" : "g" + +/** + * @template const T + * @param {T} x + * @returns {T[]} + */ +function f3(x) { +>f3 : (x: T) => T[] +>x : T + + return [x]; +>[x] : T[] +>x : T +} +const t7 = f3("hello"); +>t7 : "hello"[] +>f3("hello") : "hello"[] +>f3 : (x: T) => T[] +>"hello" : "hello" + +const t8 = f3("hello"); +>t8 : "hello"[] +>f3("hello") : "hello"[] +>f3 : (x: T) => T[] +>"hello" : "hello" + +/** + * @template const T + * @param {[T, T]} x + * @returns {T} + */ +function f4(x) { +>f4 : (x: [T, T]) => T +>x : [T, T] + + return x[0]; +>x[0] : T +>x : [T, T] +>0 : 0 +} +const t9 = f4([[1, "x"], [2, "y"]]); +>t9 : readonly [1, "x"] | readonly [2, "y"] +>f4([[1, "x"], [2, "y"]]) : readonly [1, "x"] | readonly [2, "y"] +>f4 : (x: [T, T]) => T +>[[1, "x"], [2, "y"]] : [[1, "x"], [2, "y"]] +>[1, "x"] : [1, "x"] +>1 : 1 +>"x" : "x" +>[2, "y"] : [2, "y"] +>2 : 2 +>"y" : "y" + +const t10 = f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]); +>t10 : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } +>f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]) : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } +>f4 : (x: [T, T]) => T +>[{ a: 1, b: "x" }, { a: 2, b: "y" }] : [{ a: 1; b: "x"; }, { a: 2; b: "y"; }] +>{ a: 1, b: "x" } : { a: 1; b: "x"; } +>a : 1 +>1 : 1 +>b : "x" +>"x" : "x" +>{ a: 2, b: "y" } : { a: 2; b: "y"; } +>a : 2 +>2 : 2 +>b : "y" +>"y" : "y" + +/** + * @template const T + * @param {{ x: T, y: T}} obj + * @returns {T} + */ +function f5(obj) { +>f5 : (obj: { x: T; y: T;}) => T +>obj : { x: T; y: T; } + + return obj.x; +>obj.x : T +>obj : { x: T; y: T; } +>x : T +} +const t11 = f5({ x: [1, "x"], y: [2, "y"] }); +>t11 : readonly [1, "x"] | readonly [2, "y"] +>f5({ x: [1, "x"], y: [2, "y"] }) : readonly [1, "x"] | readonly [2, "y"] +>f5 : (obj: { x: T; y: T; }) => T +>{ x: [1, "x"], y: [2, "y"] } : { x: [1, "x"]; y: [2, "y"]; } +>x : [1, "x"] +>[1, "x"] : [1, "x"] +>1 : 1 +>"x" : "x" +>y : [2, "y"] +>[2, "y"] : [2, "y"] +>2 : 2 +>"y" : "y" + +const t12 = f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }); +>t12 : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } +>f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }) : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } +>f5 : (obj: { x: T; y: T; }) => T +>{ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } } : { x: { a: 1; b: "x"; }; y: { a: 2; b: "y"; }; } +>x : { a: 1; b: "x"; } +>{ a: 1, b: "x" } : { a: 1; b: "x"; } +>a : 1 +>1 : 1 +>b : "x" +>"x" : "x" +>y : { a: 2; b: "y"; } +>{ a: 2, b: "y" } : { a: 2; b: "y"; } +>a : 2 +>2 : 2 +>b : "y" +>"y" : "y" + +/** + * @template const T + */ +class C { +>C : C + + /** + * @param {T} x + */ + constructor(x) {} +>x : T + + /** + * @template const U + * @param {U} x + */ + foo(x) { +>foo : (x: U) => U +>x : U + + return x; +>x : U + } +} + +const t13 = new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); +>t13 : C<{ readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; }> +>new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : C<{ readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; }> +>C : typeof C +>{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } +>a : 1 +>1 : 1 +>b : "c" +>"c" : "c" +>d : ["e", 2, true, { f: "g"; }] +>["e", 2, true, { f: "g" }] : ["e", 2, true, { f: "g"; }] +>"e" : "e" +>2 : 2 +>true : true +>{ f: "g" } : { f: "g"; } +>f : "g" +>"g" : "g" + +const t14 = t13.foo(["a", ["b", "c"]]); +>t14 : readonly ["a", readonly ["b", "c"]] +>t13.foo(["a", ["b", "c"]]) : readonly ["a", readonly ["b", "c"]] +>t13.foo : (x: U) => U +>t13 : C<{ readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; }> +>foo : (x: U) => U +>["a", ["b", "c"]] : ["a", ["b", "c"]] +>"a" : "a" +>["b", "c"] : ["b", "c"] +>"b" : "b" +>"c" : "c" + +/** + * @template {readonly unknown[]} const T + * @param {T} args + * @returns {T} + */ +function f6(...args) { +>f6 : (...args: T) => T +>args : T + + return args; +>args : T +} +const t15 = f6(1, 'b', { a: 1, b: 'x' }); +>t15 : readonly [1, "b", { readonly a: 1; readonly b: "x"; }] +>f6(1, 'b', { a: 1, b: 'x' }) : readonly [1, "b", { readonly a: 1; readonly b: "x"; }] +>f6 : (...args: T) => T +>1 : 1 +>'b' : "b" +>{ a: 1, b: 'x' } : { a: 1; b: "x"; } +>a : 1 +>1 : 1 +>b : "x" +>'x' : "x" + diff --git a/tests/baselines/reference/jsdocTemplateTag7.errors.txt b/tests/baselines/reference/jsdocTemplateTag7.errors.txt new file mode 100644 index 0000000000000..6d5770242ed17 --- /dev/null +++ b/tests/baselines/reference/jsdocTemplateTag7.errors.txt @@ -0,0 +1,28 @@ +a.js(2,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class +a.js(12,14): error TS1273: 'private' modifier cannot appear on a type parameter + + +==== a.js (2 errors) ==== + /** + * @template const T + ~~~~~ +!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class + * @typedef {[T]} X + */ + + /** + * @template const T + */ + class C { } + + /** + * @template private T + ~~~~~~~ +!!! error TS1273: 'private' modifier cannot appear on a type parameter + * @param {T} x + * @returns {T} + */ + function f(x) { + return x; + } + \ No newline at end of file diff --git a/tests/baselines/reference/jsdocTemplateTag7.symbols b/tests/baselines/reference/jsdocTemplateTag7.symbols new file mode 100644 index 0000000000000..2d734a70fbb87 --- /dev/null +++ b/tests/baselines/reference/jsdocTemplateTag7.symbols @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/jsdoc/jsdocTemplateTag7.ts] //// + +=== a.js === +/** + * @template const T + * @typedef {[T]} X + */ + +/** + * @template const T + */ +class C { } +>C : Symbol(C, Decl(a.js, 0, 0)) + +/** + * @template private T + * @param {T} x + * @returns {T} + */ +function f(x) { +>f : Symbol(f, Decl(a.js, 8, 11)) +>x : Symbol(x, Decl(a.js, 15, 11)) + + return x; +>x : Symbol(x, Decl(a.js, 15, 11)) +} + diff --git a/tests/baselines/reference/jsdocTemplateTag7.types b/tests/baselines/reference/jsdocTemplateTag7.types new file mode 100644 index 0000000000000..7a49d72b4a4c9 --- /dev/null +++ b/tests/baselines/reference/jsdocTemplateTag7.types @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/jsdoc/jsdocTemplateTag7.ts] //// + +=== a.js === +/** + * @template const T + * @typedef {[T]} X + */ + +/** + * @template const T + */ +class C { } +>C : C + +/** + * @template private T + * @param {T} x + * @returns {T} + */ +function f(x) { +>f : (x: T) => T +>x : T + + return x; +>x : T +} + diff --git a/tests/baselines/reference/jsdocTemplateTag8.errors.txt b/tests/baselines/reference/jsdocTemplateTag8.errors.txt new file mode 100644 index 0000000000000..1c592ae231840 --- /dev/null +++ b/tests/baselines/reference/jsdocTemplateTag8.errors.txt @@ -0,0 +1,97 @@ +a.js(18,1): error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. + Type 'unknown' is not assignable to type 'string'. +a.js(36,1): error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. + Type 'unknown' is not assignable to type 'string'. +a.js(55,1): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. + Types of property 'f' are incompatible. + Type '(x: string) => string' is not assignable to type '(x: unknown) => unknown'. + Types of parameters 'x' and 'x' are incompatible. + Type 'unknown' is not assignable to type 'string'. +a.js(56,1): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. + The types returned by 'f(...)' are incompatible between these types. + Type 'unknown' is not assignable to type 'string'. +a.js(59,14): error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias + + +==== a.js (5 errors) ==== + /** + * @template out T + * @typedef {Object} Covariant + * @property {T} x + */ + + /** + * @type {Covariant} + */ + let super_covariant = { x: 1 }; + + /** + * @type {Covariant} + */ + let sub_covariant = { x: '' }; + + super_covariant = sub_covariant; + sub_covariant = super_covariant; // Error + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. + + /** + * @template in T + * @typedef {Object} Contravariant + * @property {(x: T) => void} f + */ + + /** + * @type {Contravariant} + */ + let super_contravariant = { f: (x) => {} }; + + /** + * @type {Contravariant} + */ + let sub_contravariant = { f: (x) => {} }; + + super_contravariant = sub_contravariant; // Error + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. + sub_contravariant = super_contravariant; + + /** + * @template in out T + * @typedef {Object} Invariant + * @property {(x: T) => T} f + */ + + /** + * @type {Invariant} + */ + let super_invariant = { f: (x) => {} }; + + /** + * @type {Invariant} + */ + let sub_invariant = { f: (x) => { return "" } }; + + super_invariant = sub_invariant; // Error + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. +!!! error TS2322: Types of property 'f' are incompatible. +!!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: unknown) => unknown'. +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. + sub_invariant = super_invariant; // Error + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. +!!! error TS2322: The types returned by 'f(...)' are incompatible between these types. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. + + /** + * @template in T + ~~ +!!! error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias + * @param {T} x + */ + function f(x) {} + \ No newline at end of file diff --git a/tests/baselines/reference/jsdocTemplateTag8.symbols b/tests/baselines/reference/jsdocTemplateTag8.symbols new file mode 100644 index 0000000000000..5b6d103ed0230 --- /dev/null +++ b/tests/baselines/reference/jsdocTemplateTag8.symbols @@ -0,0 +1,99 @@ +//// [tests/cases/conformance/jsdoc/jsdocTemplateTag8.ts] //// + +=== a.js === +/** + * @template out T + * @typedef {Object} Covariant + * @property {T} x + */ + +/** + * @type {Covariant} + */ +let super_covariant = { x: 1 }; +>super_covariant : Symbol(super_covariant, Decl(a.js, 9, 3)) +>x : Symbol(x, Decl(a.js, 9, 23)) + +/** + * @type {Covariant} + */ +let sub_covariant = { x: '' }; +>sub_covariant : Symbol(sub_covariant, Decl(a.js, 14, 3)) +>x : Symbol(x, Decl(a.js, 14, 21)) + +super_covariant = sub_covariant; +>super_covariant : Symbol(super_covariant, Decl(a.js, 9, 3)) +>sub_covariant : Symbol(sub_covariant, Decl(a.js, 14, 3)) + +sub_covariant = super_covariant; // Error +>sub_covariant : Symbol(sub_covariant, Decl(a.js, 14, 3)) +>super_covariant : Symbol(super_covariant, Decl(a.js, 9, 3)) + +/** + * @template in T + * @typedef {Object} Contravariant + * @property {(x: T) => void} f + */ + +/** + * @type {Contravariant} + */ +let super_contravariant = { f: (x) => {} }; +>super_contravariant : Symbol(super_contravariant, Decl(a.js, 28, 3)) +>f : Symbol(f, Decl(a.js, 28, 27)) +>x : Symbol(x, Decl(a.js, 28, 32)) + +/** + * @type {Contravariant} + */ +let sub_contravariant = { f: (x) => {} }; +>sub_contravariant : Symbol(sub_contravariant, Decl(a.js, 33, 3)) +>f : Symbol(f, Decl(a.js, 33, 25)) +>x : Symbol(x, Decl(a.js, 33, 30)) + +super_contravariant = sub_contravariant; // Error +>super_contravariant : Symbol(super_contravariant, Decl(a.js, 28, 3)) +>sub_contravariant : Symbol(sub_contravariant, Decl(a.js, 33, 3)) + +sub_contravariant = super_contravariant; +>sub_contravariant : Symbol(sub_contravariant, Decl(a.js, 33, 3)) +>super_contravariant : Symbol(super_contravariant, Decl(a.js, 28, 3)) + +/** + * @template in out T + * @typedef {Object} Invariant + * @property {(x: T) => T} f + */ + +/** + * @type {Invariant} + */ +let super_invariant = { f: (x) => {} }; +>super_invariant : Symbol(super_invariant, Decl(a.js, 47, 3)) +>f : Symbol(f, Decl(a.js, 47, 23)) +>x : Symbol(x, Decl(a.js, 47, 28)) + +/** + * @type {Invariant} + */ +let sub_invariant = { f: (x) => { return "" } }; +>sub_invariant : Symbol(sub_invariant, Decl(a.js, 52, 3)) +>f : Symbol(f, Decl(a.js, 52, 21)) +>x : Symbol(x, Decl(a.js, 52, 26)) + +super_invariant = sub_invariant; // Error +>super_invariant : Symbol(super_invariant, Decl(a.js, 47, 3)) +>sub_invariant : Symbol(sub_invariant, Decl(a.js, 52, 3)) + +sub_invariant = super_invariant; // Error +>sub_invariant : Symbol(sub_invariant, Decl(a.js, 52, 3)) +>super_invariant : Symbol(super_invariant, Decl(a.js, 47, 3)) + +/** + * @template in T + * @param {T} x + */ +function f(x) {} +>f : Symbol(f, Decl(a.js, 55, 32)) +>x : Symbol(x, Decl(a.js, 61, 11)) + diff --git a/tests/baselines/reference/jsdocTemplateTag8.types b/tests/baselines/reference/jsdocTemplateTag8.types new file mode 100644 index 0000000000000..d085ff77d0e78 --- /dev/null +++ b/tests/baselines/reference/jsdocTemplateTag8.types @@ -0,0 +1,118 @@ +//// [tests/cases/conformance/jsdoc/jsdocTemplateTag8.ts] //// + +=== a.js === +/** + * @template out T + * @typedef {Object} Covariant + * @property {T} x + */ + +/** + * @type {Covariant} + */ +let super_covariant = { x: 1 }; +>super_covariant : Covariant +>{ x: 1 } : { x: number; } +>x : number +>1 : 1 + +/** + * @type {Covariant} + */ +let sub_covariant = { x: '' }; +>sub_covariant : Covariant +>{ x: '' } : { x: string; } +>x : string +>'' : "" + +super_covariant = sub_covariant; +>super_covariant = sub_covariant : Covariant +>super_covariant : Covariant +>sub_covariant : Covariant + +sub_covariant = super_covariant; // Error +>sub_covariant = super_covariant : Covariant +>sub_covariant : Covariant +>super_covariant : Covariant + +/** + * @template in T + * @typedef {Object} Contravariant + * @property {(x: T) => void} f + */ + +/** + * @type {Contravariant} + */ +let super_contravariant = { f: (x) => {} }; +>super_contravariant : Contravariant +>{ f: (x) => {} } : { f: (x: unknown) => void; } +>f : (x: unknown) => void +>(x) => {} : (x: unknown) => void +>x : unknown + +/** + * @type {Contravariant} + */ +let sub_contravariant = { f: (x) => {} }; +>sub_contravariant : Contravariant +>{ f: (x) => {} } : { f: (x: string) => void; } +>f : (x: string) => void +>(x) => {} : (x: string) => void +>x : string + +super_contravariant = sub_contravariant; // Error +>super_contravariant = sub_contravariant : Contravariant +>super_contravariant : Contravariant +>sub_contravariant : Contravariant + +sub_contravariant = super_contravariant; +>sub_contravariant = super_contravariant : Contravariant +>sub_contravariant : Contravariant +>super_contravariant : Contravariant + +/** + * @template in out T + * @typedef {Object} Invariant + * @property {(x: T) => T} f + */ + +/** + * @type {Invariant} + */ +let super_invariant = { f: (x) => {} }; +>super_invariant : Invariant +>{ f: (x) => {} } : { f: (x: unknown) => void; } +>f : (x: unknown) => void +>(x) => {} : (x: unknown) => void +>x : unknown + +/** + * @type {Invariant} + */ +let sub_invariant = { f: (x) => { return "" } }; +>sub_invariant : Invariant +>{ f: (x) => { return "" } } : { f: (x: string) => string; } +>f : (x: string) => string +>(x) => { return "" } : (x: string) => string +>x : string +>"" : "" + +super_invariant = sub_invariant; // Error +>super_invariant = sub_invariant : Invariant +>super_invariant : Invariant +>sub_invariant : Invariant + +sub_invariant = super_invariant; // Error +>sub_invariant = super_invariant : Invariant +>sub_invariant : Invariant +>super_invariant : Invariant + +/** + * @template in T + * @param {T} x + */ +function f(x) {} +>f : (x: T) => void +>x : T + diff --git a/tests/baselines/reference/localesObjectArgument.js b/tests/baselines/reference/localesObjectArgument.js index 59a1ddaa9d370..7bd08efad08a0 100644 --- a/tests/baselines/reference/localesObjectArgument.js +++ b/tests/baselines/reference/localesObjectArgument.js @@ -10,6 +10,8 @@ const num = 1000; const bigint = 123456789123456789n; const str = ""; +const readonlyLocales: Readonly = ['de-DE', 'ja-JP']; + now.toLocaleString(enUS); now.toLocaleDateString(enUS); now.toLocaleTimeString(enUS); @@ -32,28 +34,36 @@ str.localeCompare(str, [deDE, jaJP]); new Intl.PluralRules(enUS); new Intl.PluralRules([deDE, jaJP]); +new Intl.PluralRules(readonlyLocales); Intl.PluralRules.supportedLocalesOf(enUS); Intl.PluralRules.supportedLocalesOf([deDE, jaJP]); +Intl.PluralRules.supportedLocalesOf(readonlyLocales); new Intl.RelativeTimeFormat(enUS); new Intl.RelativeTimeFormat([deDE, jaJP]); +new Intl.RelativeTimeFormat(readonlyLocales); Intl.RelativeTimeFormat.supportedLocalesOf(enUS); Intl.RelativeTimeFormat.supportedLocalesOf([deDE, jaJP]); +Intl.RelativeTimeFormat.supportedLocalesOf(readonlyLocales); new Intl.Collator(enUS); new Intl.Collator([deDE, jaJP]); +new Intl.Collator(readonlyLocales); Intl.Collator.supportedLocalesOf(enUS); Intl.Collator.supportedLocalesOf([deDE, jaJP]); new Intl.DateTimeFormat(enUS); new Intl.DateTimeFormat([deDE, jaJP]); +new Intl.DateTimeFormat(readonlyLocales); Intl.DateTimeFormat.supportedLocalesOf(enUS); Intl.DateTimeFormat.supportedLocalesOf([deDE, jaJP]); +Intl.DateTimeFormat.supportedLocalesOf(readonlyLocales); new Intl.NumberFormat(enUS); new Intl.NumberFormat([deDE, jaJP]); +new Intl.NumberFormat(readonlyLocales); Intl.NumberFormat.supportedLocalesOf(enUS); -Intl.NumberFormat.supportedLocalesOf([deDE, jaJP]); +Intl.NumberFormat.supportedLocalesOf(readonlyLocales); //// [localesObjectArgument.js] @@ -64,6 +74,7 @@ const now = new Date(); const num = 1000; const bigint = 123456789123456789n; const str = ""; +const readonlyLocales = ['de-DE', 'ja-JP']; now.toLocaleString(enUS); now.toLocaleDateString(enUS); now.toLocaleTimeString(enUS); @@ -82,21 +93,29 @@ str.localeCompare(str, enUS); str.localeCompare(str, [deDE, jaJP]); new Intl.PluralRules(enUS); new Intl.PluralRules([deDE, jaJP]); +new Intl.PluralRules(readonlyLocales); Intl.PluralRules.supportedLocalesOf(enUS); Intl.PluralRules.supportedLocalesOf([deDE, jaJP]); +Intl.PluralRules.supportedLocalesOf(readonlyLocales); new Intl.RelativeTimeFormat(enUS); new Intl.RelativeTimeFormat([deDE, jaJP]); +new Intl.RelativeTimeFormat(readonlyLocales); Intl.RelativeTimeFormat.supportedLocalesOf(enUS); Intl.RelativeTimeFormat.supportedLocalesOf([deDE, jaJP]); +Intl.RelativeTimeFormat.supportedLocalesOf(readonlyLocales); new Intl.Collator(enUS); new Intl.Collator([deDE, jaJP]); +new Intl.Collator(readonlyLocales); Intl.Collator.supportedLocalesOf(enUS); Intl.Collator.supportedLocalesOf([deDE, jaJP]); new Intl.DateTimeFormat(enUS); new Intl.DateTimeFormat([deDE, jaJP]); +new Intl.DateTimeFormat(readonlyLocales); Intl.DateTimeFormat.supportedLocalesOf(enUS); Intl.DateTimeFormat.supportedLocalesOf([deDE, jaJP]); +Intl.DateTimeFormat.supportedLocalesOf(readonlyLocales); new Intl.NumberFormat(enUS); new Intl.NumberFormat([deDE, jaJP]); +new Intl.NumberFormat(readonlyLocales); Intl.NumberFormat.supportedLocalesOf(enUS); -Intl.NumberFormat.supportedLocalesOf([deDE, jaJP]); +Intl.NumberFormat.supportedLocalesOf(readonlyLocales); diff --git a/tests/baselines/reference/localesObjectArgument.symbols b/tests/baselines/reference/localesObjectArgument.symbols index c2c21e668249e..e0ab25d6b17ae 100644 --- a/tests/baselines/reference/localesObjectArgument.symbols +++ b/tests/baselines/reference/localesObjectArgument.symbols @@ -32,6 +32,10 @@ const bigint = 123456789123456789n; const str = ""; >str : Symbol(str, Decl(localesObjectArgument.ts, 7, 5)) +const readonlyLocales: Readonly = ['de-DE', 'ja-JP']; +>readonlyLocales : Symbol(readonlyLocales, Decl(localesObjectArgument.ts, 9, 5)) +>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --)) + now.toLocaleString(enUS); >now.toLocaleString : Symbol(Date.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --)) >now : Symbol(now, Decl(localesObjectArgument.ts, 4, 5)) @@ -151,6 +155,12 @@ new Intl.PluralRules([deDE, jaJP]); >deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5)) >jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5)) +new Intl.PluralRules(readonlyLocales); +>Intl.PluralRules : Symbol(Intl.PluralRules, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) +>PluralRules : Symbol(Intl.PluralRules, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --)) +>readonlyLocales : Symbol(readonlyLocales, Decl(localesObjectArgument.ts, 9, 5)) + Intl.PluralRules.supportedLocalesOf(enUS); >Intl.PluralRules.supportedLocalesOf : Symbol(Intl.PluralRulesConstructor.supportedLocalesOf, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) >Intl.PluralRules : Symbol(Intl.PluralRules, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --)) @@ -168,6 +178,14 @@ Intl.PluralRules.supportedLocalesOf([deDE, jaJP]); >deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5)) >jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5)) +Intl.PluralRules.supportedLocalesOf(readonlyLocales); +>Intl.PluralRules.supportedLocalesOf : Symbol(Intl.PluralRulesConstructor.supportedLocalesOf, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) +>Intl.PluralRules : Symbol(Intl.PluralRules, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) +>PluralRules : Symbol(Intl.PluralRules, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --)) +>supportedLocalesOf : Symbol(Intl.PluralRulesConstructor.supportedLocalesOf, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) +>readonlyLocales : Symbol(readonlyLocales, Decl(localesObjectArgument.ts, 9, 5)) + new Intl.RelativeTimeFormat(enUS); >Intl.RelativeTimeFormat : Symbol(Intl.RelativeTimeFormat, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) >Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) @@ -181,6 +199,12 @@ new Intl.RelativeTimeFormat([deDE, jaJP]); >deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5)) >jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5)) +new Intl.RelativeTimeFormat(readonlyLocales); +>Intl.RelativeTimeFormat : Symbol(Intl.RelativeTimeFormat, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) +>RelativeTimeFormat : Symbol(Intl.RelativeTimeFormat, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) +>readonlyLocales : Symbol(readonlyLocales, Decl(localesObjectArgument.ts, 9, 5)) + Intl.RelativeTimeFormat.supportedLocalesOf(enUS); >Intl.RelativeTimeFormat.supportedLocalesOf : Symbol(supportedLocalesOf, Decl(lib.es2020.intl.d.ts, --, --)) >Intl.RelativeTimeFormat : Symbol(Intl.RelativeTimeFormat, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) @@ -198,6 +222,14 @@ Intl.RelativeTimeFormat.supportedLocalesOf([deDE, jaJP]); >deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5)) >jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5)) +Intl.RelativeTimeFormat.supportedLocalesOf(readonlyLocales); +>Intl.RelativeTimeFormat.supportedLocalesOf : Symbol(supportedLocalesOf, Decl(lib.es2020.intl.d.ts, --, --)) +>Intl.RelativeTimeFormat : Symbol(Intl.RelativeTimeFormat, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) +>RelativeTimeFormat : Symbol(Intl.RelativeTimeFormat, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) +>supportedLocalesOf : Symbol(supportedLocalesOf, Decl(lib.es2020.intl.d.ts, --, --)) +>readonlyLocales : Symbol(readonlyLocales, Decl(localesObjectArgument.ts, 9, 5)) + new Intl.Collator(enUS); >Intl.Collator : Symbol(Intl.Collator, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) @@ -211,6 +243,12 @@ new Intl.Collator([deDE, jaJP]); >deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5)) >jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5)) +new Intl.Collator(readonlyLocales); +>Intl.Collator : Symbol(Intl.Collator, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) +>Collator : Symbol(Intl.Collator, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>readonlyLocales : Symbol(readonlyLocales, Decl(localesObjectArgument.ts, 9, 5)) + Intl.Collator.supportedLocalesOf(enUS); >Intl.Collator.supportedLocalesOf : Symbol(Intl.CollatorConstructor.supportedLocalesOf, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) >Intl.Collator : Symbol(Intl.Collator, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) @@ -241,6 +279,12 @@ new Intl.DateTimeFormat([deDE, jaJP]); >deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5)) >jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5)) +new Intl.DateTimeFormat(readonlyLocales); +>Intl.DateTimeFormat : Symbol(Intl.DateTimeFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) +>DateTimeFormat : Symbol(Intl.DateTimeFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --)) +>readonlyLocales : Symbol(readonlyLocales, Decl(localesObjectArgument.ts, 9, 5)) + Intl.DateTimeFormat.supportedLocalesOf(enUS); >Intl.DateTimeFormat.supportedLocalesOf : Symbol(Intl.DateTimeFormatConstructor.supportedLocalesOf, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) >Intl.DateTimeFormat : Symbol(Intl.DateTimeFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --)) @@ -258,6 +302,14 @@ Intl.DateTimeFormat.supportedLocalesOf([deDE, jaJP]); >deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5)) >jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5)) +Intl.DateTimeFormat.supportedLocalesOf(readonlyLocales); +>Intl.DateTimeFormat.supportedLocalesOf : Symbol(Intl.DateTimeFormatConstructor.supportedLocalesOf, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) +>Intl.DateTimeFormat : Symbol(Intl.DateTimeFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) +>DateTimeFormat : Symbol(Intl.DateTimeFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --)) +>supportedLocalesOf : Symbol(Intl.DateTimeFormatConstructor.supportedLocalesOf, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) +>readonlyLocales : Symbol(readonlyLocales, Decl(localesObjectArgument.ts, 9, 5)) + new Intl.NumberFormat(enUS); >Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) >Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) @@ -271,6 +323,12 @@ new Intl.NumberFormat([deDE, jaJP]); >deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5)) >jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5)) +new Intl.NumberFormat(readonlyLocales); +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>readonlyLocales : Symbol(readonlyLocales, Decl(localesObjectArgument.ts, 9, 5)) + Intl.NumberFormat.supportedLocalesOf(enUS); >Intl.NumberFormat.supportedLocalesOf : Symbol(Intl.NumberFormatConstructor.supportedLocalesOf, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) >Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) @@ -279,12 +337,11 @@ Intl.NumberFormat.supportedLocalesOf(enUS); >supportedLocalesOf : Symbol(Intl.NumberFormatConstructor.supportedLocalesOf, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) >enUS : Symbol(enUS, Decl(localesObjectArgument.ts, 0, 5)) -Intl.NumberFormat.supportedLocalesOf([deDE, jaJP]); +Intl.NumberFormat.supportedLocalesOf(readonlyLocales); >Intl.NumberFormat.supportedLocalesOf : Symbol(Intl.NumberFormatConstructor.supportedLocalesOf, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) >Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) >Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 2 more) >NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) >supportedLocalesOf : Symbol(Intl.NumberFormatConstructor.supportedLocalesOf, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) ->deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5)) ->jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5)) +>readonlyLocales : Symbol(readonlyLocales, Decl(localesObjectArgument.ts, 9, 5)) diff --git a/tests/baselines/reference/localesObjectArgument.types b/tests/baselines/reference/localesObjectArgument.types index 075b79567ff01..2e891df6faf76 100644 --- a/tests/baselines/reference/localesObjectArgument.types +++ b/tests/baselines/reference/localesObjectArgument.types @@ -42,6 +42,12 @@ const str = ""; >str : "" >"" : "" +const readonlyLocales: Readonly = ['de-DE', 'ja-JP']; +>readonlyLocales : readonly string[] +>['de-DE', 'ja-JP'] : string[] +>'de-DE' : "de-DE" +>'ja-JP' : "ja-JP" + now.toLocaleString(enUS); >now.toLocaleString(enUS) : string >now.toLocaleString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; } @@ -188,26 +194,42 @@ new Intl.PluralRules([deDE, jaJP]); >deDE : Intl.Locale >jaJP : Intl.Locale +new Intl.PluralRules(readonlyLocales); +>new Intl.PluralRules(readonlyLocales) : Intl.PluralRules +>Intl.PluralRules : Intl.PluralRulesConstructor +>Intl : typeof Intl +>PluralRules : Intl.PluralRulesConstructor +>readonlyLocales : readonly string[] + Intl.PluralRules.supportedLocalesOf(enUS); >Intl.PluralRules.supportedLocalesOf(enUS) : string[] ->Intl.PluralRules.supportedLocalesOf : { (locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; (locales: Intl.LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } +>Intl.PluralRules.supportedLocalesOf : { (locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; (locales: Intl.LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } >Intl.PluralRules : Intl.PluralRulesConstructor >Intl : typeof Intl >PluralRules : Intl.PluralRulesConstructor ->supportedLocalesOf : { (locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; (locales: Intl.LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } +>supportedLocalesOf : { (locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; (locales: Intl.LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } >enUS : Intl.Locale Intl.PluralRules.supportedLocalesOf([deDE, jaJP]); >Intl.PluralRules.supportedLocalesOf([deDE, jaJP]) : string[] ->Intl.PluralRules.supportedLocalesOf : { (locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; (locales: Intl.LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } +>Intl.PluralRules.supportedLocalesOf : { (locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; (locales: Intl.LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } >Intl.PluralRules : Intl.PluralRulesConstructor >Intl : typeof Intl >PluralRules : Intl.PluralRulesConstructor ->supportedLocalesOf : { (locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; (locales: Intl.LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } +>supportedLocalesOf : { (locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; (locales: Intl.LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } >[deDE, jaJP] : Intl.Locale[] >deDE : Intl.Locale >jaJP : Intl.Locale +Intl.PluralRules.supportedLocalesOf(readonlyLocales); +>Intl.PluralRules.supportedLocalesOf(readonlyLocales) : string[] +>Intl.PluralRules.supportedLocalesOf : { (locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; (locales: Intl.LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } +>Intl.PluralRules : Intl.PluralRulesConstructor +>Intl : typeof Intl +>PluralRules : Intl.PluralRulesConstructor +>supportedLocalesOf : { (locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; (locales: Intl.LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; } +>readonlyLocales : readonly string[] + new Intl.RelativeTimeFormat(enUS); >new Intl.RelativeTimeFormat(enUS) : Intl.RelativeTimeFormat >Intl.RelativeTimeFormat : { new (locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions): Intl.RelativeTimeFormat; supportedLocalesOf(locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions): string[]; } @@ -224,6 +246,13 @@ new Intl.RelativeTimeFormat([deDE, jaJP]); >deDE : Intl.Locale >jaJP : Intl.Locale +new Intl.RelativeTimeFormat(readonlyLocales); +>new Intl.RelativeTimeFormat(readonlyLocales) : Intl.RelativeTimeFormat +>Intl.RelativeTimeFormat : { new (locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions): Intl.RelativeTimeFormat; supportedLocalesOf(locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions): string[]; } +>Intl : typeof Intl +>RelativeTimeFormat : { new (locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions): Intl.RelativeTimeFormat; supportedLocalesOf(locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions): string[]; } +>readonlyLocales : readonly string[] + Intl.RelativeTimeFormat.supportedLocalesOf(enUS); >Intl.RelativeTimeFormat.supportedLocalesOf(enUS) : string[] >Intl.RelativeTimeFormat.supportedLocalesOf : (locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions) => string[] @@ -244,6 +273,15 @@ Intl.RelativeTimeFormat.supportedLocalesOf([deDE, jaJP]); >deDE : Intl.Locale >jaJP : Intl.Locale +Intl.RelativeTimeFormat.supportedLocalesOf(readonlyLocales); +>Intl.RelativeTimeFormat.supportedLocalesOf(readonlyLocales) : string[] +>Intl.RelativeTimeFormat.supportedLocalesOf : (locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions) => string[] +>Intl.RelativeTimeFormat : { new (locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions): Intl.RelativeTimeFormat; supportedLocalesOf(locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions): string[]; } +>Intl : typeof Intl +>RelativeTimeFormat : { new (locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions): Intl.RelativeTimeFormat; supportedLocalesOf(locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions): string[]; } +>supportedLocalesOf : (locales?: Intl.LocalesArgument, options?: Intl.RelativeTimeFormatOptions) => string[] +>readonlyLocales : readonly string[] + new Intl.Collator(enUS); >new Intl.Collator(enUS) : Intl.Collator >Intl.Collator : Intl.CollatorConstructor @@ -260,6 +298,13 @@ new Intl.Collator([deDE, jaJP]); >deDE : Intl.Locale >jaJP : Intl.Locale +new Intl.Collator(readonlyLocales); +>new Intl.Collator(readonlyLocales) : Intl.Collator +>Intl.Collator : Intl.CollatorConstructor +>Intl : typeof Intl +>Collator : Intl.CollatorConstructor +>readonlyLocales : readonly string[] + Intl.Collator.supportedLocalesOf(enUS); >Intl.Collator.supportedLocalesOf(enUS) : string[] >Intl.Collator.supportedLocalesOf : { (locales: string | string[], options?: Intl.CollatorOptions): string[]; (locales: Intl.LocalesArgument, options?: Intl.CollatorOptions): string[]; } @@ -296,6 +341,13 @@ new Intl.DateTimeFormat([deDE, jaJP]); >deDE : Intl.Locale >jaJP : Intl.Locale +new Intl.DateTimeFormat(readonlyLocales); +>new Intl.DateTimeFormat(readonlyLocales) : Intl.DateTimeFormat +>Intl.DateTimeFormat : Intl.DateTimeFormatConstructor +>Intl : typeof Intl +>DateTimeFormat : Intl.DateTimeFormatConstructor +>readonlyLocales : readonly string[] + Intl.DateTimeFormat.supportedLocalesOf(enUS); >Intl.DateTimeFormat.supportedLocalesOf(enUS) : string[] >Intl.DateTimeFormat.supportedLocalesOf : { (locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; (locales: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string[]; } @@ -316,6 +368,15 @@ Intl.DateTimeFormat.supportedLocalesOf([deDE, jaJP]); >deDE : Intl.Locale >jaJP : Intl.Locale +Intl.DateTimeFormat.supportedLocalesOf(readonlyLocales); +>Intl.DateTimeFormat.supportedLocalesOf(readonlyLocales) : string[] +>Intl.DateTimeFormat.supportedLocalesOf : { (locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; (locales: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string[]; } +>Intl.DateTimeFormat : Intl.DateTimeFormatConstructor +>Intl : typeof Intl +>DateTimeFormat : Intl.DateTimeFormatConstructor +>supportedLocalesOf : { (locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; (locales: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string[]; } +>readonlyLocales : readonly string[] + new Intl.NumberFormat(enUS); >new Intl.NumberFormat(enUS) : Intl.NumberFormat >Intl.NumberFormat : Intl.NumberFormatConstructor @@ -332,6 +393,13 @@ new Intl.NumberFormat([deDE, jaJP]); >deDE : Intl.Locale >jaJP : Intl.Locale +new Intl.NumberFormat(readonlyLocales); +>new Intl.NumberFormat(readonlyLocales) : Intl.NumberFormat +>Intl.NumberFormat : Intl.NumberFormatConstructor +>Intl : typeof Intl +>NumberFormat : Intl.NumberFormatConstructor +>readonlyLocales : readonly string[] + Intl.NumberFormat.supportedLocalesOf(enUS); >Intl.NumberFormat.supportedLocalesOf(enUS) : string[] >Intl.NumberFormat.supportedLocalesOf : { (locales: string | string[], options?: Intl.NumberFormatOptions): string[]; (locales: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string[]; } @@ -341,14 +409,12 @@ Intl.NumberFormat.supportedLocalesOf(enUS); >supportedLocalesOf : { (locales: string | string[], options?: Intl.NumberFormatOptions): string[]; (locales: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string[]; } >enUS : Intl.Locale -Intl.NumberFormat.supportedLocalesOf([deDE, jaJP]); ->Intl.NumberFormat.supportedLocalesOf([deDE, jaJP]) : string[] +Intl.NumberFormat.supportedLocalesOf(readonlyLocales); +>Intl.NumberFormat.supportedLocalesOf(readonlyLocales) : string[] >Intl.NumberFormat.supportedLocalesOf : { (locales: string | string[], options?: Intl.NumberFormatOptions): string[]; (locales: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string[]; } >Intl.NumberFormat : Intl.NumberFormatConstructor >Intl : typeof Intl >NumberFormat : Intl.NumberFormatConstructor >supportedLocalesOf : { (locales: string | string[], options?: Intl.NumberFormatOptions): string[]; (locales: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string[]; } ->[deDE, jaJP] : Intl.Locale[] ->deDE : Intl.Locale ->jaJP : Intl.Locale +>readonlyLocales : readonly string[] diff --git a/tests/baselines/reference/mappedTypeInferenceFromApparentType.errors.txt b/tests/baselines/reference/mappedTypeInferenceFromApparentType.errors.txt new file mode 100644 index 0000000000000..f61f0d58bcb99 --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceFromApparentType.errors.txt @@ -0,0 +1,26 @@ +mappedTypeInferenceFromApparentType.ts(10,1): error TS2322: Type 'foo' is not assignable to type 'bar'. + Types of parameters 'target' and 'source' are incompatible. + Type '{ [K in keyof U]: Obj[K]; }' is not assignable to type '{ [K in keyof U]: U[K]; }'. + Type 'Obj[K]' is not assignable to type 'U[K]'. + Type 'Obj' is not assignable to type 'U'. + 'U' could be instantiated with an arbitrary type which could be unrelated to 'Obj'. + + +==== mappedTypeInferenceFromApparentType.ts (1 errors) ==== + type Obj = { + [s: string]: number; + }; + + type foo = (target: { [K in keyof T]: T[K] }) => void; + type bar = (source: { [K in keyof U]: Obj[K] }) => void; + + declare let f: foo; + declare let b: bar; + b = f; + ~ +!!! error TS2322: Type 'foo' is not assignable to type 'bar'. +!!! error TS2322: Types of parameters 'target' and 'source' are incompatible. +!!! error TS2322: Type '{ [K in keyof U]: Obj[K]; }' is not assignable to type '{ [K in keyof U]: U[K]; }'. +!!! error TS2322: Type 'Obj[K]' is not assignable to type 'U[K]'. +!!! error TS2322: Type 'Obj' is not assignable to type 'U'. +!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Obj'. \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeInferenceFromApparentType.symbols b/tests/baselines/reference/mappedTypeInferenceFromApparentType.symbols new file mode 100644 index 0000000000000..3f76c44db9d59 --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceFromApparentType.symbols @@ -0,0 +1,41 @@ +//// [tests/cases/compiler/mappedTypeInferenceFromApparentType.ts] //// + +=== mappedTypeInferenceFromApparentType.ts === +type Obj = { +>Obj : Symbol(Obj, Decl(mappedTypeInferenceFromApparentType.ts, 0, 0)) + + [s: string]: number; +>s : Symbol(s, Decl(mappedTypeInferenceFromApparentType.ts, 1, 5)) + +}; + +type foo = (target: { [K in keyof T]: T[K] }) => void; +>foo : Symbol(foo, Decl(mappedTypeInferenceFromApparentType.ts, 2, 2)) +>T : Symbol(T, Decl(mappedTypeInferenceFromApparentType.ts, 4, 12)) +>target : Symbol(target, Decl(mappedTypeInferenceFromApparentType.ts, 4, 15)) +>K : Symbol(K, Decl(mappedTypeInferenceFromApparentType.ts, 4, 26)) +>T : Symbol(T, Decl(mappedTypeInferenceFromApparentType.ts, 4, 12)) +>T : Symbol(T, Decl(mappedTypeInferenceFromApparentType.ts, 4, 12)) +>K : Symbol(K, Decl(mappedTypeInferenceFromApparentType.ts, 4, 26)) + +type bar = (source: { [K in keyof U]: Obj[K] }) => void; +>bar : Symbol(bar, Decl(mappedTypeInferenceFromApparentType.ts, 4, 57)) +>U : Symbol(U, Decl(mappedTypeInferenceFromApparentType.ts, 5, 12)) +>source : Symbol(source, Decl(mappedTypeInferenceFromApparentType.ts, 5, 32)) +>K : Symbol(K, Decl(mappedTypeInferenceFromApparentType.ts, 5, 43)) +>U : Symbol(U, Decl(mappedTypeInferenceFromApparentType.ts, 5, 12)) +>Obj : Symbol(Obj, Decl(mappedTypeInferenceFromApparentType.ts, 0, 0)) +>K : Symbol(K, Decl(mappedTypeInferenceFromApparentType.ts, 5, 43)) + +declare let f: foo; +>f : Symbol(f, Decl(mappedTypeInferenceFromApparentType.ts, 7, 11)) +>foo : Symbol(foo, Decl(mappedTypeInferenceFromApparentType.ts, 2, 2)) + +declare let b: bar; +>b : Symbol(b, Decl(mappedTypeInferenceFromApparentType.ts, 8, 11)) +>bar : Symbol(bar, Decl(mappedTypeInferenceFromApparentType.ts, 4, 57)) + +b = f; +>b : Symbol(b, Decl(mappedTypeInferenceFromApparentType.ts, 8, 11)) +>f : Symbol(f, Decl(mappedTypeInferenceFromApparentType.ts, 7, 11)) + diff --git a/tests/baselines/reference/mappedTypeInferenceFromApparentType.types b/tests/baselines/reference/mappedTypeInferenceFromApparentType.types new file mode 100644 index 0000000000000..41705b518d68e --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceFromApparentType.types @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/mappedTypeInferenceFromApparentType.ts] //// + +=== mappedTypeInferenceFromApparentType.ts === +type Obj = { +>Obj : { [s: string]: number; } + + [s: string]: number; +>s : string + +}; + +type foo = (target: { [K in keyof T]: T[K] }) => void; +>foo : (target: { [K in keyof T]: T[K]; }) => void +>target : { [K in keyof T]: T[K]; } + +type bar = (source: { [K in keyof U]: Obj[K] }) => void; +>bar : (source: { [K in keyof U]: Obj[K]; }) => void +>source : { [K in keyof U]: Obj[K]; } + +declare let f: foo; +>f : foo + +declare let b: bar; +>b : bar + +b = f; +>b = f : foo +>b : bar +>f : foo + diff --git a/tests/baselines/reference/mappedTypeInferenceToMappedType.symbols b/tests/baselines/reference/mappedTypeInferenceToMappedType.symbols new file mode 100644 index 0000000000000..b1f19eadcb01f --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceToMappedType.symbols @@ -0,0 +1,42 @@ +//// [tests/cases/compiler/mappedTypeInferenceToMappedType.ts] //// + +=== mappedTypeInferenceToMappedType.ts === +// #56133 + +declare class Base { +>Base : Symbol(Base, Decl(mappedTypeInferenceToMappedType.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeInferenceToMappedType.ts, 2, 19)) + + someProp: T; +>someProp : Symbol(Base.someProp, Decl(mappedTypeInferenceToMappedType.ts, 2, 23)) +>T : Symbol(T, Decl(mappedTypeInferenceToMappedType.ts, 2, 19)) + + method(x: { [K in keyof U]: U[K] }): Base; +>method : Symbol(Base.method, Decl(mappedTypeInferenceToMappedType.ts, 3, 16)) +>U : Symbol(U, Decl(mappedTypeInferenceToMappedType.ts, 4, 11)) +>x : Symbol(x, Decl(mappedTypeInferenceToMappedType.ts, 4, 32)) +>K : Symbol(K, Decl(mappedTypeInferenceToMappedType.ts, 4, 38)) +>U : Symbol(U, Decl(mappedTypeInferenceToMappedType.ts, 4, 11)) +>U : Symbol(U, Decl(mappedTypeInferenceToMappedType.ts, 4, 11)) +>K : Symbol(K, Decl(mappedTypeInferenceToMappedType.ts, 4, 38)) +>Base : Symbol(Base, Decl(mappedTypeInferenceToMappedType.ts, 0, 0)) +>U : Symbol(U, Decl(mappedTypeInferenceToMappedType.ts, 4, 11)) +} + +declare class Derived extends Base { +>Derived : Symbol(Derived, Decl(mappedTypeInferenceToMappedType.ts, 5, 1)) +>T : Symbol(T, Decl(mappedTypeInferenceToMappedType.ts, 7, 22)) +>Base : Symbol(Base, Decl(mappedTypeInferenceToMappedType.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeInferenceToMappedType.ts, 7, 22)) + + method(x: { [K in keyof V]: V[K] }): Base; +>method : Symbol(Derived.method, Decl(mappedTypeInferenceToMappedType.ts, 7, 42)) +>V : Symbol(V, Decl(mappedTypeInferenceToMappedType.ts, 8, 11)) +>x : Symbol(x, Decl(mappedTypeInferenceToMappedType.ts, 8, 32)) +>K : Symbol(K, Decl(mappedTypeInferenceToMappedType.ts, 8, 38)) +>V : Symbol(V, Decl(mappedTypeInferenceToMappedType.ts, 8, 11)) +>V : Symbol(V, Decl(mappedTypeInferenceToMappedType.ts, 8, 11)) +>K : Symbol(K, Decl(mappedTypeInferenceToMappedType.ts, 8, 38)) +>Base : Symbol(Base, Decl(mappedTypeInferenceToMappedType.ts, 0, 0)) +>V : Symbol(V, Decl(mappedTypeInferenceToMappedType.ts, 8, 11)) +} diff --git a/tests/baselines/reference/mappedTypeInferenceToMappedType.types b/tests/baselines/reference/mappedTypeInferenceToMappedType.types new file mode 100644 index 0000000000000..9474e8de6fb98 --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceToMappedType.types @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/mappedTypeInferenceToMappedType.ts] //// + +=== mappedTypeInferenceToMappedType.ts === +// #56133 + +declare class Base { +>Base : Base + + someProp: T; +>someProp : T + + method(x: { [K in keyof U]: U[K] }): Base; +>method : (x: { [K in keyof U]: U[K]; }) => Base +>x : { [K in keyof U]: U[K]; } +} + +declare class Derived extends Base { +>Derived : Derived +>Base : Base + + method(x: { [K in keyof V]: V[K] }): Base; +>method : (x: { [K in keyof V]: V[K]; }) => Base +>x : { [K in keyof V]: V[K]; } +} diff --git a/tests/baselines/reference/mergedInstantiationAssignment.symbols b/tests/baselines/reference/mergedInstantiationAssignment.symbols new file mode 100644 index 0000000000000..2465d45c55743 --- /dev/null +++ b/tests/baselines/reference/mergedInstantiationAssignment.symbols @@ -0,0 +1,74 @@ +//// [tests/cases/compiler/mergedInstantiationAssignment.ts] //// + +=== mergedInstantiationAssignment.ts === +// https://github.com/microsoft/TypeScript/issues/56320 + +class GenericObject { +>GenericObject : Symbol(GenericObject, Decl(mergedInstantiationAssignment.ts, 0, 0)) +>T : Symbol(T, Decl(mergedInstantiationAssignment.ts, 2, 20)) + + set x(x: T) {} +>x : Symbol(GenericObject.x, Decl(mergedInstantiationAssignment.ts, 2, 33)) +>x : Symbol(x, Decl(mergedInstantiationAssignment.ts, 3, 8)) +>T : Symbol(T, Decl(mergedInstantiationAssignment.ts, 2, 20)) +} + +const v1 = new GenericObject() as GenericObject & +>v1 : Symbol(v1, Decl(mergedInstantiationAssignment.ts, 6, 5)) +>GenericObject : Symbol(GenericObject, Decl(mergedInstantiationAssignment.ts, 0, 0)) +>GenericObject : Symbol(GenericObject, Decl(mergedInstantiationAssignment.ts, 0, 0)) + + ({ a?: string } | { b?: number }); +>a : Symbol(a, Decl(mergedInstantiationAssignment.ts, 7, 4)) +>b : Symbol(b, Decl(mergedInstantiationAssignment.ts, 7, 21)) + +v1.x = 432; +>v1.x : Symbol(GenericObject.x, Decl(mergedInstantiationAssignment.ts, 2, 33)) +>v1 : Symbol(v1, Decl(mergedInstantiationAssignment.ts, 6, 5)) +>x : Symbol(GenericObject.x, Decl(mergedInstantiationAssignment.ts, 2, 33)) + +class GenericObjectWithoutSetter { +>GenericObjectWithoutSetter : Symbol(GenericObjectWithoutSetter, Decl(mergedInstantiationAssignment.ts, 8, 11)) +>T : Symbol(T, Decl(mergedInstantiationAssignment.ts, 10, 33)) + + declare x: T; +>x : Symbol(GenericObjectWithoutSetter.x, Decl(mergedInstantiationAssignment.ts, 10, 46)) +>T : Symbol(T, Decl(mergedInstantiationAssignment.ts, 10, 33)) +} + +const v2 = new GenericObjectWithoutSetter() as GenericObjectWithoutSetter & +>v2 : Symbol(v2, Decl(mergedInstantiationAssignment.ts, 14, 5)) +>GenericObjectWithoutSetter : Symbol(GenericObjectWithoutSetter, Decl(mergedInstantiationAssignment.ts, 8, 11)) +>GenericObjectWithoutSetter : Symbol(GenericObjectWithoutSetter, Decl(mergedInstantiationAssignment.ts, 8, 11)) + + ({ a?: string } | { b?: number }); +>a : Symbol(a, Decl(mergedInstantiationAssignment.ts, 15, 4)) +>b : Symbol(b, Decl(mergedInstantiationAssignment.ts, 15, 21)) + +v2.x = 42; +>v2.x : Symbol(GenericObjectWithoutSetter.x, Decl(mergedInstantiationAssignment.ts, 10, 46)) +>v2 : Symbol(v2, Decl(mergedInstantiationAssignment.ts, 14, 5)) +>x : Symbol(GenericObjectWithoutSetter.x, Decl(mergedInstantiationAssignment.ts, 10, 46)) + +class NormalObject { +>NormalObject : Symbol(NormalObject, Decl(mergedInstantiationAssignment.ts, 16, 10)) + + set x(x: number) {} +>x : Symbol(NormalObject.x, Decl(mergedInstantiationAssignment.ts, 18, 20)) +>x : Symbol(x, Decl(mergedInstantiationAssignment.ts, 19, 8)) +} + +const v3 = new NormalObject() as NormalObject & +>v3 : Symbol(v3, Decl(mergedInstantiationAssignment.ts, 22, 5)) +>NormalObject : Symbol(NormalObject, Decl(mergedInstantiationAssignment.ts, 16, 10)) +>NormalObject : Symbol(NormalObject, Decl(mergedInstantiationAssignment.ts, 16, 10)) + + ({ a?: string } | { b?: number }); +>a : Symbol(a, Decl(mergedInstantiationAssignment.ts, 23, 4)) +>b : Symbol(b, Decl(mergedInstantiationAssignment.ts, 23, 21)) + +v3.x = 42; +>v3.x : Symbol(NormalObject.x, Decl(mergedInstantiationAssignment.ts, 18, 20)) +>v3 : Symbol(v3, Decl(mergedInstantiationAssignment.ts, 22, 5)) +>x : Symbol(NormalObject.x, Decl(mergedInstantiationAssignment.ts, 18, 20)) + diff --git a/tests/baselines/reference/mergedInstantiationAssignment.types b/tests/baselines/reference/mergedInstantiationAssignment.types new file mode 100644 index 0000000000000..e6d9956152c40 --- /dev/null +++ b/tests/baselines/reference/mergedInstantiationAssignment.types @@ -0,0 +1,79 @@ +//// [tests/cases/compiler/mergedInstantiationAssignment.ts] //// + +=== mergedInstantiationAssignment.ts === +// https://github.com/microsoft/TypeScript/issues/56320 + +class GenericObject { +>GenericObject : GenericObject + + set x(x: T) {} +>x : T +>x : T +} + +const v1 = new GenericObject() as GenericObject & +>v1 : GenericObject & ({ a?: string | undefined; } | { b?: number | undefined; }) +>new GenericObject() as GenericObject & ({ a?: string } | { b?: number }) : GenericObject & ({ a?: string | undefined; } | { b?: number | undefined; }) +>new GenericObject() : GenericObject +>GenericObject : typeof GenericObject + + ({ a?: string } | { b?: number }); +>a : string | undefined +>b : number | undefined + +v1.x = 432; +>v1.x = 432 : 432 +>v1.x : number +>v1 : GenericObject & ({ a?: string | undefined; } | { b?: number | undefined; }) +>x : number +>432 : 432 + +class GenericObjectWithoutSetter { +>GenericObjectWithoutSetter : GenericObjectWithoutSetter + + declare x: T; +>x : T +} + +const v2 = new GenericObjectWithoutSetter() as GenericObjectWithoutSetter & +>v2 : GenericObjectWithoutSetter & ({ a?: string | undefined; } | { b?: number | undefined; }) +>new GenericObjectWithoutSetter() as GenericObjectWithoutSetter & ({ a?: string } | { b?: number }) : GenericObjectWithoutSetter & ({ a?: string | undefined; } | { b?: number | undefined; }) +>new GenericObjectWithoutSetter() : GenericObjectWithoutSetter +>GenericObjectWithoutSetter : typeof GenericObjectWithoutSetter + + ({ a?: string } | { b?: number }); +>a : string | undefined +>b : number | undefined + +v2.x = 42; +>v2.x = 42 : 42 +>v2.x : number +>v2 : GenericObjectWithoutSetter & ({ a?: string | undefined; } | { b?: number | undefined; }) +>x : number +>42 : 42 + +class NormalObject { +>NormalObject : NormalObject + + set x(x: number) {} +>x : number +>x : number +} + +const v3 = new NormalObject() as NormalObject & +>v3 : NormalObject & ({ a?: string | undefined; } | { b?: number | undefined; }) +>new NormalObject() as NormalObject & ({ a?: string } | { b?: number }) : NormalObject & ({ a?: string | undefined; } | { b?: number | undefined; }) +>new NormalObject() : NormalObject +>NormalObject : typeof NormalObject + + ({ a?: string } | { b?: number }); +>a : string | undefined +>b : number | undefined + +v3.x = 42; +>v3.x = 42 : 42 +>v3.x : number +>v3 : NormalObject & ({ a?: string | undefined; } | { b?: number | undefined; }) +>x : number +>42 : 42 + diff --git a/tests/baselines/reference/modularizeLibrary_Dom.asynciterable.js b/tests/baselines/reference/modularizeLibrary_Dom.asynciterable.js new file mode 100644 index 0000000000000..3a681bcde07e2 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_Dom.asynciterable.js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/modularizeLibrary_Dom.asynciterable.ts] //// + +//// [modularizeLibrary_Dom.asynciterable.ts] +navigator.storage.getDirectory().then(async directory => { + for await (const [key, handle] of directory) { + handle.kind; + } +}); + + +//// [modularizeLibrary_Dom.asynciterable.js] +navigator.storage.getDirectory().then(async (directory) => { + for await (const [key, handle] of directory) { + handle.kind; + } +}); diff --git a/tests/baselines/reference/modularizeLibrary_Dom.asynciterable.symbols b/tests/baselines/reference/modularizeLibrary_Dom.asynciterable.symbols new file mode 100644 index 0000000000000..16ea981e6abc1 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_Dom.asynciterable.symbols @@ -0,0 +1,25 @@ +//// [tests/cases/compiler/modularizeLibrary_Dom.asynciterable.ts] //// + +=== modularizeLibrary_Dom.asynciterable.ts === +navigator.storage.getDirectory().then(async directory => { +>navigator.storage.getDirectory().then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>navigator.storage.getDirectory : Symbol(StorageManager.getDirectory, Decl(lib.dom.d.ts, --, --)) +>navigator.storage : Symbol(NavigatorStorage.storage, Decl(lib.dom.d.ts, --, --)) +>navigator : Symbol(navigator, Decl(lib.dom.d.ts, --, --)) +>storage : Symbol(NavigatorStorage.storage, Decl(lib.dom.d.ts, --, --)) +>getDirectory : Symbol(StorageManager.getDirectory, Decl(lib.dom.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>directory : Symbol(directory, Decl(modularizeLibrary_Dom.asynciterable.ts, 0, 43)) + + for await (const [key, handle] of directory) { +>key : Symbol(key, Decl(modularizeLibrary_Dom.asynciterable.ts, 1, 22)) +>handle : Symbol(handle, Decl(modularizeLibrary_Dom.asynciterable.ts, 1, 26)) +>directory : Symbol(directory, Decl(modularizeLibrary_Dom.asynciterable.ts, 0, 43)) + + handle.kind; +>handle.kind : Symbol(FileSystemHandle.kind, Decl(lib.dom.d.ts, --, --)) +>handle : Symbol(handle, Decl(modularizeLibrary_Dom.asynciterable.ts, 1, 26)) +>kind : Symbol(FileSystemHandle.kind, Decl(lib.dom.d.ts, --, --)) + } +}); + diff --git a/tests/baselines/reference/modularizeLibrary_Dom.asynciterable.types b/tests/baselines/reference/modularizeLibrary_Dom.asynciterable.types new file mode 100644 index 0000000000000..c93cfbb5fed25 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_Dom.asynciterable.types @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/modularizeLibrary_Dom.asynciterable.ts] //// + +=== modularizeLibrary_Dom.asynciterable.ts === +navigator.storage.getDirectory().then(async directory => { +>navigator.storage.getDirectory().then(async directory => { for await (const [key, handle] of directory) { handle.kind; }}) : Promise +>navigator.storage.getDirectory().then : (onfulfilled?: (value: FileSystemDirectoryHandle) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>navigator.storage.getDirectory() : Promise +>navigator.storage.getDirectory : () => Promise +>navigator.storage : StorageManager +>navigator : Navigator +>storage : StorageManager +>getDirectory : () => Promise +>then : (onfulfilled?: (value: FileSystemDirectoryHandle) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>async directory => { for await (const [key, handle] of directory) { handle.kind; }} : (directory: FileSystemDirectoryHandle) => Promise +>directory : FileSystemDirectoryHandle + + for await (const [key, handle] of directory) { +>key : string +>handle : FileSystemHandle +>directory : FileSystemDirectoryHandle + + handle.kind; +>handle.kind : FileSystemHandleKind +>handle : FileSystemHandle +>kind : FileSystemHandleKind + } +}); + diff --git a/tests/baselines/reference/modularizeLibrary_Worker.asynciterable.js b/tests/baselines/reference/modularizeLibrary_Worker.asynciterable.js new file mode 100644 index 0000000000000..5810e5062be82 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_Worker.asynciterable.js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/modularizeLibrary_Worker.asynciterable.ts] //// + +//// [modularizeLibrary_Worker.asynciterable.ts] +navigator.storage.getDirectory().then(async directory => { + for await (const [key, handle] of directory) { + handle.kind; + } +}); + + +//// [modularizeLibrary_Worker.asynciterable.js] +navigator.storage.getDirectory().then(async (directory) => { + for await (const [key, handle] of directory) { + handle.kind; + } +}); diff --git a/tests/baselines/reference/modularizeLibrary_Worker.asynciterable.symbols b/tests/baselines/reference/modularizeLibrary_Worker.asynciterable.symbols new file mode 100644 index 0000000000000..eda3cc57a7c54 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_Worker.asynciterable.symbols @@ -0,0 +1,25 @@ +//// [tests/cases/compiler/modularizeLibrary_Worker.asynciterable.ts] //// + +=== modularizeLibrary_Worker.asynciterable.ts === +navigator.storage.getDirectory().then(async directory => { +>navigator.storage.getDirectory().then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>navigator.storage.getDirectory : Symbol(StorageManager.getDirectory, Decl(lib.webworker.d.ts, --, --)) +>navigator.storage : Symbol(NavigatorStorage.storage, Decl(lib.webworker.d.ts, --, --)) +>navigator : Symbol(navigator, Decl(lib.webworker.d.ts, --, --)) +>storage : Symbol(NavigatorStorage.storage, Decl(lib.webworker.d.ts, --, --)) +>getDirectory : Symbol(StorageManager.getDirectory, Decl(lib.webworker.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>directory : Symbol(directory, Decl(modularizeLibrary_Worker.asynciterable.ts, 0, 43)) + + for await (const [key, handle] of directory) { +>key : Symbol(key, Decl(modularizeLibrary_Worker.asynciterable.ts, 1, 22)) +>handle : Symbol(handle, Decl(modularizeLibrary_Worker.asynciterable.ts, 1, 26)) +>directory : Symbol(directory, Decl(modularizeLibrary_Worker.asynciterable.ts, 0, 43)) + + handle.kind; +>handle.kind : Symbol(FileSystemHandle.kind, Decl(lib.webworker.d.ts, --, --)) +>handle : Symbol(handle, Decl(modularizeLibrary_Worker.asynciterable.ts, 1, 26)) +>kind : Symbol(FileSystemHandle.kind, Decl(lib.webworker.d.ts, --, --)) + } +}); + diff --git a/tests/baselines/reference/modularizeLibrary_Worker.asynciterable.types b/tests/baselines/reference/modularizeLibrary_Worker.asynciterable.types new file mode 100644 index 0000000000000..13fdd566ac290 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_Worker.asynciterable.types @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/modularizeLibrary_Worker.asynciterable.ts] //// + +=== modularizeLibrary_Worker.asynciterable.ts === +navigator.storage.getDirectory().then(async directory => { +>navigator.storage.getDirectory().then(async directory => { for await (const [key, handle] of directory) { handle.kind; }}) : Promise +>navigator.storage.getDirectory().then : (onfulfilled?: (value: FileSystemDirectoryHandle) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>navigator.storage.getDirectory() : Promise +>navigator.storage.getDirectory : () => Promise +>navigator.storage : StorageManager +>navigator : WorkerNavigator +>storage : StorageManager +>getDirectory : () => Promise +>then : (onfulfilled?: (value: FileSystemDirectoryHandle) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>async directory => { for await (const [key, handle] of directory) { handle.kind; }} : (directory: FileSystemDirectoryHandle) => Promise +>directory : FileSystemDirectoryHandle + + for await (const [key, handle] of directory) { +>key : string +>handle : FileSystemHandle +>directory : FileSystemDirectoryHandle + + handle.kind; +>handle.kind : FileSystemHandleKind +>handle : FileSystemHandle +>kind : FileSystemHandleKind + } +}); + diff --git a/tests/baselines/reference/modularizeLibrary_Worker.iterable.js b/tests/baselines/reference/modularizeLibrary_Worker.iterable.js new file mode 100644 index 0000000000000..bf4b3790f218c --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_Worker.iterable.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/modularizeLibrary_Worker.iterable.ts] //// + +//// [modularizeLibrary_Worker.iterable.ts] +for (const [key, entry] of new FormData()) { + entry; +} + + +//// [modularizeLibrary_Worker.iterable.js] +for (const [key, entry] of new FormData()) { + entry; +} diff --git a/tests/baselines/reference/modularizeLibrary_Worker.iterable.symbols b/tests/baselines/reference/modularizeLibrary_Worker.iterable.symbols new file mode 100644 index 0000000000000..ed3c9835ef443 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_Worker.iterable.symbols @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/modularizeLibrary_Worker.iterable.ts] //// + +=== modularizeLibrary_Worker.iterable.ts === +for (const [key, entry] of new FormData()) { +>key : Symbol(key, Decl(modularizeLibrary_Worker.iterable.ts, 0, 12)) +>entry : Symbol(entry, Decl(modularizeLibrary_Worker.iterable.ts, 0, 16)) +>FormData : Symbol(FormData, Decl(lib.webworker.d.ts, --, --), Decl(lib.webworker.d.ts, --, --), Decl(lib.webworker.iterable.d.ts, --, --)) + + entry; +>entry : Symbol(entry, Decl(modularizeLibrary_Worker.iterable.ts, 0, 16)) +} + diff --git a/tests/baselines/reference/modularizeLibrary_Worker.iterable.types b/tests/baselines/reference/modularizeLibrary_Worker.iterable.types new file mode 100644 index 0000000000000..20a2c2464dc47 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_Worker.iterable.types @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/modularizeLibrary_Worker.iterable.ts] //// + +=== modularizeLibrary_Worker.iterable.ts === +for (const [key, entry] of new FormData()) { +>key : string +>entry : FormDataEntryValue +>new FormData() : FormData +>FormData : { new (): FormData; prototype: FormData; } + + entry; +>entry : FormDataEntryValue +} + diff --git a/tests/baselines/reference/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.symbols b/tests/baselines/reference/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.symbols new file mode 100644 index 0000000000000..7c22602f09ac9 --- /dev/null +++ b/tests/baselines/reference/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.symbols @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts] //// + +=== narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts === +function ff({ a, b }: { a: string | undefined, b: () => void }) { +>ff : Symbol(ff, Decl(narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts, 0, 0)) +>a : Symbol(a, Decl(narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts, 0, 13)) +>b : Symbol(b, Decl(narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts, 0, 16)) +>a : Symbol(a, Decl(narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts, 0, 23)) +>b : Symbol(b, Decl(narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts, 0, 46)) + + if (a !== undefined) { +>a : Symbol(a, Decl(narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts, 0, 13)) +>undefined : Symbol(undefined) + + b = () => { +>b : Symbol(b, Decl(narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts, 0, 16)) + + const x: string = a; +>x : Symbol(x, Decl(narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts, 3, 11)) +>a : Symbol(a, Decl(narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts, 0, 13)) + } + } +} + diff --git a/tests/baselines/reference/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.types b/tests/baselines/reference/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.types new file mode 100644 index 0000000000000..16ddc0c8ad1ab --- /dev/null +++ b/tests/baselines/reference/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.types @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts] //// + +=== narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts === +function ff({ a, b }: { a: string | undefined, b: () => void }) { +>ff : ({ a, b }: { a: string | undefined; b: () => void;}) => void +>a : string | undefined +>b : () => void +>a : string | undefined +>b : () => void + + if (a !== undefined) { +>a !== undefined : boolean +>a : string | undefined +>undefined : undefined + + b = () => { +>b = () => { const x: string = a; } : () => void +>b : () => void +>() => { const x: string = a; } : () => void + + const x: string = a; +>x : string +>a : string + } + } +} + diff --git a/tests/baselines/reference/narrowingPastLastAssignment.errors.txt b/tests/baselines/reference/narrowingPastLastAssignment.errors.txt new file mode 100644 index 0000000000000..0477f4c4877a1 --- /dev/null +++ b/tests/baselines/reference/narrowingPastLastAssignment.errors.txt @@ -0,0 +1,163 @@ +narrowingPastLastAssignment.ts(88,9): error TS7034: Variable 'x' implicitly has type 'any' in some locations where its type cannot be determined. +narrowingPastLastAssignment.ts(90,20): error TS7005: Variable 'x' implicitly has an 'any' type. + + +==== narrowingPastLastAssignment.ts (2 errors) ==== + function action(f: Function) {} + + // Narrowings are preserved in closures created past last assignment + + function f1(x: string | number) { + x = "abc"; + action(() => { x /* string | number */ }); + x = 42; + action(() => { x /* number */ }); + } + + // Narrowings are not preserved in inner function and class declarations (due to hoisting) + + function f2() { + let x: string | number; + x = 42; + let a = () => { x /* number */ }; + let f = function() { x /* number */ }; + let C = class { + foo() { x /* number */ } + }; + let o = { + foo() { x /* number */ } + }; + function g() { x /* string | number */ } + class A { + foo() { x /* string | number */ } + } + } + + // Narrowings are not preserved when assignments occur in inner functions + + function f3(x: string | number) { + action(() => { x = "abc" }); + x = 42; + action(() => { x /* string | number */ }); + } + + // Assignment effects in compoud statements extend to the entire statement + + function f4(cond: () => boolean) { + let x: string | number = 0; + while (cond()) { + x = "abc"; + action(() => { x /* string | number */ }); + x = 42; + action(() => { x /* string | number */ }); + } + action(() => { x /* number */ }); + } + + function f5(x: string | number, cond: () => boolean) { + if (cond()) { + x = 1; + action(() => { x /* string | number */ }); + } + else { + x = 2; + action(() => { x /* string | number */ }); + } + action(() => { x /* number */ }); + } + + function f5a(cond: boolean) { + if (cond) { + let x: number | undefined; + x = 1; + action(() => { x /* number */ }); + } + else { + let x: number | undefined; + x = 2; + action(() => { x /* number */ }); + } + } + + function f5b() { + for (let x = 0; x < 10; x++) { + if (x === 1 || x === 2) { + action(() => { x /* 1 | 2 */ }) + } + } + } + + // Implicit any variables have a known type following last assignment + + function f6() { + let x; + ~ +!!! error TS7034: Variable 'x' implicitly has type 'any' in some locations where its type cannot be determined. + x = "abc"; + action(() => { x }); // Error + ~ +!!! error TS7005: Variable 'x' implicitly has an 'any' type. + x = 42; + action(() => { x /* number */ }); + } + + // Narrowings on catch variables are preserved past last assignment + + function f7() { + try { + } + catch (e) { + if (e instanceof Error) { + let f = () => { e /* Error */ } + } + } + } + + // Narrowings are not preserved for global variables + + let g: string | number; + g = "abc"; + action(() => { g /* string | number */ }); + + // Narrowings are not preserved for exported namespace members + + namespace Foo { + export let x: string | number; + x = "abc"; + action(() => { x /* string | number */ }); + let y: string | number; + y = "abc"; + action(() => { y /* string */ }); + } + + // Repros from #35124 + + function f10() { + let i: number | undefined; + i = 0; + return (k: number) => k === i + 1; + } + + function makeAdder(n?: number) { + n ??= 0; + return (m: number) => n + m; + } + + function f11() { + let r; + r = "b"; + () => r; + } + + // Repro from #52104 + + function f12() { + const fooMap: Map> = new Map() + const values = [1, 2, 3, 4, 5]; + let foo = fooMap.get("a"); + if (foo == null) { + foo = []; + } + values.forEach(v => foo.push(v)); + } + \ No newline at end of file diff --git a/tests/baselines/reference/narrowingPastLastAssignment.symbols b/tests/baselines/reference/narrowingPastLastAssignment.symbols new file mode 100644 index 0000000000000..4ace603d16418 --- /dev/null +++ b/tests/baselines/reference/narrowingPastLastAssignment.symbols @@ -0,0 +1,365 @@ +//// [tests/cases/compiler/narrowingPastLastAssignment.ts] //// + +=== narrowingPastLastAssignment.ts === +function action(f: Function) {} +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>f : Symbol(f, Decl(narrowingPastLastAssignment.ts, 0, 16)) +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) + +// Narrowings are preserved in closures created past last assignment + +function f1(x: string | number) { +>f1 : Symbol(f1, Decl(narrowingPastLastAssignment.ts, 0, 31)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 4, 12)) + + x = "abc"; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 4, 12)) + + action(() => { x /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 4, 12)) + + x = 42; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 4, 12)) + + action(() => { x /* number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 4, 12)) +} + +// Narrowings are not preserved in inner function and class declarations (due to hoisting) + +function f2() { +>f2 : Symbol(f2, Decl(narrowingPastLastAssignment.ts, 9, 1)) + + let x: string | number; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 14, 7)) + + x = 42; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 14, 7)) + + let a = () => { x /* number */ }; +>a : Symbol(a, Decl(narrowingPastLastAssignment.ts, 16, 7)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 14, 7)) + + let f = function() { x /* number */ }; +>f : Symbol(f, Decl(narrowingPastLastAssignment.ts, 17, 7)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 14, 7)) + + let C = class { +>C : Symbol(C, Decl(narrowingPastLastAssignment.ts, 18, 7)) + + foo() { x /* number */ } +>foo : Symbol(C.foo, Decl(narrowingPastLastAssignment.ts, 18, 19)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 14, 7)) + + }; + let o = { +>o : Symbol(o, Decl(narrowingPastLastAssignment.ts, 21, 7)) + + foo() { x /* number */ } +>foo : Symbol(foo, Decl(narrowingPastLastAssignment.ts, 21, 13)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 14, 7)) + + }; + function g() { x /* string | number */ } +>g : Symbol(g, Decl(narrowingPastLastAssignment.ts, 23, 6)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 14, 7)) + + class A { +>A : Symbol(A, Decl(narrowingPastLastAssignment.ts, 24, 44)) + + foo() { x /* string | number */ } +>foo : Symbol(A.foo, Decl(narrowingPastLastAssignment.ts, 25, 13)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 14, 7)) + } +} + +// Narrowings are not preserved when assignments occur in inner functions + +function f3(x: string | number) { +>f3 : Symbol(f3, Decl(narrowingPastLastAssignment.ts, 28, 1)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 32, 12)) + + action(() => { x = "abc" }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 32, 12)) + + x = 42; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 32, 12)) + + action(() => { x /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 32, 12)) +} + +// Assignment effects in compoud statements extend to the entire statement + +function f4(cond: () => boolean) { +>f4 : Symbol(f4, Decl(narrowingPastLastAssignment.ts, 36, 1)) +>cond : Symbol(cond, Decl(narrowingPastLastAssignment.ts, 40, 12)) + + let x: string | number = 0; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 41, 7)) + + while (cond()) { +>cond : Symbol(cond, Decl(narrowingPastLastAssignment.ts, 40, 12)) + + x = "abc"; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 41, 7)) + + action(() => { x /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 41, 7)) + + x = 42; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 41, 7)) + + action(() => { x /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 41, 7)) + } + action(() => { x /* number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 41, 7)) +} + +function f5(x: string | number, cond: () => boolean) { +>f5 : Symbol(f5, Decl(narrowingPastLastAssignment.ts, 49, 1)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 51, 12)) +>cond : Symbol(cond, Decl(narrowingPastLastAssignment.ts, 51, 31)) + + if (cond()) { +>cond : Symbol(cond, Decl(narrowingPastLastAssignment.ts, 51, 31)) + + x = 1; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 51, 12)) + + action(() => { x /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 51, 12)) + } + else { + x = 2; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 51, 12)) + + action(() => { x /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 51, 12)) + } + action(() => { x /* number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 51, 12)) +} + +function f5a(cond: boolean) { +>f5a : Symbol(f5a, Decl(narrowingPastLastAssignment.ts, 61, 1)) +>cond : Symbol(cond, Decl(narrowingPastLastAssignment.ts, 63, 13)) + + if (cond) { +>cond : Symbol(cond, Decl(narrowingPastLastAssignment.ts, 63, 13)) + + let x: number | undefined; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 65, 11)) + + x = 1; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 65, 11)) + + action(() => { x /* number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 65, 11)) + } + else { + let x: number | undefined; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 70, 11)) + + x = 2; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 70, 11)) + + action(() => { x /* number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 70, 11)) + } +} + +function f5b() { +>f5b : Symbol(f5b, Decl(narrowingPastLastAssignment.ts, 74, 1)) + + for (let x = 0; x < 10; x++) { +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 77, 12)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 77, 12)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 77, 12)) + + if (x === 1 || x === 2) { +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 77, 12)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 77, 12)) + + action(() => { x /* 1 | 2 */ }) +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 77, 12)) + } + } +} + +// Implicit any variables have a known type following last assignment + +function f6() { +>f6 : Symbol(f6, Decl(narrowingPastLastAssignment.ts, 82, 1)) + + let x; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 87, 7)) + + x = "abc"; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 87, 7)) + + action(() => { x }); // Error +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 87, 7)) + + x = 42; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 87, 7)) + + action(() => { x /* number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 87, 7)) +} + +// Narrowings on catch variables are preserved past last assignment + +function f7() { +>f7 : Symbol(f7, Decl(narrowingPastLastAssignment.ts, 92, 1)) + + try { + } + catch (e) { +>e : Symbol(e, Decl(narrowingPastLastAssignment.ts, 99, 11)) + + if (e instanceof Error) { +>e : Symbol(e, Decl(narrowingPastLastAssignment.ts, 99, 11)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) + + let f = () => { e /* Error */ } +>f : Symbol(f, Decl(narrowingPastLastAssignment.ts, 101, 15)) +>e : Symbol(e, Decl(narrowingPastLastAssignment.ts, 99, 11)) + } + } +} + +// Narrowings are not preserved for global variables + +let g: string | number; +>g : Symbol(g, Decl(narrowingPastLastAssignment.ts, 108, 3)) + +g = "abc"; +>g : Symbol(g, Decl(narrowingPastLastAssignment.ts, 108, 3)) + +action(() => { g /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>g : Symbol(g, Decl(narrowingPastLastAssignment.ts, 108, 3)) + +// Narrowings are not preserved for exported namespace members + +namespace Foo { +>Foo : Symbol(Foo, Decl(narrowingPastLastAssignment.ts, 110, 42)) + + export let x: string | number; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 115, 14)) + + x = "abc"; +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 115, 14)) + + action(() => { x /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>x : Symbol(x, Decl(narrowingPastLastAssignment.ts, 115, 14)) + + let y: string | number; +>y : Symbol(y, Decl(narrowingPastLastAssignment.ts, 118, 7)) + + y = "abc"; +>y : Symbol(y, Decl(narrowingPastLastAssignment.ts, 118, 7)) + + action(() => { y /* string */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignment.ts, 0, 0)) +>y : Symbol(y, Decl(narrowingPastLastAssignment.ts, 118, 7)) +} + +// Repros from #35124 + +function f10() { +>f10 : Symbol(f10, Decl(narrowingPastLastAssignment.ts, 121, 1)) + + let i: number | undefined; +>i : Symbol(i, Decl(narrowingPastLastAssignment.ts, 126, 7)) + + i = 0; +>i : Symbol(i, Decl(narrowingPastLastAssignment.ts, 126, 7)) + + return (k: number) => k === i + 1; +>k : Symbol(k, Decl(narrowingPastLastAssignment.ts, 128, 12)) +>k : Symbol(k, Decl(narrowingPastLastAssignment.ts, 128, 12)) +>i : Symbol(i, Decl(narrowingPastLastAssignment.ts, 126, 7)) +} + +function makeAdder(n?: number) { +>makeAdder : Symbol(makeAdder, Decl(narrowingPastLastAssignment.ts, 129, 1)) +>n : Symbol(n, Decl(narrowingPastLastAssignment.ts, 131, 19)) + + n ??= 0; +>n : Symbol(n, Decl(narrowingPastLastAssignment.ts, 131, 19)) + + return (m: number) => n + m; +>m : Symbol(m, Decl(narrowingPastLastAssignment.ts, 133, 12)) +>n : Symbol(n, Decl(narrowingPastLastAssignment.ts, 131, 19)) +>m : Symbol(m, Decl(narrowingPastLastAssignment.ts, 133, 12)) +} + +function f11() { +>f11 : Symbol(f11, Decl(narrowingPastLastAssignment.ts, 134, 1)) + + let r; +>r : Symbol(r, Decl(narrowingPastLastAssignment.ts, 137, 7)) + + r = "b"; +>r : Symbol(r, Decl(narrowingPastLastAssignment.ts, 137, 7)) + + () => r; +>r : Symbol(r, Decl(narrowingPastLastAssignment.ts, 137, 7)) +} + +// Repro from #52104 + +function f12() { +>f12 : Symbol(f12, Decl(narrowingPastLastAssignment.ts, 140, 1)) + + const fooMap: Map> = new Map() +>fooMap : Symbol(fooMap, Decl(narrowingPastLastAssignment.ts, 145, 9)) +>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) +>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + + const values = [1, 2, 3, 4, 5]; +>values : Symbol(values, Decl(narrowingPastLastAssignment.ts, 146, 9)) + + let foo = fooMap.get("a"); +>foo : Symbol(foo, Decl(narrowingPastLastAssignment.ts, 147, 7)) +>fooMap.get : Symbol(Map.get, Decl(lib.es2015.collection.d.ts, --, --)) +>fooMap : Symbol(fooMap, Decl(narrowingPastLastAssignment.ts, 145, 9)) +>get : Symbol(Map.get, Decl(lib.es2015.collection.d.ts, --, --)) + + if (foo == null) { +>foo : Symbol(foo, Decl(narrowingPastLastAssignment.ts, 147, 7)) + + foo = []; +>foo : Symbol(foo, Decl(narrowingPastLastAssignment.ts, 147, 7)) + } + values.forEach(v => foo.push(v)); +>values.forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --)) +>values : Symbol(values, Decl(narrowingPastLastAssignment.ts, 146, 9)) +>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --)) +>v : Symbol(v, Decl(narrowingPastLastAssignment.ts, 151, 19)) +>foo.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(narrowingPastLastAssignment.ts, 147, 7)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>v : Symbol(v, Decl(narrowingPastLastAssignment.ts, 151, 19)) +} + diff --git a/tests/baselines/reference/narrowingPastLastAssignment.types b/tests/baselines/reference/narrowingPastLastAssignment.types new file mode 100644 index 0000000000000..18dce42399162 --- /dev/null +++ b/tests/baselines/reference/narrowingPastLastAssignment.types @@ -0,0 +1,476 @@ +//// [tests/cases/compiler/narrowingPastLastAssignment.ts] //// + +=== narrowingPastLastAssignment.ts === +function action(f: Function) {} +>action : (f: Function) => void +>f : Function + +// Narrowings are preserved in closures created past last assignment + +function f1(x: string | number) { +>f1 : (x: string | number) => void +>x : string | number + + x = "abc"; +>x = "abc" : "abc" +>x : string | number +>"abc" : "abc" + + action(() => { x /* string | number */ }); +>action(() => { x /* string | number */ }) : void +>action : (f: Function) => void +>() => { x /* string | number */ } : () => void +>x : string | number + + x = 42; +>x = 42 : 42 +>x : string | number +>42 : 42 + + action(() => { x /* number */ }); +>action(() => { x /* number */ }) : void +>action : (f: Function) => void +>() => { x /* number */ } : () => void +>x : number +} + +// Narrowings are not preserved in inner function and class declarations (due to hoisting) + +function f2() { +>f2 : () => void + + let x: string | number; +>x : string | number + + x = 42; +>x = 42 : 42 +>x : string | number +>42 : 42 + + let a = () => { x /* number */ }; +>a : () => void +>() => { x /* number */ } : () => void +>x : number + + let f = function() { x /* number */ }; +>f : () => void +>function() { x /* number */ } : () => void +>x : number + + let C = class { +>C : typeof C +>class { foo() { x /* number */ } } : typeof C + + foo() { x /* number */ } +>foo : () => void +>x : number + + }; + let o = { +>o : { foo(): void; } +>{ foo() { x /* number */ } } : { foo(): void; } + + foo() { x /* number */ } +>foo : () => void +>x : number + + }; + function g() { x /* string | number */ } +>g : () => void +>x : string | number + + class A { +>A : A + + foo() { x /* string | number */ } +>foo : () => void +>x : string | number + } +} + +// Narrowings are not preserved when assignments occur in inner functions + +function f3(x: string | number) { +>f3 : (x: string | number) => void +>x : string | number + + action(() => { x = "abc" }); +>action(() => { x = "abc" }) : void +>action : (f: Function) => void +>() => { x = "abc" } : () => void +>x = "abc" : "abc" +>x : string | number +>"abc" : "abc" + + x = 42; +>x = 42 : 42 +>x : string | number +>42 : 42 + + action(() => { x /* string | number */ }); +>action(() => { x /* string | number */ }) : void +>action : (f: Function) => void +>() => { x /* string | number */ } : () => void +>x : string | number +} + +// Assignment effects in compoud statements extend to the entire statement + +function f4(cond: () => boolean) { +>f4 : (cond: () => boolean) => void +>cond : () => boolean + + let x: string | number = 0; +>x : string | number +>0 : 0 + + while (cond()) { +>cond() : boolean +>cond : () => boolean + + x = "abc"; +>x = "abc" : "abc" +>x : string | number +>"abc" : "abc" + + action(() => { x /* string | number */ }); +>action(() => { x /* string | number */ }) : void +>action : (f: Function) => void +>() => { x /* string | number */ } : () => void +>x : string | number + + x = 42; +>x = 42 : 42 +>x : string | number +>42 : 42 + + action(() => { x /* string | number */ }); +>action(() => { x /* string | number */ }) : void +>action : (f: Function) => void +>() => { x /* string | number */ } : () => void +>x : string | number + } + action(() => { x /* number */ }); +>action(() => { x /* number */ }) : void +>action : (f: Function) => void +>() => { x /* number */ } : () => void +>x : number +} + +function f5(x: string | number, cond: () => boolean) { +>f5 : (x: string | number, cond: () => boolean) => void +>x : string | number +>cond : () => boolean + + if (cond()) { +>cond() : boolean +>cond : () => boolean + + x = 1; +>x = 1 : 1 +>x : string | number +>1 : 1 + + action(() => { x /* string | number */ }); +>action(() => { x /* string | number */ }) : void +>action : (f: Function) => void +>() => { x /* string | number */ } : () => void +>x : string | number + } + else { + x = 2; +>x = 2 : 2 +>x : string | number +>2 : 2 + + action(() => { x /* string | number */ }); +>action(() => { x /* string | number */ }) : void +>action : (f: Function) => void +>() => { x /* string | number */ } : () => void +>x : string | number + } + action(() => { x /* number */ }); +>action(() => { x /* number */ }) : void +>action : (f: Function) => void +>() => { x /* number */ } : () => void +>x : number +} + +function f5a(cond: boolean) { +>f5a : (cond: boolean) => void +>cond : boolean + + if (cond) { +>cond : boolean + + let x: number | undefined; +>x : number | undefined + + x = 1; +>x = 1 : 1 +>x : number | undefined +>1 : 1 + + action(() => { x /* number */ }); +>action(() => { x /* number */ }) : void +>action : (f: Function) => void +>() => { x /* number */ } : () => void +>x : number + } + else { + let x: number | undefined; +>x : number | undefined + + x = 2; +>x = 2 : 2 +>x : number | undefined +>2 : 2 + + action(() => { x /* number */ }); +>action(() => { x /* number */ }) : void +>action : (f: Function) => void +>() => { x /* number */ } : () => void +>x : number + } +} + +function f5b() { +>f5b : () => void + + for (let x = 0; x < 10; x++) { +>x : number +>0 : 0 +>x < 10 : boolean +>x : number +>10 : 10 +>x++ : number +>x : number + + if (x === 1 || x === 2) { +>x === 1 || x === 2 : boolean +>x === 1 : boolean +>x : number +>1 : 1 +>x === 2 : boolean +>x : number +>2 : 2 + + action(() => { x /* 1 | 2 */ }) +>action(() => { x /* 1 | 2 */ }) : void +>action : (f: Function) => void +>() => { x /* 1 | 2 */ } : () => void +>x : 1 | 2 + } + } +} + +// Implicit any variables have a known type following last assignment + +function f6() { +>f6 : () => void + + let x; +>x : any + + x = "abc"; +>x = "abc" : "abc" +>x : any +>"abc" : "abc" + + action(() => { x }); // Error +>action(() => { x }) : void +>action : (f: Function) => void +>() => { x } : () => void +>x : any + + x = 42; +>x = 42 : 42 +>x : any +>42 : 42 + + action(() => { x /* number */ }); +>action(() => { x /* number */ }) : void +>action : (f: Function) => void +>() => { x /* number */ } : () => void +>x : number +} + +// Narrowings on catch variables are preserved past last assignment + +function f7() { +>f7 : () => void + + try { + } + catch (e) { +>e : unknown + + if (e instanceof Error) { +>e instanceof Error : boolean +>e : unknown +>Error : ErrorConstructor + + let f = () => { e /* Error */ } +>f : () => void +>() => { e /* Error */ } : () => void +>e : Error + } + } +} + +// Narrowings are not preserved for global variables + +let g: string | number; +>g : string | number + +g = "abc"; +>g = "abc" : "abc" +>g : string | number +>"abc" : "abc" + +action(() => { g /* string | number */ }); +>action(() => { g /* string | number */ }) : void +>action : (f: Function) => void +>() => { g /* string | number */ } : () => void +>g : string | number + +// Narrowings are not preserved for exported namespace members + +namespace Foo { +>Foo : typeof Foo + + export let x: string | number; +>x : string | number + + x = "abc"; +>x = "abc" : "abc" +>x : string | number +>"abc" : "abc" + + action(() => { x /* string | number */ }); +>action(() => { x /* string | number */ }) : void +>action : (f: Function) => void +>() => { x /* string | number */ } : () => void +>x : string | number + + let y: string | number; +>y : string | number + + y = "abc"; +>y = "abc" : "abc" +>y : string | number +>"abc" : "abc" + + action(() => { y /* string */ }); +>action(() => { y /* string */ }) : void +>action : (f: Function) => void +>() => { y /* string */ } : () => void +>y : string +} + +// Repros from #35124 + +function f10() { +>f10 : () => (k: number) => boolean + + let i: number | undefined; +>i : number | undefined + + i = 0; +>i = 0 : 0 +>i : number | undefined +>0 : 0 + + return (k: number) => k === i + 1; +>(k: number) => k === i + 1 : (k: number) => boolean +>k : number +>k === i + 1 : boolean +>k : number +>i + 1 : number +>i : number +>1 : 1 +} + +function makeAdder(n?: number) { +>makeAdder : (n?: number) => (m: number) => number +>n : number | undefined + + n ??= 0; +>n ??= 0 : number +>n : number | undefined +>0 : 0 + + return (m: number) => n + m; +>(m: number) => n + m : (m: number) => number +>m : number +>n + m : number +>n : number +>m : number +} + +function f11() { +>f11 : () => void + + let r; +>r : any + + r = "b"; +>r = "b" : "b" +>r : any +>"b" : "b" + + () => r; +>() => r : () => string +>r : string +} + +// Repro from #52104 + +function f12() { +>f12 : () => void + + const fooMap: Map> = new Map() +>fooMap : Map +>new Map() : Map +>Map : MapConstructor + + const values = [1, 2, 3, 4, 5]; +>values : number[] +>[1, 2, 3, 4, 5] : number[] +>1 : 1 +>2 : 2 +>3 : 3 +>4 : 4 +>5 : 5 + + let foo = fooMap.get("a"); +>foo : number[] | undefined +>fooMap.get("a") : number[] | undefined +>fooMap.get : (key: string) => number[] | undefined +>fooMap : Map +>get : (key: string) => number[] | undefined +>"a" : "a" + + if (foo == null) { +>foo == null : boolean +>foo : number[] | undefined + + foo = []; +>foo = [] : never[] +>foo : number[] | undefined +>[] : never[] + } + values.forEach(v => foo.push(v)); +>values.forEach(v => foo.push(v)) : void +>values.forEach : (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void +>values : number[] +>forEach : (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void +>v => foo.push(v) : (v: number) => number +>v : number +>foo.push(v) : number +>foo.push : (...items: number[]) => number +>foo : number[] +>push : (...items: number[]) => number +>v : number +} + diff --git a/tests/baselines/reference/narrowingPastLastAssignmentInModule.symbols b/tests/baselines/reference/narrowingPastLastAssignmentInModule.symbols new file mode 100644 index 0000000000000..c4b5b29a98b81 --- /dev/null +++ b/tests/baselines/reference/narrowingPastLastAssignmentInModule.symbols @@ -0,0 +1,70 @@ +//// [tests/cases/compiler/narrowingPastLastAssignmentInModule.ts] //// + +=== narrowingPastLastAssignmentInModule.ts === +function action(f: Function) {} +>action : Symbol(action, Decl(narrowingPastLastAssignmentInModule.ts, 0, 0)) +>f : Symbol(f, Decl(narrowingPastLastAssignmentInModule.ts, 0, 16)) +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) + +// Narrowings are not preserved for exported mutable variables + +export let x1: string | number; +>x1 : Symbol(x1, Decl(narrowingPastLastAssignmentInModule.ts, 4, 10)) + +x1 = "abc"; +>x1 : Symbol(x1, Decl(narrowingPastLastAssignmentInModule.ts, 4, 10)) + +action(() => { x1 /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignmentInModule.ts, 0, 0)) +>x1 : Symbol(x1, Decl(narrowingPastLastAssignmentInModule.ts, 4, 10)) + +export { x2 }; +>x2 : Symbol(x2, Decl(narrowingPastLastAssignmentInModule.ts, 8, 8)) + +let x2: string | number; +>x2 : Symbol(x2, Decl(narrowingPastLastAssignmentInModule.ts, 9, 3)) + +x2 = "abc"; +>x2 : Symbol(x2, Decl(narrowingPastLastAssignmentInModule.ts, 9, 3)) + +action(() => { x2 /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignmentInModule.ts, 0, 0)) +>x2 : Symbol(x2, Decl(narrowingPastLastAssignmentInModule.ts, 9, 3)) + +export { x3 as foo }; +>x3 : Symbol(x3, Decl(narrowingPastLastAssignmentInModule.ts, 14, 3)) +>foo : Symbol(foo, Decl(narrowingPastLastAssignmentInModule.ts, 13, 8)) + +let x3: string | number; +>x3 : Symbol(x3, Decl(narrowingPastLastAssignmentInModule.ts, 14, 3)) + +x3 = "abc"; +>x3 : Symbol(x3, Decl(narrowingPastLastAssignmentInModule.ts, 14, 3)) + +action(() => { x3 /* string | number */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignmentInModule.ts, 0, 0)) +>x3 : Symbol(x3, Decl(narrowingPastLastAssignmentInModule.ts, 14, 3)) + +let x4: string | number; +>x4 : Symbol(x4, Decl(narrowingPastLastAssignmentInModule.ts, 18, 3)) + +x4 = "abc"; +>x4 : Symbol(x4, Decl(narrowingPastLastAssignmentInModule.ts, 18, 3)) + +action(() => { x4 /* string */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignmentInModule.ts, 0, 0)) +>x4 : Symbol(x4, Decl(narrowingPastLastAssignmentInModule.ts, 18, 3)) + +export default x4; +>x4 : Symbol(x4, Decl(narrowingPastLastAssignmentInModule.ts, 18, 3)) + +let x5: string | number; +>x5 : Symbol(x5, Decl(narrowingPastLastAssignmentInModule.ts, 23, 3)) + +x5 = "abc"; +>x5 : Symbol(x5, Decl(narrowingPastLastAssignmentInModule.ts, 23, 3)) + +action(() => { x5 /* string */ }); +>action : Symbol(action, Decl(narrowingPastLastAssignmentInModule.ts, 0, 0)) +>x5 : Symbol(x5, Decl(narrowingPastLastAssignmentInModule.ts, 23, 3)) + diff --git a/tests/baselines/reference/narrowingPastLastAssignmentInModule.types b/tests/baselines/reference/narrowingPastLastAssignmentInModule.types new file mode 100644 index 0000000000000..ccb173341e07a --- /dev/null +++ b/tests/baselines/reference/narrowingPastLastAssignmentInModule.types @@ -0,0 +1,89 @@ +//// [tests/cases/compiler/narrowingPastLastAssignmentInModule.ts] //// + +=== narrowingPastLastAssignmentInModule.ts === +function action(f: Function) {} +>action : (f: Function) => void +>f : Function + +// Narrowings are not preserved for exported mutable variables + +export let x1: string | number; +>x1 : string | number + +x1 = "abc"; +>x1 = "abc" : "abc" +>x1 : string | number +>"abc" : "abc" + +action(() => { x1 /* string | number */ }); +>action(() => { x1 /* string | number */ }) : void +>action : (f: Function) => void +>() => { x1 /* string | number */ } : () => void +>x1 : string | number + +export { x2 }; +>x2 : string | number + +let x2: string | number; +>x2 : string | number + +x2 = "abc"; +>x2 = "abc" : "abc" +>x2 : string | number +>"abc" : "abc" + +action(() => { x2 /* string | number */ }); +>action(() => { x2 /* string | number */ }) : void +>action : (f: Function) => void +>() => { x2 /* string | number */ } : () => void +>x2 : string | number + +export { x3 as foo }; +>x3 : string | number +>foo : string | number + +let x3: string | number; +>x3 : string | number + +x3 = "abc"; +>x3 = "abc" : "abc" +>x3 : string | number +>"abc" : "abc" + +action(() => { x3 /* string | number */ }); +>action(() => { x3 /* string | number */ }) : void +>action : (f: Function) => void +>() => { x3 /* string | number */ } : () => void +>x3 : string | number + +let x4: string | number; +>x4 : string | number + +x4 = "abc"; +>x4 = "abc" : "abc" +>x4 : string | number +>"abc" : "abc" + +action(() => { x4 /* string */ }); +>action(() => { x4 /* string */ }) : void +>action : (f: Function) => void +>() => { x4 /* string */ } : () => void +>x4 : string + +export default x4; +>x4 : string | number + +let x5: string | number; +>x5 : string | number + +x5 = "abc"; +>x5 = "abc" : "abc" +>x5 : string | number +>"abc" : "abc" + +action(() => { x5 /* string */ }); +>action(() => { x5 /* string */ }) : void +>action : (f: Function) => void +>() => { x5 /* string */ } : () => void +>x5 : string + diff --git a/tests/baselines/reference/quickInfoJsDocTags14.baseline b/tests/baselines/reference/quickInfoJsDocTags14.baseline new file mode 100644 index 0000000000000..ec3e3738e8989 --- /dev/null +++ b/tests/baselines/reference/quickInfoJsDocTags14.baseline @@ -0,0 +1,227 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickInfoJsDocTags14.ts === +// /** +// * @param {Object} options the args object +// * @param {number} options.a first number +// * @param {number} options.b second number +// * @param {Object} options.c sub-object +// * @param {number} options.c.d third number +// * @param {Function} callback the callback function +// * @returns {number} +// */ +// function fn(options, callback = null) { } +// ^^ +// | ---------------------------------------------------------------------- +// | function fn(options: any, callback?: any): void +// | @param options the args object +// | @param options.a first number +// | @param options.b second number +// | @param options.c sub-object +// | @param options.c.d third number +// | @param callback the callback function +// | @returns +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoJsDocTags14.ts", + "position": 302, + "name": "" + }, + "item": { + "kind": "function", + "kindModifiers": "", + "textSpan": { + "start": 302, + "length": 2 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fn", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "options", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "callback", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "options", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the args object", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "options.a", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "options.b", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "options.c", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "sub-object", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "options.c.d", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "third number", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "callback", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the callback function", + "kind": "text" + } + ] + }, + { + "name": "returns" + } + ] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoJsDocTags15.baseline b/tests/baselines/reference/quickInfoJsDocTags15.baseline new file mode 100644 index 0000000000000..da5ff2162dba0 --- /dev/null +++ b/tests/baselines/reference/quickInfoJsDocTags15.baseline @@ -0,0 +1,308 @@ +// === QuickInfo === +=== /b.js === +// import * as _a from "./a.js"; +// /** +// * @implements {_a.Foo} +// ^^^ +// | ---------------------------------------------------------------------- +// | type Foo = { +// | getName: _a.Bar; +// | } +// | ---------------------------------------------------------------------- +// */ +// class C1 { } +// +// /** +// * @extends {_a.Foo} +// ^^^ +// | ---------------------------------------------------------------------- +// | type Foo = { +// | getName: _a.Bar; +// | } +// | ---------------------------------------------------------------------- +// */ +// class C2 { } +// +// /** +// * @augments {_a.Foo} +// ^^^ +// | ---------------------------------------------------------------------- +// | type Foo = { +// | getName: _a.Bar; +// | } +// | ---------------------------------------------------------------------- +// */ +// class C3 { } + +[ + { + "marker": { + "fileName": "/b.js", + "position": 56, + "name": "1" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 53, + "length": 3 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "getName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "_a", + "kind": "aliasName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Bar", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/b.js", + "position": 99, + "name": "2" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 96, + "length": 3 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "getName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "_a", + "kind": "aliasName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Bar", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/b.js", + "position": 143, + "name": "3" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 140, + "length": 3 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "getName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "_a", + "kind": "aliasName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Bar", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoUniqueSymbolJsDoc.baseline b/tests/baselines/reference/quickInfoUniqueSymbolJsDoc.baseline new file mode 100644 index 0000000000000..ddc8034c63190 --- /dev/null +++ b/tests/baselines/reference/quickInfoUniqueSymbolJsDoc.baseline @@ -0,0 +1,74 @@ +// === QuickInfo === +=== /tests/cases/fourslash/./a.js === +// /** @type {unique symbol} */ +// const foo = Symbol(); +// foo +// ^^^ +// | ---------------------------------------------------------------------- +// | const foo: typeof foo +// | @type {unique symbol} +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/./a.js", + "position": 54, + "name": "" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 51, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "localName" + } + ], + "documentation": [], + "tags": [ + { + "name": "type", + "text": [ + { + "text": "{unique symbol}", + "kind": "text" + } + ] + } + ] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/renameJsPropertyAssignment4.baseline.jsonc b/tests/baselines/reference/renameJsPropertyAssignment4.baseline.jsonc new file mode 100644 index 0000000000000..39fb58cbc5762 --- /dev/null +++ b/tests/baselines/reference/renameJsPropertyAssignment4.baseline.jsonc @@ -0,0 +1,15 @@ +// === findRenameLocations === +// === /a.js === +// function f() { +// <|var /*RENAME*/[|fooRENAME|] = this;|> +// <|[|fooRENAME|].x = 1;|> +// } + + + +// === findRenameLocations === +// === /a.js === +// function f() { +// <|var [|fooRENAME|] = this;|> +// /*RENAME*/<|[|fooRENAME|].x = 1;|> +// } \ No newline at end of file diff --git a/tests/baselines/reference/reverseMappedTupleContext.symbols b/tests/baselines/reference/reverseMappedTupleContext.symbols new file mode 100644 index 0000000000000..0c3e8384a3392 --- /dev/null +++ b/tests/baselines/reference/reverseMappedTupleContext.symbols @@ -0,0 +1,148 @@ +//// [tests/cases/compiler/reverseMappedTupleContext.ts] //// + +=== reverseMappedTupleContext.ts === +// https://github.com/microsoft/TypeScript/issues/55382 + +declare function test1(arg: { +>test1 : Symbol(test1, Decl(reverseMappedTupleContext.ts, 0, 0)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 2, 23)) +>arg : Symbol(arg, Decl(reverseMappedTupleContext.ts, 2, 26)) + + [K in keyof T]: T[K]; +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 3, 3)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 2, 23)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 2, 23)) +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 3, 3)) + +}): T; +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 2, 23)) + +const result1 = test1(["foo", 42]); +>result1 : Symbol(result1, Decl(reverseMappedTupleContext.ts, 5, 5)) +>test1 : Symbol(test1, Decl(reverseMappedTupleContext.ts, 0, 0)) + +declare function test2(arg: { +>test2 : Symbol(test2, Decl(reverseMappedTupleContext.ts, 5, 35)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 7, 23)) +>arg : Symbol(arg, Decl(reverseMappedTupleContext.ts, 7, 53)) + + [K in keyof T]: T[K]; +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 8, 3)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 7, 23)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 7, 23)) +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 8, 3)) + +}): T; +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 7, 23)) + +const result2 = test2(["foo", 42]); +>result2 : Symbol(result2, Decl(reverseMappedTupleContext.ts, 10, 5)) +>test2 : Symbol(test2, Decl(reverseMappedTupleContext.ts, 5, 35)) + +type Schema = Record | readonly unknown[]; +>Schema : Symbol(Schema, Decl(reverseMappedTupleContext.ts, 10, 35)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + +type Definition = { +>Definition : Symbol(Definition, Decl(reverseMappedTupleContext.ts, 12, 59)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 13, 16)) + + [K in keyof T]: (() => T[K]) | Definition; +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 14, 3)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 13, 16)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 13, 16)) +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 14, 3)) +>Definition : Symbol(Definition, Decl(reverseMappedTupleContext.ts, 12, 59)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 13, 16)) +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 14, 3)) + +}; +declare function create(definition: Definition): T; +>create : Symbol(create, Decl(reverseMappedTupleContext.ts, 15, 2)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 16, 24)) +>Schema : Symbol(Schema, Decl(reverseMappedTupleContext.ts, 10, 35)) +>definition : Symbol(definition, Decl(reverseMappedTupleContext.ts, 16, 42)) +>Definition : Symbol(Definition, Decl(reverseMappedTupleContext.ts, 12, 59)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 16, 24)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 16, 24)) + +const created1 = create([() => 1, [() => ""]]); +>created1 : Symbol(created1, Decl(reverseMappedTupleContext.ts, 17, 5)) +>create : Symbol(create, Decl(reverseMappedTupleContext.ts, 15, 2)) + +const created2 = create({ +>created2 : Symbol(created2, Decl(reverseMappedTupleContext.ts, 18, 5)) +>create : Symbol(create, Decl(reverseMappedTupleContext.ts, 15, 2)) + + a: () => 1, +>a : Symbol(a, Decl(reverseMappedTupleContext.ts, 18, 25)) + + b: [() => ""], +>b : Symbol(b, Decl(reverseMappedTupleContext.ts, 19, 13)) + +}); + +interface CompilerOptions { +>CompilerOptions : Symbol(CompilerOptions, Decl(reverseMappedTupleContext.ts, 21, 3)) + + allowUnreachableCode?: boolean; +>allowUnreachableCode : Symbol(CompilerOptions.allowUnreachableCode, Decl(reverseMappedTupleContext.ts, 23, 27)) + + allowUnusedLabels?: boolean; +>allowUnusedLabels : Symbol(CompilerOptions.allowUnusedLabels, Decl(reverseMappedTupleContext.ts, 24, 33)) + + alwaysStrict?: boolean; +>alwaysStrict : Symbol(CompilerOptions.alwaysStrict, Decl(reverseMappedTupleContext.ts, 25, 30)) +} +type KeepLiteralStrings = { +>KeepLiteralStrings : Symbol(KeepLiteralStrings, Decl(reverseMappedTupleContext.ts, 27, 1)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 28, 24)) + + [K in keyof T]: T[K]; +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 29, 3)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 28, 24)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 28, 24)) +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 29, 3)) + +}; +declare function test4>(obj: { +>test4 : Symbol(test4, Decl(reverseMappedTupleContext.ts, 30, 2)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 31, 23)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(reverseMappedTupleContext.ts, 31, 59)) + + [K in keyof T & keyof CompilerOptions]: { +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 32, 3)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 31, 23)) +>CompilerOptions : Symbol(CompilerOptions, Decl(reverseMappedTupleContext.ts, 21, 3)) + + dependencies: KeepLiteralStrings; +>dependencies : Symbol(dependencies, Decl(reverseMappedTupleContext.ts, 32, 43)) +>KeepLiteralStrings : Symbol(KeepLiteralStrings, Decl(reverseMappedTupleContext.ts, 27, 1)) +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 31, 23)) +>K : Symbol(K, Decl(reverseMappedTupleContext.ts, 32, 3)) + + }; +}): T; +>T : Symbol(T, Decl(reverseMappedTupleContext.ts, 31, 23)) + +const result4 = test4({ +>result4 : Symbol(result4, Decl(reverseMappedTupleContext.ts, 36, 5)) +>test4 : Symbol(test4, Decl(reverseMappedTupleContext.ts, 30, 2)) + + alwaysStrict: { +>alwaysStrict : Symbol(alwaysStrict, Decl(reverseMappedTupleContext.ts, 36, 23)) + + dependencies: ["foo", "bar"], +>dependencies : Symbol(dependencies, Decl(reverseMappedTupleContext.ts, 37, 17)) + + }, + allowUnusedLabels: { +>allowUnusedLabels : Symbol(allowUnusedLabels, Decl(reverseMappedTupleContext.ts, 39, 4)) + + dependencies: ["baz", "qwe"], +>dependencies : Symbol(dependencies, Decl(reverseMappedTupleContext.ts, 40, 22)) + + }, +}); + diff --git a/tests/baselines/reference/reverseMappedTupleContext.types b/tests/baselines/reference/reverseMappedTupleContext.types new file mode 100644 index 0000000000000..5e65b21b770e4 --- /dev/null +++ b/tests/baselines/reference/reverseMappedTupleContext.types @@ -0,0 +1,130 @@ +//// [tests/cases/compiler/reverseMappedTupleContext.ts] //// + +=== reverseMappedTupleContext.ts === +// https://github.com/microsoft/TypeScript/issues/55382 + +declare function test1(arg: { +>test1 : (arg: { [K in keyof T]: T[K]; }) => T +>arg : { [K in keyof T]: T[K]; } + + [K in keyof T]: T[K]; +}): T; +const result1 = test1(["foo", 42]); +>result1 : [string, number] +>test1(["foo", 42]) : [string, number] +>test1 : (arg: { [K in keyof T]: T[K]; }) => T +>["foo", 42] : [string, number] +>"foo" : "foo" +>42 : 42 + +declare function test2(arg: { +>test2 : (arg: { [K in keyof T]: T[K]; }) => T +>arg : { [K in keyof T]: T[K]; } + + [K in keyof T]: T[K]; +}): T; +const result2 = test2(["foo", 42]); +>result2 : [string, number] +>test2(["foo", 42]) : [string, number] +>test2 : (arg: { [K in keyof T]: T[K]; }) => T +>["foo", 42] : [string, number] +>"foo" : "foo" +>42 : 42 + +type Schema = Record | readonly unknown[]; +>Schema : readonly unknown[] | Record + +type Definition = { +>Definition : Definition + + [K in keyof T]: (() => T[K]) | Definition; +}; +declare function create(definition: Definition): T; +>create : (definition: Definition) => T +>definition : Definition + +const created1 = create([() => 1, [() => ""]]); +>created1 : [number, [string]] +>create([() => 1, [() => ""]]) : [number, [string]] +>create : (definition: Definition) => T +>[() => 1, [() => ""]] : [() => number, [() => string]] +>() => 1 : () => number +>1 : 1 +>[() => ""] : [() => string] +>() => "" : () => string +>"" : "" + +const created2 = create({ +>created2 : { a: number; b: [string]; } +>create({ a: () => 1, b: [() => ""],}) : { a: number; b: [string]; } +>create : (definition: Definition) => T +>{ a: () => 1, b: [() => ""],} : { a: () => number; b: [() => string]; } + + a: () => 1, +>a : () => number +>() => 1 : () => number +>1 : 1 + + b: [() => ""], +>b : [() => string] +>[() => ""] : [() => string] +>() => "" : () => string +>"" : "" + +}); + +interface CompilerOptions { + allowUnreachableCode?: boolean; +>allowUnreachableCode : boolean | undefined + + allowUnusedLabels?: boolean; +>allowUnusedLabels : boolean | undefined + + alwaysStrict?: boolean; +>alwaysStrict : boolean | undefined +} +type KeepLiteralStrings = { +>KeepLiteralStrings : KeepLiteralStrings + + [K in keyof T]: T[K]; +}; +declare function test4>(obj: { +>test4 : >(obj: { [K in keyof T & keyof CompilerOptions]: { dependencies: KeepLiteralStrings; }; }) => T +>obj : { [K in keyof T & keyof CompilerOptions]: { dependencies: KeepLiteralStrings; }; } + + [K in keyof T & keyof CompilerOptions]: { + dependencies: KeepLiteralStrings; +>dependencies : KeepLiteralStrings + + }; +}): T; +const result4 = test4({ +>result4 : { alwaysStrict: ["foo", "bar"]; allowUnusedLabels: ["baz", "qwe"]; } +>test4({ alwaysStrict: { dependencies: ["foo", "bar"], }, allowUnusedLabels: { dependencies: ["baz", "qwe"], },}) : { alwaysStrict: ["foo", "bar"]; allowUnusedLabels: ["baz", "qwe"]; } +>test4 : >(obj: { [K in keyof T & keyof CompilerOptions]: { dependencies: KeepLiteralStrings; }; }) => T +>{ alwaysStrict: { dependencies: ["foo", "bar"], }, allowUnusedLabels: { dependencies: ["baz", "qwe"], },} : { alwaysStrict: { dependencies: ["foo", "bar"]; }; allowUnusedLabels: { dependencies: ["baz", "qwe"]; }; } + + alwaysStrict: { +>alwaysStrict : { dependencies: ["foo", "bar"]; } +>{ dependencies: ["foo", "bar"], } : { dependencies: ["foo", "bar"]; } + + dependencies: ["foo", "bar"], +>dependencies : ["foo", "bar"] +>["foo", "bar"] : ["foo", "bar"] +>"foo" : "foo" +>"bar" : "bar" + + }, + allowUnusedLabels: { +>allowUnusedLabels : { dependencies: ["baz", "qwe"]; } +>{ dependencies: ["baz", "qwe"], } : { dependencies: ["baz", "qwe"]; } + + dependencies: ["baz", "qwe"], +>dependencies : ["baz", "qwe"] +>["baz", "qwe"] : ["baz", "qwe"] +>"baz" : "baz" +>"qwe" : "qwe" + + }, +}); + diff --git a/tests/baselines/reference/reverseMappedUnionInference.types b/tests/baselines/reference/reverseMappedUnionInference.types index 0ce2b95184ff0..6eb20a8c8ce1d 100644 --- a/tests/baselines/reference/reverseMappedUnionInference.types +++ b/tests/baselines/reference/reverseMappedUnionInference.types @@ -142,7 +142,7 @@ const myUnion = unionType([identifierExtractor, stringExtractor]); >myUnion : AnyExtractor<{ node: Identifier; kind: "identifier"; value: string; } | { node: StringLiteral; kind: "string"; value: string; }> >unionType([identifierExtractor, stringExtractor]) : AnyExtractor<{ node: Identifier; kind: "identifier"; value: string; } | { node: StringLiteral; kind: "string"; value: string; }> >unionType : (parsers: { [K in keyof Result]: AnyExtractor; }) => AnyExtractor ->[identifierExtractor, stringExtractor] : (Extractor | Extractor)[] +>[identifierExtractor, stringExtractor] : [Extractor, Extractor] >identifierExtractor : Extractor >stringExtractor : Extractor diff --git a/tests/baselines/reference/staticAutoAccessorsWithDecorators(target=es2017).js b/tests/baselines/reference/staticAutoAccessorsWithDecorators(target=es2017).js index 341c4ee4ede11..f4c000661b6ef 100644 --- a/tests/baselines/reference/staticAutoAccessorsWithDecorators(target=es2017).js +++ b/tests/baselines/reference/staticAutoAccessorsWithDecorators(target=es2017).js @@ -63,34 +63,37 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function ( }; let A = (() => { var _a, _A_x_accessor_storage, _A_y_accessor_storage; - let _staticExtraInitializers = []; - let _instanceExtraInitializers = []; let _static_x_decorators; let _static_x_initializers = []; + let _static_x_extraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return _a = class A { - constructor() { - _A_y_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 2))); - } // uses class reference static get x() { return __classPrivateFieldGet(_a, _a, "f", _A_x_accessor_storage); } static set x(value) { __classPrivateFieldSet(_a, _a, value, "f", _A_x_accessor_storage); } // uses 'this' get y() { return __classPrivateFieldGet(this, _A_y_accessor_storage, "f"); } set y(value) { __classPrivateFieldSet(this, _A_y_accessor_storage, value, "f"); } + constructor() { + _A_y_accessor_storage.set(this, __runInitializers(this, _y_initializers, 2)); + __runInitializers(this, _y_extraInitializers); + } }, _A_y_accessor_storage = new WeakMap(), (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _static_x_decorators = [((t, c) => { })]; _y_decorators = [((t, c) => { })]; - __esDecorate(_a, null, _static_x_decorators, { kind: "accessor", name: "x", static: true, private: false, access: { has: obj => "x" in obj, get: obj => obj.x, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, _static_x_initializers, _staticExtraInitializers); - __esDecorate(_a, null, _y_decorators, { kind: "accessor", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_a, null, _static_x_decorators, { kind: "accessor", name: "x", static: true, private: false, access: { has: obj => "x" in obj, get: obj => obj.x, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, _static_x_initializers, _static_x_extraInitializers); + __esDecorate(_a, null, _y_decorators, { kind: "accessor", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(_a, _staticExtraInitializers); })(), // uses class reference _A_x_accessor_storage = { value: __runInitializers(_a, _static_x_initializers, 1) }, + (() => { + __runInitializers(_a, _static_x_extraInitializers); + })(), _a; })(); diff --git a/tests/baselines/reference/staticAutoAccessorsWithDecorators(target=es2022).js b/tests/baselines/reference/staticAutoAccessorsWithDecorators(target=es2022).js index cc85e8e66fa40..33e49e296162c 100644 --- a/tests/baselines/reference/staticAutoAccessorsWithDecorators(target=es2022).js +++ b/tests/baselines/reference/staticAutoAccessorsWithDecorators(target=es2022).js @@ -51,29 +51,34 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i return useValue ? value : void 0; }; let A = (() => { - let _staticExtraInitializers = []; - let _instanceExtraInitializers = []; let _static_x_decorators; let _static_x_initializers = []; + let _static_x_extraInitializers = []; let _y_decorators; let _y_initializers = []; + let _y_extraInitializers = []; return class A { static { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _static_x_decorators = [((t, c) => { })]; _y_decorators = [((t, c) => { })]; - __esDecorate(this, null, _static_x_decorators, { kind: "accessor", name: "x", static: true, private: false, access: { has: obj => "x" in obj, get: obj => obj.x, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, _static_x_initializers, _staticExtraInitializers); - __esDecorate(this, null, _y_decorators, { kind: "accessor", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _static_x_decorators, { kind: "accessor", name: "x", static: true, private: false, access: { has: obj => "x" in obj, get: obj => obj.x, set: (obj, value) => { obj.x = value; } }, metadata: _metadata }, _static_x_initializers, _static_x_extraInitializers); + __esDecorate(this, null, _y_decorators, { kind: "accessor", name: "y", static: false, private: false, access: { has: obj => "y" in obj, get: obj => obj.y, set: (obj, value) => { obj.y = value; } }, metadata: _metadata }, _y_initializers, _y_extraInitializers); if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); - __runInitializers(this, _staticExtraInitializers); } static #x_accessor_storage = __runInitializers(this, _static_x_initializers, 1); // uses class reference static get x() { return A.#x_accessor_storage; } static set x(value) { A.#x_accessor_storage = value; } - #y_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 2)); + #y_accessor_storage = __runInitializers(this, _y_initializers, 2); // uses 'this' get y() { return this.#y_accessor_storage; } set y(value) { this.#y_accessor_storage = value; } + constructor() { + __runInitializers(this, _y_extraInitializers); + } + static { + __runInitializers(this, _static_x_extraInitializers); + } }; })(); diff --git a/tests/baselines/reference/textChanges/insertNodeInListAfter10.js b/tests/baselines/reference/textChanges/insertNodeInListAfter10.js index 300230bf51ca8..643aedfd1ac6e 100644 --- a/tests/baselines/reference/textChanges/insertNodeInListAfter10.js +++ b/tests/baselines/reference/textChanges/insertNodeInListAfter10.js @@ -6,5 +6,6 @@ import { ===MODIFIED=== import { - x, b as a + x, + b as a } from "bar" \ No newline at end of file diff --git a/tests/baselines/reference/textChanges/insertNodeInListAfter12.js b/tests/baselines/reference/textChanges/insertNodeInListAfter12.js index 79e7bb2c8b6cf..b89dc68491b1c 100644 --- a/tests/baselines/reference/textChanges/insertNodeInListAfter12.js +++ b/tests/baselines/reference/textChanges/insertNodeInListAfter12.js @@ -6,5 +6,6 @@ import { ===MODIFIED=== import { - x, a + x, + a } from "bar" \ No newline at end of file diff --git a/tests/baselines/reference/textChanges/insertNodeInListAfter18.js b/tests/baselines/reference/textChanges/insertNodeInListAfter18.js index b25a3f463464b..9f4d25189b930 100644 --- a/tests/baselines/reference/textChanges/insertNodeInListAfter18.js +++ b/tests/baselines/reference/textChanges/insertNodeInListAfter18.js @@ -6,5 +6,6 @@ import { ===MODIFIED=== import { - x0, x, a + x0, x, + a } from "bar" \ No newline at end of file diff --git a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js index 144118fae91f8..a589fbabc4de9 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js @@ -111,7 +111,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection/esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection/esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, decorators, decorators.legacy default: undefined --allowJs diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index 4f6bbee5e0aca..b738987321d96 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -111,7 +111,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection/esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection/esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, decorators, decorators.legacy default: undefined --allowJs diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 4f6bbee5e0aca..b738987321d96 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -111,7 +111,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection/esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection/esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, decorators, decorators.legacy default: undefined --allowJs diff --git a/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap1.js b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap1.js new file mode 100644 index 0000000000000..28bbf58340b78 --- /dev/null +++ b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap1.js @@ -0,0 +1,357 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +//// [/lib.d.ts] +lib.d.ts-Text + +//// [/lib.decorators.d.ts] +lib.decorators.d.ts-Text + +//// [/lib.decorators.legacy.d.ts] +lib.decorators.legacy.d.ts-Text + +//// [/package.json] +{ + "type": "module", + "imports": { + "#is-browser": { + "browser": "./dist/env/browser.js", + "default": "./dist/env/node.js" + } + } +} + +//// [/src/a.ts] +isBrowser + +//// [/src/env/browser.ts] +export const isBrowser = true; + +//// [/src/env/node.ts] +export const isBrowser = false; + +//// [/tsconfig.json] +{ + "compilerOptions": { + "module": "nodenext", + "rootDir": "src", + "outDir": "dist" + } +} + + +Info seq [hh:mm:ss:mss] request: + { + "seq": 0, + "type": "request", + "arguments": { + "file": "/tsconfig.json" + }, + "command": "open" + } +Info seq [hh:mm:ss:mss] Search path: / +Info seq [hh:mm:ss:mss] For info: /tsconfig.json :: Config file name: /tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tsconfig.json 2000 undefined Project: /tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/tsconfig.json", + "reason": "Creating possible configured project for /tsconfig.json to open" + } + } +Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { + "rootNames": [ + "/lib.d.ts", + "/lib.decorators.d.ts", + "/lib.decorators.legacy.d.ts", + "/src/a.ts", + "/src/env/browser.ts", + "/src/env/node.ts" + ], + "options": { + "module": 199, + "rootDir": "/src", + "outDir": "/dist", + "configFilePath": "/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.legacy.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/a.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/env/browser.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/env/node.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (6) + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /lib.d.ts Text-1 lib.d.ts-Text + /src/a.ts Text-1 "isBrowser" + /src/env/browser.ts Text-1 "export const isBrowser = true;" + /src/env/node.ts Text-1 "export const isBrowser = false;" + + + lib.decorators.d.ts + Library referenced via 'decorators' from file 'lib.d.ts' + Matched by default include pattern '**/*' + lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file 'lib.d.ts' + Matched by default include pattern '**/*' + lib.d.ts + Matched by default include pattern '**/*' + src/a.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + src/env/browser.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + src/env/node.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingFinish", + "body": { + "projectName": "/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "configFileDiag", + "body": { + "triggerFile": "/tsconfig.json", + "configFile": "/tsconfig.json", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + /lib.d.ts Text-1 lib.d.ts-Text + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /tsconfig.json SVC-1-0 "{\n \"compilerOptions\": {\n \"module\": \"nodenext\",\n \"rootDir\": \"src\",\n \"outDir\": \"dist\"\n }\n}" + + + lib.d.ts + Default library for target 'es5' + lib.decorators.d.ts + Library referenced via 'decorators' from file 'lib.d.ts' + lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file 'lib.d.ts' + tsconfig.json + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /package.json 250 undefined WatchType: package.json file +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (6) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /tsconfig.json ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +After Request +watchedFiles:: +/lib.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.legacy.d.ts: *new* + {"pollingInterval":500} +/package.json: *new* + {"pollingInterval":250} +/src/a.ts: *new* + {"pollingInterval":500} +/src/env/browser.ts: *new* + {"pollingInterval":500} +/src/env/node.ts: *new* + {"pollingInterval":500} +/tsconfig.json: *new* + {"pollingInterval":2000} + +watchedDirectoriesRecursive:: +: *new* + {} + +Info seq [hh:mm:ss:mss] request: + { + "seq": 1, + "type": "request", + "arguments": { + "preferences": { + "includeCompletionsForModuleExports": true, + "includeCompletionsWithInsertText": true + } + }, + "command": "configure" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "configure", + "request_seq": 1, + "success": true + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 2, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "syntacticDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "syntacticDiagnosticsSync", + "request_seq": 2, + "success": true, + "body": [] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 3, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "semanticDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "semanticDiagnosticsSync", + "request_seq": 3, + "success": true, + "body": [ + { + "message": "Cannot find name 'isBrowser'.", + "start": 0, + "length": 9, + "category": "error", + "code": 2304, + "startLocation": { + "line": 1, + "offset": 1 + }, + "endLocation": { + "line": 1, + "offset": 10 + } + } + ] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 4, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "suggestionDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "suggestionDiagnosticsSync", + "request_seq": 4, + "success": true, + "body": [] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 5, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "startLine": 1, + "startOffset": 1, + "endLine": 1, + "endOffset": 10, + "errorCodes": [ + 2304 + ] + }, + "command": "getCodeFixes" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "getCodeFixes", + "request_seq": 5, + "success": true, + "body": [ + { + "fixName": "import", + "description": "Add import from \"./env/browser.js\"", + "changes": [ + { + "fileName": "/src/a.ts", + "textChanges": [ + { + "start": { + "line": 1, + "offset": 1 + }, + "end": { + "line": 1, + "offset": 1 + }, + "newText": "import { isBrowser } from \"./env/browser.js\";\r\n\r\n" + } + ] + } + ] + }, + { + "fixName": "import", + "description": "Add import from \"#is-browser\"", + "changes": [ + { + "fileName": "/src/a.ts", + "textChanges": [ + { + "start": { + "line": 1, + "offset": 1 + }, + "end": { + "line": 1, + "offset": 1 + }, + "newText": "import { isBrowser } from \"#is-browser\";\r\n\r\n" + } + ] + } + ] + } + ] + } \ No newline at end of file diff --git a/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap2.js b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap2.js new file mode 100644 index 0000000000000..0faa37e2e0945 --- /dev/null +++ b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap2.js @@ -0,0 +1,321 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +//// [/lib.d.ts] +lib.d.ts-Text + +//// [/lib.decorators.d.ts] +lib.decorators.d.ts-Text + +//// [/lib.decorators.legacy.d.ts] +lib.decorators.legacy.d.ts-Text + +//// [/package.json] +{ + "type": "module", + "imports": { + "#internal/*": "./dist/internal/*" + } +} + +//// [/src/a.ts] +something + +//// [/src/internal/foo.ts] +export function something(name: string) {} + +//// [/tsconfig.json] +{ + "compilerOptions": { + "module": "nodenext", + "rootDir": "src", + "outDir": "dist" + } +} + + +Info seq [hh:mm:ss:mss] request: + { + "seq": 0, + "type": "request", + "arguments": { + "file": "/tsconfig.json" + }, + "command": "open" + } +Info seq [hh:mm:ss:mss] Search path: / +Info seq [hh:mm:ss:mss] For info: /tsconfig.json :: Config file name: /tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tsconfig.json 2000 undefined Project: /tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/tsconfig.json", + "reason": "Creating possible configured project for /tsconfig.json to open" + } + } +Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { + "rootNames": [ + "/lib.d.ts", + "/lib.decorators.d.ts", + "/lib.decorators.legacy.d.ts", + "/src/a.ts", + "/src/internal/foo.ts" + ], + "options": { + "module": 199, + "rootDir": "/src", + "outDir": "/dist", + "configFilePath": "/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.legacy.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/a.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/internal/foo.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (5) + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /lib.d.ts Text-1 lib.d.ts-Text + /src/a.ts Text-1 "something" + /src/internal/foo.ts Text-1 "export function something(name: string) {}" + + + lib.decorators.d.ts + Library referenced via 'decorators' from file 'lib.d.ts' + Matched by default include pattern '**/*' + lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file 'lib.d.ts' + Matched by default include pattern '**/*' + lib.d.ts + Matched by default include pattern '**/*' + src/a.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + src/internal/foo.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingFinish", + "body": { + "projectName": "/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "configFileDiag", + "body": { + "triggerFile": "/tsconfig.json", + "configFile": "/tsconfig.json", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + /lib.d.ts Text-1 lib.d.ts-Text + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /tsconfig.json SVC-1-0 "{\n \"compilerOptions\": {\n \"module\": \"nodenext\",\n \"rootDir\": \"src\",\n \"outDir\": \"dist\"\n }\n}" + + + lib.d.ts + Default library for target 'es5' + lib.decorators.d.ts + Library referenced via 'decorators' from file 'lib.d.ts' + lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file 'lib.d.ts' + tsconfig.json + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /package.json 250 undefined WatchType: package.json file +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (5) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /tsconfig.json ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +After Request +watchedFiles:: +/lib.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.legacy.d.ts: *new* + {"pollingInterval":500} +/package.json: *new* + {"pollingInterval":250} +/src/a.ts: *new* + {"pollingInterval":500} +/src/internal/foo.ts: *new* + {"pollingInterval":500} +/tsconfig.json: *new* + {"pollingInterval":2000} + +watchedDirectoriesRecursive:: +: *new* + {} + +Info seq [hh:mm:ss:mss] request: + { + "seq": 1, + "type": "request", + "arguments": { + "preferences": { + "includeCompletionsForModuleExports": true, + "includeCompletionsWithInsertText": true + } + }, + "command": "configure" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "configure", + "request_seq": 1, + "success": true + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 2, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "syntacticDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "syntacticDiagnosticsSync", + "request_seq": 2, + "success": true, + "body": [] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 3, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "semanticDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "semanticDiagnosticsSync", + "request_seq": 3, + "success": true, + "body": [ + { + "message": "Cannot find name 'something'.", + "start": 0, + "length": 9, + "category": "error", + "code": 2304, + "startLocation": { + "line": 1, + "offset": 1 + }, + "endLocation": { + "line": 1, + "offset": 10 + } + } + ] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 4, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "suggestionDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "suggestionDiagnosticsSync", + "request_seq": 4, + "success": true, + "body": [] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 5, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "startLine": 1, + "startOffset": 1, + "endLine": 1, + "endOffset": 10, + "errorCodes": [ + 2304 + ] + }, + "command": "getCodeFixes" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "getCodeFixes", + "request_seq": 5, + "success": true, + "body": [ + { + "fixName": "import", + "description": "Add import from \"#internal/foo.js\"", + "changes": [ + { + "fileName": "/src/a.ts", + "textChanges": [ + { + "start": { + "line": 1, + "offset": 1 + }, + "end": { + "line": 1, + "offset": 1 + }, + "newText": "import { something } from \"#internal/foo.js\";\r\n\r\n" + } + ] + } + ] + } + ] + } \ No newline at end of file diff --git a/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap3.js b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap3.js new file mode 100644 index 0000000000000..b2621096bd175 --- /dev/null +++ b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap3.js @@ -0,0 +1,321 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +//// [/lib.d.ts] +lib.d.ts-Text + +//// [/lib.decorators.d.ts] +lib.decorators.d.ts-Text + +//// [/lib.decorators.legacy.d.ts] +lib.decorators.legacy.d.ts-Text + +//// [/package.json] +{ + "type": "module", + "imports": { + "#internal/": "./dist/internal/" + } +} + +//// [/src/a.ts] +something + +//// [/src/internal/foo.ts] +export function something(name: string) {} + +//// [/tsconfig.json] +{ + "compilerOptions": { + "module": "nodenext", + "rootDir": "src", + "outDir": "dist" + } +} + + +Info seq [hh:mm:ss:mss] request: + { + "seq": 0, + "type": "request", + "arguments": { + "file": "/tsconfig.json" + }, + "command": "open" + } +Info seq [hh:mm:ss:mss] Search path: / +Info seq [hh:mm:ss:mss] For info: /tsconfig.json :: Config file name: /tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tsconfig.json 2000 undefined Project: /tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/tsconfig.json", + "reason": "Creating possible configured project for /tsconfig.json to open" + } + } +Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { + "rootNames": [ + "/lib.d.ts", + "/lib.decorators.d.ts", + "/lib.decorators.legacy.d.ts", + "/src/a.ts", + "/src/internal/foo.ts" + ], + "options": { + "module": 199, + "rootDir": "/src", + "outDir": "/dist", + "configFilePath": "/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.legacy.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/a.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/internal/foo.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (5) + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /lib.d.ts Text-1 lib.d.ts-Text + /src/a.ts Text-1 "something" + /src/internal/foo.ts Text-1 "export function something(name: string) {}" + + + lib.decorators.d.ts + Library referenced via 'decorators' from file 'lib.d.ts' + Matched by default include pattern '**/*' + lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file 'lib.d.ts' + Matched by default include pattern '**/*' + lib.d.ts + Matched by default include pattern '**/*' + src/a.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + src/internal/foo.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingFinish", + "body": { + "projectName": "/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "configFileDiag", + "body": { + "triggerFile": "/tsconfig.json", + "configFile": "/tsconfig.json", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + /lib.d.ts Text-1 lib.d.ts-Text + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /tsconfig.json SVC-1-0 "{\n \"compilerOptions\": {\n \"module\": \"nodenext\",\n \"rootDir\": \"src\",\n \"outDir\": \"dist\"\n }\n}" + + + lib.d.ts + Default library for target 'es5' + lib.decorators.d.ts + Library referenced via 'decorators' from file 'lib.d.ts' + lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file 'lib.d.ts' + tsconfig.json + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /package.json 250 undefined WatchType: package.json file +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (5) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /tsconfig.json ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +After Request +watchedFiles:: +/lib.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.legacy.d.ts: *new* + {"pollingInterval":500} +/package.json: *new* + {"pollingInterval":250} +/src/a.ts: *new* + {"pollingInterval":500} +/src/internal/foo.ts: *new* + {"pollingInterval":500} +/tsconfig.json: *new* + {"pollingInterval":2000} + +watchedDirectoriesRecursive:: +: *new* + {} + +Info seq [hh:mm:ss:mss] request: + { + "seq": 1, + "type": "request", + "arguments": { + "preferences": { + "includeCompletionsForModuleExports": true, + "includeCompletionsWithInsertText": true + } + }, + "command": "configure" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "configure", + "request_seq": 1, + "success": true + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 2, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "syntacticDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "syntacticDiagnosticsSync", + "request_seq": 2, + "success": true, + "body": [] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 3, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "semanticDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "semanticDiagnosticsSync", + "request_seq": 3, + "success": true, + "body": [ + { + "message": "Cannot find name 'something'.", + "start": 0, + "length": 9, + "category": "error", + "code": 2304, + "startLocation": { + "line": 1, + "offset": 1 + }, + "endLocation": { + "line": 1, + "offset": 10 + } + } + ] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 4, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "suggestionDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "suggestionDiagnosticsSync", + "request_seq": 4, + "success": true, + "body": [] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 5, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "startLine": 1, + "startOffset": 1, + "endLine": 1, + "endOffset": 10, + "errorCodes": [ + 2304 + ] + }, + "command": "getCodeFixes" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "getCodeFixes", + "request_seq": 5, + "success": true, + "body": [ + { + "fixName": "import", + "description": "Add import from \"#internal/foo.js\"", + "changes": [ + { + "fileName": "/src/a.ts", + "textChanges": [ + { + "start": { + "line": 1, + "offset": 1 + }, + "end": { + "line": 1, + "offset": 1 + }, + "newText": "import { something } from \"#internal/foo.js\";\r\n\r\n" + } + ] + } + ] + } + ] + } \ No newline at end of file diff --git a/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap4.js b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap4.js new file mode 100644 index 0000000000000..e25af521ae67b --- /dev/null +++ b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap4.js @@ -0,0 +1,324 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +//// [/lib.d.ts] +lib.d.ts-Text + +//// [/lib.decorators.d.ts] +lib.decorators.d.ts-Text + +//// [/lib.decorators.legacy.d.ts] +lib.decorators.legacy.d.ts-Text + +//// [/package.json] +{ + "type": "module", + "imports": { + "#is-browser": { + "types": "./dist/env/browser.d.ts", + "default": "./dist/env/browser.js" + } + } +} + +//// [/src/a.ts] +isBrowser + +//// [/src/env/browser.ts] +export const isBrowser = true; + +//// [/tsconfig.json] +{ + "compilerOptions": { + "module": "nodenext", + "rootDir": "src", + "outDir": "dist" + } +} + + +Info seq [hh:mm:ss:mss] request: + { + "seq": 0, + "type": "request", + "arguments": { + "file": "/tsconfig.json" + }, + "command": "open" + } +Info seq [hh:mm:ss:mss] Search path: / +Info seq [hh:mm:ss:mss] For info: /tsconfig.json :: Config file name: /tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tsconfig.json 2000 undefined Project: /tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/tsconfig.json", + "reason": "Creating possible configured project for /tsconfig.json to open" + } + } +Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { + "rootNames": [ + "/lib.d.ts", + "/lib.decorators.d.ts", + "/lib.decorators.legacy.d.ts", + "/src/a.ts", + "/src/env/browser.ts" + ], + "options": { + "module": 199, + "rootDir": "/src", + "outDir": "/dist", + "configFilePath": "/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.legacy.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/a.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/env/browser.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (5) + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /lib.d.ts Text-1 lib.d.ts-Text + /src/a.ts Text-1 "isBrowser" + /src/env/browser.ts Text-1 "export const isBrowser = true;" + + + lib.decorators.d.ts + Library referenced via 'decorators' from file 'lib.d.ts' + Matched by default include pattern '**/*' + lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file 'lib.d.ts' + Matched by default include pattern '**/*' + lib.d.ts + Matched by default include pattern '**/*' + src/a.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + src/env/browser.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingFinish", + "body": { + "projectName": "/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "configFileDiag", + "body": { + "triggerFile": "/tsconfig.json", + "configFile": "/tsconfig.json", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + /lib.d.ts Text-1 lib.d.ts-Text + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /tsconfig.json SVC-1-0 "{\n \"compilerOptions\": {\n \"module\": \"nodenext\",\n \"rootDir\": \"src\",\n \"outDir\": \"dist\"\n }\n}" + + + lib.d.ts + Default library for target 'es5' + lib.decorators.d.ts + Library referenced via 'decorators' from file 'lib.d.ts' + lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file 'lib.d.ts' + tsconfig.json + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /package.json 250 undefined WatchType: package.json file +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (5) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /tsconfig.json ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +After Request +watchedFiles:: +/lib.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.legacy.d.ts: *new* + {"pollingInterval":500} +/package.json: *new* + {"pollingInterval":250} +/src/a.ts: *new* + {"pollingInterval":500} +/src/env/browser.ts: *new* + {"pollingInterval":500} +/tsconfig.json: *new* + {"pollingInterval":2000} + +watchedDirectoriesRecursive:: +: *new* + {} + +Info seq [hh:mm:ss:mss] request: + { + "seq": 1, + "type": "request", + "arguments": { + "preferences": { + "includeCompletionsForModuleExports": true, + "includeCompletionsWithInsertText": true + } + }, + "command": "configure" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "configure", + "request_seq": 1, + "success": true + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 2, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "syntacticDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "syntacticDiagnosticsSync", + "request_seq": 2, + "success": true, + "body": [] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 3, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "semanticDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "semanticDiagnosticsSync", + "request_seq": 3, + "success": true, + "body": [ + { + "message": "Cannot find name 'isBrowser'.", + "start": 0, + "length": 9, + "category": "error", + "code": 2304, + "startLocation": { + "line": 1, + "offset": 1 + }, + "endLocation": { + "line": 1, + "offset": 10 + } + } + ] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 4, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "suggestionDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "suggestionDiagnosticsSync", + "request_seq": 4, + "success": true, + "body": [] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 5, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "startLine": 1, + "startOffset": 1, + "endLine": 1, + "endOffset": 10, + "errorCodes": [ + 2304 + ] + }, + "command": "getCodeFixes" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "getCodeFixes", + "request_seq": 5, + "success": true, + "body": [ + { + "fixName": "import", + "description": "Add import from \"#is-browser\"", + "changes": [ + { + "fileName": "/src/a.ts", + "textChanges": [ + { + "start": { + "line": 1, + "offset": 1 + }, + "end": { + "line": 1, + "offset": 1 + }, + "newText": "import { isBrowser } from \"#is-browser\";\r\n\r\n" + } + ] + } + ] + } + ] + } \ No newline at end of file diff --git a/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap5.js b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap5.js new file mode 100644 index 0000000000000..9440f3f24757c --- /dev/null +++ b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_importsMap5.js @@ -0,0 +1,341 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +//// [/lib.d.ts] +lib.d.ts-Text + +//// [/lib.decorators.d.ts] +lib.decorators.d.ts-Text + +//// [/lib.decorators.legacy.d.ts] +lib.decorators.legacy.d.ts-Text + +//// [/package.json] +{ + "type": "module", + "imports": { + "#is-browser": { + "types": "./types/env/browser.d.ts", + "default": "./not-dist-on-purpose/env/browser.js" + } + } +} + +//// [/src/a.ts] +isBrowser + +//// [/src/env/browser.ts] +export const isBrowser = true; + +//// [/tsconfig.json] +{ + "compilerOptions": { + "module": "nodenext", + "rootDir": "src", + "outDir": "dist", + "declarationDir": "types", + } +} + + +Info seq [hh:mm:ss:mss] request: + { + "seq": 0, + "type": "request", + "arguments": { + "file": "/tsconfig.json" + }, + "command": "open" + } +Info seq [hh:mm:ss:mss] Search path: / +Info seq [hh:mm:ss:mss] For info: /tsconfig.json :: Config file name: /tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tsconfig.json 2000 undefined Project: /tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/tsconfig.json", + "reason": "Creating possible configured project for /tsconfig.json to open" + } + } +Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { + "rootNames": [ + "/lib.d.ts", + "/lib.decorators.d.ts", + "/lib.decorators.legacy.d.ts", + "/src/a.ts", + "/src/env/browser.ts" + ], + "options": { + "module": 199, + "rootDir": "/src", + "outDir": "/dist", + "declarationDir": "/types", + "configFilePath": "/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.legacy.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/a.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/env/browser.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (5) + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /lib.d.ts Text-1 lib.d.ts-Text + /src/a.ts Text-1 "isBrowser" + /src/env/browser.ts Text-1 "export const isBrowser = true;" + + + lib.decorators.d.ts + Library referenced via 'decorators' from file 'lib.d.ts' + Matched by default include pattern '**/*' + lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file 'lib.d.ts' + Matched by default include pattern '**/*' + lib.d.ts + Matched by default include pattern '**/*' + src/a.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + src/env/browser.ts + Matched by default include pattern '**/*' + File is ECMAScript module because 'package.json' has field "type" with value "module" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingFinish", + "body": { + "projectName": "/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "configFileDiag", + "body": { + "triggerFile": "/tsconfig.json", + "configFile": "/tsconfig.json", + "diagnostics": [ + { + "start": { + "line": 6, + "offset": 5 + }, + "end": { + "line": 6, + "offset": 21 + }, + "text": "Option 'declarationDir' cannot be specified without specifying option 'declaration' or option 'composite'.", + "code": 5069, + "category": "error", + "fileName": "/tsconfig.json" + } + ] + } + } +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + /lib.d.ts Text-1 lib.d.ts-Text + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /tsconfig.json SVC-1-0 "{\n \"compilerOptions\": {\n \"module\": \"nodenext\",\n \"rootDir\": \"src\",\n \"outDir\": \"dist\",\n \"declarationDir\": \"types\",\n }\n}" + + + lib.d.ts + Default library for target 'es5' + lib.decorators.d.ts + Library referenced via 'decorators' from file 'lib.d.ts' + lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file 'lib.d.ts' + tsconfig.json + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /package.json 250 undefined WatchType: package.json file +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (5) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /tsconfig.json ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +After Request +watchedFiles:: +/lib.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.legacy.d.ts: *new* + {"pollingInterval":500} +/package.json: *new* + {"pollingInterval":250} +/src/a.ts: *new* + {"pollingInterval":500} +/src/env/browser.ts: *new* + {"pollingInterval":500} +/tsconfig.json: *new* + {"pollingInterval":2000} + +watchedDirectoriesRecursive:: +: *new* + {} + +Info seq [hh:mm:ss:mss] request: + { + "seq": 1, + "type": "request", + "arguments": { + "preferences": { + "includeCompletionsForModuleExports": true, + "includeCompletionsWithInsertText": true + } + }, + "command": "configure" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "configure", + "request_seq": 1, + "success": true + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 2, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "syntacticDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "syntacticDiagnosticsSync", + "request_seq": 2, + "success": true, + "body": [] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 3, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "semanticDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "semanticDiagnosticsSync", + "request_seq": 3, + "success": true, + "body": [ + { + "message": "Cannot find name 'isBrowser'.", + "start": 0, + "length": 9, + "category": "error", + "code": 2304, + "startLocation": { + "line": 1, + "offset": 1 + }, + "endLocation": { + "line": 1, + "offset": 10 + } + } + ] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 4, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "includeLinePosition": true + }, + "command": "suggestionDiagnosticsSync" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "suggestionDiagnosticsSync", + "request_seq": 4, + "success": true, + "body": [] + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 5, + "type": "request", + "arguments": { + "file": "/src/a.ts", + "startLine": 1, + "startOffset": 1, + "endLine": 1, + "endOffset": 10, + "errorCodes": [ + 2304 + ] + }, + "command": "getCodeFixes" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "getCodeFixes", + "request_seq": 5, + "success": true, + "body": [ + { + "fixName": "import", + "description": "Add import from \"#is-browser\"", + "changes": [ + { + "fileName": "/src/a.ts", + "textChanges": [ + { + "start": { + "line": 1, + "offset": 1 + }, + "end": { + "line": 1, + "offset": 1 + }, + "newText": "import { isBrowser } from \"#is-browser\";\r\n\r\n" + } + ] + } + ] + } + ] + } \ No newline at end of file diff --git a/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_wildcardExports1.js b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_wildcardExports1.js index c20647bf14fc7..9fedb1abdc436 100644 --- a/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_wildcardExports1.js +++ b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_wildcardExports1.js @@ -171,9 +171,10 @@ Info seq [hh:mm:ss:mss] Files (4) Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /package.json 250 undefined WatchType: package.json file -Info seq [hh:mm:ss:mss] AutoImportProviderProject: found 5 root files in 1 dependencies in * ms +Info seq [hh:mm:ss:mss] AutoImportProviderProject: found 6 root files in 1 dependencies in * ms Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/pkg/a/a1.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/pkg/b/b1.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/pkg/b/b2.d.mts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/pkg/c/c1.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/pkg/c/subfolder/c2.d.mts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/pkg/d/d1.d.mts 500 undefined WatchType: Closed Script info @@ -183,9 +184,10 @@ Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/pkg/b/pa Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/pkg/c/package.json 2000 undefined Project: /dev/null/autoImportProviderProject1* WatchType: File location affecting resolution Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/autoImportProviderProject1* Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/dev/null/autoImportProviderProject1*' (AutoImportProvider) -Info seq [hh:mm:ss:mss] Files (5) +Info seq [hh:mm:ss:mss] Files (6) /node_modules/pkg/a/a1.d.ts Text-1 "export const a1: number;" /node_modules/pkg/b/b1.d.ts Text-1 "export const b1: number;" + /node_modules/pkg/b/b2.d.mts Text-1 "export const NOT_REACHABLE: number;" /node_modules/pkg/c/c1.d.ts Text-1 "export const c1: number;" /node_modules/pkg/c/subfolder/c2.d.mts Text-1 "export const c2: number;" /node_modules/pkg/d/d1.d.mts Text-1 "export const d1: number;" @@ -197,6 +199,8 @@ Info seq [hh:mm:ss:mss] Files (5) node_modules/pkg/b/b1.d.ts Root file specified for compilation File is CommonJS module because 'node_modules/pkg/package.json' does not have field "type" + node_modules/pkg/b/b2.d.mts + Root file specified for compilation node_modules/pkg/c/c1.d.ts Root file specified for compilation File is CommonJS module because 'node_modules/pkg/package.json' does not have field "type" @@ -231,7 +235,7 @@ Info seq [hh:mm:ss:mss] Files (4) Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] Project '/dev/null/autoImportProviderProject1*' (AutoImportProvider) -Info seq [hh:mm:ss:mss] Files (5) +Info seq [hh:mm:ss:mss] Files (6) Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) @@ -257,6 +261,8 @@ watchedFiles:: {"pollingInterval":2000} /node_modules/pkg/b/b1.d.ts: *new* {"pollingInterval":500} +/node_modules/pkg/b/b2.d.mts: *new* + {"pollingInterval":500} /node_modules/pkg/b/package.json: *new* {"pollingInterval":2000} /node_modules/pkg/c/c1.d.ts: *new* @@ -315,7 +321,7 @@ Info seq [hh:mm:ss:mss] forEachExternalModuleToImportFrom autoImportProvider: * Info seq [hh:mm:ss:mss] getExportInfoMap: done in * ms Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache -Info seq [hh:mm:ss:mss] collectAutoImports: resolved 5 module specifiers, plus 0 ambient and 0 from cache +Info seq [hh:mm:ss:mss] collectAutoImports: resolved 5 module specifiers, plus 0 ambient and 1 from cache Info seq [hh:mm:ss:mss] collectAutoImports: response is complete Info seq [hh:mm:ss:mss] collectAutoImports: * Info seq [hh:mm:ss:mss] getCompletionData: Semantic work: * @@ -1108,6 +1114,8 @@ watchedFiles:: {"pollingInterval":2000} /node_modules/pkg/b/b1.d.ts: {"pollingInterval":500} +/node_modules/pkg/b/b2.d.mts: + {"pollingInterval":500} /node_modules/pkg/b/package.json: {"pollingInterval":2000} /node_modules/pkg/c/c1.d.ts: diff --git a/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_wildcardExports3.js b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_wildcardExports3.js new file mode 100644 index 0000000000000..5d8219f48ec76 --- /dev/null +++ b/tests/baselines/reference/tsserver/fourslashServer/autoImportProvider_wildcardExports3.js @@ -0,0 +1,628 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +//// [/lib.d.ts] +lib.d.ts-Text + +//// [/lib.decorators.d.ts] +lib.decorators.d.ts-Text + +//// [/lib.decorators.legacy.d.ts] +lib.decorators.legacy.d.ts-Text + +//// [/project/apps/web/app/index.tsx] +(); + +//// [/project/apps/web/node_modules/@repo/ui] symlink(/project/packages/ui) +//// [/project/apps/web/package.json] +{ + "name": "web", + "version": "1.0.0", + "dependencies": { + "@repo/ui": "workspace:*" + } +} + +//// [/project/apps/web/tsconfig.json] +{ + "compilerOptions": { + "module": "esnext", + "moduleResolution": "bundler", + "noEmit": true, + "jsx": "preserve" + }, + "include": ["app"] +} + +//// [/project/packages/ui/package.json] +{ + "name": "@repo/ui", + "version": "1.0.0", + "exports": { + "./*": "./src/*.tsx" + } +} + +//// [/project/packages/ui/src/Card.tsx] +export const Card = () => null; + + +Info seq [hh:mm:ss:mss] request: + { + "seq": 0, + "type": "request", + "arguments": { + "file": "/project/packages/ui/package.json" + }, + "command": "open" + } +Info seq [hh:mm:ss:mss] Search path: /project/packages/ui +Info seq [hh:mm:ss:mss] For info: /project/packages/ui/package.json :: No config files found. +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /project/packages/ui/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /project/packages/ui/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.legacy.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /project/packages/ui/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /project/packages/ui/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + /lib.d.ts Text-1 lib.d.ts-Text + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /project/packages/ui/package.json SVC-1-0 "{\n \"name\": \"@repo/ui\",\n \"version\": \"1.0.0\",\n \"exports\": {\n \"./*\": \"./src/*.tsx\"\n }\n}" + + + ../../../lib.d.ts + Default library for target 'es5' + ../../../lib.decorators.d.ts + Library referenced via 'decorators' from file '../../../lib.d.ts' + ../../../lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file '../../../lib.d.ts' + package.json + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /project/packages/ui/package.json 250 undefined WatchType: package.json file +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /project/packages/ui/package.json ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +After Request +watchedFiles:: +/lib.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.d.ts: *new* + {"pollingInterval":500} +/lib.decorators.legacy.d.ts: *new* + {"pollingInterval":500} +/project/packages/ui/package.json: *new* + {"pollingInterval":250} + +watchedDirectoriesRecursive:: +/project/packages/ui/node_modules: *new* + {} +/project/packages/ui/node_modules/@types: *new* + {} + +Info seq [hh:mm:ss:mss] request: + { + "seq": 1, + "type": "request", + "arguments": { + "file": "/project/apps/web/app/index.tsx" + }, + "command": "open" + } +Info seq [hh:mm:ss:mss] Search path: /project/apps/web/app +Info seq [hh:mm:ss:mss] For info: /project/apps/web/app/index.tsx :: Config file name: /project/apps/web/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /project/apps/web/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /project/apps/web/tsconfig.json 2000 undefined Project: /project/apps/web/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/project/apps/web/tsconfig.json", + "reason": "Creating possible configured project for /project/apps/web/app/index.tsx to open" + } + } +Info seq [hh:mm:ss:mss] Config: /project/apps/web/tsconfig.json : { + "rootNames": [ + "/project/apps/web/app/index.tsx" + ], + "options": { + "module": 99, + "moduleResolution": 100, + "noEmit": true, + "jsx": 1, + "configFilePath": "/project/apps/web/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /project/apps/web/app 1 undefined Config: /project/apps/web/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /project/apps/web/app 1 undefined Config: /project/apps/web/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /project/apps/web/tsconfig.json +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /project/apps/web/node_modules 1 undefined Project: /project/apps/web/tsconfig.json WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /project/apps/web/node_modules 1 undefined Project: /project/apps/web/tsconfig.json WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /project/apps/web/node_modules/@types 1 undefined Project: /project/apps/web/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /project/apps/web/node_modules/@types 1 undefined Project: /project/apps/web/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /project/apps/web/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/project/apps/web/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /lib.d.ts Text-1 lib.d.ts-Text + /lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /project/apps/web/app/index.tsx SVC-1-0 "();" + + + ../../../lib.d.ts + Default library for target 'es5' + ../../../lib.decorators.d.ts + Library referenced via 'decorators' from file '../../../lib.d.ts' + ../../../lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file '../../../lib.d.ts' + app/index.tsx + Matched by include pattern 'app' in 'tsconfig.json' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /project/apps/web/package.json 250 undefined WatchType: package.json file +Info seq [hh:mm:ss:mss] AutoImportProviderProject: found 1 root files in 1 dependencies in * ms +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /project/packages/ui/src/Card.tsx 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/autoImportProviderProject1* +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/autoImportProviderProject1* Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/autoImportProviderProject1*' (AutoImportProvider) +Info seq [hh:mm:ss:mss] Files (1) + /project/packages/ui/src/Card.tsx Text-1 "export const Card = () => null;" + + + ../../packages/ui/src/Card.tsx + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingFinish", + "body": { + "projectName": "/project/apps/web/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "configFileDiag", + "body": { + "triggerFile": "/project/apps/web/app/index.tsx", + "configFile": "/project/apps/web/tsconfig.json", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] Project '/project/apps/web/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/autoImportProviderProject1*' (AutoImportProvider) +Info seq [hh:mm:ss:mss] Files (1) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /project/packages/ui/package.json ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileName: /project/apps/web/app/index.tsx ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /project/apps/web/tsconfig.json +After Request +watchedFiles:: +/lib.d.ts: + {"pollingInterval":500} +/lib.decorators.d.ts: + {"pollingInterval":500} +/lib.decorators.legacy.d.ts: + {"pollingInterval":500} +/project/apps/web/package.json: *new* + {"pollingInterval":250} +/project/apps/web/tsconfig.json: *new* + {"pollingInterval":2000} +/project/packages/ui/package.json: + {"pollingInterval":250} +/project/packages/ui/src/Card.tsx: *new* + {"pollingInterval":500} + +watchedDirectoriesRecursive:: +/project/apps/web/app: *new* + {} +/project/apps/web/node_modules: *new* + {} +/project/apps/web/node_modules/@types: *new* + {} +/project/packages/ui/node_modules: + {} +/project/packages/ui/node_modules/@types: + {} + +Info seq [hh:mm:ss:mss] request: + { + "seq": 2, + "type": "request", + "arguments": { + "preferences": { + "includeCompletionsForModuleExports": true, + "allowIncompleteCompletions": true + } + }, + "command": "configure" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "configure", + "request_seq": 2, + "success": true + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 3, + "type": "request", + "arguments": { + "file": "/project/apps/web/app/index.tsx", + "line": 1, + "offset": 7 + }, + "command": "completionInfo" + } +Info seq [hh:mm:ss:mss] getCompletionData: Get current token: * +Info seq [hh:mm:ss:mss] getCompletionData: Is inside comment: * +Info seq [hh:mm:ss:mss] getCompletionData: Get previous token: * +Info seq [hh:mm:ss:mss] getCompletionsAtPosition: isCompletionListBlocker: * +Info seq [hh:mm:ss:mss] getExportInfoMap: cache miss or empty; calculating new results +Info seq [hh:mm:ss:mss] forEachExternalModuleToImportFrom autoImportProvider: * +Info seq [hh:mm:ss:mss] getExportInfoMap: done in * ms +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /project/apps/web/node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /project/apps/web/node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache +Info seq [hh:mm:ss:mss] collectAutoImports: resolved 1 module specifiers, plus 0 ambient and 0 from cache +Info seq [hh:mm:ss:mss] collectAutoImports: response is complete +Info seq [hh:mm:ss:mss] collectAutoImports: * +Info seq [hh:mm:ss:mss] getCompletionData: Semantic work: * +Info seq [hh:mm:ss:mss] getCompletionsAtPosition: getCompletionEntriesFromSymbols: * +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "completionInfo", + "request_seq": 3, + "success": true, + "body": { + "flags": 9, + "isGlobalCompletion": false, + "isMemberCompletion": false, + "isNewIdentifierLocation": false, + "entries": [ + { + "name": "Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "ArrayBuffer", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Boolean", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "DataView", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Date", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "decodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "decodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "encodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "encodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Error", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "eval", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "EvalError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Float32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Float64Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Function", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "globalThis", + "kind": "module", + "kindModifiers": "", + "sortText": "15" + }, + { + "name": "Infinity", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Int16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Int32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Int8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Intl", + "kind": "module", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "isFinite", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "isNaN", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "JSON", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Math", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "NaN", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Number", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Object", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "parseFloat", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "parseInt", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "RangeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "ReferenceError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "RegExp", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "String", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "SyntaxError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "TypeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Uint16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Uint32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Uint8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Uint8ClampedArray", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "undefined", + "kind": "var", + "kindModifiers": "", + "sortText": "15" + }, + { + "name": "URIError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15" + }, + { + "name": "Card", + "kind": "const", + "kindModifiers": "export", + "sortText": "16", + "hasAction": true, + "source": "@repo/ui/Card", + "sourceDisplay": [ + { + "text": "@repo/ui/Card", + "kind": "text" + } + ], + "isPackageJsonImport": true, + "data": { + "exportName": "Card", + "exportMapKey": "4 * Card ", + "moduleSpecifier": "@repo/ui/Card", + "fileName": "/project/packages/ui/src/Card.tsx", + "isPackageJsonImport": true + } + }, + { + "name": "escape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15" + }, + { + "name": "unescape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15" + } + ] + } + } +After Request +watchedFiles:: +/lib.d.ts: + {"pollingInterval":500} +/lib.decorators.d.ts: + {"pollingInterval":500} +/lib.decorators.legacy.d.ts: + {"pollingInterval":500} +/project/apps/web/package.json: + {"pollingInterval":250} +/project/apps/web/tsconfig.json: + {"pollingInterval":2000} +/project/packages/ui/package.json: + {"pollingInterval":250} +/project/packages/ui/src/Card.tsx: + {"pollingInterval":500} + +watchedDirectoriesRecursive:: +/project/apps/web/app: + {} +/project/apps/web/node_modules: + {} + {} *new* +/project/apps/web/node_modules/@types: + {} +/project/packages/ui/node_modules: + {} +/project/packages/ui/node_modules/@types: + {} diff --git a/tests/baselines/reference/tsserver/rename/rename-TS-file-with-js-extension.js b/tests/baselines/reference/tsserver/rename/rename-TS-file-with-js-extension.js new file mode 100644 index 0000000000000..dd2d27ac17ad2 --- /dev/null +++ b/tests/baselines/reference/tsserver/rename/rename-TS-file-with-js-extension.js @@ -0,0 +1,197 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +Before request +//// [/a.ts] +export const a = 1; + +//// [/b.ts] +import * as foo from './a.js'; + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/a.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: / +Info seq [hh:mm:ss:mss] For info: /a.ts :: No config files found. +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject1* WatchType: Missing file +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (1) + /a.ts SVC-1-0 "export const a = 1;" + + + a.ts + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (1) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/a/lib/lib.d.ts: *new* + {"pollingInterval":500} + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/b.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: / +Info seq [hh:mm:ss:mss] For info: /b.ts :: No config files found. +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject2* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject2* WatchType: Missing file +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject2* Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject2*' (Inferred) +Info seq [hh:mm:ss:mss] Files (2) + /a.ts SVC-1-0 "export const a = 1;" + /b.ts SVC-1-0 "import * as foo from './a.js';" + + + a.ts + Imported via './a.js' from file 'b.ts' + b.ts + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] `remove Project:: +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (1) + /a.ts + + + a.ts + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject1* WatchType: Missing file +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject2*' (Inferred) +Info seq [hh:mm:ss:mss] Files (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject2* +Info seq [hh:mm:ss:mss] FileName: /b.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject2* +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "preferences": { + "allowRenameOfImportPath": true + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "configure", + "request_seq": 3, + "success": true, + "performanceData": { + "updateGraphDurationMs": * + } + } +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "rename", + "arguments": { + "file": "/b.ts", + "line": 1, + "offset": 25 + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + { + "response": { + "info": { + "canRename": true, + "fileToRename": "/a.ts", + "displayName": "/a.ts", + "fullDisplayName": "./a.js", + "kind": "module", + "kindModifiers": "", + "triggerSpan": { + "start": { + "line": 1, + "offset": 25 + }, + "end": { + "line": 1, + "offset": 29 + } + } + }, + "locs": [ + { + "file": "/b.ts", + "locs": [ + { + "start": { + "line": 1, + "offset": 23 + }, + "end": { + "line": 1, + "offset": 29 + }, + "contextStart": { + "line": 1, + "offset": 1 + }, + "contextEnd": { + "line": 1, + "offset": 31 + } + } + ] + } + ] + }, + "responseRequired": true + } +After request diff --git a/tests/baselines/reference/tsserver/rename/works-with-fileToRename.js b/tests/baselines/reference/tsserver/rename/works-with-fileToRename.js index ecc3762016c8d..d43f0f7596b3c 100644 --- a/tests/baselines/reference/tsserver/rename/works-with-fileToRename.js +++ b/tests/baselines/reference/tsserver/rename/works-with-fileToRename.js @@ -132,7 +132,7 @@ Info seq [hh:mm:ss:mss] response: "canRename": true, "fileToRename": "/a.ts", "displayName": "/a.ts", - "fullDisplayName": "/a.ts", + "fullDisplayName": "./a", "kind": "module", "kindModifiers": "", "triggerSpan": { @@ -259,7 +259,7 @@ Info seq [hh:mm:ss:mss] response: "canRename": true, "fileToRename": "/a.ts", "displayName": "/a.ts", - "fullDisplayName": "/a.ts", + "fullDisplayName": "./a", "kind": "module", "kindModifiers": "", "triggerSpan": { diff --git a/tests/baselines/reference/tsserver/telemetry/does-not-expose-paths.js b/tests/baselines/reference/tsserver/telemetry/does-not-expose-paths.js index dc21b322516d7..4c29185d5827e 100644 --- a/tests/baselines/reference/tsserver/telemetry/does-not-expose-paths.js +++ b/tests/baselines/reference/tsserver/telemetry/does-not-expose-paths.js @@ -471,7 +471,7 @@ Info seq [hh:mm:ss:mss] event: "line": 34, "offset": 16 }, - "text": "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'.", + "text": "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.disposable', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'esnext.decorators', 'decorators', 'decorators.legacy'.", "code": 6046, "category": "error", "fileName": "/tsconfig.json" diff --git a/tests/baselines/reference/typeFromPropertyAssignment10.symbols b/tests/baselines/reference/typeFromPropertyAssignment10.symbols index 6741190878be8..e40fc76333bab 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment10.symbols +++ b/tests/baselines/reference/typeFromPropertyAssignment10.symbols @@ -93,7 +93,7 @@ Outer.app.Application = (function () { me.view = new Outer.app.SomeView(); >me.view : Symbol(Application.view, Decl(application.js, 7, 22)) ->me : Symbol(Application.view, Decl(application.js, 7, 22)) +>me : Symbol(me, Decl(application.js, 7, 11)) >view : Symbol(Application.view, Decl(application.js, 7, 22)) >Outer.app.SomeView : Symbol(Outer.app.SomeView, Decl(someview.js, 0, 0)) >Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(someview.js, 6, 6), Decl(someview.js, 15, 6), Decl(application.js, 0, 6)) diff --git a/tests/baselines/reference/typeFromPropertyAssignment10_1.symbols b/tests/baselines/reference/typeFromPropertyAssignment10_1.symbols index 3f503faa766e4..c460e49a902b6 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment10_1.symbols +++ b/tests/baselines/reference/typeFromPropertyAssignment10_1.symbols @@ -93,7 +93,7 @@ Outer.app.Application = (function () { me.view = new Outer.app.SomeView(); >me.view : Symbol(Application.view, Decl(application.js, 7, 22)) ->me : Symbol(Application.view, Decl(application.js, 7, 22)) +>me : Symbol(me, Decl(application.js, 7, 11)) >view : Symbol(Application.view, Decl(application.js, 7, 22)) >Outer.app.SomeView : Symbol(Outer.app.SomeView, Decl(someview.js, 0, 0)) >Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(someview.js, 6, 6), Decl(someview.js, 15, 6), Decl(application.js, 0, 6)) diff --git a/tests/baselines/reference/typeFromPropertyAssignment40.symbols b/tests/baselines/reference/typeFromPropertyAssignment40.symbols index 347a110756223..e77306cb3d98d 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment40.symbols +++ b/tests/baselines/reference/typeFromPropertyAssignment40.symbols @@ -10,7 +10,7 @@ function Outer() { self.y = 2 >self.y : Symbol(Outer.y, Decl(typeFromPropertyAssignment40.js, 1, 19)) ->self : Symbol(Outer.y, Decl(typeFromPropertyAssignment40.js, 1, 19)) +>self : Symbol(self, Decl(typeFromPropertyAssignment40.js, 1, 7)) >y : Symbol(Outer.y, Decl(typeFromPropertyAssignment40.js, 1, 19)) } /** @type {Outer} */ diff --git a/tests/baselines/reference/typeFromPropertyAssignment9.symbols b/tests/baselines/reference/typeFromPropertyAssignment9.symbols index 3e1bbca657ac0..bfc23e323b688 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment9.symbols +++ b/tests/baselines/reference/typeFromPropertyAssignment9.symbols @@ -46,7 +46,7 @@ my.predicate.query = function () { me.property = false; >me.property : Symbol(query.property, Decl(a.js, 9, 18)) ->me : Symbol(query.property, Decl(a.js, 9, 18)) +>me : Symbol(me, Decl(a.js, 9, 7)) >property : Symbol(query.property, Decl(a.js, 9, 18)) }; diff --git a/tests/baselines/reference/typeFromPropertyAssignment9_1.symbols b/tests/baselines/reference/typeFromPropertyAssignment9_1.symbols index 6262ac7d94746..dd3d6c19678d7 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment9_1.symbols +++ b/tests/baselines/reference/typeFromPropertyAssignment9_1.symbols @@ -46,7 +46,7 @@ my.predicate.query = function () { me.property = false; >me.property : Symbol(query.property, Decl(a.js, 9, 18)) ->me : Symbol(query.property, Decl(a.js, 9, 18)) +>me : Symbol(me, Decl(a.js, 9, 7)) >property : Symbol(query.property, Decl(a.js, 9, 18)) }; diff --git a/tests/baselines/reference/typesVersions.ambientModules.trace.json b/tests/baselines/reference/typesVersions.ambientModules.trace.json index b8461698d9e7c..637af04734a94 100644 --- a/tests/baselines/reference/typesVersions.ambientModules.trace.json +++ b/tests/baselines/reference/typesVersions.ambientModules.trace.json @@ -881,5 +881,17 @@ "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersions.emptyTypes.trace.json b/tests/baselines/reference/typesVersions.emptyTypes.trace.json index 6a0282a43d638..51284d259e6a9 100644 --- a/tests/baselines/reference/typesVersions.emptyTypes.trace.json +++ b/tests/baselines/reference/typesVersions.emptyTypes.trace.json @@ -917,5 +917,18 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersions.justIndex.trace.json b/tests/baselines/reference/typesVersions.justIndex.trace.json index 6177a45aaace6..567aedf61205d 100644 --- a/tests/baselines/reference/typesVersions.justIndex.trace.json +++ b/tests/baselines/reference/typesVersions.justIndex.trace.json @@ -917,5 +917,18 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersions.multiFile.trace.json b/tests/baselines/reference/typesVersions.multiFile.trace.json index 589e95c6469be..7f5aaf3d3ebc9 100644 --- a/tests/baselines/reference/typesVersions.multiFile.trace.json +++ b/tests/baselines/reference/typesVersions.multiFile.trace.json @@ -860,5 +860,17 @@ "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json index b8461698d9e7c..637af04734a94 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json @@ -881,5 +881,17 @@ "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json index 589e95c6469be..7f5aaf3d3ebc9 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json @@ -860,5 +860,17 @@ "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json index 231fee4507e60..5598b74ec8099 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json @@ -883,5 +883,17 @@ "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json index c31f2afd0f3bf..ded85860a42e3 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json @@ -866,5 +866,17 @@ "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typingsSuggestionBun1.errors.txt b/tests/baselines/reference/typingsSuggestionBun1.errors.txt new file mode 100644 index 0000000000000..c2ab614b5fc9d --- /dev/null +++ b/tests/baselines/reference/typingsSuggestionBun1.errors.txt @@ -0,0 +1,11 @@ +a.ts(1,14): error TS2868: Cannot find name 'Bun'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig. + + +==== tsconfig.json (0 errors) ==== + { "compilerOptions": {"types": []} } + +==== a.ts (1 errors) ==== + const file = Bun.file("/a.ts"); + ~~~ +!!! error TS2868: Cannot find name 'Bun'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig. + \ No newline at end of file diff --git a/tests/baselines/reference/typingsSuggestionBun1.js b/tests/baselines/reference/typingsSuggestionBun1.js new file mode 100644 index 0000000000000..4561a2ff4aec5 --- /dev/null +++ b/tests/baselines/reference/typingsSuggestionBun1.js @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/typings/typingsSuggestionBun1.ts] //// + +//// [a.ts] +const file = Bun.file("/a.ts"); + + +//// [a.js] +var file = Bun.file("/a.ts"); diff --git a/tests/baselines/reference/typingsSuggestionBun1.symbols b/tests/baselines/reference/typingsSuggestionBun1.symbols new file mode 100644 index 0000000000000..77b6c8f717480 --- /dev/null +++ b/tests/baselines/reference/typingsSuggestionBun1.symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/typings/typingsSuggestionBun1.ts] //// + +=== a.ts === +const file = Bun.file("/a.ts"); +>file : Symbol(file, Decl(a.ts, 0, 5)) + diff --git a/tests/baselines/reference/typingsSuggestionBun1.types b/tests/baselines/reference/typingsSuggestionBun1.types new file mode 100644 index 0000000000000..2961bd4487239 --- /dev/null +++ b/tests/baselines/reference/typingsSuggestionBun1.types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/typings/typingsSuggestionBun1.ts] //// + +=== a.ts === +const file = Bun.file("/a.ts"); +>file : any +>Bun.file("/a.ts") : any +>Bun.file : any +>Bun : any +>file : any +>"/a.ts" : "/a.ts" + diff --git a/tests/baselines/reference/typingsSuggestionBun2.errors.txt b/tests/baselines/reference/typingsSuggestionBun2.errors.txt new file mode 100644 index 0000000000000..309dc7e05b313 --- /dev/null +++ b/tests/baselines/reference/typingsSuggestionBun2.errors.txt @@ -0,0 +1,11 @@ +a.ts(1,14): error TS2867: Cannot find name 'Bun'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`. + + +==== tsconfig.json (0 errors) ==== + { "compilerOptions": {} } + +==== a.ts (1 errors) ==== + const file = Bun.file("/a.ts"); + ~~~ +!!! error TS2867: Cannot find name 'Bun'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`. + \ No newline at end of file diff --git a/tests/baselines/reference/typingsSuggestionBun2.js b/tests/baselines/reference/typingsSuggestionBun2.js new file mode 100644 index 0000000000000..7a19ff2b8416f --- /dev/null +++ b/tests/baselines/reference/typingsSuggestionBun2.js @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/typings/typingsSuggestionBun2.ts] //// + +//// [a.ts] +const file = Bun.file("/a.ts"); + + +//// [a.js] +var file = Bun.file("/a.ts"); diff --git a/tests/baselines/reference/typingsSuggestionBun2.symbols b/tests/baselines/reference/typingsSuggestionBun2.symbols new file mode 100644 index 0000000000000..e022b8f6d6142 --- /dev/null +++ b/tests/baselines/reference/typingsSuggestionBun2.symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/typings/typingsSuggestionBun2.ts] //// + +=== a.ts === +const file = Bun.file("/a.ts"); +>file : Symbol(file, Decl(a.ts, 0, 5)) + diff --git a/tests/baselines/reference/typingsSuggestionBun2.types b/tests/baselines/reference/typingsSuggestionBun2.types new file mode 100644 index 0000000000000..e68cee2f35eee --- /dev/null +++ b/tests/baselines/reference/typingsSuggestionBun2.types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/typings/typingsSuggestionBun2.ts] //// + +=== a.ts === +const file = Bun.file("/a.ts"); +>file : any +>Bun.file("/a.ts") : any +>Bun.file : any +>Bun : any +>file : any +>"/a.ts" : "/a.ts" + diff --git a/tests/baselines/reference/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.symbols b/tests/baselines/reference/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.symbols new file mode 100644 index 0000000000000..05f1a32cc11d0 --- /dev/null +++ b/tests/baselines/reference/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.symbols @@ -0,0 +1,275 @@ +//// [tests/cases/compiler/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.tsx] //// + +=== node_modules/@types/react/index.d.ts === +// https://github.com/microsoft/TypeScript/issues/56688 + + +export = React; +>React : Symbol(React, Decl(index.d.ts, 4, 26)) + +export as namespace React; +>React : Symbol(React, Decl(index.d.ts, 3, 15)) + +declare namespace React { +>React : Symbol(React, Decl(index.d.ts, 4, 26)) + + type ReactNode = +>ReactNode : Symbol(ReactNode, Decl(index.d.ts, 6, 25)) + + | ReactElement +>ReactElement : Symbol(ReactElement, Decl(index.d.ts, 15, 58)) + + | string + | number + | Iterable +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) +>ReactNode : Symbol(ReactNode, Decl(index.d.ts, 6, 25)) + + | boolean + | null + | undefined; + type JSXElementConstructor

= (props: P) => ReactNode; +>JSXElementConstructor : Symbol(JSXElementConstructor, Decl(index.d.ts, 14, 16)) +>P : Symbol(P, Decl(index.d.ts, 15, 29)) +>props : Symbol(props, Decl(index.d.ts, 15, 35)) +>P : Symbol(P, Decl(index.d.ts, 15, 29)) +>ReactNode : Symbol(ReactNode, Decl(index.d.ts, 6, 25)) + + interface ReactElement< +>ReactElement : Symbol(ReactElement, Decl(index.d.ts, 15, 58)) + + P = any, +>P : Symbol(P, Decl(index.d.ts, 16, 25)) + + T extends string | JSXElementConstructor = +>T : Symbol(T, Decl(index.d.ts, 17, 12)) +>JSXElementConstructor : Symbol(JSXElementConstructor, Decl(index.d.ts, 14, 16)) + + | string + | JSXElementConstructor, +>JSXElementConstructor : Symbol(JSXElementConstructor, Decl(index.d.ts, 14, 16)) + + > { + type: T; +>type : Symbol(ReactElement.type, Decl(index.d.ts, 21, 5)) +>T : Symbol(T, Decl(index.d.ts, 17, 12)) + + props: P; +>props : Symbol(ReactElement.props, Decl(index.d.ts, 22, 12)) +>P : Symbol(P, Decl(index.d.ts, 16, 25)) + + key: string | null; +>key : Symbol(ReactElement.key, Decl(index.d.ts, 23, 13)) + } + + type ComponentProps> = +>ComponentProps : Symbol(ComponentProps, Decl(index.d.ts, 25, 3)) +>T : Symbol(T, Decl(index.d.ts, 27, 22)) +>JSXElementConstructor : Symbol(JSXElementConstructor, Decl(index.d.ts, 14, 16)) + + T extends JSXElementConstructor ? P : never; +>T : Symbol(T, Decl(index.d.ts, 27, 22)) +>JSXElementConstructor : Symbol(JSXElementConstructor, Decl(index.d.ts, 14, 16)) +>P : Symbol(P, Decl(index.d.ts, 28, 41)) +>P : Symbol(P, Decl(index.d.ts, 28, 41)) + + interface ExoticComponent

{ +>ExoticComponent : Symbol(ExoticComponent, Decl(index.d.ts, 28, 57)) +>P : Symbol(P, Decl(index.d.ts, 30, 28)) + + (props: P): ReactNode; +>props : Symbol(props, Decl(index.d.ts, 31, 5)) +>P : Symbol(P, Decl(index.d.ts, 30, 28)) +>ReactNode : Symbol(ReactNode, Decl(index.d.ts, 6, 25)) + + readonly $$typeof: symbol; +>$$typeof : Symbol(ExoticComponent.$$typeof, Decl(index.d.ts, 31, 26)) + } + + type LazyExoticComponent> = +>LazyExoticComponent : Symbol(LazyExoticComponent, Decl(index.d.ts, 33, 3)) +>T : Symbol(T, Decl(index.d.ts, 35, 27)) +>JSXElementConstructor : Symbol(JSXElementConstructor, Decl(index.d.ts, 14, 16)) + + ExoticComponent> & { +>ExoticComponent : Symbol(ExoticComponent, Decl(index.d.ts, 28, 57)) +>ComponentProps : Symbol(ComponentProps, Decl(index.d.ts, 25, 3)) +>T : Symbol(T, Decl(index.d.ts, 35, 27)) + + readonly _result: T; +>_result : Symbol(_result, Decl(index.d.ts, 36, 42)) +>T : Symbol(T, Decl(index.d.ts, 35, 27)) + + }; + + function createElement(): void; +>createElement : Symbol(createElement, Decl(index.d.ts, 38, 6)) + + namespace JSX { +>JSX : Symbol(JSX, Decl(index.d.ts, 40, 33)) + + interface Element extends GlobalJSXElement {} +>Element : Symbol(Element, Decl(index.d.ts, 42, 17)) +>GlobalJSXElement : Symbol(GlobalJSXElement, Decl(index.d.ts, 74, 1)) + + interface ElementChildrenAttribute +>ElementChildrenAttribute : Symbol(ElementChildrenAttribute, Decl(index.d.ts, 43, 49)) + + extends GlobalJSXElementChildrenAttribute {} +>GlobalJSXElementChildrenAttribute : Symbol(GlobalJSXElementChildrenAttribute, Decl(index.d.ts, 76, 49)) + + type LibraryManagedAttributes = GlobalJSXLibraryManagedAttributes< +>LibraryManagedAttributes : Symbol(LibraryManagedAttributes, Decl(index.d.ts, 45, 50)) +>C : Symbol(C, Decl(index.d.ts, 46, 34)) +>P : Symbol(P, Decl(index.d.ts, 46, 36)) +>GlobalJSXLibraryManagedAttributes : Symbol(GlobalJSXLibraryManagedAttributes, Decl(index.d.ts, 78, 41)) + + C, +>C : Symbol(C, Decl(index.d.ts, 46, 34)) + + P +>P : Symbol(P, Decl(index.d.ts, 46, 36)) + + >; + interface IntrinsicElements extends GlobalJSXIntrinsicElements {} +>IntrinsicElements : Symbol(IntrinsicElements, Decl(index.d.ts, 49, 6)) +>GlobalJSXIntrinsicElements : Symbol(GlobalJSXIntrinsicElements, Decl(index.d.ts, 82, 2)) + } +} + +type ReactManagedAttributes = C extends { defaultProps: infer D } +>ReactManagedAttributes : Symbol(ReactManagedAttributes, Decl(index.d.ts, 52, 1)) +>C : Symbol(C, Decl(index.d.ts, 54, 28)) +>P : Symbol(P, Decl(index.d.ts, 54, 30)) +>C : Symbol(C, Decl(index.d.ts, 54, 28)) +>defaultProps : Symbol(defaultProps, Decl(index.d.ts, 54, 47)) +>D : Symbol(D, Decl(index.d.ts, 54, 67)) + + ? P & D +>P : Symbol(P, Decl(index.d.ts, 54, 30)) +>D : Symbol(D, Decl(index.d.ts, 54, 67)) + + : P; +>P : Symbol(P, Decl(index.d.ts, 54, 30)) + +declare global { +>global : Symbol(global, Decl(index.d.ts, 56, 6)) + + namespace JSX { +>JSX : Symbol(JSX, Decl(index.d.ts, 58, 16)) + + interface Element extends React.ReactElement {} +>Element : Symbol(Element, Decl(index.d.ts, 59, 17)) +>React.ReactElement : Symbol(React.ReactElement, Decl(index.d.ts, 15, 58)) +>React : Symbol(React, Decl(index.d.ts, 4, 26)) +>ReactElement : Symbol(React.ReactElement, Decl(index.d.ts, 15, 58)) + + interface ElementChildrenAttribute { +>ElementChildrenAttribute : Symbol(ElementChildrenAttribute, Decl(index.d.ts, 60, 61)) + + children: {}; +>children : Symbol(ElementChildrenAttribute.children, Decl(index.d.ts, 61, 40)) + } + type LibraryManagedAttributes = C extends React.LazyExoticComponent< +>LibraryManagedAttributes : Symbol(LibraryManagedAttributes, Decl(index.d.ts, 63, 5)) +>C : Symbol(C, Decl(index.d.ts, 64, 34)) +>P : Symbol(P, Decl(index.d.ts, 64, 36)) +>C : Symbol(C, Decl(index.d.ts, 64, 34)) +>React : Symbol(React, Decl(index.d.ts, 4, 26)) +>LazyExoticComponent : Symbol(React.LazyExoticComponent, Decl(index.d.ts, 33, 3)) + + infer T +>T : Symbol(T, Decl(index.d.ts, 65, 11)) + + > + ? ReactManagedAttributes +>ReactManagedAttributes : Symbol(ReactManagedAttributes, Decl(index.d.ts, 52, 1)) +>T : Symbol(T, Decl(index.d.ts, 65, 11)) +>P : Symbol(P, Decl(index.d.ts, 64, 36)) + + : ReactManagedAttributes; +>ReactManagedAttributes : Symbol(ReactManagedAttributes, Decl(index.d.ts, 52, 1)) +>C : Symbol(C, Decl(index.d.ts, 64, 34)) +>P : Symbol(P, Decl(index.d.ts, 64, 36)) + + interface IntrinsicElements { +>IntrinsicElements : Symbol(IntrinsicElements, Decl(index.d.ts, 68, 37)) + + div: {}; +>div : Symbol(IntrinsicElements.div, Decl(index.d.ts, 69, 33)) + + span: {}; +>span : Symbol(IntrinsicElements.span, Decl(index.d.ts, 70, 14)) + } + } +} + +interface GlobalJSXElement extends JSX.Element {} +>GlobalJSXElement : Symbol(GlobalJSXElement, Decl(index.d.ts, 74, 1)) +>JSX.Element : Symbol(JSX.Element, Decl(index.d.ts, 59, 17)) +>JSX : Symbol(JSX, Decl(index.d.ts, 58, 16)) +>Element : Symbol(JSX.Element, Decl(index.d.ts, 59, 17)) + +interface GlobalJSXElementChildrenAttribute +>GlobalJSXElementChildrenAttribute : Symbol(GlobalJSXElementChildrenAttribute, Decl(index.d.ts, 76, 49)) + + extends JSX.ElementChildrenAttribute {} +>JSX.ElementChildrenAttribute : Symbol(JSX.ElementChildrenAttribute, Decl(index.d.ts, 60, 61)) +>JSX : Symbol(JSX, Decl(index.d.ts, 58, 16)) +>ElementChildrenAttribute : Symbol(JSX.ElementChildrenAttribute, Decl(index.d.ts, 60, 61)) + +type GlobalJSXLibraryManagedAttributes = JSX.LibraryManagedAttributes< +>GlobalJSXLibraryManagedAttributes : Symbol(GlobalJSXLibraryManagedAttributes, Decl(index.d.ts, 78, 41)) +>C : Symbol(C, Decl(index.d.ts, 79, 39)) +>P : Symbol(P, Decl(index.d.ts, 79, 41)) +>JSX : Symbol(JSX, Decl(index.d.ts, 58, 16)) +>LibraryManagedAttributes : Symbol(JSX.LibraryManagedAttributes, Decl(index.d.ts, 63, 5)) + + C, +>C : Symbol(C, Decl(index.d.ts, 79, 39)) + + P +>P : Symbol(P, Decl(index.d.ts, 79, 41)) + +>; +interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {} +>GlobalJSXIntrinsicElements : Symbol(GlobalJSXIntrinsicElements, Decl(index.d.ts, 82, 2)) +>JSX.IntrinsicElements : Symbol(JSX.IntrinsicElements, Decl(index.d.ts, 68, 37)) +>JSX : Symbol(JSX, Decl(index.d.ts, 58, 16)) +>IntrinsicElements : Symbol(JSX.IntrinsicElements, Decl(index.d.ts, 68, 37)) + +=== src/index.tsx === +import React from 'react' +>React : Symbol(React, Decl(index.tsx, 0, 6)) + +declare function upperFirst(str: T): Capitalize +>upperFirst : Symbol(upperFirst, Decl(index.tsx, 0, 25)) +>T : Symbol(T, Decl(index.tsx, 2, 28)) +>str : Symbol(str, Decl(index.tsx, 2, 46)) +>T : Symbol(T, Decl(index.tsx, 2, 28)) +>Capitalize : Symbol(Capitalize, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(index.tsx, 2, 28)) + +const displayEnum = (value: string) => upperFirst(value.toLowerCase()) +>displayEnum : Symbol(displayEnum, Decl(index.tsx, 4, 5)) +>value : Symbol(value, Decl(index.tsx, 4, 21)) +>upperFirst : Symbol(upperFirst, Decl(index.tsx, 0, 25)) +>value.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(index.tsx, 4, 21)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) + +function Comp() { +>Comp : Symbol(Comp, Decl(index.tsx, 4, 70)) + + return

+>div : Symbol(JSX.IntrinsicElements.div, Decl(index.d.ts, 69, 33)) + + Scope: {displayEnum("VALUE")} +>span : Symbol(JSX.IntrinsicElements.span, Decl(index.d.ts, 70, 14)) +>span : Symbol(JSX.IntrinsicElements.span, Decl(index.d.ts, 70, 14)) +>displayEnum : Symbol(displayEnum, Decl(index.tsx, 4, 5)) + +
+>div : Symbol(JSX.IntrinsicElements.div, Decl(index.d.ts, 69, 33)) +} + diff --git a/tests/baselines/reference/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.types b/tests/baselines/reference/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.types new file mode 100644 index 0000000000000..db99c94a2c91d --- /dev/null +++ b/tests/baselines/reference/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.types @@ -0,0 +1,175 @@ +//// [tests/cases/compiler/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.tsx] //// + +=== node_modules/@types/react/index.d.ts === +// https://github.com/microsoft/TypeScript/issues/56688 + + +export = React; +>React : typeof React + +export as namespace React; +>React : typeof React + +declare namespace React { +>React : typeof React + + type ReactNode = +>ReactNode : string | number | boolean | ReactElement> | Iterable | null | undefined + + | ReactElement + | string + | number + | Iterable + | boolean + | null + | undefined; + type JSXElementConstructor

= (props: P) => ReactNode; +>JSXElementConstructor : JSXElementConstructor

+>props : P + + interface ReactElement< + P = any, + T extends string | JSXElementConstructor = + | string + | JSXElementConstructor, + > { + type: T; +>type : T + + props: P; +>props : P + + key: string | null; +>key : string | null + } + + type ComponentProps> = +>ComponentProps : ComponentProps + + T extends JSXElementConstructor ? P : never; + + interface ExoticComponent

{ + (props: P): ReactNode; +>props : P + + readonly $$typeof: symbol; +>$$typeof : symbol + } + + type LazyExoticComponent> = +>LazyExoticComponent : LazyExoticComponent + + ExoticComponent> & { + readonly _result: T; +>_result : T + + }; + + function createElement(): void; +>createElement : () => void + + namespace JSX { + interface Element extends GlobalJSXElement {} + interface ElementChildrenAttribute + extends GlobalJSXElementChildrenAttribute {} + type LibraryManagedAttributes = GlobalJSXLibraryManagedAttributes< +>LibraryManagedAttributes : LibraryManagedAttributes + + C, + P + >; + interface IntrinsicElements extends GlobalJSXIntrinsicElements {} + } +} + +type ReactManagedAttributes = C extends { defaultProps: infer D } +>ReactManagedAttributes : ReactManagedAttributes +>defaultProps : D + + ? P & D + : P; + +declare global { +>global : any + + namespace JSX { + interface Element extends React.ReactElement {} +>React : typeof React + + interface ElementChildrenAttribute { + children: {}; +>children : {} + } + type LibraryManagedAttributes = C extends React.LazyExoticComponent< +>LibraryManagedAttributes : LibraryManagedAttributes +>React : any + + infer T + > + ? ReactManagedAttributes + : ReactManagedAttributes; + interface IntrinsicElements { + div: {}; +>div : {} + + span: {}; +>span : {} + } + } +} + +interface GlobalJSXElement extends JSX.Element {} +>JSX : any + +interface GlobalJSXElementChildrenAttribute + extends JSX.ElementChildrenAttribute {} +>JSX : any + +type GlobalJSXLibraryManagedAttributes = JSX.LibraryManagedAttributes< +>GlobalJSXLibraryManagedAttributes : GlobalJSXLibraryManagedAttributes +>JSX : any + + C, + P +>; +interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {} +>JSX : any + +=== src/index.tsx === +import React from 'react' +>React : typeof React + +declare function upperFirst(str: T): Capitalize +>upperFirst : (str: T) => Capitalize +>str : T + +const displayEnum = (value: string) => upperFirst(value.toLowerCase()) +>displayEnum : (value: string) => Capitalize +>(value: string) => upperFirst(value.toLowerCase()) : (value: string) => Capitalize +>value : string +>upperFirst(value.toLowerCase()) : Capitalize +>upperFirst : (str: T) => Capitalize +>value.toLowerCase() : string +>value.toLowerCase : () => string +>value : string +>toLowerCase : () => string + +function Comp() { +>Comp : () => React.JSX.Element + + return

+>
Scope: {displayEnum("VALUE")}
: React.JSX.Element +>div : any + + Scope: {displayEnum("VALUE")} +>Scope: : React.JSX.Element +>span : any +>span : any +>displayEnum("VALUE") : Capitalize +>displayEnum : (value: string) => Capitalize +>"VALUE" : "VALUE" + +
+>div : any +} + diff --git a/tests/baselines/reference/uniqueSymbolJs.errors.txt b/tests/baselines/reference/uniqueSymbolJs.errors.txt new file mode 100644 index 0000000000000..3304772c07596 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolJs.errors.txt @@ -0,0 +1,15 @@ +a.js(5,18): error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead. +a.js(5,28): error TS1005: ';' expected. + + +==== ./a.js (2 errors) ==== + /** @type {unique symbol} */ + const foo = Symbol(); + + /** @typedef {{ [foo]: boolean }} A */ + /** @typedef {{ [key: foo] boolean }} B */ + ~~~ +!!! error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead. + ~~~~~~~ +!!! error TS1005: ';' expected. + \ No newline at end of file diff --git a/tests/baselines/reference/uniqueSymbolJs.symbols b/tests/baselines/reference/uniqueSymbolJs.symbols new file mode 100644 index 0000000000000..89f44c0c8e31a --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolJs.symbols @@ -0,0 +1,11 @@ +//// [tests/cases/compiler/uniqueSymbolJs.ts] //// + +=== ./a.js === +/** @type {unique symbol} */ +const foo = Symbol(); +>foo : Symbol(foo, Decl(a.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) + +/** @typedef {{ [foo]: boolean }} A */ +/** @typedef {{ [key: foo] boolean }} B */ + diff --git a/tests/baselines/reference/uniqueSymbolJs.types b/tests/baselines/reference/uniqueSymbolJs.types new file mode 100644 index 0000000000000..0d36ae028a1b8 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolJs.types @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/uniqueSymbolJs.ts] //// + +=== ./a.js === +/** @type {unique symbol} */ +const foo = Symbol(); +>foo : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +/** @typedef {{ [foo]: boolean }} A */ +/** @typedef {{ [key: foo] boolean }} B */ + diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.types b/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.types index 9b449b0321f77..e812b448aae7a 100644 --- a/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.types +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsInJs.types @@ -18,14 +18,14 @@ class C { * @readonly */ static readonlyStaticType; ->readonlyStaticType : symbol +>readonlyStaticType : unique symbol /** * @type {unique symbol} * @readonly */ static readonlyStaticTypeAndCall = Symbol(); ->readonlyStaticTypeAndCall : symbol +>readonlyStaticTypeAndCall : unique symbol >Symbol() : unique symbol >Symbol : SymbolConstructor @@ -50,7 +50,7 @@ class C { /** @type {unique symbol} */ const a = Symbol(); ->a : symbol +>a : unique symbol >Symbol() : unique symbol >Symbol : SymbolConstructor diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.types b/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.types index b3827f6afa870..94045cdeb1dca 100644 --- a/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.types +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsInJsErrors.types @@ -15,7 +15,7 @@ class C { * @readonly */ static readonlyType; ->readonlyType : symbol +>readonlyType : unique symbol /** * @type {unique symbol} diff --git a/tests/baselines/reference/varianceReferences.errors.txt b/tests/baselines/reference/varianceReferences.errors.txt new file mode 100644 index 0000000000000..25d23697fba79 --- /dev/null +++ b/tests/baselines/reference/varianceReferences.errors.txt @@ -0,0 +1,42 @@ +varianceReferences.ts(3,32): error TS2637: Variance annotations are only supported in type aliases for object, function, constructor, and mapped types. +varianceReferences.ts(8,28): error TS2637: Variance annotations are only supported in type aliases for object, function, constructor, and mapped types. +varianceReferences.ts(14,32): error TS2637: Variance annotations are only supported in type aliases for object, function, constructor, and mapped types. + + +==== varianceReferences.ts (3 errors) ==== + type NumericConstraint = Value; + + type VarianceConstrainedNumber = + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2637: Variance annotations are only supported in type aliases for object, function, constructor, and mapped types. + NumericConstraint; + + type Unconstrained = Value; + + type VarianceUnconstrained = Unconstrained; + ~~~~~~~~~~~~ +!!! error TS2637: Variance annotations are only supported in type aliases for object, function, constructor, and mapped types. + + type Level3of3Unconstrained = Value; + type Level2of3Unconstrained = Level3of3Unconstrained; + type Level1of3Unconstrained = Level2of3Unconstrained; + + type VarianceDeepUnconstrained = Level1of3Unconstrained; + ~~~~~~~~~~~~ +!!! error TS2637: Variance annotations are only supported in type aliases for object, function, constructor, and mapped types. + + interface Shape { + value: Value; + } + + type VarianceShape = Shape; + + interface Level3of3Shape { + value: Value; + } + + type Level2of3Shape = Level3of3Shape; + type Level1of3Shape = Level2of3Shape; + + type VarianceDeepShape = Level1of3Shape; + \ No newline at end of file diff --git a/tests/baselines/reference/varianceReferences.js b/tests/baselines/reference/varianceReferences.js new file mode 100644 index 0000000000000..12d717da01a50 --- /dev/null +++ b/tests/baselines/reference/varianceReferences.js @@ -0,0 +1,35 @@ +//// [tests/cases/compiler/varianceReferences.ts] //// + +//// [varianceReferences.ts] +type NumericConstraint = Value; + +type VarianceConstrainedNumber = + NumericConstraint; + +type Unconstrained = Value; + +type VarianceUnconstrained = Unconstrained; + +type Level3of3Unconstrained = Value; +type Level2of3Unconstrained = Level3of3Unconstrained; +type Level1of3Unconstrained = Level2of3Unconstrained; + +type VarianceDeepUnconstrained = Level1of3Unconstrained; + +interface Shape { + value: Value; +} + +type VarianceShape = Shape; + +interface Level3of3Shape { + value: Value; +} + +type Level2of3Shape = Level3of3Shape; +type Level1of3Shape = Level2of3Shape; + +type VarianceDeepShape = Level1of3Shape; + + +//// [varianceReferences.js] diff --git a/tests/baselines/reference/varianceReferences.symbols b/tests/baselines/reference/varianceReferences.symbols new file mode 100644 index 0000000000000..275f3193bf3cc --- /dev/null +++ b/tests/baselines/reference/varianceReferences.symbols @@ -0,0 +1,92 @@ +//// [tests/cases/compiler/varianceReferences.ts] //// + +=== varianceReferences.ts === +type NumericConstraint = Value; +>NumericConstraint : Symbol(NumericConstraint, Decl(varianceReferences.ts, 0, 0)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 0, 23)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 0, 23)) + +type VarianceConstrainedNumber = +>VarianceConstrainedNumber : Symbol(VarianceConstrainedNumber, Decl(varianceReferences.ts, 0, 53)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 2, 31)) + + NumericConstraint; +>NumericConstraint : Symbol(NumericConstraint, Decl(varianceReferences.ts, 0, 0)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 2, 31)) + +type Unconstrained = Value; +>Unconstrained : Symbol(Unconstrained, Decl(varianceReferences.ts, 3, 27)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 5, 19)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 5, 19)) + +type VarianceUnconstrained = Unconstrained; +>VarianceUnconstrained : Symbol(VarianceUnconstrained, Decl(varianceReferences.ts, 5, 34)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 7, 27)) +>Unconstrained : Symbol(Unconstrained, Decl(varianceReferences.ts, 3, 27)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 7, 27)) + +type Level3of3Unconstrained = Value; +>Level3of3Unconstrained : Symbol(Level3of3Unconstrained, Decl(varianceReferences.ts, 7, 64)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 9, 28)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 9, 28)) + +type Level2of3Unconstrained = Level3of3Unconstrained; +>Level2of3Unconstrained : Symbol(Level2of3Unconstrained, Decl(varianceReferences.ts, 9, 43)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 10, 28)) +>Level3of3Unconstrained : Symbol(Level3of3Unconstrained, Decl(varianceReferences.ts, 7, 64)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 10, 28)) + +type Level1of3Unconstrained = Level2of3Unconstrained; +>Level1of3Unconstrained : Symbol(Level1of3Unconstrained, Decl(varianceReferences.ts, 10, 67)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 11, 28)) +>Level2of3Unconstrained : Symbol(Level2of3Unconstrained, Decl(varianceReferences.ts, 9, 43)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 11, 28)) + +type VarianceDeepUnconstrained = Level1of3Unconstrained; +>VarianceDeepUnconstrained : Symbol(VarianceDeepUnconstrained, Decl(varianceReferences.ts, 11, 67)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 13, 31)) +>Level1of3Unconstrained : Symbol(Level1of3Unconstrained, Decl(varianceReferences.ts, 10, 67)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 13, 31)) + +interface Shape { +>Shape : Symbol(Shape, Decl(varianceReferences.ts, 13, 77)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 15, 16)) + + value: Value; +>value : Symbol(Shape.value, Decl(varianceReferences.ts, 15, 24)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 15, 16)) +} + +type VarianceShape = Shape; +>VarianceShape : Symbol(VarianceShape, Decl(varianceReferences.ts, 17, 1)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 19, 19)) +>Shape : Symbol(Shape, Decl(varianceReferences.ts, 13, 77)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 19, 19)) + +interface Level3of3Shape { +>Level3of3Shape : Symbol(Level3of3Shape, Decl(varianceReferences.ts, 19, 48)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 21, 25)) + + value: Value; +>value : Symbol(Level3of3Shape.value, Decl(varianceReferences.ts, 21, 33)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 21, 25)) +} + +type Level2of3Shape = Level3of3Shape; +>Level2of3Shape : Symbol(Level2of3Shape, Decl(varianceReferences.ts, 23, 1)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 25, 20)) +>Level3of3Shape : Symbol(Level3of3Shape, Decl(varianceReferences.ts, 19, 48)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 25, 20)) + +type Level1of3Shape = Level2of3Shape; +>Level1of3Shape : Symbol(Level1of3Shape, Decl(varianceReferences.ts, 25, 51)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 26, 20)) +>Level2of3Shape : Symbol(Level2of3Shape, Decl(varianceReferences.ts, 23, 1)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 26, 20)) + +type VarianceDeepShape = Level1of3Shape; +>VarianceDeepShape : Symbol(VarianceDeepShape, Decl(varianceReferences.ts, 26, 51)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 28, 23)) +>Level1of3Shape : Symbol(Level1of3Shape, Decl(varianceReferences.ts, 25, 51)) +>Value : Symbol(Value, Decl(varianceReferences.ts, 28, 23)) + diff --git a/tests/baselines/reference/varianceReferences.types b/tests/baselines/reference/varianceReferences.types new file mode 100644 index 0000000000000..5ecc8436aa686 --- /dev/null +++ b/tests/baselines/reference/varianceReferences.types @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/varianceReferences.ts] //// + +=== varianceReferences.ts === +type NumericConstraint = Value; +>NumericConstraint : Value + +type VarianceConstrainedNumber = +>VarianceConstrainedNumber : Value + + NumericConstraint; + +type Unconstrained = Value; +>Unconstrained : Value + +type VarianceUnconstrained = Unconstrained; +>VarianceUnconstrained : Value + +type Level3of3Unconstrained = Value; +>Level3of3Unconstrained : Value + +type Level2of3Unconstrained = Level3of3Unconstrained; +>Level2of3Unconstrained : Value + +type Level1of3Unconstrained = Level2of3Unconstrained; +>Level1of3Unconstrained : Value + +type VarianceDeepUnconstrained = Level1of3Unconstrained; +>VarianceDeepUnconstrained : Value + +interface Shape { + value: Value; +>value : Value +} + +type VarianceShape = Shape; +>VarianceShape : VarianceShape + +interface Level3of3Shape { + value: Value; +>value : Value +} + +type Level2of3Shape = Level3of3Shape; +>Level2of3Shape : Level2of3Shape + +type Level1of3Shape = Level2of3Shape; +>Level1of3Shape : Level1of3Shape + +type VarianceDeepShape = Level1of3Shape; +>VarianceDeepShape : VarianceDeepShape + diff --git a/tests/cases/compiler/allowJsCrossMonorepoPackage.ts b/tests/cases/compiler/allowJsCrossMonorepoPackage.ts new file mode 100644 index 0000000000000..2af955d311deb --- /dev/null +++ b/tests/cases/compiler/allowJsCrossMonorepoPackage.ts @@ -0,0 +1,44 @@ +// @Filename: /node_modules/pkg/index.d.ts +export declare function pkg(): "pkg"; + +// @Filename: /packages/shared/package.json +{ + "name": "shared", + "version": "1.0.0", + "type": "module", + "exports": "./index.js" +} + +// @Filename: /packages/shared/utils.js +export { pkg } from "pkg"; + +// @Filename: /packages/shared/index.js +import { pkg } from "./utils.js"; +export const x = pkg(); + +// @Filename: /packages/main/package.json +{ + "name": "main", + "version": "1.0.0", + "type": "module", + "dependencies": { + "shared": "workspace:*" + } +} + +// @Filename: /packages/main/tsconfig.json +{ + "compilerOptions": { + "noEmit": true, + "checkJs": true, + "strict": true, + "module": "esnext", + "moduleResolution": "bundler", + "traceResolution": true, + } +} + +// @link: /packages/shared -> /packages/main/node_modules/shared + +// @Filename: /packages/main/index.ts +import { x } from "shared"; diff --git a/tests/cases/compiler/commentEmitOnParenthesizedAssertionInReturnStatement.ts b/tests/cases/compiler/commentEmitOnParenthesizedAssertionInReturnStatement.ts new file mode 100644 index 0000000000000..042c639812a99 --- /dev/null +++ b/tests/cases/compiler/commentEmitOnParenthesizedAssertionInReturnStatement.ts @@ -0,0 +1,17 @@ +// @strict: true +// @lib: esnext +// @target: esnext +// @removeComments: false + +export class Foo { + client = { + getThing: () => Promise.resolve('') + } + + foo(): Promise { + return ( + /* TODO: Avoid using type assertions, please refactor. */ this.client + .getThing() as unknown as Promise + ); + } +} diff --git a/tests/cases/compiler/controlFlowAliasedDiscriminants.ts b/tests/cases/compiler/controlFlowAliasedDiscriminants.ts index 53e7bdd8bd352..b177724568278 100644 --- a/tests/cases/compiler/controlFlowAliasedDiscriminants.ts +++ b/tests/cases/compiler/controlFlowAliasedDiscriminants.ts @@ -1,5 +1,4 @@ -// @strictNullChecks: true -// @noImplicitAny: true +// @strict: true type UseQueryResult = { isSuccess: false; @@ -104,3 +103,13 @@ type Nested = { resp.resp.data satisfies string; } } + +function bindingPatternInParameter({ data: data1, isSuccess: isSuccess1 }: UseQueryResult) { + const { data: data2, isSuccess: isSuccess2 } = useQuery(); + + const areSuccess = isSuccess1 && isSuccess2; + if (areSuccess) { + data1.toExponential(); + data2.toExponential(); + } +} diff --git a/tests/cases/compiler/declarationEmitBindingPatternsUnused.ts b/tests/cases/compiler/declarationEmitBindingPatternsUnused.ts new file mode 100644 index 0000000000000..285292e8d4819 --- /dev/null +++ b/tests/cases/compiler/declarationEmitBindingPatternsUnused.ts @@ -0,0 +1,115 @@ +// @declaration: true +// @target: esnext +// @skipLibCheck: false + +type Named = { name: string } +function notReferenced({ name: alias }: Named) { + +} +function notReferencedNestedAlias({ p: { name: alias } }: { p: Named }) { +} +function notReferencedArrayAlias([a, b, { name: alias }]: Named[]) { +} + + + +function referencedInCode({ name: alias }: Named) { + return alias; +} + +function referencedInSignarture({ name: alias }: Named): typeof alias { + return alias; +} + +function referencedInSignartureKeyword({ function: alias }: { function: string }): typeof alias { + return null!; +} + +function referencedInInferredType({ name: alias }: Named) { + type Named2 = { name: typeof alias } + return null! as Named2 +} + +function referencedInNestedFunction({ name: alias }: Named) { + return function(p: typeof alias) { + + } +} + +function referencedNestedAlias({ p: { name: alias } }: { p: Named }): typeof alias { + return alias; +} + +function referencedArrayAlias([a, b, { name: alias }]: Named[]): typeof alias { + return alias; +} + + +class NotReferencedClass { + constructor({ name: alias }: Named) { + } + set x({ name: alias }: Named) { + console.log(alias); + } + m({ name: alias }: Named) { + console.log(alias); + } +} + +class ReferencedInCodeClas { + constructor({ name: alias }: Named) { + console.log(alias); + } + set x({ name: alias }: Named) { + console.log(alias); + } + m({ name: alias }: Named) { + console.log(alias); + } +} + +class ReferencedInSignartureClass { + constructor({ name: alias }: Named, p: typeof alias) { + console.log(alias); + } + set x({ name: alias }: Named & { o: typeof alias }) { + + } + mReturnType({ name: alias }: Named): typeof alias { + return null! + } + mRerturnTypeNested({ name: alias }: Named): NonNullable { + return null! + } + mParameter({ name: alias }: Named, p: typeof alias) { + return null! + } +} + +let notReferencedFnType: ({ name: alias }: Named) => void; +let referencedInSignartureReturnTypeFnType: ({ name: alias }: Named) => typeof alias; +let referencedInSignartureParamTypeFnType: ({ name: alias }: Named, p: typeof alias) => void; + +let notReferencedCtorType: new ({ name: alias }: Named) => void; +let referencedInSignartureReturnTypeCtorType: new ({ name: alias }: Named) => typeof alias; +let referencedInSignartureParamTypeCtorType: new ({ name: alias }: Named, p: typeof alias) => void; + + +interface NotReferencedInterface { + ({ name: alias }: Named): void + new ({ name: alias }: Named): void + set x({ name: alias }: Named); + m({ name: alias }: Named); +} + +interface ReferencedInSignartureInterface { + ({ name: alias }: Named, p: typeof alias): void + ({ name: alias }: Named): typeof alias + + new ({ name: alias }: Named, p: typeof alias): void + new ({ name: alias }: Named): typeof alias + set x({ name: alias }: Named & { o: typeof alias }) + mReturnType({ name: alias }: Named): typeof alias; + mRerturnTypeNested({ name: alias }: Named): NonNullable; + mParameter({ name: alias }: Named, p: typeof alias); +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmitJsReExportDefault.ts b/tests/cases/compiler/declarationEmitJsReExportDefault.ts new file mode 100644 index 0000000000000..0d05fc45d6051 --- /dev/null +++ b/tests/cases/compiler/declarationEmitJsReExportDefault.ts @@ -0,0 +1,18 @@ +// @noTypesAndSymbols: true + +// @filename: /node_modules/a/package.json +{"name": "a", "version": "0.0.0"} +// @filename: /node_modules/a/index.d.ts +export const a = 123; + +// @filename: /tsconfig.json +{ + "compilerOptions": { + "module": "node16", + "declaration": true, + "emitDeclarationOnly": true, + "checkJs": true, + } +} +// @filename: /index.mjs +export {default as mod} from 'a'; diff --git a/tests/cases/compiler/declarationEmitNestedAnonymousMappedType.ts b/tests/cases/compiler/declarationEmitNestedAnonymousMappedType.ts new file mode 100644 index 0000000000000..29db810629b13 --- /dev/null +++ b/tests/cases/compiler/declarationEmitNestedAnonymousMappedType.ts @@ -0,0 +1,10 @@ +// @declaration: true +export function enumFromStrings() { + type Part1 = { + [key in keyof Members as Members[key] extends string + ? Members[key] + : never]: Members[key]; + }; + type Part2 = { [Property in keyof Part1]: Part1[Property] }; + return Object.create(null) as Part2; +} diff --git a/tests/cases/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.ts b/tests/cases/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.ts new file mode 100644 index 0000000000000..bb903da3c3907 --- /dev/null +++ b/tests/cases/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.ts @@ -0,0 +1,24 @@ +// @declaration: true +// @emitDeclarationOnly: true +// @noTypesAndSymbols: true +// @module: nodenext + +// @Filename: /node_modules/foo/index.d.ts +declare module "foo" { + export interface Original {} +} + +// @Filename: /augmentation.ts +export interface FooOptions {} +declare module "foo" { + export interface Augmentation {} +} + +// @Filename: /index.ts +import { Original, Augmentation } from "foo"; +import type { FooOptions } from "./augmentation"; +export interface _ { + original: Original; + augmentation: Augmentation; + options: FooOptions; +} diff --git a/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts b/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts new file mode 100644 index 0000000000000..e497819e07e38 --- /dev/null +++ b/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts @@ -0,0 +1,239 @@ +// @strict: true +// @declaration: true +// @module: nodenext +// @moduleResolution: nodenext +// @target: esnext + +// @filename: node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts +type QueryKey = ReadonlyArray; + +interface Register {} + +type DefaultError = Register extends { + defaultError: infer TError; +} + ? TError + : Error; + +type ShouldRetryFunction = ( + failureCount: number, + error: TError, +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; + +type QueryFunctionContext< + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; + } + : { + queryKey: TQueryKey; + pageParam: TPageParam; + }; + +type QueryFunction< + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; + queryFn?: QueryFunction; + queryKey?: TQueryKey; + initialData?: TData; + initialDataUpdatedAt?: number | (() => number | undefined); +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; + refetchInterval?: number; + select?: (data: TQueryData) => TData; +} + +type UseQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +}; + +interface QueryObserverBaseResult { + data: TData | undefined; + dataUpdatedAt: number; + error: TError | null; + errorUpdatedAt: number; + failureCount: number; + failureReason: TError | null; + errorUpdateCount: number; + isError: boolean; + isFetched: boolean; + isFetchedAfterMount: boolean; + isFetching: boolean; + isLoading: boolean; + isPending: boolean; + isLoadingError: boolean; + isInitialLoading: boolean; + isPaused: boolean; + isPlaceholderData: boolean; + isRefetchError: boolean; + isRefetching: boolean; + isStale: boolean; + isSuccess: boolean; +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + status: "success"; +} + +type DefinedQueryObserverResult< + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { + value: T; +}; + +type UseBaseQueryReturnType< + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +}; + +type UseQueryReturnType = UseBaseQueryReturnType; + +declare function useQuery< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +): UseQueryReturnType; + +export { type UseQueryReturnType, useQuery }; + +// @filename: node_modules/@tanstack/vue-query/build/modern/index.d.ts +export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; + +// @filename: node_modules/@tanstack/vue-query/package.json +{ + "name": "@tanstack/vue-query", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./build/modern/index.d.ts", + "default": "./build/modern/index.js" + }, + "require": { + "types": "./build/modern/index.d.cts", + "default": "./build/modern/index.cjs" + } + } + } +} + +// @filename: src/index.mts +import { useQuery } from '@tanstack/vue-query' + +const baseUrl = 'https://api.publicapis.org/' + +interface IEntry { + API: string + Description: string + Auth: string + HTTPS: boolean + Cors: string + Link: string + Category: string +} + +const testApi = { + getEntries: (): Promise => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)) + } +} + +const entryKeys = { + all: ['entries'] as const, + list: () => [...entryKeys.all, 'list'] as const +} + +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }) +} diff --git a/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts b/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts new file mode 100644 index 0000000000000..7d29e551f5157 --- /dev/null +++ b/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts @@ -0,0 +1,239 @@ +// @strict: true +// @declaration: true +// @module: nodenext +// @moduleResolution: nodenext +// @target: esnext + +// @filename: node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts +type QueryKey = ReadonlyArray; + +interface Register {} + +type DefaultError = Register extends { + defaultError: infer TError; +} + ? TError + : Error; + +type ShouldRetryFunction = ( + failureCount: number, + error: TError, +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; + +type QueryFunctionContext< + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; + } + : { + queryKey: TQueryKey; + pageParam: TPageParam; + }; + +type QueryFunction< + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; + queryFn?: QueryFunction; + queryKey?: TQueryKey; + initialData?: TData; + initialDataUpdatedAt?: number | (() => number | undefined); +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; + refetchInterval?: number; + select?: (data: TQueryData) => TData; +} + +type UseQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +}; + +interface QueryObserverBaseResult { + data: TData | undefined; + dataUpdatedAt: number; + error: TError | null; + errorUpdatedAt: number; + failureCount: number; + failureReason: TError | null; + errorUpdateCount: number; + isError: boolean; + isFetched: boolean; + isFetchedAfterMount: boolean; + isFetching: boolean; + isLoading: boolean; + isPending: boolean; + isLoadingError: boolean; + isInitialLoading: boolean; + isPaused: boolean; + isPlaceholderData: boolean; + isRefetchError: boolean; + isRefetching: boolean; + isStale: boolean; + isSuccess: boolean; +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + status: "success"; +} + +type DefinedQueryObserverResult< + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { + value: T; +}; + +type UseBaseQueryReturnType< + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +}; + +type UseQueryReturnType = UseBaseQueryReturnType; + +declare function useQuery< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +): UseQueryReturnType; + +export { type UseQueryReturnType as b, useQuery as u }; + +// @filename: node_modules/@tanstack/vue-query/build/modern/index.d.ts +export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; + +// @filename: node_modules/@tanstack/vue-query/package.json +{ + "name": "@tanstack/vue-query", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./build/modern/index.d.ts", + "default": "./build/modern/index.js" + }, + "require": { + "types": "./build/modern/index.d.cts", + "default": "./build/modern/index.cjs" + } + } + } +} + +// @filename: src/index.mts +import { useQuery } from '@tanstack/vue-query' + +const baseUrl = 'https://api.publicapis.org/' + +interface IEntry { + API: string + Description: string + Auth: string + HTTPS: boolean + Cors: string + Link: string + Category: string +} + +const testApi = { + getEntries: (): Promise => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)) + } +} + +const entryKeys = { + all: ['entries'] as const, + list: () => [...entryKeys.all, 'list'] as const +} + +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }) +} diff --git a/tests/cases/compiler/declarationEmitUsingTypeAlias1.ts b/tests/cases/compiler/declarationEmitUsingTypeAlias1.ts new file mode 100644 index 0000000000000..257a82e3e32bc --- /dev/null +++ b/tests/cases/compiler/declarationEmitUsingTypeAlias1.ts @@ -0,0 +1,30 @@ +// @strict: true +// @declaration: true +// @module: nodenext + +// @filename: node_modules/some-dep/dist/inner.d.ts +export declare type Other = { other: string }; +export declare type SomeType = { arg: Other }; + +// @filename: node_modules/some-dep/dist/index.d.ts +export type OtherType = import('./inner').Other; +export type SomeType = import('./inner').SomeType; + +// @filename: node_modules/some-dep/package.json +{ + "name": "some-dep", + "exports": { + ".": "./dist/index.js" + } +} + +// @filename: src/index.ts +import { SomeType } from "some-dep"; + +export const foo = (thing: SomeType) => { + return thing; +}; + +export const bar = (thing: SomeType) => { + return thing.arg; +}; \ No newline at end of file diff --git a/tests/cases/compiler/deferredConditionalTypes2.ts b/tests/cases/compiler/deferredConditionalTypes2.ts new file mode 100644 index 0000000000000..e1f4f57a2673b --- /dev/null +++ b/tests/cases/compiler/deferredConditionalTypes2.ts @@ -0,0 +1,38 @@ +// @strict: true +// @noEmit: true + +// https://github.com/microsoft/TypeScript/issues/56270 + +type PositiveInfinity = 1e999; +type NegativeInfinity = -1e999; + +export type IsEqual = (() => G extends A ? 1 : 2) extends < + G, +>() => G extends B ? 1 : 2 + ? true + : false; + +export type Add
= [ + IsEqual, + IsEqual, + IsEqual, + IsEqual, +] extends infer R extends [boolean, boolean, boolean, boolean] + ? [true, false] extends ([R[0], R[3]]) + ? PositiveInfinity + : "failed" + : never; + +export type AddWithoutParentheses = [ + IsEqual, + IsEqual, + IsEqual, + IsEqual, +] extends infer R extends [boolean, boolean, boolean, boolean] + ? [true, false] extends [R[0], R[3]] + ? PositiveInfinity + : "failed" + : never; + +type AddTest0 = Add; +type AddTest1 = AddWithoutParentheses; diff --git a/tests/cases/compiler/enumAssignmentCompat3.ts b/tests/cases/compiler/enumAssignmentCompat3.ts index 97a136468e3ee..a706be4ce2176 100644 --- a/tests/cases/compiler/enumAssignmentCompat3.ts +++ b/tests/cases/compiler/enumAssignmentCompat3.ts @@ -69,13 +69,13 @@ abc = secondAbcd; // missing 'd' abc = secondAb; // ok abc = secondCd; // missing 'd' abc = nope; // nope! -abc = decl; // ok +abc = decl; // bad - value of 'c' differs between these enums secondAbc = abc; // ok secondAbcd = abc; // ok secondAb = abc; // missing 'c' secondCd = abc; // missing 'a' and 'b' nope = abc; // nope! -decl = abc; // ok +decl = abc; // bad - value of 'c' differs between these enums // const is only assignable to itself k = k; @@ -84,6 +84,6 @@ k = abc; // merged enums compare all their members abc = merged; // missing 'd' -merged = abc; // ok +merged = abc; // bad - value of 'c' differs between these enums abc = merged2; // ok merged2 = abc; // ok \ No newline at end of file diff --git a/tests/cases/compiler/enumAssignmentCompat6.ts b/tests/cases/compiler/enumAssignmentCompat6.ts new file mode 100644 index 0000000000000..b91300d37c537 --- /dev/null +++ b/tests/cases/compiler/enumAssignmentCompat6.ts @@ -0,0 +1,77 @@ +// @filename a.ts +namespace numerics { + export enum DiagnosticCategory { + Warning, + Error, + Suggestion, + Message, + } + + export enum DiagnosticCategory2 { + Warning, + Error, + Suggestion, + Message, + } +} + +namespace strings { + export enum DiagnosticCategory { + Warning = "Warning", + Error = "Error", + Suggestion = "Suggestion", + Message = "Message", + } +} + +declare namespace ambients { + export enum DiagnosticCategory { + Warning, + Error, + Suggestion, + Message, + } +} + +function f(x: numerics.DiagnosticCategory, y: strings.DiagnosticCategory) { + x = y; + y = x; +} + +function g(x: numerics.DiagnosticCategory2, y: strings.DiagnosticCategory) { + x = y; + y = x; +} + +function h(x: numerics.DiagnosticCategory, y: ambients.DiagnosticCategory) { + x = y; + y = x; +} + +function i(x: strings.DiagnosticCategory, y: ambients.DiagnosticCategory) { + x = y; + y = x; +} + +// @filename: f.ts +export enum DiagnosticCategory { + Warning, + Error, + Suggestion, + Message, +} + +export let x: DiagnosticCategory; + +(() => { + enum DiagnosticCategory { + Warning = "Warning", + Error = "Error", + Suggestion = "Suggestion", + Message = "Message", + } + function f(y: DiagnosticCategory) { + x = y; + y = x; + } +})() \ No newline at end of file diff --git a/tests/cases/compiler/enumAssignmentCompat7.ts b/tests/cases/compiler/enumAssignmentCompat7.ts new file mode 100644 index 0000000000000..179f7d844dbfb --- /dev/null +++ b/tests/cases/compiler/enumAssignmentCompat7.ts @@ -0,0 +1,26 @@ +// @strict: true +// @strictFunctionTypes: false + +namespace first { + export enum E { A = 1 } +} + +namespace second { + export enum E { A = 2 } +} + +class Base { + method(param: first.E) { + + } +} + +class Derived extends Base { + override method(param: second.E) { + } +} + +function overloadingFunction(): first.E +function overloadingFunction(): second.E { + return second.E.B +} \ No newline at end of file diff --git a/tests/cases/compiler/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts b/tests/cases/compiler/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts new file mode 100644 index 0000000000000..e3e880dd4ae14 --- /dev/null +++ b/tests/cases/compiler/homomorphicMappedTypeWithNonHomomorphicInstantiationSpreadable1.ts @@ -0,0 +1,42 @@ +// @strict: true +// @noEmit: true + +type HandleOptions = { + [I in keyof O]: { + value: O[I]; + }; +}; + +declare function func1< + T extends Record, +>(fields: { + [K in keyof T]: { + label: string; + options: [...HandleOptions]; + }; +}): T; + +const result = func1({ + prop: { + label: "first", + options: [ + { + value: 123, + }, + { + value: "foo", + }, + ], + }, + other: { + label: "second", + options: [ + { + value: "bar", + }, + { + value: true, + }, + ], + }, +}); \ No newline at end of file diff --git a/tests/cases/compiler/implicitConstParameters.ts b/tests/cases/compiler/implicitConstParameters.ts index 97996789124f6..f5c2cd5e79828 100644 --- a/tests/cases/compiler/implicitConstParameters.ts +++ b/tests/cases/compiler/implicitConstParameters.ts @@ -35,7 +35,7 @@ function f3(x: string | undefined) { } function f4(x: string | undefined) { - x = "abc"; // causes x to be considered non-const + x = "abc"; if (x) { doSomething(() => x.length); } diff --git a/tests/cases/compiler/isolatedModulesShadowGlobalTypeNotValue.ts b/tests/cases/compiler/isolatedModulesShadowGlobalTypeNotValue.ts new file mode 100644 index 0000000000000..9b0b7bd7c65e8 --- /dev/null +++ b/tests/cases/compiler/isolatedModulesShadowGlobalTypeNotValue.ts @@ -0,0 +1,54 @@ +// @isolatedModules: false, true +// @verbatimModuleSyntax: false, true +// @noEmit: true +// @noTypesAndSymbols: true + +// @filename: ./types.ts +export interface Date { + day: number; + month: number; + year: number; +} + +export namespace Event { + export type T = any; +} + +// @filename: ./node.d.ts +declare module 'node:console' { + global { + interface Console { + Console: console.ConsoleConstructor; + } + namespace console { + interface ConsoleConstructor { + prototype: Console; + new (): Console; + } + } + var console: Console; + } + export = globalThis.console; +} + +// @filename: ./bad.ts +import { Date, Event } from './types'; +function foo(a: Date) { + const b = new Date(a.year, a.month, a.day); + return b.getTime(); +} +function bar() { + return new Event('bar') as Event.T; +} + +// @filename: ./good.ts +import type { Date, Event } from './types'; +import { Console } from 'node:console'; +function foo(a: Date) { + const b = new Date(a.year, a.month, a.day); + return b.getTime(); +} +function bar() { + return new Event('bar') as Event.T; +} +const baz: Console = new Console(); diff --git a/tests/cases/compiler/mappedTypeInferenceFromApparentType.ts b/tests/cases/compiler/mappedTypeInferenceFromApparentType.ts new file mode 100644 index 0000000000000..9fc5e6401a72f --- /dev/null +++ b/tests/cases/compiler/mappedTypeInferenceFromApparentType.ts @@ -0,0 +1,13 @@ +// @strict: true +// @noEmit: true + +type Obj = { + [s: string]: number; +}; + +type foo = (target: { [K in keyof T]: T[K] }) => void; +type bar = (source: { [K in keyof U]: Obj[K] }) => void; + +declare let f: foo; +declare let b: bar; +b = f; \ No newline at end of file diff --git a/tests/cases/compiler/mappedTypeInferenceToMappedType.ts b/tests/cases/compiler/mappedTypeInferenceToMappedType.ts new file mode 100644 index 0000000000000..2bf82fac1c78a --- /dev/null +++ b/tests/cases/compiler/mappedTypeInferenceToMappedType.ts @@ -0,0 +1,13 @@ +// @strict: true +// @noEmit: true + +// #56133 + +declare class Base { + someProp: T; + method(x: { [K in keyof U]: U[K] }): Base; +} + +declare class Derived extends Base { + method(x: { [K in keyof V]: V[K] }): Base; +} \ No newline at end of file diff --git a/tests/cases/compiler/mergedInstantiationAssignment.ts b/tests/cases/compiler/mergedInstantiationAssignment.ts new file mode 100644 index 0000000000000..30710a7d2ab10 --- /dev/null +++ b/tests/cases/compiler/mergedInstantiationAssignment.ts @@ -0,0 +1,28 @@ +// @strict: true +// @noEmit: true + +// https://github.com/microsoft/TypeScript/issues/56320 + +class GenericObject { + set x(x: T) {} +} + +const v1 = new GenericObject() as GenericObject & + ({ a?: string } | { b?: number }); +v1.x = 432; + +class GenericObjectWithoutSetter { + declare x: T; +} + +const v2 = new GenericObjectWithoutSetter() as GenericObjectWithoutSetter & + ({ a?: string } | { b?: number }); +v2.x = 42; + +class NormalObject { + set x(x: number) {} +} + +const v3 = new NormalObject() as NormalObject & + ({ a?: string } | { b?: number }); +v3.x = 42; diff --git a/tests/cases/compiler/modularizeLibrary_Dom.asynciterable.ts b/tests/cases/compiler/modularizeLibrary_Dom.asynciterable.ts new file mode 100644 index 0000000000000..d4c00461aef1c --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_Dom.asynciterable.ts @@ -0,0 +1,9 @@ +īģŋ// @skipLibCheck: true +// @lib: es2018,dom,dom.asynciterable +// @target: es2018 + +navigator.storage.getDirectory().then(async directory => { + for await (const [key, handle] of directory) { + handle.kind; + } +}); diff --git a/tests/cases/compiler/modularizeLibrary_Worker.asynciterable.ts b/tests/cases/compiler/modularizeLibrary_Worker.asynciterable.ts new file mode 100644 index 0000000000000..5e875a9bc8ed2 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_Worker.asynciterable.ts @@ -0,0 +1,9 @@ +īģŋ// @skipLibCheck: true +// @lib: es2018,webworker,webworker.asynciterable +// @target: es2018 + +navigator.storage.getDirectory().then(async directory => { + for await (const [key, handle] of directory) { + handle.kind; + } +}); diff --git a/tests/cases/compiler/modularizeLibrary_Worker.iterable.ts b/tests/cases/compiler/modularizeLibrary_Worker.iterable.ts new file mode 100644 index 0000000000000..e41d0b034f3e1 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_Worker.iterable.ts @@ -0,0 +1,7 @@ +īģŋ// @skipLibCheck: true +// @lib: es6,webworker,webworker.iterable +// @target: es6 + +for (const [key, entry] of new FormData()) { + entry; +} diff --git a/tests/cases/compiler/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts b/tests/cases/compiler/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts new file mode 100644 index 0000000000000..3f88e085c31cc --- /dev/null +++ b/tests/cases/compiler/narrowRefinedConstLikeParameterBIndingElementNameInInnerScope.ts @@ -0,0 +1,10 @@ +// @strict: true +// @noEmit: true + +function ff({ a, b }: { a: string | undefined, b: () => void }) { + if (a !== undefined) { + b = () => { + const x: string = a; + } + } +} diff --git a/tests/cases/compiler/narrowingPastLastAssignment.ts b/tests/cases/compiler/narrowingPastLastAssignment.ts new file mode 100644 index 0000000000000..ae66ab03db719 --- /dev/null +++ b/tests/cases/compiler/narrowingPastLastAssignment.ts @@ -0,0 +1,157 @@ +// @strict: true +// @noEmit: true +// @target: esnext + +function action(f: Function) {} + +// Narrowings are preserved in closures created past last assignment + +function f1(x: string | number) { + x = "abc"; + action(() => { x /* string | number */ }); + x = 42; + action(() => { x /* number */ }); +} + +// Narrowings are not preserved in inner function and class declarations (due to hoisting) + +function f2() { + let x: string | number; + x = 42; + let a = () => { x /* number */ }; + let f = function() { x /* number */ }; + let C = class { + foo() { x /* number */ } + }; + let o = { + foo() { x /* number */ } + }; + function g() { x /* string | number */ } + class A { + foo() { x /* string | number */ } + } +} + +// Narrowings are not preserved when assignments occur in inner functions + +function f3(x: string | number) { + action(() => { x = "abc" }); + x = 42; + action(() => { x /* string | number */ }); +} + +// Assignment effects in compoud statements extend to the entire statement + +function f4(cond: () => boolean) { + let x: string | number = 0; + while (cond()) { + x = "abc"; + action(() => { x /* string | number */ }); + x = 42; + action(() => { x /* string | number */ }); + } + action(() => { x /* number */ }); +} + +function f5(x: string | number, cond: () => boolean) { + if (cond()) { + x = 1; + action(() => { x /* string | number */ }); + } + else { + x = 2; + action(() => { x /* string | number */ }); + } + action(() => { x /* number */ }); +} + +function f5a(cond: boolean) { + if (cond) { + let x: number | undefined; + x = 1; + action(() => { x /* number */ }); + } + else { + let x: number | undefined; + x = 2; + action(() => { x /* number */ }); + } +} + +function f5b() { + for (let x = 0; x < 10; x++) { + if (x === 1 || x === 2) { + action(() => { x /* 1 | 2 */ }) + } + } +} + +// Implicit any variables have a known type following last assignment + +function f6() { + let x; + x = "abc"; + action(() => { x }); // Error + x = 42; + action(() => { x /* number */ }); +} + +// Narrowings on catch variables are preserved past last assignment + +function f7() { + try { + } + catch (e) { + if (e instanceof Error) { + let f = () => { e /* Error */ } + } + } +} + +// Narrowings are not preserved for global variables + +let g: string | number; +g = "abc"; +action(() => { g /* string | number */ }); + +// Narrowings are not preserved for exported namespace members + +namespace Foo { + export let x: string | number; + x = "abc"; + action(() => { x /* string | number */ }); + let y: string | number; + y = "abc"; + action(() => { y /* string */ }); +} + +// Repros from #35124 + +function f10() { + let i: number | undefined; + i = 0; + return (k: number) => k === i + 1; +} + +function makeAdder(n?: number) { + n ??= 0; + return (m: number) => n + m; +} + +function f11() { + let r; + r = "b"; + () => r; +} + +// Repro from #52104 + +function f12() { + const fooMap: Map> = new Map() + const values = [1, 2, 3, 4, 5]; + let foo = fooMap.get("a"); + if (foo == null) { + foo = []; + } + values.forEach(v => foo.push(v)); +} diff --git a/tests/cases/compiler/narrowingPastLastAssignmentInModule.ts b/tests/cases/compiler/narrowingPastLastAssignmentInModule.ts new file mode 100644 index 0000000000000..b036091fc851a --- /dev/null +++ b/tests/cases/compiler/narrowingPastLastAssignmentInModule.ts @@ -0,0 +1,30 @@ +// @strict: true +// @noEmit: true +// @target: esnext + +function action(f: Function) {} + +// Narrowings are not preserved for exported mutable variables + +export let x1: string | number; +x1 = "abc"; +action(() => { x1 /* string | number */ }); + +export { x2 }; +let x2: string | number; +x2 = "abc"; +action(() => { x2 /* string | number */ }); + +export { x3 as foo }; +let x3: string | number; +x3 = "abc"; +action(() => { x3 /* string | number */ }); + +let x4: string | number; +x4 = "abc"; +action(() => { x4 /* string */ }); +export default x4; + +let x5: string | number; +x5 = "abc"; +action(() => { x5 /* string */ }); diff --git a/tests/cases/compiler/reverseMappedTupleContext.ts b/tests/cases/compiler/reverseMappedTupleContext.ts new file mode 100644 index 0000000000000..a2d2bcfe508d0 --- /dev/null +++ b/tests/cases/compiler/reverseMappedTupleContext.ts @@ -0,0 +1,47 @@ +// @strict: true +// @noEmit: true + +// https://github.com/microsoft/TypeScript/issues/55382 + +declare function test1(arg: { + [K in keyof T]: T[K]; +}): T; +const result1 = test1(["foo", 42]); + +declare function test2(arg: { + [K in keyof T]: T[K]; +}): T; +const result2 = test2(["foo", 42]); + +type Schema = Record | readonly unknown[]; +type Definition = { + [K in keyof T]: (() => T[K]) | Definition; +}; +declare function create(definition: Definition): T; +const created1 = create([() => 1, [() => ""]]); +const created2 = create({ + a: () => 1, + b: [() => ""], +}); + +interface CompilerOptions { + allowUnreachableCode?: boolean; + allowUnusedLabels?: boolean; + alwaysStrict?: boolean; +} +type KeepLiteralStrings = { + [K in keyof T]: T[K]; +}; +declare function test4>(obj: { + [K in keyof T & keyof CompilerOptions]: { + dependencies: KeepLiteralStrings; + }; +}): T; +const result4 = test4({ + alwaysStrict: { + dependencies: ["foo", "bar"], + }, + allowUnusedLabels: { + dependencies: ["baz", "qwe"], + }, +}); diff --git a/tests/cases/compiler/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.tsx b/tests/cases/compiler/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.tsx new file mode 100644 index 0000000000000..521373e3e24ab --- /dev/null +++ b/tests/cases/compiler/unionReductionWithStringMappingAndIdenticalBaseTypeExistsNoCrash.tsx @@ -0,0 +1,106 @@ +// @strict: true +// @noEmit: true +// @target: esnext +// @lib: dom, esnext +// @jsx: react +// @esModuleInterop: true +// @moduleResolution: node + +// https://github.com/microsoft/TypeScript/issues/56688 + +// @filename: node_modules/@types/react/index.d.ts + +export = React; +export as namespace React; + +declare namespace React { + type ReactNode = + | ReactElement + | string + | number + | Iterable + | boolean + | null + | undefined; + type JSXElementConstructor

= (props: P) => ReactNode; + interface ReactElement< + P = any, + T extends string | JSXElementConstructor = + | string + | JSXElementConstructor, + > { + type: T; + props: P; + key: string | null; + } + + type ComponentProps> = + T extends JSXElementConstructor ? P : never; + + interface ExoticComponent

{ + (props: P): ReactNode; + readonly $$typeof: symbol; + } + + type LazyExoticComponent> = + ExoticComponent> & { + readonly _result: T; + }; + + function createElement(): void; + + namespace JSX { + interface Element extends GlobalJSXElement {} + interface ElementChildrenAttribute + extends GlobalJSXElementChildrenAttribute {} + type LibraryManagedAttributes = GlobalJSXLibraryManagedAttributes< + C, + P + >; + interface IntrinsicElements extends GlobalJSXIntrinsicElements {} + } +} + +type ReactManagedAttributes = C extends { defaultProps: infer D } + ? P & D + : P; + +declare global { + namespace JSX { + interface Element extends React.ReactElement {} + interface ElementChildrenAttribute { + children: {}; + } + type LibraryManagedAttributes = C extends React.LazyExoticComponent< + infer T + > + ? ReactManagedAttributes + : ReactManagedAttributes; + interface IntrinsicElements { + div: {}; + span: {}; + } + } +} + +interface GlobalJSXElement extends JSX.Element {} +interface GlobalJSXElementChildrenAttribute + extends JSX.ElementChildrenAttribute {} +type GlobalJSXLibraryManagedAttributes = JSX.LibraryManagedAttributes< + C, + P +>; +interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {} + +// @filename: src/index.tsx +import React from 'react' + +declare function upperFirst(str: T): Capitalize + +const displayEnum = (value: string) => upperFirst(value.toLowerCase()) + +function Comp() { + return

+ Scope: {displayEnum("VALUE")} +
+} diff --git a/tests/cases/compiler/uniqueSymbolJs.ts b/tests/cases/compiler/uniqueSymbolJs.ts new file mode 100644 index 0000000000000..faa4bd5fcf8ad --- /dev/null +++ b/tests/cases/compiler/uniqueSymbolJs.ts @@ -0,0 +1,11 @@ +// @target: esnext +// @checkJs: true +// @allowJs: true +// @noEmit: true +// @filename: ./a.js + +/** @type {unique symbol} */ +const foo = Symbol(); + +/** @typedef {{ [foo]: boolean }} A */ +/** @typedef {{ [key: foo] boolean }} B */ diff --git a/tests/cases/compiler/varianceReferences.ts b/tests/cases/compiler/varianceReferences.ts new file mode 100644 index 0000000000000..a31f34df33206 --- /dev/null +++ b/tests/cases/compiler/varianceReferences.ts @@ -0,0 +1,29 @@ +type NumericConstraint = Value; + +type VarianceConstrainedNumber = + NumericConstraint; + +type Unconstrained = Value; + +type VarianceUnconstrained = Unconstrained; + +type Level3of3Unconstrained = Value; +type Level2of3Unconstrained = Level3of3Unconstrained; +type Level1of3Unconstrained = Level2of3Unconstrained; + +type VarianceDeepUnconstrained = Level1of3Unconstrained; + +interface Shape { + value: Value; +} + +type VarianceShape = Shape; + +interface Level3of3Shape { + value: Value; +} + +type Level2of3Shape = Level3of3Shape; +type Level1of3Shape = Level2of3Shape; + +type VarianceDeepShape = Level1of3Shape; diff --git a/tests/cases/conformance/controlFlow/controlFlowAliasing.ts b/tests/cases/conformance/controlFlow/controlFlowAliasing.ts index b32f80abae94f..f9a3defe79bf9 100644 --- a/tests/cases/conformance/controlFlow/controlFlowAliasing.ts +++ b/tests/cases/conformance/controlFlow/controlFlowAliasing.ts @@ -134,10 +134,10 @@ function f25(arg: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) { let obj = arg; const isFoo = obj.kind === 'foo'; if (isFoo) { - obj.foo; // Not narrowed because obj is mutable + obj.foo; } else { - obj.bar; // Not narrowed because obj is mutable + obj.bar; } } diff --git a/tests/cases/conformance/controlFlow/controlFlowElementAccessNoCrash1.ts b/tests/cases/conformance/controlFlow/controlFlowElementAccessNoCrash1.ts new file mode 100644 index 0000000000000..88ff6edab4557 --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowElementAccessNoCrash1.ts @@ -0,0 +1,32 @@ +// @strict: true +// @noEmit: true + +interface TestTscEdit { + caption: string; + commandLineArgs?: readonly string[]; +} + +interface TestTscCompile { + subScenario: string; + commandLineArgs: readonly string[]; +} + +interface VerifyTscEditDiscrepanciesInput { + index: number; + edits: readonly TestTscEdit[]; + commandLineArgs: TestTscCompile["commandLineArgs"]; +} + +function testTscCompile(input: TestTscCompile) {} + +function verifyTscEditDiscrepancies({ + index, + edits, + commandLineArgs, +}: VerifyTscEditDiscrepanciesInput) { + const { caption } = edits[index]; + testTscCompile({ + subScenario: caption, + commandLineArgs: edits[index].commandLineArgs || commandLineArgs, + }); +} diff --git a/tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts b/tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts index 7b18bec96103b..67bce5559e9cf 100644 --- a/tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts +++ b/tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts @@ -436,3 +436,34 @@ function tooNarrow([x, y]: [1, 1] | [1, 2] | [1]) { const shouldNotBeOk: never = x; // Error } } + +// https://github.com/microsoft/TypeScript/issues/56312 + +function parameterReassigned1([x, y]: [1, 2] | [3, 4]) { + if (Math.random()) { + x = 1; + } + if (y === 2) { + x; // 1 | 3 + } +} + +function parameterReassigned2([x, y]: [1, 2] | [3, 4]) { + if (Math.random()) { + y = 2; + } + if (y === 2) { + x; // 1 | 3 + } +} + +// https://github.com/microsoft/TypeScript/pull/56313#discussion_r1416482490 + +const parameterReassignedContextualRest1: (...args: [1, 2] | [3, 4]) => void = (x, y) => { + if (Math.random()) { + y = 2; + } + if (y === 2) { + x; // 1 | 3 + } +} diff --git a/tests/cases/conformance/es2020/localesObjectArgument.ts b/tests/cases/conformance/es2020/localesObjectArgument.ts index 37be75f13d6b2..71e63ff14143e 100644 --- a/tests/cases/conformance/es2020/localesObjectArgument.ts +++ b/tests/cases/conformance/es2020/localesObjectArgument.ts @@ -9,6 +9,8 @@ const num = 1000; const bigint = 123456789123456789n; const str = ""; +const readonlyLocales: Readonly = ['de-DE', 'ja-JP']; + now.toLocaleString(enUS); now.toLocaleDateString(enUS); now.toLocaleTimeString(enUS); @@ -31,25 +33,33 @@ str.localeCompare(str, [deDE, jaJP]); new Intl.PluralRules(enUS); new Intl.PluralRules([deDE, jaJP]); +new Intl.PluralRules(readonlyLocales); Intl.PluralRules.supportedLocalesOf(enUS); Intl.PluralRules.supportedLocalesOf([deDE, jaJP]); +Intl.PluralRules.supportedLocalesOf(readonlyLocales); new Intl.RelativeTimeFormat(enUS); new Intl.RelativeTimeFormat([deDE, jaJP]); +new Intl.RelativeTimeFormat(readonlyLocales); Intl.RelativeTimeFormat.supportedLocalesOf(enUS); Intl.RelativeTimeFormat.supportedLocalesOf([deDE, jaJP]); +Intl.RelativeTimeFormat.supportedLocalesOf(readonlyLocales); new Intl.Collator(enUS); new Intl.Collator([deDE, jaJP]); +new Intl.Collator(readonlyLocales); Intl.Collator.supportedLocalesOf(enUS); Intl.Collator.supportedLocalesOf([deDE, jaJP]); new Intl.DateTimeFormat(enUS); new Intl.DateTimeFormat([deDE, jaJP]); +new Intl.DateTimeFormat(readonlyLocales); Intl.DateTimeFormat.supportedLocalesOf(enUS); Intl.DateTimeFormat.supportedLocalesOf([deDE, jaJP]); +Intl.DateTimeFormat.supportedLocalesOf(readonlyLocales); new Intl.NumberFormat(enUS); new Intl.NumberFormat([deDE, jaJP]); +new Intl.NumberFormat(readonlyLocales); Intl.NumberFormat.supportedLocalesOf(enUS); -Intl.NumberFormat.supportedLocalesOf([deDE, jaJP]); +Intl.NumberFormat.supportedLocalesOf(readonlyLocales); diff --git a/tests/cases/conformance/jsdoc/jsdocTemplateTag6.ts b/tests/cases/conformance/jsdoc/jsdocTemplateTag6.ts new file mode 100644 index 0000000000000..7555c69178184 --- /dev/null +++ b/tests/cases/conformance/jsdoc/jsdocTemplateTag6.ts @@ -0,0 +1,93 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @strict: true +// @Filename: a.js + +/** + * @template const T + * @param {T} x + * @returns {T} + */ +function f1(x) { + return x; +} +const t1 = f1("a"); +const t2 = f1(["a", ["b", "c"]]); +const t3 = f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); + +/** + * @template const T, U + * @param {T} x + * @returns {T} + */ +function f2(x) { + return x; +}; +const t4 = f2('a'); +const t5 = f2(['a', ['b', 'c']]); +const t6 = f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); + +/** + * @template const T + * @param {T} x + * @returns {T[]} + */ +function f3(x) { + return [x]; +} +const t7 = f3("hello"); +const t8 = f3("hello"); + +/** + * @template const T + * @param {[T, T]} x + * @returns {T} + */ +function f4(x) { + return x[0]; +} +const t9 = f4([[1, "x"], [2, "y"]]); +const t10 = f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]); + +/** + * @template const T + * @param {{ x: T, y: T}} obj + * @returns {T} + */ +function f5(obj) { + return obj.x; +} +const t11 = f5({ x: [1, "x"], y: [2, "y"] }); +const t12 = f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }); + +/** + * @template const T + */ +class C { + /** + * @param {T} x + */ + constructor(x) {} + + /** + * @template const U + * @param {U} x + */ + foo(x) { + return x; + } +} + +const t13 = new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); +const t14 = t13.foo(["a", ["b", "c"]]); + +/** + * @template {readonly unknown[]} const T + * @param {T} args + * @returns {T} + */ +function f6(...args) { + return args; +} +const t15 = f6(1, 'b', { a: 1, b: 'x' }); diff --git a/tests/cases/conformance/jsdoc/jsdocTemplateTag7.ts b/tests/cases/conformance/jsdoc/jsdocTemplateTag7.ts new file mode 100644 index 0000000000000..b4f85fb71a170 --- /dev/null +++ b/tests/cases/conformance/jsdoc/jsdocTemplateTag7.ts @@ -0,0 +1,24 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @strict: true +// @Filename: a.js + +/** + * @template const T + * @typedef {[T]} X + */ + +/** + * @template const T + */ +class C { } + +/** + * @template private T + * @param {T} x + * @returns {T} + */ +function f(x) { + return x; +} diff --git a/tests/cases/conformance/jsdoc/jsdocTemplateTag8.ts b/tests/cases/conformance/jsdoc/jsdocTemplateTag8.ts new file mode 100644 index 0000000000000..3e6c25d2e46fc --- /dev/null +++ b/tests/cases/conformance/jsdoc/jsdocTemplateTag8.ts @@ -0,0 +1,68 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @strict: true +// @Filename: a.js + +/** + * @template out T + * @typedef {Object} Covariant + * @property {T} x + */ + +/** + * @type {Covariant} + */ +let super_covariant = { x: 1 }; + +/** + * @type {Covariant} + */ +let sub_covariant = { x: '' }; + +super_covariant = sub_covariant; +sub_covariant = super_covariant; // Error + +/** + * @template in T + * @typedef {Object} Contravariant + * @property {(x: T) => void} f + */ + +/** + * @type {Contravariant} + */ +let super_contravariant = { f: (x) => {} }; + +/** + * @type {Contravariant} + */ +let sub_contravariant = { f: (x) => {} }; + +super_contravariant = sub_contravariant; // Error +sub_contravariant = super_contravariant; + +/** + * @template in out T + * @typedef {Object} Invariant + * @property {(x: T) => T} f + */ + +/** + * @type {Invariant} + */ +let super_invariant = { f: (x) => {} }; + +/** + * @type {Invariant} + */ +let sub_invariant = { f: (x) => { return "" } }; + +super_invariant = sub_invariant; // Error +sub_invariant = super_invariant; // Error + +/** + * @template in T + * @param {T} x + */ +function f(x) {} diff --git a/tests/cases/conformance/typings/typingsSuggestionBun1.ts b/tests/cases/conformance/typings/typingsSuggestionBun1.ts new file mode 100644 index 0000000000000..aff75faff5dac --- /dev/null +++ b/tests/cases/conformance/typings/typingsSuggestionBun1.ts @@ -0,0 +1,5 @@ +// @filename: tsconfig.json +{ "compilerOptions": {"types": []} } + +// @filename: a.ts +const file = Bun.file("/a.ts"); diff --git a/tests/cases/conformance/typings/typingsSuggestionBun2.ts b/tests/cases/conformance/typings/typingsSuggestionBun2.ts new file mode 100644 index 0000000000000..6c07e0483d347 --- /dev/null +++ b/tests/cases/conformance/typings/typingsSuggestionBun2.ts @@ -0,0 +1,5 @@ +// @filename: tsconfig.json +{ "compilerOptions": {} } + +// @filename: a.ts +const file = Bun.file("/a.ts"); diff --git a/tests/cases/fourslash/autoImportPackageJsonExportsSpecifierEndsInTs.ts b/tests/cases/fourslash/autoImportPackageJsonExportsSpecifierEndsInTs.ts new file mode 100644 index 0000000000000..7784b0334f929 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonExportsSpecifierEndsInTs.ts @@ -0,0 +1,27 @@ +/// + +// @module: nodenext + +// @Filename: /node_modules/pkg/package.json +//// { +//// "name": "pkg", +//// "version": "1.0.0", +//// "exports": { +//// "./something.ts": "./a.js" +//// } +//// } + +// @Filename: /node_modules/pkg/a.d.ts +//// export function foo(): void; + +// @Filename: /package.json +//// { +//// "dependencies": { +//// "pkg": "*" +//// } +//// } + +// @Filename: /index.ts +//// foo/**/ + +verify.importFixModuleSpecifiers("", ["pkg/something.ts"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsConditions.ts b/tests/cases/fourslash/autoImportPackageJsonImportsConditions.ts new file mode 100644 index 0000000000000..71fd139167ca9 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsConditions.ts @@ -0,0 +1,22 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#thing": { +//// "types": { "import": "./types-esm/thing.d.mts", "require": "./types/thing.d.ts" }, +//// "default": { "import": "./esm/thing.mjs", "require": "./dist/thing.js" } +//// } +//// } +//// } + + +// @Filename: /src/.ts +//// something/*a*/ + +// @Filename: /types/thing.d.ts +//// export function something(name: string): any; + +verify.importFixModuleSpecifiers("a", ["#thing"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsLength1.ts b/tests/cases/fourslash/autoImportPackageJsonImportsLength1.ts new file mode 100644 index 0000000000000..ae0999fb7a3b0 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsLength1.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*": "./src/*.ts" +//// } +//// } + +// @Filename: /src/a/b/c/something.ts +//// export function something(name: string): any; + +// @Filename: /src/a/b/c/d.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["./something"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsLength2.ts b/tests/cases/fourslash/autoImportPackageJsonImportsLength2.ts new file mode 100644 index 0000000000000..5b54f6b3149c4 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsLength2.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*": "./src/*.ts" +//// } +//// } + +// @Filename: /src/a/b/c/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#a/b/c/something"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsPattern.ts b/tests/cases/fourslash/autoImportPackageJsonImportsPattern.ts new file mode 100644 index 0000000000000..70aeabcfdaaea --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsPattern.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*": "./src/*" +//// } +//// } + +// @Filename: /src/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#something.js"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsPattern_js.ts b/tests/cases/fourslash/autoImportPackageJsonImportsPattern_js.ts new file mode 100644 index 0000000000000..a5955a65c9275 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsPattern_js.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*": "./src/*.js" +//// } +//// } + +// @Filename: /src/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#something"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsPattern_js_ts.ts b/tests/cases/fourslash/autoImportPackageJsonImportsPattern_js_ts.ts new file mode 100644 index 0000000000000..bf9b3305d77bb --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsPattern_js_ts.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*.js": "./src/*.ts" +//// } +//// } + +// @Filename: /src/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#something.js"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts.ts b/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts.ts new file mode 100644 index 0000000000000..a48ef7d4bc720 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*": "./src/*.ts" +//// } +//// } + +// @Filename: /src/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#something"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts_js.ts b/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts_js.ts new file mode 100644 index 0000000000000..701b8fbd978b8 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts_js.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*.ts": "./src/*.js" +//// } +//// } + +// @Filename: /src/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#something.ts"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts_ts.ts b/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts_ts.ts new file mode 100644 index 0000000000000..19171deea3b58 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts_ts.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*.ts": "./src/*.ts" +//// } +//// } + +// @Filename: /src/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#something.ts"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsPreference1.ts b/tests/cases/fourslash/autoImportPackageJsonImportsPreference1.ts new file mode 100644 index 0000000000000..dfac2a3ab55d0 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsPreference1.ts @@ -0,0 +1,20 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*": "./src/*.ts" +//// } +//// } + +// @Filename: /src/a/b/c/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["./src/a/b/c/something"], { + importModuleSpecifierPreference: "relative" +}); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsPreference2.ts b/tests/cases/fourslash/autoImportPackageJsonImportsPreference2.ts new file mode 100644 index 0000000000000..affd548cfa3ce --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsPreference2.ts @@ -0,0 +1,20 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*": "./src/*.ts" +//// } +//// } + +// @Filename: /src/a/b/c/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["./src/a/b/c/something"], { + importModuleSpecifierPreference: "project-relative" +}); diff --git a/tests/cases/fourslash/autoImportPackageJsonImportsPreference3.ts b/tests/cases/fourslash/autoImportPackageJsonImportsPreference3.ts new file mode 100644 index 0000000000000..3113af1bab627 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImportsPreference3.ts @@ -0,0 +1,20 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#*": "./src/*.ts" +//// } +//// } + +// @Filename: /src/a/b/c/something.ts +//// export function something(name: string): any; + +// @Filename: /src/a/b/c/d.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#a/b/c/something"], { + importModuleSpecifierPreference: "non-relative" +}); diff --git a/tests/cases/fourslash/autoImportPackageJsonImports_capsInPath1.ts b/tests/cases/fourslash/autoImportPackageJsonImports_capsInPath1.ts new file mode 100644 index 0000000000000..81b698ebd4d4c --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImports_capsInPath1.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /Dev/package.json +//// { +//// "imports": { +//// "#thing": "./src/something.js" +//// } +//// } + +// @Filename: /Dev/src/something.ts +//// export function something(name: string): any; + +// @Filename: /Dev/a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#thing"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImports_capsInPath2.ts b/tests/cases/fourslash/autoImportPackageJsonImports_capsInPath2.ts new file mode 100644 index 0000000000000..eb0b0f6838140 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImports_capsInPath2.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /Dev/package.json +//// { +//// "imports": { +//// "#thing/*": "./src/*.js" +//// } +//// } + +// @Filename: /Dev/src/something.ts +//// export function something(name: string): any; + +// @Filename: /Dev/a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#thing/something"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImports_js.ts b/tests/cases/fourslash/autoImportPackageJsonImports_js.ts new file mode 100644 index 0000000000000..1056d13dd5076 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImports_js.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#thing": "./src/something.js" +//// } +//// } + +// @Filename: /src/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#thing"]); diff --git a/tests/cases/fourslash/autoImportPackageJsonImports_ts.ts b/tests/cases/fourslash/autoImportPackageJsonImports_ts.ts new file mode 100644 index 0000000000000..a8e8b13b3d6e4 --- /dev/null +++ b/tests/cases/fourslash/autoImportPackageJsonImports_ts.ts @@ -0,0 +1,18 @@ +/// + +// @module: nodenext + +// @Filename: /package.json +//// { +//// "imports": { +//// "#thing": "./src/something.ts" +//// } +//// } + +// @Filename: /src/something.ts +//// export function something(name: string): any; + +// @Filename: /a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#thing"]); diff --git a/tests/cases/fourslash/autoImportTypeImport1.ts b/tests/cases/fourslash/autoImportTypeImport1.ts new file mode 100644 index 0000000000000..40422df03d2e7 --- /dev/null +++ b/tests/cases/fourslash/autoImportTypeImport1.ts @@ -0,0 +1,46 @@ +/// + +// @verbatimModuleSyntax: true +// @target: esnext + +// @Filename: /foo.ts +//// export const A = 1; +//// export type B = { x: number }; +//// export type C = 1; +//// export class D = { y: string }; + +// @Filename: /test.ts +//// import { A, D, type C } from './foo'; +//// const b: B/**/ | C; +//// console.log(A, D); + +goTo.marker(""); + +// importFixes should only place the import in sorted position if the existing imports are sorted as specified, +// otherwise the import should be placed at the end +verify.importFixAtPosition([ +`import { A, D, type C, type B } from './foo'; +const b: B | C; +console.log(A, D);`], + /*errorCode*/ undefined, + { organizeImportsTypeOrder: "inline" } + // `type B` is added to the end since the existing imports are not sorted as specified +); + +verify.importFixAtPosition([ +`import { A, D, type B, type C } from './foo'; +const b: B | C; +console.log(A, D);`], + /*errorCode*/ undefined, + { organizeImportsTypeOrder: "last" } + // `type B` is added to the sorted position since the existing imports *are* sorted as specified +); + +verify.importFixAtPosition([ +`import { A, D, type C, type B } from './foo'; +const b: B | C; +console.log(A, D);`], + /*errorCode*/ undefined, + { organizeImportsTypeOrder: "first" } + // `type B` is added to the end (default behavior) since the existing imports are not sorted as specified +); \ No newline at end of file diff --git a/tests/cases/fourslash/autoImportTypeImport2.ts b/tests/cases/fourslash/autoImportTypeImport2.ts new file mode 100644 index 0000000000000..195a12980c2f8 --- /dev/null +++ b/tests/cases/fourslash/autoImportTypeImport2.ts @@ -0,0 +1,43 @@ +/// + +// @verbatimModuleSyntax: true +// @target: esnext + +// @Filename: /foo.ts +//// export const A = 1; +//// export type B = { x: number }; +//// export type C = 1; +//// export class D = { y: string }; + +// @Filename: /test.ts +//// import { A, type C, D } from './foo'; +//// const b: B/**/ | C; +//// console.log(A, D); + +goTo.marker(""); + +// importFixes should only place the import in sorted position if the existing imports are sorted as specified, +// otherwise the import should be placed at the end +verify.importFixAtPosition([ +`import { A, type B, type C, D } from './foo'; +const b: B | C; +console.log(A, D);`], + /*errorCode*/ undefined, + { organizeImportsTypeOrder: "inline" } +); + +verify.importFixAtPosition([ +`import { A, type C, D, type B } from './foo'; +const b: B | C; +console.log(A, D);`], + /*errorCode*/ undefined, + { organizeImportsTypeOrder: "last" } +); + +verify.importFixAtPosition([ +`import { A, type C, D, type B } from './foo'; +const b: B | C; +console.log(A, D);`], + /*errorCode*/ undefined, + { organizeImportsTypeOrder: "first" } +); \ No newline at end of file diff --git a/tests/cases/fourslash/autoImportTypeImport3.ts b/tests/cases/fourslash/autoImportTypeImport3.ts new file mode 100644 index 0000000000000..50594e625817c --- /dev/null +++ b/tests/cases/fourslash/autoImportTypeImport3.ts @@ -0,0 +1,44 @@ +/// + +// @verbatimModuleSyntax: true +// @target: esnext + +// @Filename: /foo.ts +//// export const A = 1; +//// export type B = { x: number }; +//// export type C = 1; +//// export class D = { y: string }; + +// @Filename: /test.ts +//// import { A, type B, type C } from './foo'; +//// const b: B | C; +//// console.log(A, D/**/); + +goTo.marker(""); + +// importFixes should only place the import in sorted position if the existing imports are sorted as specified, +// otherwise the import should be placed at the end (regardless of if it's a regular or type-only import) +verify.importFixAtPosition([ +`import { A, D, type B, type C } from './foo'; +const b: B | C; +console.log(A, D);`], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder : "last" } +); + +verify.importFixAtPosition([ +`import { A, type B, type C, D } from './foo'; +const b: B | C; +console.log(A, D);`], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder : "inline" } +); + +verify.importFixAtPosition([ +`import { A, type B, type C, D } from './foo'; +const b: B | C; +console.log(A, D);`], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder : "first" } + // `D` is added to the end since `A, type B, type C` is not sorted to "first" +); \ No newline at end of file diff --git a/tests/cases/fourslash/autoImportTypeImport4.ts b/tests/cases/fourslash/autoImportTypeImport4.ts new file mode 100644 index 0000000000000..82dff821438f7 --- /dev/null +++ b/tests/cases/fourslash/autoImportTypeImport4.ts @@ -0,0 +1,111 @@ +/// + +// @verbatimModuleSyntax: true +// @target: esnext + +// @Filename: /exports1.ts +//// export const a = 0; +//// export const A = 1; +//// export const b = 2; +//// export const B = 3; +//// export const c = 4; +//// export const C = 5; +//// export type x = 6; +//// export const X = 7; +//// export const Y = 8; +//// export const Z = 9; + +// @Filename: /exports2.ts +//// export const d = 0; +//// export const D = 1; +//// export const e = 2; +//// export const E = 3; + +// @Filename: /index0.ts +//// import { A, B, C } from "./exports1"; +//// a/*0*/; +//// b; + +// @Filename: /index1.ts +//// import { A, B, C, type Y, type Z } from "./exports1"; +//// a/*1*/; +//// b; + +// @Filename: /index2.ts +//// import { A, a, B, b, type Y, type Z } from "./exports1"; +//// import { E } from "./exports2"; +//// d/*2*/ + +// addition of correctly sorted type imports should not affect behavior as shown in autoImportSortCaseSensitivity1.ts +goTo.marker("0"); +verify.importFixAtPosition([ + `import { A, B, C, a } from "./exports1";\na;\nb;`, + `import { A, B, C, b } from "./exports1";\na;\nb;`, +], + /*errorCode*/ undefined, + { organizeImportsTypeOrder : "last" }); +verify.importFixAtPosition([ + `import { a, A, B, C } from "./exports1";\na;\nb;`, + `import { A, b, B, C } from "./exports1";\na;\nb;` +], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder : "last" }); + +goTo.marker("1"); +verify.importFixAtPosition([ + `import { A, B, C, a, type Y, type Z } from "./exports1";\na;\nb;`, + `import { A, B, C, b, type Y, type Z } from "./exports1";\na;\nb;`, +], + /*errorCode*/ undefined, + { organizeImportsTypeOrder : "last" }); +verify.importFixAtPosition([ + `import { a, A, B, C, type Y, type Z } from "./exports1";\na;\nb;`, + `import { A, b, B, C, type Y, type Z } from "./exports1";\na;\nb;` +], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder : "last" }); + +// if we sort inline and sensitive, then all upper case imports should be sorted before any lower case imports +verify.importFixAtPosition([ + `import { A, B, C, type Y, type Z, a } from "./exports1";\na;\nb;`, + `import { A, B, C, type Y, type Z, b } from "./exports1";\na;\nb;`, +], + /*errorCode*/ undefined, + { organizeImportsTypeOrder : "inline" }); +verify.importFixAtPosition([ + `import { a, A, B, C, type Y, type Z } from "./exports1";\na;\nb;`, + `import { A, b, B, C, type Y, type Z } from "./exports1";\na;\nb;` +], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder : "inline" }); + +goTo.marker("2"); +verify.importFixAtPosition([ +`import { A, a, B, b, type Y, type Z } from "./exports1"; +import { d, E } from "./exports2"; +d`, +], + /*errorCode*/ undefined, + { organizeImportsTypeOrder : "last" }); +verify.importFixAtPosition([ +`import { A, a, B, b, type Y, type Z } from "./exports1"; +import { E, d } from "./exports2"; +d` +], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: false, organizeImportsTypeOrder : "last" }); + +verify.importFixAtPosition([ +`import { A, a, B, b, type Y, type Z } from "./exports1"; +import { d, E } from "./exports2"; +d`, +], + /*errorCode*/ undefined, + { organizeImportsTypeOrder : "last" }); +verify.importFixAtPosition([ +`import { A, a, B, b, type Y, type Z } from "./exports1"; +import { E, d } from "./exports2"; +d` +], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: false, organizeImportsTypeOrder : "last" }); \ No newline at end of file diff --git a/tests/cases/fourslash/autoImportTypeImport5.ts b/tests/cases/fourslash/autoImportTypeImport5.ts new file mode 100644 index 0000000000000..a0800d3f236f0 --- /dev/null +++ b/tests/cases/fourslash/autoImportTypeImport5.ts @@ -0,0 +1,86 @@ +/// + +// @verbatimModuleSyntax: true +// @target: esnext + +// @Filename: /exports1.ts +//// export const a = 0; +//// export const A = 1; +//// export const b = 2; +//// export const B = 3; +//// export const c = 4; +//// export const C = 5; +//// export type x = 6; +//// export const X = 7; +//// export type y = 8 +//// export const Y = 9; +//// export const Z = 10; + +// @Filename: /exports2.ts +//// export const d = 0; +//// export const D = 1; +//// export const e = 2; +//// export const E = 3; + +// @Filename: /index0.ts +//// import { type X, type Y, type Z } from "./exports1"; +//// const foo: x/*0*/; +//// const bar: y; + +// @Filename: /index1.ts +//// import { A, B, type X, type Y, type Z } from "./exports1"; +//// const foo: x/*1*/; +//// const bar: y; + +// addition of correctly sorted regular imports should not affect correctly sorted type imports +goTo.marker("0"); +verify.importFixAtPosition([ + `import { type X, type Y, type Z, type x } from "./exports1";\nconst foo: x;\nconst bar: y;`, + `import { type X, type Y, type Z, type y } from "./exports1";\nconst foo: x;\nconst bar: y;`, +], + /*errorCode*/ undefined, + { organizeImportsTypeOrder : "last" }); +verify.importFixAtPosition([ + `import { type x, type X, type Y, type Z } from "./exports1";\nconst foo: x;\nconst bar: y;`, + `import { type X, type y, type Y, type Z } from "./exports1";\nconst foo: x;\nconst bar: y;`, +], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder : "last" }); +verify.importFixAtPosition([ + `import { type X, type Y, type Z, type x } from "./exports1";\nconst foo: x;\nconst bar: y;`, + `import { type X, type Y, type Z, type y } from "./exports1";\nconst foo: x;\nconst bar: y;`, +], + /*errorCode*/ undefined, + { organizeImportsTypeOrder : "inline" }); +verify.importFixAtPosition([ + `import { type x, type X, type Y, type Z } from "./exports1";\nconst foo: x;\nconst bar: y;`, + `import { type X, type y, type Y, type Z } from "./exports1";\nconst foo: x;\nconst bar: y;`, +], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder : "inline" }); +verify.importFixAtPosition([ + `import { type X, type Y, type Z, type x } from "./exports1";\nconst foo: x;\nconst bar: y;`, + `import { type X, type Y, type Z, type y } from "./exports1";\nconst foo: x;\nconst bar: y;`, +], + /*errorCode*/ undefined, + { organizeImportsTypeOrder : "first" }); +verify.importFixAtPosition([ + `import { type x, type X, type Y, type Z } from "./exports1";\nconst foo: x;\nconst bar: y;`, + `import { type X, type y, type Y, type Z } from "./exports1";\nconst foo: x;\nconst bar: y;`, +], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder : "first" }); + +goTo.marker("1"); +verify.importFixAtPosition([ + `import { A, B, type X, type Y, type Z, type x } from "./exports1";\nconst foo: x;\nconst bar: y;`, + `import { A, B, type X, type Y, type Z, type y } from "./exports1";\nconst foo: x;\nconst bar: y;`, +], + /*errorCode*/ undefined, + { organizeImportsTypeOrder : "last" }); +verify.importFixAtPosition([ + `import { A, B, type x, type X, type Y, type Z } from "./exports1";\nconst foo: x;\nconst bar: y;`, + `import { A, B, type X, type y, type Y, type Z } from "./exports1";\nconst foo: x;\nconst bar: y;`, +], + /*errorCode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder : "last" }); \ No newline at end of file diff --git a/tests/cases/fourslash/callHierarchyClassPropertyArrowFunction.ts b/tests/cases/fourslash/callHierarchyClassPropertyArrowFunction.ts new file mode 100644 index 0000000000000..ba20f7f581b78 --- /dev/null +++ b/tests/cases/fourslash/callHierarchyClassPropertyArrowFunction.ts @@ -0,0 +1,13 @@ +/// + +////class C { +//// caller = () => { +//// this.callee(); +//// } +//// +//// /**/callee = () => { +//// } +////} + +goTo.marker(); +verify.baselineCallHierarchy(); diff --git a/tests/cases/fourslash/codeFixAddMissingEnumMember10.ts b/tests/cases/fourslash/codeFixAddMissingEnumMember10.ts index 0335c9ef552e8..6681562397bb0 100644 --- a/tests/cases/fourslash/codeFixAddMissingEnumMember10.ts +++ b/tests/cases/fourslash/codeFixAddMissingEnumMember10.ts @@ -18,7 +18,7 @@ verify.codeFix({ c = "123" } enum A { - a = E.c, + a = E.c, b = "b" } A.b` diff --git a/tests/cases/fourslash/codeFixAddMissingEnumMember14.ts b/tests/cases/fourslash/codeFixAddMissingEnumMember14.ts new file mode 100644 index 0000000000000..91bcdcfaf5d0f --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingEnumMember14.ts @@ -0,0 +1,26 @@ +/// + +////const a = 1; +//// +////export const enum E { +//// A = 0, +//// B = 1, +////} +//// +////const foo = E.Foo/**/; + +goTo.marker(""); +verify.codeFix({ + index: 0, + description: "Add missing enum member 'Foo'", + newFileContent: +`const a = 1; + +export const enum E { + A = 0, + B = 1, + Foo, +} + +const foo = E.Foo;`, +}); diff --git a/tests/cases/fourslash/codeFixAddMissingEnumMember15.ts b/tests/cases/fourslash/codeFixAddMissingEnumMember15.ts new file mode 100644 index 0000000000000..8c4018a377328 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingEnumMember15.ts @@ -0,0 +1,22 @@ +/// + +////const a = 1; +//// +////export const enum E { +////} +//// +////const foo = E.Foo/**/; + +goTo.marker(""); +verify.codeFix({ + index: 0, + description: "Add missing enum member 'Foo'", + newFileContent: +`const a = 1; + +export const enum E { + Foo +} + +const foo = E.Foo;`, +}); diff --git a/tests/cases/fourslash/codeFixAddMissingEnumMember4.ts b/tests/cases/fourslash/codeFixAddMissingEnumMember4.ts index a4e204015561f..4158e7a883382 100644 --- a/tests/cases/fourslash/codeFixAddMissingEnumMember4.ts +++ b/tests/cases/fourslash/codeFixAddMissingEnumMember4.ts @@ -9,7 +9,7 @@ verify.codeFix({ description: "Add missing enum member 'b'", newFileContent: `enum E { a = "a", - b = "b" + b = "b", } E.b` }); diff --git a/tests/cases/fourslash/codeFixAddMissingEnumMember5.ts b/tests/cases/fourslash/codeFixAddMissingEnumMember5.ts index 9d0fe55859ec0..bf2868974e556 100644 --- a/tests/cases/fourslash/codeFixAddMissingEnumMember5.ts +++ b/tests/cases/fourslash/codeFixAddMissingEnumMember5.ts @@ -9,7 +9,7 @@ verify.codeFix({ description: "Add missing enum member 'b'", newFileContent: `enum E { a = "a" + "-", - b = "b" + b = "b", } E.b` }); diff --git a/tests/cases/fourslash/codeFixAddMissingEnumMember9.ts b/tests/cases/fourslash/codeFixAddMissingEnumMember9.ts index acc27a6a4ea2a..f42ab3f4f2a32 100644 --- a/tests/cases/fourslash/codeFixAddMissingEnumMember9.ts +++ b/tests/cases/fourslash/codeFixAddMissingEnumMember9.ts @@ -18,7 +18,7 @@ verify.codeFix({ c = "123" } enum A { - a = E.a, + a = E.a, b } A.b` diff --git a/tests/cases/fourslash/codeFixAddMissingProperties29.ts b/tests/cases/fourslash/codeFixAddMissingProperties29.ts new file mode 100644 index 0000000000000..964c3363f5791 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingProperties29.ts @@ -0,0 +1,27 @@ +/// + +////namespace Foo.Bar { +//// export enum E { +//// E1 = 0, +//// E2 = 1, +//// } +//// export interface Baz { +//// prop1: string; +//// prop2: number; +//// prop3: E.E1; +//// prop4: Foo.Bar.E.E1; +//// } +////} +////[|const foo: Foo.Bar.Baz = {}|] + +verify.codeFix({ + index: 0, + description: ts.Diagnostics.Add_missing_properties.message, + newRangeContent: +`const foo: Foo.Bar.Baz = { + prop1: "", + prop2: 0, + prop3: Foo.Bar.E.E1, + prop4: Foo.Bar.E.E1 +}`, +}); diff --git a/tests/cases/fourslash/completionForObjectProperty.ts b/tests/cases/fourslash/completionForObjectProperty.ts new file mode 100644 index 0000000000000..dcedc4c9e47b7 --- /dev/null +++ b/tests/cases/fourslash/completionForObjectProperty.ts @@ -0,0 +1,70 @@ +/// + +// @Filename: /a.ts +//// export const foo = { bar: 'baz' }; + +// @Filename: /b.ts +//// const test = foo/*1*/ + +// @Filename: /c.ts +//// const test2 = {...foo/*2*/} + +// @Filename: /d.ts +//// const test3 = [{...foo/*3*/}] + +// @Filename: /e.ts +//// const test4 = { foo/*4*/ } + +// @Filename: /f.ts +//// const test5 = { foo: /*5*/ } + +// @Filename: /g.ts +//// const test6 = { unrelated: foo/*6*/ } + +// @Filename: /i.ts +//// const test7: { foo/*7*/: "unrelated" } + +// @Filename: /h.ts +//// const test8: { foo: string } = { foo/*8*/ } + +verify.completions({ + marker: "1", + includes: { name: "foo", source: "/a", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, + isNewIdentifierLocation: true, + preferences: { includeCompletionsForModuleExports: true } +}, { + marker: "2", + includes: { name: "foo", source: "/a", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, + isNewIdentifierLocation: false, + preferences: { includeCompletionsForModuleExports: true } +}, { + marker: "3", + includes: { name: "foo", source: "/a", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, + isNewIdentifierLocation: false, + preferences: { includeCompletionsForModuleExports: true } +}, { + marker: "4", + includes: { name: "foo", source: "/a", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, + isNewIdentifierLocation: true, + preferences: { includeCompletionsForModuleExports: true } +}, { + marker: "5", + includes: { name: "foo", source: "/a", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, + isNewIdentifierLocation: false, + preferences: { includeCompletionsForModuleExports: true } +}, { + marker: "6", + includes: { name: "foo", source: "/a", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, + isNewIdentifierLocation: false, + preferences: { includeCompletionsForModuleExports: true } +}, { + marker: "7", + excludes: "foo", + isNewIdentifierLocation: true, + preferences: { includeCompletionsForModuleExports: true } +}, { + marker: "8", + includes: { name: "foo", sortText: completion.SortText.LocationPriority }, + isNewIdentifierLocation: false, + preferences: { includeCompletionsForModuleExports: true } +}); diff --git a/tests/cases/fourslash/completionListDefaultTypeArgumentPositionTypeOnly.ts b/tests/cases/fourslash/completionListDefaultTypeArgumentPositionTypeOnly.ts new file mode 100644 index 0000000000000..d42049c5eccd6 --- /dev/null +++ b/tests/cases/fourslash/completionListDefaultTypeArgumentPositionTypeOnly.ts @@ -0,0 +1,6 @@ +/// + +//// const foo = "foo"; +//// function test1() {} + +verify.completions({ marker: "1", exact: completion.globalTypes }); diff --git a/tests/cases/fourslash/completionListIsGlobalCompletion.ts b/tests/cases/fourslash/completionListIsGlobalCompletion.ts index 107c64adadb2a..9516b8e4f34ab 100644 --- a/tests/cases/fourslash/completionListIsGlobalCompletion.ts +++ b/tests/cases/fourslash/completionListIsGlobalCompletion.ts @@ -48,7 +48,7 @@ verify.completions( { marker: "7", exact: completion.globalsInsideFunction(x), isGlobalCompletion: true }, { marker: "9", exact: ["x", "y"], isGlobalCompletion: false }, { marker: "10", exact: completion.classElementKeywords, isGlobalCompletion: false, isNewIdentifierLocation: true }, - { marker: "13", exact: globals, isGlobalCompletion: false }, + { marker: "13", exact: completion.globalTypesPlus(["A", "B", "C"]), isGlobalCompletion: false }, { marker: "15", exact: globals.filter(name => name !== 'x'), isGlobalCompletion: true, isNewIdentifierLocation: true }, { marker: "16", unsorted: [...x, completion.globalThisEntry, ...completion.globalsVars, completion.undefinedVarEntry].filter(name => name !== 'user'), isGlobalCompletion: false }, { marker: "17", exact: completion.globalKeywords, isGlobalCompletion: false }, diff --git a/tests/cases/fourslash/completionPropertyShorthandForObjectLiteral5.ts b/tests/cases/fourslash/completionPropertyShorthandForObjectLiteral5.ts index d3002f56c4619..85d45299f3694 100644 --- a/tests/cases/fourslash/completionPropertyShorthandForObjectLiteral5.ts +++ b/tests/cases/fourslash/completionPropertyShorthandForObjectLiteral5.ts @@ -9,7 +9,7 @@ verify.completions({ marker: "", - exact: completion.globalsPlus(["foo"]), + includes: { name: "exportedConstant", source: "/a", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, isNewIdentifierLocation: true, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts b/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts index 2b815911a1b77..8b5961e859ef0 100644 --- a/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts +++ b/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts @@ -17,6 +17,6 @@ verify.baselineFindAllReferences('0', '1', '2', '3', '4', 'export'); verify.baselineRename([r0, r1, r2]); for (const range of [r3b, r4b]) { goTo.rangeStart(range); - verify.renameInfoSucceeded(/*displayName*/ "/a.ts", /*fullDisplayName*/ "/a.ts", /*kind*/ "module", /*kindModifiers*/ "", /*fileToRename*/ "/a.ts", range); + verify.renameInfoSucceeded(/*displayName*/ "/a.ts", /*fullDisplayName*/ "./a", /*kind*/ "module", /*kindModifiers*/ "", /*fileToRename*/ "/a.ts", range); verify.renameInfoFailed("You cannot rename this element.", { allowRenameOfImportPath: false }); } diff --git a/tests/cases/fourslash/formatSpaceAfterImplementsExtends.ts b/tests/cases/fourslash/formatSpaceAfterImplementsExtends.ts new file mode 100644 index 0000000000000..b732c99aa2cd6 --- /dev/null +++ b/tests/cases/fourslash/formatSpaceAfterImplementsExtends.ts @@ -0,0 +1,27 @@ +/// + +////class C1 implements Array{ +////} +//// +////class C2 implements Number{ +////} +//// +////class C3 extends Array{ +////} +//// +////class C4 extends Number{ +////} + +format.document(); +verify.currentFileContentIs( +`class C1 implements Array { +} + +class C2 implements Number { +} + +class C3 extends Array { +} + +class C4 extends Number { +}`); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index b61f947e488b1..5daa7c0b3167e 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -670,6 +670,7 @@ declare namespace FourSlashInterface { readonly organizeImportsNumericCollation?: boolean; readonly organizeImportsAccentCollation?: boolean; readonly organizeImportsCaseFirst?: "upper" | "lower" | false; + readonly organizeImportsTypeOrder?: "first" | "last" | "inline"; } interface InlayHintsOptions extends UserPreferences { readonly includeInlayParameterNameHints?: "none" | "literals" | "all"; diff --git a/tests/cases/fourslash/genericsFormatting.ts b/tests/cases/fourslash/genericsFormatting.ts index bb2a218a44082..e22b16d433f6c 100644 --- a/tests/cases/fourslash/genericsFormatting.ts +++ b/tests/cases/fourslash/genericsFormatting.ts @@ -26,7 +26,7 @@ format.document(); goTo.marker("inClassDeclaration"); -verify.currentLineContentIs("class Foo {"); +verify.currentLineContentIs("class Foo {"); goTo.marker("inMethodDeclaration"); verify.currentLineContentIs(" public method(a: T1, b: Array): Map> {"); diff --git a/tests/cases/fourslash/importNameCodeFix_importType7.ts b/tests/cases/fourslash/importNameCodeFix_importType7.ts index 7d28f3019654b..c74a3c2c22837 100644 --- a/tests/cases/fourslash/importNameCodeFix_importType7.ts +++ b/tests/cases/fourslash/importNameCodeFix_importType7.ts @@ -22,3 +22,31 @@ verify.importFixAtPosition([ type SomeInterface, } from "./exports.js"; new SomePig`]); + +verify.importFixAtPosition([ +`import { + SomePig, + type SomeInterface, +} from "./exports.js"; +new SomePig`], +/*errorCode*/ undefined, +{ organizeImportsTypeOrder: "last" }); + +verify.importFixAtPosition([ +`import { + type SomeInterface, + SomePig, +} from "./exports.js"; +new SomePig`], + /*errorCode*/ undefined, + { organizeImportsTypeOrder: "inline" } +); + +verify.importFixAtPosition([ +`import { + type SomeInterface, + SomePig, +} from "./exports.js"; +new SomePig`], +/*errorCode*/ undefined, +{ organizeImportsTypeOrder: "first" }); diff --git a/tests/cases/fourslash/jsdocLink6.ts b/tests/cases/fourslash/jsdocLink6.ts new file mode 100644 index 0000000000000..459066fbabe01 --- /dev/null +++ b/tests/cases/fourslash/jsdocLink6.ts @@ -0,0 +1,16 @@ +/// + +// @filename: /a.ts +////export default function A() { } +////export function B() { }; + +// @Filename: /b.ts +////import A, { B } from "./a"; + +/////** +//// * {@link A} +//// * {@link B} +//// */ +////export default function /**/f() { } + +verify.baselineQuickInfo(); diff --git a/tests/cases/fourslash/moveToFile_existingImports5.ts b/tests/cases/fourslash/moveToFile_existingImports5.ts new file mode 100644 index 0000000000000..45dcec215c555 --- /dev/null +++ b/tests/cases/fourslash/moveToFile_existingImports5.ts @@ -0,0 +1,38 @@ +/// + +// @filename: /a.ts +////export class Bar {} +////export class Baz {} + +// @filename: /b.ts +////import { Bar, Baz } from "./a"; +//// +////[|const Foo = { +//// bar: Bar, +//// baz: Baz, +////}|] +//// +////export function fn(name: keyof typeof Foo) { +//// return Foo[name]; +////} + +verify.moveToFile({ + newFileContents: { + "/a.ts": +`export class Bar {} +export class Baz {} + +export const Foo = { + bar: Bar, + baz: Baz, +}; +`, + "/b.ts": +`import { Foo } from "./a"; + +export function fn(name: keyof typeof Foo) { + return Foo[name]; +}`, + }, + interactiveRefactorArguments: { targetFile: "/a.ts" }, +}); diff --git a/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions.ts b/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions.ts index d35d051eda66c..16ad964e5dc6d 100644 --- a/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions.ts +++ b/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions.ts @@ -18,7 +18,7 @@ //// // These will only show up as childItems. //// function z() {} //// console.log(function() {}) -//// describe("this", 'function', `is a function`, `but this ${"wont"} show`, () => {}); +//// describe("this", 'function', `is a function`, `with template literal ${"a"}`, () => {}); //// [].map(() => {}); ////}) ////(function classes() { @@ -77,11 +77,11 @@ verify.navigationTree({ "kind": "function" }, { - "text": `describe("this", 'function', \`is a function\`) callback`, + "text": "describe(\"this\", 'function', `is a function`, `with template literal ${\"a\"}`) callback", "kind": "function" }, { - "text": `map() callback`, + "text": "map() callback", "kind": "function" }, { @@ -199,11 +199,11 @@ verify.navigationBar([ "kind": "function" }, { - "text": `describe("this", 'function', \`is a function\`) callback`, + "text": "describe(\"this\", 'function', `is a function`, `with template literal ${\"a\"}`) callback", "kind": "function" }, { - "text": `map() callback`, + "text": "map() callback", "kind": "function" }, { diff --git a/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions3.ts b/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions3.ts new file mode 100644 index 0000000000000..2b2881e8ac6ac --- /dev/null +++ b/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions3.ts @@ -0,0 +1,93 @@ +/// + +////describe('foo', () => { +//// test(`a ${1} b ${2}`, () => {}) +////}) +//// +////const a = 1; +////const b = 2; +////describe('foo', () => { +//// test(`a ${a} b {b}`, () => {}) +////}) + +verify.navigationTree({ + "text": "", + "kind": "script", + "childItems": [ + { + "text": "a", + "kind": "const" + }, + { + "text": "b", + "kind": "const" + }, + { + "text": "describe('foo') callback", + "kind": "function", + "childItems": [ + { + "text": "test(`a ${1} b ${2}`) callback", + "kind": "function" + } + ] + }, + { + "text": "describe('foo') callback", + "kind": "function", + "childItems": [ + { + "text": "test(`a ${a} b {b}`) callback", + "kind": "function" + } + ] + } + ] +}); + +verify.navigationBar([ + { + "text": "", + "kind": "script", + "childItems": [ + { + "text": "a", + "kind": "const" + }, + { + "text": "b", + "kind": "const" + }, + { + "text": "describe('foo') callback", + "kind": "function" + }, + { + "text": "describe('foo') callback", + "kind": "function" + } + ] + }, + { + "text": "describe('foo') callback", + "kind": "function", + "childItems": [ + { + "text": "test(`a ${1} b ${2}`) callback", + "kind": "function" + } + ], + "indent": 1 + }, + { + "text": "describe('foo') callback", + "kind": "function", + "childItems": [ + { + "text": "test(`a ${a} b {b}`) callback", + "kind": "function" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/organizeImports1.ts b/tests/cases/fourslash/organizeImports1.ts index 58306c8161caa..53ee2c25b1fe1 100644 --- a/tests/cases/fourslash/organizeImports1.ts +++ b/tests/cases/fourslash/organizeImports1.ts @@ -18,26 +18,26 @@ //// console.log(a, B, b, c, C, d, D); //// console.log(e, f, F, g, G, H, h); -// verify.organizeImports( -// `import { -// a, -// b, -// b as B, -// c, -// c as C, -// d, d as D, -// e, -// f, -// f as F, -// g, -// g as G, -// h, h as H -// } from './foo'; +verify.organizeImports( +`import { + a, + b, + b as B, + c, + c as C, + d, d as D, + e, + f, + f as F, + g, + g as G, + h, h as H +} from './foo'; -// console.log(a, B, b, c, C, d, D); -// console.log(e, f, F, g, G, H, h);`, -// /*mode*/ undefined, -// { organizeImportsIgnoreCase: true }); +console.log(a, B, b, c, C, d, D); +console.log(e, f, F, g, G, H, h);`, +/*mode*/ undefined, +{ organizeImportsIgnoreCase: true }); verify.organizeImports( `import { diff --git a/tests/cases/fourslash/organizeImports16.ts b/tests/cases/fourslash/organizeImports16.ts index 93aa5a81f2cb8..be7150c047e0f 100644 --- a/tests/cases/fourslash/organizeImports16.ts +++ b/tests/cases/fourslash/organizeImports16.ts @@ -9,22 +9,25 @@ verify.organizeImports( interface Use extends A {} console.log(a, b);`); +edit.replaceLine(0, 'import { a, A, b } from "foo1";'); verify.organizeImports( -`import { a, A, b } from "foo"; +`import { a, A, b } from "foo1"; interface Use extends A {} console.log(a, b);`, /*mode*/ undefined, { organizeImportsIgnoreCase: "auto" }); +edit.replaceLine(0, 'import { a, A, b } from "foo2";'); verify.organizeImports( -`import { a, A, b } from "foo"; +`import { a, A, b } from "foo2"; interface Use extends A {} console.log(a, b);`, /*mode*/ undefined, { organizeImportsIgnoreCase: true }); +edit.replaceLine(0, 'import { a, A, b } from "foo3";'); verify.organizeImports( -`import { A, a, b } from "foo"; +`import { A, a, b } from "foo3"; interface Use extends A {} console.log(a, b);`, /*mode*/ undefined, diff --git a/tests/cases/fourslash/organizeImportsType1.ts b/tests/cases/fourslash/organizeImportsType1.ts new file mode 100644 index 0000000000000..998cb2f041123 --- /dev/null +++ b/tests/cases/fourslash/organizeImportsType1.ts @@ -0,0 +1,46 @@ +/// + +// @allowSyntheticDefaultImports: true +// @moduleResolution: node +// @noUnusedLocals: true +// @target: es2018 + +//// import { A } from "foo"; +//// import { type B } from "foo"; +//// import { C } from "foo"; +//// import { type E } from "foo"; +//// import { D } from "foo"; +//// +//// console.log(A, B, C, D, E); + +// default behavior is "last" +verify.organizeImports( +`import { A, C, D, type B, type E } from "foo"; + +console.log(A, B, C, D, E);` +); + +verify.organizeImports( +`import { A, type B, C, D, type E } from "foo"; + +console.log(A, B, C, D, E);`, + undefined, + { organizeImportsTypeOrder : "inline" } +); + + +verify.organizeImports( +`import { type B, type E, A, C, D } from "foo"; + +console.log(A, B, C, D, E);`, + undefined, + { organizeImportsTypeOrder : "first" } +); + +verify.organizeImports( +`import { A, C, D, type B, type E } from "foo"; + +console.log(A, B, C, D, E);`, + undefined, + { organizeImportsTypeOrder : "last" } +); \ No newline at end of file diff --git a/tests/cases/fourslash/organizeImportsType2.ts b/tests/cases/fourslash/organizeImportsType2.ts new file mode 100644 index 0000000000000..57b2b4db26950 --- /dev/null +++ b/tests/cases/fourslash/organizeImportsType2.ts @@ -0,0 +1,50 @@ +/// + +// @allowSyntheticDefaultImports: true +// @moduleResolution: node +// @noUnusedLocals: true +// @target: es2018 + +//// type A = string; +//// type B = string; +//// const C = "hello"; +//// export { A, type B, C }; + +// default behavior is equivalent to "last" +verify.organizeImports( +`type A = string; +type B = string; +const C = "hello"; +export { A, C, type B }; +` +); + +verify.organizeImports( +`type A = string; +type B = string; +const C = "hello"; +export { A, type B, C }; +`, + undefined, + { organizeImportsTypeOrder : "inline" } +); + +verify.organizeImports( +`type A = string; +type B = string; +const C = "hello"; +export { type B, A, C }; +`, + undefined, + { organizeImportsTypeOrder : "first" } +); + +verify.organizeImports( +`type A = string; +type B = string; +const C = "hello"; +export { A, C, type B }; +`, + undefined, + { organizeImportsTypeOrder : "last" } +); \ No newline at end of file diff --git a/tests/cases/fourslash/organizeImportsType3.ts b/tests/cases/fourslash/organizeImportsType3.ts new file mode 100644 index 0000000000000..4ed9a24f04cb5 --- /dev/null +++ b/tests/cases/fourslash/organizeImportsType3.ts @@ -0,0 +1,29 @@ +/// + +//// import { +//// d, +//// type d as D, +//// type c, +//// c as C, +//// b, +//// b as B, +//// type A, +//// a +//// } from './foo'; +//// console.log(A, a, B, b, c, C, d, D); + +verify.organizeImports( +`import { + type A, + b as B, + c as C, + type d as D, + a, + b, + type c, + d +} from './foo'; +console.log(A, a, B, b, c, C, d, D);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: false, organizeImportsTypeOrder: "inline" } +); diff --git a/tests/cases/fourslash/organizeImportsType4.ts b/tests/cases/fourslash/organizeImportsType4.ts new file mode 100644 index 0000000000000..da76b5f17bbea --- /dev/null +++ b/tests/cases/fourslash/organizeImportsType4.ts @@ -0,0 +1,29 @@ +/// + +//// import { +//// d, +//// type d as D, +//// type c, +//// c as C, +//// b, +//// b as B, +//// type A, +//// a +//// } from './foo'; +//// console.log(A, a, B, b, c, C, d, D); + +verify.organizeImports( +`import { + type A, + a, + b, + b as B, + type c, + c as C, + d, + type d as D +} from './foo'; +console.log(A, a, B, b, c, C, d, D);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder: "inline" } +); diff --git a/tests/cases/fourslash/organizeImportsType5.ts b/tests/cases/fourslash/organizeImportsType5.ts new file mode 100644 index 0000000000000..1f8bb8dd602a7 --- /dev/null +++ b/tests/cases/fourslash/organizeImportsType5.ts @@ -0,0 +1,29 @@ +/// + +//// import { +//// d, +//// type d as D, +//// type c, +//// c as C, +//// b, +//// b as B, +//// type A, +//// a +//// } from './foo'; +//// console.log(A, a, B, b, c, C, d, D); + +verify.organizeImports( +`import { + type A, + b as B, + c as C, + type d as D, + a, + b, + type c, + d +} from './foo'; +console.log(A, a, B, b, c, C, d, D);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto", organizeImportsTypeOrder: "inline" } +); diff --git a/tests/cases/fourslash/organizeImportsType6.ts b/tests/cases/fourslash/organizeImportsType6.ts new file mode 100644 index 0000000000000..c38fc504e07b1 --- /dev/null +++ b/tests/cases/fourslash/organizeImportsType6.ts @@ -0,0 +1,36 @@ +/// + +//// import { type a, A, b } from "foo"; +//// interface Use extends A {} +//// console.log(a, b); + +verify.organizeImports( +`import { type a, A, b } from "foo"; +interface Use extends A {} +console.log(a, b);`, + /*mode*/ undefined, + { organizeImportsTypeOrder: "inline" }); + +edit.replaceLine(0, 'import { type a, A, b } from "foo1";'); +verify.organizeImports( +`import { type a, A, b } from "foo1"; +interface Use extends A {} +console.log(a, b);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto", organizeImportsTypeOrder: "inline" }); + +edit.replaceLine(0, 'import { type a, A, b } from "foo2";'); +verify.organizeImports( +`import { type a, A, b } from "foo2"; +interface Use extends A {} +console.log(a, b);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder: "inline" }); + +edit.replaceLine(0, 'import { type a, A, b } from "foo3";'); +verify.organizeImports( +`import { A, type a, b } from "foo3"; +interface Use extends A {} +console.log(a, b);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: false, organizeImportsTypeOrder: "inline" }); \ No newline at end of file diff --git a/tests/cases/fourslash/organizeImportsType7.ts b/tests/cases/fourslash/organizeImportsType7.ts new file mode 100644 index 0000000000000..72fd2af92c9db --- /dev/null +++ b/tests/cases/fourslash/organizeImportsType7.ts @@ -0,0 +1,36 @@ +/// + +//// import { a, type A, b } from "foo"; +//// interface Use extends A {} +//// console.log(a, b); + +verify.organizeImports( +`import { a, type A, b } from "foo"; +interface Use extends A {} +console.log(a, b);`, + /*mode*/ undefined, + { organizeImportsTypeOrder: "inline" }); + +edit.replaceLine(0, 'import { a, type A, b } from "foo1";'); +verify.organizeImports( +`import { a, type A, b } from "foo1"; +interface Use extends A {} +console.log(a, b);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto", organizeImportsTypeOrder: "inline" }); + +edit.replaceLine(0, 'import { a, type A, b } from "foo2";'); +verify.organizeImports( +`import { a, type A, b } from "foo2"; +interface Use extends A {} +console.log(a, b);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: true, organizeImportsTypeOrder: "inline"}); + +edit.replaceLine(0, 'import { a, type A, b } from "foo3";'); +verify.organizeImports( +`import { type A, a, b } from "foo3"; +interface Use extends A {} +console.log(a, b);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: false, organizeImportsTypeOrder: "inline" }); \ No newline at end of file diff --git a/tests/cases/fourslash/organizeImportsType8.ts b/tests/cases/fourslash/organizeImportsType8.ts new file mode 100644 index 0000000000000..da43f893431df --- /dev/null +++ b/tests/cases/fourslash/organizeImportsType8.ts @@ -0,0 +1,53 @@ +/// + +//// import { type A, type a, b, B } from "foo"; +//// console.log(a, b, A, B); + +verify.organizeImports( +`import { type A, type a, b, B } from "foo"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto", organizeImportsTypeOrder: "inline" } +); + +edit.replaceLine(0, 'import { type A, type a, b, B } from "foo1";'); +verify.organizeImports( +`import { type A, type a, b, B } from "foo1"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto", organizeImportsTypeOrder: "first" } +); + +edit.replaceLine(0, 'import { type A, type a, b, B } from "foo2";'); +verify.organizeImports( +`import { B, b, type A, type a } from "foo2"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto", organizeImportsTypeOrder: "last" } +); + +// default behavior is { organizeImportsTypeOrder: "last" } + +edit.replaceLine(0, 'import { type A, type a, b, B } from "foo3";'); +verify.organizeImports( +`import { B, b, type A, type a } from "foo3"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto" } +); + +edit.replaceLine(0, 'import { type A, type a, b, B } from "foo4";'); +verify.organizeImports( +`import { b, B, type A, type a } from "foo4"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: true } +); + +edit.replaceLine(0, 'import { type A, type a, b, B } from "foo5";'); +verify.organizeImports( +`import { B, b, type A, type a } from "foo5"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: false } +); \ No newline at end of file diff --git a/tests/cases/fourslash/organizeImportsType9.ts b/tests/cases/fourslash/organizeImportsType9.ts new file mode 100644 index 0000000000000..efe6107e020b6 --- /dev/null +++ b/tests/cases/fourslash/organizeImportsType9.ts @@ -0,0 +1,48 @@ +/// + +//// import { type a, type A, b, B } from "foo"; +//// console.log(a, b, A, B); + +verify.organizeImports( +`import { type a, type A, b, B } from "foo"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto", organizeImportsTypeOrder: "inline" }); + +edit.replaceLine(0, 'import { type a, type A, b, B } from "foo1";'); +verify.organizeImports( +`import { type a, type A, b, B } from "foo1"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto", organizeImportsTypeOrder: "first"} +); + +edit.replaceLine(0, 'import { type a, type A, b, B } from "foo2";'); +verify.organizeImports( +`import { B, b, type A, type a } from "foo2"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto", organizeImportsTypeOrder: "last" } +); + +edit.replaceLine(0, 'import { type a, type A, b, B } from "foo3";'); +verify.organizeImports( +`import { B, b, type A, type a } from "foo3"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: "auto" } +); + +edit.replaceLine(0, 'import { type a, type A, b, B } from "foo4";'); +verify.organizeImports( +`import { b, B, type a, type A } from "foo4"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: true }); + +edit.replaceLine(0, 'import { type a, type A, b, B } from "foo5";'); +verify.organizeImports( +`import { B, b, type A, type a } from "foo5"; +console.log(a, b, A, B);`, + /*mode*/ undefined, + { organizeImportsIgnoreCase: false }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoFromContextualUnionType1.ts b/tests/cases/fourslash/quickInfoFromContextualUnionType1.ts new file mode 100644 index 0000000000000..32031032d2a55 --- /dev/null +++ b/tests/cases/fourslash/quickInfoFromContextualUnionType1.ts @@ -0,0 +1,17 @@ +/// + +// @strict: true +//// // based on https://github.com/microsoft/TypeScript/issues/55495 +//// type X = +//// | { +//// name: string; +//// [key: string]: any; +//// } +//// | { +//// name: "john"; +//// someProp: boolean; +//// }; +//// +//// const obj = { name: "john", /*1*/someProp: "foo" } satisfies X; + +verify.quickInfoAt("1", "(property) someProp: string"); diff --git a/tests/cases/fourslash/quickInfoJsDocTags14.ts b/tests/cases/fourslash/quickInfoJsDocTags14.ts new file mode 100644 index 0000000000000..ee6781e275140 --- /dev/null +++ b/tests/cases/fourslash/quickInfoJsDocTags14.ts @@ -0,0 +1,14 @@ +/// + +/////** +//// * @param {Object} options the args object +//// * @param {number} options.a first number +//// * @param {number} options.b second number +//// * @param {Object} options.c sub-object +//// * @param {number} options.c.d third number +//// * @param {Function} callback the callback function +//// * @returns {number} +//// */ +////function /**/fn(options, callback = null) { } + +verify.baselineQuickInfo(); diff --git a/tests/cases/fourslash/quickInfoJsDocTags15.ts b/tests/cases/fourslash/quickInfoJsDocTags15.ts new file mode 100644 index 0000000000000..aa611224d8e89 --- /dev/null +++ b/tests/cases/fourslash/quickInfoJsDocTags15.ts @@ -0,0 +1,36 @@ +/// + +// @allowJs: true +// @checkJs: true +// @filename: /a.js +/////** +//// * @callback Bar +//// * @param {string} name +//// * @returns {string} +//// */ +//// +/////** +//// * @typedef Foo +//// * @property {Bar} getName +//// */ +////export const foo = 1; + +// @filename: /b.js +////import * as _a from "./a.js"; +/////** +//// * @implements {_a.Foo/*1*/} +//// */ +////class C1 { } +//// +/////** +//// * @extends {_a.Foo/*2*/} +//// */ +////class C2 { } +//// +/////** +//// * @augments {_a.Foo/*3*/} +//// */ +////class C3 { } + +goTo.file("/b.js") +verify.baselineQuickInfo(); diff --git a/tests/cases/fourslash/quickInfoUniqueSymbolJsDoc.ts b/tests/cases/fourslash/quickInfoUniqueSymbolJsDoc.ts new file mode 100644 index 0000000000000..58f9feb625960 --- /dev/null +++ b/tests/cases/fourslash/quickInfoUniqueSymbolJsDoc.ts @@ -0,0 +1,10 @@ +/// + +// @checkJs: true +// @allowJs: true +// @filename: ./a.js +/////** @type {unique symbol} */ +////const foo = Symbol(); +////foo/**/ + +verify.baselineQuickInfo(); diff --git a/tests/cases/fourslash/refactorExtractType89.ts b/tests/cases/fourslash/refactorExtractType89.ts new file mode 100644 index 0000000000000..bb6026cc7a6e0 --- /dev/null +++ b/tests/cases/fourslash/refactorExtractType89.ts @@ -0,0 +1,61 @@ +/// + +//// interface Yadda { x: T } +//// +//// export let blah: Yadda/*a*//*b*/; +//// +//// interface YaddaWithDefault { x: T/*d*/ } + +goTo.marker("a"); +verify.refactorAvailableForTriggerReason("invoked", "Extract type", "Extract to type alias") + +goTo.marker("b"); +edit.applyRefactor({ + triggerReason: "invoked", + refactorName: "Extract type", + actionName: "Extract to type alias", + actionDescription: "Extract to type alias", + newContent: `interface Yadda { x: T } + +type /*RENAME*/NewType = Yadda; + +export let blah: NewType; + +interface YaddaWithDefault { x: T }`, +}); + +goTo.marker("c"); +edit.applyRefactor({ + triggerReason: "invoked", + refactorName: "Extract type", + actionName: "Extract to type alias", + actionDescription: "Extract to type alias", + newContent: `interface Yadda { x: T } + +type NewType = Yadda; + +export let blah: NewType; + +type /*RENAME*/NewType_1 = boolean; + +interface YaddaWithDefault { x: T }` +}); + +goTo.marker("d"); +edit.applyRefactor({ + triggerReason: "invoked", + refactorName: "Extract type", + actionName: "Extract to type alias", + actionDescription: "Extract to type alias", + newContent: `interface Yadda { x: T } + +type NewType = Yadda; + +export let blah: NewType; + +type NewType_1 = boolean; + +type /*RENAME*/NewType_2 = T; + +interface YaddaWithDefault { x: NewType_2 }` +}); diff --git a/tests/cases/fourslash/renameImport.ts b/tests/cases/fourslash/renameImport.ts index 21ec3420462e5..4819098619bfc 100644 --- a/tests/cases/fourslash/renameImport.ts +++ b/tests/cases/fourslash/renameImport.ts @@ -24,9 +24,10 @@ verify.noErrors(); goTo.eachRange(range => { const target = range.marker && range.marker.data && range.marker.data.target; - const name = target === "dir" ? "/dir" : target === "dir/index" ? "/dir/index.ts" : "/a.ts"; + const displayName = target === "dir" ? "./dir" : target === "dir/index" ? "./dir/index" : "./a"; + const fileName = target === "dir" ? "/dir" : target === "dir/index" ? "/dir/index.ts" : "/a.ts"; const kind = target === "dir" ? "directory" : "module"; - verify.renameInfoSucceeded(/*displayName*/ name, /*fullDisplayName*/ name, /*kind*/ kind, /*kindModifiers*/ "", /*fileToRename*/ name, range); + verify.renameInfoSucceeded(/*displayName*/ fileName, /*fullDisplayName*/ displayName, /*kind*/ kind, /*kindModifiers*/ "", /*fileToRename*/ fileName, range); verify.renameInfoFailed("You cannot rename this element.", { allowRenameOfImportPath: false }); }); diff --git a/tests/cases/fourslash/renameJsPropertyAssignment4.ts b/tests/cases/fourslash/renameJsPropertyAssignment4.ts new file mode 100644 index 0000000000000..c436e9d172248 --- /dev/null +++ b/tests/cases/fourslash/renameJsPropertyAssignment4.ts @@ -0,0 +1,11 @@ +/// + +// @allowJs: true +// @Filename: /a.js +////function f() { +//// var /*1*/foo = this; +//// /*2*/foo.x = 1; +////} + +goTo.file("/a.js") +verify.baselineRename(["1", "2"]); diff --git a/tests/cases/fourslash/server/autoImportProvider_importsMap1.ts b/tests/cases/fourslash/server/autoImportProvider_importsMap1.ts new file mode 100644 index 0000000000000..02f6072753d16 --- /dev/null +++ b/tests/cases/fourslash/server/autoImportProvider_importsMap1.ts @@ -0,0 +1,32 @@ +/// + +// @Filename: /tsconfig.json +//// { +//// "compilerOptions": { +//// "module": "nodenext", +//// "rootDir": "src", +//// "outDir": "dist" +//// } +//// } + +// @Filename: /package.json +//// { +//// "type": "module", +//// "imports": { +//// "#is-browser": { +//// "browser": "./dist/env/browser.js", +//// "default": "./dist/env/node.js" +//// } +//// } +//// } + +// @Filename: /src/env/browser.ts +//// export const isBrowser = true; + +// @Filename: /src/env/node.ts +//// export const isBrowser = false; + +// @Filename: /src/a.ts +//// isBrowser/**/ + +verify.importFixModuleSpecifiers("", ["./env/browser.js", "#is-browser"]); \ No newline at end of file diff --git a/tests/cases/fourslash/server/autoImportProvider_importsMap2.ts b/tests/cases/fourslash/server/autoImportProvider_importsMap2.ts new file mode 100644 index 0000000000000..934823091e79b --- /dev/null +++ b/tests/cases/fourslash/server/autoImportProvider_importsMap2.ts @@ -0,0 +1,26 @@ +/// + +// @Filename: /tsconfig.json +//// { +//// "compilerOptions": { +//// "module": "nodenext", +//// "rootDir": "src", +//// "outDir": "dist" +//// } +//// } + +// @Filename: /package.json +//// { +//// "type": "module", +//// "imports": { +//// "#internal/*": "./dist/internal/*" +//// } +//// } + +// @Filename: /src/internal/foo.ts +//// export function something(name: string) {} + +// @Filename: /src/a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#internal/foo.js"]); \ No newline at end of file diff --git a/tests/cases/fourslash/server/autoImportProvider_importsMap3.ts b/tests/cases/fourslash/server/autoImportProvider_importsMap3.ts new file mode 100644 index 0000000000000..d10e697685315 --- /dev/null +++ b/tests/cases/fourslash/server/autoImportProvider_importsMap3.ts @@ -0,0 +1,26 @@ +/// + +// @Filename: /tsconfig.json +//// { +//// "compilerOptions": { +//// "module": "nodenext", +//// "rootDir": "src", +//// "outDir": "dist" +//// } +//// } + +// @Filename: /package.json +//// { +//// "type": "module", +//// "imports": { +//// "#internal/": "./dist/internal/" +//// } +//// } + +// @Filename: /src/internal/foo.ts +//// export function something(name: string) {} + +// @Filename: /src/a.ts +//// something/**/ + +verify.importFixModuleSpecifiers("", ["#internal/foo.js"]); \ No newline at end of file diff --git a/tests/cases/fourslash/server/autoImportProvider_importsMap4.ts b/tests/cases/fourslash/server/autoImportProvider_importsMap4.ts new file mode 100644 index 0000000000000..11921f3fe52e6 --- /dev/null +++ b/tests/cases/fourslash/server/autoImportProvider_importsMap4.ts @@ -0,0 +1,29 @@ +/// + +// @Filename: /tsconfig.json +//// { +//// "compilerOptions": { +//// "module": "nodenext", +//// "rootDir": "src", +//// "outDir": "dist" +//// } +//// } + +// @Filename: /package.json +//// { +//// "type": "module", +//// "imports": { +//// "#is-browser": { +//// "types": "./dist/env/browser.d.ts", +//// "default": "./dist/env/browser.js" +//// } +//// } +//// } + +// @Filename: /src/env/browser.ts +//// export const isBrowser = true; + +// @Filename: /src/a.ts +//// isBrowser/**/ + +verify.importFixModuleSpecifiers("", ["#is-browser"]); \ No newline at end of file diff --git a/tests/cases/fourslash/server/autoImportProvider_importsMap5.ts b/tests/cases/fourslash/server/autoImportProvider_importsMap5.ts new file mode 100644 index 0000000000000..6f360f6b3bf51 --- /dev/null +++ b/tests/cases/fourslash/server/autoImportProvider_importsMap5.ts @@ -0,0 +1,30 @@ +/// + +// @Filename: /tsconfig.json +//// { +//// "compilerOptions": { +//// "module": "nodenext", +//// "rootDir": "src", +//// "outDir": "dist", +//// "declarationDir": "types", +//// } +//// } + +// @Filename: /package.json +//// { +//// "type": "module", +//// "imports": { +//// "#is-browser": { +//// "types": "./types/env/browser.d.ts", +//// "default": "./not-dist-on-purpose/env/browser.js" +//// } +//// } +//// } + +// @Filename: /src/env/browser.ts +//// export const isBrowser = true; + +// @Filename: /src/a.ts +//// isBrowser/**/ + +verify.importFixModuleSpecifiers("", ["#is-browser"]); \ No newline at end of file diff --git a/tests/cases/fourslash/server/autoImportProvider_wildcardExports1.ts b/tests/cases/fourslash/server/autoImportProvider_wildcardExports1.ts index 1c1f30f6ca509..d18e6cead0a1e 100644 --- a/tests/cases/fourslash/server/autoImportProvider_wildcardExports1.ts +++ b/tests/cases/fourslash/server/autoImportProvider_wildcardExports1.ts @@ -89,6 +89,7 @@ verify.completions({ sortText: completion.SortText.AutoImportSuggestions } ], + excludes: ["NOT_REACHABLE"], preferences: { includeCompletionsForModuleExports: true, allowIncompleteCompletions: true diff --git a/tests/cases/fourslash/server/autoImportProvider_wildcardExports3.ts b/tests/cases/fourslash/server/autoImportProvider_wildcardExports3.ts new file mode 100644 index 0000000000000..f5aa9020e0be8 --- /dev/null +++ b/tests/cases/fourslash/server/autoImportProvider_wildcardExports3.ts @@ -0,0 +1,55 @@ +/// + +// @Filename: /project/packages/ui/package.json +//// { +//// "name": "@repo/ui", +//// "version": "1.0.0", +//// "exports": { +//// "./*": "./src/*.tsx" +//// } +//// } + +// @Filename: /project/packages/ui/src/Card.tsx +//// export const Card = () => null; + +// @Filename: /project/apps/web/package.json +//// { +//// "name": "web", +//// "version": "1.0.0", +//// "dependencies": { +//// "@repo/ui": "workspace:*" +//// } +//// } + +// @Filename: /project/apps/web/tsconfig.json +//// { +//// "compilerOptions": { +//// "module": "esnext", +//// "moduleResolution": "bundler", +//// "noEmit": true, +//// "jsx": "preserve" +//// }, +//// "include": ["app"] +//// } + +// @Filename: /project/apps/web/app/index.tsx +//// (); + +// @link: /project/packages/ui -> /project/apps/web/node_modules/@repo/ui + +goTo.marker(""); +verify.completions({ + includes: [ + { + name: "Card", + source: "@repo/ui/Card", + sourceDisplay: "@repo/ui/Card", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, + ], + preferences: { + includeCompletionsForModuleExports: true, + allowIncompleteCompletions: true + } +});