Why am I encountering this error message:
TypeError: node_telegram_bot_api_1.default is not a constructor
This is the TypeScript code snippet I have written:
import * as dotenv from 'dotenv';
dotenv.config({ path: __dirname + '/.env'})
console.log('Hello TypeScript')
import TelegramBot from 'node-telegram-bot-api';
const bot = new TelegramBot(process.env.BOT_TOKEN, {polling: true});
Upon compiling, here is how my code output looks like:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const dotenv = require("dotenv");
dotenv.config({ path: __dirname + '/.env' });
console.log('Hello TypeScript');
const node_telegram_bot_api_1 = require("node-telegram-bot-api");
const bot = new node_telegram_bot_api_1.default(process.env.BOT_TOKEN, { polling: true });