š£ A Rollup plugin which generates type definitions for Svelte Components, including Props and Events.
This plugin requires an LTS Node version (v8.0.0+) and Rollup v1.20.0+.
Using npm:
npm install rollup-plugin-svelte-types --save-dev
Create a rollup.config.js
configuration file and import the plugin:
import svelteDts from 'rollup-plugin-svelte-types';
export default {
input: 'src/entry.js',
// ...
plugins: [
svelteDts()
]
};
Then call rollup
either via the CLI or the API.
It's possible to use configure a few settings:
import svelteDts from 'rollup-plugin-svelte-types';
export default {
input: 'src/entry.js',
// ...
plugins: [
svelteDts({
libRoot: './src', // The root directory to generate the type definitions for. Defaults to './'
declarationDir: './dist/types' // The directory to place the generated definitions in. Defaults to './types'
})
]
};