DEV Community

Max Cerrina
Max Cerrina

Posted on

Minimal (yes, truly) TypeScript setup

One of the most frustrating things ever is wanting to try something out and having to install a million things and learn 3.14 new tools just to get something runnable in your browser.

I wrote up a minimal server and repository for a project that compiles your TypeScript down for use in a browser environment, so that people can try TypeScript if they want, without worrying about things like loaders, webpack, etc.

GitHub logo aleph-naught2tog / ts_without_dependencies

Dependency-free skeleton for a web site with Typescript

Dependency-free Typescript setup

This is a truly minimal, dependency-free setup that will provide the skeleton for you to:

  • write your code in Typescript
  • compile it for browser use
  • use that compiled code in a browser environment

That's it. This server won't do anything fancy: it won't reload for you, it won't minify or uglify anything.

It will serve files for you, and that's it. You can ignore the server entirely if you want; or, if you think writing your own server sounds neat, the second half of the README is worth checking out.

There's no magic here. No Webpack, no loaders, no routing libraries necessary, etc. (If you don't know what those are, don't worry -- the point of this repository is so you don't have to.) There's nothing wrong with using those tools, but they add complexity, and they can extremely frustrating to use when all you really want…

Its only dependency is TypeScript itself. Literally. (Well, okay, Node too, but TypeScript itself uses Node, so I think that's permissible.)

If all you want is to try a basic website with TypeScript, this is perfect for that.

If you want to try writing your own server, please use this as a base if you want -- I included notes in the server files, let me know if anything is unclear! -- but if you want nothing to do with the server, you shouldn't need to mess with its code.

Top comments (1)

darkain profile image
Vincent Milum Jr

Simplicity is key, and I wish more engineers understood this. Good work! I still need to document what I've done, I created an entire PHP based web site and data processing framework. It's as simple as "git clone" to get the base running, but it's still too rough around the edges in some areas. There is extreme value in things this simple though.

Another example, I personally learned to program computers before Google even existed. MSDOS came with QBASIC. Simply open it up, type commands, and hit "run" - it was literally this easy back then to get into programming. But as you've described here, "modern" programming is riddled with development environments and dependency trees that are INSANELY complicated. Why have things gone backwards? We should all work together on minimizing the barrier to entry for new and inspiring engineers!