File tree Expand file tree Collapse file tree 2 files changed +29
-14
lines changed
source/library/components/py-terminal Expand file tree Collapse file tree 2 files changed +29
-14
lines changed Original file line number Diff line number Diff line change 1
1
import propTypes from "prop-types" ;
2
- import { PyTerminalProperties , PyTerminalTag } from "./py-terminal.types" ;
2
+ import { forwardRef } from "react" ;
3
+ import type { PyTerminalProperties , PyTerminalTag } from "./py-terminal.types" ;
3
4
4
- const PyTerminal : PyTerminalTag = < T extends object > ( {
5
- ...rest
6
- } : PyTerminalProperties < T > ) : JSX . Element => {
7
- return < py-terminal { ...rest } /> ;
8
- } ;
5
+ const PyTerminal : PyTerminalTag = forwardRef (
6
+ < OptionalProperties extends object > (
7
+ properties : PyTerminalProperties < OptionalProperties > ,
8
+ ) : JSX . Element => {
9
+ return < py-terminal { ...properties } /> ;
10
+ } ,
11
+ ) as PyTerminalTag ;
12
+
13
+ PyTerminal . displayName = "PyTerminal" ;
9
14
10
15
PyTerminal . propTypes = {
11
16
auto : propTypes . bool ,
Original file line number Diff line number Diff line change 1
- import { DetailedHTMLProps , HTMLAttributes , WeakValidationMap } from "react" ;
2
- import ReactElementProps from "~types/react-element-properties/react-element-properties" ;
1
+ import type {
2
+ DetailedHTMLProps ,
3
+ HTMLAttributes ,
4
+ WeakValidationMap ,
5
+ } from "react" ;
6
+ import type ReactElementProps from "~types/react-element-properties/react-element-properties" ;
3
7
4
8
export type PyTerminalPropertiesBase = Omit <
5
9
ReactElementProps <
@@ -10,13 +14,19 @@ export type PyTerminalPropertiesBase = Omit<
10
14
auto ?: boolean ;
11
15
} ;
12
16
13
- export type PyTerminalProperties < T > = T extends infer T
14
- ? T & PyTerminalPropertiesBase
15
- : PyTerminalPropertiesBase ;
17
+ export type PyTerminalProperties < OptionalProperties > =
18
+ OptionalProperties extends infer OptionalProperties
19
+ ? OptionalProperties & PyTerminalPropertiesBase
20
+ : PyTerminalPropertiesBase ;
16
21
17
- export type PyTerminalProps < T > = PyTerminalProperties < T > ;
22
+ export type PyTerminalProps < OptionalProperties > =
23
+ PyTerminalProperties < OptionalProperties > ;
18
24
19
25
export type PyTerminalTag = {
20
- < T extends object > ( properties : PyTerminalProperties < T > ) : JSX . Element ;
21
- propTypes : WeakValidationMap < PyTerminalPropertiesBase > ;
26
+ < OptionalProperties extends object > (
27
+ properties : PyTerminalProperties < OptionalProperties > ,
28
+ ) : JSX . Element ;
29
+ displayName ?: string ;
30
+ defaultProps ?: Partial < PyTerminalPropertiesBase > ;
31
+ propTypes ?: WeakValidationMap < PyTerminalPropertiesBase > ;
22
32
} ;
You can’t perform that action at this time.
0 commit comments