diff --git a/types/react-text-mask/index.d.ts b/types/react-text-mask/index.d.ts new file mode 100644 index 0000000000..f4c46bea58 --- /dev/null +++ b/types/react-text-mask/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for react-text-mask 16.0 +// Project: https://github.com/text-mask/text-mask +// Definitions by: Guilherme Hübner +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; + +export type maskArray = Array; + +export interface MaskedInputProps extends React.InputHTMLAttributes { + mask?: maskArray | ((input: HTMLInputElement) => maskArray); + + guide?: boolean; + + placeholderChar?: string; + + keepCharPositions?: boolean; + + pipe?: (conformedValue: string, config: any) => false | string | { value: string, indexesOfPipedChars: number[] }; + + onReject?: (infos: { conformedValue: string, maskRejection: boolean, pipeRejection: boolean }) => void; + + onAccept?: () => void; +} + +export interface conformToMaskResult { + conformedValue: string; + meta: { + someCharsRejected: boolean + }; +} + +export default class MaskedInput extends React.Component {} + +export function conformToMask(text: string, mask: maskArray, config: any): conformToMaskResult; diff --git a/types/react-text-mask/tsconfig.json b/types/react-text-mask/tsconfig.json new file mode 100644 index 0000000000..ca4a35b1cb --- /dev/null +++ b/types/react-text-mask/tsconfig.json @@ -0,0 +1,22 @@ +{ + "files": [ + "index.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/react-text-mask/tslint.json b/types/react-text-mask/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/react-text-mask/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}