DEV Community

Discussion on: Building a Vue 3 component with Typescript

Collapse
 
vutran6853 profile image
Vu Tran • Edited

I don't understand. You are writing TS in script tag. But I don't see you are using TS inside your setup function. You can write this without add typescript and just use setup(). So what is this blog about?

Collapse
 
lmillucci profile image
Lorenzo Millucci

It is a very very simple example, it's true that I'm not using any specific Typescript code inside the setup function but I could have use it because the project is configured to transpile typescript.
This article was about configuring the environment to create a very easy component to try composition API through Typescript. It's clear that you can easily remove all the TS setup and go with the vanilla JS ;)

PS: if I had used only JS I would have defined a the component with export default { setup(){} } and not with export default defineComponent({ .. })

Collapse
 
vutran6853 profile image
Vu Tran

I see. Thank you for clearly that up for me. Good reading too.