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
This commit is contained in:
York Yao
2018-02-02 11:06:22 +08:00
committed by Mohamed Hegazy
parent faf57355e1
commit 04dca3a081
4 changed files with 49 additions and 0 deletions

20
types/upng-js/index.d.ts vendored Normal file
View File

@@ -0,0 +1,20 @@
// Type definitions for upng-js 2.1
// Project: https://github.com/photopea/UPNG.js
// Definitions by: York Yao <https://github.com/plantain-00>
// 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;
}

View File

@@ -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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -0,0 +1,5 @@
import * as UPNG from 'upng-js';
declare const buff: ArrayBuffer;
const img = UPNG.decode(buff);
const rgba = UPNG.toRGBA8(img);