Merge branch 'main' into copilot/fix-62127

This commit is contained in:
Jake Bailey
2025-09-25 13:18:52 -07:00
8805 changed files with 60099 additions and 109184 deletions
+1
View File
@@ -9,3 +9,4 @@ jakebailey
DanielRosenwasser
navya9singh
iisaduan
johnfav03
@@ -1,4 +1,4 @@
name: Accept Baselines and Fix Lints
name: Accept Baselines, Fix Lints, and Format
on:
workflow_dispatch: {}
@@ -17,10 +17,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
@@ -32,8 +32,9 @@ jobs:
git rm -r --quiet tests/baselines/reference
npx hereby runtests-parallel --ci --fix || true
npx hereby baseline-accept
npx hereby format
git add ./src
git add ./tests/baselines/reference
git diff --cached
git commit -m "Update Baselines and/or Applied Lint Fixes"
git commit -m "Update Baselines, Applied Lint Fixes, and/or Formatted"
git push
+148 -52
View File
@@ -9,6 +9,10 @@ on:
branches:
- main
- release-*
merge_group:
branches:
- main
# - release-*
permissions:
contents: read
@@ -24,43 +28,107 @@ jobs:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
node-version:
- '22'
- '20'
- '18'
- '16'
- '14'
bundle:
- 'true'
include:
- node-version: 'lts/*'
bundle: false
os: ubuntu-latest
exclude:
# No Node 14 on ARM macOS
- node-version: '14'
os: macos-latest
config:
# Main builds
- os: ubuntu-latest
node-version: '24'
bundle: true
runs-on: ${{ matrix.os }}
name: Test Node ${{ matrix.node-version }} on ${{ matrix.os }}${{ (!matrix.bundle && ' with --no-bundle') || '' }}
# Other builds (skipped in merge queues)
- os: windows-latest
node-version: '24'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
- os: macos-latest
node-version: '24'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: '22'
bundle: true
- os: windows-latest
node-version: '22'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
# Skip macOS for this version; resources are limited.
# - os: macos-latest
# node-version: '22'
# bundle: true
# skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: '20'
bundle: true
- os: windows-latest
node-version: '20'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
# Skip macOS for this version; resources are limited.
# - os: macos-latest
# node-version: '20'
# bundle: true
# skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: '18'
bundle: true
- os: windows-latest
node-version: '18'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
# Skip macOS for this version; resources are limited.
# - os: macos-latest
# node-version: '18'
# bundle: true
# skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: '16'
bundle: true
- os: windows-latest
node-version: '16'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
- os: macos-latest
node-version: '16'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: '14'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
- os: windows-latest
node-version: '14'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
# No Node 14 on ARM macOS
# - os: macos-latest
# node-version: '14'
# bundle: true
# skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: 'lts/*'
bundle: false
skip: ${{ github.event_name == 'merge_group' }}
exclude:
- config:
skip: true
runs-on: ${{ matrix.config.os }}
name: Test Node ${{ matrix.config.node-version }} on ${{ matrix.config.os }}${{ (!matrix.config.bundle && ' with --no-bundle') || '' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use node version ${{ matrix.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Use node version ${{ matrix.config.node-version }}
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.config.node-version }}
check-latest: true
- run: npm ci
- name: Tests
id: test
# run tests, but lint separately
run: npm run test -- --no-lint --bundle=${{ matrix.bundle }}
run: npm run test -- --no-lint --bundle=${{ matrix.config.bundle }}
- name: Print baseline diff on failure
if: ${{ failure() && steps.test.conclusion == 'failure' }}
@@ -70,6 +138,8 @@ jobs:
git diff --staged --exit-code
coverage:
if: ${{ github.event_name != 'merge_group' }}
runs-on:
- 'self-hosted'
- '1ES.Pool=TypeScript-1ES-GitHub-Large'
@@ -80,8 +150,8 @@ jobs:
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
@@ -95,7 +165,7 @@ jobs:
name: coverage
path: coverage
- uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
disable_search: true
@@ -105,8 +175,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
@@ -118,8 +188,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
@@ -131,13 +201,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
- uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ~/.cache/dprint
key: ${{ runner.os }}-dprint-${{ hashFiles('package-lock.json', '.dprint.jsonc') }}
@@ -151,8 +221,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
@@ -167,8 +237,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
@@ -180,9 +250,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
@@ -221,16 +291,16 @@ jobs:
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: pr
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: base
ref: ${{ github.base_ref }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
@@ -262,8 +332,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
@@ -278,8 +348,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
@@ -294,11 +364,13 @@ jobs:
run: npx hereby build-src --built
baselines:
if: ${{ github.event_name != 'merge_group' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
@@ -338,3 +410,27 @@ jobs:
with:
name: fix_baselines.patch
path: fix_baselines.patch
required:
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- test
- coverage
- lint
- knip
- format
- browser-integration
- typecheck
- smoke
- package-size
- misc
- self-check
- baselines
steps:
- name: Check required jobs
env:
NEEDS: ${{ toJson(needs) }}
run: |
! echo $NEEDS | jq -e 'to_entries[] | { job: .key, result: .value.result } | select((.result == "success" or .result == "skipped") | not)'
+4 -4
View File
@@ -42,11 +42,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
uses: github/codeql-action/init@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3.30.1
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@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
uses: github/codeql-action/autobuild@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3.30.1
# ℹ️ 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@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
uses: github/codeql-action/analyze@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3.30.1
+2 -2
View File
@@ -15,8 +15,8 @@ jobs:
# You can define any steps you want, and they will run before the agent starts.
# If you do not check out your code, Copilot will do this for you.
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
- run: npm ci
# pull dprint caches before network access is blocked
- run: npx hereby check-format || true
+2 -2
View File
@@ -47,13 +47,13 @@ jobs:
if: github.repository == 'microsoft/TypeScript'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
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/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
id: open-pr
env:
PR: ${{ inputs.pr }}
+4 -4
View File
@@ -20,8 +20,8 @@ jobs:
if: github.repository == 'microsoft/TypeScript'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
@@ -42,8 +42,8 @@ jobs:
if: github.repository == 'microsoft/TypeScript'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
# Use NODE_AUTH_TOKEN environment variable to authenticate to this registry.
+2 -2
View File
@@ -27,11 +27,11 @@ jobs:
exit 1
fi
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ inputs.branch_name }}
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
+2 -2
View File
@@ -50,12 +50,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
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@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
+4 -4
View File
@@ -21,8 +21,8 @@ jobs:
if: github.repository == 'microsoft/TypeScript'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
@@ -42,8 +42,8 @@ jobs:
if: github.repository == 'microsoft/TypeScript'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
# Use NODE_AUTH_TOKEN environment variable to authenticate to this registry.
+1 -1
View File
@@ -108,7 +108,7 @@ jobs:
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+=" For some extra review, we'll ping @sheetalkamat, @mjbvz, 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
@@ -19,8 +19,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
+2 -2
View File
@@ -29,7 +29,7 @@ jobs:
steps:
- name: 'Checkout code'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
@@ -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@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
uses: github/codeql-action/upload-sarif@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3.30.1
with:
sarif_file: results.sarif
+2 -2
View File
@@ -49,11 +49,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ inputs.branch_name }}
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
+2 -2
View File
@@ -42,10 +42,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ inputs.branch_name }}
filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
- name: Get repo name
run: R=${GITHUB_REPOSITORY%?wiki}; echo "BASENAME=${R##*/}" >> $GITHUB_ENV
- name: Checkout ${{ env.BASENAME }}-wiki
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: '${{ GITHUB.repository_owner }}/${{ env.BASENAME }}-wiki'
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
+3 -3
View File
@@ -51,13 +51,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- if: ${{ github.event.inputs.bisect }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
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.
- if: ${{ !github.event.inputs.bisect }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- uses: microsoft/TypeScript-Twoslash-Repro-Action@master
+2 -2
View File
@@ -22,10 +22,10 @@ jobs:
if: github.repository == 'microsoft/TypeScript'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
+1 -1
View File
@@ -52,7 +52,7 @@ const libs = memoize(() => {
/** @type {{ libs: string[]; paths: Record<string, string | undefined>; }} */
const libraries = readJson("./src/lib/libs.json");
const libs = libraries.libs.map(lib => {
const relativeSources = ["header.d.ts", lib + ".d.ts"];
const relativeSources = [lib + ".d.ts"];
const relativeTarget = libraries.paths && libraries.paths[lib] || ("lib." + lib + ".d.ts");
const sources = relativeSources.map(s => path.posix.join("src/lib", s));
const target = `built/local/${relativeTarget}`;
+1806 -1290
View File
File diff suppressed because it is too large Load Diff
+19 -20
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "5.9.0",
"version": "6.0.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
@@ -42,46 +42,45 @@
"@dprint/formatter": "^0.4.1",
"@dprint/typescript": "0.93.4",
"@esfx/canceltoken": "^1.0.0",
"@eslint/js": "^9.20.0",
"@eslint/js": "^9.33.0",
"@octokit/rest": "^21.1.1",
"@types/chai": "^4.3.20",
"@types/diff": "^7.0.1",
"@types/minimist": "^1.2.5",
"@types/mocha": "^10.0.10",
"@types/ms": "^0.7.34",
"@types/node": "latest",
"@types/source-map-support": "^0.5.10",
"@types/which": "^3.0.4",
"@typescript-eslint/rule-tester": "^8.24.1",
"@typescript-eslint/type-utils": "^8.24.1",
"@typescript-eslint/utils": "^8.24.1",
"azure-devops-node-api": "^14.1.0",
"@typescript-eslint/rule-tester": "^8.39.1",
"@typescript-eslint/type-utils": "^8.39.1",
"@typescript-eslint/utils": "^8.39.1",
"azure-devops-node-api": "^15.1.1",
"c8": "^10.1.3",
"chai": "^4.5.0",
"chokidar": "^4.0.3",
"diff": "^7.0.0",
"dprint": "^0.49.0",
"esbuild": "^0.25.0",
"eslint": "^9.20.1",
"diff": "^8.0.2",
"dprint": "^0.49.1",
"esbuild": "^0.25.9",
"eslint": "^9.33.0",
"eslint-formatter-autolinkable-stylish": "^1.4.0",
"eslint-plugin-regexp": "^2.7.0",
"fast-xml-parser": "^4.5.2",
"eslint-plugin-regexp": "^2.10.0",
"fast-xml-parser": "^5.2.5",
"glob": "^10.4.5",
"globals": "^15.15.0",
"hereby": "^1.10.0",
"globals": "^16.3.0",
"hereby": "^1.11.0",
"jsonc-parser": "^3.3.1",
"knip": "^5.44.4",
"knip": "^5.62.0",
"minimist": "^1.2.8",
"mocha": "^10.8.2",
"mocha-fivemat-progress-reporter": "^0.1.0",
"monocart-coverage-reports": "^2.12.1",
"monocart-coverage-reports": "^2.12.6",
"ms": "^2.1.3",
"picocolors": "^1.1.1",
"playwright": "^1.50.1",
"playwright": "^1.54.2",
"source-map-support": "^0.5.21",
"tslib": "^2.8.1",
"typescript": "^5.7.3",
"typescript-eslint": "^8.24.1",
"typescript": "^5.9.2",
"typescript-eslint": "^8.39.1",
"which": "^3.0.1"
},
"overrides": {
+1 -1
View File
@@ -412,7 +412,7 @@ function createBuilderProgramState(
if (canCopySemanticDiagnostics) {
if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics) return;
if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics) return;
if (newProgram.isSourceFileDefaultLibrary(sourceFile) && !copyLibFileDiagnostics) return;
// Unchanged file copy diagnostics
const diagnostics = oldState!.semanticDiagnosticsPerFile.get(sourceFilePath);
+13 -8
View File
@@ -338,6 +338,7 @@ import {
getMembersOfDeclaration,
getModifiers,
getModuleInstanceState,
getModuleSpecifierOfBareOrAccessedRequire,
getNameFromImportAttribute,
getNameFromIndexInfo,
getNameOfDeclaration,
@@ -710,6 +711,7 @@ import {
isPrivateIdentifier,
isPrivateIdentifierClassElementDeclaration,
isPrivateIdentifierPropertyAccessExpression,
isPrivateIdentifierSymbol,
isPropertyAccessEntityNameExpression,
isPropertyAccessExpression,
isPropertyAccessOrQualifiedName,
@@ -1529,7 +1531,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
var noUncheckedSideEffectImports = !!compilerOptions.noUncheckedSideEffectImports;
var noUncheckedSideEffectImports = compilerOptions.noUncheckedSideEffectImports !== false;
var checkBinaryExpression = createCheckBinaryExpression();
var emitResolver = createResolver();
@@ -4682,9 +4684,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
}
function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression, ignoreErrors?: boolean): Symbol | undefined {
function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression, ignoreErrors?: boolean, errorMessage?: DiagnosticMessage): Symbol | undefined {
const isClassic = getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Classic;
const errorMessage = isClassic ?
errorMessage ??= isClassic ?
Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option
: Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? undefined : errorMessage, ignoreErrors);
@@ -4712,7 +4714,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
? location
: (isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)?.name ||
(isLiteralImportTypeNode(location) ? location : undefined)?.argument.literal ||
(isVariableDeclaration(location) && location.initializer && isRequireCall(location.initializer, /*requireStringLiteralLikeArgument*/ true) ? location.initializer.arguments[0] : undefined) ||
isVariableDeclarationInitializedToBareOrAccessedRequire(location) && getModuleSpecifierOfBareOrAccessedRequire(location) ||
findAncestor(location, isImportCall)?.arguments[0] ||
findAncestor(location, or(isImportDeclaration, isJSDocImportTag, isExportDeclaration))?.moduleSpecifier ||
findAncestor(location, isExternalModuleImportEqualsDeclaration)?.moduleReference.expression;
@@ -7610,6 +7612,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (getDeclarationModifierFlagsFromSymbol(propertySymbol) & (ModifierFlags.Private | ModifierFlags.Protected) && context.tracker.reportPrivateInBaseOfClassExpression) {
context.tracker.reportPrivateInBaseOfClassExpression(unescapeLeadingUnderscores(propertySymbol.escapedName));
}
if (isPrivateIdentifierSymbol(propertySymbol) && context.tracker.reportPrivateInBaseOfClassExpression) {
context.tracker.reportPrivateInBaseOfClassExpression(idText((propertySymbol.valueDeclaration! as NamedDeclaration).name! as PrivateIdentifier));
}
}
if (checkTruncationLength(context) && (i + 2 < properties.length - 1)) {
context.out.truncated = true;
@@ -21499,7 +21504,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
let issuedElaboration = false;
if (!targetProp) {
const indexInfo = getApplicableIndexInfo(target, nameType);
if (indexInfo && indexInfo.declaration && !getSourceFileOfNode(indexInfo.declaration).hasNoDefaultLib) {
if (indexInfo && indexInfo.declaration && !host.isSourceFileDefaultLibrary(getSourceFileOfNode(indexInfo.declaration))) {
issuedElaboration = true;
addRelatedInfo(reportedDiag, createDiagnosticForNode(indexInfo.declaration, Diagnostics.The_expected_type_comes_from_this_index_signature));
}
@@ -21507,7 +21512,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (!issuedElaboration && (targetProp && length(targetProp.declarations) || target.symbol && length(target.symbol.declarations))) {
const targetNode = targetProp && length(targetProp.declarations) ? targetProp.declarations![0] : target.symbol.declarations![0];
if (!getSourceFileOfNode(targetNode).hasNoDefaultLib) {
if (!host.isSourceFileDefaultLibrary(getSourceFileOfNode(targetNode))) {
addRelatedInfo(
reportedDiag,
createDiagnosticForNode(
@@ -37998,7 +38003,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const exprType = checkExpression(expression, checkMode);
if (isConstTypeReference(type)) {
if (!isValidConstAssertionArgument(expression)) {
error(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
error(expression, Diagnostics.A_const_assertion_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
}
return getRegularTypeOfLiteralType(exprType);
}
@@ -48511,7 +48516,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
}
else if (noUncheckedSideEffectImports && !importClause) {
void resolveExternalModuleName(node, node.moduleSpecifier);
void resolveExternalModuleName(node, node.moduleSpecifier, /*ignoreErrors*/ undefined, Diagnostics.Cannot_find_module_or_type_declarations_for_side_effect_import_of_0);
}
}
checkImportAttributes(node);
+2 -2
View File
@@ -873,7 +873,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
affectsProgramStructure: true,
category: Diagnostics.Language_and_Environment,
description: Diagnostics.Enable_lib_replacement,
defaultValueDescription: true,
defaultValueDescription: false,
},
// Strict Type Checks
@@ -1243,7 +1243,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
affectsBuildInfo: true,
category: Diagnostics.Modules,
description: Diagnostics.Check_side_effect_imports,
defaultValueDescription: false,
defaultValueDescription: true,
},
// Source Maps
+6 -6
View File
@@ -1063,8 +1063,8 @@ export function rangeEquals<T>(array1: readonly T[], array2: readonly T[], pos:
*
* @internal
*/
export const elementAt: <T>(array: readonly T[] | undefined, offset: number) => T | undefined = !!Array.prototype.at
? (array, offset) => array?.at(offset)
export const elementAt: <T>(array: readonly T[] | undefined, offset: number) => T | undefined = !!(Array.prototype as any).at
? (array, offset) => (array as any)?.at(offset)
: (array, offset) => {
if (array !== undefined) {
offset = toOffset(array, offset);
@@ -1623,7 +1623,7 @@ export function createSet<TElement, THash = number>(getHashCode: (element: TElem
const multiMap = new Map<THash, TElement | TElement[]>();
let size = 0;
function* getElementIterator(): IterableIterator<TElement> {
function* getElementIterator(): SetIterator<TElement> {
for (const value of multiMap.values()) {
if (isArray(value)) {
yield* value;
@@ -1722,13 +1722,13 @@ export function createSet<TElement, THash = number>(getHashCode: (element: TElem
}
}
},
keys(): IterableIterator<TElement> {
keys(): SetIterator<TElement> {
return getElementIterator();
},
values(): IterableIterator<TElement> {
values(): SetIterator<TElement> {
return getElementIterator();
},
*entries(): IterableIterator<[TElement, TElement]> {
*entries(): SetIterator<[TElement, TElement]> {
for (const value of getElementIterator()) {
yield [value, value];
}
+1 -1
View File
@@ -1,6 +1,6 @@
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configurePrerelease` too.
export const versionMajorMinor = "5.9";
export const versionMajorMinor = "6.0";
// The following is baselined as a literal template type without intervention
/** The version of the TypeScript compiler release */
export const version: string = `${versionMajorMinor}.0-dev`;
+6 -2
View File
@@ -1155,7 +1155,7 @@
"category": "Error",
"code": 1354
},
"A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals.": {
"A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals.": {
"category": "Error",
"code": 1355
},
@@ -4007,6 +4007,10 @@
"category": "Error",
"code": 2881
},
"Cannot find module or type declarations for side-effect import of '{0}'.": {
"category": "Error",
"code": 2882
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
@@ -4661,7 +4665,7 @@
"category": "Error",
"code": 5094
},
"Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.": {
"Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.": {
"category": "Error",
"code": 5095
},
+3 -7
View File
@@ -4286,18 +4286,14 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
}
function emitSyntheticTripleSlashReferencesIfNeeded(node: Bundle) {
emitTripleSlashDirectives(!!node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || [], node.syntheticLibReferences || []);
emitTripleSlashDirectives(node.syntheticFileReferences || [], node.syntheticTypeReferences || [], node.syntheticLibReferences || []);
}
function emitTripleSlashDirectivesIfNeeded(node: SourceFile) {
if (node.isDeclarationFile) emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives, node.libReferenceDirectives);
if (node.isDeclarationFile) emitTripleSlashDirectives(node.referencedFiles, node.typeReferenceDirectives, node.libReferenceDirectives);
}
function emitTripleSlashDirectives(hasNoDefaultLib: boolean, files: readonly FileReference[], types: readonly FileReference[], libs: readonly FileReference[]) {
if (hasNoDefaultLib) {
writeComment(`/// <reference no-default-lib="true"/>`);
writeLine();
}
function emitTripleSlashDirectives(files: readonly FileReference[], types: readonly FileReference[], libs: readonly FileReference[]) {
if (currentSourceFile && currentSourceFile.moduleName) {
writeComment(`/// <amd-module name="${currentSourceFile.moduleName}" />`);
writeLine();
+2 -4
View File
@@ -6181,16 +6181,15 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
isDeclarationFile = node.isDeclarationFile,
referencedFiles = node.referencedFiles,
typeReferenceDirectives = node.typeReferenceDirectives,
hasNoDefaultLib = node.hasNoDefaultLib,
_hasNoDefaultLib = false,
libReferenceDirectives = node.libReferenceDirectives,
) {
return node.statements !== statements
|| node.isDeclarationFile !== isDeclarationFile
|| node.referencedFiles !== referencedFiles
|| node.typeReferenceDirectives !== typeReferenceDirectives
|| node.hasNoDefaultLib !== hasNoDefaultLib
|| node.libReferenceDirectives !== libReferenceDirectives
? update(cloneSourceFileWithChanges(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, hasNoDefaultLib, libReferenceDirectives), node)
? update(cloneSourceFileWithChanges(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, /*hasNoDefaultLib*/ false, libReferenceDirectives), node)
: node;
}
@@ -6201,7 +6200,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
node.syntheticFileReferences = undefined;
node.syntheticTypeReferences = undefined;
node.syntheticLibReferences = undefined;
node.hasNoDefaultLib = undefined;
return node;
}
+14 -1
View File
@@ -112,6 +112,16 @@ export function createParenthesizerRules(factory: NodeFactory): ParenthesizerRul
return parenthesizerRule;
}
function mixingBinaryOperatorsRequiresParentheses(a: SyntaxKind, b: SyntaxKind) {
if (a === SyntaxKind.QuestionQuestionToken) {
return b === SyntaxKind.AmpersandAmpersandToken || b === SyntaxKind.BarBarToken;
}
if (b === SyntaxKind.QuestionQuestionToken) {
return a === SyntaxKind.AmpersandAmpersandToken || a === SyntaxKind.BarBarToken;
}
return false;
}
/**
* Determines whether the operand to a BinaryExpression needs to be parenthesized.
*
@@ -121,6 +131,10 @@ export function createParenthesizerRules(factory: NodeFactory): ParenthesizerRul
* BinaryExpression.
*/
function binaryOperandNeedsParentheses(binaryOperator: SyntaxKind, operand: Expression, isLeftSideOfBinary: boolean, leftOperand: Expression | undefined) {
const emittedOperand = skipPartiallyEmittedExpressions(operand);
if (isBinaryExpression(emittedOperand) && mixingBinaryOperatorsRequiresParentheses(binaryOperator, emittedOperand.operatorToken.kind)) {
return true;
}
// If the operand has lower precedence, then it needs to be parenthesized to preserve the
// intent of the expression. For example, if the operand is `a + b` and the operator is
// `*`, then we need to parenthesize the operand to preserve the intended order of
@@ -140,7 +154,6 @@ export function createParenthesizerRules(factory: NodeFactory): ParenthesizerRul
// the intended order of operations: `(a ** b) ** c`
const binaryOperatorPrecedence = getOperatorPrecedence(SyntaxKind.BinaryExpression, binaryOperator);
const binaryOperatorAssociativity = getOperatorAssociativity(SyntaxKind.BinaryExpression, binaryOperator);
const emittedOperand = skipPartiallyEmittedExpressions(operand);
if (!isLeftSideOfBinary && operand.kind === SyntaxKind.ArrowFunction && binaryOperatorPrecedence > OperatorPrecedence.Assignment) {
// We need to parenthesize arrow functions on the right side to avoid it being
// parsed as parenthesized expression: `a && (() => {})`
+4 -2
View File
@@ -2812,7 +2812,9 @@ function getLoadModuleFromTargetExportOrImport(extensions: Extensions, state: Mo
const subTarget = (target as MapLike<unknown>)[condition];
const result = loadModuleFromTargetExportOrImport(subTarget, subpath, pattern, key);
if (result) {
traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
if (result.value) {
traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
}
traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return result;
}
@@ -2846,7 +2848,7 @@ function getLoadModuleFromTargetExportOrImport(extensions: Extensions, state: Mo
if (state.traceEnabled) {
trace(state.host, Diagnostics.package_json_scope_0_explicitly_maps_specifier_1_to_null, scope.packageDirectory, moduleName);
}
return toSearchResult(/*value*/ undefined);
return { value: undefined };
}
if (state.traceEnabled) {
trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
+1 -2
View File
@@ -10617,7 +10617,6 @@ export function processPragmasIntoFields(context: PragmaContext, reportDiagnosti
context.typeReferenceDirectives = [];
context.libReferenceDirectives = [];
context.amdDependencies = [];
context.hasNoDefaultLib = false;
context.pragmas!.forEach((entryOrList, key) => { // TODO: GH#18217
// TODO: The below should be strongly type-guarded and not need casts/explicit annotations, since entryOrList is related to
// key and key is constrained to a union; but it's not (see GH#21483 for at least partial fix) :(
@@ -10630,7 +10629,7 @@ export function processPragmasIntoFields(context: PragmaContext, reportDiagnosti
const { types, lib, path, ["resolution-mode"]: res, preserve: _preserve } = arg.arguments;
const preserve = _preserve === "true" ? true : undefined;
if (arg.arguments["no-default-lib"] === "true") {
context.hasNoDefaultLib = true;
// This has been removed; parse but ignore it.
}
else if (types) {
const parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic);
+30 -66
View File
@@ -71,8 +71,6 @@ import {
EmitResult,
emptyArray,
ensureTrailingDirectorySeparator,
equateStringsCaseInsensitive,
equateStringsCaseSensitive,
exclusivelyPrefixedNodeCoreModules,
ExportAssignment,
ExportDeclaration,
@@ -1577,7 +1575,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
const host = createProgramOptionsHost || createCompilerHost(options);
const configParsingHost = parseConfigHostFromCompilerHostLike(host);
let skipDefaultLib = options.noLib;
const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
const defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(getDefaultLibraryFileName());
@@ -1708,6 +1705,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
* - undefined otherwise
*/
const filesByName = new Map<Path, SourceFile | false | undefined>();
const libFiles = new Set<Path>();
let missingFileNames = new Map<Path, string>();
// stores 'filename -> file association' ignoring case
// used to track cases when two file names differ only in casing
@@ -1779,7 +1777,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
}
tracing?.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length });
forEach(rootNames, (name, index) => processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, { kind: FileIncludeKind.RootFile, index }));
forEach(rootNames, (name, index) => processRootFile(name, /*isDefaultLib*/ false, { kind: FileIncludeKind.RootFile, index }));
tracing?.pop();
// load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders
@@ -1808,20 +1806,17 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
tracing?.pop();
}
// Do not process the default library if:
// - The '--noLib' flag is used.
// - A 'no-default-lib' reference comment is encountered in
// processing the root files.
if (rootNames.length && !skipDefaultLib) {
if (rootNames.length && !options.noLib) {
// If '--lib' is not specified, include default library file according to '--target'
// otherwise, using options specified in '--lib' instead of '--target' default library file
const defaultLibraryFileName = getDefaultLibraryFileName();
if (!options.lib && defaultLibraryFileName) {
processRootFile(defaultLibraryFileName, /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false, { kind: FileIncludeKind.LibFile });
libFiles.add(toPath(defaultLibraryFileName));
processRootFile(defaultLibraryFileName, /*isDefaultLib*/ true, { kind: FileIncludeKind.LibFile });
}
else {
forEach(options.lib, (libFileName, index) => {
processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false, { kind: FileIncludeKind.LibFile, index });
processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, { kind: FileIncludeKind.LibFile, index });
});
}
}
@@ -2453,11 +2448,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
// 'lib' references has changed. Matches behavior in changesAffectModuleResolution
structureIsReused = StructureIsReused.SafeModules;
}
else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
// value of no-default-lib has changed
// this will affect if default library is injected into the list of files
structureIsReused = StructureIsReused.SafeModules;
}
// check tripleslash references
else if (!arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
// tripleslash references has changed
@@ -2683,31 +2673,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
}
function isSourceFileDefaultLibrary(file: SourceFile): boolean {
if (!file.isDeclarationFile) {
return false;
}
if (file.hasNoDefaultLib) {
return true;
}
if (options.noLib) {
return false;
}
// If '--lib' is not specified, include default library file according to '--target'
// otherwise, using options specified in '--lib' instead of '--target' default library file
const equalityComparer = host.useCaseSensitiveFileNames() ? equateStringsCaseSensitive : equateStringsCaseInsensitive;
if (!options.lib) {
return equalityComparer(file.fileName, getDefaultLibraryFileName());
}
else {
return some(options.lib, libFileName => {
// We might not have resolved lib if one of the root file included contained no-default-lib = true
const resolvedLib = resolvedLibReferences!.get(libFileName);
return !!resolvedLib && equalityComparer(file.fileName, resolvedLib.actual);
});
}
return libFiles.has(file.path);
}
function getTypeChecker() {
@@ -3317,8 +3283,8 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
return configFileParsingDiagnostics || emptyArray;
}
function processRootFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, reason: FileIncludeReason) {
processSourceFile(normalizePath(fileName), isDefaultLib, ignoreNoDefaultLib, /*packageId*/ undefined, reason);
function processRootFile(fileName: string, isDefaultLib: boolean, reason: FileIncludeReason) {
processSourceFile(normalizePath(fileName), isDefaultLib, /*packageId*/ undefined, reason);
}
function fileReferenceIsEqualTo(a: FileReference, b: FileReference): boolean {
@@ -3512,17 +3478,17 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
}
/** This has side effects through `findSourceFile`. */
function processSourceFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, packageId: PackageId | undefined, reason: FileIncludeReason): void {
function processSourceFile(fileName: string, isDefaultLib: boolean, packageId: PackageId | undefined, reason: FileIncludeReason): void {
getSourceFileFromReferenceWorker(
fileName,
fileName => findSourceFile(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId), // TODO: GH#18217
fileName => findSourceFile(fileName, isDefaultLib, reason, packageId), // TODO: GH#18217
(diagnostic, ...args) => addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, diagnostic, args),
reason,
);
}
function processProjectReferenceFile(fileName: string, reason: ProjectReferenceFile) {
return processSourceFile(fileName, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined, reason);
return processSourceFile(fileName, /*isDefaultLib*/ false, /*packageId*/ undefined, reason);
}
function reportFileNamesDifferOnlyInCasingError(fileName: string, existingFile: SourceFile, reason: FileIncludeReason): void {
@@ -3548,13 +3514,13 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
}
// Get source file from normalized fileName
function findSourceFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, reason: FileIncludeReason, packageId: PackageId | undefined): SourceFile | undefined {
function findSourceFile(fileName: string, isDefaultLib: boolean, reason: FileIncludeReason, packageId: PackageId | undefined): SourceFile | undefined {
tracing?.push(tracing.Phase.Program, "findSourceFile", {
fileName,
isDefaultLib: isDefaultLib || undefined,
fileIncludeKind: (FileIncludeKind as any)[reason.kind],
});
const result = findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId);
const result = findSourceFileWorker(fileName, isDefaultLib, reason, packageId);
tracing?.pop();
return result;
}
@@ -3571,7 +3537,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
{ languageVersion, impliedNodeFormat: result, setExternalModuleIndicator, jsDocParsingMode: host.jsDocParsingMode };
}
function findSourceFileWorker(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, reason: FileIncludeReason, packageId: PackageId | undefined): SourceFile | undefined {
function findSourceFileWorker(fileName: string, isDefaultLib: boolean, reason: FileIncludeReason, packageId: PackageId | undefined): SourceFile | undefined {
const path = toPath(fileName);
if (useSourceOfProjectReferenceRedirect) {
let source = getRedirectFromOutput(path);
@@ -3590,7 +3556,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
if (realPath !== path) source = getRedirectFromOutput(realPath);
}
if (source?.source) {
const file = findSourceFile(source.source, isDefaultLib, ignoreNoDefaultLib, reason, packageId);
const file = findSourceFile(source.source, isDefaultLib, reason, packageId);
if (file) addFileToFilesByName(file, path, fileName, /*redirectedPath*/ undefined);
return file;
}
@@ -3712,8 +3678,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
}
}
skipDefaultLib = skipDefaultLib || (file.hasNoDefaultLib && !ignoreNoDefaultLib);
if (!options.noResolve) {
processReferencedFiles(file, isDefaultLib);
processTypeReferenceDirectives(file);
@@ -3793,7 +3757,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
processSourceFile(
resolveTripleslashReference(ref.fileName, file.fileName),
isDefaultLib,
/*ignoreNoDefaultLib*/ false,
/*packageId*/ undefined,
{ kind: FileIncludeKind.ReferenceFile, file: file.path, index },
);
@@ -3846,7 +3809,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
if (resolvedTypeReferenceDirective.isExternalLibraryImport) currentNodeModulesDepth++;
// resolved from the primary path
processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, reason); // TODO: GH#18217
processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, reason); // TODO: GH#18217
if (resolvedTypeReferenceDirective.isExternalLibraryImport) currentNodeModulesDepth--;
}
@@ -3860,6 +3823,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
if (existing) return existing.actual;
const result = pathForLibFileWorker(libFileName);
(resolvedLibReferences ??= new Map()).set(libFileName, result);
libFiles.add(toPath(result.actual));
return result.actual;
}
@@ -3867,7 +3831,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
const existing = resolvedLibProcessing?.get(libFileName);
if (existing) return existing;
if (options.libReplacement === false) {
if (!options.libReplacement) {
const result: LibResolution = {
resolution: {
resolvedModule: undefined,
@@ -3924,8 +3888,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
forEach(file.libReferenceDirectives, (libReference, index) => {
const libFileName = getLibFileNameFromLibReference(libReference);
if (libFileName) {
// we ignore any 'no-default-lib' reference set on this file.
processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true, { kind: FileIncludeKind.LibReferenceDirective, file: file.path, index });
processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, { kind: FileIncludeKind.LibReferenceDirective, file: file.path, index });
}
else {
programDiagnostics.addFileProcessingDiagnostic({
@@ -3995,7 +3958,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
findSourceFile(
resolvedFileName,
/*isDefaultLib*/ false,
/*ignoreNoDefaultLib*/ false,
{ kind: FileIncludeKind.Import, file: file.path, index },
resolution.packageId,
);
@@ -4083,10 +4045,9 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
}
const getCommonSourceDirectory = memoize(() => getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()));
commandLine.fileNames.forEach(fileName => {
if (isDeclarationFileName(fileName)) return;
const path = toPath(fileName);
let outputDts;
if (!fileExtensionIs(fileName, Extension.Json)) {
if (!isDeclarationFileName(fileName) && !fileExtensionIs(fileName, Extension.Json)) {
if (!commandLine.options.outFile) {
outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory);
mapOutputFileToResolvedRef!.set(toPath(outputDts), { resolvedRef, source: fileName });
@@ -4371,8 +4332,8 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
}
if (moduleResolution === ModuleResolutionKind.Bundler && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== ModuleKind.Preserve) {
createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "bundler");
if (moduleResolution === ModuleResolutionKind.Bundler && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== ModuleKind.Preserve && moduleKind !== ModuleKind.CommonJS) {
createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later, "bundler");
}
if (
@@ -4436,10 +4397,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
function getIgnoreDeprecationsVersion(): Version {
const ignoreDeprecations = options.ignoreDeprecations;
if (ignoreDeprecations) {
// While we could do Version.tryParse here to support any version,
// for now, only allow "5.0". We aren't planning on deprecating anything
// until 6.0.
if (ignoreDeprecations === "5.0") {
if (ignoreDeprecations === "5.0" || ignoreDeprecations === "6.0") {
return new Version(ignoreDeprecations);
}
reportInvalidIgnoreDeprecations();
@@ -4527,6 +4485,12 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
createDeprecatedDiagnostic("preserveValueImports", /*value*/ undefined, "verbatimModuleSyntax");
}
});
checkDeprecations("6.0", "7.0", createDiagnostic, createDeprecatedDiagnostic => {
if (options.moduleResolution === ModuleResolutionKind.Node10) {
createDeprecatedDiagnostic("moduleResolution", "node10");
}
});
}
function verifyDeprecatedProjectReference(ref: ProjectReference, parentFile: JsonSourceFile | undefined, index: number) {
+1 -4
View File
@@ -462,11 +462,9 @@ export function transformDeclarations(context: TransformationContext): Transform
rawReferencedFiles = [];
rawTypeReferenceDirectives = [];
rawLibReferenceDirectives = [];
let hasNoDefaultLib = false;
const bundle = factory.createBundle(
map(node.sourceFiles, sourceFile => {
if (sourceFile.isDeclarationFile) return undefined!; // Omit declaration files from bundle results, too // TODO: GH#18217
hasNoDefaultLib = hasNoDefaultLib || sourceFile.hasNoDefaultLib;
currentSourceFile = sourceFile;
enclosingDeclaration = sourceFile;
lateMarkedStatements = undefined;
@@ -504,7 +502,6 @@ export function transformDeclarations(context: TransformationContext): Transform
bundle.syntheticFileReferences = getReferencedFiles(outputFilePath);
bundle.syntheticTypeReferences = getTypeReferences();
bundle.syntheticLibReferences = getLibReferences();
bundle.hasNoDefaultLib = hasNoDefaultLib;
return bundle;
}
@@ -536,7 +533,7 @@ export function transformDeclarations(context: TransformationContext): Transform
}
}
const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(node, host, /*forceDtsPaths*/ true).declarationFilePath!));
return factory.updateSourceFile(node, combinedStatements, /*isDeclarationFile*/ true, getReferencedFiles(outputFilePath), getTypeReferences(), node.hasNoDefaultLib, getLibReferences());
return factory.updateSourceFile(node, combinedStatements, /*isDeclarationFile*/ true, getReferencedFiles(outputFilePath), getTypeReferences(), /*hasNoDefaultLib*/ false, getLibReferences());
function collectFileReferences(sourceFile: SourceFile) {
rawReferencedFiles = concatenate(rawReferencedFiles, map(sourceFile.referencedFiles, f => [sourceFile, f]));
+4 -11
View File
@@ -4288,7 +4288,6 @@ export interface SourceFileLike {
lineMap?: readonly number[];
/** @internal */
getPositionOfLineAndCharacter?(line: number, character: number, allowEdits?: true): number;
languageVariant?: LanguageVariant;
}
/** @internal */
@@ -4363,14 +4362,7 @@ export interface SourceFile extends Declaration, LocalsContainer {
/** @internal */
renamedDependencies?: ReadonlyMap<string, string>;
/**
* lib.d.ts should have a reference comment like
*
* /// <reference no-default-lib="true"/>
*
* If any other file has this comment, it signals not to include lib.d.ts
* because this containing file is intended to act as a default library.
*/
/** @deprecated Always false. Use a Program to determine if a file is a lib file. */
hasNoDefaultLib: boolean;
languageVersion: ScriptTarget;
@@ -4471,7 +4463,6 @@ export interface ReadonlyPragmaContext {
typeReferenceDirectives: readonly FileReference[];
libReferenceDirectives: readonly FileReference[];
amdDependencies: readonly AmdDependency[];
hasNoDefaultLib?: boolean;
moduleName?: string;
}
@@ -4505,7 +4496,6 @@ export interface Bundle extends Node {
/** @internal */ syntheticFileReferences?: readonly FileReference[];
/** @internal */ syntheticTypeReferences?: readonly FileReference[];
/** @internal */ syntheticLibReferences?: readonly FileReference[];
/** @internal */ hasNoDefaultLib?: boolean;
}
export interface JsonSourceFile extends SourceFile {
@@ -7330,6 +7320,9 @@ export enum ModuleResolutionKind {
* Use the new name or consider switching to a modern module resolution target.
*/
NodeJs = 2,
/**
* @deprecated
*/
Node10 = 2,
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
// to better support ECMAScript modules and their use within node - however more features are still being added.
+21 -11
View File
@@ -3824,6 +3824,20 @@ export function isBindingElementOfBareOrAccessedRequire(node: Node): node is Bin
return isBindingElement(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
}
/** @internal */
export function getModuleSpecifierOfBareOrAccessedRequire(node: VariableDeclarationInitializedTo<RequireOrImportCall | AccessExpression>): StringLiteralLike | undefined {
if (isVariableDeclarationInitializedToRequire(node)) {
return node.initializer.arguments[0];
}
if (isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
const leftmost = getLeftmostAccessExpression(node.initializer);
if (isRequireCall(leftmost, /*requireStringLiteralLikeArgument*/ true)) {
return leftmost.arguments[0];
}
}
return undefined;
}
function isVariableDeclarationInitializedWithRequireHelper(node: Node, allowAccessedRequire: boolean) {
return isVariableDeclaration(node) &&
!!node.initializer &&
@@ -8994,9 +9008,6 @@ const _computedOptions = createComputedCompilerOptions({
let moduleResolution = compilerOptions.moduleResolution;
if (moduleResolution === undefined) {
switch (_computedOptions.module.computeValue(compilerOptions)) {
case ModuleKind.CommonJS:
moduleResolution = ModuleResolutionKind.Node10;
break;
case ModuleKind.Node16:
case ModuleKind.Node18:
case ModuleKind.Node20:
@@ -9005,6 +9016,7 @@ const _computedOptions = createComputedCompilerOptions({
case ModuleKind.NodeNext:
moduleResolution = ModuleResolutionKind.NodeNext;
break;
case ModuleKind.CommonJS:
case ModuleKind.Preserve:
moduleResolution = ModuleResolutionKind.Bundler;
break;
@@ -10329,6 +10341,7 @@ export function rangeOfTypeParameters(sourceFile: SourceFile, typeParameters: No
/** @internal */
export interface HostWithIsSourceOfProjectReferenceRedirect {
isSourceOfProjectReferenceRedirect(fileName: string): boolean;
isSourceFileDefaultLibrary(file: SourceFile): boolean;
}
/** @internal */
export function skipTypeChecking(
@@ -10355,10 +10368,9 @@ function skipTypeCheckingWorker(
ignoreNoCheck: boolean,
) {
// If skipLibCheck is enabled, skip reporting errors if file is a declaration file.
// If skipDefaultLibCheck is enabled, skip reporting errors if file contains a
// '/// <reference no-default-lib="true"/>' directive.
// If skipDefaultLibCheck is enabled, skip reporting errors if file is a lib.
return (options.skipLibCheck && sourceFile.isDeclarationFile ||
options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib) ||
options.skipDefaultLibCheck && host.isSourceFileDefaultLibrary(sourceFile)) ||
(!ignoreNoCheck && options.noCheck) ||
host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) ||
!canIncludeBindAndCheckDiagnostics(sourceFile, options);
@@ -12028,7 +12040,7 @@ export function isSideEffectImport(node: Node): boolean {
return !!ancestor && !ancestor.importClause;
}
// require('module').builtinModules.filter(x => !x.startsWith('_'))
// require('module').builtinModules.filter(x => !x.match(/^(?:_|node:)/))
const unprefixedNodeCoreModulesList = [
"assert",
"assert/strict",
@@ -12071,7 +12083,6 @@ const unprefixedNodeCoreModulesList = [
"stream/web",
"string_decoder",
"sys",
"test/mock_loader",
"timers",
"timers/promises",
"tls",
@@ -12090,11 +12101,10 @@ const unprefixedNodeCoreModulesList = [
/** @internal */
export const unprefixedNodeCoreModules: Set<string> = new Set(unprefixedNodeCoreModulesList);
// await fetch('https://nodejs.org/docs/latest/api/all.json').then(r => r.text()).then(t =>
// new Set(t.match(/(?<=')node:.+?(?=')/g))
// .difference(new Set(require('module').builtinModules.map(x => `node:${x}`))))
// require('module').builtinModules.filter(x => x.startsWith('node:'))
/** @internal */
export const exclusivelyPrefixedNodeCoreModules: Set<string> = new Set([
"node:quic",
"node:sea",
"node:sqlite",
"node:test",
+16 -19
View File
@@ -423,26 +423,23 @@ export class TestState {
this.addMatchedInputFile(importedFilePath, exts);
});
// Check if no-default-lib flag is false and if so add default library
if (!resolvedResult.isLibFile) {
this.languageServiceAdapterHost.addScript(
libName(Harness.Compiler.defaultLibFileName),
Harness.Compiler.getDefaultLibrarySourceFile()!.text,
/*isRootFile*/ false,
);
this.languageServiceAdapterHost.addScript(
libName(Harness.Compiler.defaultLibFileName),
Harness.Compiler.getDefaultLibrarySourceFile()!.text,
/*isRootFile*/ false,
);
compilationOptions.lib?.forEach(fileName => {
const libFile = Harness.Compiler.getDefaultLibrarySourceFile(fileName);
ts.Debug.assertIsDefined(libFile, `Could not find lib file '${fileName}'`);
if (libFile) {
this.languageServiceAdapterHost.addScript(
libName(fileName),
libFile.text,
/*isRootFile*/ false,
);
}
});
}
compilationOptions.lib?.forEach(fileName => {
const libFile = Harness.Compiler.getDefaultLibrarySourceFile(fileName);
ts.Debug.assertIsDefined(libFile, `Could not find lib file '${fileName}'`);
if (libFile) {
this.languageServiceAdapterHost.addScript(
libName(fileName),
libFile.text,
/*isRootFile*/ false,
);
}
});
}
else {
// resolveReference file-option is not specified then do not resolve any files and include all inputFiles
+2 -2
View File
@@ -5,11 +5,11 @@ import * as ts from "./_namespaces/ts.js";
// this will work in the browser via browserify
declare global {
// Module transform: converted from ambient declaration
var assert: typeof chai.assert; // eslint-disable-line no-var
var assert: typeof chai.assert;
}
declare global {
// Module transform: converted from ambient declaration
var expect: typeof chai.expect; // eslint-disable-line no-var
var expect: typeof chai.expect;
}
globalThis.assert = chai.assert;
{
+11 -4
View File
@@ -233,7 +233,7 @@ export namespace Compiler {
export const es2015DefaultLibFileName = "lib.es2015.d.ts";
// Cache of lib files from "built/local"
export let libFileNameSourceFileMap: Map<string, ts.SourceFile> | undefined;
export let libFileNameSourceFileMap: Map<string, { file: ts.SourceFile; stringified: string; }> | undefined;
export function getDefaultLibrarySourceFile(fileName: string = defaultLibFileName): ts.SourceFile | undefined {
if (!isDefaultLibraryFile(fileName)) {
@@ -241,16 +241,19 @@ export namespace Compiler {
}
if (!libFileNameSourceFileMap) {
const file = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + "lib.es5.d.ts")!, /*languageVersion*/ ts.ScriptTarget.Latest);
libFileNameSourceFileMap = new Map(Object.entries({
[defaultLibFileName]: createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + "lib.es5.d.ts")!, /*languageVersion*/ ts.ScriptTarget.Latest),
[defaultLibFileName]: { file, stringified: JSON.stringify(file.text) },
}));
}
let sourceFile = libFileNameSourceFileMap.get(fileName);
if (!sourceFile) {
libFileNameSourceFileMap.set(fileName, sourceFile = createSourceFileAndAssertInvariants(fileName, IO.readFile(libFolder + fileName)!, ts.ScriptTarget.Latest));
const file = createSourceFileAndAssertInvariants(fileName, IO.readFile(libFolder + fileName)!, ts.ScriptTarget.Latest);
sourceFile = { file, stringified: JSON.stringify(file.text) };
libFileNameSourceFileMap.set(fileName, sourceFile);
}
return sourceFile;
return sourceFile.file;
}
export function getDefaultLibFileName(options: ts.CompilerOptions): string {
@@ -418,6 +421,10 @@ export namespace Compiler {
// Files from tests\lib that are requested by "@libFiles"
if (options.libFiles) {
for (const fileName of options.libFiles.split(",")) {
if (fileName === "lib.d.ts" && !options.noLib) {
// Hack from Corsa.
continue;
}
programFileNames.push(vpath.combine(vfs.testLibFolder, fileName));
}
}
+2 -2
View File
@@ -144,8 +144,8 @@ function sanitizeHarnessLSException(s: string) {
export function sanitizeLibFileText(s: string): string {
Compiler.libFileNameSourceFileMap?.forEach((lib, fileName) => {
s = replaceAll(s, JSON.stringify(lib.text), `${fileName}-Text`);
s = replaceAll(s, lib.text, `${fileName}-Text`);
s = replaceAll(s, lib.stringified, `${fileName}-Text`);
s = replaceAll(s, lib.file.text, `${fileName}-Text`);
});
return s;
}
+2
View File
@@ -356,6 +356,8 @@ interface Float16ArrayConstructor {
new (length?: number): Float16Array<ArrayBuffer>;
new (array: ArrayLike<number> | Iterable<number>): Float16Array<ArrayBuffer>;
new <TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(buffer: TArrayBuffer, byteOffset?: number, length?: number): Float16Array<TArrayBuffer>;
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float16Array<ArrayBuffer>;
new (array: ArrayLike<number> | ArrayBuffer): Float16Array<ArrayBuffer>;
/**
* The size in bytes of each element in the array.
-1
View File
@@ -1 +0,0 @@
/// <reference no-default-lib="true"/>
@@ -6060,20 +6060,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[当“module”设置为“preserve”时,CommonJS 模块中不允许使用 ESM 语法。]]></Val>
<Val><![CDATA[ECMAScript 导入和导出不能写入 "verbatimModuleSyntax" 下的 CommonJS 文件中。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[启用“verbatimModuleSyntax”时,CommonJS 模块中不允许使用 ESM 语法。]]></Val>
<Val><![CDATA[ECMAScript 导入和导出不能写入 "verbatimModuleSyntax" 下的 CommonJS 文件中。调整最近的 "package.json" 中的 "type" 字段,将此文件设置为 ECMAScript 模块,或调整 TypeScript 中的 "verbatimModuleSyntax"、"module" 和 "moduleResolution" 设置。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[当 "module" 设置为 "preserve" 时,CommonJS 模块中不允许使用 ECMAScript 模块语法。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10545,11 +10554,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[只有在“module”设置为“preserve”或“es2015”或更高版本时,才能使用选项“{0}”。]]></Val>
<Val><![CDATA[只有在 "module" 设置为 "preserve"、"commonjs"、"es2015" 或更高版本时,才能使用选项“{0}”。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6060,20 +6060,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[當 'module' 設定為 'preserve' 時,CommonJS 模組中不允許 ESM 語法。]]></Val>
<Val><![CDATA[無法在 'verbatimModuleSyntax' 底下的 CommonJS 檔案中撰寫 ECMAScript 匯入和匯出。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[啟用 'verbatimModuleSyntax' 時,CommonJS 模組中不允許 ESM 語法。]]></Val>
<Val><![CDATA[無法在 'verbatimModuleSyntax' 底下的 CommonJS 檔案中撰寫 ECMAScript 匯入和匯出。請調整最近的 'package.json' 中的 'type' 欄位,將此檔案設為 ECMAScript 模組,或調整 TypeScript 中的 'verbatimModuleSyntax'、'module' 和 'moduleResolution' 設定。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[當 'module' 設定為 'preserve' 時,CommonJS 模組中不允許 ECMAScript 模組語法。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10545,11 +10554,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[只有當 'module' 設定為 'preserve'、'es2015' 或更新版本時,才能使用 '{0}' 選項。]]></Val>
<Val><![CDATA[只有當 'module' 設定為 'preserve'、'commonjs' 或 'es2015' 或更新版本時,才能使用選項 '{0}'。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6069,20 +6069,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Když je možnost „module“ nastavená na „preserve“, v modulu CommonJS se nepovoluje syntaxe ESM.]]></Val>
<Val><![CDATA[Importy a exporty ECMAScript nelze zapsat do souboru CommonJS v části verbatimModuleSyntax.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Když je povolená syntaxe „verbatimModuleSyntax“, není v modulu CommonJS povolená syntaxe ESM.]]></Val>
<Val><![CDATA[Importy a exporty ECMAScript nelze zapsat do souboru CommonJS v části verbatimModuleSyntax. Upravte pole type v nejbližším souboru package.json tak, aby tento soubor byl modulem ECMAScript, případně upravte nastavení verbatimModuleSyntax, module a moduleResolution v TypeScriptu.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Syntaxe modulu ECMAScript není v modulu CommonJS povolená, pokud je možnost module nastavená na preserve.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10554,11 +10563,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Možnost „{0}“ se dá použít jenom v případě, že je možnost „modul“ nastavená na „preserve“ nebo na „es2015“ a novější.]]></Val>
<Val><![CDATA[Možnost „{0}“ se dá použít jenom v případě, že je možnost „modul“ nastavená na „preserve“, „commonjs“ nebo na „es2015“ a novější.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6057,20 +6057,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Die ESM-Syntax ist in einem CommonJS-Modul nicht zulässig, wenn "module" auf "preserve" festgelegt ist.]]></Val>
<Val><![CDATA[ECMAScript-Importe und -Exporte können nicht in eine CommonJS-Datei unter „verbatimModuleSyntax“ geschrieben werden.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Die ESM-Syntax ist in einem CommonJS-Modul nicht zulässig, wenn "verbatimModuleSyntax" aktiviert ist.]]></Val>
<Val><![CDATA[ECMAScript-Importe und -Exporte können nicht in eine CommonJS-Datei unter „verbatimModuleSyntax“ geschrieben werden. Passen Sie das Feld „type“ im nächsten „package.json“ an, um diese Datei zu einem ECMAScript-Modul zu machen, oder passen Sie die Einstellungen „verbatimModuleSyntax“, „module“ und „moduleResolution“ in TypeScript an.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Die ECMAScript-Modulsyntax ist in einem CommonJS-Modul nicht zulässig, wenn „module“ auf „preserve“ festgelegt ist.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10542,11 +10551,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Die Option "{0}" kann nur verwendet werden, wenn "module" auf "preserve" oder auf "es2015" oder höher festgelegt ist.]]></Val>
<Val><![CDATA[Die Option „{0}“ kann nur verwendet werden, wenn „module“ auf „preserve“, „commonjs“, „es2015“ oder höher festgelegt ist.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6072,20 +6072,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[No se permite la sintaxis ESM en un módulo CommonJS cuando "module" está establecido en "preserve".]]></Val>
<Val><![CDATA[Las importaciones y exportaciones de ECMAScript no se pueden escribir en un archivo CommonJS en "verbatimModuleSyntax".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[No se permite la sintaxis ESM en un módulo CommonJS cuando "verbatimModuleSyntax" está habilitado.]]></Val>
<Val><![CDATA[Las importaciones y exportaciones de ECMAScript no se pueden escribir en un archivo CommonJS en "verbatimModuleSyntax". Ajuste el campo "type" en el "package.json" más cercano para convertir este archivo en un módulo ECMAScript o ajuste la configuración "verbatimModuleSyntax", "module" y "moduleResolution" en TypeScript.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[No se permite la sintaxis del módulo ECMAScript en un módulo CommonJS cuando "module" está establecido en "preserve".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10557,11 +10566,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La opción “{0}” solo se puede usar cuando “module” está establecido en “preserve” o en “es2015” o posterior.]]></Val>
<Val><![CDATA[La opción "{0}" solo se puede usar cuando "module" está establecido en "preserve", en "commonjs" o en "es2015" o posterior.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6072,20 +6072,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La syntaxe ESM n’est pas autorisée dans un module CommonJS quand « module » a la valeur « preserve ».]]></Val>
<Val><![CDATA[Les importations et exportations ECMAScript ne peuvent pas être écrites dans un fichier CommonJS sous 'verbatimModuleSyntax'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La syntaxe ESM n'est pas autorisée dans un module CommonJS lorsque « verbatimModuleSyntax » est activé.]]></Val>
<Val><![CDATA[Les importations et exportations ECMAScript ne peuvent pas être écrites dans un fichier CommonJS sous 'verbatimModuleSyntax'. Ajustez le champ 'type' dans le 'package.json' le plus proche pour faire de ce fichier un module ECMAScript, ou ajustez vos paramètres 'verbatimModuleSyntax', 'module' et 'moduleResolution' dans TypeScript.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La syntaxe du module ECMAScript n’est pas autorisée dans un module CommonJS quand 'module' est défini sur 'preserve'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10557,11 +10566,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[L’option '{0}' ne peut être utilisée que lorsque 'module' a la valeur 'preserve' ou 'es2015' ou version ultérieure.]]></Val>
<Val><![CDATA[L’option « {0} » ne peut être utilisée que lorsque « module » a la valeur « preserve », « commonjs » ou « es2015 » ou une version ultérieure.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6060,20 +6060,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Sintassi ESM non consentita in un modulo CommonJS quando 'module' è impostato su 'preserve'.]]></Val>
<Val><![CDATA[Le importazioni e le esportazioni di ECMAScript non possono essere scritte in un file CommonJS in "verbatimModuleSyntax".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Sintassi ESM non consentita in un modulo CommonJS quando 'verbatimModuleSyntax' è abilitato.]]></Val>
<Val><![CDATA[Le importazioni e le esportazioni di ECMAScript non possono essere scritte in un file CommonJS in "verbatimModuleSyntax". Modificare il campo "type" nel "package.json" più vicino per rendere questo file un modulo ECMAScript oppure modificare le impostazioni "verbatimModuleSyntax", "module" e "moduleResolution" in TypeScript.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La sintassi del modulo ECMAScript non è consentita in un modulo CommonJS quando "module" è impostato su "preserve".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10545,9 +10554,9 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[L'opzione '{0}' può essere usata solo quando 'module' è impostato su 'preserve' o 'es2015' o versione successiva.]]></Val>
</Tgt>
@@ -6060,20 +6060,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['module' が 'preserve' に設定されている場合、CommonJS モジュールでは ESM 構文を使用できません。]]></Val>
<Val><![CDATA[ECMAScript のインポートとエクスポートは、CommonJS ファイルの 'verbatimModuleSyntax' の下に書き込むことができません。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['verbatimModuleSyntax' が有効である場合、CommonJS モジュールで ESM 構文は許可されません。]]></Val>
<Val><![CDATA[ECMAScript のインポートとエクスポートは、CommonJS ファイルの 'verbatimModuleSyntax' の下に書き込むことができません。最も近い 'package.json' の 'type' フィールドを調整してこのファイルを ECMAScript モジュールにするか、TypeScript で 'verbatimModuleSyntax'、'module'、'moduleResolution' の設定を調整します。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['module' が 'preserve' に設定されている場合、CommonJS モジュールでは ECMAScript モジュール構文を使用できません。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10545,11 +10554,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[オプション '{0}' は、'module' が 'preserve' または 'es2015' 以降に設定されている場合にのみ使用できます。]]></Val>
<Val><![CDATA[オプション '{0}' は、'module' が 'preserve'、'commonjs'、または 'es2015' 以降に設定されている場合にのみ使用できます。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6060,20 +6060,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['module'이 'preserve'로 설정된 경우 CommonJS 모듈에서는 ESM 구문을 사용할 수 없습니다.]]></Val>
<Val><![CDATA[ECMAScript 가져오기 및 내보내기를 'verbatimModuleSyntax' 아래의 CommonJS 파일에 쓸 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['verbatimModuleSyntax'를 사용하도록 설정한 경우 CommonJS 모듈에서는 ESM 구문을 사용할 수 없습니다.]]></Val>
<Val><![CDATA[ECMAScript 가져오기 및 내보내기를 'verbatimModuleSyntax' 아래의 CommonJS 파일에 쓸 수 없습니다. 가장 가까운 'package.json'에서 'type' 필드를 조정하여 이 파일을 ECMAScript 모듈로 만들거나 TypeScript에서 'verbatimModuleSyntax', 'module' 및 'moduleResolution' 설정을 조정합니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['module'이 'preserve'로 설정된 경우 CommonJS 모듈에서는 ECMAScript 모듈 구문을 사용할 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10545,11 +10554,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' 옵션은 'module'이 'preserve' 또는 'es2015' 이상으로 설정된 경우에만 사용할 수 있습니다.]]></Val>
<Val><![CDATA['{0}' 옵션은 'module'이 'preserve', 'commonjs', 또는 'es2015' 이상으로 설정된 경우에만 사용할 수 있습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6050,20 +6050,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Składnia ESM jest niedozwolona w module CommonJS, gdy element „module” jest ustawiony na wartość „preserve”.]]></Val>
<Val><![CDATA[Importów i eksportów ECMAScript nie można zapisać w pliku CommonJS w obszarze „verbatimModuleSyntax”.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Składnia ESM jest niedozwolona w module CommonJS, gdy jest włączona opcja „verbatimModuleSyntax”.]]></Val>
<Val><![CDATA[Importów i eksportów ECMAScript nie można zapisać w pliku CommonJS w obszarze „verbatimModuleSyntax”. Dostosuj pole „type” w najbliższej lokalizacji „package.json”, aby ustawić ten plik jako moduł ECMAScript, lub dostosuj ustawienia „verbatimModuleSyntax”, „module” i „moduleResolution” w języku TypeScript.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Składnia modułu ECMAScript jest niedozwolona w module CommonJS, gdy element „module” jest ustawiony na wartość „preserve”.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10535,11 +10544,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Opcji „{0}” można używać tylko wtedy, gdy element „module” ma wartość „preserve” lub „es2015” lub nowszą.]]></Val>
<Val><![CDATA[Opcji „{0}” można używać tylko wtedy, gdy element „module” ma wartość „preserve”, „commonjs” lub „es2015” lub nowszą.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6053,20 +6053,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[A sintaxe ESM não é permitida em um módulo CommonJS quando 'module' estiver definido como 'preserve'.]]></Val>
<Val><![CDATA[Importações e exportações ECMAScript não podem ser gravadas em um arquivo CommonJS em "texttimModuleSyntax".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[A sintaxe ESM não é permitida em um módulo CommonJS quando a opção "verbatimModuleSyntax" estiver habilitada.]]></Val>
<Val><![CDATA[Importações e exportações ECMAScript não podem ser gravadas em um arquivo CommonJS em "texttimModuleSyntax". Ajuste o campo "type" no "package.json" mais próximo para tornar esse arquivo um módulo ECMAScript ou ajuste as configurações "texttimModuleSyntax", "module" e "moduleResolution" no TypeScript.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[A sintaxe do módulo ECMAScript não é permitida em um módulo CommonJS quando "module" está definido como "preserve".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10538,11 +10547,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[A opção '{0}' só pode ser usada quando 'module' está definido como 'preserve' ou 'es2015' ou posterior.]]></Val>
<Val><![CDATA[A opção "{0}" só pode ser usada quando "module" estiver definido como "preserve", "commonjs" ou "es2015" ou posterior.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6059,20 +6059,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Синтаксис ESM не разрешен в модуле CommonJS, если для параметра "модуль" установлено значение "сохранить".]]></Val>
<Val><![CDATA[Импорты и экспорты ECMAScript невозможно записать в файл CommonJS в разделе "verbatimModuleSyntax".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Синтаксис ESM не разрешен в модуле CommonJS, если включен "verbatimModuleSyntax".]]></Val>
<Val><![CDATA[Импорты и экспорты ECMAScript невозможно записать в файл CommonJS в разделе "verbatimModuleSyntax". Измените поле "type" в ближайшем файле "package.json", чтобы сделать этот файл модулем ECMAScript, или настройте параметры "verbatimModuleSyntax", "module" и "moduleResolution" в TypeScript.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Синтаксис модуля ECMAScript не разрешен в модуле CommonJS, если для параметра "module" установлено значение "preserve".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10544,11 +10553,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Параметр "{0}" можно использовать только в том случае, если для параметра "module" установлено значение "preserve" или "es2015" или более поздней версии.]]></Val>
<Val><![CDATA[Опцию "{0}" можно использовать только в том случае, если для параметра "module" установлено значение "preserve", "commonjs", "es2015" или более поздней версии.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -6053,20 +6053,29 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['Module', 'preserve' olarak ayarlandığında CommonJS modülünde ESM sözdizimine izin verilmez.]]></Val>
<Val><![CDATA[ECMAScript içeri ve dışarı aktarma işlemleri, 'verbatimModuleSyntax' altında bir CommonJS dosyasına yazılamaz.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.]]></Val>
<Val><![CDATA[ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['verbatimModuleSyntax' etkinleştirildiğinde CommonJS modülünde ESM söz dizimi kullanılamaz.]]></Val>
<Val><![CDATA[ECMAScript içeri ve dışarı aktarma işlemleri, 'verbatimModuleSyntax' altında bir CommonJS dosyasına yazılamaz. Bu dosyayı ECMAScript modülü yapmak için en yakın 'package.json' dosyasındaki 'type' alanını düzenleyin veya TypeScript'teki 'verbatimModuleSyntax', 'module' ve 'moduleResolution' ayarlarınızı düzenleyin.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['Module', 'preserve' olarak ayarlandığında CommonJS modülünde ECMAScript modülü sözdizimine izin verilmez.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10538,11 +10547,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.]]></Val>
<Val><![CDATA[Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' seçeneği, yalnızca 'module' değeri 'preserve', 'es2015' veya üzeri olarak ayarlandığında kullanılabilir.]]></Val>
<Val><![CDATA['{0}' seçeneği yalnızca 'module' 'preserve', 'commonjs' veya 'es2015' ya da daha yeni bir değere ayarlandığında kullanılabilir.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
+1
View File
@@ -3269,6 +3269,7 @@ export const enum ModuleResolutionKind {
Node = "node",
/** @deprecated Renamed to `Node10` */
NodeJs = "node",
/** @deprecated */
Node10 = "node10",
Node16 = "node16",
NodeNext = "nodenext",
+8 -8
View File
@@ -1595,7 +1595,7 @@ function getJsxClosingTagCompletion(location: Node | undefined, sourceFile: Sour
switch (node.kind) {
case SyntaxKind.JsxClosingElement:
return true;
case SyntaxKind.LessThanSlashToken:
case SyntaxKind.SlashToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.Identifier:
case SyntaxKind.PropertyAccessExpression:
@@ -3508,7 +3508,7 @@ function getCompletionData(
}
break;
case SyntaxKind.LessThanSlashToken:
case SyntaxKind.SlashToken:
if (currentToken.parent.kind === SyntaxKind.JsxSelfClosingElement) {
location = currentToken;
}
@@ -3518,7 +3518,7 @@ function getCompletionData(
switch (parent.kind) {
case SyntaxKind.JsxClosingElement:
if (contextToken.kind === SyntaxKind.LessThanSlashToken) {
if (contextToken.kind === SyntaxKind.SlashToken) {
isStartingCloseTag = true;
location = contextToken;
}
@@ -4185,10 +4185,6 @@ function getCompletionData(
return charactersFuzzyMatchInString(symbolName, lowerCaseTokenText);
},
(info, symbolName, isFromAmbientModule, exportMapKey) => {
if (detailsEntryId && !some(info, i => detailsEntryId.source === stripQuotes(i.moduleSymbol.name))) {
return;
}
// Do a relatively cheap check to bail early if all re-exports are non-importable
// due to file location or package.json dependency filtering. For non-node16+
// module resolution modes, getting past this point guarantees that we'll be
@@ -4217,6 +4213,10 @@ function getCompletionData(
({ exportInfo = info[0], moduleSpecifier } = result);
}
if (detailsEntryId && (detailsEntryId.source !== moduleSpecifier && !some(info, i => detailsEntryId.source === stripQuotes(i.moduleSymbol.name)))) {
return;
}
const isDefaultExport = exportInfo.exportKind === ExportKind.Default;
const symbol = isDefaultExport && getLocalSymbolForExportDefault(Debug.checkDefined(exportInfo.symbol)) || Debug.checkDefined(exportInfo.symbol);
@@ -5809,7 +5809,7 @@ function isValidTrigger(sourceFile: SourceFile, triggerCharacter: CompletionsTri
case "/":
return !!contextToken && (isStringLiteralLike(contextToken)
? !!tryGetImportFromModuleSpecifier(contextToken)
: contextToken.kind === SyntaxKind.LessThanSlashToken && isJsxClosingElement(contextToken.parent));
: contextToken.kind === SyntaxKind.SlashToken && isJsxClosingElement(contextToken.parent));
case " ":
return !!contextToken && isImportKeyword(contextToken) && contextToken.parent.kind === SyntaxKind.SourceFile;
default:
+10 -7
View File
@@ -23,6 +23,7 @@ import {
Node,
PatternMatcher,
PatternMatchKind,
Program,
ScriptElementKind,
SourceFile,
SyntaxKind,
@@ -38,7 +39,7 @@ interface RawNavigateToItem {
}
/** @internal */
export function getNavigateToItems(sourceFiles: readonly SourceFile[], checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number | undefined, excludeDtsFiles: boolean, excludeLibFiles?: boolean): NavigateToItem[] {
export function getNavigateToItems(sourceFiles: readonly SourceFile[], checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number | undefined, excludeDtsFiles: boolean, excludeLibFiles: boolean | undefined, program: Program): NavigateToItem[] {
const patternMatcher = createPatternMatcher(searchValue);
if (!patternMatcher) return emptyArray;
const rawItems: RawNavigateToItem[] = [];
@@ -51,12 +52,12 @@ export function getNavigateToItems(sourceFiles: readonly SourceFile[], checker:
continue;
}
if (shouldExcludeFile(sourceFile, !!excludeLibFiles, singleCurrentFile)) {
if (shouldExcludeFile(sourceFile, !!excludeLibFiles, singleCurrentFile, program)) {
continue;
}
sourceFile.getNamedDeclarations().forEach((declarations, name) => {
getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, !!excludeLibFiles, singleCurrentFile, rawItems);
getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, !!excludeLibFiles, singleCurrentFile, rawItems, program);
});
}
@@ -68,8 +69,8 @@ export function getNavigateToItems(sourceFiles: readonly SourceFile[], checker:
* Exclude 'node_modules/' files and standard library files if 'excludeLibFiles' is true.
* If we're in current file only mode, we don't exclude the current file, even if it is a library file.
*/
function shouldExcludeFile(file: SourceFile, excludeLibFiles: boolean, singleCurrentFile: SourceFile | undefined): boolean {
return file !== singleCurrentFile && excludeLibFiles && (isInsideNodeModules(file.path) || file.hasNoDefaultLib);
function shouldExcludeFile(file: SourceFile, excludeLibFiles: boolean, singleCurrentFile: SourceFile | undefined, program: Program): boolean {
return file !== singleCurrentFile && excludeLibFiles && (isInsideNodeModules(file.path) || program.isSourceFileDefaultLibrary(file));
}
function getItemsFromNamedDeclaration(
@@ -81,6 +82,7 @@ function getItemsFromNamedDeclaration(
excludeLibFiles: boolean,
singleCurrentFile: SourceFile | undefined,
rawItems: RawNavigateToItem[],
program: Program,
): void {
// First do a quick check to see if the name of the declaration matches the
// last portion of the (possibly) dotted name they're searching for.
@@ -90,7 +92,7 @@ function getItemsFromNamedDeclaration(
}
for (const declaration of declarations) {
if (!shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile)) continue;
if (!shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile, program)) continue;
if (patternMatcher.patternContainsDots) {
// If the pattern has dots in it, then also see if the declaration container matches as well.
@@ -110,6 +112,7 @@ function shouldKeepItem(
checker: TypeChecker,
excludeLibFiles: boolean,
singleCurrentFile: SourceFile | undefined,
program: Program,
): boolean {
switch (declaration.kind) {
case SyntaxKind.ImportClause:
@@ -118,7 +121,7 @@ function shouldKeepItem(
const importer = checker.getSymbolAtLocation((declaration as ImportClause | ImportSpecifier | ImportEqualsDeclaration).name!)!; // TODO: GH#18217
const imported = checker.getAliasedSymbol(importer);
return importer.escapedName !== imported.escapedName
&& !imported.declarations?.every(d => shouldExcludeFile(d.getSourceFile(), excludeLibFiles, singleCurrentFile));
&& !imported.declarations?.every(d => shouldExcludeFile(d.getSourceFile(), excludeLibFiles, singleCurrentFile, program));
default:
return true;
}
+2 -3
View File
@@ -22,7 +22,6 @@ export function preProcessFile(sourceText: string, readImportFiles = true, detec
typeReferenceDirectives: [],
libReferenceDirectives: [],
amdDependencies: [],
hasNoDefaultLib: undefined,
moduleName: undefined,
};
const importedFiles: FileReference[] = [];
@@ -429,7 +428,7 @@ export function preProcessFile(sourceText: string, readImportFiles = true, detec
importedFiles.push(decl.ref);
}
}
return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: undefined };
return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: false, ambientExternalModules: undefined };
}
else {
// for global scripts ambient modules still can have augmentations - look for ambient modules with depth > 0
@@ -447,6 +446,6 @@ export function preProcessFile(sourceText: string, readImportFiles = true, detec
}
}
}
return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: ambientModuleNames };
return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: false, ambientExternalModules: ambientModuleNames };
}
}
+2 -4
View File
@@ -504,9 +504,8 @@ function createChildren(node: Node, sourceFile: SourceFileLike | undefined): rea
});
return children;
}
const languageVariant = sourceFile?.languageVariant ?? LanguageVariant.Standard;
scanner.setText((sourceFile || node.getSourceFile()).text);
scanner.setLanguageVariant(languageVariant);
let pos = node.pos;
const processNode = (child: Node) => {
addSyntheticNodes(children, pos, child.pos, node);
@@ -527,7 +526,6 @@ function createChildren(node: Node, sourceFile: SourceFileLike | undefined): rea
node.forEachChild(processNode, processNodes);
addSyntheticNodes(children, pos, node.end, node);
scanner.setText(undefined);
scanner.setLanguageVariant(LanguageVariant.Standard);
return children;
}
@@ -2484,7 +2482,7 @@ export function createLanguageService(
function getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles = false, excludeLibFiles = false): NavigateToItem[] {
synchronizeHostData();
const sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles();
return NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles);
return NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles, program);
}
function getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean, forceDtsEmit?: boolean) {
+7 -4
View File
@@ -1067,8 +1067,9 @@ function getCompletionEntriesForNonRelativeModules(
if (tryFileExists(host, packageFile)) {
const packageJson = readJson(packageFile, host);
const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
exportsOrImportsLookup((packageJson as MapLike<unknown>).exports, fragmentSubpath, packageDirectory, /*isExports*/ true, /*isImports*/ false);
return;
if (exportsOrImportsLookup((packageJson as MapLike<unknown>).exports, fragmentSubpath, packageDirectory, /*isExports*/ true, /*isImports*/ false)) {
return;
}
}
return nodeModulesDirectoryOrImportsLookup(ancestor);
};
@@ -1079,9 +1080,10 @@ function getCompletionEntriesForNonRelativeModules(
return arrayFrom(result.values());
function exportsOrImportsLookup(lookupTable: unknown, fragment: string, baseDirectory: string, isExports: boolean, isImports: boolean) {
/** Returns true if the search should stop */
function exportsOrImportsLookup(lookupTable: unknown, fragment: string, baseDirectory: string, isExports: boolean, isImports: boolean): boolean {
if (typeof lookupTable !== "object" || lookupTable === null) { // eslint-disable-line no-restricted-syntax
return; // null lookupTable or entrypoint only
return lookupTable !== undefined; // null lookupTable or entrypoint only
}
const keys = getOwnKeys(lookupTable as MapLike<unknown>);
const conditions = getConditions(compilerOptions, mode);
@@ -1105,6 +1107,7 @@ function getCompletionEntriesForNonRelativeModules(
},
comparePatternKeys,
);
return true;
}
}
+6 -4
View File
@@ -89,8 +89,7 @@ export function transpileDeclaration(input: string, transpileOptions: TranspileO
// at least a minimal `lib` available, since the checker will `any` their types without these defined.
// Late bound symbol names, in particular, are impossible to define without `Symbol` at least partially defined.
// TODO: This should *probably* just load the full, real `lib` for the `target`.
const barebonesLibContent = `/// <reference no-default-lib="true"/>
interface Boolean {}
const barebonesLibContent = `interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
@@ -152,6 +151,10 @@ function transpileWorker(input: string, transpileOptions: TranspileOptions, decl
options.declarationMap = false;
}
// When transpiling declartions, we need libs.
// getDefaultLibFileName will cause barebonesLib to be used.
options.noLib = !declaration;
const newLine = getNewLineCharacter(options);
// Create a compilerHost object to allow the compiler to read and write files
const compilerHost: CompilerHost = {
@@ -201,8 +204,7 @@ function transpileWorker(input: string, transpileOptions: TranspileOptions, decl
let outputText: string | undefined;
let sourceMapText: string | undefined;
const inputs = declaration ? [inputFileName, barebonesLibName] : [inputFileName];
const program = createProgram(inputs, options, compilerHost);
const program = createProgram([inputFileName], options, compilerHost);
if (transpileOptions.reportDiagnostics) {
addRange(/*to*/ diagnostics, /*from*/ program.getSyntacticDiagnostics(sourceFile));
+1
View File
@@ -248,6 +248,7 @@ export interface PreProcessedFileInfo {
libReferenceDirectives: FileReference[];
importedFiles: FileReference[];
ambientExternalModules?: string[];
/** @deprecated Always false. Use a Program to determine if a file is a lib file. */
isLibFile: boolean;
}
+1 -2
View File
@@ -1889,7 +1889,7 @@ export function isInsideJsxElementOrAttribute(sourceFile: SourceFile, position:
}
// <div>|</div>
if (token.kind === SyntaxKind.LessThanSlashToken && token.parent.kind === SyntaxKind.JsxClosingElement) {
if (token.kind === SyntaxKind.LessThanToken && token.parent.kind === SyntaxKind.JsxClosingElement) {
return true;
}
@@ -1934,7 +1934,6 @@ export function isInsideJsxElement(sourceFile: SourceFile, position: number): bo
|| node.kind === SyntaxKind.CloseBraceToken
|| node.kind === SyntaxKind.OpenBraceToken
|| node.kind === SyntaxKind.SlashToken
|| node.kind === SyntaxKind.LessThanSlashToken
) {
node = node.parent;
}
+1 -1
View File
@@ -126,7 +126,7 @@ export function createTestCompilerHost(texts: readonly NamedSourceText[], target
getTrace: () => trace,
clearTrace: () => trace.length = 0,
getSourceFile: fileName => filesByPath.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)),
getDefaultLibFileName: () => "lib.d.ts",
getDefaultLibFileName: () => "",
writeFile: ts.notImplemented,
getCurrentDirectory: () => currentDirectory,
getDirectories: () => [],
@@ -72,8 +72,7 @@ import {
export const libFile: File = {
path: getPathForTypeScriptTestLocation("lib.d.ts"),
content: `/// <reference no-default-lib="true"/>
interface Boolean {}
content: `interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
+306
View File
@@ -423,5 +423,311 @@ describe("unittests:: PrinterAPI", () => {
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryBarBarExpressionWithLeftBinaryQuestionQuestionExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("b"),
),
ts.factory.createToken(ts.SyntaxKind.BarBarToken),
ts.factory.createIdentifier("c"),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryAmpersandAmpersandExpressionWithLeftBinaryQuestionQuestionExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("b"),
),
ts.factory.createToken(ts.SyntaxKind.AmpersandAmpersandToken),
ts.factory.createIdentifier("c"),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryBarBarExpressionWithRightBinaryQuestionQuestionExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.BarBarToken),
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("b"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("c"),
),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryAmpersandAmpersandExpressionWithRightBinaryQuestionQuestionExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.AmpersandAmpersandToken),
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("b"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("c"),
),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryQuestionQuestionExpressionWithLeftBinaryBarBarExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.BarBarToken),
ts.factory.createIdentifier("b"),
),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("c"),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryQuestionQuestionExpressionWithLeftBinaryAmpersandAmpersandExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.AmpersandAmpersandToken),
ts.factory.createIdentifier("b"),
),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("c"),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryQuestionQuestionExpressionWithRightBinaryBarBarExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("b"),
ts.factory.createToken(ts.SyntaxKind.BarBarToken),
ts.factory.createIdentifier("c"),
),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryQuestionQuestionExpressionWithRightBinaryAmpersandAmpersandExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("b"),
ts.factory.createToken(ts.SyntaxKind.AmpersandAmpersandToken),
ts.factory.createIdentifier("c"),
),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryQuestionQuestionExpressionWithLeftBinaryQuestionQuestionExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("b"),
),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("c"),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryQuestionQuestionExpressionWithRightBinaryQuestionQuestionExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("b"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("c"),
),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryCommaExpressionWithLeftBinaryQuestionQuestionExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("b"),
),
ts.factory.createToken(ts.SyntaxKind.CommaToken),
ts.factory.createIdentifier("c"),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryCommaExpressionWithRightBinaryQuestionQuestionExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.CommaToken),
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("b"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("c"),
),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryEqualsEqualsExpressionWithLeftBinaryQuestionQuestionExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("b"),
),
ts.factory.createToken(ts.SyntaxKind.EqualsEqualsToken),
ts.factory.createIdentifier("c"),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryEqualsEqualsExpressionWithRightBinaryQuestionQuestionExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.EqualsEqualsToken),
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("b"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("c"),
),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryQuestionQuestionExpressionWithLeftBinaryCommaExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.CommaToken),
ts.factory.createIdentifier("b"),
),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("c"),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryQuestionQuestionExpressionWithRightBinaryCommaExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("b"),
ts.factory.createToken(ts.SyntaxKind.CommaToken),
ts.factory.createIdentifier("c"),
),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryQuestionQuestionExpressionWithLeftBinaryEqualsEqualsExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.EqualsEqualsToken),
ts.factory.createIdentifier("b"),
),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createIdentifier("c"),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
printsCorrectly("binaryQuestionQuestionExpressionWithRightBinaryEqualsEqualsExpression", {}, printer =>
printer.printNode(
ts.EmitHint.Unspecified,
ts.factory.createExpressionStatement(
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("a"),
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.factory.createBinaryExpression(
ts.factory.createIdentifier("b"),
ts.factory.createToken(ts.SyntaxKind.EqualsEqualsToken),
ts.factory.createIdentifier("c"),
),
),
),
ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext),
));
});
});
@@ -358,9 +358,7 @@ describe("unittests:: reuseProgramStructure:: General", () => {
const baselines: string[] = [];
baselineProgram(baselines, initialProgram);
const afterNpmInstallProgram = updateProgram(initialProgram, rootFiles.map(f => f.name), options, f => {
f[1].text = f[1].text.updateReferences(`/// <reference no-default-lib="true"/>`);
}, filesAfterNpmInstall);
const afterNpmInstallProgram = updateProgram(initialProgram, rootFiles.map(f => f.name), options, ts.noop, filesAfterNpmInstall);
baselineProgram(baselines, afterNpmInstallProgram);
runBaseline("fetches imports after npm install", baselines);
@@ -400,7 +398,7 @@ describe("unittests:: reuseProgramStructure:: General", () => {
{
name: "f1.ts",
text: SourceText.New(
`/// <reference path="a1.ts"/>${newLine}/// <reference types="typerefs1"/>${newLine}/// <reference no-default-lib="true"/>`,
`/// <reference path="a1.ts"/>${newLine}/// <reference types="typerefs1"/>`,
`import { B } from './b1';${newLine}export let BB = B;`,
"declare module './b1' { interface B { y: string; } }",
),
@@ -14,8 +14,7 @@ import {
const libFile: File = {
path: vfsWatch_LibFile.path,
content: `/// <reference no-default-lib="true"/>
interface Boolean {}
content: `interface Boolean {}
interface Function {}
interface IArguments {}
interface Number { toExponential: any; }
@@ -2,7 +2,7 @@ import * as Harness from "../../../_namespaces/Harness.js";
import * as ts from "../../../_namespaces/ts.js";
describe("unittests:: services:: extract:: Symbol Walker", () => {
function test(description: string, source: string, verifier: (file: ts.SourceFile, checker: ts.TypeChecker) => void) {
function test(description: string, source: string, verifier: (file: ts.SourceFile, checker: ts.TypeChecker, program: ts.Program) => void) {
it(description, () => {
const result = Harness.Compiler.compileFiles(
[{
@@ -16,7 +16,7 @@ describe("unittests:: services:: extract:: Symbol Walker", () => {
);
const file = result.program!.getSourceFile("main.ts")!;
const checker = result.program!.getTypeChecker();
verifier(file, checker);
verifier(file, checker, result.program!);
});
}
@@ -29,13 +29,13 @@ interface Bar {
history: Bar[];
}
export default function foo(a: number, b: Bar): void {}`,
(file, checker) => {
(file, checker, program) => {
let foundCount = 0;
let stdLibRefSymbols = 0;
const expectedSymbols = ["default", "a", "b", "Bar", "x", "y", "history"];
const walker = checker.getSymbolWalker(symbol => {
const isStdLibSymbol = ts.forEach(symbol.declarations, d => {
return ts.getSourceFileOfNode(d).hasNoDefaultLib;
return program.isSourceFileDefaultLibrary(ts.getSourceFileOfNode(d));
});
if (isStdLibSymbol) {
stdLibRefSymbols++;
@@ -91,6 +91,68 @@ describe("unittests:: tsbuild:: moduleResolution:: handles the modules and optio
}),
commandLineArgs: ["-b", "packages/pkg1.tsconfig.json", "packages/pkg2.tsconfig.json", "--verbose", "--traceResolution"],
});
verifyTsc({
scenario: "moduleResolution",
subScenario: "resolution from d.ts of referenced project",
sys: () =>
TestServerHost.createWatchedSystem({
"/home/src/workspaces/project/common.d.ts": "export type OnValue = (value: number) => void",
"/home/src/workspaces/project/producer/index.ts": dedent`
export { ValueProducerDeclaration } from "./in-js"
import { OnValue } from "@common"
export interface ValueProducerFromTs {
onValue: OnValue;
}
`,
"/home/src/workspaces/project/producer/in-js.d.ts": dedent`
import { OnValue } from "@common"
export interface ValueProducerDeclaration {
onValue: OnValue;
}
`,
"/home/src/workspaces/project/producer/tsconfig.json": jsonToReadableText({
compilerOptions: {
strict: true,
composite: true,
module: "nodenext",
moduleResolution: "nodenext",
paths: {
"@common": ["../common.d.ts"],
},
libReplacement: false,
},
}),
"/home/src/workspaces/project/consumer/index.ts": dedent`
import { ValueProducerDeclaration, ValueProducerFromTs } from "@producer"
declare let v: ValueProducerDeclaration;
// n is implicitly any because onValue is actually any (despite what the tooltip says)
v.onValue = (n) => {
}
// n is implicitly number as expected
declare let v2: ValueProducerFromTs;
v2.onValue = (n) => {
}`,
"/home/src/workspaces/project/consumer/tsconfig.json": jsonToReadableText({
compilerOptions: {
strict: true,
module: "nodenext",
moduleResolution: "nodenext",
paths: {
"@producer": ["../producer/index"],
},
libReplacement: false,
},
references: [
{ path: "../producer" },
],
}),
}),
commandLineArgs: ["--b", "consumer", "--traceResolution", "-v"],
});
});
describe("unittests:: tsbuild:: moduleResolution:: impliedNodeFormat differs between projects for shared file", () => {
+2 -4
View File
@@ -504,13 +504,11 @@ class someClass2 { }`,
modifySystem: sys => {
sys.writeFile(
getTypeScriptLibTestLocation("esnext.full"),
`/// <reference no-default-lib="true"/>
/// <reference lib="esnext" />`,
`/// <reference lib="esnext" />`,
);
sys.writeFile(
libFile.path,
`/// <reference no-default-lib="true"/>
/// <reference lib="esnext" />`,
`/// <reference lib="esnext" />`,
);
sys.writeFile(
"core/tsconfig.json",
@@ -297,34 +297,6 @@ declare global {
edits: noChangeOnlyRuns,
});
verifyTsc({
scenario: "incremental",
subScenario: "ts file with no-default-lib that augments the global scope",
sys: () =>
TestServerHost.createWatchedSystem({
"/home/src/workspaces/project/src/main.ts": dedent`
/// <reference no-default-lib="true"/>
/// <reference lib="esnext" />
declare global {
interface Test {
}
}
export {};
`,
"/home/src/workspaces/project/tsconfig.json": jsonToReadableText({
compilerOptions: {
target: "ESNext",
module: "ESNext",
incremental: true,
outDir: "dist",
},
}),
}),
commandLineArgs: ["--rootDir", "src"],
});
verifyTsc({
scenario: "incremental",
subScenario: "change to type that gets used as global through export in another file",
@@ -1,5 +1,4 @@
import { emptyArray } from "../../_namespaces/ts.js";
import { dedent } from "../../_namespaces/Utils.js";
import { jsonToReadableText } from "../helpers.js";
import {
forEachLibResolutionScenario,
@@ -58,25 +57,4 @@ describe("unittests:: tsc:: libraryResolution:: library file resolution", () =>
],
baselinePrograms: true,
});
verifyTsc({
scenario: "libraryResolution",
subScenario: "when one of the file skips default lib inclusion",
sys: () =>
TestServerHost.createWatchedSystem({
"/home/src/workspaces/project/a.d.ts": dedent`
/// <reference no-default-lib="true"/>
/// <reference lib="es6"/>
declare const a = "hello";
`,
"/home/src/workspaces/project/b.d.ts": `export const b = 10;`,
"/home/src/workspaces/project/tsconfig.json": jsonToReadableText({
compilerOptions: {
lib: ["es6", "dom"],
},
}),
}),
commandLineArgs: ["-i", "--explainFiles"],
baselinePrograms: true,
});
});
@@ -288,7 +288,7 @@ describe("unittests:: tscWatch:: watchEnvironment:: tsc-watch with different pol
sys: () => {
const configFile: File = {
path: `/user/username/projects/myproject/tsconfig.json`,
content: "{}",
content: `{ "compilerOptions": { "moduleResolution": "node10" } }`,
};
const file1: File = {
path: `/user/username/projects/myproject/src/file1.ts`,
@@ -188,6 +188,11 @@ describe("unittests:: tsserver:: autoImportProvider::", () => {
// Create auto import provider project, ensure still !session.getProjectService().pendingEnsureProjectForOpenFiles
host.writeFile(packageJson.path, packageJson.content);
// package.json was watched in --moduleResolution bundler
assert.isTrue(session.getProjectService().pendingEnsureProjectForOpenFiles);
host.runQueuedTimeoutCallbacks();
assert.isFalse(session.getProjectService().pendingEnsureProjectForOpenFiles);
session.host.baselineHost("Before getPackageJsonAutoImportProvider");
hostProject.getPackageJsonAutoImportProvider();
assert.isFalse(session.getProjectService().pendingEnsureProjectForOpenFiles);
@@ -49,7 +49,7 @@ const indexFile: File = {
const tsconfigFile: File = {
path: "/home/src/project/project/tsconfig.json",
content: `{ "compilerOptions": { "module": "commonjs" } }`,
content: `{ "compilerOptions": { "module": "commonjs", "moduleResolution": "node10" } }`,
};
const packageJsonFile: File = {
@@ -45,7 +45,7 @@ describe("unittests:: tsserver:: getEditsForFileRename::", () => {
getDefaultLibFileName: options => ts.getDefaultLibFileName(options),
readFile: path => host.readFile(path),
fileExists: path => host.fileExists(path),
resolveModuleNames: (moduleNames, containingFile) => moduleNames.map(name => ts.resolveModuleName(name, containingFile, options, lsHost, moduleResolutionCache).resolvedModule),
resolveModuleNames: (moduleNames, containingFile) => moduleNames.map(name => ts.resolveModuleName(name, containingFile, options, lsHost, moduleResolutionCache, /*redirectedReference*/ undefined, ts.ModuleKind.CommonJS).resolvedModule),
getResolvedModuleWithFailedLookupLocationsFromCache: (moduleName, containingFile, mode) => moduleResolutionCache.getFromDirectoryCache(moduleName, mode, ts.getDirectoryPath(containingFile), /*redirectedReference*/ undefined),
};
const service = ts.createLanguageService(lsHost);
@@ -2472,7 +2472,7 @@ describe("unittests:: tsserver:: typingsInstaller:: recomputing resolutions of u
ts.server.updateProjectIfDirty(project);
const program = project.getLanguageService().getProgram()!;
const sourceFile = program.getSourceFileByPath(appPath)!;
const foooResolution = program.getResolvedModule(sourceFile, "fooo", /*mode*/ undefined)!.resolvedModule!;
const foooResolution = program.getResolvedModule(sourceFile, "fooo", ts.ModuleKind.CommonJS)!.resolvedModule!;
project.writeLog(`Resolution from : ${sourceFile.fileName} for "fooo" goes to: ${jsonToReadableText(foooResolution)}`);
return foooResolution;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,7 +1,7 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.ts] ////
//// [module.d.ts]
declare module Point {
declare namespace Point {
export var Origin: { x: number; y: number; }
}
@@ -1,7 +1,7 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.ts] ////
=== module.d.ts ===
declare module Point {
declare namespace Point {
>Point : Symbol(Point, Decl(module.d.ts, 0, 0), Decl(function.d.ts, 0, 0))
export var Origin: { x: number; y: number; }
@@ -1,7 +1,7 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.ts] ////
=== module.d.ts ===
declare module Point {
declare namespace Point {
>Point : typeof Point
> : ^^^^^^^^^^^^
@@ -1,8 +1,8 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndAmbientWithSameNameAndCommonRoot.ts] ////
//// [module.d.ts]
declare module A {
export module Point {
declare namespace A {
export namespace Point {
export var Origin: {
x: number;
y: number;
@@ -11,7 +11,7 @@ declare module A {
}
//// [class.d.ts]
declare module A {
declare namespace A {
export class Point {
constructor(x: number, y: number);
x: number;
@@ -1,11 +1,11 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndAmbientWithSameNameAndCommonRoot.ts] ////
=== module.d.ts ===
declare module A {
declare namespace A {
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(class.d.ts, 0, 0))
export module Point {
>Point : Symbol(Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
export namespace Point {
>Point : Symbol(Point, Decl(module.d.ts, 0, 21), Decl(class.d.ts, 0, 21))
export var Origin: {
>Origin : Symbol(Origin, Decl(module.d.ts, 2, 18))
@@ -20,11 +20,11 @@ declare module A {
}
=== class.d.ts ===
declare module A {
declare namespace A {
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(class.d.ts, 0, 0))
export class Point {
>Point : Symbol(Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
>Point : Symbol(Point, Decl(module.d.ts, 0, 21), Decl(class.d.ts, 0, 21))
constructor(x: number, y: number);
>x : Symbol(x, Decl(class.d.ts, 2, 20))
@@ -47,14 +47,14 @@ var p: { x: number; y: number; }
var p = A.Point.Origin;
>p : Symbol(p, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
>A.Point.Origin : Symbol(A.Point.Origin, Decl(module.d.ts, 2, 18))
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 21), Decl(class.d.ts, 0, 21))
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(class.d.ts, 0, 0))
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 21), Decl(class.d.ts, 0, 21))
>Origin : Symbol(A.Point.Origin, Decl(module.d.ts, 2, 18))
var p = new A.Point(0, 0); // unexpected error here, bug 840000
>p : Symbol(p, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 21), Decl(class.d.ts, 0, 21))
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(class.d.ts, 0, 0))
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 21), Decl(class.d.ts, 0, 21))
@@ -1,11 +1,11 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndAmbientWithSameNameAndCommonRoot.ts] ////
=== module.d.ts ===
declare module A {
declare namespace A {
>A : typeof A
> : ^^^^^^^^
export module Point {
export namespace Point {
>Point : typeof Point
> : ^^^^^^^^^^^^
@@ -25,7 +25,7 @@ declare module A {
}
=== class.d.ts ===
declare module A {
declare namespace A {
>A : typeof A
> : ^^^^^^^^
@@ -1,8 +1,8 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.ts] ////
//// [module.d.ts]
declare module A {
export module Point {
declare namespace A {
export namespace Point {
export var Origin: {
x: number;
y: number;
@@ -11,7 +11,7 @@ declare module A {
}
//// [classPoint.ts]
module A {
namespace A {
export class Point {
constructor(public x: number, public y: number) { }
}
@@ -1,11 +1,11 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.ts] ////
=== module.d.ts ===
declare module A {
declare namespace A {
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(classPoint.ts, 0, 0))
export module Point {
>Point : Symbol(Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
export namespace Point {
>Point : Symbol(Point, Decl(module.d.ts, 0, 21), Decl(classPoint.ts, 0, 13))
export var Origin: {
>Origin : Symbol(Origin, Decl(module.d.ts, 2, 18))
@@ -20,11 +20,11 @@ declare module A {
}
=== classPoint.ts ===
module A {
namespace A {
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(classPoint.ts, 0, 0))
export class Point {
>Point : Symbol(Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
>Point : Symbol(Point, Decl(module.d.ts, 0, 21), Decl(classPoint.ts, 0, 13))
constructor(public x: number, public y: number) { }
>x : Symbol(Point.x, Decl(classPoint.ts, 2, 20))
@@ -41,14 +41,14 @@ var p: { x: number; y: number; }
var p = A.Point.Origin;
>p : Symbol(p, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
>A.Point.Origin : Symbol(A.Point.Origin, Decl(module.d.ts, 2, 18))
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 21), Decl(classPoint.ts, 0, 13))
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(classPoint.ts, 0, 0))
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 21), Decl(classPoint.ts, 0, 13))
>Origin : Symbol(A.Point.Origin, Decl(module.d.ts, 2, 18))
var p = new A.Point(0, 0); // unexpected error here, bug 840000
>p : Symbol(p, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 21), Decl(classPoint.ts, 0, 13))
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(classPoint.ts, 0, 0))
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 21), Decl(classPoint.ts, 0, 13))
@@ -1,11 +1,11 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.ts] ////
=== module.d.ts ===
declare module A {
declare namespace A {
>A : typeof A
> : ^^^^^^^^
export module Point {
export namespace Point {
>Point : typeof Point
> : ^^^^^^^^^^^^
@@ -25,7 +25,7 @@ declare module A {
}
=== classPoint.ts ===
module A {
namespace A {
>A : typeof A
> : ^^^^^^^^
@@ -1,7 +1,7 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.ts] ////
//// [module.d.ts]
declare module Point {
declare namespace Point {
export var Origin: { x: number; y: number; }
}
@@ -1,7 +1,7 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.ts] ////
=== module.d.ts ===
declare module Point {
declare namespace Point {
>Point : Symbol(Point, Decl(module.d.ts, 0, 0), Decl(function.ts, 0, 0))
export var Origin: { x: number; y: number; }
@@ -1,7 +1,7 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.ts] ////
=== module.d.ts ===
declare module Point {
declare namespace Point {
>Point : typeof Point
> : ^^^^^^^^^^^^
@@ -14,7 +14,7 @@ ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(46,15): err
value: T;
}
module clodule1 {
namespace clodule1 {
function f(x: T) { }
~
!!! error TS2304: Cannot find name 'T'.
@@ -26,7 +26,7 @@ ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(46,15): err
value: T;
}
module clodule2 {
namespace clodule2 {
var x: T;
~
!!! error TS2304: Cannot find name 'T'.
@@ -45,7 +45,7 @@ ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(46,15): err
value: T;
}
module clodule3 {
namespace clodule3 {
export var y = { id: T };
~
!!! error TS2304: Cannot find name 'T'.
@@ -57,7 +57,7 @@ ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(46,15): err
value: T;
}
module clodule4 {
namespace clodule4 {
class D {
name: T;
~
@@ -9,7 +9,7 @@ class clodule1<T>{
value: T;
}
module clodule1 {
namespace clodule1 {
function f(x: T) { }
}
@@ -19,7 +19,7 @@ class clodule2<T>{
value: T;
}
module clodule2 {
namespace clodule2 {
var x: T;
class D<U extends T>{
@@ -34,7 +34,7 @@ class clodule3<T>{
value: T;
}
module clodule3 {
namespace clodule3 {
export var y = { id: T };
}
@@ -44,7 +44,7 @@ class clodule4<T>{
value: T;
}
module clodule4 {
namespace clodule4 {
class D {
name: T;
}
@@ -15,11 +15,11 @@ class clodule1<T>{
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 2, 15))
}
module clodule1 {
namespace clodule1 {
>clodule1 : Symbol(clodule1, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 0, 0), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 6, 1))
function f(x: T) { }
>f : Symbol(f, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 8, 17))
>f : Symbol(f, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 8, 20))
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 9, 15))
>T : Symbol(T)
}
@@ -36,7 +36,7 @@ class clodule2<T>{
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 12, 15))
}
module clodule2 {
namespace clodule2 {
>clodule2 : Symbol(clodule2, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 10, 1), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 16, 1))
var x: T;
@@ -69,7 +69,7 @@ class clodule3<T>{
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 27, 15))
}
module clodule3 {
namespace clodule3 {
>clodule3 : Symbol(clodule3, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 25, 1), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 31, 1))
export var y = { id: T };
@@ -89,11 +89,11 @@ class clodule4<T>{
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 37, 15))
}
module clodule4 {
namespace clodule4 {
>clodule4 : Symbol(clodule4, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 35, 1), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 41, 1))
class D {
>D : Symbol(D, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 43, 17))
>D : Symbol(D, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 43, 20))
name: T;
>name : Symbol(D.name, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 44, 13))
@@ -16,7 +16,7 @@ class clodule1<T>{
> : ^
}
module clodule1 {
namespace clodule1 {
>clodule1 : typeof clodule1
> : ^^^^^^^^^^^^^^^
@@ -40,7 +40,7 @@ class clodule2<T>{
> : ^
}
module clodule2 {
namespace clodule2 {
>clodule2 : typeof clodule2
> : ^^^^^^^^^^^^^^^
@@ -75,7 +75,7 @@ class clodule3<T>{
> : ^
}
module clodule3 {
namespace clodule3 {
>clodule3 : typeof clodule3
> : ^^^^^^^^^^^^^^^
@@ -103,7 +103,7 @@ class clodule4<T>{
> : ^
}
module clodule4 {
namespace clodule4 {
>clodule4 : typeof clodule4
> : ^^^^^^^^^^^^^^^
@@ -12,7 +12,7 @@ ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFu
!!! error TS2300: Duplicate identifier 'fn'.
}
module clodule {
namespace clodule {
// error: duplicate identifier expected
export function fn<T>(x: T, y: T): T {
~~
@@ -8,7 +8,7 @@ class clodule<T> {
static fn<U>(id: U) { }
}
module clodule {
namespace clodule {
// error: duplicate identifier expected
export function fn<T>(x: T, y: T): T {
return x;

Some files were not shown because too many files have changed in this diff Show More