diff --git a/types/react-tagsinput/index.d.ts b/types/react-tagsinput/index.d.ts index 945d207475..b9f0de64e0 100644 --- a/types/react-tagsinput/index.d.ts +++ b/types/react-tagsinput/index.d.ts @@ -10,9 +10,7 @@ import * as React from "react"; export as namespace ReactTagsInput; export = TagsInput; -type Tag = any; - -declare class TagsInput extends React.Component { +declare class TagsInput extends React.Component> { accept(): any; addTag(tag: Tag): any; blur(): void; @@ -22,10 +20,10 @@ declare class TagsInput extends React.Component { declare namespace TagsInput { interface InputProps { - readonly [prop: string]: any; + readonly [prop: string]: any; } - interface RenderInputProps extends InputProps { + interface RenderInputProps extends InputProps { readonly addTag: (tag: Tag) => void; readonly onChange: (e: React.ChangeEvent<{ readonly value: string }>) => void; readonly ref: (r: any) => void; // parameter is either a DOM element or a mounted React component @@ -36,7 +34,7 @@ declare namespace TagsInput { readonly [prop: string]: any; } - interface RenderTagProps extends TagProps { + interface RenderTagProps extends TagProps { readonly disabled: boolean; readonly getTagDisplayValue: (tag: Tag) => string; readonly onRemove: (tagIndex: number) => void; @@ -45,7 +43,7 @@ declare namespace TagsInput { type RenderLayout = (tagElements: React.ReactElement[], inputElement: React.ReactElement) => React.ReactChild; - interface ReactTagsInputProps extends React.Props { + interface ReactTagsInputProps extends React.Props> { value: Tag[]; onChange: (tags: Tag[], changed: Tag[], changedIndexes: number[]) => void; onChangeInput?: (value: string) => void; @@ -65,9 +63,9 @@ declare namespace TagsInput { focusedClassName?: string; tagProps?: TagProps; inputProps?: InputProps; - tagDisplayProp?: string | null; - renderTag?: (props: RenderTagProps) => React.ReactNode; - renderInput?: (props: RenderInputProps) => React.ReactNode; + tagDisplayProp?: keyof Tag | string | null; + renderTag?: (props: RenderTagProps) => React.ReactNode; + renderInput?: (props: RenderInputProps) => React.ReactNode; renderLayout?: RenderLayout; preventSubmit?: boolean; }