eps1lon / types-react-codemod

Collection of transforms for jscodeshift related to `@types/react`
MIT License
314 stars 12 forks source link

useCallback: transform incorrect when using arrow function with single params #176

Open TIS-OMiddle opened 1 year ago

TIS-OMiddle commented 1 year ago

input: useCallback(event => {})

current output: useCallback(event: any => {})

expect output: useCallback((event: any) => {})

It should add a brackets in this condition

eps1lon commented 1 year ago

This codemod relies on jscodeshift and Babel for code generation. Though it's not clear if it's a configuration mistake on our side or a bug in 3rd party dependencies. But definitely worth checking out.