[HN Gopher] Comptime.ts: compile-time expressions for TypeScript
       ___________________________________________________________________
        
       Comptime.ts: compile-time expressions for TypeScript
        
       Author : excalo
       Score  : 71 points
       Date   : 2025-08-03 19:11 UTC (3 days ago)
        
 (HTM) web link (comptime.js.org)
 (TXT) w3m dump (comptime.js.org)
        
       | Thom2000 wrote:
       | Interesting. I've never seen the import-with syntax, though and
       | it's hard to find any documentation on it. Is this a syntax
       | extension?
        
         | nrabulinski wrote:
         | It's been introduced as part of ecmascript 2026
         | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
        
           | no_wizard wrote:
           | It first started as an assert statement[0] for those who may
           | have seen that, these type statements are an evolution out of
           | that proposal.
           | 
           | I do wonder if this makes the importable gets (via type:
           | json) a reality like assert was going to.
           | 
           | [0]: https://v8.dev/features/import-assertions
        
             | throwitaway1123 wrote:
             | > I do wonder if this makes the importable gets (via type:
             | json) a reality like assert was going to.
             | 
             | Yes, the JSON modules proposal is finished.
             | 
             | https://github.com/tc39/proposal-json-modules
             | 
             | https://caniuse.com/mdn-
             | javascript_statements_import_import_...
        
       | mdarens wrote:
       | One of the most exciting features of Zig, but am I correct that
       | this doesn't apply to types themselves like comptime generics in
       | Zig? I find that to be one of the most powerful ideas: type level
       | mappings that have the same syntax as the runtime code where you
       | can just set an iteration limit. This would be a great way to get
       | around the "too large union" problem in TS, for example.
        
       | apatheticonion wrote:
       | I literally just want Rust style macros and proc macros in
       | JavaScript. e.g. using
       | 
       | ``` const MyComponent = () => jsx!(<div></div>) ```
       | 
       | rather than a .tsx file.
       | 
       | That or wasm to be usable so I can just write my web apps in Rust
        
       | stevage wrote:
       | I could imagine this being useful for pre-compiling markdown.
        
       ___________________________________________________________________
       (page generated 2025-08-06 23:00 UTC)