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

Storybook does not support declare TypeScript interface #13818

Closed
temurih opened this issue Feb 4, 2021 · 2 comments
Closed

Storybook does not support declare TypeScript interface #13818

temurih opened this issue Feb 4, 2021 · 2 comments

Comments

@temurih
Copy link

temurih commented Feb 4, 2021

Describe the bug

I get it, Storybook is not meant to support TypeScript. I am ok with it. But it should support basics of TS. One of them is declare, all you have to do is ignore it wherever you find. I don't think it should be hard to implement.

image

To Reproduce
Steps to reproduce the behavior:

Just add the following and try to compile with Storybook,

declare global {
    interface Window {
        something?: {
            open: (config: object, id: string) => unknown;
        };
    }
}

Expected behavior

Just ignore wherever it finds declare

Version

Storybook 6.1.17
"@storybook/addon-essentials": "^6.1.17",
"@storybook/addon-info": "^5.3.21",
"@storybook/addon-links": "^6.1.17",
"@storybook/addons": "^6.1.17",
"@storybook/preset-create-react-app": "3.1.5",
"@storybook/react": "^6.1.17",

@phated
Copy link
Contributor

phated commented Feb 9, 2021

declare syntax can only be used in .d.ts files, as per https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html, but you've tried to specify it in a .tsx file.

@temurih
Copy link
Author

temurih commented Feb 15, 2021

@phated, ok!!! I am not sure about that, because I can use it in any file and it compiles just fine. But anyway, let that go. What do you think about entends? Where that should be used in your opinion?

image

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

No branches or pull requests

3 participants