• @DrM@feddit.de
    link
    fedilink
    17 months ago

    I don’t think that this would work, there are no types anymore during runtime because everything is translated into plain js on build. TypeScript only exists during development

    • @CanadaPlus
      link
      1
      edit-2
      7 months ago

      It would be dependent on what I was doing exactly, but a lot of times I’d end up reimplementing the type system in the runtime code, basically. Maybe I’d test the data every time it returns from the library, which would be slow, but if performance is an issue and there’s still no TS options I should really just be making my own libraries.

      I really don’t want to deal with the above kinds of bugs, yo. Bugs that are actually visible in the code are hard enough. Maybe I’d have to do it but I’d kick and scream the whole way there.