From 1c3089e2a8d4cbc879a1e2bcb11a8d27cd040f2d Mon Sep 17 00:00:00 2001 From: Neek Sandhu Date: Mon, 17 Jul 2017 23:02:35 -0700 Subject: [PATCH] Update index.d.ts Add support for css pre-processors like `sass`, `less` etc. --- types/css-modules/index.d.ts | 47 ++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/types/css-modules/index.d.ts b/types/css-modules/index.d.ts index 8b65145a52..7d7bd52abd 100644 --- a/types/css-modules/index.d.ts +++ b/types/css-modules/index.d.ts @@ -1,21 +1,38 @@ -// Type definitions for css-modules 1506 +// Type definitions for css-modules 1.0 // Project: https://github.com/css-modules/css-modules // Definitions by: NeekSandhu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +interface Stringifyable { + /** + * Stringifies the imported stylesheet for use with inline style tags + */ + toString(): string; +} +interface SelectorNode { + /** + * Returns the specific selector from imported stylesheet as string + */ + [key: string]: string; +} declare module '*.css' { - type Stringifyable = { - /** - * Stringifies the imported stylesheet for use with inline style tags - */ - toString: () => string - } - type SelectorNode = { - /** - * Returns the specific selector from imported stylesheet as string - */ - [key: string]: string - } - const styles: SelectorNode & Stringifyable - export default styles + const styles: SelectorNode & Stringifyable; + export default styles; +} + +declare module '*.scss' { + const styles: SelectorNode & Stringifyable; + export default styles; +} + +declare module '*.sass' { + const styles: SelectorNode & Stringifyable; + export default styles; +} + +declare module '*.less' { + const styles: SelectorNode & Stringifyable; + export default styles; }