DEV Community

Discussion on: How to Create and Publish a React Component Library

Collapse
 
kbradley profile image
Kristin Bradley • Edited

Great article! Very clear and easy to follow.

When importing the library I created into my test application, it worked great except I got this error: TS7016: Could not find a declaration file for module ... implicitly has an 'any' type.

It looks like I need to declare the module for my components but I'm unsure where to do this? I want to add this in the component library itself so users importing it won't see this error.

Collapse
 
alexeagleson profile image
Alex Eagleson • Edited

The output of the declaration files is covered in the "Adding Rollup" section. From this part of the rollup config in particular:

  {
    input: "dist/esm/types/index.d.ts",
    output: [{ file: "dist/index.d.ts", format: "esm" }],
    plugins: [dts()],
  },
Enter fullscreen mode Exit fullscreen mode
Collapse
 
kbradley profile image
Kristin Bradley

Ok thanks. I double checked and I have that in my rollup.config.js file.

Some comments have been hidden by the post's author - find out more