正在加载视频...

视频加载失败

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 次观看 • 3 年前 •via X (Twitter)

11 条评论

Shu 的头像
Shu3 年前

TypeScript error with hints if you made a typo:

Shu 的头像
Shu3 年前

Autocompletion for static links when editing:

Shu 的头像
Shu3 年前

Dynamic routes with parameters:

Shu 的头像
Shu3 年前

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

Tanner Linsley 的头像
Tanner Linsley3 年前

@nextjs Nice!

Fernando Rojo 的头像
Fernando Rojo3 年前

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

Shu 的头像
Shu3 年前

@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 的头像
Julius3 年前

@nextjs Very niceeee!!!

Steven Tey 的头像
Steven Tey3 年前

@nextjs This is a gamechanger 🤯

victor 的头像
victor3 年前

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

Shu 的头像
Shu3 年前

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

相关视频