You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you know, in TypeScript, you can define a type-checked file in a few ways:
With a .ts extension & tsconfig.json file for compiler settings
With a .js extension & tsconfig.json with allowJs: true and checkJs: true
With a .js extension & jsconfig.json with checkJs: true.
With a .js extension and // @ts-check at the top of the file
This implies that a .vue file should be interpreted in "TypeScript-mode" if any of the above are true.
However, it appears that Volar / Vue language services only initiate takeover mode if a Vue tag has <script lang="ts"> or <script setup lang="ts"> IMO this is incorrect. For instance, in my setup, jsconfig.json is defined, and set to type-check all JS. I also tried adding "include": ["./lib/**/*.vue", "./lib/**/*.js"] but this had no effect.
However, in the <template> block, it reports that dynamicSlots has a type of any. If I change the script setup to <script type="ts">, it works, but I don't think this should be necessary?
Or, is there another way to enable Vue TypeScript language services for a type-checked JS document?
The text was updated successfully, but these errors were encountered:
This! Takeover mode not working in JSDoc comments not only results in this doing nothing, but it also results in an error being displayed in my editor.
As you know, in TypeScript, you can define a type-checked file in a few ways:
.ts
extension &tsconfig.json
file for compiler settings.js
extension &tsconfig.json
withallowJs: true
andcheckJs: true
.js
extension &jsconfig.json
withcheckJs: true
..js
extension and// @ts-check
at the top of the fileThis implies that a
.vue
file should be interpreted in "TypeScript-mode" if any of the above are true.However, it appears that Volar / Vue language services only initiate takeover mode if a Vue tag has
<script lang="ts">
or<script setup lang="ts">
IMO this is incorrect. For instance, in my setup,jsconfig.json
is defined, and set to type-check all JS. I also tried adding"include": ["./lib/**/*.vue", "./lib/**/*.js"]
but this had no effect.I've defined a computed prop with JSDoc like:
However, in the
<template>
block, it reports thatdynamicSlots
has a type ofany
. If I change the script setup to<script type="ts">
, it works, but I don't think this should be necessary?Or, is there another way to enable Vue TypeScript language services for a type-checked JS document?
The text was updated successfully, but these errors were encountered: