← Back to Projects

ob-ts-node

2024

Org Babel support for TypeScript via ts-node

Developed a comprehensive solution for Literate TypeScript Programming in Emacs. It leverages ts-node to provide first-class support for modern TypeScript (imports, types) within Org-Mode code blocks, and optionally supports other runtimes like Deno, Bun, or npx via the :cli-cmd parameter.

Usage Example

#+BEGIN_SRC typescript

      interface User {
      name: string;
      id: number;
      }
      const user: User = { name: "Alice", id: 1 };
      console.log(`${user.name}:${user.id}`);
      
#+END_SRC
#+RESULTS:
: Alice:1

Key Details

  • Literate ProgrammingEnables direct execution of TypeScript code blocks within Org docs, bridging the gap between documentation and runnable code.
  • Modern ToolingBuilt on top of ts-node, allowing support for modern ES features, CommonJS imports, and complex tsconfig.json configurations.
  • Ecosystem AdoptionWidely adopted by the Emacs community as the recommended solution for TypeScript in Org Babel, replacing deprecated wrappers.

Technologies & Concepts

Open-SourceEmacs LispTypeScriptLiterate ProgrammingOrg-ModeDev Tools