Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

w3nl
Copy link
Contributor

@w3nl w3nl commented Sep 12, 2025

What

Users are having module declaration issues when importing @trojs/openapi-server:

Could not find a declaration file for module '@trojs/openapi-server'. '/xxx/backend/node_modules/@trojs/openapi-server/src/server.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/trojs__openapi-server` if it exists or add a new declaration (.d.ts) file containing `declare module '@trojs/openapi-server';`ts(7016)

This PR enhances JSDoc documentation and adds declaration file generation to improve type support. The npm run build:types runs on npm run publish.

  • It uses typescript tsc cli only to convert JSDoc comment into .d.ts files.
  • tsconfig config is default generated with tsc --init.

How to test

To generate the declaration files from JSDoc, run:

npm run build:types

Check that types folder is created with .d.ts files

Let me know if you have any questions!

@w3nl w3nl requested a review from Copilot September 12, 2025 09:34
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds TypeScript declaration file generation to enable better type support for users importing the @trojs/openapi-server package. It addresses module declaration issues by generating .d.ts files from JSDoc comments during the publish process.

  • Added TypeScript as a dependency and configured build:types script to generate declaration files
  • Updated publish process to automatically generate types before publishing via prepublishOnly hook
  • Added types field to package.json to specify the main declaration file entry point

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

coderabbitai bot commented Sep 12, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/types

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@w3nl w3nl merged commit 7b0a24b into v1.x Sep 12, 2025
11 checks passed
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.