From ee1df8659c364ec473f7d718b87499d6d0d18406 Mon Sep 17 00:00:00 2001 From: Mohab Date: Thu, 21 Dec 2023 19:35:43 +0200 Subject: [PATCH] Delete README.md --- codemods/msw/2/type-args/README.md | 119 ----------------------------- 1 file changed, 119 deletions(-) delete mode 100644 codemods/msw/2/type-args/README.md diff --git a/codemods/msw/2/type-args/README.md b/codemods/msw/2/type-args/README.md deleted file mode 100644 index 947fce71..00000000 --- a/codemods/msw/2/type-args/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# Move Generic Arguments and Body Type Casts - -## Description - -There is a change to generic type interface of `rest.method()` calls. This codemod puts the generic arguments in the correct order to keep type safety. - -### WARNING - -This codemod runs `.fixUnusedIdentifiers()` on a target source file. This would remove any unused declarations in the file. This is due to the atomicity of this mod, which blindly inserts the callback structure into each msw handler callback and then cleans up the variables that are not used anymore. - -## Example - -### Before - -```ts -http.get('/resource', (req, res, ctx) => { - return res(ctx.json({ firstName: 'John' })); -}); -``` - -### After - -```ts -http.get('/resource', (req, res, ctx) => { - return res(ctx.json({ firstName: 'John' })); -}); -``` - -### Before - -```ts -http.get('/resource', (req, res, ctx) => { - return res(ctx.json({ firstName: 'John' })); -}); -``` - -### After - -```ts -http.get('/resource', (req, res, ctx) => { - return res(ctx.json({ firstName: 'John' })); -}); -``` - -### Before - -```ts -const handlers: RestHandler[] = [ - http.get('/resource', (req, res, ctx) => { - return res(ctx.json({ firstName: 'John' })); - }), -]; -``` - -### After - -```ts -const handlers: HttpHandler[] = [ - http.get('/resource', (req, res, ctx) => { - return res(ctx.json({ firstName: 'John' })); - }), -]; -``` - -### Before - -```ts -export function mockFactory( - url: string, - resolver: ResponseResolver< - MockedRequest<{ id: string }>, - RestContext, - Awaited - >, -) { - return http.get(url, resolver); -}; -``` - -### After - -```ts -export function mockFactory( - url: string, - resolver: ResponseResolver< - HttpRequestResolverExtras, - { id: string }, - Awaited - >, -) { - return http.get(url, resolver); -}; -``` - -## Applicability Criteria - -MSW version >= 1.0.0 - -## Other Metadata - -### Codemod Version - -v1.0.0 - -### Change Mode - -**Assistive**: The automation partially completes changes. Human involvement is needed to make changes ready to be pushed and merged. - -### **Codemod Engine** - -[ts-morph](https://github.com/dsherret/ts-morph) - -### Estimated Time Saving - -~15 minutes per occurrence - -### Owner - -[Intuita](https://github.com/intuita-inc)