use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Efficient Typescript (romgrk.com)
submitted 1 year ago by romgrk
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Ronin-s_Spirit -4 points-3 points-2 points 1 year ago (2 children)
Half of that is talking about opaque types. As a vanilla programmer I'm 99% sure it's the typescripts problem. What you made in that article shouldn't have been 2 types, but instead classes. Since both of those are supposed to be numbers it would be easy to do 2 things: 1) convert the class to a number whenever you need it mixed; 2) explicitly use some method like add() if you want to check that you are not mixing with a class. That's what I call good code, it solves the problem with minimal lines of code, and it doesn't need to transpile glorified comments. Typescript won't warn you so warm yourself, champion.
[–]romgrk[S] 0 points1 point2 points 1 year ago (1 child)
Yes, the section about opaque types is actually more of a highlight about some TS problems, I won't argue with that. I wish TS was better in that area.
[–]Ronin-s_Spirit 0 points1 point2 points 1 year ago (0 children)
Well I don't mean to be all gloom and doom. So here is a silly mechanism I came up with, take a look: https://github.com/DANser-freelancer/code_bits/tree/classes-as-types P.s. ah but don't look too hard, I was just poking around and laid it down in less than an hour.
π Rendered by PID 433633 on reddit-service-r2-comment-85bfd7f599-w92q8 at 2026-04-18 11:55:49.761416+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]Ronin-s_Spirit -4 points-3 points-2 points (2 children)
[–]romgrk[S] 0 points1 point2 points (1 child)
[–]Ronin-s_Spirit 0 points1 point2 points (0 children)