Skip to content

Commit

Permalink
feat: add typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Nov 6, 2019
1 parent 519d167 commit 74a1b83
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 74a1b83

Please sign in to comment.