572
(page 2) 50 comments
sorted by: hot top controversial new old
[-] _hovi_@lemmy.world 8 points 1 year ago

If js docs are a good working replacement then I can understand wanting to avoid all the annoying issues with typescript. I haven't used it before but it seems less flexible and more verbose, what's other people's experience with it? I'd have to check it out myself but for the moment typescript makes JavaScript a little more bearable.

[-] dvdv@feddit.nl 9 points 1 year ago

Javascript is a standard, typescript is not. You're at their whims if they ever want to change anything, break anything etc. If typing would get introduced in JavaScript, I would be on that instantly. But for now, I'd rather not touch typescript

[-] killeronthecorner@lemmy.world 8 points 1 year ago

I wasn't sure if this meme worked until I saw what he was eating

[-] satrunalia44@lemmy.world 7 points 1 year ago

I prefer JavaScript personally, but it's time to acknowledge that TypeScript has won. If you want to contribute and succeed as a developer in the JS ecosystem, you need to learn TS, like it or not.

[-] o11c@programming.dev 6 points 1 year ago

I haven't managed to break into the JS-adjacent ecosystem, but tooling around Typescript is definitely a major part of the problem:

  • following a basic tutorial somehow ended up spending multiple seconds just to transpile and run "Hello, World!".
  • there are at least 3 different ways of specifying the files and settings you want to use, and some of them will cause others to be ignored entirely, even though it looks like they should be used.
  • embracing duck typing means many common type errors simply cannot be caught. Also that means dynamic type checks are impossible, even though JS itself supports them (admittedly with oddities, e.g. with string vs String).
  • there are at least 3 incompatible ways to define and use a "module", and it's not clear what's actually useful or intended to be used, or what the outputs are supposed to be for different environments.

At this point I'm seriously considering writing my own sanelanguage-to-JS transpiler or using some other one (maybe Haxe? but I'm not sure its object model allows full performance tweaking), because I've written literally dozens of other languages without this kind of pain.

WASM has its own problems (we shouldn't be quick to call asm.js obsolete ... also, C's object model is not what people think it is) but that's another story.


At this point, I'd be happy with some basic code reuse. Have a "generalized fibonacci" module taking 3 inputs, and call it 3 ways: from a web browser on the client side, as a web browser request to server (which is running nodejs), or as a nodejs command-line program. Transpiling one of the callers should not force the others to be transpiled, but if multiple of the callers need to be transpiled at once, it should not typecheck the library internals multiple times. I should also be able to choose whether to produce a "dynamic" library (which can be recompiled later without recompiling the dependencies) or a "static" one (only output a single merged file), and whether to minify.

I'm not sure the TS ecosystem is competent enough to deal with this.

load more comments (1 replies)
[-] sj_zero@lotide.fbxl.net 6 points 1 year ago
load more comments (1 replies)
[-] asyncrosaurus@programming.dev 6 points 1 year ago

Javascript.

Because my exposure to Typescript is wading through over-engineered and bloated Angular front ends that could easily (and should) be thrown out and re-written in html/ js.

But also because I exclusively write simple shit that doesn't have a build step for the front end, because 90% of the stuff I make gains no benefit from needlessly overly complex front ends.

load more comments (1 replies)
[-] KSPAtlas@sopuli.xyz 6 points 1 year ago

"In own my lane"

[-] karmiclychee@sh.itjust.works 6 points 1 year ago

I've always felt it doesn't solve the problem people think it's solving.

[-] ShortFuse@lemmy.world 6 points 1 year ago* (last edited 1 year ago)

I've been writing my own render framework and component library for about a year now.

One thing I enjoy most about it is that the types are automatically inferred. There's a lot of Typescript wrangling going on, and it gets really deep into what TS is capable of and barely capable of (polymorphic this, dynamic return types based on input, Class type reconstruction, mixins that influence both static and instance properties, event listeners based on event name, typed property watchers based on property name).

It's all written in JavaScript with "JSDocs". It's not really JSDocs because there's a lot of recursion that's not possible with regular JSDocs. It's TS type information slipped into JSDoc comments.

Ridiculously complex core Class

But that is to setup the ability to tap into inferred types. The actual code that's written (eg: components) is fully typed check with little or no type declaration.

Declarative-style component with almost no explicit typing

The reality is, no complex piece of code should be written without some form of type checking. TS isn't perfect and if there were something better, I'd move. Alliances are stupid. There are problems with some things that have not been, and likely will never be, fixed. But what type-checkers should do best is infer types dynamically.

The result means all my code today just runs in the browser. I don't have to wrangle builders or compilers (bye Webpack!). At most, I use just esbuild to minify, though it's an optional step, not a mandatory one. If I want to mess around on Codepen with my library, I can refer to a git commit directly and load the file. I don't need npm to package and release. (CodePen Sample)

[-] Ddhuud@lemmy.world 4 points 1 year ago

I'm with the guy sitting at the table

[-] vox@sopuli.xyz 4 points 1 year ago

I don't like blocated crap, so vanilla js es6 is the way

[-] ChaoticNeutralCzech@feddit.de 4 points 1 year ago

I’ll be downvoted again but I agree.

[-] dbilitated@aussie.zone 6 points 1 year ago

if you're a beginner, and you post an opinion and lots of people say that many years of professional experience make them disagree with you, why would you not take that on board? I wish you well on your learning journey. at some point you'll outgrow vanilla js and you'll have learned enough to configure transpilation and webpack etc. it'll be a good day.

[-] parrot-party@kbin.social 6 points 1 year ago

The fact that you're doubling down on your ignorance is quite problematic. Typescript is not an enterprise system that forms arcane JS. It's literally JS with a slight adjustment that allows you to say "also this is this type". You write JS the entire time and can "disable" the typescript at any location you need to not be typed.

load more comments (4 replies)
load more comments
view more: ‹ prev next ›
this post was submitted on 08 Sep 2023
572 points (100.0% liked)

Programmer Humor

20703 readers
1348 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS