diff --git a/types/inline-style-prefixer/index.d.ts b/types/inline-style-prefixer/index.d.ts index 8c730fff2f..b7edaf3e59 100644 --- a/types/inline-style-prefixer/index.d.ts +++ b/types/inline-style-prefixer/index.d.ts @@ -1,28 +1,25 @@ -// Type definitions for inline-style-prefixer 3.0 +// Type definitions for inline-style-prefixer 5.0 // Project: https://github.com/rofrischmann/inline-style-prefixer // Definitions by: Andrej Hazucha // dpetrezselyova +// Frank Li // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 -declare namespace InlineStylePrefixer { - interface Configuration { - userAgent?: string; - keepUnprefixed?: boolean; - } +export type Plugin = ( + property: string, + value: number | string | number[] | string[] | T, + style: T, + prefixMap?: Record +) => number | string | number[] | string[] | T | undefined; + +export interface StaticData { + prefixMap: Record; + plugins: Plugin[]; } -declare class InlineStylePrefixer { - constructor(cfg?: InlineStylePrefixer.Configuration); +export type Prefix = (style: T) => T; - prefix(style: CSSStyleDeclaration): CSSStyleDeclaration; +export function createPrefixer(staticData: StaticData): Prefix; - // support for React.CSSProperties - prefix(style: T): T; - - static prefixAll(style: CSSStyleDeclaration): CSSStyleDeclaration; - - // support for React.CSSProperties - static prefixAll(style: T): T; -} - -export = InlineStylePrefixer; +export const prefix: Prefix; diff --git a/types/inline-style-prefixer/inline-style-prefixer-tests.ts b/types/inline-style-prefixer/inline-style-prefixer-tests.ts index 6971eac32d..1c26fcea35 100644 --- a/types/inline-style-prefixer/inline-style-prefixer-tests.ts +++ b/types/inline-style-prefixer/inline-style-prefixer-tests.ts @@ -1,8 +1,6 @@ -import Prefixer = require('inline-style-prefixer'); +import { prefix } from 'inline-style-prefixer'; -const prefixer = new Prefixer(); - -const prefixed = prefixer.prefix({ +const prefixed = prefix({ fontSize: '16', flexDirection: 'column' });