dsherret / dsherret/ts-morph

Can i generate some TSX/JSX code somehow?

Open
#240 14 comments 7 reactions 0 assignees View on GitHub
domain: manipulation domain: navigation
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

Let's say I want to generate a function which returns some TSX, like:

```typescript
export default function Layout({ children }) {
return (


my website


{children}




);
}
```

how would I define the function body? The only method I have found for now is using a multiline string and call `setBodyText()` with it. Also, modifying eg: stuff within the `` in a clean way would be really awesome! Is there any support for TSX planned?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing function-body generation API, especially the multiline-string approach using setBodyText(), and compare it with the requested TSX example. Determine what TSX/JSX generation and clean edits inside the head and body should support, then verify the resulting API against the example; the issue names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.