• @CanadaPlus
    link
    57 months ago

    I’ve never used TS, and I’m not exactly sure what nest.js even does, but building a TypeScript project on top of a JavaScript library not designed for it seems like asking for trouble. Is that standard practice?

      • @CanadaPlus
        link
        1
        edit-2
        7 months ago

        Web dev continues to be cursed, I guess.

        If I really needed to use a JS library in TS, I’d have to build some sort of adapter between the two that crashes whenever the JS library (that doesn’t know anything about your types) breaks the typing rules. Anything else will inevitably lead to the above “fun” kind of bugs.

        • @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.