openrewrite / openrewrite/rewrite
JS RPC not returning option types for TypeScript recipes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
Details
- Library: org.openrewrite:rewrite-javascript:8.66.2
- Class:
org.openrewrite.javascript.rpc.JavaScriptRewriteRpc - Method:
getRecipes()
Problem
When loading TypeScript recipes via RPC, the type field of OptionDescriptor is always null, even though the TypeScript source code explicitly defines a type.
Example
export class ModernizeOctalEscapeSequences extends Recipe {
@Option({
displayName: "Use Unicode escapes",
description: "Use Unicode escape sequences...",
required: false,
example: "true",
})
useUnicodeEscapes: boolean; // ← TYPE IS "boolean"
}
What my RPC calls returns:
Recipe: org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences
Option name: useUnicodeEscapes
type: null ← Should be "boolean"
description: Use Unicode escape sequences (`\uXXXX`)...
example: true
required: false
How I'm calling it:
val rpc = JavaScriptRewriteRpc.builder().get()
rpc.installRecipes("@openrewrite/rewrite", "8.66.2")
val descriptors: List<RecipeDescriptor> = rpc.recipes
for (descriptor in descriptors) {
for (option in descriptor.options) {
println("type: ${option.type}") // Prints "null"
}
}
Expected behavior
option.type should be a non-null type such as "boolean" (as a String representation of the TypeScript type)
Actual behavior
option.type is null
Impact
- Documentation generation shows
nullinstead of proper types - Users cannot tell what type of value to provide for recipe options without checking the source code itself
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in rewrite-javascript/rewrite/src/main/java/org/openrewrite/javascript/rpc/JavaScriptRewriteRpc.java at getRecipes(), then compare its option handling with modernize-octal-escape-sequences.ts, especially the useUnicodeEscapes declaration. Verify the resulting RecipeDescriptor options expose the TypeScript type as a string rather than null, while preserving the existing description, example, and required fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100