unlock-protocol / unlock

Ʉnlock is a protocol for memberships built on a blockchain.
https://unlock-protocol.com
MIT License
839 stars 248 forks source link

Decide whether and how to use TypeScript #1449

Closed cnasc closed 5 years ago

cnasc commented 5 years ago

We need to determine if we are going to use TypeScript when we spin off the paywall app, and how we will use it if we do.

cellog commented 5 years ago

@cnasc do you want to take the reins on deciding a limited way we can test this? Or lead an experiment? Part of this will be consulting with @julien51 to determine the priority and when this should be considered

cnasc commented 5 years ago

I am 100% willing to take the reins on an experiment for this.

Here's what I propose:

  1. We get the app building with TypeScript, but don't annotate any types just yet (our JS is legal TypeScript, it just isn't type checked) a. The end result of this should be an app that works just the same as before, but with a whole boatload of errors for things that haven't been typed
  2. We prioritize modules of the code to be annotated. My personal preference on this is to start at the boundaries. The idea is that we have a sort of "ring" around the codebase. If the things on the ring boundary can be trusted, then the things inside the ring which are not checked still gain some robustness. As time goes on, we shrink the ring piece by piece until the whole app is typed.
  3. Once the whole app is typed, we can start setting lint configs to fail rather than warn on code that isn't typed or which has an any type. In fact, we can probably do this module-by-module, so that as each module gets typed, we also clamp down the rules so that no new dynamically typed code sneaks in.

To "experimentify" that, I think step 1 needs to be done in its entirety. Then we can fetch types for third-party libraries and then move to implementing some of our own code.

julien51 commented 5 years ago

@cnasc works for me. Let's focus on the unlock-app for now on this one since it probably has less moving part (despite being bigger!). Let's do 1. and reconvene before you attack 2.

cnasc commented 5 years ago

Just to confirm:

cnasc commented 5 years ago

I think at this point we have decided what the path forward is for TypeScript, and given that today I should merge TS support for both unlock-app and locksmith, I think we can close this issue.