element-plus / element-plus-nuxt-starter

🌰 A starter example for element-plus with Nuxt 3.
https://element-plus-nuxt.vercel.app
MIT License
299 stars 83 forks source link

About `typescript` question? Does this need to be installed again? #48

Closed RSS1102 closed 2 years ago

RSS1102 commented 2 years ago

Does this need to be installed again?

  1. It says "nuxt 3 is fully typed and provides helpful shortcuts to ensure you have access to accurate type information when you are coding".https://v3.nuxtjs.org/guide/concepts/typescript

2.I do not install typescript, but I still have type verification. image image

YunYouJun commented 2 years ago

You should write it like this let name: string | number = '123'.

By the way, String shoud be 'string'.

RSS1102 commented 2 years ago

You should write it like this let name: string | number = '123'.

By the way, String shoud be 'string'.

OK,This is my mistake. My main question is to ask the difference between installing typescriptand not.

The above figure is just to prove that I have not installed typescript, and I can still make type judgment. I don't quite understand the difference between whether to install or not.(To determine if I want to install typescriptas well) thanks.

YunYouJun commented 2 years ago

If you install typescript, you can control the version of typescript.

If you do not install it, it will invoke global typescript or a version of typescript invoked by another package.

If you don't want typescript type check, write it like this:

<script setup>
// just remove lang="ts" in script
</script>
RSS1102 commented 2 years ago

ok,Thank you very much for your answer.