egoist / tsup

The simplest and fastest way to bundle your TypeScript libraries.
https://tsup.egoist.dev
MIT License
8.99k stars 217 forks source link

Module '"tsup"' declares 'BuildEnd' locally, but it is not exported. #556

Open leonardssh opened 2 years ago

leonardssh commented 2 years ago

I wrote a plugin and saw that types are not exported, only declared locally. image

If I try to use it directly, it is not found. image

Upvote & Fund

Fund with Polar

egoist commented 2 years ago

As it is said it's not exported, it's not a public API yet but if you want to use it you can type your plugin like this:

type Unpacked<T> = T extends undefined ? never : T extends (infer U)[] ? U : T;

type Plugin = Unpacked<Options['plugins']>

const somePlugin = (): Plugin => {
  return {}
}