39 comments

  • Waterluvian8 hours ago
    A few things I&#x27;ve come to personally believe after spending years developing web and robotics software in Python&#x2F;JavaScript then spending years having to maintain while constantly adding new features and dealing with company pivots:<p>- The types exist whether you write them down or not.<p>- If they&#x27;re not written down, they&#x27;re written down in your head.<p>- Your head is very volatile and hard for others to access.<p>- Typing is an incredibly good form of documentation.<p>- JSDoc and TypeScript are standards&#x2F;formats for typing. Like any tools, they both have advantages and disadvantages. Neither is objectively better than the other.<p>- Make informed decisions on how you&#x27;ll describe your types, and then be consistent and unsurprising.<p>- A type checker is the computer saying, &quot;okay then, prove it&quot; about your program&#x27;s type validity.<p>- Not every program benefits from the same amount of &quot;prove it.&quot;<p>- Too much can be as bad as too little. You&#x27;re wasting resources proving throwaway code.<p>- I like languages that let you decide how much you need to &quot;prove it.&quot;
    • Culonavirus34 minutes ago
      &gt; Your head is very volatile and hard for others to access.<p>One of the lessons you learn while doing this job is that &quot;others&quot; includes &quot;yourself in the future&quot;.<p>(Of course people will tell you this way before you find out yourself, but what do they know...)
    • john01dav5 hours ago
      &gt; - I like languages that let you decide how much you need to &quot;prove it.&quot;<p>Rust is known for being very &quot;prove it,&quot; as you put it, but I think that it is not, and it exposes a weakness in your perspective here. In particular, Rust lets you be lax about types (Any) or other proved constraints (borrow checker bypass by unsafe, Arc, or cloning), but it forces you to decide how the unproven constraints are handled (ranging from undefined behavior to doing what you probably want with performance trade-offs). A langauge that simply lets you not prove it still <i>must</i> choose one of these approaches to run, but you will be less aware of what is chosen and unable to pick the right one for your use case. Writing something with, for example, Arc, .clone(), or Any is almost as easy as writing it in something like Python at the start (just arbitrarily pick one approach and go with it), but you get the aforementioned advantages and it scales better (the reader can instantly see (instead of dredging through the code to try to figure it out) &quot;oh, this could be any type&quot; or &quot;oh, this is taken by ownership, so no spooky action at a distance is likely&quot;).
    • culi7 hours ago
      &gt; JSDoc and TypeScript are standards&#x2F;formats for typing. Like any tools, they both have advantages and disadvantages. Neither is objectively better than the other.<p>Agreed. Just to clarify, my intentions with this post weren&#x27;t to advocate for one over the other. Just to point out that they are the same thing. They are both TypeScript.
      • KPGv23 hours ago
        &gt; They are both TypeScript.<p>I take issue with this position because this seems to imply &quot;PureScript and JavaScript are both JavaScript&quot; is a true statement merely because one of them turns into the other with tooling.
        • egeozcan2 hours ago
          I think the point here is that all the TS tooling works with JSDoc without any friction. As long as you don&#x27;t look into the file, from the tooling perspective, a .ts file and a .js file with proper JSDoc annotations are practically the same.
          • aatd861 hour ago
            Except the js files can work in the browser as is.. not the ts one (fortunately I might add, I find ts syntax very loaded at times) Either one is superseding the other one, or they are simply distant cousins, but this is not interchangeable.<p>TS from JSDoc requires a generative pass to. This is a (expected) level of indirection. (unless some tooling does it automatically)
    • jama2114 hours ago
      And if your boss is the type to pivot way too often and want it done yesterday, then they don’t deserve code that is prove in the right places so you just get an LLM to add typing to everything after the fact…
      • jve57 minutes ago
        &gt; then they don’t deserve code that is prove<p>I don&#x27;t get it. Types are a way to write code. Nothing to do with how fast&#x2F;much the code changes.
    • scotty7934 minutes ago
      &gt; I like languages that let you decide how much you need to &quot;prove it.&quot;<p>I love that too. Are there any other languages than TS that have this as a core design feature?
    • user39393825 hours ago
      I&#x27;ll take a more definite position. Build pipelines are the devil. Every square inch of surface complexity you add to whatever you&#x27;re doing, you will pay for it. If there&#x27;s a way to get the benefits without the build step, that&#x27;s your choice. You may need runtime type enforcement, so that&#x27;s not JSDoc, and you&#x27;re doing that with... JS so that&#x27;s already suspicious but the use case def exists. JS, the DOM, HTTP, this whole stack is garbage at this point so arguing about the type system is a little idk hard to care about personally. I have a solution that lets you discard most of the web stack, that&#x27;s more interesting to me.
  • prisenco10 hours ago
    I&#x27;m a fan of anything that allows me to build with javascript that doesn&#x27;t require a build step.<p>Modern HTML&#x2F;CSS with Web Components and JSDoc is underrated. Not for everyone but should be more in the running for a modern frontend stack than it is.
    • bobbylarrybobby9 hours ago
      On the one hand I can see the appeal of not having a build step. On the other, given how many different parts of the web dev pipeline require one, it seems very tricky to get all of your dependencies to be build-step-free. And with things like HMR the cost of a build step is much ameliorated.
      • prisenco9 hours ago
        I haven&#x27;t run into any steps that require one, there&#x27;s always alternatives.<p>Do you have anything specific in mind?
        • webstrand8 hours ago
          Anything that uses JSX syntax, for instance.<p>Any kind of downleveling, though that&#x27;s less important these days most users only need polyfills, new syntax features like `using` are not widely used.<p>Minification, and bundling for web is still somewhat necessary. ESM is still tricky to use without assistance.<p>None of these are necessary. But if you use any of them you&#x27;ve already committed to having a build step, so adding in a typescript-erasure step isn&#x27;t much extra work.
          • brazukadev8 hours ago
            If there is one thing I don&#x27;t miss using WebComponents is JSX. lit-html is much, much better.
            • claytongulick6 hours ago
              It&#x27;s such a lovely and simple stack.<p>No Lit Element or Lit or whatever it&#x27;s branded now, no framework just vanilla web components, lit-html in a render() method, class properties for reactivity, JSDoc for opt-in typing, using it where it makes sense but not junking up the code base where it&#x27;s not needed...<p>No build step, no bundles, most things stay in light dom, so just normal CSS, no source maps, transpiling or wasted hours with framework version churn...<p>Such a wonderful and relaxing way to do modern web development.
              • prisenco5 hours ago
                I love it. I&#x27;ve had a hard time convincing clients it&#x27;s the best way to go but any side projects recently and going forward will always start with this frontend stack and no more until fully necessary.
                • brazukadev5 hours ago
                  This discussion made me happy to see more people enjoying the stack available in the browser. I think over time, what devs enjoy using is what becomes mainstream, React was the same fresh breeze in the past.
    • odie55335 hours ago
      I have not written a line of JavaScript that got shipped as-is in probably a decade. It always goes through Vite or Webpack. So the benefit of JS without a build step is of no benefit to me.
      • prisenco4 hours ago
        Dare to dream and be bold.<p>Seriously, start a project and use only the standards. You&#x27;ll be surprised how good the experience can be.
    • junon9 hours ago
      Webcomponents are a pain in the ass to make, though. That is, sufficiently complex ones. I wish there was an easier way.
      • jeswin5 hours ago
        It&#x27;s ok now, at least for me. There are still challenges around theming and styling because of styling boundaries (which makes Web Components powerful, but still). A part of it is about tooling, which can be easier to improve.<p>Try my tiny web components lib if you want to keep JSX but not the rest of React: <a href="https:&#x2F;&#x2F;github.com&#x2F;webjsx&#x2F;magic-loop" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;webjsx&#x2F;magic-loop</a>
      • eric-p75 hours ago
        I&#x27;ve built Solarite, a library that&#x27;s made vanilla web components a lot more productive IMHO. It allows minimal DOM updates when the data changes. And other nice features like nested styles and passing constructor arguments to sub-components via attributes.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Vorticode&#x2F;solarite" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Vorticode&#x2F;solarite</a>
      • prisenco9 hours ago
        They could have better ergonomics and I hope a successor that does comes out but they&#x27;re really not that bad.
        • brazukadev8 hours ago
          web components need 2 things to be great without external libraries (like lit-html):<p>- signals, which is currently Stage 1 <a href="https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-signals" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-signals</a><p>- And this proposal: <a href="https:&#x2F;&#x2F;github.com&#x2F;WICG&#x2F;webcomponents&#x2F;issues&#x2F;1069" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;WICG&#x2F;webcomponents&#x2F;issues&#x2F;1069</a> which is basically lit-html in the browser
    • auxiliarymoose9 hours ago
      Agreed on native HTML+CSS+JSDoc. An advantage in my use-cases is that built-in browser dev tools become fluid to use. View a network request, click to the initiator directly in your source code, add breakpoints and step without getting thrown into library internals, edit code and data in memory to verify assumptions &amp; fixes, etc.<p>Especially helpful as applications become larger and a debugger becomes necessary to efficiently track down and fix problems.
    • winrid4 hours ago
      TS is worth the build step.
      • prisenco4 hours ago
        JSDoc is TypeScript.
        • KPGv23 hours ago
          It is TypeScript in the same way my rear end is the Grand Canyon: they are somewhat isomorphic but one is much less pleasant to look at.
    • mmcromp5 hours ago
      Why? The half a second for the HMR is taking up too much your day?
      • prisenco5 hours ago
        No, because layers of abstraction come at a cost and we have created a temple to the clouds piled with abstractions. Any option to simplify processes and remove abstractions should be taken or at least strongly considered.<p>Code written for a web browser 30 years ago will still run in a web browser today. But what guarantee does a build step have that the toolchain will still even exist 30 years from now?<p>And because modern HTML&#x2F;CSS is powerful and improving at a rapid clip. I don&#x27;t want to be stuck on non-standard frameworks when the rest of the world moves on to better and better standards.
  • etoxin8 hours ago
    So, some history. When SPA&#x27;s started to boom on the web JSDoc was a life saver for typing. Application state was getting more complex. We needed more guard rails.<p>Then Google Closure Compiler came along which added type safety via JSDOC and TS came along with (TS)JSDoc support and it&#x27;s own TS syntax.<p>The community chose native TS and Google Closure compiler slipped away into the background.<p>So (TS)JSDoc support is a relic from when Microsoft was trying to get market share from Google.<p>Today in 2025, TS offers so much more than the (TS)JSDoc implementation. Generics, Enums, Utility types, Type Testing in Vitest, typeguards, plus other stuff.<p>Today I use TS. I also use plain JSDoc for documentation. e.g. @link and @see for docs. Or @deprecated when I&#x27;m flagging a method to be removed. @example for a quick look up of how to use a component.<p>TS and plain JSDoc are both important together. But (TS)JSDoc alone, is a relic of the past.
    • culi7 hours ago
      &gt; Today in 2025, TS offers so much more than the (TS)JSDoc implementation. Generics, Enums, Utility types, Type Testing in Vitest, typeguards, plus other stuff.<p>This was my main impetus for writing this article. Modern JSDoc uses the TypeScript language service. You can use generics, utility types, typeguards (including the `is` keyword), regex parsing, etc all with just JSDoc.<p>I used these features extensively (especially generics) in a personal project and managed to do it all in JSDoc.
      • apatheticonion3 hours ago
        JSDoc is missing a lot of basic capabilities. For example a TypeDef is automatically exported which can cause collisions and forces you to repeat or inline types.<p>Types for classes are poor and often you&#x27;ll find yourself creating a `.d.ts` file or `.ts` file to export non trivial types - however the target file doesn&#x27;t know how to consume them.
        • culi2 hours ago
          typedefs are indeed automatically exported but that doesn&#x27;t mean collisions can happen. You would still have to explicitly import a type<p>Regardless, I hardly consider that a &quot;missing basic capability&quot;<p>I don&#x27;t know what you mean about types for classes being &quot;poor&quot;. Types for classes work exactly the same way
          • apatheticonion2 hours ago
            You cannot replicate `import type { x } from &#x27;.&#x2F;foo&#x27;` without also re-exporting that import - which causes collisions.<p>The alternative is to do an inline `const foo = &#x2F;** @type {import(&#x27;.&#x2F;foo&#x27;).x} *&#x2F; ({})` however this gets messy, repetitive and it&#x27;s difficult to use algebraic types (e.g. `Event &amp; { detail: string }`)
      • c-hendricks5 hours ago
        JSDoc does not understand typescript syntax though? The typescript language server just kinda plows through&#x2F;over JSDoc sure, but try getting JSDoc to parse some of the TS-ified things that JSDoc has alternatives for.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;jsdoc&#x2F;jsdoc&#x2F;issues&#x2F;1917" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jsdoc&#x2F;jsdoc&#x2F;issues&#x2F;1917</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;jsdoc&#x2F;jsdoc&#x2F;issues&#x2F;1917#issuecomment-1250760267" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jsdoc&#x2F;jsdoc&#x2F;issues&#x2F;1917#issuecomment-1250...</a>
        • culi5 hours ago
          tuples, `&amp;` operator, and even generics all work perfectly well inside a `@type` declaration. For example:<p>```js<p><pre><code> &#x2F;** * @type {{ * slug: `${string}_${number}`; * id: number; * } &amp; { status?: [code: number, text: string]; }} *&#x2F; const example = { slug: &#x27;abc_34&#x27;, id: 34 }; </code></pre> is the exact equivalent of<p>```ts<p><pre><code> const example: { slug: `${string}_${number}`; id: number; } &amp; { status?: [code: number, text: string] } = { slug: &#x27;abc_34&#x27;, id: 34 }; </code></pre> For TS-specific keywords like `satisfies`, there&#x27;s a corresponding JSDoc keyword like @satisfies. Generics use @template.<p>Is there any specific feature you think is not supported? I&#x27;m sure I could work up a TS Playground example.
          • c-hendricks5 hours ago
            &gt; Is there any specific feature you think is not supported<p>Yeah, uhm, most of what you&#x27;ve been posting? :). That JSDoc example above gives:<p><pre><code> ERROR: Unable to parse a tag&#x27;s type expression for source file &#x2F;Work&#x2F;lol-jsdoc-why&#x2F;index.js in line 1 with tag title &quot; type&quot; and text &quot;{{ slug: `${string}_${number}`; id: number;} &amp; { status?: [code: number, text: string]; }}&quot;: Invalid type expre ssion &quot;{ slug: `${string}_${number}`; id: number;} &amp; { status?: [code: number, text: string]; }&quot;: Expected &quot;!&quot;, &quot;$&quot;, &quot;&#x27;&quot;, &quot;(&quot;, &quot;*&quot;, &quot;.&quot;, &quot;...&quot;, &quot;0&quot;, &quot;?&quot;, &quot;@&quot;, &quot;Function&quot;, &quot;\&quot;&quot;, &quot;\\&quot;, &quot;_&quot;, &quot;break&quot;, &quot;case&quot;, &quot;catch&quot;, &quot;class&quot;, &quot;const&quot;, &quot;continue&quot;, &quot;debugger&quot;, &quot;default&quot;, &quot;delete&quot;, &quot;do&quot;, &quot;else&quot;, &quot;enum&quot;, &quot;export&quot;, &quot;extends&quot;, &quot;false&quot;, &quot;finally&quot;, &quot;for&quot;, &quot;function&quot;, &quot;if&quot;, &quot;implements&quot;, &quot;impor t&quot;, &quot;in&quot;, &quot;instanceof&quot;, &quot;interface&quot;, &quot;let&quot;, &quot;new&quot;, &quot;null&quot;, &quot;package&quot;, &quot;private&quot;, &quot;protected&quot;, &quot;public&quot;, &quot;return&quot;, &quot;static&quot;, &quot;supe r&quot;, &quot;switch&quot;, &quot;this&quot;, &quot;throw&quot;, &quot;true&quot;, &quot;try&quot;, &quot;typeof&quot;, &quot;undefined&quot;, &quot;var&quot;, &quot;void&quot;, &quot;while&quot;, &quot;with&quot;, &quot;yield&quot;, &quot;{&quot;, Unicode letter number, Unicode lowercase letter, Unicode modifier letter, Unicode other letter, Unicode titlecase letter, Unicode uppercase let ter, or [1-9] but &quot;`&quot; found. </code></pre> Edit: Also, your first edit says Webpack switched from TypeScript to JavaScript, but Webpack source was never written in TypeScript.
            • culi4 hours ago
              We&#x27;re talking about two different things here. All my examples work perfectly fine with TypeScript<p><a href="https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;play&#x2F;?#code&#x2F;PQKhCgAIUgBAXAngBwKaQN4ajSkDOANgK4DmAXJAAYAkG+8ATgJYB2pAvgPp2vEC2AI1SMOVANw48kZgBNKfISMnRIHSADJMBeAEN4xfAH5KAbQDGAe1moFA4YwA0keKgAe8SgxbsAuuLUOHGBwK1YGSHddfmRCdABebSIySgByXUFzLgBmABZU5zlKPLVJIA" rel="nofollow">https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;play&#x2F;?#code&#x2F;PQKhCgAIUgBAXAngB...</a><p>You are attempting to generate documentation from jsdoc comments using an npm package that is also called &quot;jsdoc&quot;. Ofc in this case &quot;JSDoc <i>is not</i> TypeScript&quot;. That package only supports the subset of JSDoc that is relevant to it. Though I believe you can use TypeDoc instead if you want to generate documentation from JSDoc that contains typescript types.<p>In the post I made it explicit that I&#x27;m talking about intellisense, developer tooling, type checking etc. You can run `tsc` to do typechecking on a project typed with JSDoc like the examples I&#x27;ve given throughout this thread just fine.<p>I guess the difference here is I&#x27;m coming at this from the perspective of &quot;what is TypeScript used for. Can JSDoc comments substitute that&quot;. And the answer is almost completely yes.<p>Also tbh I&#x27;ve never met anyone that uses that package to generate API docs. I don&#x27;t think it&#x27;s a very modern package: <a href="https:&#x2F;&#x2F;github.com&#x2F;jsdoc&#x2F;jsdoc&#x2F;issues&#x2F;2129" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jsdoc&#x2F;jsdoc&#x2F;issues&#x2F;2129</a>
              • c-hendricks4 hours ago
                Apologies, my first draft of that comment got deleted on a refresh (mobile) and my posted one left out how I&#x27;m probably being too pedantic: the official JSDoc is not TypeScript.<p>Your post is actually one of the more accurate ones compared to others that say &quot;you don&#x27;t need typescript&quot; with the big caveat that you actually need a whole lot of the typescript ecosystem to make JSDoc work.<p>I just wish there was an official handover, or a more clear delineation between JSDoc and Typescript JSDoc Extensions.
                • culi2 hours ago
                  I think you have a valuable point. I kinda purposely avoided explicitly defining what JSDoc is. Instead I&#x27;m relying on &quot;the JSDoc we&#x27;re all familiar with&quot;. I said in the post that if your IDE is giving you intellisense from JSDoc comments then you are almost certainly already using TypeScript. That&#x27;s about as close as I got to defining the JSDoc I&#x27;m talking about<p>But given that JSDoc doesn&#x27;t have any sort of formal spec, I think the distinction you&#x27;re making is more of a historical than a technical one.
      • k3vinw3 hours ago
        I’m curious how type checking is possible in a JDoc project. As far as I’m aware there’s no way to get type checking to work without tsc or a TypeScript LSP plugin.
        • culi2 hours ago
          That is exactly how it works. Any IDE providing you intellisense is using the TypeScript language service. That&#x27;s why this article is called &quot;JSDoc is TypeScript&quot;. If you see a red squiggly because of your JSDoc comment, you are almost certainly already using TypeScript (without any .ts files)
    • johnfn5 hours ago
      The article is an explicit response to the point you’re making.
  • tobyhinloopen1 hour ago
    &gt; Take it from a massive TypeScript nerd: JSDoc is not an anti-TypeScript position to take. It is the same powerful static analysis without the build step.<p>Ahum <a href="https:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F;learn&#x2F;typescript&#x2F;run-natively" rel="nofollow">https:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F;learn&#x2F;typescript&#x2F;run-natively</a>
    • spoiler31 minutes ago
      Technically there&#x27;s still a build step happening under the hood! But another benefit of shifting TS into JSDoc comments is that it also works in browsers. That being said, while I understand the aversion to unnecessary complexity, I&#x27;m personally fine with a build step to remove TS. It&#x27;s a much nicer syntax IMO. And with tools like `swc` for type stripping, it&#x27;s pretty snappy too.
    • eevilspock44 minutes ago
      that&#x27;s limited to node. won&#x27;t work in a browser.
  • mirekrusin11 hours ago
    1. there are plenty things you can&#x27;t express in jsdoc but can in typescript, flow did the right thing here where you have access to full language, not sure why typescript never did it, they could, with the same syntax flow is using<p>2. you can have navigation that goes to typescript file instead of definition, just arrange your exports in package.json correctly (first ones take precedence)
    • culi10 hours ago
      Well I&#x27;d love to hear some concrete examples if you have any on hand! I was of the same opinion as you until I refactored a project of mine to use JSDoc.<p>Since any TypeScript type can be expressed in JSDoc, I imagine you&#x27;re mostly thinking of generics. At least that was my main sticking point. JSDoc does actually have generic slots with the @template tag. Actually using them in practice is a little unintuitive but involves typing the return type. E.g. for a function it&#x27;d look like this:<p><pre><code> &#x2F;** @type {ReturnType&lt;typeof useState&lt;Book[]&gt;&gt;} *&#x2F; const [books, setBooks] = useState();</code></pre>
      • g947o9 hours ago
        Last time I checked, there isn&#x27;t a way to extend types (<a href="https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;docs&#x2F;handbook&#x2F;2&#x2F;objects.html#extending-types" rel="nofollow">https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;docs&#x2F;handbook&#x2F;2&#x2F;objects.html#...</a>) that works exactly like in TypeScript.
        • culi9 hours ago
          JSDoc actually has the @extends tag<p><pre><code> &#x2F;** * @typedef {object} Dog @extends Animal * @property {string} childProp *&#x2F; </code></pre> But I don&#x27;t really use that feature in TypeScript. Instead I rely on `&amp;`. This works in exactly the same way in JSDoc.<p>Also if you&#x27;re curious about the equivalent of `extends` in generic slots, here&#x27;s an example I have from a different project<p><pre><code> &#x2F;** * @template {Record&lt;string, unknown&gt;} [T=Record&lt;string, unknown&gt;] * @typedef {{ * children?: NewickNode&lt;T&gt;[]; * name?: string; * length?: number; * data?: T; * }} NewickNode *&#x2F; </code></pre> The generic slot here, T, is &quot;extended&quot; by Record&lt;string, unknown&gt;. The equivalent in TypeScript would look like<p><pre><code> type NewickNode&lt;T extends Record&lt;string, unknown&gt; = Record&lt;string, unknown&gt;&gt; = { children?: NewickNode&lt;T&gt;[]; name?: string; length?: number; data?: T; };</code></pre>
          • llimllib5 hours ago
            the equivalent in typescript would be &quot;export type&quot; not just &quot;type&quot;, since as I pointed out that type is exported without you being able to control it
          • KPGv23 hours ago
            I don&#x27;t understand why someone would opt for &quot;write Typescript, but add a bunch of extra characters, make the syntax clunkier, and throw away all the benefits of compile-time errors because we&#x27;d rather have runtime errors&quot; in order to save, what, a microsecond stripping typescript out of TS files?<p>Everyone&#x27;s complaining about &quot;the build step&quot; but the build step is just an eye blink of stripping out some things that match a regex.
            • culi3 hours ago
              &gt; throw away all the benefits of compile-time errors because we&#x27;d rather have runtime errors<p>This is inaccurate on multiple counts. First of all, you can still run tsc with JSDoc if you want a hard error and you can still use strict mode with JSDoc. Your tsconfig file governs JSDoc-typed code just the same as it governs .ts-typed code. In both cases you can also ignore the red squigglies (the <i>exact same</i> red squigglies) and end up with runtime errors.<p>Nobody is advocating for reduced type safety or increased runtime errors.<p>I also think there are many valid reasons to loathe a build step (like not dealing with the headache that is the discrepency between the way the TS compiler deals with import paths vs js runtimes).<p>All that being said, I&#x27;m not really trying to convince anyone to stop using TypeScript. I&#x27;m simply pointing out that using JSDoc <i>is</i> using TypeScript. It&#x27;s the same language service.
        • auxiliarymoose9 hours ago
          You can use `&amp;` operator to combine types. Works for adding fields, making branded types, etc.
          • g947o8 hours ago
            which is not the same as &quot;extends&quot;.
            • spoiler27 minutes ago
              There&#x27;s also a slight performance caveat when it comes to interfaces vs intersections (&amp;) to keep in mind: <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;Typescript&#x2F;wiki&#x2F;Performance#preferring-interfaces-over-intersections" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;Typescript&#x2F;wiki&#x2F;Performance#pre...</a>
      • g947o9 hours ago
        Support for generics is limited in JSDoc compared to TypeScript, especially when arrow function is involved. Things that work fine in TypeScript trigger errors even though they are syntactically the same.
        • culi9 hours ago
          Because AirBnB&#x27;s ESLint config has been burned into my brain I almost only use arrow functions. I also use generics extremely often. It&#x27;s definitely a little more clunky but I haven&#x27;t run into anything you can do in TypeScript that you can&#x27;t do in JSDoc.<p>JSDoc also allows you to type stuff in-line. For example I often have to type an empty array like so:<p><pre><code> const [books, setBooks] = useState(&#x2F;** @type {Book[]} *&#x2F;([])); </code></pre> If you have a tangible example of a problem you&#x27;ve run into, I&#x27;d love to walk through it.
          • g947o8 hours ago
            JavaScript example:<p><a href="https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;play&#x2F;?filetype=js#code&#x2F;PTAEAEBcGcFoGMAWBTeBrAUB4AqHHQcJJkBbABwBsBDE0AFQKPHmssoCNr1QB1AS0iIAMgHsA5uP4A7cQGE2nbpkIRy1AE7VSoAN4AzAK7T4kfqOkAKAJQAuegF9Qrdl3RMIG5JEMbp0PUcmYCxcfFUoMipaZAYPKABPcljdASExSRl5RTc0AB56AD4HYIx4C2hIUAB3QREJKVlQAF5QfRbCvQJQHvL-UUpkADpKCUsAclHM2QBCcetu3oqqr2hDSirW-RsAbkXQLx8-A+Q1jb2HPYwjEzMLUHFvAC1kDVFQGy6ensPfaVAAAwXUJ4eLqLQ6VJ1DKNbKuZROADaU1hzVq6QaWQAuvFfn4ArppIZSBxXiVCCEbqZzP8ACaiXiiDRoD4orItGrQzGyaxfb54-5s2SWR6QF5vawXIA" rel="nofollow">https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;play&#x2F;?filetype=js#code&#x2F;PTAEAE...</a><p>Almost equivalent typescript code:<p><a href="https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;play&#x2F;?#code&#x2F;C4TwDgpgBA6glsAFgGQPYHN1wHboMICGANkQEYEDGA1lALxQA8AKgHwAUFxZlVAXFGwCUdFlCbDaopgG4AULIqpsAZ2BQA7ghQYsufvCRpMOfF3LU6UAGYioAb1lQnURStREIAOiIY2Ach9jXABCP0FHZ1dVKAAnCGUAVyI1eishOWdYiGAEmOwsxOS5AF95KwTsCmA4JSh0bIAtCBjUAWEHTLicvKgABhKyiqqa-IATVBhUGJo2QN10fS0jecIScxp6TUMdE3aIpy7c-LmTNnrgJpbBEqA" rel="nofollow">https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;play&#x2F;?#code&#x2F;C4TwDgpgBA6glsAFg...</a><p>(I had to make it a little bit different from the JS code to make it compile)<p>(Well, this is not exactly about arrow function I guess. I remembered that part wrong.)<p>Note that I cannot make the type check in JS code to pass. Whatever I do, there is always a error. Meanwhile, it does not take much to TS code to work.
            • culi7 hours ago
              Try this out. I think it&#x27;s a much more faithful representation of your TypeScript example too. JSDoc just wants you to be explicit about the default for generic slots (which is `unknown` in TypeScript).<p><a href="https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;play&#x2F;?filetype=js#code&#x2F;PTAEAEBcGcFoGMAWBTeBrAUB4AqHHQcJJkBbABwBsBDE0AbQBUBeAVwDs12B7Ad3YC6BIlACe5ZABNkAM1ABvADyMAfAAp41SpQBG1dAC5QagJShmK0IzMWrAX1AB1AJaREAGW4BzL8-ZeAYS1dfTRlFWFgLFwRSHFkBRc3Tx8-QOC9dAccKPhudmhIUF5XD29ff3NQGQ54c0t5AlBmvILuSmQAOkpvNQByHtT-AEI+kyaW-MLQACdkaFZKIuZq2tMAbgnZ5EhWGfZthaXNu02MGvZ4SGd80C8dgC1kGe5jM0bm5rnd-dAABhO0Twwgg5GoM2opESpRSFXS2kyaAc9EGcOYJWS5TSQkIEG+ewKCnYrFIOmedki51q11ukm4jm4MzQxlRaSqGLKQy87y2+N+rP8anukCeLxMJyAA" rel="nofollow">https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;play&#x2F;?filetype=js#code&#x2F;PTAEAE...</a><p>Hover over the variables and you should see that the type inference is working just the same as in your TypeScript example
              • g947o6 hours ago
                Ah I see. Looks like you avoided using the &quot;@callback&quot; tag but instead used the &quot;@typedef&quot; tag directly. Thanks!<p>I do think it illustrates a problem with TypeScript&#x27;s support for JSDoc though. You see, I started with the code in JS and could not make it work, after which I translated it to TS. In JS&#x2F;JSdoc, &quot;@callback&quot; is the &quot;idiomatic&quot; way of defining a function callback type with JSDoc. (It also makes it easier to add documentation for each parameter if necessary.) And indeed, @callback works the most of the time, except in such cases where these JSDoc tags don&#x27;t work nicely together, and these alternatives become necessary.
                • culi6 hours ago
                  This is absolutely a fair point. JSDoc predates TypeScript by over a decade. It&#x27;s not until more recently that the syntaxes have started to converge.<p>My brain definitely works in TypeScript so I tend to translate from there. I definitely consider myself more familiar with TypeScript than with JSDoc, but sometimes (e.g. here) that&#x27;s a benefit not a weakness
      • efortis9 hours ago
        and types can be written in .d.ts file(s), which can be used in jsdoc out of the box (no import needed)
        • g947o9 hours ago
          You could, but in a large codebase with multiple contributors, it easily becomes messy and confusing.
      • afavour9 hours ago
        ReturnType is TypeScript, no? You’re using JSDoc to express but it’s a TypeScript type.
        • culi9 hours ago
          As I stated in the article, JSDoc <i>is</i> TypeScript :P<p>TypeScript utility types are available in JSDoc. You can pretty much copy-paste any typescript Type&#x2F;Interface into JSDoc
        • Mogzol9 hours ago
          Isn&#x27;t that the whole point of the article? For all intents and purposes, JSDoc IS TypeScript
    • creatonez10 hours ago
      &gt; there are plenty things you can&#x27;t express in jsdoc but can in typescript<p>This isn&#x27;t really true anymore, they have systematically added pretty much every type system feature to the JSDoc-like syntax.
      • g947o9 hours ago
        Having JSDoc-like syntax isn&#x27;t the same as it being fully supported. If you have a large enough codebase, you&#x27;ll likely find a few cases where things work in TypeScript but its equivalent somehow fails type check in JSDoc.
        • trekz9 hours ago
          &gt; If you have a large enough codebase, you&#x27;ll likely find a few cases where things work in TypeScript but its equivalent somehow fails type check in JSDoc.<p>You keep repeating this throughout the thread. Can you give an example?
          • spartanatreyu6 hours ago
            Not that person, but is there an easy way to write something like a basic semver?<p>export type SemVer = `${number}.${number}.${number}`;<p>Could you extend it to work with regex groups like:<p>export const SemVerRegex = &#x2F;^(?&lt;major&gt;0|[1-9]\d<i>)\.(?&lt;minor&gt;0|[1-9]\d</i>)\.(?&lt;patch&gt;0|[1-9]\d<i>)(?:-((?:0|[1-9]\d</i>|\d<i>[a-zA-Z-][0-9a-zA-Z-]</i>)(?:\.(?:0|[1-9]\d<i>|\d</i>[a-zA-Z-][0-9a-zA-Z-]<i>))</i>))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$&#x2F;;<p>Could the groups be extracted so you the type back if you ran the regex on a string like: &quot;1.2.3&quot;, or &quot;1.2.3-prerelease&quot;?
            • g947o6 hours ago
              it is possible to do many of these with @typedef, but it gets difficult with JSDoc very quickly. In TypeScript you can easily create multi-line type aliases. Not quite so in JSDoc.
          • g947o8 hours ago
            <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46268701">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46268701</a>
    • measurablefunc10 hours ago
      TypeScript&#x27;s type system is Turing complete so you have access to essentially unlimited expressivity (up to the typechecking termination depth): <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14905043">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14905043</a>
  • crummy11 hours ago
    &gt; For packages typed with JSDoc, CTRL&#x2F;CMD clicking on a function will take you to actual code rather than a type declarations file. I much prefer this experience as a dev.<p>ok i didn&#x27;t think about this, that&#x27;s an underrated benefit
    • agumonkey11 hours ago
      could be a customizable behavior in editor&#x2F;ide though
      • g947o9 hours ago
        There is indeed an option in VSCode &quot;typescript.preferGoToSourceDefinition&quot; --<p>Prefer Go To Source Definition<p>Makes `Go to Definition` avoid type declaration files when possible by triggering `Go to Source Definition` instead.
    • IshKebab10 hours ago
      This works with Typescript too though?
      • filleduchaos10 hours ago
        It doesn&#x27;t. You might be thinking of libraries that <i>you</i> wrote, not packages from e.g. npm, which are distributed as JavaScript + type definition files not as TypeScript code.
        • sthuck9 hours ago
          It should work if the library was compiled with deceleration map option. Which most libraries are not and it&#x27;s a shame.<p>It was added like 3 years ago which was probably a bit too late, not even sure why it&#x27;s not the default. (File size?)
        • homebrewer8 hours ago
          In real IDEs, not glorified text editors like VSCode, it does. I use this often in IDEA, it&#x27;s muscle memory so I&#x27;m not even completely sure what to press, but it&#x27;s likely &quot;go to definition&quot; and by default is tied to ctrl+alt+b.<p>IDEA adds its own analysis on top of that provided by the language server.<p>Works on JS + every variant of type definitions I&#x27;ve ever seen, among many other things (not only programming languages, but also database objects, etc).
  • zackify11 hours ago
    5 years ago I was at a meet up and the guy talking was saying how if you don&#x27;t like typescript these jsdocs are the way to go. Had to explain to my employer attending that it is still typescript. Didn&#x27;t seem to believe me and was super against typescript but not jsdocs lol
    • sntxcmp11 hours ago
      The difference is syntax compression imo.
    • TheRealPomax8 hours ago
      &gt; Had to explain to my employer attending that it is still typescript<p>&quot;is&quot; is doing a lot of heavy lifting there: JSDoc and TypeScript are two different ways to explicit prescribe typing in a way that tooling can use to determine correctness. The TS syntax is _far_ more powerful, but JSDoc can do most of the common TS use cases, for folks who want to stay in JS land while still benefiting from type tooling (either invoked or straight up built into the IDE).
      • culi8 hours ago
        &gt; in a way that tooling can use to determine correctness.<p>As I pointed out in the article, the &quot;tooling&quot; is exactly TypeScript language services. If you are using JSDoc and you get squigglies or intellisense or any other similar features, you <i>are</i> using TypeScript.<p>You can copy-paste basically any bit of TypeScript into a JSDoc comment and it will work. JSDoc supports any non-runtime feature of TypeScript (so not enums). Even generics! You can even reference TypeScript utility types!<p>The whole point of this article was to correct the idea that JSDoc is not TypeScript. It absolutely is! There&#x27;s almost nothing you can&#x27;t define in JSDoc that you can&#x27;t define in a .ts file. Albeit with a sometimes clunkier syntax
        • KPGv23 hours ago
          &gt; If you are using JSDoc and you get squigglies or intellisense or any other similar features, you are using TypeScript.<p>This is true in the same way you are &quot;using&quot; C++ if you are on Windows. When most people say &quot;use XYZ language&quot; they mean &quot;are personally writing code in XYZ language&quot; rather than &quot;under the hood my code is transpiled to this other language I don&#x27;t write in&quot;
      • Sammi8 hours ago
        In practice today JSDoc 100% completely and utterly always is Typescript.<p>It might not have been so originally. It might still be possible to do differently. But in practice today you are getting Typescript in your JSDoc with the out of the box tooling that is everywhere.
  • Lorin1 hour ago
    Not when the TS team refuses to fix long standing issues preventing JSDOC from operating properly in VSC, for example <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;TypeScript&#x2F;issues&#x2F;16665" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;TypeScript&#x2F;issues&#x2F;16665</a>
    • n2d429 minutes ago
      To be honest, I find Ryan Cavanaugh&#x27;s argument against this quite convincing. It&#x27;s weird to have something documented if you import the .ts file, but not if you import a .d.ts generated from it. If you want to show the value of the default argument of a function, you should probably just add it to the doc comment — not the type.
  • llimllib11 hours ago
    counterpoint: JSDoc <i>is not</i> typescript<p>If you define a type in a file with @typedef, it is automatically exported and there is nothing you can do to control that: <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;TypeScript&#x2F;issues&#x2F;46011" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;TypeScript&#x2F;issues&#x2F;46011</a><p>I tried making a library this way and lacking control over the visibility of the exported types was really painful; it made my intellisense awful because every type I defined at the root was exported from the library
    • sureglymop11 hours ago
      I really like it for web components. Lately I have many &quot;my-component.js&quot; files and it&#x27;s quite nice to just be able to copy them to new projects and have it all work without a build step. But I&#x27;m not sure I would use JSDoc over typescript syntax in a large project.
    • culi8 hours ago
      That&#x27;s technically a fair complaint but feels like a minor nitpick. Just don&#x27;t `@import` the types you don&#x27;t want to use.
  • auggierose1 hour ago
    Been there, tried that. When starting to write JavaScript in anger 3 or 4 years ago, I started out with JSDoc, because my impression was also, hey, that is like TypeScript, but closer to the metal and maybe with less magic. A few months in I realised that TypeScript is just a better and more well-rounded implementation of what JSDoc has to offer (I don&#x27;t remember now, but there were annoying things that you would expect would work in JSDoc, but didn&#x27;t quite).<p>Just use TypeScript.
  • pjmlp11 hours ago
    TypeScript won over the alternatives, exactly because it is only a type checker, and not a new language.<p>Granted they initially weren&#x27;t down that path, but they course corrected it on time, and not much people use stuff like enums in new code.
  • akst11 hours ago
    I&#x27;m actually using JSTypes in app, I don&#x27;t mind it.<p>I choose to use it because I didn&#x27;t want to deal with a build step for a smaller project. The project has grown and I am looking at adding a build step for bundling but still not too worried about using JSDoc over TS.<p>This might be my config, but one thing that does annoy me is whenever I define a lambda, I need to add an doc type. I guess if that&#x27;s disincentivising me from writing lambdas maybe I should just add a TS compile step lol.<p>----------------------<p>Here&#x27;s an example - I got some config typed with this function <a href="https:&#x2F;&#x2F;github.com&#x2F;AKST&#x2F;analysis-notebook&#x2F;blob&#x2F;c9fea8b465317f41da2a10d7c1d493c811803e32&#x2F;lib&#x2F;app&#x2F;sec-unsw&#x2F;sec-2102&#x2F;sec-05-3&#x2F;util.js#L11-L14" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;AKST&#x2F;analysis-notebook&#x2F;blob&#x2F;c9fea8b465317...</a> - Here&#x27;s the type <a href="https:&#x2F;&#x2F;github.com&#x2F;AKST&#x2F;analysis-notebook&#x2F;blob&#x2F;c9fea8b465317f41da2a10d7c1d493c811803e32&#x2F;lib&#x2F;app&#x2F;sec-unsw&#x2F;sec-2102&#x2F;sec-05-3&#x2F;type.ts#L18-L36" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;AKST&#x2F;analysis-notebook&#x2F;blob&#x2F;c9fea8b465317...</a> - And here&#x27;s something to generate a more complicated type for defining config knobs <a href="https:&#x2F;&#x2F;github.com&#x2F;AKST&#x2F;analysis-notebook&#x2F;blob&#x2F;c9fea8b465317f41da2a10d7c1d493c811803e32&#x2F;lib&#x2F;base&#x2F;runtime&#x2F;config&#x2F;type.ts#L52-L60" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;AKST&#x2F;analysis-notebook&#x2F;blob&#x2F;c9fea8b465317...</a>
    • g947o9 hours ago
      These days you can run TypeScript files as-is (type stripping) for testing in many runtimes, and for bundling, most bundlers support using a ts file as the entry point directly.
      • akst6 hours ago
        yep! However this is a website I made for hosting my own notes in the browser browser (sorry for the load times, no bundler so each file is a seperate request)<p><a href="https:&#x2F;&#x2F;akst.io&#x2F;vis&#x2F;20250601-complex-geo&#x2F;?app=unsw.2102.01-1" rel="nofollow">https:&#x2F;&#x2F;akst.io&#x2F;vis&#x2F;20250601-complex-geo&#x2F;?app=unsw.2102.01-1</a><p>That said, when I write tests, I write them in Typescript for that reason.
  • g947o9 hours ago
    I work in a codebase that unfortunately does not support TypeScript. I use JSDoc extensively, although not with type check enabled (due to various limitations). I also work on other projects with TypeScript. My own experience is that the DX with &quot;real&quot; TypeScript is much, much better than JavaScript with JSDoc, without question. JavaScript with JSDoc is much more verbose, with a lot of limitations when types get long or complex compared to TypeScript. The official TypeScript language service also does not provide the same level of support in very subtle ways.<p>Basically, the fact that it works does not mean it works well, and I don&#x27;t recommend anyone going in this other direction unless they understand what they are getting into.
    • culi9 hours ago
      &gt; although not with type check enabled (due to various limitations)<p>Curious what limitations there are on static type checking. It seems like a matter of your IDE setup<p>&gt; My own experience is that the DX with &quot;real&quot; TypeScript is much, much better than JavaScript with JSDoc<p>I agree with the DX point. I would just point out that if you&#x27;re using JSDoc and getting intellisense from it, you <i>are</i> using TypeScript
      • g947o8 hours ago
        Not a limitation in language service, but an issue with the codebase itself -- legacy codebase with a lot of missing&#x2F;incorrect typing from upstream JavaScript code (owned by other teams), making it practically impossible to actually run type check.
  • CSSer8 hours ago
    &gt; For packages typed with JSDoc, CTRL&#x2F;CMD clicking on a function will take you to actual code rather than a type declarations file. I much prefer this experience as a dev.<p>More broadly, this is the default behavior of JS even without JSDoc blocks, and it ought to be the default behavior <i>everywhere</i>, including TS. I&#x27;m not alone in this sentiment, but it&#x27;s incredibly contentious. There&#x27;s been an open GH issue about it with hundreds of replies for years. I have no idea why they can&#x27;t just pick a different shortcut for viewing types and call it a day. They&#x27;d be doing the entire ecosystem a favor.
  • jcbhmr8 hours ago
    JSDoc works great for buildless application setups! One downside is that if you publish a library to npm you still need a build step to generate .d.ts files from your JSDoc type annotations so that npm shows a &quot;TS&quot; badge on the npm package page. This also seems to apply to VSCode&#x27;s intellisense which keeps trying to poke you to &quot;try to install @types&#x2F;jsdoc-typed-package to get type information&quot;. Other JS ecosystem tooling also doesn&#x27;t seem to process JSDoc types at all such as jsdocs.io or tsdocs.dev. So for libraries we&#x27;re stuck with .d.ts generation via &quot;tsc --allowJs --checkJs --declaration ...&quot; even if it&#x27;s all JS.<p>npm displays packages with bundled TypeScript declarations <a href="https:&#x2F;&#x2F;github.blog&#x2F;changelog&#x2F;2020-12-16-npm-displays-packages-with-bundled-typescript-declarations&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.blog&#x2F;changelog&#x2F;2020-12-16-npm-displays-packag...</a><p>JSDoc-typed node modules require special configuration in consumers to be useful <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;TypeScript&#x2F;issues&#x2F;19145" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;TypeScript&#x2F;issues&#x2F;19145</a>
  • Brysonbw8 hours ago
    I&#x27;m a big advocate for explicit type annotations in code. Likewise, either or is good with me. However, these days I lean towards using JSDoc only because I prefer not to add typescript lib and an additional build step just to get type safety in a project.<p>Also, you can use both (if that&#x27;s what you prefer).
  • auxiliarymoose9 hours ago
    This is how I develop web software, and I&#x27;ve found it productive and maintainable.<p>A bonus of this approach is that it clearly delineates what type information is available at runtime, vs what type information is just a comment. (especially useful when working with serialized data).<p>I also like that it generally means all of the preconditions and postconditions for functions are in a single place (both the prose and the technical information are in the JSDoc comment), keeping the code itself low-noise and boiled down to its essence, and providing a natural place to write example inputs and outputs to guide usage.<p>As for generic types, I use them extensively, and this is made less verbose e.g. on function calls by using an @type annotation on the function which accepts a TypeScript signature without needing separate @template + @param annotations.<p>It&#x27;s awesome stuff, and I&#x27;m happy that TypeScript works so well with JSDoc!
  • apatheticonion3 hours ago
    Personally, given the limitations of JSDoc, I&#x27;d like to see a header-file like definition system for build-less applications (like libraries).<p><pre><code> &#x2F; index.js index.d.ts </code></pre> Where values in `index.js` can be typed in the header file with complete TypeScript syntax and those types are present in the target file via intellisense and type checking<p><pre><code> &#x2F;&#x2F; index.js function useStr(x){} &#x2F;&#x2F; has intellisense for &quot;string&quot; useStr(&quot;Hello&quot;) useStr(42) &#x2F;&#x2F; IDE and type checker error </code></pre> And<p><pre><code> &#x2F;&#x2F; index.d.ts declare function useStr(x: string): void</code></pre>
    • MrJohz2 hours ago
      This can be done, and is done in some projects, but the problem is that you need to manually maintain both sets of files, which can easily go out of sync if you&#x27;re not careful. You also lose out on the ability to check your own code - using the header file you&#x27;ve written there, you can&#x27;t really check the implementation of `useStr` to check that it works.<p>The advantage of JSDoc is that the TypeScript compiler treats it as equivalent to TypeScript source code, which means you&#x27;ve still got access to type checking inside your functions.<p>One thing I&#x27;ve seen in a few places is still to have DTS files that declare all sorts of types that are used in the application, and then have those files imported by JSDoc comments. That way, you&#x27;ve got TypeScript syntax for your types, which tend to get bulky and difficult to read in JSDoc syntax, but you still don&#x27;t need a build system because the DTS imports are ignored completely at runtime.
      • apatheticonion2 hours ago
        You can define a declaration file alongside its target however the target does not use the types defined within its declaration within itself - only consumers see the types.<p>There are three issues with that.<p>The first is that JSDoc doesn&#x27;t support everything you need in TypeScript and there is a lot of inlining (like typedef causes collisions, there&#x27;s no importing a type without also re-exporting it from the importing file unless you inline the import)<p>The second is that JSDoc isn&#x27;t picked up from imported libraries (or at least I don&#x27;t think it is?)<p>Lastly, you still need a transpiler to remove the comments and build d.ts files.<p>In the end, JSDoc isn&#x27;t practical for projects. The header file strategy means you don&#x27;t need to transpile ever (only a typechecker) and you&#x27;d get the full suite of TypeScript functionality - at the cost of synchronization overhead.<p>For a project using JSDoc, you&#x27;ll graduate to TypeScript when there is sufficient complexity anyway. Migrating from a d.ts file is way easier (potentially automatable) than migrating from JSDoc.
        • MrJohz54 minutes ago
          The problem with the header file strategy is that TypeScript doesn&#x27;t have total type inference. That approach works e.g. in OCaml, where you can (optionally) type the boundaries of the function and everything inside the function can always be inferred. But TypeScript works differently and doesn&#x27;t support that approach. So fundamentally, what you&#x27;re describing isn&#x27;t really possible without using a very restrictive subset of TypeScript that can be totally inferred or having very broad type definitions.<p>So even if TypeScript did check the header file against the implementation, you&#x27;d still need additional annotations inside the implementation file. At that point, why not put all the annotations inside the implementation file directly?<p>Regarding your points:<p>1. JSDoc does support everything that TypeScript supports (that&#x27;s the point of this article), although it does not necessarily support it as cleanly, hence why projects like Svelte typically use DTS files to define the project&#x27;s types, and have those be imported inside JSDoc annotations. It&#x27;s not perfect, but it gets you a long way.<p>2. You&#x27;re right, JSDoc isn&#x27;t picked up from imported libraries, but if you&#x27;re publishing a library, you&#x27;ll have a build script there, and at that point it&#x27;s typical to generate the DTS files and pack those with the source code. That seems fairly reasonable to me — while developing, you don&#x27;t need to worry about building files, but then when packaging and releasing you do.<p>3. You don&#x27;t need a transpiler with JSDoc, the point behind JSDoc is that it&#x27;s literally just the pre-existing JS documentation syntax. You can (and should) leave the comments in. Even if you&#x27;re using TypeScript syntax, you should have JSDoc annotations (although adding the types to those annotations is redundant in that case). You can also just include the DTS files. As long as they&#x27;re only imported from JSDoc, the runtime won&#x27;t see them.<p>Personally, having tried out JSDoc-based TypeScript, I&#x27;d rather just use the native type stripping in Node for development, and keep with TS syntax, but there are large projects that have made the opposite choice, most noticeably Svelte. So I don&#x27;t think it&#x27;s a given that JSDoc users will inevitably graduate to TypeScript (especially when projects have gone in the opposite direction).
  • conartist611 hours ago
    I still think that JS is very much not TS. Most TS code assumes you never need to check for errors because the type checker proves they can&#x27;t happen.<p>Then, paradoxically, with no error checking at runtime, it becomes fully possible for JS code to call into TS code in a way that breaks the shit out of the TS compiler&#x27;s assumptions. In philosophy then TS and JS are as incompatible as GPL and EULA
    • sethaurus9 hours ago
      It doesn&#x27;t matter if a library is written in TS or JS; you cannot meaningfully protect against other code calling you incorrectly.<p>Sure, you can check if they gave you a string instead of a number. But if you receive an array of nested objects, are you going to traverse the whole graph and check every property? If the caller gives you a callback, do you check if it returns the correct value? If that callback itself returns a function, do you check that function&#x27;s return type too? And will you check these things at every single function boundary?<p>This kind of paranoid runtime type-checking would completely dominate the code, and nobody does it. Many invariants which exist at compile-time cannot be meaningfully checked at runtime, even if you wanted to. All you can do is offer a type-safe interface, trust your callers to respect it, and check for a few common mistakes at the boundary. You cannot protect your code against other code calling it incorrectly, and in practice nobody does. This is equally true for JS and TS.
    • md22410 hours ago
      Writing a Typescript program that takes external input but has no runtime error checking is already a mistake, though. Dealing with external input requires type assertions (since Typescript doesn&#x27;t know what the program is getting at compile-time) and if you write type assertions without ensuring that the assertions are accurate, then that&#x27;s on you, not Typescript.<p>However, if your point is that Typescript can lull people into a false sense of safety, then sure, I take your point. You have to understand where type assertions are coming into play, and if that&#x27;s obscured then the type safety can be illusory. The benefits of Typescript require you to make sure that the runtime inputs to your program are sufficiently validated.
      • billyp-rva10 hours ago
        &gt; Writing a Typescript program that takes external input but has no runtime error checking is already a mistake, though.<p>If it&#x27;s a service, yes, and that&#x27;s true no matter what technology the service is using. If it&#x27;s a <i>library</i>, no, because...<p>&gt; and if you write type assertions without ensuring that the assertions are accurate, then that&#x27;s on you, not Typescript.<p>That&#x27;s on whoever is using the library, not the library author. If the library author provides type definitions, and you as the consumer choose to ignore them, then it&#x27;s on you.
      • conartist610 hours ago
        TS certainly thinks of external input as a boundary requiring safety, but usually that would mean form input or CLI args parsing or something.<p>Usually there&#x27;s little if any protection against a JS caller providing wrong-type args to TS functions.
        • md22410 hours ago
          Sure, but if the caller is Javascript then you&#x27;re running Javascript, not Typescript*, so it makes sense that you&#x27;re not going to get type safety.<p>I&#x27;m also not sure we&#x27;re actually disagreeing on anything, so perhaps my reply was pointless. I agree that if you mix JS and TS in the way you describe, you&#x27;ll have problems. My reply was just to say &quot;yes, and that&#x27;s not really Typescript&#x27;s fault&quot;, but perhaps you weren&#x27;t implying that to begin with.<p>* I&#x27;m aware that you can&#x27;t run Typescript directly, but I hope my point here is clear... you&#x27;re running a program that wasn&#x27;t type-checked by TS.
        • umanwizard9 hours ago
          Something similar is true for most statically typed languages.<p>If you write a C library, nothing stops someone from writing an assembly-language program that calls functions in your library with the wrong types.
    • epolanski10 hours ago
      The type checker can only prove what is known at compile time and only if you&#x27;re disciplined.<p>To bridge runtime and compile time (as your application will likely get some external data) you&#x27;ve got to use a proper parser such as zod[1] or if you want to stretch it even further effect-schema[2].<p>[1] <a href="https:&#x2F;&#x2F;zod.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;zod.dev&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;effect.website&#x2F;docs&#x2F;schema&#x2F;introduction&#x2F;" rel="nofollow">https:&#x2F;&#x2F;effect.website&#x2F;docs&#x2F;schema&#x2F;introduction&#x2F;</a>
      • girvo10 hours ago
        I’m currently in love with Arktype, and as it supports Standard Schema it plugs into most places that can take Zod schemas too :)<p><a href="https:&#x2F;&#x2F;arktype.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;arktype.io&#x2F;</a>
        • epolanski10 hours ago
          That&#x27;s a validator, not a proper parser, no?
          • culi6 hours ago
            What&#x27;s the difference here? I&#x27;ve only used Zod but I typically think of Zod as a runtime validation library. AFAIK arktype is a full-featured replacement for Zod
  • sureglymop11 hours ago
    A somewhat related thing programmers must understand is that whether you write typescript, JSX, .astro or .svelte files, you are technically not writing JavaScript.<p>You should occasionally look at the build artifacts of your framework but also ask yourself whether it is worth it to write code that may not represent what actually ends up being executed.<p>Lately I just use vite with no starter template but with web components and css modules. It at least feels more convenient than using any framework or library.
    • wvenable10 hours ago
      This seems like an issue but in all my practical experience it really isn&#x27;t. TypeScript becomes JavaScript with the types removed. Then you tree-shake, minify, and whatever is executed is no where near what you actually wrote but at the same it totally is the same because that&#x27;s no different than any other compilation process.<p>Occasionally, I have to remember that JavaScript has no types at runtime but it&#x27;s surprisingly not that often.
      • sureglymop10 hours ago
        I mean what makes it more acceptable is that you have HMR and instant preview during development. So, all the transformations and bundling aside, you do see how it runs during development.<p>However I have been in a few situations at work where all of a sudden we did have issues that required us to dig deeper. There were also some bundling related issues that caused problems in production deployments. At that point many co workers had no idea how to even approach it to be honest.
        • wvenable9 hours ago
          I&#x27;ve had similar experiences with compiled languages in one form or another throughout my career as well. I don&#x27;t think JavaScript is particularly special that we need to call it out for things like TypeScript, minification, or bundling.
    • umanwizard11 hours ago
      &gt; ask yourself whether it is worth it to write code that may not represent what actually ends up being executed.<p>Doesn&#x27;t this describe every programming language?<p>When you write C, you are technically not writing machine code.<p>Even when you write JavaScript, what actually gets executed is V8 bytecode and&#x2F;or machine code (depending on whether the JIT fires).
      • sureglymop10 hours ago
        That&#x27;s correct, however I would say there is a small difference in that most of this code still <i>seems</i> just like JavaScript, sometimes it even feels as though it is JavaScript running in the same context when it then gets compiled to run on server&#x2F;client.<p>I think the point I&#x27;m trying to make is that this can be confusing or even dangerous especially for new developers. It just doesn&#x27;t hurt to actually look at the Vite plugins transforming it all to understand it instead of making assumptions if we work with it on the daily.
      • vlovich12311 hours ago
        Yeah it’s a silly line of reasoning. The transformations of TS -&gt; JS are a lot smaller and simpler than C-&gt; asm &#x2F; machine code; it’s basically just removing type annotations. Now minification and optimization can make the output a lot more terse, but that can be done for JS too. And it’s not as complicated and detached from the source as an optimizing compiler is.
        • sureglymop10 hours ago
          Let&#x27;s not act like it&#x27;s the same thing. I&#x27;m not strictly talking about just Typescript, I&#x27;m saying that if you work with these technologies every day it would be wise to go look at their Vite plugins to see how they transform your code and be sure to understand it. It&#x27;s nice to have <i>magic</i> but it&#x27;s nicer to use the magic if we have demystified it first.<p>And I don&#x27;t know about you, but I occasionally do open compiled ELF files in a hex editor and I certainly did at first when I was learning more. That&#x27;s a good practice also.
    • kaufmann11 hours ago
      Aren&#x27;t you loosing a lot of the declarative features like signals or similar, when you do your projects without those frameworks?<p>(asking to learn)
      • sureglymop10 hours ago
        Somewhat. I could still use framework agnostic state management libraries&#x2F;patterns and most are (e.g. svelte signals, jotai, zustand, etc.).<p>I&#x27;ve even used Proxies directly to implement some reactivity before. However as for the &quot;declarative&quot; parts, I think it&#x27;s just a little bit of a different way to work but you get used to it and imo it pays off. Knowing the web APIs <i>should</i> be a requirement anyway and it doesn&#x27;t hurt to work with them directly as much as possible.
  • notpushkin4 hours ago
    What I would really like to see is a TS compiler that emits .js libraries with typing information compiled as JSDoc comments.
  • mohsen110 hours ago
    Webpack is typed using JSDoc and type-checked via TypeScript -- I started this migration a while ago. It works pretty well
    • culi9 hours ago
      Wow I had no idea! Have you written anywhere about your experiences?
  • eezing7 hours ago
    Aside from the following, JSDoc is absolutely TypeScript.<p>Discriminated unions, conditional types, mapped types, template literal types, recursive type aliases, higher-kinded type patterns, generic constraints with conditional inference, the infer keyword, never type exhaustiveness checking, const assertions, readonly tuple and array inference, exact object types, key remapping in mapped types, indexed access types, variance annotations, assertion signatures, strict null checking with flow-sensitive narrowing, definite assignment assertions, the satisfies operator, declaration merging, module augmentation, symbol-typed properties, type-safe enums<p>…and not written via comments
    • culi7 hours ago
      Yes, all of these are supported in JSDoc because they are supported in TypeScript. Because JSDoc is TypeScript. You can either define your types in JSDoc comments or in .ts files.<p>I really mean it. You can even use the @satisfies operator like so<p><pre><code> &#x2F;** @satisfies {Type} *&#x2F; </code></pre> Discriminated unions, conditional types, mapped types, template literal types, etc work exactly the same way if you define them in a JSDoc comment as if you define them in a .ts file
    • cutler7 hours ago
      Sounds like Scala type fetishism all over again.
  • efortis10 hours ago
    jsdoc is nice because you don’t have to write the non-helpful types.<p>---<p>In WebStorm, jsdoc can be rendered in HTML, which makes the code easier to scan. Here&#x27;s a side-by-side VSCode vs WebStorm:<p><a href="https:&#x2F;&#x2F;x.com&#x2F;efortis&#x2F;status&#x2F;1989776568676221137" rel="nofollow">https:&#x2F;&#x2F;x.com&#x2F;efortis&#x2F;status&#x2F;1989776568676221137</a><p>---<p>And in jsdoc you can have an inline description:<p><pre><code> @prop {number} width Video width in pixels</code></pre>
    • culi8 hours ago
      &gt; you don’t have to write the non-helpful types<p>This entirely depends on your tsconfig setup. You can run a JSDoc-typed project in strict mode exactly the same way you would a *.ts-typed project.
      • efortis8 hours ago
        Do you know if it&#x27;s possible to do that the other way around?
        • culi8 hours ago
          You mean a TypeScript project without strict mode? Sure. Again, whether you&#x27;re defining types in JSDoc comments or in .ts files, the behavior is entirely governed by a tsconfig file
  • strongpigeon11 hours ago
    Oh man, the mention of ScriptSharp brought back memories. I started my career at MSFT on SharePoint and the front end was an ungodly mix of ScriptSharp and other stuff.<p>I vividly remember being in a meeting with the Exchange team (about building shared frontend components) arguing for us to adopt TS instead as it had a better experience and very rapidly growing popularity (that was about 10 years ago). Plus, as strong as Nikhil [0] was, he was basically the only person behind ScriptSharp while TS had a whole team.<p>Of course, this being MSFT, this effort went no where. While true that the TS toolchain lacked the tree-shaking that ScriptSharp had, I was just annoyed that we had to build stuff using what was obviously an dead-ish language with limited support, many flaws, and no resources to improve it.<p>But hey, at least it wasn’t GWT.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;nikhilk" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nikhilk</a>
    • culi9 hours ago
      From what I&#x27;ve read, many of TypeScript&#x27;s design regrets have political origins. Enums and other features that oppose TS&#x27;s structural type system were added as compromises with C# developers in MS and similar negotiations with the Angular team in order to increase adoption of TypeScript over alternatives
      • pavo-etc8 hours ago
        I would love to know where you read this!
        • culi8 hours ago
          Oh gosh, I don&#x27;t think I can recall a specific source. I&#x27;ve listened to many interviews with the TypeScript team and in Q&amp;A they&#x27;re often asked about their &quot;biggest regrets&quot;. Early on TypeScript&#x27;s adoption was far from a sure thing. After convincing Microsoft their biggest threat was Angular&#x27;s own AtScript (and maybe even Flow). TypeScript was extremely beholden to whatever Microsoft or Angular devs wanted to be added to the language in order for them to agree to push TypeScript as the future
  • epolanski10 hours ago
    Not really, at best it&#x27;s a verbose and limited subset.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-type-annotations?tab=readme-ov-file#limits-of-jsdoc-type-annotations" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-type-annotations?tab=readme...</a>
    • culi9 hours ago
      It&#x27;s certainly more verbose but certainly not a limited subset. You can copy paste any typescript Type or Interface in a jsdoc @typedef. As I stated in the article, it&#x27;s still the TypeScript language service that&#x27;s analyzing either JSDoc-defined types or TypeScript defined types. It&#x27;s typescript all the way down<p>But JSDoc lets you do pretty much everything that isn&#x27;t a runtime feature of TypeScript (e.g. enums, namespaces, etc). Even generic slots are supported
      • g947o9 hours ago
        You just haven&#x27;t worked in a complex enough project yet.<p>I found several limitations and already opened several issues on github.
    • efortis10 hours ago
      Although it&#x27;s more verbose, it makes code less dense because it lives outside the function parameters.<p>Also, it&#x27;s not a super limited subset. For instance, you can write types in .d.ts the IDE uses those types in jsdoc out of the box.
      • epolanski9 hours ago
        The list of things jsdoc cannot do is long but a simple example is overloading, you cannot express this[1] in jsdoc, and if you need to reference .d.ts files you&#x27;re back at using TypeScript, so the point of JSDoc was...?<p>If you need precise return typing, conditional types, literal values, etc, you aren&#x27;t going far if anywhere with JSDoc.<p>[1] <a href="https:&#x2F;&#x2F;shorturl.at&#x2F;pg5dL" rel="nofollow">https:&#x2F;&#x2F;shorturl.at&#x2F;pg5dL</a>
        • efortis8 hours ago
          There a few points in favor of TS types in jsdoc (in order):<p>1. not having to type everything (many types are not helpful)<p>2. makes code less dense (and they can be rendered in HTML) <a href="https:&#x2F;&#x2F;x.com&#x2F;efortis&#x2F;status&#x2F;1989776568676221137" rel="nofollow">https:&#x2F;&#x2F;x.com&#x2F;efortis&#x2F;status&#x2F;1989776568676221137</a><p>3. not needing a compiler (browsers don&#x27;t support TS)<p>I think the main jsdoc caveat is around private types.<p>About 1, IDK if there’s a way to set up TS for that.
        • g947o9 hours ago
          This specific one is actually supported since TypeScript 5.0:<p><a href="https:&#x2F;&#x2F;devblogs.microsoft.com&#x2F;typescript&#x2F;announcing-typescript-5-0&#x2F;#@overload-support-in-jsdoc" rel="nofollow">https:&#x2F;&#x2F;devblogs.microsoft.com&#x2F;typescript&#x2F;announcing-typescr...</a><p>But not properly documented (<a href="https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;docs&#x2F;handbook&#x2F;jsdoc-supported-types.html" rel="nofollow">https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;docs&#x2F;handbook&#x2F;jsdoc-supported...</a>), which shows how much Microsoft neglects JS + JSDoc workflow. Github issues have been created a long time ago, but nothing has been done so far. Apparently Microsoft is too busy with their AI slop to work on actually useful stuff.
  • neallindsay10 hours ago
    Some TypeScript features are <i>only</i> available through JSDoc. The one I encounter most often is `@deprecated`.
    • pyrolistical9 hours ago
      What do you mean? Jsdoc has it<p><a href="https:&#x2F;&#x2F;jsdoc.app&#x2F;tags-deprecated" rel="nofollow">https:&#x2F;&#x2F;jsdoc.app&#x2F;tags-deprecated</a>
      • christophilus9 hours ago
        I think he’s saying that <i>only</i> JSDoc has it. Vanilla TS doesn’t.
  • sgammon8 hours ago
    No it isn’t, otherwise Closure Compiler would (still) be running MS365
    • sgammon8 hours ago
      “There’s nuance” yeah as much in my comment as the headline at the top of the article
  • afavour9 hours ago
    Eh. I agree with the principle. I’ve written personal projects with JSDoc because I truly love the idea of finally being done with build systems and just serving the files I write without a step in between.<p>But it’s more annoying than just writing TypeScript. There are ways to express just about everything TypeScript can but they’re all more difficult and convoluted (generics are a great example). For a project of any reasonable size I’m still going to advocate to use TypeScript.
  • casmn9 hours ago
    I am always using JSDocs whenever i am writing a function - i think this is a good practice for every developer - even if it&#x27;s a simple function.
  • brazukadev6 hours ago
    I like the mention to someone from the React team as it seems TypeScript&#x2F;type safety did not help them create better, safer software.
    • jason_oster4 hours ago
      Writing better, safer software is more of a cultural problem than a language problem. Languages can only do so much.
  • paulddraper11 hours ago
    And in fact, this what the Closure Compiler does…typecheck based on JSDoc.<p>However, the precision and completeness is not nearly what can be expressed in TypeScript. With generics particularly.
    • culi8 hours ago
      Care to give an example? In another reply I pointed out how advanced JSDoc syntax&#x27;s support for generics is.[0] Even allowing for `extends` and default values for generic slots.<p>The clunkiest part is in the way you &quot;pass in&quot; a generic to a slot. But this is solved by typing the return type.<p>I use generics pretty extensively and I&#x27;ve not yet come across a use-case JSDoc couldn&#x27;t handle<p>[0] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46267810">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46267810</a>
  • user393938211 hours ago
    Agree. It’s superior. I arrived at this about 2 years ago no regrets. Type safety matters on the tooling side anyway. Unless you’re testing for the runtime I guess?
    • culi8 hours ago
      I&#x27;m glad to hear you&#x27;ve had a good experience with JSDoc but I want to reiterate that my position isn&#x27;t that JSDoc is superior. Just that it <i>is</i> TypeScript
      • user39393822 hours ago
        Yes I’m saying, starting from equality Id add on to say it’s actually the better form. TypeScripts extra enforcement adds complexity without usefulness.
  • gaigalas11 hours ago
    The sooner we get <a href="https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-type-annotations" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-type-annotations</a>, the better.<p>Once we get it, there is still a solid decade before runtimes support it, and optimistically, still more 10 years minimum having to deal with an interpreted language that has acquired an unecessary build step.<p>I absolutely hated when PHP switched from a phpDoc culture with static analysis (and IDE inconsistencies that would click-take you to stubs as well) to actual types. Not because I hate types, but because of the transition period. Once it&#x27;s gone, it&#x27;s such a relief to get rid of unecessary docblocks.
    • g947o4 hours ago
      The proposal likely won&#x27;t go anywhere. The first sentence in README says enough about it.
    • conartist611 hours ago
      That proposal is a nonstarter. It cannot and will not ever be accepted
      • gaigalas10 hours ago
        Something needs to change. I don&#x27;t care about one specific proposal.<p>It&#x27;s miserable having a de-facto build step for an interpreted language. Worst of both worlds.<p>Maybe just TS is fast, but it encourages developers to put more and more stuff into that build step (and they do, they do that a lot). Culturally, that trend is not going to change unless the main reason for having said build step is removed.<p>The whole babel&#x2F;transpiling thing was meant to be temporary. It became temporarily permanent &#x2F; permanently temporary.
        • conartist610 hours ago
          I&#x27;m the person who is developing a permanent solution.
          • prmph8 hours ago
            Which is?
            • conartist66 hours ago
              A standard environment in which to run code that extends the builtin parser.
      • indolering11 hours ago
        Please elaborate!
        • conartist610 hours ago
          The proposal is to introduce a whole slew of syntax to JS that according to the proposal will have no meaning. This is a paradox. You have only created a language if you can use it to convey meaning
          • gaigalas10 hours ago
            That&#x27;s not entirely true. Ideally, there would be a follow up with a reflection API.<p>Also, comments are syntax and they&#x27;re mostly meaningless. By your reasoning, programming languages should have no comments.<p>So, it&#x27;s not really a qualitative issue (presence of meaningless syntax) but a quantitative one (presence of lots of parsing complexity).
            • conartist610 hours ago
              If you say that whatever data is put there doesn&#x27;t matter at all, the one thing you definitely cannot ever do later is give it meaning.
              • gaigalas10 hours ago
                Unless I say it&#x27;s meaning is to be optionally reflected upon during runtime!<p>Look, I understand the purism and mostly, I agree. But this is not a clean slate language, it will never be perfect and it&#x27;s going to become more and more idiosyncratic as times go by.
                • conartist610 hours ago
                  I don&#x27;t see how it&#x27;s optional.<p>Comments are a kind of freedom in code. You&#x27;re completely free to use them precisely because (in a plain execution environment) they cannot influence the result of evaluation<p>If comments &#x2F;can&#x2F; change the result of evaluation then you simply are not (completely) free to use them. (And yes I know that this is a simplification in JS where you can already get the source code of a function with toString... Ugh)
                  • gaigalas8 hours ago
                    Makes sense. I&#x27;m excited for your solution, despite not having seen it. If you can solve that, it would be awesome.
      • botten11 hours ago
        Why?
        • conartist610 hours ago
          In short, we can do much better. I&#x27;m building a full syntax extension&#x2F;macro evaluation mechanism for JS.
          • herpdyderp8 hours ago
            Where is it? What is it called?
            • conartist66 hours ago
              It&#x27;s called BABLR as it takes concepts from Babel (transpiling) and ANTLR (parsing arbitrary syntax). <a href="https:&#x2F;&#x2F;github.com&#x2F;bablr-lang&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bablr-lang&#x2F;</a><p>I&#x27;m currently in the process of trying to pull together our first big release.
  • zwb23245502 hours ago
    [dead]
  • sgammon8 hours ago
    [flagged]
  • austin-cheney11 hours ago
    Who cares what some framework guy thinks. When I was writing JavaScript for employment most people doing that work were hyper concerned with how to write code and what other people thought about it. These kinds of opinions and conversations are critically important for beginners, but junior and senior developers never seemed to get past these concerns of basic literacy.<p>When other developers and non-developers look at JavaScript developers as small children it’s because the maturity difference is very evident from the outside. Once developers get past basic literacy they are free to worry about architecture, performance, scale, platform independence, and more. For most JavaScript developers they just expect some framework to do it for them.
    • christophilus9 hours ago
      Dunno. Your comment seems pretty immature and strangely emotional. If you think you’re too good for these sorts of articles and this sort of tech, then maybe you’re also too good for the related discussion.
      • austin-cheney6 hours ago
        I guess you are only looking for praise or pity. If that is the case then yes, I am too good&#x2F;mature for your work and discussions.