SlideShare une entreprise Scribd logo
1  sur  20
Introduction à
Flow
Pourquoi utiliser du
typage avec
Javascript??
• Parce que Javascript…
• Le typage nous permet
• Détection plus tôt des
erreurs
• Améliorer la lisibilité du
code
• Améliorer la qualité du
code
Qu’est ce que Flow type ?
• Static type checker
Un outil d'analyse statique de JS et non un langage (tel que Typescript)
• Inférence de types
 Comprendre comme un grand quel doit être le type associé à la déclaration
Comment
typer son
code
On ajoute // @flow à
chaque fichier que l’on
souhaite ajouter du typage
On peut ajouter du type à
nos éléments ou utiliser
l’inférence.
Primitives
Literal
Fonctions
Fonctions
Functions avec optional
Function avec multiple arguments
Function Types
Flow nous informe d’erreurs faciles de JS
Maybe types
• let foo: ?string; // peut-être une string, null ou undefined
Objets et classes
Interface types
State
Import / export
Flow-typed
Repo et outil de types des librairies tierces
Tools
• React
• supporté directement et permet la suppression des propTypes
• Create-React-App (CRA) supporte Flow par défaut
• IDE
• Majors: VSCODE(en workspace)
• Nuclide (Atom)
Conclusion
Juste du typage dans JS .
Sources
• https://flow.org/en/
• https://fr.slideshare.net/andrewrota/why-statictypecheckingisbetter
• https://putaindecode.io/fr/articles/js/flow/
• https://putaindecode.io/fr/articles/js/flow/advanced-part-1/
• https://speakerdeck.com/yayoc/practical-flow-type?slide=47
• Comparaison
• https://medium.com/the-web-tub/comparing-flow-with-typescript-6a8ff7fd4cbb
• https://djcordhose.github.io/flow-vs-typescript/2016_hhjs.html#/26
• Typescript
• http://pierreterrat.com/pourquoi-typescript/

Contenu connexe

Similaire à Flowtype

Comprendre, utiliser et créer une API
Comprendre, utiliser et créer une APIComprendre, utiliser et créer une API
Comprendre, utiliser et créer une APIOlivia Reaney
 
Présentation de Robot framework
Présentation de Robot frameworkPrésentation de Robot framework
Présentation de Robot frameworkgilleslenfant
 
La Tooling API, est-ce pour moi ? Bien sûr, viens voir pourquoi !
La Tooling API, est-ce pour moi ? Bien sûr, viens voir pourquoi !La Tooling API, est-ce pour moi ? Bien sûr, viens voir pourquoi !
La Tooling API, est-ce pour moi ? Bien sûr, viens voir pourquoi !Paris Salesforce Developer Group
 
Introduction à Play Framework 2
Introduction à Play Framework 2Introduction à Play Framework 2
Introduction à Play Framework 2Samy Dindane
 
Robot Framework Introduction
Robot Framework IntroductionRobot Framework Introduction
Robot Framework Introductionlaurent bristiel
 
Introduction aux spécifications exécutables (dit aussi atdd, bdd)
Introduction aux spécifications exécutables (dit aussi atdd, bdd)Introduction aux spécifications exécutables (dit aussi atdd, bdd)
Introduction aux spécifications exécutables (dit aussi atdd, bdd)Jean-Pierre Lambert
 
Webinar "Alfresco en une heure"
Webinar "Alfresco en une heure"Webinar "Alfresco en une heure"
Webinar "Alfresco en une heure"Michael Harlaut
 
Vincent biret azure functions et flow (montreal)
Vincent biret azure functions et flow (montreal)Vincent biret azure functions et flow (montreal)
Vincent biret azure functions et flow (montreal)Vincent Biret
 
Initiation au JavaScript
Initiation au JavaScriptInitiation au JavaScript
Initiation au JavaScriptMouna Dhaouadi
 
Chap1 Introduction à python
Chap1 Introduction à pythonChap1 Introduction à python
Chap1 Introduction à pythonMariem ZAOUALI
 
GtugDakar AppEngine, Gwt
GtugDakar AppEngine, GwtGtugDakar AppEngine, Gwt
GtugDakar AppEngine, Gwthkairi
 
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...ENSIBS
 
Langage de Programmation.pdf
Langage de Programmation.pdfLangage de Programmation.pdf
Langage de Programmation.pdfAboubacarDiarra10
 

Similaire à Flowtype (16)

Comprendre, utiliser et créer une API
Comprendre, utiliser et créer une APIComprendre, utiliser et créer une API
Comprendre, utiliser et créer une API
 
Présentation de Robot framework
Présentation de Robot frameworkPrésentation de Robot framework
Présentation de Robot framework
 
La Tooling API, est-ce pour moi ? Bien sûr, viens voir pourquoi !
La Tooling API, est-ce pour moi ? Bien sûr, viens voir pourquoi !La Tooling API, est-ce pour moi ? Bien sûr, viens voir pourquoi !
La Tooling API, est-ce pour moi ? Bien sûr, viens voir pourquoi !
 
Introduction à Play Framework 2
Introduction à Play Framework 2Introduction à Play Framework 2
Introduction à Play Framework 2
 
Robot Framework Introduction
Robot Framework IntroductionRobot Framework Introduction
Robot Framework Introduction
 
Introduction aux spécifications exécutables (dit aussi atdd, bdd)
Introduction aux spécifications exécutables (dit aussi atdd, bdd)Introduction aux spécifications exécutables (dit aussi atdd, bdd)
Introduction aux spécifications exécutables (dit aussi atdd, bdd)
 
Webinar "Alfresco en une heure"
Webinar "Alfresco en une heure"Webinar "Alfresco en une heure"
Webinar "Alfresco en une heure"
 
Vincent biret azure functions et flow (montreal)
Vincent biret azure functions et flow (montreal)Vincent biret azure functions et flow (montreal)
Vincent biret azure functions et flow (montreal)
 
C#
C#C#
C#
 
Initiation au JavaScript
Initiation au JavaScriptInitiation au JavaScript
Initiation au JavaScript
 
Chap1 Introduction à python
Chap1 Introduction à pythonChap1 Introduction à python
Chap1 Introduction à python
 
Chapter1
Chapter1Chapter1
Chapter1
 
GtugDakar AppEngine, Gwt
GtugDakar AppEngine, GwtGtugDakar AppEngine, Gwt
GtugDakar AppEngine, Gwt
 
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...
 
Support cours j2_ee
Support cours j2_eeSupport cours j2_ee
Support cours j2_ee
 
Langage de Programmation.pdf
Langage de Programmation.pdfLangage de Programmation.pdf
Langage de Programmation.pdf
 

Flowtype

Notes de l'éditeur

  1. Car JS est un language à typage faible et dynamique
  2. Language faible typé
  3. Static versus dynamic = les types ne peuvent être changés en cours de route
  4. Il est fortement conseiller de typer les signatures des fonctions exposés
  5. Vous remarquerez les generics
  6. Vous remarquerez les generics