File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -110,16 +110,17 @@ export const hyphenate = cacheStringFunction((str: string) =>
110
110
/**
111
111
* @private
112
112
*/
113
- export const capitalize = cacheStringFunction (
114
- ( str : string ) => str . charAt ( 0 ) . toUpperCase ( ) + str . slice ( 1 )
115
- )
113
+ export const capitalize = cacheStringFunction ( < T extends string > ( str : T ) => {
114
+ return ( str . charAt ( 0 ) . toUpperCase ( ) + str . slice ( 1 ) ) as Capitalize < T >
115
+ } )
116
116
117
117
/**
118
118
* @private
119
119
*/
120
- export const toHandlerKey = cacheStringFunction ( ( str : string ) =>
121
- str ? `on${ capitalize ( str ) } ` : ``
122
- )
120
+ export const toHandlerKey = cacheStringFunction ( < T extends string > ( str : T ) => {
121
+ const s = str ? `on${ capitalize ( str ) } ` : ``
122
+ return s as T extends '' ? '' : `on${Capitalize < T > } `
123
+ } )
123
124
124
125
// compare whether a value has changed, accounting for NaN.
125
126
export const hasChanged = ( value : any , oldValue : any ) : boolean =>
You can’t perform that action at this time.
0 commit comments