Skip to content

Commit 7951e74

Browse files
committed
updated types
1 parent 9fc34e9 commit 7951e74

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed

src/components/TypeAnimation/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { TypeAnimationProps, Wrapper } from './index.types';
88
const DEFAULT_SPEED = 40;
99
const TypeAnimation = forwardRef<
1010
HTMLElementTagNameMap[Wrapper],
11-
TypeAnimationProps & HTMLAttributes<HTMLElementTagNameMap[Wrapper]>
11+
TypeAnimationProps
1212
>(
1313
(
1414
{

src/components/TypeAnimation/index.types.ts

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
export interface TypeAnimationProps extends Props {
2-
ref?: React.Ref<HTMLElementTagNameMap[Wrapper]>;
3-
}
1+
import { HTMLAttributes } from 'react';
42

53
interface Props {
64
sequence: Sequence;
@@ -14,13 +12,42 @@ interface Props {
1412
preRenderFirstString?: boolean;
1513
}
1614

15+
export interface TypeAnimationProps
16+
extends Props,
17+
Pick<
18+
HTMLAttributes<HTMLElementTagNameMap[Wrapper]>,
19+
'style' | 'aria-label' | 'aria-hidden' | 'role' | 'className'
20+
> {
21+
ref?: React.Ref<HTMLElementTagNameMap[Wrapper]>;
22+
}
23+
1724
export type GranularSpeed = {
1825
type: 'keyStrokeDelayInMs';
1926
value: number;
2027
};
2128

2229
export type StringSplitter = (text: string) => ReadonlyArray<string>;
2330

31+
export type Wrapper =
32+
| 'p'
33+
| 'div'
34+
| 'span'
35+
| 'strong'
36+
| 'a'
37+
| 'h1'
38+
| 'h2'
39+
| 'h3'
40+
| 'h4'
41+
| 'h5'
42+
| 'h6'
43+
| 'b';
44+
45+
export type Sequence = Array<SequenceElement>;
46+
export type SequenceElement =
47+
| string
48+
| number
49+
| ((element: HTMLElement | null) => void | Promise<void>);
50+
2451
export type Speed =
2552
| 1
2653
| 2
@@ -121,23 +148,3 @@ export type Speed =
121148
| 97
122149
| 98
123150
| 99;
124-
125-
export type Wrapper =
126-
| 'p'
127-
| 'div'
128-
| 'span'
129-
| 'strong'
130-
| 'a'
131-
| 'h1'
132-
| 'h2'
133-
| 'h3'
134-
| 'h4'
135-
| 'h5'
136-
| 'h6'
137-
| 'b';
138-
139-
export type Sequence = Array<SequenceElement>;
140-
export type SequenceElement =
141-
| string
142-
| number
143-
| ((element: HTMLElement | null) => void | Promise<void>);

0 commit comments

Comments
 (0)