This particular project has been developed using the create-vue
tool and comes with built-in support for Typescript
.
Key versions include Vue: 3.3.4, Typescript: 5.0.4
Here is a snippet of the code to provide context:
// ComponentA.vue
<script setup lang="ts">
type ComProps = {
duration?: '0'|'0.5'|'1'|'1.5'|'2'|'2.5',
// ...
};
const props = defineProps<ComProps>();
// ComponentB.vue
<template>
<ComponentA duration="2.7" /> // this won't trigger an error
</template>
// vite.config.ts
export default defineConfig({
plugins: [
vue(),
vueJsx(),
checker({
vueTsc: true,
terminal: true
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
});
The expected outcome would be a TypeScript error due to passing an invalid prop in component A.