Skip to content

[good-first-issue] transpiler.ts stub — cell → TypeScript class (Fixes #24)#30

Closed
lb1192176991-lab wants to merge 2 commits into
SHShinSK:mainfrom
lb1192176991-lab:feat/transpiler-stub-24-1780140096
Closed

[good-first-issue] transpiler.ts stub — cell → TypeScript class (Fixes #24)#30
lb1192176991-lab wants to merge 2 commits into
SHShinSK:mainfrom
lb1192176991-lab:feat/transpiler-stub-24-1780140096

Conversation

@lb1192176991-lab

Copy link
Copy Markdown

What

Added typescript/transpiler.ts — a stub transpiler that converts .cell AST to TypeScript class output. Handles CellDecl AST nodes and generates:

  • @cell({ role: "...", tags: [...], lifespan: "..." }) decorators
  • Class definitions extending BaseCell
  • Nucleus fields as class properties with type annotations
  • Membrane accepts/emits declarations
  • Handler methods (onSignalName(param: SignalType) { ... })
  • Statement-level transpilation for emit, let, return
  • Expression transpilation for literals, identifiers, member access, calls, binary/unary/ternary ops
  • Type expression → TS type string conversion (SimpleType, UnionType, ListType, MapType, OptionType, GenericType)

Also updated compile.ts to integrate the transpiler — added an optional shouldTranspile param to compile() and exports TranspileResult.

Why

Required as the first step to enable TypeScript code generation from Cell Coding DSL. This stub handles the CellDecl case per issue requirements, producing output like:

@cell({ role: "입력값 유효성 검사" })
export class Validator extends BaseCell {
  onRawInput(input: RawInput) {
    this.emit(ValidSignal);
  }
}

Testing

  • tsc --noEmit passes (all imports resolved within the project)
  • The transpiler was integrated into the existing compile pipeline as compile(source, true)

@SHShinSK

Copy link
Copy Markdown
Owner

Thanks for picking up #24 and for the clear PR description — the stub and compile(..., shouldTranspile) integration are easy to follow.

main already includes a more complete typescript/transpiler.ts (program/cell-file transpile, handler body via transpile-handler, tests, CLI wiring), so this branch conflicts with the current tree and we can’t merge it as-is without duplicating that work.

I’m closing this PR to avoid confusion. If you’d like to contribute next, issues labeled good first issue that are still open on main are a good place to start — or comment on #24 if you want a smaller follow-up task (e.g. docs/tests around the existing transpiler).

Thanks again for the contribution.

@SHShinSK

Copy link
Copy Markdown
Owner

Thanks again for picking up #24 — the PR description and the compile(..., shouldTranspile) integration were clear and well structured.

As noted, main already includes a fuller typescript/transpiler.ts (program/cell-file transpile, handler body via transpile-handler, CLI cell build, --transpiled runtime, and parity tests), so merging this branch would duplicate work and conflict with the current tree. Closing the PR was the right call.

If you'd like to contribute next, here are good follow-up tasks on main:

Docs — type mapping table / transpiler usage (see examples/README.md Phase 3 section)
Tests — typescript/transpiler.test.ts (type mapping, standalone mode, error paths)
Error UX — include line/column in transpileCellFile diagnostics
CLI — cell build --watch
Draft issue checklist: .github/issue-drafts/06-transpiler-stub.md (Follow-up tasks).

Feel free to comment on #24 or open a new issue/PR for one of the items above — happy to review

@SHShinSK

Copy link
Copy Markdown
Owner

#24 is closed on main. Pick a follow-up from issues #XX–#YY (transpiler diagnostics, cell build --watch, docs, etc.) — happy to review.

@SHShinSK SHShinSK closed this Jun 2, 2026
@SHShinSK

SHShinSK commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Closing — main already includes a fuller typescript/transpiler.ts (program/cell-file transpile, handler codegen, CLI cell build, tests). Rebasing this branch would conflict and duplicate that work.

Thanks again @lb1192176991-lab for the clear stub and compile(..., shouldTranspile) design — it helped validate the direction.

Next contributions (still open on main):

  • Docs: .github/issue-drafts/17-transpiler-standalone-docs.md
  • Tests: 16-transpiler-unsupported-stmts.md
  • Error UX: 14-transpiler-error-diagnostics.md
  • CLI: 15-cell-build-watch.md

Pick one and open a fresh PR from current main — happy to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants