The developers providing everyone with free tools are or course welcome to write those tools in whatever languages they want. But to me, the comment definitions are longer to type and more difficult to parse than inline type definitions. I would much rather use one of the quick TS compilers that don't actually type check when I want to make and test a small change to my source code. But to each their own!
TS to JSDoc Conversion
131–140 of 163 posts
Re: TS to JSDoc Conversion
#132Wouldn't it be nice if all runtimes and browsers had native support for TS and you could just skip the entire transpiling and source mapping step? Oh, well.
Re: TS to JSDoc Conversion
#133We do this at my current company for all projects, it does not mean you don't use typescript, you will still validate all your files with TS, but there's no build step, just a check. Very rarely we find a case that we can't cover with JSDoc annotations, and most of the time it means the code could be refactored to be simpler. I do this now for all my personal projects, in my opinion it's simpler, faster and closer to…
But the one big annoyance is events - I've never found a satisfying way of writing a JSdoc that says what events a class emits, or what parameters the events have. Do you have a way of handling this?
Re: TS to JSDoc Conversion
#134We do this at my current company for all projects, it does not mean you don't use typescript, you will still validate all your files with TS, but there's no build step, just a check. Very rarely we find a case that we can't cover with JSDoc annotations, and most of the time it means the code could be refactored to be simpler. I do this now for all my personal projects, in my opinion it's simpler, faster and closer to…
> Very rarely we find a case that we can't cover with JSDoc annotations I regret every `infer` statement I've put in application code. Grug phrased this elegantly: https://grugbrain.dev/#grug-on-type-systems
Re: TS to JSDoc Conversion
#135Earlier quoted context omitted.
Type imports are the worst.
Do you mean native JSDoc namepaths like /** * @type {module:look/here~MyType} */ or TypeScript "JSDoc" imports like /** * @type {typeof import("./look/here").MyType} */ or both?
Re: TS to JSDoc Conversion
#136Earlier quoted context omitted.
> Very rarely we find a case that we can't cover with JSDoc annotations I regret every `infer` statement I've put in application code. Grug phrased this elegantly: https://grugbrain.dev/#grug-on-type-systems
I have never seen grug before. This is fantastic.
Re: TS to JSDoc Conversion
#137Finally things are heading in the right direction. Can't wait for more to do this. Typescript might be good for some, but I'm glad to see the hype finally begin to fade, so the rest of up can breathe again.
A lot of the new frontend codebases involve a build step before running. For such codebases, TypeScript's build hurdle has already been overcome.
Re: TS to JSDoc Conversion
#138Re: TS to JSDoc Conversion
#139Earlier quoted context omitted.
I don't use Svelte, but I appreciate the principled approach and the clear explanation. I primarily coded in Python for 4 years. Then I founded a company that didn't need as much data science and my primary language switched to JavaScript (2 years) then TypeScript (4 years). Overall, I really like TypeScript. But I do absolutely miss being able to cmd + click into a function/class from an open source package and see…
What if TypeScript could compile to JS/JSDoc instead of source maps? I'm also not a fan of 'go to definition' bringing me to a dead end d.ts file, but also there has to be a better solution than verbosely JSDoc'ing all the things.
It would take forever to become mainstream but if node and major browsers started to support this tomorrow, along with ESM modules we could drop TS compilation and bundling entirely during development, safely publish npm packages as TS (even a bundled TS) and simplify tooling for monorepos, IDEs, etc.
Unfortunately that wouldn't solve dealing with templates like JSX/TSX or future language syntax/features.
https://devblogs.microsoft.com/typescript/a-proposal-for-typ...
Re: TS to JSDoc Conversion
#140We do this at my current company for all projects, it does not mean you don't use typescript, you will still validate all your files with TS, but there's no build step, just a check. Very rarely we find a case that we can't cover with JSDoc annotations, and most of the time it means the code could be refactored to be simpler. I do this now for all my personal projects, in my opinion it's simpler, faster and closer to…