Automatically generate better typings for json files. Supports json modules.
npm i unplugin-json-dts -D
Vite
// vite.config.ts
import jsonDts from 'unplugin-json-dts/vite'
export default defineConfig({
plugins: [
jsonDts(),
],
})
Rollup
// rollup.config.js
import jsonDts from 'unplugin-json-dts/rollup'
export default {
plugins: [
jsonDts(),
],
}
Webpack
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-json-dts/webpack')()
]
}