Skip to content

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

@rtritto

Description

@rtritto

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions