Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty export in type definition file: type definition file is ignored #95

Open
2 tasks
rtritto opened this issue Oct 11, 2024 · 0 comments
Open
2 tasks
Labels
bug Something isn't working

Comments

@rtritto
Copy link

rtritto commented Oct 11, 2024

Problem

After build there is a warning log:

Generated an empty chunk: "types.d".

The export in the type definition file is empty:

// /dist/types.d.mts
export {  }

Notes

  • seems that types.d.ts is ignored by pkgroll
  • same behaviour changing package.json:
    • {
        "types": "./dist/types.d.ts"
        "exports": {
          "types": "./dist/types.d.ts"
        }
      }
    • {
        "types": "./dist/index.d.ts"
        "exports": {
          "types": "./dist/index.d.ts"
        }
      }
    • {
        "types": "./dist/index.d.mts"
        "exports": {
          "types": "./dist/index.d.mts"
        }
      }
  • PnP (Plug'n'Play) is enabled with Yarn Berry (should not be relevant)
  • is generated without type definition file (as default, maybe should be generated a types.d.ts if export(s) is index.js or types.d.mts if export(s) is index.mjs)

Expected behavior

/dist/types.d.mts file contains related type definition:

declare function getValue(value: StringOrNumber): StringOrNumber;

export { getValue };

Minimal reproduction URL

https://github.com/rtritto/test-pkgroll/tree/bug-type-definition

Version

2.5.0

Node.js version

22.9.0

Package manager

yarn

Operating system

Windows

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work financially will speed up resolution

  • I'm willing to offer financial support
@rtritto rtritto added the bug Something isn't working label Oct 11, 2024
@rtritto rtritto changed the title Type definition file isn't bundled Type definition file is empty Oct 11, 2024
@rtritto rtritto changed the title Type definition file is empty Empty export of type definition file Oct 11, 2024
@rtritto rtritto changed the title Empty export of type definition file Empty export in type definition file Oct 11, 2024
@rtritto rtritto changed the title Empty export in type definition file Empty export in type definition file: types.d file is ignored Oct 11, 2024
@rtritto rtritto changed the title Empty export in type definition file: types.d file is ignored Empty export in type definition file: type definition file is ignored Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant