正在加载视频...
视频加载失败
Type safety without writing the types yourself? This is now possible for all methods and variables with special meaning to SvelteKit!
85,413 次观看 • 3 年前 •via X (Twitter)
10 条评论

This all started with @shuding_ sharing his work of auto-typings for Next.js. It got us inspired to see what this could look like for SvelteKit. I prototyped this and we immediately felt an improvement in productivity and DX.

While this is super convenient, this isn't just about that. It's also about correctness: I forgot or got some types mixed up more than once - the computer never will.

This is in line with Svelte's major insight that by writing code in a declarative way we can get the machine to do the bulk of the work for us, correctly and efficiently.

Check out the blog post for more info:

As usual, you and your team's work is incredible and appreciated!

Hyped!!! I guess that we have some homework to do over the weekend now 😅 +page.gql 😉

One of the things I love about @nuxt_js 3 💚

This is amazing! Great work 🎉 Would be perfect to have typescript syntax working on template as well for full type-safety everywhere in Svelte. Fingers crossed!

wait wait wait wait wait. How in the world does that export validation work 👀👀

It's part of the typescript plugin. It looks at the TS AST to check the top level exports and adds a custom error message if there's an invalid one


