Right now I've a little issue with a Node.js package -- Telegraf, a bot framework -- when trying to create a typing for it in TypeScript. The package itself has the following export:
module.exports = Object.assign(Telegraf, {
Composer,
Extra,
Markup,
Router,
Telegram,
session
})
The TS import:
import * as Telegraf from 'telegraf';
But, when trying to access it, I've the following object as Telegraf:
{ Composer: [Function: Composer],
Extra: { [Function: Extra] Markup: [Function: Markup] },
Markup: [Function: Markup],
Router: [Function: Router],
Telegram: [Function: Telegram],
session: [Function],
default:
{ [Function: Telegraf]
Composer: [Function: Composer],
Extra: { [Function: Extra] Markup: [Function: Markup] },
Markup: [Function: Markup],
Router: [Function: Router],
Telegram: [Function: Telegram],
session: [Function] } }
My doubt is: How can I access the [Function: Telegraf] in Telegraf.default?
Note
You might ask "Why he wants to access this expecific property?". It's because I've to emulate the following Node.js in TS:
const Telegraf = require('telegraf');
const bot = new Telegraf(process.env.BOT_TOKEN);
More about Telegraf in: http://telegraf.js.org/#/