Reputation: 8137
I am trying to use the hellosign-embedded module from my TypeScript application, which is then packaged using Webpack and run as part of a web page.
I've also imported the @types
typings.
The problem is that if I use:
import * as HelloSign from "hellosign-embedded";
Typescript gives me an error:
error TS2306: File 'D:/Work/ProjectX/node_modules/@types/hellosign-embedded/index.d.ts' is not a module.
I've also tried simply using:
import "hellosign-embedded";
Which gives me access to the HelloSign
global from my code, but the problem then is that after running webpack, when running it in the browser, HelloSign
is not found:
Uncaught ReferenceError: HelloSign is not defined
at HTMLDocument.<anonymous> (onboarding.tsx:10)
at mightThrow (jquery.js:3570)
at process (jquery.js:3638)
What's the proper way to import this library? Is there a problem with the typings provided?
Upvotes: 0
Views: 784
Reputation: 37403
do this it works for me :
import HelloSign = require("hellosign-embedded");
console.log(HelloSign.init);
go to the definition file : node_modules/@types/hellosign-embedded/index.d.ts
add this to the end of file :
export = HelloSign;
Upvotes: 0