## 事象 以下のようなエラーになる場合。 ```console:Svelteの場合 'ConvertHandler' is not exported by src\converter.ts, imported by src\ConvertBox.svelte ``` ```console:Vue3&Viteの場合 xxx does not provide an export named xxx ``` ## 解決方法 [[TypeScript 3.8]]でリリースされた[[Type-Only Imports and Export]]を使う必要がある。 > As we’re only transpiling, it’s not possible to import types or interfaces into your svelte component without using the new TS 3.8 type import modifier: import type { SomeInterface } from ‘./MyModule’ otherwise bundlers will complain that the name is not exported by MyModule. 以下の2点を確認する。 - `interface`ではなく`type`を使う - `import type`でimportする ```diff - import { ConvertHandler } from "./converter"; + import type { ConvertHandler } from "./converter"; ``` ## 参考 - [svelte-preprocess/docs/preprocessing.md at main · sveltejs/svelte-preprocess](https://github.com/sveltejs/svelte-preprocess/blob/main/docs/preprocessing.md#typescript---limitations)