From 58d948e92273e76ea221491221507ef7dc08e4d9 Mon Sep 17 00:00:00 2001 From: Yaroslav Romanenko Date: Tue, 21 Dec 2021 12:21:39 +0200 Subject: [PATCH] fix: typescript errors for input and password component --- src/Input/Input.tsx | 5 +---- src/Password/Password.tsx | 5 +++-- src/types.ts | 2 ++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Input/Input.tsx b/src/Input/Input.tsx index e93e1ed..b1ef043 100644 --- a/src/Input/Input.tsx +++ b/src/Input/Input.tsx @@ -9,13 +9,10 @@ import React, { } from 'react'; import cx from 'clsx'; import Hint from '../Hint/Hint'; -import { Error } from '../types'; - +import { Error, InputValueType } from '../types'; type InputElementType = HTMLInputElement | HTMLTextAreaElement; -type InputValueType = string | number | readonly string[]; - export interface InputProps extends Omit, 'onChange'> { scale?: 'medium' | 'small' | 'big'; error?: Error; diff --git a/src/Password/Password.tsx b/src/Password/Password.tsx index 5396b54..da508a0 100644 --- a/src/Password/Password.tsx +++ b/src/Password/Password.tsx @@ -1,15 +1,16 @@ import React, { FC, InputHTMLAttributes, ReactNode, useState } from 'react'; import Input from '../Input/Input'; import Button from '../Button/Button'; -import { Error } from '../types'; +import { Error, InputValueType } from '../types'; -export interface PasswordProps extends InputHTMLAttributes { +export interface PasswordProps extends Omit, 'onChange'> { scale?: 'medium' | 'small'; label?: string | ReactNode; error?: Error; withToggle?: boolean; i18nToggle?: (isPasswordVisible: boolean) => string; onToggle?: () => void; + onChange?:(value: InputValueType, event?: React.ChangeEvent) => void; } function i18nToggleDefault(isPasswordVisible: boolean) { diff --git a/src/types.ts b/src/types.ts index 284ff00..5628b59 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,5 @@ import { ReactNode } from 'react'; export type Error = boolean | string | ReactNode; + +export type InputValueType = string | number | readonly string[];