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

ts file which has declarations only will not emit corresponding d.ts #868

Closed
littlee opened this issue Jul 21, 2021 · 3 comments
Closed

Comments

@littlee
Copy link

littlee commented Jul 21, 2021

src:
index.ts

import { T } from './model';
export function a(b: T) {}

model.ts

export type T = {
  a: string;
}

package.json

{
  "name": "my-lib",
  "version": "1.0.0",
  "types": "types/index.d.ts",
  "scripts": {
    "build": "microbundle"
  },
  "devDependencies": {
    "microbundle": "^0.13.3"
  }
}

after building, ./types directory has only one file, model.d.ts is missing
image

@rschristian
Copy link
Collaborator

rschristian commented Jul 21, 2021

@littlee This happens because you (likely) haven't set your tsconfig.json up correctly. You need to make sure both files are included by your config, for example:

{
  ...
  "include": ["src/**/*"]
}

This ensures types/model.d.ts gets created. See ezolenko/rollup-plugin-typescript2#106 (comment)

@littlee
Copy link
Author

littlee commented Jul 21, 2021

🤦 alright

@agilgur5
Copy link
Contributor

agilgur5 commented Sep 17, 2022

Thought I'd update here that I fixed the root cause upstream in ezolenko/rollup-plugin-typescript2#406, which was released in rpt2 0.34.0.

The tsconfig include workaround should no longer be necessary, and one can now use tsconfig files instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants