Add react-text-mask definitions (#23871)

This commit is contained in:
Guilherme Hübner Franco
2018-02-26 12:33:11 -08:00
committed by Andy
parent c37774d139
commit 35cb910717
3 changed files with 61 additions and 0 deletions
+36
View File
@@ -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 <https://github.com/guilhermehubner>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from "react";
export type maskArray = Array<string | RegExp>;
export interface MaskedInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
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<MaskedInputProps, any> {}
export function conformToMask(text: string, mask: maskArray, config: any): conformToMaskResult;
+22
View File
@@ -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
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}