question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript - TypeError telegraf_inline_menu_1.default is not a constructor

See original GitHub issue

Describe the bug This might not be a bug, but i encountered the following Type error while trying to instantiate this library. Pardon my light knowledge on typescript 😃.

Error message :

TypeError: telegraf_inline_menu_1.default is not a constructor

Versions Did you updated telegraf and telegraf-inline-menu to the latest version?

  • Version of telegraf: 3.26.0
  • Version of telegraf-inline-menu: 3.5.1

To Reproduce Steps to reproduce the behavior:

  1. ts-node --project tsconfig.json src/main.ts

Expected behavior There shouldn’t be any error from the import. I have yet to start utilising the telegrah-inline-menu capability.

Screenshots If applicable, add your specific code to help explain your problem.

import Telegraf from 'telegraf'
import TelegrafInlineMenu from 'telegraf-inline-menu'
const menu = new TelegrafInlineMenu('Main Menu')

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
EdJoPaTocommented, Mar 29, 2019

Adding esModuleInterop to your config solved it for me. But I do not fully understand why that is.

https://www.typescriptlang.org/docs/handbook/compiler-options.html

0reactions
Porkecheburecommented, Jan 18, 2021

God why js is such a shit

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: *.default is not a constructor - Stack Overflow
I get the following error, when testing some javascript code, transpiled from a typescript file. Here is the ...
Read more >
TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >
Typescript Error - 'default.a is not a constructor'. #157 - GitHub
I am trying to get the json-editor alive and running with a simple Aurelia project. I can get the project to run successfully, ......
Read more >
Resolving TypeError: "X" is Not a Constructor in JavaScript
JavaScript "TypeError: "x" is not a constructor" errors occur when invalid objects or a variable is erroneously used as a constructor.
Read more >
"[Class] is not a constructor" error using JsonServiceClient
I am creating a React/Redux application using Typescript 2.1.4 and ES6 (using babel-polyfill and webpack). I get the following error when ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found