Typing end to end with TypeScript
Tricks and tooling for web applications typing with TypeScript.
Why using TypeScript?
- less bugs
- autocompletion
- security
- type checks
- better abstractions
Still some issues
What about managing IOs ?
- API interface
- database IOs
- user inputs
- routing parameters
- configuration/environment
OpenAPI
Syncing API documentation with the code:
GraphQL
Tie TypeScript types with GraphQL schemas:
Others
Did you heard about tRPC?
JSONSchema
Only JSON inputs?
-
generate types from JSONSchema using schema2dts
and validate with AJV,
-
create schemas and types altogether with TypeBox.
What about clients?
Applications and back-ends may use your API too:
- type casting using generics,
- generate sdk from OpenAPI,
- type GraphQL queries using graphql-codegen,
again.
User inputs
Typing React forms entries with useForm.
Routing parameters
Let's manage NextJS query/path parameters!
Configuration/Environment
Use global types