Why the vue-shims.d.ts file can be used in typeScipt and how ts recognizes it.

in addition, why the following code can declare a .vue file.

// src/vue-shims.d.ts

declare module "*.vue" {
    import Vue from "vue";
    export default Vue;
}

because js itself has no type, the language service of ts needs .d.ts file to identify the type. Only in this way can we achieve the corresponding syntax checking and intelligent prompt. The .d.ts file written by ourselves is directly placed in the project directory, and ts will identify it by itself. There is no need for us to do anything. For more detailed information, please take a look at document

.
Menu