hwookim / storybook-addon-cookie

Set document.cookie for each Storybook.
MIT License
9 stars 3 forks source link

No TypeScript declarations file #4

Closed mskrzypek closed 1 year ago

mskrzypek commented 1 year ago

Hello,

I am encountering an issue with storybook-addon-cookie when attempting to use it in a TypeScript project. When I import the module using the following syntax in Storybook's preview.tsx:

import { cookieDecorator } from 'storybook-addon-cookie';

I receive an error:

Cannot find module 'storybook-addon-cookie' or its corresponding type declarations.ts(2307)
Cannot find module 'storybook-addon-cookie' or its corresponding type declarations.
Translation: This could be one of two things - either storybook-addon-cookie doesn't exist on your file system, or I can't find any type declarations for it.

I believe this problem arises due to the absence of TypeScript declarations in your package. Although storybook-addon-cookie appears to be written in TypeScript, it does not ship with the necessary .d.ts files. As a result, TypeScript and supporting IDEs can't recognize the imported module's types.

Ideally, the TypeScript compiler should generate these declaration files during the build process. This can be configured in the tsconfig.json file by setting the "declaration" property to true.

Thank you for your attention to this matter.

hwookim commented 1 year ago

@mskrzypek We apologize for the delayed response. I have added the settings you mentioned and will now generate the d.ts file.

I just followed the options in the addon-kit provided by storybook, but there was no mention of that option..🤔

I'll try to be more responsive next time. Thanks so much for bringing this issue to my attention.