Migrate to a newer language feature
Migrate old code patterns to a specific modern language feature with a clear before/after and notes on compatibility concerns.
Preview
Copy prompt
Refactor the following [Language] code to take advantage of [Feature, e.g. optional chaining, pattern matching, async generators, record types, or structural typing]: [Paste code]. Begin with a concise explanation of what the feature does and when it is appropriate to use it. Show the before-and-after transformation and note any runtime compatibility constraints, browser support considerations, or build tool requirements associated with the feature.
More
Refactoring
Prompts
