You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hmm, I think it's a consequence of the way the @h5web/shared package is set up, more precisely the fact that it is not marked as an "external" dependency during the build (if you recall, we have to bundle it inside the other packages since it's not published to NPM).
In @h5web/shared, we have a step to build the types to dist-ts with tsc, but I have a feeling that these built types are in fact not used.
When we run tsc in the other packages, @h5web/shared imports are left as is, because TS considers them external imports. We then run Rollup to merge the dist-ts types into a single file, but since @h5web/shared is not marked as external (contrary to @h5web/lib for instance), Rollup tries to find its types to bundle them, but it can't find them because shared/package.json doesn't have a types field (otherwise we'd have to continuously rebuild the types in development). So Rollup (or rather rollup-plugin-dts) tries to read the types from the source files and it looks like it's pretty bad at doing that.
I reckon the Rollup plugin just copies over anything that is imported with import type. In lib/dist/index.d.ts, you can see for instance that the entire mockValues object is bundled in as is. I think this is due to the type import in shared/src/mock/models.ts. Similarly, we use a type import for EntityKind somewhere in the app package.
I'm not seeing a quick and easy solution for this issue right now, unfortunately, but at least I understand why it's happening, which is a good step. 😄 I'll keep thinking.
Describe the bug
The built declaration types of
@h5web/app
give the following error at the first encounteredenum
:To Reproduce
packages/app
pnpm build:dts
dist/index.d.ts
ts(1046)
Context
Encountered when trying to build
jupyterlab-h5web
withh5web@4.1.0
Additional info
rollup-plugin-dts
but closed: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier. Swatinem/rollup-plugin-dts#178enum
should not be ind.ts
files ? https://stackoverflow.com/questions/62109542/enums-in-typescript-d-ts-fileThe text was updated successfully, but these errors were encountered: