- 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.
There are three issues with that.
The first is that JSDoc doesn't support everything you need in TypeScript and there is a lot of inlining (like typedef causes collisions, there's no importing a type without also re-exporting it from the importing file unless you inline the import)
The second is that JSDoc isn't picked up from imported libraries (or at least I don't think it is?)
Lastly, you still need a transpiler to remove the comments and build d.ts files.
In the end, JSDoc isn't practical for projects. The header file strategy means you don't need to transpile ever (only a typechecker) and you'd get the full suite of TypeScript functionality - at the cost of synchronization overhead.
For a project using JSDoc, you'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.
- Personally, given the limitations of JSDoc, I'd like to see a header-file like definition system for build-less applications (like libraries).
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/ index.js index.d.ts
And// index.js function useStr(x){} // has intellisense for "string" useStr("Hello") useStr(42) // IDE and type checker error// index.d.ts declare function useStr(x: string): void - 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.
Types for classes are poor and often you'll find yourself creating a `.d.ts` file or `.ts` file to export non trivial types - however the target file doesn't know how to consume them.
- Keep in mind the energy vs electricity "gochya".
Australia, for instance, powers 40% of its electricity with renewables.
However, electricity makes up ~20% of _total_ energy consumption which means renewables made up 9% of _total_ energy production.
As the electrification of transport, industry, manufacturing, etc proceeds, the demand for electricity will increase (in the case of Australia, we need to 5x our electricity production).
Ironically, legislators are disincentivized from stimulating electrification as getting to 100% renewable electricity production is easier when electricity is only 20% of our energy usage.
- Cries in $0.45/kWh AUD (metro Sydney). Best I've found is $0.37/kWh
- Transpilation of anything other than jsx requires a complex toolchain with layers of things like LSPs, compilers, IDE plugins, bundler plugins, etc.
Frameworks that go that route typically activate this toolchain by defining a dedicated file extension (.vue, .svelte).
This custom toolchain (LSP, IDE plugins) presents a lot of overhead to project maintainers and makes it difficult to actually create a viable alternative to the JSX based ecosystem.
For instance both Vue and Svelte took years to support TypeScript, and their integrations were brittle and often incompatible with test tooling.
Angular used decorators in a very similar way to what I am describing here. It's a source code annotation in "valid" ecmascript that is compiled away by their custom compiler. Though decorators are now abandoned and Angular still requires a lot of custom tooling to work (e.g, try to build an Angular project with a custom rspack configuration).
JSX/TSX has preferential treatment in this regard as it's a macro that's built into tsc - no other framework has this advantage.
- Same. I started writing one as a weekend project and got as far as having a GH repo with releases that mirror the binaries of the tools that I use, normalizing the archives so they can be installed in the same way. It auto-generates a release whenever the project authors update their projects.
https://github.com/alshdavid/install-scripts/releases?q=node...
https://github.com/alshdavid/install-scripts/releases
All of the binaries here are expected to be standalone/portable installations, so you can download/extract the archive and just run the binary.
I haven't yet written a package manager yet, but I was planning for it to just do the same thing as above but figure out your OS/ARCH, handle extraction and also offer a PATH update system so you can run `eval $(xpkg env)` and PATH is updated automatically.curl -L --url https://github.com/alshdavid/install-scripts/releases/download/terraform-1.14.1/terraform-1.14.1-linux-amd64.tar.gz | tar -xvzf - -C $HOME/.local/bin $HOME/.local/bin/terraform --help - I agree. Incoming hot take.
IMO, a big part of it is the lack of competition (in approach) exacerbated by the inability to provide alternatives due to technical/syntactical limitations of JavaScript itself.
Vue, Svelte, Angular, Ripple - anything other than React-y JSX based frameworks require custom compilers, custom file-types and custom LSPs/extensions to work with.
React/JSX frameworks have preferential treatment with pre-processors essentially baking in a crude compile time macro for JSX transformations.
Rust solved this by having a macro system that facilitated language expansion without external pre-processors - e.g. Yew and Leptos implement Vue-like and React-like patterns, including support for JSX and HTML templating natively inside standard .rs files, with standard testing tools and standard LSP support;
https://github.com/leptos-rs/leptos/blob/main/examples/count...
https://github.com/yewstack/yew/blob/master/examples/counter...
So either the ECMAScript folks figure out a way to have standardized runtime & compilable userland language extensions (e.g. macros) or WASM paves the way for languages better suited to the task to take over.
Neither of these cases are likely, however, so the web world is likely destined to remain unergonomic, overly complex and slow - at least for the next 5 - 10 years.
- Exactly this. "AI usage is 20% of our customer base" "AI usage has increased 5% this quarter" "Due to our xyz campaign, AI usage has increased 10%"
It writes a narrative of success even if it's embellished. Managers respond to data and the people collecting the data are incentivised to indicate success.
- Sadly, almost none of my friends care or understand (older family members or non-tech people). If I tried to convince friends to move to Signal because of my disdain for AI profiteering, they'd react as if I were trying to get them to join a church.
- I don't understand why it takes 5 seconds for Chrome to open on my MBP while it's near instant on my Linux and Windows PC.
Why is eveything so slow on new MacOS?
- Yeah, sadly, it seems almost impossible to get anything higher than 30% efficiency (theoretically with a Stirling engine, if you can find one, haha) out of a thermal battery without extreme pressures and temperatures.
Back-of-the-napkin math felt promising. A 1kg block of sand heated to 500 degrees Celsius should contain about 100Wh of electricity. Scaling that capacity up is easy, as it's just about adding sand or temperature (+ an effective method of transporting heat across the sand - maybe sand + used motor oil?).
Assuming 80% efficiency, tariff arbitrage (buy electricity during off-peak hours and use it during high-price hours) would pay off very quickly. In my area (Australia) it would be a matter of months - but the low real-world efficiency and lack of parts make it impossible.
It could work for heating during winter, though perhaps an AC/heatpump with the condenser a couple metres underground would be better value for money.
- I was interested in trying to make a DIY thermal battery as a hobby experiment. Other than using thermal energy directly, I couldn't find a way to effectively convert the heat energy to electrical energy.
Peltier modules can be used to generate electricity, but they are crazy inefficient.
An efficient steam turbine is largely inaccessible to hobbiests and I am scared of steam/pressure. Though I did look at repurposing a car turbo for this purpose. There were additional issues with regulating the amount of heat you wanted to extract (load matching) and recycling waste heat.
I wondered if it was possible to use a Sterling engine, but you can't buy anything other than very small toys online and I don't have the facilities to machine my own.
Haha, would love to get something working, but I suppose I'm not smart enough to figure out an effective way to get that heat back out as usable/controlled electricity.
- How far away are we from being able to use new snapdragon laptops with Linux?
I'm pretty keen to play around with Proton, FEX in a laptop that rivals the MBP
- > slack clones
As an anecdote - I really want to see consolidation here. All my chat services under one parent application. WhatsApp, Slack, Discord, Messenger.
I really don't care about the vendor for chat services, just exhausted of installing multiple clients and many of the clients being pretty garbage.
I would also like to say the same for many services. Online banking is top of mind for me right now as I have several bank accounts chasing competitive savings rates.
- 2 points
- I tried this. Their examples don't even compile lol
- Tauri is pretty awesome. Rust backend, WebView front end. Nothing uses native desktop elements of course.
To be fair, there is no practical way to write native desktop applications using stylistically consistent UI elements AND have it be portable AND in a language that you enjoy using.
As far as I can tell, Windows 11 doesn't even have a toolkit with platform UI elements.
GTK on Gnome is pretty okay and GTK-rs is not dissimilar to React. Who know what MacOS uses but something something Swift XCode.
But I agree, just use web technologies. Write once, ship everywhere (and hum loudly when people complain about poor performance - joking, it's the vendors' fault we have to use web technologies).
- I'd been taking 3mg slow release melatonin daily for years up until a few months ago. To be honest, I'm not sure it has any significant effect.
Regular exercise and a consistent sleep routine (cardio, weight lifting, going to bed early, and waking up early) has been more effective for me.
According to my fitbit, my average sleep duration is 6hr 30min over the last 2 years, down from 7hr30. When I wake up, there's no going back.
The biggest contributor to my reduction in sleep is my job, which in the last few years added stack ranking and by-annual performance reviews which requires daily book keeping of my "company impact".
I also got an echo-cardiogram last week (unrelated) and it came back in top shape (have a calcium score test coming up). Not saying melatonin isn't a risk for cardio health, but as a male in his early 30s with a family history of heart disease, nothing seems to indicate an increase in damage in my case.
The alternative is to do an inline `const foo = /** @type {import('./foo').x} */ ({})` however this gets messy, repetitive and it's difficult to use algebraic types (e.g. `Event & { detail: string }`)