diff --git a/types/chenfengyuan__vue-qrcode/chenfengyuan__vue-qrcode-tests.ts b/types/chenfengyuan__vue-qrcode/chenfengyuan__vue-qrcode-tests.ts new file mode 100644 index 0000000000..7bb84364f6 --- /dev/null +++ b/types/chenfengyuan__vue-qrcode/chenfengyuan__vue-qrcode-tests.ts @@ -0,0 +1,10 @@ +import Vue from 'vue'; +import VueQrCode from '@chenfengyuan/vue-qrcode'; + +new Vue({ + el: '#app', + components: { + VueQrCode, + }, + template: `` +}); diff --git a/types/chenfengyuan__vue-qrcode/index.d.ts b/types/chenfengyuan__vue-qrcode/index.d.ts new file mode 100644 index 0000000000..d3cab3a6c0 --- /dev/null +++ b/types/chenfengyuan__vue-qrcode/index.d.ts @@ -0,0 +1,50 @@ +// Type definitions for @chenfengyuan/vue-qrcode 1.0 +// Project: https://github.com/fengyuanchen/vue-qrcode +// Definitions by: gaoming13 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.9 +import { VueConstructor } from 'vue'; + +declare const VueQrCode: QrCodeConstructor; +export = VueQrCode; + +interface QrCodePorps { + // The value of the QR code. + value: string | null; + // The options for the QR code generator. + options: { + // QR Code version. + version?: number; + // Error correction level. + errorCorrectionLevel?: 'low' | 'medium' | 'quartile' | 'high' | 'L' | 'M' | 'Q' | 'H'; + // Mask pattern used to mask the symbol. + maskPattern?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; + // Define how much wide the quiet zone should be. + margin?: number; + // Scale factor. + scale?: number; + // Forces a specific width for the output image. + width?: number; + color?: { + dark?: string; + light?: string; + } + }; + // The tag name of the component's root element. + tag: string; +} + +interface QrCodeWatch { + $props: (val: any) => void; +} + +interface QrCodeMethods { + // Generate QR code. + generate: () => void; +} + +interface QrCodeConstructor extends VueConstructor { + props: QrCodePorps; + watch: QrCodeWatch; + methods: QrCodeMethods; +} diff --git a/types/chenfengyuan__vue-qrcode/package.json b/types/chenfengyuan__vue-qrcode/package.json new file mode 100644 index 0000000000..faefc1b2f7 --- /dev/null +++ b/types/chenfengyuan__vue-qrcode/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "vue": ">=2.0.0" + } +} diff --git a/types/chenfengyuan__vue-qrcode/tsconfig.json b/types/chenfengyuan__vue-qrcode/tsconfig.json new file mode 100644 index 0000000000..73b2f2030c --- /dev/null +++ b/types/chenfengyuan__vue-qrcode/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "esModuleInterop": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "@chenfengyuan/vue-qrcode": ["chenfengyuan__vue-qrcode"] + } + }, + "files": [ + "index.d.ts", + "chenfengyuan__vue-qrcode-tests.ts" + ] +} diff --git a/types/chenfengyuan__vue-qrcode/tslint.json b/types/chenfengyuan__vue-qrcode/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chenfengyuan__vue-qrcode/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }