Hacker News new | ask | show | jobs
by bilalq 1133 days ago
It's immediately clear from the very first few lines of the PR that they're sacrificing safety for this.

Before:

    import { Node } from 'acorn';
    import * as code_red from 'code-red';

    export const parse = (source: string): Node =>
      code_red.parse(source, {
        sourceType: 'module',
        ecmaVersion: 13,
        locations: true
      });

After:

    import * as code_red from 'code-red';

    /**
     * @param {string} source
     * @returns {any}
     */
    export const parse = (source) =>
      code_red.parse(source, {
        sourceType: 'module',
        ecmaVersion: 13,
        locations: true
      });

But I'm not a Svelte maintainer or user, so if this is their choice, I guess it is what it is. It's not something I'd ever consider. There are other approaches for making linked npm package workflows more manageable. There's the one mentioned by one of the VSCode maintainer, but the simplest setup is to just have a watch process running that recompiles on the fly.
3 comments

We're using an automated tool to do the gross conversion, then combing through fixing the issues. There's a reason the PR's a draft, dammit! :lol: Don't worry, _no_ type-safety will be lost, internally or externally.
Fair enough. Minor nit, the PR is not actually marked as a draft.
Maybe I am unfamiliar with jsdoc, or what the shape of Node from acorn is, but yeah if every function is returning any, that seems like a big downgrade and sacrifice.
You are making judgements based on a draft PR. There is a ton of work still to do.
Fair enough! I'd love to read a blog post about this after you finish the work.

EDIT: It'd be a great outcome in the end if this conversion spurs DX improvements in Node/TS.

> There is a ton of work still to do.

What's the estimated ROI?

That depends on how much you value getting a bunch of developers to think about svelte, jsdoc, and typescript.