From f0261fe530ea8534aca1f7f1ca6928bae0fb6a55 Mon Sep 17 00:00:00 2001 From: Artem Lyubchuk Date: Fri, 24 Aug 2018 14:28:13 +0300 Subject: [PATCH] Fix type of ref argument for render property --- types/react-text-mask/index.d.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/types/react-text-mask/index.d.ts b/types/react-text-mask/index.d.ts index f59878e83f..c5b968a5e0 100644 --- a/types/react-text-mask/index.d.ts +++ b/types/react-text-mask/index.d.ts @@ -4,11 +4,12 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import * as React from 'react'; +import * as React from "react"; export type maskArray = Array; -export interface MaskedInputProps extends React.InputHTMLAttributes { +export interface MaskedInputProps + extends React.InputHTMLAttributes { mask?: maskArray | ((value: string) => maskArray); guide?: boolean; @@ -17,11 +18,14 @@ export interface MaskedInputProps extends React.InputHTMLAttributes false | string | { value: string; indexesOfPipedChars: number[] }; + pipe?: ( + conformedValue: string, + config: any + ) => false | string | { value: string; indexesOfPipedChars: number[] }; showMask?: boolean; - render?: (ref: MaskedInput, props: any) => any; + render?: (ref: (inputElement: HTMLElement) => void, props: any) => any; } export interface conformToMaskResult { @@ -31,6 +35,13 @@ export interface conformToMaskResult { }; } -export default class MaskedInput extends React.Component {} +export default class MaskedInput extends React.Component< + MaskedInputProps, + any +> {} -export function conformToMask(text: string, mask: maskArray, config: any): conformToMaskResult; +export function conformToMask( + text: string, + mask: maskArray, + config: any +): conformToMaskResult;