diff --git a/types/upng-js/index.d.ts b/types/upng-js/index.d.ts new file mode 100644 index 0000000000..a6b31f54a6 --- /dev/null +++ b/types/upng-js/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for upng-js 2.1 +// Project: https://github.com/photopea/UPNG.js +// Definitions by: York Yao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function decode(buff: ArrayBuffer): PngData; + +export function encode(bufs: ArrayBuffer, width: number, height: number, ps?: number, dels?: any[]): ArrayBuffer; + +export function toRGBA8(out: PngData): ArrayBuffer; + +export interface PngData { + width: number; + height: number; + depth: number; + ctype: any; + frames: any; + tabs: any; + data: ArrayBuffer; +} diff --git a/types/upng-js/tsconfig.json b/types/upng-js/tsconfig.json new file mode 100644 index 0000000000..e6499c55f2 --- /dev/null +++ b/types/upng-js/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "upng-js-tests.ts" + ] +} diff --git a/types/upng-js/tslint.json b/types/upng-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/upng-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/upng-js/upng-js-tests.ts b/types/upng-js/upng-js-tests.ts new file mode 100644 index 0000000000..4b0823baa0 --- /dev/null +++ b/types/upng-js/upng-js-tests.ts @@ -0,0 +1,5 @@ +import * as UPNG from 'upng-js'; + +declare const buff: ArrayBuffer; +const img = UPNG.decode(buff); +const rgba = UPNG.toRGBA8(img);