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

Viewed 257

I'm trying to import a self-written TypeScript-Module to a Svelte component. However, I'm receiving the following error when I try to import the Module with the following line

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

we receive the following error:

enter image description here

So we tried to define the format of the imported file by writing .ts at the end of the file name:

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

but then we received the following error:

enter image description here

Does anybody know how to solve this problem?

2 Answers

I found the problem which led to the error. I should simply have used the right Svelte template which was released by svelte.dev to be able to import TypeScript to the application. Here is the link to the instruction that helped me to fix the template I'm using: https://svelte.dev/blog/svelte-and-typescript

Related