Skip to content

📒 Test project, which shows major differences between: FlowType and TypeScript

Notifications You must be signed in to change notification settings

piecioshka/test-flowtype-vs-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

test-flowtype-vs-typescript

📒 Test project, which shows major differences between: FlowType and TypeScript

Why?

A couple of days ago, I read comments in a blog post http://michalzalecki.com/typescript-vs-flow/ and decided to run tests to show the major differences between FlowType and TypeScript.

Source

  1. FlowType source file.

    /* @flow */
    
    'use strict';
    
    function Person(name: string) {
        this.name = name;
    }
    
    module.exports = Person;
  2. TypeScript source file

    'use strict';
    
    class Person {
        private name: string;
    
        constructor(name: string) {
            this.name = name;
        }
    }
    
    export default Person;
  3. After compilation when I run the line

    new Person(123);
  • in the FlowType strategy I got an error

    Hello BDD! Runtime error occur! 😎

  • following the TypeScript way nothing happens ...

    Eh... no runtime errors? Why? 😱

How to run?

npm run build   # build basic scaffold
npm test        # trigger unit tests!

Conclusions

FlowType was created to keep proper type during runtime (life application)

TypeScript was created to keep proper type during translation process.

License

The MIT License @ 2016

About

📒 Test project, which shows major differences between: FlowType and TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published