neocotic / qrious

Pure JavaScript library for QR code generation using canvas
https://neocotic.com/qrious
Other
1.55k stars 216 forks source link

Add typescript support #101

Open FrankiePo opened 7 years ago

FrankiePo commented 7 years ago

Currently, there is no *.d.ts files to support Typescript. Can be done by "Should I Use The typings Field In package.json?"

chrillewoodz commented 7 years ago

Please implement this.

dougludlow commented 6 years ago

Was just using this library. Here's what I threw together real quick, it can probably be expanded on:

interface QRiousStatic {
    new(options?: QRiousOptions): QRiousStatic;
    toDataURL(mime?: string): string;
}

type CorrectionLevel = 'L' | 'M' | 'Q' | 'H';

interface QRiousOptions {
    background?: string;
    backgroundAlpha?: number;
    foreground?: string,
    foregroundAlpha?: number,
    level?: CorrectionLevel;
    padding?: number,
    size?: number,
    value?: string
}

declare module "qrious" {
    export = QRious;
}

declare var QRious: QRiousStatic
nayuki commented 6 years ago

My QR Code generator library has a native port in TypeScript. Have a look at https://github.com/nayuki/QR-Code-generator/tree/master/typescript

giovanni-bertoncelli commented 1 year ago

@neocotic anything on this?