Skip to content

fix(upgrade): fix test types#16493

Merged
ematipico merged 3 commits into
withastro:mainfrom
ocavue-forks:ocavue/fix-upgrade-ts
Apr 28, 2026
Merged

fix(upgrade): fix test types#16493
ematipico merged 3 commits into
withastro:mainfrom
ocavue-forks:ocavue/fix-upgrade-ts

Conversation

@ocavue
Copy link
Copy Markdown
Contributor

@ocavue ocavue commented Apr 27, 2026

Changes

  1. Removed noEmit: true from packages/upgrade/tsconfig.json. This actually reveals the following error in CI. This is an old bug but since we didn't emit .d.ts files we didn't find it out.
@astrojs/upgrade@0.7.2 : typecheck:tests packages/upgrade
  
  > @astrojs/upgrade@0.7.2 typecheck:tests /home/runner/work/astro/astro/packages/upgrade
  > tsc --build tsconfig.test.json
  
  Error: test/install.test.ts(30,17): error TS2345: Argument of type '{ packages: { name: string; currentVersion: string; targetVersion: string; }[]; cwd: string; version: string; packageManager: string; dryRun: boolean; }' is not assignable to parameter of type 'Pick<Context, "version" | "packages" | "packageManager" | "prompt" | "dryRun" | "exit" | "cwd">'.
    Type '{ packages: { name: string; currentVersion: string; targetVersion: string; }[]; cwd: string; version: string; packageManager: string; dryRun: boolean; }' is missing the following properties from type 'Pick<Context, "version" | "packages" | "packageManager" | "prompt" | "dryRun" | "exit" | "cwd">': prompt, exit
  1. Actually fix the TS typing so that this error is gone.

Testing

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 27, 2026

⚠️ No Changeset found

Latest commit: 47915d1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment on lines +27 to +29
"dist/**/*.js",
"dist/**/*.mjs",
"upgrade.mjs"
Copy link
Copy Markdown
Contributor Author

@ocavue ocavue Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. upgrade.js is a mistake. That file has been renamed to upgrade.mjs.

  2. Since @astrojs/upgrade is a CLI, we probably don't want to ship dist/**/*.d.ts files to the NPM registry. Maybe that's why we had noEmit: true in the first place. Anyway, I get rid of all dist/**/*.d.ts files when publishing by only including .js and .mjs files.

    (We currently only emit .js files; I added .mjs just in case we want to ship .mjs files in the future)

@ocavue ocavue changed the title fix(upgrade): fix incorrect typings fix(upgrade): fix test types Apr 27, 2026
@ocavue ocavue marked this pull request as ready for review April 27, 2026 16:13
@ematipico ematipico merged commit 60c2842 into withastro:main Apr 28, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants