For anyone who is still confused - they're still gonna be using TypeScript in that they will have a tsconfig.json, `allowJS: true, checkJS: true` but they are just writing the files in JS with JSDoc type annotations, they'll still have `.d.ts` files to allow TS developers to use it without issues. Is it contrarian - yes - is it insane - no, not really. Edit: the motivation seems to be to simplify processes - running…
TS can generate d.ts files from JS files that use JSDoc
TS to JSDoc Conversion
31–40 of 163 posts
Re: TS to JSDoc Conversion
#32If I remember right, symfony (php framework) has comments that affect how the code runs which as far as I’m concerned means they’re not comments at all but actually code masquerading as comments. Reading about JSDoc gives me the same uneasy feeling, even if it’s not quite the same thing. Edit: Here’s one example, you can define your routes in symfony using comments. Not only that, but it’s actually the officially rec…
Re: TS to JSDoc Conversion
#33Earlier quoted context omitted.
ts-node [1]: am i a joke to you? [1] https://www.npmjs.com/package/ts-node
ts-node is responsible for my favourite error message in all of computing. Yes better than: 'Error: success' or 'keyboard not found: press F1 to continue' > ts-node: Unknown file extension: ts. Someone will reply for a technical reason about this (mentioning .mts or package.json settings or whatever) but that doesn't change the fact that a program whose only job is to run ts files should know what a ts file is. GitHu…
Re: TS to JSDoc Conversion
#34If I remember right, symfony (php framework) has comments that affect how the code runs which as far as I’m concerned means they’re not comments at all but actually code masquerading as comments. Reading about JSDoc gives me the same uneasy feeling, even if it’s not quite the same thing. Edit: Here’s one example, you can define your routes in symfony using comments. Not only that, but it’s actually the officially rec…
Re: TS to JSDoc Conversion
#35If I remember right, symfony (php framework) has comments that affect how the code runs which as far as I’m concerned means they’re not comments at all but actually code masquerading as comments. Reading about JSDoc gives me the same uneasy feeling, even if it’s not quite the same thing. Edit: Here’s one example, you can define your routes in symfony using comments. Not only that, but it’s actually the officially rec…
From the page you linked:
> Routes can be configured in YAML, XML, PHP or using attributes. All formats provide the same features and performance, so choose your favorite. Symfony recommends attributes because it's convenient to put the route and controller in the same place.
Attributes are not comments, they are an official structured way of handling metadata.
[1] https://www.php.net/manual/en/language.attributes.overview.p...
Re: TS to JSDoc Conversion
#36If I remember right, symfony (php framework) has comments that affect how the code runs which as far as I’m concerned means they’re not comments at all but actually code masquerading as comments. Reading about JSDoc gives me the same uneasy feeling, even if it’s not quite the same thing. Edit: Here’s one example, you can define your routes in symfony using comments. Not only that, but it’s actually the officially rec…
Smuggling pragmas in comment has a long and rich history. It’s literally the reason why json does not support comments.
> Reading about JSDoc gives me the same uneasy feeling, even if it’s not quite the same thing.
It’s not just “not quite the same thing”, it’s entirely unrelated in every way and shape. JSDoc does not affect the runtime behaviour of its code, or how that code interacts with other systems.
Re: TS to JSDoc Conversion
#37Earlier quoted context omitted.
ts-node [1]: am i a joke to you? [1] https://www.npmjs.com/package/ts-node
ts-node does not play well with ESM modules out of the box. I've started experimenting with tsx but it still has some edge cases of its own. Honestly, ESM has been the bane of my existence this year as packages are slowly starting to migrate, and fixing issues lays on the developer, not any one framework.
And introducing new extensions like .mjs or .cjs is the smoldering dead raccoon responsible for half of the smell.
Re: TS to JSDoc Conversion
#38A bit off-topic (sorry): Is anyone using Svelte in production without SvelteKit? Hows Svelte documentation as of late?
Re: TS to JSDoc Conversion
#39If I remember right, symfony (php framework) has comments that affect how the code runs which as far as I’m concerned means they’re not comments at all but actually code masquerading as comments. Reading about JSDoc gives me the same uneasy feeling, even if it’s not quite the same thing. Edit: Here’s one example, you can define your routes in symfony using comments. Not only that, but it’s actually the officially rec…
Are they not using attributes, which start with a #? I thought PHP had C style // comments.
Re: TS to JSDoc Conversion
#40We 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…