Skip to content

Commit

Permalink
fix: typescript errors for input and password component
Browse files Browse the repository at this point in the history
  • Loading branch information
wallwhite committed Dec 21, 2021
1 parent 4799186 commit 58d948e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
scale?: 'medium' | 'small' | 'big';
error?: Error;
Expand Down
5 changes: 3 additions & 2 deletions src/Password/Password.tsx
Original file line number Diff line number Diff line change
@@ -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<HTMLInputElement> {
export interface PasswordProps extends Omit<InputHTMLAttributes<HTMLInputElement>, '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) {
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ReactNode } from 'react';

export type Error = boolean | string | ReactNode;

export type InputValueType = string | number | readonly string[];

0 comments on commit 58d948e

Please sign in to comment.