Skip to content

Typescript support? #3

@andfaulkner

Description

@andfaulkner

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions