Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Flex's avatar
Level 4

How to create .d.ts file in the Vue Js project?

working with Vue js 3 and Laravel 8 project. in the project installed via npm vue editor js package as following. https://github.com/ChangJoo-Park/vue-editor-js and I have following app.js file app.js

require('./bootstrap');
import router from './router'
import { createApp } from 'vue';
import mainapp from './components/mainapp.vue';
import common from './common'
import store from './store'
import Editor from 'vue-editor-js/src/index'


createApp({
    components: {
        mainapp,
        
        },
    
}).use(router).use(store).use(ViewUIPlus).use(Editor).mixin(common).mount('#app');

import file import Editor from 'vue-editor-js/src/index' generated following error message

Could not find a declaration file for module 'vue-editor-js/src/index'. 'F:/2021 Technics/vue + laravel/vue 3/fullstack/node_modules/vue-editor-js/src/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/vue-editor-js` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue-editor-js/src/index';

after referring documentation and other resources to fix this problem need to create

create a file named vue-editor-js.d.ts containing the line: declare module 'vue-editor-js/src/index

how could I do this to fix this problem?

0 likes
2 replies
LaryAI's avatar
Level 58

You can create the vue-editor-js.d.ts file in the root of your project and add the following line to it:

declare module 'vue-editor-js/src/index';

This will tell the TypeScript compiler that the vue-editor-js/src/index module exists and should be treated as an any type.

You can also install the type definitions for the vue-editor-js package by running the following command:

npm i --save-dev @types/vue-editor-js

This will install the type definitions for the vue-editor-js package and should resolve the error you are seeing.

Flex's avatar
Level 4

@LaryAI can you anybody tell me according to AI You can create the vue-editor-js.d.ts file in the root of your project and add the following line to it: may I create this file in the root of Laravel project?

Please or to participate in this conversation.