'How to add types for generated vue 3 components lib (TypeScript, Composition API)

How I Can add types for generated via rollup lib of components? I get this error: TS7016 Could not find a declaration file for module… implicitly has an ‘any’ type. Rollup.config.js

import peerDepsExternal from "rollup-plugin-peer-deps-external";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "rollup-plugin-typescript2";
import ts, {ScriptTarget} from "rollup-plugin-ts";
import vue from "rollup-plugin-vue";
import clear from 'rollup-plugin-clear';

export default async function config(args) {
  return {
    input: 'src/index.ts',
    output: [
      {
        format: 'esm',
        file: 'dist/library.mjs',
        sourcemap: true,
      },
      {
        format: 'cjs',
        file: 'dist/library.js',
        sourcemap: true
      }
    ],
    plugins: [
      peerDepsExternal(), 
      resolve(), 
      commonjs(), 
      ts({
        allowSyntheticDefaultImports: true,
        allowJs: true
      }), 
      vue(), 
      clear({
        targets: ['./dist'],
      })
    ]
  };
}

Result: ./dist. Components: ./dist/library.d.ts



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source