Loading video...

Video Failed to Load

Go Home

Statically typed links are coming to Next.js: ◆ Autocompletion ◆ Error on invalid routes ◆ Prevents 404 links during build ◆ Dynamic, catch-all, and optional catch-all routes ◆ Works with both `pages` and `app` ◆ No extra configuration needed!

278,585 views • 3 years ago •via X (Twitter)

11 Comments

Shu's profile picture
Shu3 years ago

TypeScript error with hints if you made a typo:

Shu's profile picture
Shu3 years ago

Autocompletion for static links when editing:

Shu's profile picture
Shu3 years ago

Dynamic routes with parameters:

Shu's profile picture
Shu3 years ago

Catch-all and optional catch-all routes are supported too:

Tanner Linsley's profile picture
Tanner Linsley3 years ago

@nextjs Nice!

Fernando Rojo's profile picture
Fernando Rojo3 years ago

@nextjs can this work with custom link components too, or only those imported from next/link?

Shu's profile picture
Shu3 years ago

@nextjs (Deleted my previous reply as I got it wrong) For custom components you will have to type it with a `Route` type, imported from Next.js, instead of using `string`. And then it will just work!

Julius's profile picture
Julius3 years ago

@nextjs Very niceeee!!!

Steven Tey's profile picture
Steven Tey3 years ago

@nextjs This is a gamechanger 🤯

victor's profile picture
victor3 years ago

@nextjs Interesting — how will this work? How would Typescript know about file system? Is the dev server compiling types while using fs?

Shu's profile picture
Shu3 years ago

@nextjs Yes, type declarations will be generated by the dev server

Related Videos