• count_dongulus@lemmy.world
    link
    fedilink
    arrow-up
    22
    ·
    4 hours ago

    This is why I will never touch Javascript again. Long ago when I worked on web stuff, half my workflow was spent in the debugger tracing garbage to find where a typo was. The industry moved to Typescript, and now assuming the strictness checks are enabled, if some Typescript transpiles successfully, I can be 95% sure whatever fuckup I observe at runtime is a logic problem.

    Weakly typed languages were an awful idea. But in general, if the compiler isn’t able to detect most runtime issues (like with C++ here), it’s not going to be the most productive language to use for building solutions compared to smarter alternatives.

      • count_dongulus@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        1 hour ago

        Try porting a very small bit of behavior into a new tiny library or module that is Typescript based and independently published. Enable the strictness checks in tsconfig - really, really resist the urge to use any, and enforce that any is disallowed in tsconfig. Familiarize yourself with its utility types that really trip new authors up. “Record” comes to mind here, and others that involve generics if you haven’t before worked with generics. Some of the type error messaging can be pretty obtuse - don’t be afraid to paste them into an LLM (or use Copilot enhanced Intellisense) to explain what it actually means. IMO the type violation messaging is a weak dev experience point for new authors, so don’t sweat it if you occasionally “struggle to make the squiggles go away”.