将自己编写的 TypeScript 模块导入到 Svelte 组件时出错

An error by importing self-written TypeScript modules to a Svelte component

我正在尝试将自己编写的 TypeScript 模块导入 Svelte 组件。但是,当我尝试使用以下行导入模块时收到以下错误

import {TelegramBotForSafetyMania} from '../telegram_bot';

我们收到以下错误:

所以我们尝试通过在文件名末尾写.ts来定义导入文件的格式:

import {TelegramBotForSafetyMania} from '../telegram_bot.ts';

但随后我们收到以下错误:

有人知道如何解决这个问题吗?

你可以尝试在 ...distancecalculator 之后添加 .ts 吗?

另见用法示例中的 import 语句: https://deno.land/x/distancecalculator@v1.1.4#usage-example-for-your-code

我找到了导致错误的问题。我应该简单地使用 svelte.dev 发布的正确的 Svelte 模板,以便能够将 TypeScript 导入应用程序。 这是帮助我修复我正在使用的模板的说明的 link: https://svelte.dev/blog/svelte-and-typescript