For humanfs, I'm using a kind of TypeScript-JavaScript hybrid setup for the first time, and I'm kind of loving it.
Interfaces are written in TypeScript files, while the functionality is written in JavaScript files with JSDoc type annotations.
One of my big complaints about TypeScript is when people mix type/interface definitions with functionality. When 75% of a file is long type definitions, it's maddening for me.
This way, I'm writing mostly clean JavaScript, but still get type checking.
@nzakas this is how I write libraries and it's awesome.
@developit great minds something something.
@nzakas what is the benefit of writing interfaces in TypeScript rather than having them be typerefs in JSDoc? Are you running Typescript type checker against them or is it something else?
@McNeely TS is far more expressive than JSDoc. And yes. It’s open source, after all, you can just look at the code.
@nzakas What is the benefit compared to using Typescript for everything, but still defining interfaces in separate files?
@demivan 1) enforces a clean separation, 2) can use ESLint’s default parser to help me dog food it.
@nzakas can we generate .d.ts files with interfaces from JSDoc comments? @shivelysanders ?
@functionalscript @nzakas no, just type aliases. There’s no support for an @interface tag.