Open frankandrobot opened 3 years ago
@frankandrobot if you view the package on npm (https://www.npmjs.com/package/jscodeshift) you'll see this icon:
This means the types are external (as opposed to built-in) so will require you also install the type definitions: https://www.npmjs.com/package/@types/jscodeshift
npm i jscodeshift @types/jscodeshift
Then, there should be a Transform
type that can be used to type the transform function.
// transform.ts
import { Transform } from "jscodeshift";
const transform: Transform = (file, api) => {
// ...
};
export default transform;
Here's an example of a TypeScript jscodeshift transform: https://github.com/skovy/font-awesome-codemod
Thanks!
On Mar 13, 2021, at 2:48 PM, Spencer Miskoviak @.***> wrote:
@frankandrobot https://github.com/frankandrobot if you view the package on npm (https://www.npmjs.com/package/jscodeshift https://www.npmjs.com/package/jscodeshift) you'll see this icon:
https://user-images.githubusercontent.com/5247455/111043860-db0ba180-83f9-11eb-9164-0f111f6590c4.png This means the types are external (as opposed to built-in) so will require you also install the type definitions: @./jscodeshift @./jscodeshift> npm i jscodeshift @types/jscodeshift Then, there should be a Transform type that can be used to type the transform function.
// transform.ts import { Transform } from "jscodeshift";
const transform: Transform = (file, api) => { // ... };
export default transform; Here's an example of a TypeScript jscodeshift transform: https://github.com/skovy/font-awesome-codemod https://github.com/skovy/font-awesome-codemod — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/facebook/jscodeshift/issues/414#issuecomment-798783417, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGAGMM72WPMJQ4MVTO2ZQTTDO6QTANCNFSM4X264W2A.
As per the README
However, where are the types for use in the module? In particular, the types for the API? I do not see any type declarations in the npm package.