- I have strings, booleans, objects, numbers, arrays… what more do you need?
- Trusting what the code does, trusting what the team does.
- Transpiler checks: TypeScript and Flow\
- Both have type definitions that must be published for dependencies
- What other advantages do we get from using types?
- (Paul) Failing faster
- (Paul) Fail faster during TDD. (Mat - You can also possibly eliminate some tests by encoding meaning with types)
- (Paul) Your future self won’t hate your present self (encode more meaning.)
- (Paul) “Help Me (IDE) Help You” … IDE integrations, TS LS refactoring
- (Paul) Less tests needed as whole chunks are “safe”
- (Mat) Safe assumptions made by tools/code generators (Types enable Tools)
- Why would someone not want to use a tool?
- An upfront time investment is required
- Some gaps with full DOM API
- How do we decide between them?
- (Mat) Gettings teams up-to-speed (good or bad depending on team background)
- (Paulo) Nowadays is easy for one to decide for TS, because its huge adoption and community + more types libraries types available.
- (Paulo) For simple static type check, flow would be better option.
- (Mat) TS alternative would be //ts-check and/or tsdoc
- (Paulo) In the past, Type Inference using Flow was better, but it looks like is not anymore.
- (Mat) Edge case - Flow can type nested React components, TS cannot
- Big win - generating types from graphql :)
- What is the “cost” of using these tools?
- (David) Making a small, seemingly innocuous change can trigger a Flow massacre; can take hours to fix.
- (Paul) You have to think first. Writing down the shape of your props, or state, or whatever can be irritating.
- (Mat) Getting teams up to speed - upfront cost for learning/training - downstream benefits guarding against large codebase regression
- (Paul) You’re almost guaranteed to have build-tool-version pain, or @types skew pain, etc.
- (Paulo) When working with flow, you don't feel like writing another language, even though TS is a super set of JS, but it can scare away beginners.
- TS lock you down to a new ecosystem, where in flow you still can use your old babel.