Live data from Hacker News

Yarn's Future – v2 and beyond

github.com

121–130 of 239 posts

Re: Yarn's Future – v2 and beyond

#121

Earlier quoted context omitted.

If you write type annotations in TS, they're stripped away. If you write type annotations in Flow, they're stripped away. There's no difference. TS has some additional features which are purely optional that don't get purely stripped out, but you're not mandated to use them.

Is there any compiler option or linter config that prevents the use of these extra features?

tslint has no-namespace and no-enum to disallow the two things that create new runtime code

Re: Yarn's Future – v2 and beyond

#122
post #118

Earlier quoted context omitted.

Do people typically prefer TypeScript over ES6?

I'd prefer Eiffel or Oberon, but almost anything is better than ES6. I just wish there was some kind of standard library movement to coincide with it, but even MS seems okay with left-pad.

ES5 is not better than ES6. So I prefer ES6 in that case.

Re: Yarn's Future – v2 and beyond

#123
post #13
post #3

There appears to be a real movement to move from Flow to typescript. Is Flow dying?

Both yarn and jest have announced they're switching to TypeScript. A corporate like Facebook would never allow that unless there was an internal shift in direction. I'd consider flow dead.

> A corporate like Facebook would never allow that unless there was an internal shift in direction.

Sure they would. Flow has nothing to do with Facebook's business strategy, or its marketing campaigns, or even its corporate strategy. I'd be surprised if anyone on VP or higher even knows what it is.

Insofar as "NIH" wins at big companies, it's when there's a business motive to promote a certain technology or FUD about what other technologies might exist.

But engineering team A deciding not to use engineering team B's tools despite working at the same company? Happens all the time.

Re: Yarn's Future – v2 and beyond

#124
post #52

The JS ecosystem has its flaws, but one has to appreciate the speed at which momentum shifts, making clear winners obvious. The move towards TypeScript 'winning' has been fast, and to everyone's benefit.

Maybe it's a benefit when moving from Flow, but personally, I would rather have JS projects spend that time adding more tests than converting to static typing. Edit: changed strong to static.

Just a nitpick, but Typescript adds static typing, not strong typing. The types are still weak because implicit type conversions still exist:

  const x = "one two" + 3;

Re: Yarn's Future – v2 and beyond

#125

Earlier quoted context omitted.

Maybe it's a benefit when moving from Flow, but personally, I would rather have JS projects spend that time adding more tests than converting to static typing. Edit: changed strong to static.

Just a nitpick, but Typescript adds static typing, not strong typing. The types are still weak because implicit type conversions still exist: const x = "one two" + 3;

I think you can make either your typescript or tslint config error out on this at compile time. I think this is configurable.

Re: Yarn's Future – v2 and beyond

#126

serious question, if you are starting a new project today why would you choose to use npm over yarn?

Because it comes standard with most node distributions and is pretty good.

It coming standard means one fewer dependency for everyone on the team to install, which is important on my current team where roughly half are backend- or mobile-only.

I like both yarn and npm, and yarn would have some benefits for us, but probably not enough to counter the extra effort onboarding other devs. npm still has some pain points, but I’ve ran into a few pain points on yarn too. And I think there being multiple projects here has helped the ecosystem.

npm is also doing some neat feature development (npm audit).

Also, the npm team is fantastic, whereas when I adopted yarn early on they dismissed the issue I opened about yarn not working for my setup. They’re a good team, but that lowered my confidence that I’d be able to get through any obstacles while using it. It’s still a fantastic tool though.)

Re: Yarn's Future – v2 and beyond

#127

serious question, if you are starting a new project today why would you choose to use npm over yarn?

Experience at the agency I worked at until a couple months ago, which had continually followed this pattern with projects started after the yarn/npm split got serious:

1) Start or inherit a project using Yarn because that's what all the cool kids are using.

2) Develop for a while, everything's fine.

3) Lose a whole day when you eventually stumble on a Yarn bug or missing feature in Yarn.

4) Angrily switch the project to NPM, solving the problem immediately.

5) Continue developing as usual.

I think this happened on like half a dozen projects after the yarn/npm split occurred, and I saw it happen as recently as Fall 2018. Developers leaned trend-chasing there, but after being burned several times even the trend-chasier ones were tepid on yarn and tended to accept that if they started with it they'd probably end up switching before long.

FWIW I don't like npm much, but I still default to it so I don't, inevitably, hit the above situation at some point. Yarn doesn't provide enough benefits to make it worth having an even less-trustworthy tool in my build process than npm already is.

[EDIT] TL;DR: We all got sick of ending up on open GH issues for Yarn when trying to track down build and, worse still, run-time problems. So we started favoring NPM again as the lower (though far from zero) headache option.

Re: Yarn's Future – v2 and beyond

#128
post #52

The JS ecosystem has its flaws, but one has to appreciate the speed at which momentum shifts, making clear winners obvious. The move towards TypeScript 'winning' has been fast, and to everyone's benefit.

> , and to everyone's benefit.

Why? I've worked on large codebases in Coffeescript, ES6 and Typescript. Whatever this whole community sings and believes, but Coffeescript still wins for me. ES6 is still trying to catch up but will probably never reach the beauty and ease of Coffeescript. Both are transpilers, only ES6 with Babel is a total horror to manage (just upgraded a large codebase to Babel 7..).

Typescript takes about 2x the time to write if you want to create all your typings properly. I hear you say; only in the beginning, later it will speed up the development process. I've never seen that in reality! I've actually never seen a proper codebase in Typescript. Show me a Typescript codebase not using the type 'any'! In a decent system language you can't get away with that, it's just a fake sense of security.

A good codebase should not be dependant at all by Typescript or whatever hype comes next. Writing a good codebase is IMHO a craft and should not depend on the language or a bunch of tooling. If Typescript is way to go, what about Python, Ruby, abandon it, deprecated? Are those inferior languages compared to Typescript? Typescript is just another hype, very smart play by Microsoft btw.

Re: Yarn's Future – v2 and beyond

#129

Earlier quoted context omitted.

Static types are a form of test!

They aren’t, and it’s detrimental to think of them that way.

Why do you think so? I think they're better than equivalent tests, and in fact help bring about better testing.

A lot of unit tests will revolve around checking types. If you don't have to runtime-check this, you can focus unit tests on semantics and integrations assuming the underlying data structures are correct.

Re: Yarn's Future – v2 and beyond

#130
post #52

The JS ecosystem has its flaws, but one has to appreciate the speed at which momentum shifts, making clear winners obvious. The move towards TypeScript 'winning' has been fast, and to everyone's benefit.

> , and to everyone's benefit. Why? I've worked on large codebases in Coffeescript, ES6 and Typescript. Whatever this whole community sings and believes, but Coffeescript still wins for me. ES6 is still trying to catch up but will probably never reach the beauty and ease of Coffeescript. Both are transpilers, only ES6 with Babel is a total horror to manage (just upgraded a large codebase to Babel 7..). Typescript tak…

We are doing backend and frontend in Typescript and have very limited 'any' usage. Mostly for some hacky library for some small isolated need.

I can the same way cast value to an Object in Java of NSObject in Swift.

Post reply on HN