From 04dca3a08177dbcba2afc53323d38316698b360a Mon Sep 17 00:00:00 2001 From: York Yao Date: Fri, 2 Feb 2018 11:06:22 +0800 Subject: [PATCH] add types of upng-js (#23357) * add types of upng-js * Update index.d.ts * Update upng-js-tests.ts * Update index.d.ts * Update index.d.ts --- types/upng-js/index.d.ts | 20 ++++++++++++++++++++ types/upng-js/tsconfig.json | 23 +++++++++++++++++++++++ types/upng-js/tslint.json | 1 + types/upng-js/upng-js-tests.ts | 5 +++++ 4 files changed, 49 insertions(+) create mode 100644 types/upng-js/index.d.ts create mode 100644 types/upng-js/tsconfig.json create mode 100644 types/upng-js/tslint.json create mode 100644 types/upng-js/upng-js-tests.ts 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);