Fireship · @fireship

A heroic new proposal for JavaScript // The Code Report

Uploaded March 10, 2022 · Length 3:00

A heroic new proposal for JavaScript // The Code Report

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.

  1. 0:01

    it is march 10 2022 and you're watching

  2. 0:04

    the code report typescript will turn 10

  3. 0:06

    years old in october of this year in the

  4. 0:08

    early days it was only used by squares

  5. 0:10

    working at big mega corporations today

  6. 0:12

    even that dude at the coffee shop with a

  7. 0:14

    man bun drinking a soy latte coding on

  8. 0:16

    his m1 macbook as loving typescript on

  9. 0:18

    the state of javascript survey types

  10. 0:20

    were the number one missing feature

  11. 0:22

    apparently people like to catch bugs

  12. 0:23

    before they get shipped to production

  13. 0:25

    but there's still one thing that we can

  14. 0:26

    all agree to hate about typescript the

  15. 0:28

    build step or transpiling your

  16. 0:30

    typescript code back into vanilla

  17. 0:31

    javascript it takes time and requires

  18. 0:34

    you to think about annoying

  19. 0:35

    configuration details wouldn't it be

  20. 0:36

    nice if typescript just worked in the

  21. 0:38

    browser without a build step well that

  22. 0:40

    dream might become a reality someday

  23. 0:42

    because the team behind typescript just

  24. 0:44

    submitted a tc39 proposal that would

  25. 0:46

    bring native types into the ecmascript

  26. 0:48

    standard aka the javascript programming

  27. 0:51

    language before you celebrate though

  28. 0:52

    keep in mind that many tc39 proposals

  29. 0:54

    fail and this is just at stage zero

  30. 0:56

    which means it hasn't even been

  31. 0:58

    presented to the important people yet a

  32. 0:59

    proposal needs to go through four stages

  33. 1:02

    before it gets implemented into the

  34. 1:03

    ecmascript standard this process can

  35. 1:05

    take years and it may never get there at

  36. 1:07

    all back in the early 2000s there was a

  37. 1:09

    version of javascript called es4 it was

  38. 1:11

    going to include a type system but

  39. 1:13

    everybody disagreed on it so much that

  40. 1:15

    they just threw that entire version of

  41. 1:16

    javascript in the garbage and skipped

  42. 1:18

    ahead to es5 that was probably for the

  43. 1:20

    best because today typescript gives us a

  44. 1:22

    very good idea of what a type system for

  45. 1:24

    javascript should look like but does

  46. 1:26

    that mean that every browser and runtime

  47. 1:28

    like node.js will need to implement the

  48. 1:30

    typescript compiler no actually the way

  49. 1:32

    it works is pretty clever if we look

  50. 1:34

    closely the proposal says types as

  51. 1:36

    comments in javascript you can use js

  52. 1:38

    dot comments in vanilla javascript then

  53. 1:40

    use a ts check comment to get type

  54. 1:42

    checking in a plain javascript file

  55. 1:44

    that's pretty cool because you get the

  56. 1:46

    awesome intellisense of typescript

  57. 1:47

    without the need for a build step

  58. 1:49

    because comments are totally ignored by

  59. 1:51

    the browser the drawback is that nobody

  60. 1:53

    wants to write comments like this

  61. 1:54

    they're really clunky and awkward what

  62. 1:56

    the proposal aims to do is add an

  63. 1:58

    optional syntax to javascript that would