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.

TypeError: print_js_1.default is not a function

See original GitHub issue

When used with webpack and typescript getting the error mentioned on title. Transpiled code appears to be like this:

...
print_js_1.default({
   printable: url,
   type: "pdf",
...

And it works fine when bundled without libraryExport: 'default' config.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
buazizcommented, May 27, 2019

just use

import * as printJs from 'print-js'
0reactions
crabblycommented, May 21, 2019

Yes. The actual printJS function is exported here: https://github.com/crabbly/Print.js/blob/master/src/index.js#L10

But in the interface, I don’t know if it matches. https://github.com/crabbly/Print.js/blob/master/src/index.d.ts#L41 Again, I don’t know much about Typescript yet, therefore, relying heavily on your guys to get this properly setup in the library.

The idea is to support es6 module import in the TypeScript interface, so that this wouldn’t create an undefined error:

import printJS from 'print-js'

Thanks again for all the help.

Here is a codesandbox showing the es6 import working fine without TypeScript: https://codesandbox.io/s/x2yrj0kwww

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: (0 , dayjs_1.default) is not a function - Stack Overflow
It was working on my previous app, but I don't know why do I get this error for my new application? node.js ·...
Read more >
is not a function or its return value is not iterable in ReactJs ...
TypeError : react__WEBPACK_IMPORTED_MODULE_0_default is not a function or its return value is not iterable 1 | import useState from 'react'; ...
Read more >
Ravenous Part 4 TypeError: default.search is not a function
Deploying my final ravenous project yields this issue: TypeError: util_Yelp__WEBPACK_IMPORTED_MODULE_5_.default.search is not a function.
Read more >
typeerror: (0 , express_1.default) is not a function - You.com
Test suite failed to run TypeError: (0 , express_1.default) is not a function export default function makeApp() { const app: Application = express();....
Read more >
(0 , import_defineToJSON.default) is not a function - Bugs
When trying to import '@8base/auth' to a Vite+Vue 3 project, the following error is trigger by the import statement. Uncaught TypeError: (0 ...
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