TypeError: print_js_1.default is not a function
See original GitHub issueWhen 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:
- Created 4 years ago
- Reactions:2
- Comments:14 (13 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
just use
Yes. The actual
printJS
function is exported here: https://github.com/crabbly/Print.js/blob/master/src/index.js#L10But 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