This track runs TypeScript in the browser before your code executes. You can annotate setup() return types, props, and refs for safer refactors—patterns that carry directly into Vite + <script setup lang="ts"> projects.
Typing refs
const count = ref<number>(0);
const user = ref<{ name: string } | null>(null);
Props in options API style
Use props: { id: { type: Number, required: true } } in the playground; in SFCs you would use defineProps<{ id: number }>().
Emit typing
Declare emits as string arrays or typed tuples in build tools. Here, annotate setup context manually when needed.
Self-check
- Why type nullable refs as
T | null? - What does the playground strip from your source before run?