@@ -26,12 +26,12 @@ export const absoluteCenter = css`
26
26
transform : translate (-50% , -50% );
27
27
` ;
28
28
29
- export const isValidCSSHex = ( hex : string ) => {
29
+ export const isValidCSSHex = ( hex : string ) : boolean => {
30
30
// matches 6 digit characters prefixed with a '#'.
31
31
return / ^ # [ 0 - 9 A - F ] { 6 } $ / i. test ( hex ) ;
32
32
} ;
33
33
34
- export const hexTorgba = ( hex : string , alpha : number = 1 ) => {
34
+ export const hexTorgba = ( hex : string , alpha : number = 1 ) : string => {
35
35
if ( ! isValidCSSHex ( hex ) ) {
36
36
return '' ;
37
37
}
@@ -52,12 +52,13 @@ export const hexTorgba = (hex: string, alpha: number = 1) => {
52
52
*/
53
53
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
54
54
export const createStyledConfig = ( additionalProps : string [ ] = [ ] ) => ( {
55
- shouldForwardProp : ( prop : string ) =>
56
- // Native HTML props is forwarded
57
- isPropValid ( prop ) ||
58
- // Allow additional non-HTML/custom props to be forwarded
59
- additionalProps . includes ( prop ) ,
55
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
+ shouldForwardProp : ( prop : string ) => {
57
+ // Forward custom props
58
+ if ( additionalProps . includes ( prop ) ) return true ;
59
+
60
+ return isPropValid ( prop ) ;
61
+ } ,
60
62
} ) ;
61
63
62
- // Default styled config with no additional props
63
64
export const defaultStyledConfig = createStyledConfig ( ) ;
0 commit comments