2017-10-16

Creating and Printing a TypeScript AST from Fable

Fable can be used to create Node applications, not just web applications. Similar to last week's post titled Creating and Printing a TypeScript AST from Rust, I've ported the TypeScript Compiler API example, but to Fable this time. It is a little less complicated than last week's proof-of-concept because this too runs on Node like the original.


The bundle was created by running `dotnet fable webpack`:



The ported code looks really similar to the original TypeScript code:

Loading gist ...

Proof of Concept

This was a proof-of-concept to see what it would take to port ts2fable from being written in TypeScript to being written in Fable. It also gave me a chance to become more familiar with Fable interop. I continue to be impressed with Fable. This was much easier than I expected.