File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 72
72
"dependencies" : {
73
73
"@babel/runtime" : " ^7.18.6" ,
74
74
"prop-types" : " ^15.0.0" ,
75
- "redux-form-normalize-on-blur" : " ^1.1.1 "
75
+ "redux-form-normalize-on-blur" : " ^1.1.2 "
76
76
},
77
77
"main" : " dist/index.js" ,
78
78
"types" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -10,14 +10,15 @@ type AdditionalProps = {
10
10
input : { onKeyDown ?: React . KeyboardEventHandler < any > }
11
11
}
12
12
13
- type InputProps = BaseFieldProps < AdditionalProps > & {
13
+ // eslint-disable-next-line @typescript-eslint/ban-types
14
+ type BaseNumericFieldProps < P = { } > = BaseFieldProps < P & AdditionalProps > & {
14
15
normalizeOnBlur ?: any
15
16
normalizeNumber ?: NumberNormalizer
16
17
}
17
18
18
19
export default function createNumericField (
19
20
Field : React . ComponentType < BaseFieldProps < AdditionalProps > >
20
- ) : React . ComponentType < InputProps > {
21
+ ) {
21
22
function defaultNormalize (
22
23
value ?: ( string | number ) | null
23
24
) : ( string | number ) | null | undefined {
@@ -27,7 +28,9 @@ export default function createNumericField(
27
28
return Number . isFinite ( parsed ) ? parsed : value . trim ( )
28
29
}
29
30
30
- return class NumericField extends React . Component < InputProps > {
31
+ return class NumericField <
32
+ P extends BaseNumericFieldProps = BaseNumericFieldProps
33
+ > extends React . Component < P > {
31
34
normalizeOnBlur = ( value : any ) : any => {
32
35
const { normalizeOnBlur } = this . props
33
36
const normalizeNumber = this . props . normalizeNumber || defaultNormalize
You can’t perform that action at this time.
0 commit comments