SlideShare ist ein Scribd-Unternehmen logo
1 von 105
Downloaden Sie, um offline zu lesen
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/

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie Web Applications of the Future with TypeScript and GraphQL

Ähnlich wie 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
 

Mehr von Roy Derks

Mehr von 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+
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 

Web Applications of the Future with TypeScript and GraphQL