Skip to content
This repository was archived by the owner on Oct 30, 2020. It is now read-only.

Unsupported class names #39

Open
ghost opened this issue Sep 19, 2017 · 5 comments
Open

Unsupported class names #39

ghost opened this issue Sep 19, 2017 · 5 comments

Comments

@ghost
Copy link

ghost commented Sep 19, 2017

Great module, and I got it working easily enough.

I'm currently importing the class names from bootstrap.less, and one of the classes is called in.

'in' is a reserved keyword and so causes a validation error in the bootstrap.less.d.ts file.

I had a look through the options, but there didn't appear to be an option that addresses this issue.

My 'webpack.config.js' section FWIW:

{
    loader: 'typings-for-css-modules-loader',
    options: {
        modules: true,
        namedExport: true,
        camelCase: true,
        sourceMap: true
    }
},
@ghost
Copy link
Author

ghost commented Sep 19, 2017

Don't use "in" as a class name seems the obvious answer, however it's part of bootstrap so I don't have control over that beyond "don't use bootstrap" which isn't much of an option.

A way to tell 'typings-for-css-modules-loader' to ignore any classes with reserved keyword names would be fine by me.

Or someway to have them automatically renamed.
e.g. "in" would become "reserved_in" or similar.

@timse
Copy link
Contributor

timse commented Sep 21, 2017

hum good question - not sure if there is a way to make typescript ignore the "in" ?
e.g. by making it a string etc. - any ideas?

@scamden
Copy link

scamden commented Oct 3, 2017

using non named exports is a workaround

@scamden
Copy link

scamden commented Oct 3, 2017

except for me that's broken per #20

@aaronbeall
Copy link

@timse @scamden I posted in #20 but there is a way I believe we can export reserved words as top-level exports:

interface IFooCss { }
declare const styles: IFooCss;
export = styles;

This is basically commonjs compatibility syntax. If you want to expose IFooCss I think you can just wrap it in a namespace with the same name as the const.

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

No branches or pull requests

3 participants