Skip to content

feat: TypeScript target #20

@Mnehmos

Description

@Mnehmos

Overview

Emit TypeScript code from .nl files.

Command

nlsc compile src/math.nl --target typescript
✓ Generated src/math.ts (42 lines)

Implementation

  • Add emit_typescript() in emitter.py
  • Map NLS types → TS types (number→number, string→string, etc.)
  • Generate interfaces from @type blocks
  • Generate typed functions from ANLUs
  • Handle guards as type guards or runtime checks

Type Mapping

NLS TypeScript
number number
string string
boolean boolean
list of X X[]
CustomType interface CustomType

Exit Criteria

  • Generated TypeScript compiles with tsc --strict
  • Type safety matches NLS constraints

Metadata

Metadata

Assignees

No one assigned

    Labels

    emitterCode generation targetsenhancementNew feature or requestmulti-targetCross-platform compilation

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions