Skip to content

Emit type declarations#30

Merged
alvinsw merged 2 commits intoLanguage-Research-Technology:masterfrom
omkar-ethz:typings
Apr 15, 2026
Merged

Emit type declarations#30
alvinsw merged 2 commits intoLanguage-Research-Technology:masterfrom
omkar-ethz:typings

Conversation

@omkar-ethz
Copy link
Copy Markdown

Motivation

Currently, the ro-crate package as published on npm does not include type declarations. This means ts projects cannot benefit from typings for ROCrate, Entity, etc.
This PR attempts to fix project configuration to export type declarations in the npm package.

Changes

  • Add declaration: true to tsconfig
  • Rename types.d.ts to types.ts, as .d.ts files are not considered for compilation (stackoverflow)
  • include type declarations in npm package by adding types to package.json

@omkar-ethz
Copy link
Copy Markdown
Author

Tested with my fork that the published npm package includes type declarations: https://www.npmjs.com/package/@omkar.xyz/ro-crate

@omkar-ethz
Copy link
Copy Markdown
Author

@alvinsw @moisbo any interest in merging this? or should we handle the absence of types by having a copy of type declarations in our project.. of course we would prefer the former:)

@alvinsw
Copy link
Copy Markdown
Member

alvinsw commented Mar 18, 2026

@omkar-ethz Sorry I just noticed your PR today. Thank you for your contribution. I am still a little bit unsure that the javascript code must be compiled using tsc, but there may not be another way. I will discuss this first with my team and do more tests.

Copy link
Copy Markdown
Member

@alvinsw alvinsw left a comment

Choose a reason for hiding this comment

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

I will merge this first and then try it, then publish it as a new version separately.

@alvinsw alvinsw merged commit 046123f into Language-Research-Technology:master Apr 15, 2026
@omkar-ethz
Copy link
Copy Markdown
Author

Thanks @alvinsw ! let me know in case of any issues

@alvinsw
Copy link
Copy Markdown
Member

alvinsw commented Apr 15, 2026

@omkar-ethz I have published v3.7.1 but I have to pin typedoc to version 0.28.13 which still uses typescript 5. If I upgrade typedoc to current version (with typescript 6), tsc will output a lot of errors. Would you be able to try and see if there is any quick workaround without having to fix all the sloppy typings (for now)?

@omkar-ethz
Copy link
Copy Markdown
Author

@alvinsw it seems that typescript 6 made 'strict: true' as default, setting it explicitly to false in tsconfig.json got rid of most errors. I will create a PR with updated typedoc and ts versions

@omkar-ethz
Copy link
Copy Markdown
Author

@alvinsw #32 fix for TypeScript 6

github-merge-queue bot pushed a commit to paulscherrerinstitute/scilog that referenced this pull request Apr 16, 2026
We enabled type declarations upstream in the `ro-crate` library
([PR](Language-Research-Technology/ro-crate-js#30)).
Upgrading to v3.7.1 of the lib which includes them. 
Moreover rocrate.metadata was a type error (but somehow still working),
replaced it with
[descriptor](https://language-research-technology.github.io/ro-crate-js/v3.7/classes/ROCrate.html#descriptor)
instead.
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