export internal type modules for TypeScript portability#1446
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1446 +/- ##
=======================================
Coverage 92.26% 92.26%
=======================================
Files 32 32
Lines 5781 5781
=======================================
Hits 5334 5334
Misses 447 447 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This might already be fixed in #1436, just not published to npm. |
|
Interesting - anyone care to describe the difference between those two solutions? We should probably put out another release once import gets merged and we've kicked the tires a bit. |
|
@tonious You're right, the current
If I understand correctly, there are two
Because of the order of the @tonious If there is no other good reason to export these |
|
API-Extractor rolls up the type declarations. I've disabled a bunch of the functionality, as this is pretty much all we need it to do. There are separate roll-ups for overall manifoldCAD functions, and the few functions like animation and level-of-detail that are only changeable at the top level. @Loosetooth said:
Now that I've thought about it a little, this PR makes sense. I didn't feel comfortable entirely omitting the not-rolled-up-version of Can I request a few small changes while you're cleaning up my mess? Complete extensions for consistency: "./manifold-encapsulated-types.d.ts": "./manifold-encapsulated-types.d.ts",
"./manifold-global-types.d.ts": "./manifold-global-types.d.ts"Also, we should probably explicitly export "./manifold.js": "./manifold.js",
"./manifold.d.ts": "./manifold.d.ts",
"./manifold": {
"import": {
"types": "./manifold.d.ts",
"default": "./manifold.js"
}
},@elalish said:
I'm working on it! 😂 |
|
@tonious I added your proposed changes. I also added and explicit export for |
|
Looks good! Thanks, @Loosetooth :) |
When users write ManifoldCAD scripts and try to transpile them with TypeScript tools (tsc, tsdown, rolldown), they encounter error TS2742:
Root cause: The
lib/*.d.tsfiles (andmanifold.d.tsitself) import from./manifold-encapsulated-typesand./manifold-global-types, but these modules aren't declared in the package.jsonexportsmap. TypeScript sees these as internal, non-portable paths.Fix: Add the missing exports:
These files are already shipped in the package and imported by
manifold.d.ts. They just weren't explicitly exported.