Jimdo/typings-for-css-modules-loader

Need to have named export and interface declaration at the same time for using in isomorphic app

budarin opened this issue · 0 comments

I am developing an isomorphic app and style-loader/useable and use such operator

import appStyles from './app.css';
...
const css = process.env.__BROWSER__ ? appStyles.locals : appStyles;
...
if (process.env.__BROWSER__ ) {
    appStyles.use();
}
...
<div className={css.btn} />

so I need to have both declarations and also to have declared use and ``unuse``` methods

What is needed:
app.css

.hello {
    color: red;
}

app.css.d.ts

export interface IAppCss {
    hello: string;
}
export const hello: string;

export const locals: IAppCss;
export const use: Function;
export const unuse: Function;

Propose to add an option flag isomorphic: boolean (false by default)