unplugin-json-dts

Automatically generate better typings for json files. Supports json modules

Usage no npm install needed!

<script type="module">
  import unpluginJsonDts from 'https://cdn.skypack.dev/unplugin-json-dts';
</script>

README

unplugin-json-dts

NPM version

Automatically generate better typings for json files. Supports json modules.

Comparision of before and after screenshots

Installation

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')()
  ]
}