End to End Typesafety?

Is it even doable?

Spoiler alert : Yes*, and it is very sweet

👋🏽

I am Siddhant

🐤 @callmesiddhant 

Principles

 

1.  Use Comic Sans

 

2.  Never Use Light Theme

 

3.  Never Code in Rust

.

.

.

.

420. Don't break Stuff (specially on Prod)

- Siddhant™ 2022

Don't Break Stuff ?

1. Test your user behaviours

 

2. Add multiple points of failure.

 

3. Add static type checking 

 

//...

 

START

*USING*

TYPESCRIPT

🤺  Don't Fight it  🤺

Server

Client

End to End Typesafety ?

Type Info ?

interface UserRequest {
	name : string;
	age : number;
}

Server

Client

interface IRequestParams {
	name : string;
	age : number;
}
interface IResponseParams {
	data : UserData[]
}

What happens if backend changes some key on a critical API?

You on call btw 👆🏼

Solution?

Codegen?

https://github.com/deepmap/oapi-codegen

*Run the script eveytime anything new is added*

We can do better!

tRPC

END TO END TYPESAFETY!

Let's see a Demo!

This is just a start!

Sidenote : tRPC only works for monorepos

Important Links

 https://trpc.io/

 https://blitzjs.com/

Text

Made with Slides.com