Live data from Hacker News

Starting a TypeScript Project in 2021

metachris.com

101–110 of 190 posts

Re: Starting a TypeScript Project in 2021

#101

Earlier quoted context omitted.

FYI PowerShell is pretty cross-platform these days. But I see having it all written in JS is still simpler.

I don't know about simpler :) My preference is to eliminate the OS discrepancy by making Docker images the building block of the stack in dev environments, CI pipelines, and production deployments. This means you pay a constant and predictable amount of operational complexity, but eliminate the entire class of constraints caused by cross-platform variability. Seems like a good deal, trading a variable cost for a cons…

I've read about NixOS here on HN which aims to do something similar.

Does your approach with using docker heavily have some disadvantages you experienced? Just curious, it sounds interesting...

Re: Starting a TypeScript Project in 2021

#102

I recommend adding `--transpile-only` to `ts-node` in npm scripts and any interactive workflows. If you have type checking in your editor or tsc --watch in a terminal you don't need to block unit tests or iterative development while ts-node runs type checks.

I disagree, I don't want my project to successfully build at all if I have type errors.

Re: Starting a TypeScript Project in 2021

#103
post #90

Earlier quoted context omitted.

Honest question though, what abstraction do you use in place of React? I don't disagree that it's pretty obtuse, despite loving working in it. I miss being able to look up the source of Backbone.js and gain a real understanding of why something was happening. Maybe I'll get to that point in React, but it seems much harder to grasp what the source is doing.

I just write JavaScript? The concepts of Basecamp's Hotwire[0] are particularly simple and elegant enough for the 1% of stuff that isn't just a static page or can't be solved in a single JS function. I've never been like "boy I really need a virtual DOM" so I guess I've never really seen the appeal of React. It just seems like a bundle of complexity, obfuscation and anti-patterns. 0: https://hotwire.dev

> I just write JavaScript?

This is the tell. If you are able to satisfy your business requirements with "just JavaScript" then you are in a completely different world than the people building production-grade web apps and there's absolutely nothing wrong with that. If you can be productive with "just JavaScript" then that's awesome!

However, I'm sure you understand there's a massive difference between simple pages that need *some* interactivity and a full-blown app inside a web browser.

I'm sure you've come across projects that probably didn't need the same tooling that I'm describing which ultimately boils down to a judgement call.

> I've never been like "boy I really need a virtual DOM" so I guess I've never really seen the appeal of React. It just seems like a bundle of complexity, obfuscation and anti-patterns.

That's because you've never needed it before. I've never been like "boy I really need a batteries-included web framework" so I guess I've never really seen the appeal of Rails. It just seems like a bundle of complexity, obfuscation and anti-patterns.

Re: Starting a TypeScript Project in 2021

#104
post #66

In 2021, I think it's safe to start a TypeScript project with Deno.

Do you have any quickstart guides that you could recommend to get started with Typescript and Deno?

Why not just following the official doc? https://deno.land/manual@v1.9.1/getting_started

One of good things about Deno is that it has golang-like opinionated/standardized workflow.

Re: Starting a TypeScript Project in 2021

#105
post #103

Earlier quoted context omitted.

I just write JavaScript? The concepts of Basecamp's Hotwire[0] are particularly simple and elegant enough for the 1% of stuff that isn't just a static page or can't be solved in a single JS function. I've never been like "boy I really need a virtual DOM" so I guess I've never really seen the appeal of React. It just seems like a bundle of complexity, obfuscation and anti-patterns. 0: https://hotwire.dev

> I just write JavaScript? This is the tell. If you are able to satisfy your business requirements with "just JavaScript" then you are in a completely different world than the people building production-grade web apps and there's absolutely nothing wrong with that. If you can be productive with "just JavaScript" then that's awesome! However, I'm sure you understand there's a massive difference between simple pages th…

> ...than the people building production-grade web apps...

Please don't co-opt the word "production" to mean what you're implying here. Production doesn't mean single-page, reactive, etc. applications, it just means "in production."

Re: Starting a TypeScript Project in 2021

#106

Ever since watching Jonathan blows talk "Preventing the collapse of civilisation", I've been mulling over things like this. It feels like we have this defacto set of commands you have to run to start a new Node/Typescript project, without much understand of what it does. Then you get complier or lint errors and then spend ages googling around for the answer that tells you to change a specific flag. This isn't a compl…

I can't even imagine how painful it must be for a curious kid to get started in programming these days. I feel so lucky to have started with a little 8-bit computer with a built-in BASIC interpreter. You turned it on and could start typing your program right away.

Re: Starting a TypeScript Project in 2021

#107

Earlier quoted context omitted.

> Is React language or a library? Does it have its own virtual machine? It's a library, but it does provide a runtime. As such it IMO makes sense that it would have it's own debugging tools. This is pretty common for complex frameworks. Other frontend frameworks like Angular and Vue do it. As do backend frameworks like Rails and Laravel. Or as another example you could look at Unity (the game framework). You can stil…

As someone who works on and fixes bugs in databases and filesystems, perhaps we don't look at things the same way.

Well, parent can find an error in a React app with a standard JS debugger, you can find an error in databases and filesystems with gdb or some such, but not vice versa.

Can be as simple as that: familiarity.

Re: Starting a TypeScript Project in 2021

#108

That is a lot of boilerplate and reliance on external tooling that could probably be a single bash or PowerShell script. My preferred approach is to let thy primary modules be thy commands. That way everything is tidy, documented, and clear for your users. Example: // module commandName is a module to parse a command, exclusion list, and options apart from other arguments of process.argv import commandName from "./li…

> probably be a single bash or PowerShell script The fact that it could be either bash or PowerShell is a primary reason why this tooling is there. Bash scripts work great (I use them) if everyone coding on the project shares an operating system. Not so much once you cross that boundary. To give a sense of the lengths the JS community goes to address these compatibility issues, consider that Yarn 2 actually implement…

But almost none of the instructions provided in the article are JavaScript. They are shell commands.

Re: Starting a TypeScript Project in 2021

#109

I’m curious about the value of eslint for TypeScript. I’ve not really found myself wanting from the coverage provided by tsc.

To be honest, I was really happy with TSLint. The amount of configuration and scaffolding around ESLint is a big turnoff from me compared to how easy it was to get TSLint going.

A lot of the most common TSLint "boxed" configurations have direct ESLint relatives at this point. For one opinionated example there is eslint-config-standard-with-typescript [1]. Using a prepared config like that is just as easy as using one built for TSLint. (It's an "extends" field that does most of the work.)

Though I admit I've kind of moved more towards even more opinionated Prettier than ESLint lately.

[1] https://www.npmjs.com/package/eslint-config-standard-with-ty...

Re: Starting a TypeScript Project in 2021

#110

esbuild sounds promising as one friction point was that the TS compiler would compile all your TS files into JS files but there was no way to bundle them together into one JS file you could include in your HTML and webpack takes a bit to setup. It looks like esbuild doesn’t have websocket auto-reload magic so will need to refresh the web browser to see the recompiled changes.

Snowpack is an option if you want a fancier auto-reload dev server oriented around ES Modules. It can use either esbuild or webpack under the covers, IIRC, for its bundling step when it comes time for that.
Post reply on HN