mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 00:18:20 +08:00
react-css-modules: augment react's HTMLAttributes interface (#12184)
* augment react's HTMLAttributes interface with styleName * move 'react-css-modules' declarations to top-level, turn on strictNullChecks
This commit is contained in:
committed by
Masahiro Wakame
parent
30907212e7
commit
4c4aeebb1e
58
react-css-modules/index.d.ts
vendored
58
react-css-modules/index.d.ts
vendored
@@ -1,33 +1,35 @@
|
||||
// Type definitions for react-css-modules 3.7.9
|
||||
// Project: https://github.com/gajus/react-css-modules
|
||||
// Definitions by: Kostya Esmukov <https://github.com/KostyaEsmukov>
|
||||
// Definitions by: Kostya Esmukov <https://github.com/KostyaEsmukov>, Tadas Dailyda <https://github.com/skirsdeda>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module 'react-css-modules' {
|
||||
|
||||
interface TypeOptions {
|
||||
allowMultiple?: boolean;
|
||||
errorWhenNotFound?: boolean;
|
||||
}
|
||||
|
||||
type StylesObject = any;
|
||||
|
||||
interface CSSModules {
|
||||
(defaultStyles: StylesObject, options?: TypeOptions): <C extends Function>(Component: C) => C;
|
||||
<C extends Function>(Component: C, defaultStyles: StylesObject, options?: TypeOptions): C;
|
||||
}
|
||||
|
||||
module CSSModules {
|
||||
// Extend your component's Prop interface with this one to get access to `this.props.styles`
|
||||
//
|
||||
// interface MyComponentProps extends CSSModules.InjectedCSSModuleProps {}
|
||||
interface InjectedCSSModuleProps {
|
||||
styles?: StylesObject;
|
||||
}
|
||||
}
|
||||
|
||||
let CSSModules: CSSModules;
|
||||
|
||||
export = CSSModules;
|
||||
interface TypeOptions {
|
||||
allowMultiple?: boolean;
|
||||
errorWhenNotFound?: boolean;
|
||||
}
|
||||
|
||||
type StylesObject = any;
|
||||
|
||||
interface CSSModules {
|
||||
(defaultStyles: StylesObject, options?: TypeOptions): <C extends Function>(Component: C) => C;
|
||||
<C extends Function>(Component: C, defaultStyles: StylesObject, options?: TypeOptions): C;
|
||||
}
|
||||
|
||||
declare module CSSModules {
|
||||
// Extend your component's Prop interface with this one to get access to `this.props.styles`
|
||||
//
|
||||
// interface MyComponentProps extends CSSModules.InjectedCSSModuleProps {}
|
||||
interface InjectedCSSModuleProps {
|
||||
styles?: StylesObject;
|
||||
}
|
||||
}
|
||||
|
||||
declare let CSSModules: CSSModules;
|
||||
|
||||
export = CSSModules;
|
||||
|
||||
declare module 'react' {
|
||||
interface HTMLAttributes<T> {
|
||||
styleName?: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -15,4 +15,4 @@
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user