Add TypeScript config for @mailpoet/components

This handles both type checking and type declaration emitting.

[MAILPOET-5015]
This commit is contained in:
Jan Jakes
2023-01-26 14:56:37 +01:00
committed by Jan Jakeš
parent 2aaf01fe11
commit 8fbe37dc4d
5 changed files with 54 additions and 19 deletions

View File

@ -1,5 +1,6 @@
import path from 'node:path';
import { default as defaultConfig } from '@wordpress/scripts/config/webpack.config.js';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import { WebpackEmitAllPlugin } from '../../../tools/webpack/webpack-emit-all-plugin.js';
const dirname = new URL('.', import.meta.url).pathname;
@ -9,6 +10,7 @@ const plugins = [
(plugin) => plugin.constructor.name !== 'DependencyExtractionWebpackPlugin',
),
new WebpackEmitAllPlugin({ context: path.join(dirname, 'src') }),
new ForkTsCheckerWebpackPlugin({ typescript: { mode: 'write-dts' } }),
];
export default {