Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using static typing #347

Closed
zkochan opened this issue Sep 4, 2016 · 10 comments
Closed

Using static typing #347

zkochan opened this issue Sep 4, 2016 · 10 comments

Comments

@zkochan
Copy link
Member

zkochan commented Sep 4, 2016

I think rewriting pnpm to TypeScript would be beneficial.

  1. I remember several bugs that TypeScript would have caught automatically. For instance, this one: 84d9aa5.
  2. From a marketing perspective this would be another plus over npm/ied.
  3. For the community it would be easier to contribute to pnpm with type checking, auto-completion, hints and other awesome stuff the TypeScript provides.
@iamstarkov
Copy link
Contributor

Does pnpm have programmatic API to use?

@zkochan
Copy link
Member Author

zkochan commented Sep 4, 2016

@iamstarkov
Copy link
Contributor

than, typescript will not help raw-js consumers to validate their code anyway. and there is not run-time check as far as i know it

@iamstarkov
Copy link
Contributor

also, a lot of people will complain about implementing it in flow instead

@zkochan
Copy link
Member Author

zkochan commented Sep 4, 2016

I am not really familiar with flow, but I was under the impression that it has the same syntax as TypeScript but not as good tooling.

It will not change anything for the raw-js users but it would make the life of pnpm maintainers easier.

@zkochan
Copy link
Member Author

zkochan commented Sep 4, 2016

We can even look at it as a smarter eslint... For instance, like a month ago I changed a method called linkBins to accept only 1 argument. And only recently I noticed that in 1 place I did not update the code which was using it 7ffb692. It wasn't a bug, because the additional args were just ignored, but the code looked weird. TypeScript would've caught that

@andreypopp
Copy link
Contributor

I'm all for static typing, but I'd rather go with Flow as it has more powerful type system and thus much better chances to catch an error.

As a con for both TypeScript and Flow is that build process becomes necessary: you can't run code before transpiring it (well, you can with flow-node for example and I think something like this exists for TypeScript).

I could make a PR with such build process incorporated and some of the modules annotated with Flow to see how it feels.

@zkochan zkochan changed the title Using TypeScript Using static typing Sep 5, 2016
@iamstarkov
Copy link
Contributor

make the life of pnpm maintainers easier

thats a good point

@iamstarkov
Copy link
Contributor

I will be able to read and edit static-typed js as well, i guess.

So @zkochan, @andreypopp pick a side and go ahead =)

@zkochan
Copy link
Member Author

zkochan commented Sep 6, 2016

Well, personally I like TypeScript 2 more, but it is in beta yet and it is easier to convert an existing project to Flow. So if @andreypopp wants Flow, I don't resist.

And we can switch to TypeScript later, in case it will become superior.

zkochan added a commit that referenced this issue Sep 8, 2016
zkochan added a commit that referenced this issue Sep 8, 2016
zkochan added a commit that referenced this issue Sep 8, 2016
zkochan added a commit that referenced this issue Sep 12, 2016
zkochan added a commit that referenced this issue Sep 12, 2016
zkochan added a commit that referenced this issue Sep 12, 2016
zkochan added a commit that referenced this issue Sep 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants