I'm facing a challenge in importing an external JavaScript library that lacks typings or an installable package. The specific plugin I am trying to import is located at: https://github.com/amw/jpeg_camera/tree/master/dist/jpeg_camera_no_flash.js. What I aim to do is import three classes from this plugin: JpegCamera
, JpegCameraHTML5
, and Snapshot
. After following some tutorials, I managed to define the structure of these classes along with their interfaces in a separate .d.ts
file. Here's how the .d.ts file looks like:
declare module Camera {}<br>
export class JpegCamera {...}<br>
export class JpegCameraHTML5 {...}<br>
export class Snapshot {...}
My current roadblock lies in establishing a connection between the source file of the plugin (.js), my custom .d.ts file, and the TypeScript file where I intend to import these three classes. I attempted to use:
import * as X from "path/to/d.ts
but unfortunately, it didn't yield the desired outcome. Any insights would be appreciated! Thank you :)