Closed
Description
Before you start, please make sure to:
- Read the doc
- Have tried the latest version
- Search to see if your issue already exists
- Look for / ask questions on Stack Overflow
- Reproduce the bug in incognito/private mode to avoid interference from browser extensions
Link to minimal reproduction
None
Steps to reproduce
- Install JSON Editor Vue in a Vue 3 & TypeScript app:
npm i json-editor-vue vanilla-jsoneditor
- Try importing it as so:
<script setup lang="ts"> import JsonEditorVue from 'json-editor-vue'; </script>
What is expected?
I expected this to work:
<template>
<JsonEditorVue v-model="modelValue" />
</template>
<script setup lang="ts">
import { ref } from 'vue';
import JsonEditorVue from 'json-editor-vue';
interface Props {
modelValue: any;
}
const props = defineProps<Props>();
const modelValue = ref(props.modelValue);
</script>
What is actually happening?
Instead I got this error:
Could not find a declaration file for module 'json-editor-vue'. '/workspace/node_modules/json-editor-vue/dist/json-editor-vue.umd.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/json-editor-vue` if it exists or add a new declaration (.d.ts) file containing `declare module 'json-editor-vue';`ts(7016)
System Info
System:
OS: Linux 5.15 Alpine Linux
CPU: (4) x64 12th Gen Intel(R) Core(TM) i5-12400
Memory: 1.73 GB / 5.80 GB
Container: Yes
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.20.1 - /usr/bin/node
npm: 7.24.2 - /workspace/node_modules/.bin/npm
npmPackages:
@fortawesome/fontawesome-free: ^6.4.0 => 6.4.0
@fortawesome/fontawesome-svg-core: ^6.4.0 => 6.4.0
@fortawesome/free-brands-svg-icons: ^6.4.0 => 6.4.0
@fortawesome/free-regular-svg-icons: ^6.4.0 => 6.4.0
@fortawesome/free-solid-svg-icons: ^6.4.0 => 6.4.2
@fortawesome/vue-fontawesome: ^3.0.3 => 3.0.3
@fullcalendar/core: ^6.1.8 => 6.1.8
@fullcalendar/daygrid: ^6.1.8 => 6.1.8
@fullcalendar/interaction: ^6.1.8 => 6.1.8
@fullcalendar/vue3: ^6.1.8 => 6.1.8
@h-hg/docsify-image-caption: ^0.1.2 => 0.1.2
@jamescoyle/vue-icon: ^0.1.2 => 0.1.2
@markbattistella/docsify-sidebarfooter: ^4.0.0 => 4.0.0
@mdi/font: ^7.0.96 => 7.2.96
@mdi/js: ^7.2.96 => 7.2.96
@rodrigogs/mysql-events: ^0.6.0 => 0.6.0
@shopify/draggable: ^1.0.0-beta.12 => 1.0.0-beta.12
@ttskch/select2-bootstrap4-theme: ^1.5.2 => 1.5.2
@types/leaflet.fullscreen: ^1.6.1 => 1.6.1
@types/lodash: ^4.14.197 => 4.14.197
@vitejs/plugin-vue: ^4.2.3 => 4.2.3
@vue-leaflet/vue-leaflet: ^0.9.0 => 0.9.0
@vue/test-utils: ^2.4.0 => 2.4.0
@vueuse/core: ^10.1.0 => 10.1.2
accounting-js: ^1.1.1 => 1.1.1
animate.css: ^4.1.1 => 4.1.1
apexcharts: ^3.35.3 => 3.41.0
autobahn-browser: ^20.9.2 => 20.9.2
axios: ^0.21.1 => 0.19.2
bootbox: ^5.5.2 => 5.5.3
bootstrap: ^4.6.2 => 4.6.2
bootstrap-fileinput: ^5.1.5 => 5.5.2
bootstrap-slider: ^11.0.2 => 11.0.2
bootstrap4-datetimepicker: ^5.2.3 => 5.2.3
clipboard: ^2.0.6 => 2.0.11
cross-env: ^7.0 => 7.0.3
cssmin: ^0.4.3 => 0.4.3
currency.js: ^2.0.4 => 2.0.4
cz-conventional-changelog: ^3.3.0 => 3.3.0
datatables.net-bs4: ^1.10.23 => 1.13.4
datatables.net-buttons-bs4: ^1.6.5 => 1.7.1
datatables.net-colreorder-bs4: ^1.5.3 => 1.6.2
datatables.net-fixedcolumns-bs4: ^3.3.2 => 3.3.3
datatables.net-fixedheader-bs4: ^3.1.8 => 3.3.2
datatables.net-responsive-bs4: ^2.2.7 => 2.4.1
datatables.net-rowgroup-bs4: ^1.1.2 => 1.3.1
datatables.net-rowreorder-bs4: ^1.2.7 => 1.3.3
daterangepicker: ^3.1.0 => 3.1.0
dayjs: ^1.8.36 => 1.11.8
docsify: ^4.13.0 => 4.13.0
docsify-copy-code: ^2.1.1 => 2.1.1
docsify-drawio: ^1.0.6 => 1.0.7
docsify-plugin-flexible-alerts: ^1.1.1 => 1.1.1
docsify-updated: ^1.0.5 => 1.0.5
domurl: ^2.3.4 => 2.3.4
easytimer.js: ^4.3.4 => 4.5.4
echarts: ^5.1.2 => 5.4.2
emails-input: ^1.0.0 => 1.0.0
excellentexport: ^3.9.6 => 3.9.6
express: ^4.17.1 => 4.18.2
faker: ^5.5.3 => 5.5.3
fullcalendar: ^5.9.0 => 5.11.5
gasparesganga-jquery-loading-overlay: ^2.1.7 => 2.1.7
glyphicons-only-bootstrap: ^1.0.1 => 1.0.1
heatmap.js: ^2.0.5 => 2.0.5
html-to-image: ^1.9.0 => 1.11.11
html2canvas: ^1.4.1 => 1.4.1
jquery: ^3.6.0 => 3.7.0
jquery-confirm: ^3.3.4 => 3.3.4
jquery-sortablejs: ^1.0.1 => 1.0.1
jquery.json-viewer: ^1.4.0 => 1.5.0
jquery.redirect: ^1.1.4 => 1.2.0
jsbarcode: ^3.11.5 => 3.11.5
jsdom: ^22.1.0 => 22.1.0
json-editor-vue: ^0.10.15 => 0.10.15
jspdf: ^2.5.1 => 2.5.1
jspdf-autotable: ^3.5.31 => 3.5.31
jszip: ^3.6.0 => 3.10.1
laravel-mix: ^6.0.49 => 6.0.49
laravel-mix-eslint: ^0.2.0 => 0.2.0
latest-version: ^5.1.0 => 5.1.0
leaflet: ^1.9.3 => 1.9.4
leaflet-extra-markers: ^1.2.1 => 1.2.2
leaflet-heatmap: ^1.0.0 => 1.0.0
leaflet-layervisibility: * => 0.1.0post1
leaflet-rotatedmarker: ^0.2.0 => 0.2.0
leaflet.fullscreen: ^2.4.0 => 2.4.0
leaflet.heat: ^0.2.0 => 0.2.0
leaflet.marker.slideto: ^0.2.0 => 0.2.0
lodash: ^4.17.19 => 4.17.21
lodash-es: ^4.17.21 => 4.17.21
mburger-css: ^1.3.3 => 1.3.3
mmenu-js: ^8.5.24 => 8.5.24
moment: ^2.29.4 => 2.29.4
moment-with-locales-es6: ^1.0.1 => 1.0.1
nodemon: ^2.0.12 => 2.0.22
noty: ^3.2.0-beta-deprecated => 3.2.0-beta-deprecated
npm: ^7.11.1 => 7.24.2
pdfmake: ^0.1.71 => 0.1.72
pm2: ^5.1.2 => 5.3.0
prettier: ^3.0.3 => 3.0.3
primeflex: ^3.3.0 => 3.3.1
primeicons: ^6.0.1 => 6.0.1
primevue: ^3.27.0 => 3.29.2
prismjs: ^1.29.0 => 1.29.0
pusher-js: ^7.0.3 => 7.6.0
redom: ^3.27.1 => 3.29.1
resolve-url-loader: ^2.3.1 => 2.3.2
sass: ^1.20.1 => 1.63.2
sass-loader: ^8.0.0 => 8.0.2
screenfull: ^5.1.0 => 5.2.0
select2: ^4.0.13 => 4.0.13
select2-bootstrap4-theme: ^1.0.0 => 1.0.0
smartwizard: ^5.1.1 => v5.1.1
socket.io: ^4.2.0 => 4.6.2
socket.io-client: ^4.2.0 => 2.4.0
sortablejs: ^1.13.0 => 1.15.0
sql-events-listener: ^1.0.0 => 1.0.0
tf-vue-leaflet-heatmap: ^1.0.0 => 1.0.0
ts-loader: ^9.4.4 => 9.4.4
tui-calendar: ^1.13.0 => 1.15.3
tui-dom: ^3.0.0 => 3.0.0
typescript: ^5.2.2 => 5.2.2
uglify-js: ^3.13.4 => 3.17.4
uglify-js-es6: ^2.8.9 => 2.8.9
url-template: ^3.1.0 => 3.1.0
vanilla-jsoneditor: ^0.18.3 => 0.18.3
viewerjs: ^1.9.2 => 1.11.3
vitest: ^0.33.0 => 0.33.0
vue: ^3.2.47 => 3.3.4
vue-axios: ^3.5.2 => 3.5.2
vue-cli: ^2.9.6 => 2.9.6
vue-loader: ^16.8.3 => 16.8.3
vue-sse: ^2.5.2 => 2.5.2
vue2-leaflet-hotline: ^1.0.1 => 1.0.1
vue3-apexcharts: ^1.4.1 => 1.4.1
vuetify: ^3.2.4 => 3.3.3
Package Manager
npm
Any additional comments?
I managed to make it work by adding the following code in the shims-vue.d.ts
file in the root folder of my app:
declare module 'json-editor-vue' {
import { Component } from 'json-editor-vue/dist/src/Component';
export default Component;
}
Am I missing something? Shouldn't it have worked without having to do all that?
Metadata
Metadata
Assignees
Labels
No labels