jscodeshift-ts-satisfies is a codemod for jscodeshift that transforms type annotations to use the satisfies
keyword available in TypeScript 4.9 and later.
Before using the codemod script, make sure you have jscodeshift installed. You can do this using the following command:
npm install -g jscodeshift jscodeshift-ts-satisfies
To apply the codemod to all TypeScript files in the stories
directory, you can use the following command:
jscodeshift -t node_modules/jscodeshift-ts-satisfies/src/ts-satisfies.ts stories/**/*.ts
You have the option to specify the types that should undergo transformation using the --types
flag. Here's an example:
jscodeshift -t node_modules/jscodeshift-ts-satisfies/src/ts-satisfies.ts stories/**/*.ts --types=Meta --types=StoryObj --types=Story