p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

add `export default p5` at end of global.d.ts

Open nbogie opened this issue 1 month ago • 1 comments

Resolves #8302

Changes: adds a final export default p5 to global.d.ts when it's prepared in typescript.mjs

changes one of the type tests (test/types/basic.js) to use this default import.

Prepared following @davepagurek 's instruction. (Thanks!)

PR Checklist

  • [x] npm run lint passes
  • [x] Unit tests are included / updated

nbogie avatar Nov 26 '25 16:11 nbogie

Also tested the fix successfully with a couple of p5 global-mode typescript projects, locally, including this non-trivial one.

Process:

used npm pack on the patched p5 code, and and then in my test projects ran npm install that-new-p5.tgz in place of p5 from npm.
Changed those projects to use import p5 from "p5/global".
Both type-checked and ran fine.

nbogie avatar Nov 28 '25 02:11 nbogie