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

Typescript support? #3

Open
andfaulkner opened this issue Jun 28, 2017 · 2 comments
Open

Typescript support? #3

andfaulkner opened this issue Jun 28, 2017 · 2 comments

Comments

@andfaulkner
Copy link

andfaulkner commented Jun 28, 2017

Using this module in Typescript results in compilation failures.

For example, writing the following:

@cm
export class MainClientRootView extends React.Component<MainClientRootViewProps, {}> {
    render() {
        return (
            <div className={['minh-100p', 'maxh-100p', 'h-100p']}>
                 ....
            </div>
        )
    }
};

...causes the following on compilation:

[at-loader] Checking started in a separate process...

[at-loader] Checking finished with 4 errors
[at-loader] ./app/client/components-subapp/main-client/main-client-root-view.tsx:47:22
    TS2322: Type 'string[]' is not assignable to type 'string'.

However, the component works at runtime. I know the module is working, because removing the decorator breaks it.

I really like this react-classname-module, but this is a dealbreaker for Typescript projects. It'd be fantastic if there were a baked-in solution available. I think (but am not sure) automatic overrides of React/JSX/TSX typings applied immediately on importing the module could do the trick.

@timomeh
Copy link
Contributor

timomeh commented Jun 28, 2017

This module is currently unmaintained. I'm kinda amazed it's still in use. 😅 But I'm open for PRs.

@andfaulkner
Copy link
Author

Thanks - in that case, if I get the time I'll put together a solution for this.

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

2 participants