v2.1.0
New template for generated files to avoid issues with the requirement to use default imports in environments that don't have esModuleInterop
enabled (PR #14) fixes #8
Example:
// generated d.ts
declare namespace ExampleCssModule {
export interface IExampleCss {
"bar-baz": string;
composed: string;
foo: string;
}
}
declare const ExampleCssModule: ExampleCssModule.IExampleCss & {
/** WARNING: Only available when `css-loader` is used without `style-loader` or `mini-css-extract-plugin` */
locals: ExampleCssModule.IExampleCss;
};
export = ExampleCssModule;
This type declaration allows the following usage:
import * as styles from "./example.css";
import { IExampleCss } from "./example.css";
console.log(styles.composed);
// or default import when TS `esModuleInterop` enabled
import styles from "./example.css";
import { IExampleCss } from "./example.css";
console.log(styles.composed);