diff --git a/types/react-dynamic-number/index.d.ts b/types/react-dynamic-number/index.d.ts new file mode 100644 index 0000000000..c1ffdc229d --- /dev/null +++ b/types/react-dynamic-number/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for react-dynamic-number 1.7 +// Project: https://github.com/uhlryk/react-dynamic-number +// Definitions by: Eugene Rodin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from 'react'; + +/** + * remove Diff & Omit when in will be placed in TS from scratch + */ +export type Diff = ({[P in T]: P} & {[P in U]: never} & {[x: string]: never})[T]; +export type Omit = {[P in Diff]: T[P]}; + +export type BaseInputProps = Partial< + Omit< + React.DetailedHTMLProps, HTMLInputElement>, + 'ref' | 'value' | 'onChange' | 'placeholder' + > +>; + +export interface DynamicNumberProps extends BaseInputProps { + value?: number | ''; + separator?: '.' | ','; + thousand?: boolean | ' '; + integer?: number; + fraction?: number; + positive?: boolean; + negative?: boolean; + placeholder?: string; + onChange?: (event: React.ChangeEvent, modelValue: number, viewValue: string) => void; +} + +export default class DynamicNumber extends React.Component {} diff --git a/types/react-dynamic-number/react-dynamic-number-tests.tsx b/types/react-dynamic-number/react-dynamic-number-tests.tsx new file mode 100644 index 0000000000..0dd947b6c7 --- /dev/null +++ b/types/react-dynamic-number/react-dynamic-number-tests.tsx @@ -0,0 +1,16 @@ +import * as React from 'react'; +import DynamicNumber from 'react-dynamic-number'; + +export class Test extends React.Component { + render() { + return ( + + ); + } +} diff --git a/types/react-dynamic-number/tsconfig.json b/types/react-dynamic-number/tsconfig.json new file mode 100644 index 0000000000..ad1a3aee65 --- /dev/null +++ b/types/react-dynamic-number/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "strictFunctionTypes": true + }, + "files": ["index.d.ts", "react-dynamic-number-tests.tsx"] +} diff --git a/types/react-dynamic-number/tslint.json b/types/react-dynamic-number/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-dynamic-number/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }