gvaldambrini / storybook-router

A storybook decorator that allows you to use routing-aware components in your stories
MIT License
258 stars 33 forks source link

Typescript declaration file (.d.ts) #49

Open rdhainaut opened 4 years ago

rdhainaut commented 4 years ago

Issue:

The declaration file is missing to work properly with typescript. (= typescript support ?)

Which version are you using?

v1.0.7

Are you using storybook-router with a react based project or a vue one?

vue

Please describe the problem:

I have the following error on serve:

Could not find a declaration file for module 'storybook-vue-router'. 'd:/path/node_modules/storybook-vue-router/dist/vue.js' implicitly has an 'any' type.

Please explain how to reproduce the issue or (better) provide an example to do it.

a simple import and use decorator trigger this error

// myComponent.stories.ts
import StoryRouter from "storybook-vue-router";

export default {
  title: "aStory/Title",
  component: MyComponent,
  decorators: [StoryRouter()]
};
Finrod927 commented 4 years ago

You can create a storybook-vue-router.d.ts file with this declaration:

declare module 'storybook-vue-router' {
  export default function storyRouterDecorator(): Function
}

I'm not sure it's 100% correct, but it will fix the "missing declaration file" error