Skip to content

Conversation

@rajk93
Copy link
Contributor

@rajk93 rajk93 commented Nov 7, 2025

fixes #5566

Problem

When using typegen with definitions containing no custom types (only RPC/runtime definitions), the generated types.ts file would be completely empty, causing TypeScript compilation errors when re-exported via export * from './types'.

Solution

Added a phantom export to the tsDef/types.hbs template to ensure the generated file always has at least one export:

  export type PHANTOM_GENERATED = 'generated';

While @jacogr mentioned #5566 (comment) using a timestamped phantom export PHANTOM_GENERATED_<Date.now()> for uniqueness, but here a static phantom export is sufficient because:

  • The file is completely auto-generated and overwritten on each build
  • No conflict risk since the phantom export is never actually imported or used

@rajk93 rajk93 marked this pull request as ready for review November 7, 2025 12:56
Copy link
Member

@ap211unitech ap211unitech left a comment

Choose a reason for hiding this comment

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

Looks fine

@rajk93 rajk93 merged commit 58f4bb7 into master Nov 11, 2025
4 checks passed
@rajk93 rajk93 deleted the rk/fix-empty-types branch November 11, 2025 06:13
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Nov 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to make type generation work without custom definitions provided?

5 participants