dts resolve is not working (with repro)
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
I cannot get the `dts.resolve` option to work at all.
All of the options I have tried thus far result in importing of the types from an external package.
Things I have done:
- [x] Imported the dependency as a `devDependencies`
- [x] Used the imported types and also re-exported them from the package.
- [x] Set `dts.resolve` to `true`
- [x] Tried setting `dts.resolve` to an array and include the specific package.
- [x] Tried adding `noExternal` with the package name to force it to always bundle.
Repro repo: https://github.com/moltar/tsup-dts-resolve#readme
---
**Edit:** Interesting, 🤔 ...
This seems to be limited to the specific package (`@changesets/types`).
I tried to make the same example by importing `tsup` type `Format` and it actually worked, and re-exported the `Format` type as required.
```ts
// test
type Format = 'cjs' | 'esm' | 'iife';
type MyFormat = Format;
declare const config: MyFormat;
export { MyFormat, config };
```
---
**Edit 2**: That does appear to be an issue with the package!
Adding this to `@changesets/types` `package.json` file does fix the problem:
```json
"types": "dist/types.cjs.d.ts",
```
Output:
```ts
// test
declare const DEPENDENCY_TYPES: readonly ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
declare type DependencyType = typeof DEPENDENCY_TYPES[number];
type MyDependencyType = DependencyType;
declare const config: MyDependencyType;
export { MyDependencyType, config };
```
Contributor guide
Assessment
This issue has not been assessed yet.