Fireship · @fireship
A heroic new proposal for JavaScript // The Code Report
Uploaded March 10, 2022 · Length 3:00
Summary
typescript proposal for native types in javascript without build step
- typescript
- javascript
- native types
- tc39 proposal
- javascript development
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:01
it is march 10 2022 and you're watching
- 0:04
the code report typescript will turn 10
- 0:06
years old in october of this year in the
- 0:08
early days it was only used by squares
- 0:10
working at big mega corporations today
- 0:12
even that dude at the coffee shop with a
- 0:14
man bun drinking a soy latte coding on
- 0:16
his m1 macbook as loving typescript on
- 0:18
the state of javascript survey types
- 0:20
were the number one missing feature
- 0:22
apparently people like to catch bugs
- 0:23
before they get shipped to production
- 0:25
but there's still one thing that we can
- 0:26
all agree to hate about typescript the
- 0:28
build step or transpiling your
- 0:30
typescript code back into vanilla
- 0:31
javascript it takes time and requires
- 0:34
you to think about annoying
- 0:35
configuration details wouldn't it be
- 0:36
nice if typescript just worked in the
- 0:38
browser without a build step well that
- 0:40
dream might become a reality someday
- 0:42
because the team behind typescript just
- 0:44
submitted a tc39 proposal that would
- 0:46
bring native types into the ecmascript
- 0:48
standard aka the javascript programming
- 0:51
language before you celebrate though
- 0:52
keep in mind that many tc39 proposals
- 0:54
fail and this is just at stage zero
- 0:56
which means it hasn't even been
- 0:58
presented to the important people yet a
- 0:59
proposal needs to go through four stages
- 1:02
before it gets implemented into the
- 1:03
ecmascript standard this process can
- 1:05
take years and it may never get there at
- 1:07
all back in the early 2000s there was a
- 1:09
version of javascript called es4 it was
- 1:11
going to include a type system but
- 1:13
everybody disagreed on it so much that
- 1:15
they just threw that entire version of
- 1:16
javascript in the garbage and skipped
- 1:18
ahead to es5 that was probably for the
- 1:20
best because today typescript gives us a
- 1:22
very good idea of what a type system for
- 1:24
javascript should look like but does
- 1:26
that mean that every browser and runtime
- 1:28
like node.js will need to implement the
- 1:30
typescript compiler no actually the way
- 1:32
it works is pretty clever if we look
- 1:34
closely the proposal says types as
- 1:36
comments in javascript you can use js
- 1:38
dot comments in vanilla javascript then
- 1:40
use a ts check comment to get type
- 1:42
checking in a plain javascript file
- 1:44
that's pretty cool because you get the
- 1:46
awesome intellisense of typescript
- 1:47
without the need for a build step
- 1:49
because comments are totally ignored by
- 1:51
the browser the drawback is that nobody
- 1:53
wants to write comments like this
- 1:54
they're really clunky and awkward what
- 1:56
the proposal aims to do is add an
- 1:58
optional syntax to javascript that would


