madkarlsson,

Its important to understand that:

  • JavaScript is typescript
  • Typescript is JavaScript with types

When you are writing typescript, you are writing JavaScript but have additional syntax to help support type safety and structure. If you are creating a function that does x, it should very much be the same in JS and TS, just in TS it has extra syntax

TS doesn’t modify the way JS works, its one of the stated needs for the tooling.

In TS, for example, I can denote an object as


<span style="color:#323232;">const x: Record = {}
</span>

In JS it would be


<span style="color:#323232;">const x = {}
</span>

It’s still nothing but an object. TS doesn’t change the functionality, it just adds typing and checks that you are using that object properly as static build step.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • Ask_kbincafe
  • oklahoma
  • feritale
  • SuperSentai
  • KamenRider
  • All magazines