ts-blank-space is a fast type-stripping compiler that converts TypeScript to JavaScript. It supports a modern subset of TypeScript by erasing the types and replacing them with whitespace. That's it. It is not a type checker and does not perform any other code transformations. The underlying technique can improve build performance and simplify development. The implementation is pure TypeScript. It is simple enough to read and understand in a few minutes because it is only 700 lines of code and reuses the original TypeScript parser. The core idea is to use spaces as a substitute for type annotations. You can think of ts-blank-space as a reference implementation of this type-stripping technique. Much like other compiler techniques seen in the JavaScript ecosystem, such as tree-shaking, it is a reusable idea that any TypeScript compiler could implement.

Features

  • Only 4 times slower than a native multi-threaded transformer
  • Fastest compared to non-native (JavaScript or Wasm)
  • No new JavaScript code is generated; instead, it re-uses slices of the existing source string
  • Less than 700 lines of code and one dependency (TypeScript)
  • Try it out in the playground
  • Documentation available

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

Apache License V2.0

Follow ts-blank-space

ts-blank-space Web Site

You Might Also Like
Gen AI apps are built with MongoDB Atlas Icon
Gen AI apps are built with MongoDB Atlas

The database for AI-powered applications.

MongoDB Atlas is the developer-friendly database used to build, scale, and run gen AI and LLM-powered apps—without needing a separate vector database. Atlas offers built-in vector search, global availability across 115+ regions, and flexible document modeling. Start building AI apps faster, all in one place.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of ts-blank-space!

Additional Project Details

Programming Language

TypeScript

Related Categories

TypeScript Libraries

Registered

2024-09-20