SlideShare una empresa de Scribd logo
1 de 105
Descargar para leer sin conexión
Web applications of the future
with TypeScript and GraphQL
Who is this for?
@gethackteam
@gethackteam
@gethackteam
That’s why you need
type systems! ✅ ❌
@gethackteam
A little bit about
myself first…
@gethackteam
Roy Derks
@gethackteam
What do you already know
about TypeScript? .
@gethackteam
TypeScript is a typed superset of
JavaScript
@gethackteam
That compiles to plain
JavaScript
And uses the latest ECMAScript
features
@gethackteam
superset. [′sü·pər‚set] (computer science)
A programming language that contains all
the features of a given language and has
been expanded or enhanced to include
other features as well.
- the internet
@gethackteam
superset. [′sü·pər‚set] (computer science)
A programming language that contains all
the features of a given language and has
been expanded or enhanced to include
other features as well.
- the internet
@gethackteam
@gethackteam
function with one
parameter
This will also run in
TypeScript
@gethackteam
@gethackteam
But not in “strict” mode
@gethackteam
As TypeScript has optional
static type checking
@gethackteam
@gethackteam
@gethackteam
Enable all strict type-
checking options
This will also run in
TypeScript
@gethackteam
This will also run in
TypeScript
@gethackteam
@gethackteam
@gethackteam
Will give a compile
error
Compile error?
@gethackteam
TypeScript is a typed superset of
JavaScript
@gethackteam
That compiles to plain
JavaScript
And uses the latest ECMAScript
features
@gethackteam
Compiler
@gethackteam
@gethackteam
Define how it’s compiled to
JavaScript
@gethackteam
Define how it’s compiled to
JavaScript
@gethackteam
@gethackteam
Compiles to ES5
So it can run in the browser
@gethackteam
@gethackteam
Back to compile errors
@gethackteam
@gethackteam
@gethackteam
Enable all strict type-
checking options
@gethackteam
Compile errors
@gethackteam
Compile errors
No type defined for ‘array’ and ‘item’
@gethackteam
@gethackteam
No type defined for ‘array’
and ‘item’
So you’d need to define types
@gethackteam
@gethackteam
@gethackteam
If you’re lazy,
just add ‘any’
But why use TypeScript then?
@gethackteam
Let's add some types
@gethackteam
@gethackteam
@gethackteam
Also, there’s some inference
There are multiple ways to
define types
@gethackteam
@gethackteam
@gethackteam
TypeScript is a typed superset of
JavaScript
@gethackteam
That compiles to plain
JavaScript
And uses the latest ECMAScript
features
@gethackteam
JavaScript that scales 🚀
@gethackteam
Want to learn more about
TypeScript?
@gethackteam
@gethackteam
https://www.typescriptlang.org/docs/
@gethackteam
https://www.typescriptlang.org/docs/
You know what else has types?
@gethackteam
You know what else has types?
GraphQL!
@gethackteam
@gethackteam
If you aren’t familiar with
GraphQL .
GraphQL is a query language for
APIs
@gethackteam
That offers a single endpoint for
multiple resources
And is based on a type system
@gethackteam
@gethackteam
Ask what you need, get exactly that
GraphQL is a query language for
APIs
@gethackteam
That offers a single endpoint for
multiple resources
And is based on a type system
@gethackteam
@gethackteam
Define nested relationships
GraphQL is a query language for
APIs
@gethackteam
That offers a single endpoint for
multiple resources
And is based on a type system
@gethackteam
Type system
@gethackteam
Type system
And they aren’t too different
@gethackteam
@gethackteam
@gethackteam
Both have basic “scalar” types
@gethackteam
@gethackteam
Can relate to other types
@gethackteam
@gethackteam
And have required/optional flags
@gethackteam
Let’s look at a GraphQL Server
@gethackteam
http://bit.ly/32HRSJG
GraphQL server
with Apollo
@gethackteam
So how can we combine
TypeScript and GraphQL?
@gethackteam
By using
@gethackteam
A CLI tool that generates
TypeScript types from a
GraphQL schema.
@gethackteam
Remember both the type
definitions?
@gethackteam
@gethackteam
The GraphQL schema is used to
generate TypeScript types
@gethackteam
@gethackteam
Generate TypeScript types
@gethackteam
How does this work?
@gethackteam
GraphQL Code Generator
@gethackteam
GraphQL Code Generator
Use a wizard to setup
@gethackteam
Or define your own settings
@gethackteam
GraphQL Code Generator
@gethackteam
GraphQL Code Generator
Generates TypeScript types
@gethackteam
@gethackteam
Generate TypeScript types
@gethackteam
@gethackteam
@gethackteam
Map basic TypeScript types
to scalar types of GraphQL
@gethackteam
@gethackteam
Keep relation to
non-scalar types
Opens the door to end-to-end
type safety
@gethackteam
And you can automatically
generate Apollo components
@gethackteam
So should I start converting to
TypeScript right away? 🧐
@gethackteam
@gethackteam
But definitely start using a
type system!!
@gethackteam
Want to learn more?
Search: Roy Derks@gethackteam
https://www.typescriptlang.org/docs/
https://graphql.org/learn/
https://graphql-code-generator.com/

Más contenido relacionado

La actualidad más candente

The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
Sashko Stubailo
 
Reactive Programming
Reactive ProgrammingReactive Programming
Reactive Programming
Zhentian Wan
 

La actualidad más candente (20)

GraphQL is new sexy
GraphQL is new sexyGraphQL is new sexy
GraphQL is new sexy
 
CD in Machine Learning Systems
CD in Machine Learning SystemsCD in Machine Learning Systems
CD in Machine Learning Systems
 
The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
 
TypeScript and SharePoint Framework
TypeScript and SharePoint FrameworkTypeScript and SharePoint Framework
TypeScript and SharePoint Framework
 
Seminar globalize3 - DungNV
Seminar globalize3 - DungNVSeminar globalize3 - DungNV
Seminar globalize3 - DungNV
 
Add ClassyShark to your Android toolbox
Add ClassyShark to your Android toolboxAdd ClassyShark to your Android toolbox
Add ClassyShark to your Android toolbox
 
This Week in Neo4j - 15th December 2018
This Week in Neo4j - 15th December 2018This Week in Neo4j - 15th December 2018
This Week in Neo4j - 15th December 2018
 
API Publishers Series, Part 1: Introduction to Documentation
API Publishers Series, Part 1: Introduction to DocumentationAPI Publishers Series, Part 1: Introduction to Documentation
API Publishers Series, Part 1: Introduction to Documentation
 
Reactive Programming
Reactive ProgrammingReactive Programming
Reactive Programming
 
Serving ML easily with FastAPI - meme version
Serving ML easily with FastAPI - meme versionServing ML easily with FastAPI - meme version
Serving ML easily with FastAPI - meme version
 
Scala vs. Python: Which Language Should be learned in 2020
Scala vs. Python: Which Language Should be learned in 2020Scala vs. Python: Which Language Should be learned in 2020
Scala vs. Python: Which Language Should be learned in 2020
 
WebNano - Ideas for Web Frameworks
WebNano - Ideas for Web FrameworksWebNano - Ideas for Web Frameworks
WebNano - Ideas for Web Frameworks
 
Angular Vienna - Use React tools for better Angular apps
Angular Vienna - Use React tools for better Angular appsAngular Vienna - Use React tools for better Angular apps
Angular Vienna - Use React tools for better Angular apps
 
Matlab Assignment Experts Research Help
Matlab Assignment Experts Research HelpMatlab Assignment Experts Research Help
Matlab Assignment Experts Research Help
 
Fly me to the moon
Fly me to the moonFly me to the moon
Fly me to the moon
 
Insprint automation, build the culture
Insprint automation, build the cultureInsprint automation, build the culture
Insprint automation, build the culture
 
Expressing the Context - A Functional Way
Expressing the Context - A Functional WayExpressing the Context - A Functional Way
Expressing the Context - A Functional Way
 
Help with Matlab Assignment Research Help
Help with Matlab Assignment Research HelpHelp with Matlab Assignment Research Help
Help with Matlab Assignment Research Help
 
Introduction to lambda behave
Introduction to lambda behaveIntroduction to lambda behave
Introduction to lambda behave
 
5 levels of api test automation
5 levels of api test automation5 levels of api test automation
5 levels of api test automation
 

Similar a Web Applications of the Future with TypeScript and GraphQL

Similar a Web Applications of the Future with TypeScript and GraphQL (20)

Web Applications of the Future: GraphQL and TypeScript | React Alicante
Web Applications of the Future: GraphQL and TypeScript | React AlicanteWeb Applications of the Future: GraphQL and TypeScript | React Alicante
Web Applications of the Future: GraphQL and TypeScript | React Alicante
 
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Testing GraphQL in Your JavaScript Application: From Zero to Hundred PercentTesting GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
 
Wrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQLWrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQL
 
GraphQL Without a Database | Frontend Developer Love
GraphQL Without a Database | Frontend Developer LoveGraphQL Without a Database | Frontend Developer Love
GraphQL Without a Database | Frontend Developer Love
 
Machine Learning and Python For Marketing Automation | MKGO October 2019 | Ru...
Machine Learning and Python For Marketing Automation | MKGO October 2019 | Ru...Machine Learning and Python For Marketing Automation | MKGO October 2019 | Ru...
Machine Learning and Python For Marketing Automation | MKGO October 2019 | Ru...
 
GraphQL-ify your APIs - Devoxx UK 2021
 GraphQL-ify your APIs - Devoxx UK 2021 GraphQL-ify your APIs - Devoxx UK 2021
GraphQL-ify your APIs - Devoxx UK 2021
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Hands On - GraphQL
Hands On - GraphQLHands On - GraphQL
Hands On - GraphQL
 
Javascript
JavascriptJavascript
Javascript
 
Scenic City Summit 2018 - TypeScript 101
Scenic City Summit 2018 - TypeScript 101Scenic City Summit 2018 - TypeScript 101
Scenic City Summit 2018 - TypeScript 101
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHP
 
A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
A Deep Dive Into SEO Tactics For Modern Javascript FrameworksA Deep Dive Into SEO Tactics For Modern Javascript Frameworks
A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
 
Pentesting GraphQL Applications For Fun and Profit - Pranav Hivarekar
Pentesting GraphQL Applications For Fun and Profit - Pranav HivarekarPentesting GraphQL Applications For Fun and Profit - Pranav Hivarekar
Pentesting GraphQL Applications For Fun and Profit - Pranav Hivarekar
 
Elixir absinthe-basics
Elixir absinthe-basicsElixir absinthe-basics
Elixir absinthe-basics
 
Scaling your GraphQL applications with Dgraph
Scaling your GraphQL applications with DgraphScaling your GraphQL applications with Dgraph
Scaling your GraphQL applications with Dgraph
 
TypeScript: JavaScript that scales (Kostas Stergiou) - GreeceJS #22
TypeScript: JavaScript that scales (Kostas Stergiou) - GreeceJS #22TypeScript: JavaScript that scales (Kostas Stergiou) - GreeceJS #22
TypeScript: JavaScript that scales (Kostas Stergiou) - GreeceJS #22
 
GraphQL-ify your APIs
GraphQL-ify your APIsGraphQL-ify your APIs
GraphQL-ify your APIs
 
Why GraphQL is Perfect for Node.js Microservices - IJS London 2022
Why GraphQL is Perfect for Node.js Microservices - IJS London 2022Why GraphQL is Perfect for Node.js Microservices - IJS London 2022
Why GraphQL is Perfect for Node.js Microservices - IJS London 2022
 
PHP, the GraphQL ecosystem and GraphQLite
PHP, the GraphQL ecosystem and GraphQLitePHP, the GraphQL ecosystem and GraphQLite
PHP, the GraphQL ecosystem and GraphQLite
 
Why GraphQL Is Perfect For Microservices - CityJS London 2022
Why GraphQL Is Perfect For Microservices - CityJS London 2022Why GraphQL Is Perfect For Microservices - CityJS London 2022
Why GraphQL Is Perfect For Microservices - CityJS London 2022
 

Más de Roy Derks

Más de Roy Derks (10)

Workshop State-management in React with Context and Hooks
Workshop State-management in React with Context and HooksWorkshop State-management in React with Context and Hooks
Workshop State-management in React with Context and Hooks
 
GraphQL Authentication
GraphQL AuthenticationGraphQL Authentication
GraphQL Authentication
 
Open-sourcing JavaScript at the City of Amsterdam - All Things Open 2019
Open-sourcing JavaScript at the City of Amsterdam - All Things Open 2019Open-sourcing JavaScript at the City of Amsterdam - All Things Open 2019
Open-sourcing JavaScript at the City of Amsterdam - All Things Open 2019
 
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy DerksWe Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
 
JNation: REST APIs to GraphQL with Express and Apollo
JNation: REST APIs to GraphQL with Express and ApolloJNation: REST APIs to GraphQL with Express and Apollo
JNation: REST APIs to GraphQL with Express and Apollo
 
Handling Large-Scale State-Management with React Context and Hooks
Handling Large-Scale State-Management with React Context and HooksHandling Large-Scale State-Management with React Context and Hooks
Handling Large-Scale State-Management with React Context and Hooks
 
Using ReasonML For Your Next JavaScript Project
Using ReasonML For Your Next JavaScript ProjectUsing ReasonML For Your Next JavaScript Project
Using ReasonML For Your Next JavaScript Project
 
Boilerplates Are The New Copy-Paste
Boilerplates Are The New Copy-PasteBoilerplates Are The New Copy-Paste
Boilerplates Are The New Copy-Paste
 
GraphQL Will Do To REST What JSON Did To XML
GraphQL Will Do To REST What JSON Did To XMLGraphQL Will Do To REST What JSON Did To XML
GraphQL Will Do To REST What JSON Did To XML
 
Workshop JavaScript ES6+
Workshop JavaScript ES6+Workshop JavaScript ES6+
Workshop JavaScript ES6+
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Web Applications of the Future with TypeScript and GraphQL