From 43751cf91ff40e5154efda5cead5ba5588275fa6 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Wed, 28 Dec 2016 17:09:04 +0100 Subject: [PATCH] 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 --- react-maskedinput/index.d.ts | 32 +++++++++++++++++++ react-maskedinput/react-maskedinput-tests.tsx | 22 +++++++++++++ react-maskedinput/tsconfig.json | 21 ++++++++++++ react-maskedinput/tslint.json | 1 + 4 files changed, 76 insertions(+) create mode 100644 react-maskedinput/index.d.ts create mode 100644 react-maskedinput/react-maskedinput-tests.tsx create mode 100644 react-maskedinput/tsconfig.json create mode 100644 react-maskedinput/tslint.json diff --git a/react-maskedinput/index.d.ts b/react-maskedinput/index.d.ts new file mode 100644 index 0000000000..3ef7333e77 --- /dev/null +++ b/react-maskedinput/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for react-maskedinput 3.3 +// Project: https://github.com/insin/react-maskedinput +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { ComponentClass, HTMLAttributes } from "react"; + +export as namespace MaskedInput; + +export = MaskedInput; + +declare const MaskedInput: MaskedInput; +type MaskedInput = ComponentClass; + +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 { + mask: string; + formatCharacter?: CharsFormatters; + placeholderChar?: string; + } +} + diff --git a/react-maskedinput/react-maskedinput-tests.tsx b/react-maskedinput/react-maskedinput-tests.tsx new file mode 100644 index 0000000000..609b5c8241 --- /dev/null +++ b/react-maskedinput/react-maskedinput-tests.tsx @@ -0,0 +1,22 @@ +import * as React from "react" + +import * as MaskedInput from "react-maskedinput" + +class Test extends React.Component { + + public render () { + return ( + char, + transform: (char: string) => char + } + } + } /> + ) + } + +} diff --git a/react-maskedinput/tsconfig.json b/react-maskedinput/tsconfig.json new file mode 100644 index 0000000000..941d424dd6 --- /dev/null +++ b/react-maskedinput/tsconfig.json @@ -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" + ] +} diff --git a/react-maskedinput/tslint.json b/react-maskedinput/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/react-maskedinput/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }