zxpsuper / qrcode-with-logos

A plugin for generating QR codes with a logo and styling.
https://zxpsuper.github.io/qrcode-with-logos
MIT License
137 stars 41 forks source link

Typescript definition error #9

Closed hasanmumin closed 3 years ago

hasanmumin commented 3 years ago

I think your typescript definition is not correct, here is my usage and error message.

import QrCodeWithLogo from 'qrcode-with-logos';

const qrcode = new QrCodeWithLogo({
content: "https://github.com/zxpsuper",
image: document.getElementById("logo"),
width: 470,
  logo: {
     src: "logo_round.png",
 },
});

Error message:

(alias) const QrCodeWithLogo: IQrCodeWithLogo import QrCodeWithLogo This expression is not constructable. Type 'IQrCodeWithLogo' has no construct signatures.

nweat commented 3 years ago

@hasanmumin I am having the same issue. For now, I have to explicitly declare a type like so:

const _QrCodeWithLogo: any = QrCodeWithLogo;
new _QrCodeWithLogo({...})
hasanmumin commented 3 years ago

thank you @nweat I know, I did the same thing :)

zxpsuper commented 3 years ago

I think your typescript definition is not correct, here is my usage and error message.

import QrCodeWithLogo from 'qrcode-with-logos';

const qrcode = new QrCodeWithLogo({
content: "https://github.com/zxpsuper",
image: document.getElementById("logo"),
width: 470,
  logo: {
     src: "logo_round.png",
 },
});

Error message:

(alias) const QrCodeWithLogo: IQrCodeWithLogo import QrCodeWithLogo This expression is not constructable. Type 'IQrCodeWithLogo' has no construct signatures.

It has been solved in version@1.0.3.

zxpsuper commented 3 years ago

@hasanmumin I am having the same issue. For now, I have to explicitly declare a type like so:

const _QrCodeWithLogo: any = QrCodeWithLogo;
new _QrCodeWithLogo({...})

It has been solved in version@1.0.3.

zxpsuper commented 3 years ago

It has been solved in version@1.0.3.