feat: add definitions for gzip-size v4

This commit is contained in:
Jimi van der Woning
2017-11-13 11:19:45 +01:00
parent bf47dab3b5
commit bd4e79efd4
5 changed files with 62 additions and 5 deletions

View File

@@ -1,13 +1,19 @@
// Type definitions for gzip-size 3.0
// Type definitions for gzip-size 4.0
// Project: https://github.com/sindresorhus/gzip-size
// Definitions by: York Yao <https://github.com/plantain-00>
// Jimi van der Woning <https://github.com/jimivdw>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare function gzipSize(input: string | Buffer, callback: (error: Error, size: number) => void): string;
export = gzipSize;
import * as stream from 'stream';
import * as zlib from 'zlib';
declare function gzipSize(input: string | Buffer, options?: zlib.ZlibOptions): Promise<number>;
declare namespace gzipSize {
function sync(input: string | Buffer): number;
function stream(): NodeJS.ReadWriteStream;
function sync(input: string | Buffer, options?: zlib.ZlibOptions): number;
function stream(options?: zlib.ZlibOptions): stream.PassThrough;
}
export = gzipSize;

View File

@@ -0,0 +1,7 @@
import gzipSize = require('gzip-size');
const string = 'Lorem ipsum dolor sit amet.';
console.log(string.length);
console.log(gzipSize.sync(string));

13
types/gzip-size/v3/index.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
// Type definitions for gzip-size 3.0
// Project: https://github.com/sindresorhus/gzip-size
// Definitions by: York Yao <https://github.com/plantain-00>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare function gzipSize(input: string | Buffer, callback: (error: Error, size: number) => void): string;
export = gzipSize;
declare namespace gzipSize {
function sync(input: string | Buffer): number;
function stream(): NodeJS.ReadWriteStream;
}

View File

@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"paths": {
"gzip-size": [
"gzip-size/v3"
]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"gzip-size-tests.ts"
]
}

View File

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