Skip to content

fix(types): ensure TypeScript declarations are generated on package pack and continuous release - #9192

Open
Pcmhacker-piro wants to merge 1 commit into
processing:mainfrom
Pcmhacker-piro:fix/missing-type-declarations
Open

Pcmhacker-piro wants to merge 1 commit into
processing:mainfrom
Pcmhacker-piro:fix/missing-type-declarations

Conversation

@Pcmhacker-piro

@Pcmhacker-piro Pcmhacker-piro commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Resolves #9190

Changes:

  • Added "prepack": "npm run generate-types" to package.json so that declaration files (types/p5.d.ts and types/global.d.ts) are automatically generated whenever npm pack or npm publish is run (e.g. during local manual releases or packaging).
  • Added npm run generate-types step before publishing in .github/workflows/continuous-release.yml so that automated pkg-pr-new snapshots always include type declaration files.
  • Added explicit .js extension to relative import import P5 from './p5.js'; in utils/typescript.mjs so that types/global.d.ts is fully compliant with ESM resolution (--moduleResolution node16 and nodenext).

Proof & Verification:

Real Terminal Video Demo (asciinema recording)

Terminal Verification Demo

Terminal Output Screenshot

Terminal Proof Screenshot


PR Checklist

  • npm run lint passes (0 errors)
  • Inline reference is included / updated
  • Unit tests are included / updated (npm run test:types passes with 0 errors)

@Pcmhacker-piro

Copy link
Copy Markdown
Contributor Author

Hi @ksen0 @limzykenneth, could you please review this PR when you get a chance? It resolves #9190 by adding "prepack": "npm run generate-types" to ensure declaration files (types/p5.d.ts and types/global.d.ts) are always automatically generated and included during packaging/publishing, adding type generation to the continuous release workflow, and fixing the relative import in global.d.ts for ESM nodenext resolution. Real terminal recording demo and proof screenshot are attached. Thank you!

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.

[p5.js 2.0+ Bug Report]: Missing type declarations

2 participants