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