diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..4922385 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,39 @@ +/** + * Parses inline style to object. + * + * @example + * import StyleToObject from 'style-to-object'; + * StyleToObject('line-height: 42;'); + * + */ + +declare var StyleToObject: ( + style: string, + iterator?: StyleToObject.Iterator +) => { [name: string]: any } | null; +export = StyleToObject; + +declare namespace StyleToObject { + interface DeclarationPos { + line: number; + column: number; + } + + // declaration is object from module `inline-style-parser` + interface Declaration { + type: string; + property: string; + value: string; + position: { + start: DeclarationPos; + end: DeclarationPos; + source: any; + }; + } + + type Iterator = ( + property: string, + value: string, + declaration: Declaration + ) => void; +}