From 24ed3ccb3c967c6fe8bca491fe1bde07b810a7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sadjow=20Le=C3=A3o?= Date: Thu, 15 Oct 2026 12:44:01 -0300 Subject: [PATCH 1/2] ci: check the published types with TypeScript 6 and 7 --- .github/workflows/main.yml | 22 ++++++++++++++++++++++ README.md | 2 ++ scripts/test-package.mjs | 25 ++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9a1674d..1d199f1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,3 +94,25 @@ jobs: env: NUXT_VERSION: ${{ matrix.nuxt-version }} NUXT_TELEMETRY_DISABLED: '1' + + declarations: + timeout-minutes: 10 + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + typescript-version: ['6', '7'] + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 + with: + node-version: 22 + - uses: pnpm/action-setup@v6 + with: + cache: true + - run: pnpm install --frozen-lockfile + - run: pnpm dev:prepare + - name: Check published package types with TypeScript ${{ matrix.typescript-version }} + run: pnpm test:package + env: + TYPESCRIPT_VERSION: ${{ matrix.typescript-version }} diff --git a/README.md b/README.md index 0d22a75..df69ef9 100644 --- a/README.md +++ b/README.md @@ -370,6 +370,8 @@ pnpm dev:build `test:package` checks the actual npm tarball from an isolated TypeScript consumer. `test:compatibility` also installs it in an independent Nuxt app, checks types, builds and generates static pages, and exercises campaign navigation, reload persistence, and form submission in Chromium. It tests the latest Nuxt 4 release by default; set `NUXT_VERSION=3` for Nuxt 3 or `NUXT_VERSION=npm:nuxt-nightly@5x` for the Nuxt 5 nightly. CI runs all three separately from the Node 22, 24, and 26 checks, and a nightly failure does not fail the workflow. These are tested configurations, not runtime version restrictions. +Set `TYPESCRIPT_VERSION` to check the tarball with another TypeScript release, for example `TYPESCRIPT_VERSION=7 pnpm test:package`. Applications compile the published declarations with their own TypeScript, so CI also runs this check with the latest TypeScript 6 and 7 releases. + Use `pnpm dev` for the playground. See the [release documentation](docs/RELEASING.md) for preparing and publishing a version. ## License diff --git a/scripts/test-package.mjs b/scripts/test-package.mjs index b73da9b..3047b78 100644 --- a/scripts/test-package.mjs +++ b/scripts/test-package.mjs @@ -38,10 +38,29 @@ try { files: ['consumer.mts'], }), ) - execFileSync(process.execPath, [join(root, 'node_modules/typescript/bin/tsc'), '-p', directory], { - stdio: 'inherit', - }) + const compiler = typescriptCompiler(process.env.TYPESCRIPT_VERSION) + execFileSync(process.execPath, [compiler, '-p', directory], { stdio: 'inherit' }) if (process.argv.includes('--app')) await testCompatibility({ root, directory, tarball }) } finally { rmSync(directory, { recursive: true, force: true }) } + +// Consumers compile the published declarations with their own TypeScript, so CI checks newer +// releases than the one this repository builds with +function typescriptCompiler(version) { + if (!version) return join(root, 'node_modules/typescript/bin/tsc') + const prefix = join(directory, 'typescript') + const install = [ + 'install', + '--prefix', + prefix, + '--no-audit', + '--no-fund', + `typescript@${version}`, + ] + execFileSync('npm', install, { stdio: 'inherit' }) + const typescript = join(prefix, 'node_modules/typescript') + const { version: installed } = JSON.parse(readFileSync(join(typescript, 'package.json'), 'utf8')) + console.log(`Checking package types with TypeScript ${installed}`) + return join(typescript, 'bin/tsc') +} From 8a08443ff8a2a0f9dacd7d5f5e25cf1e18c41889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sadjow=20Le=C3=A3o?= Date: Thu, 15 Oct 2026 14:11:45 -0300 Subject: [PATCH 2/2] docs: list the TypeScript releases CI checks the declarations with --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index df69ef9..433335b 100644 --- a/README.md +++ b/README.md @@ -349,6 +349,8 @@ const attribution: AttributionSnapshot = { Supported UTM fields are the manual campaign parameters Google Analytics 4 documents: `utm_id`, `utm_source`, `utm_medium`, `utm_campaign`, `utm_source_platform`, `utm_term`, `utm_content`, `utm_creative_format`, and `utm_marketing_tactic`. Google click fields are `gclid`, `gad_source`, `gad_campaignid`, `gbraid`, `wbraid`, and `dclid`; Google Ads sends `gbraid` or `wbraid` alongside or instead of `gclid` for some iOS traffic. A nonempty value in any of these fields makes a visit a campaign visit. When a parameter repeats in the URL, each field, including configured click parameters, keeps its first nonempty value: `?utm_source=&utm_source=google&utm_source=newsletter` saves `google`. `clickParams` holds the values of the names listed in the `clickParams` option. `gclidParams`, `clickParams`, and `customParams` are optional. The package also exports `ModuleOptions`, `UTMParams`, `GCLIDParams`, `ClickParams`, `AdditionalInfo`, `BeforeTrackContext`, `NuxtUTMHooks`, and `UseNuxtUTMReturn`. +CI compiles the published declarations with TypeScript 5.9 and with the latest TypeScript 6 and 7 releases. Older TypeScript releases are untested. + ## Development Use the pnpm version pinned in `package.json`. The commands below assume Corepack is installed; see [pnpm installation](https://pnpm.io/installation) if needed. @@ -370,7 +372,7 @@ pnpm dev:build `test:package` checks the actual npm tarball from an isolated TypeScript consumer. `test:compatibility` also installs it in an independent Nuxt app, checks types, builds and generates static pages, and exercises campaign navigation, reload persistence, and form submission in Chromium. It tests the latest Nuxt 4 release by default; set `NUXT_VERSION=3` for Nuxt 3 or `NUXT_VERSION=npm:nuxt-nightly@5x` for the Nuxt 5 nightly. CI runs all three separately from the Node 22, 24, and 26 checks, and a nightly failure does not fail the workflow. These are tested configurations, not runtime version restrictions. -Set `TYPESCRIPT_VERSION` to check the tarball with another TypeScript release, for example `TYPESCRIPT_VERSION=7 pnpm test:package`. Applications compile the published declarations with their own TypeScript, so CI also runs this check with the latest TypeScript 6 and 7 releases. +Set `TYPESCRIPT_VERSION` to check the tarball with another TypeScript release, for example `TYPESCRIPT_VERSION=7 pnpm test:package`. Applications compile the published declarations with their own TypeScript, so CI also runs this check with each release listed in [Data and TypeScript](#data-and-typescript). Use `pnpm dev` for the playground. See the [release documentation](docs/RELEASING.md) for preparing and publishing a version.