mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 22:38:33 +08:00
Add definitions for react-maskedinput (#13430)
* Add definitions for react-maskedinput * Add tslint.json * Add required compiler option * Add flag to compile against typescript 2.1 * Add semicolon, remove ts 2.1 target
This commit is contained in:
32
react-maskedinput/index.d.ts
vendored
Normal file
32
react-maskedinput/index.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Type definitions for react-maskedinput 3.3
|
||||
// Project: https://github.com/insin/react-maskedinput
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { ComponentClass, HTMLAttributes } from "react";
|
||||
|
||||
export as namespace MaskedInput;
|
||||
|
||||
export = MaskedInput;
|
||||
|
||||
declare const MaskedInput: MaskedInput;
|
||||
type MaskedInput = ComponentClass<MaskedInput.MaskedInputProps>;
|
||||
|
||||
declare namespace MaskedInput {
|
||||
|
||||
export interface FormatCharacter {
|
||||
validate(char: string): string;
|
||||
transform?(char: string): string;
|
||||
}
|
||||
|
||||
export interface CharsFormatters {
|
||||
[char: string]: FormatCharacter;
|
||||
}
|
||||
|
||||
export interface MaskedInputProps extends HTMLAttributes<any> {
|
||||
mask: string;
|
||||
formatCharacter?: CharsFormatters;
|
||||
placeholderChar?: string;
|
||||
}
|
||||
}
|
||||
|
||||
22
react-maskedinput/react-maskedinput-tests.tsx
Normal file
22
react-maskedinput/react-maskedinput-tests.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import * as React from "react"
|
||||
|
||||
import * as MaskedInput from "react-maskedinput"
|
||||
|
||||
class Test extends React.Component<any, any> {
|
||||
|
||||
public render () {
|
||||
return (
|
||||
<MaskedInput mask="111"
|
||||
placeholderChar="X"
|
||||
formatCharacter={
|
||||
{
|
||||
"a" : {
|
||||
validate: (char: string) => char,
|
||||
transform: (char: string) => char
|
||||
}
|
||||
}
|
||||
} />
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
21
react-maskedinput/tsconfig.json
Normal file
21
react-maskedinput/tsconfig.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-maskedinput-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
react-maskedinput/tslint.json
Normal file
1
react-maskedinput/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user