mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Added image-thumbnail types (#39086)
* Added image-thumbnail types * Updated types to use the generator
This commit is contained in:
parent
83185eca3d
commit
f7fb7dfada
14
types/image-thumbnail/image-thumbnail-tests.ts
Normal file
14
types/image-thumbnail/image-thumbnail-tests.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { createReadStream } from 'fs';
|
||||
import imageThumbnail = require('image-thumbnail');
|
||||
|
||||
imageThumbnail({ uri: '' }); // $ExpectType Promise<Buffer>
|
||||
imageThumbnail({ uri: '' }, { responseType: 'base64' }); // $ExpectType Promise<string>
|
||||
|
||||
imageThumbnail(''); // $ExpectType Promise<Buffer>
|
||||
imageThumbnail('', { responseType: 'base64' }); // $ExpectType Promise<string>
|
||||
|
||||
imageThumbnail(Buffer.from([])); // $ExpectType Promise<Buffer>
|
||||
imageThumbnail(Buffer.from([]), { responseType: 'base64' }); // $ExpectType Promise<string>
|
||||
|
||||
imageThumbnail(createReadStream('')); // $ExpectType Promise<Buffer>
|
||||
imageThumbnail(createReadStream(''), { responseType: 'base64' }); // $ExpectType Promise<string>
|
||||
28
types/image-thumbnail/index.d.ts
vendored
Normal file
28
types/image-thumbnail/index.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Type definitions for image-thumbnail 1.0
|
||||
// Project: https://github.com/onildoaguiar/image-thumbnail#readme
|
||||
// Definitions by: Noam Alffasy <https://github.com/noamalffasy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { ReadStream } from 'fs';
|
||||
|
||||
export = imageFunction;
|
||||
|
||||
declare function imageFunction(
|
||||
src: { uri: string } | string | Buffer | ReadStream,
|
||||
options?: { responseType: 'buffer' } & imageFunction.Options,
|
||||
): Promise<Buffer>;
|
||||
declare function imageFunction(
|
||||
src: { uri: string } | string | Buffer | ReadStream,
|
||||
options?: { responseType: 'base64' } & imageFunction.Options,
|
||||
): Promise<string>;
|
||||
|
||||
declare namespace imageFunction {
|
||||
interface Options {
|
||||
percentage?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
responseType?: string;
|
||||
}
|
||||
}
|
||||
23
types/image-thumbnail/tsconfig.json
Normal file
23
types/image-thumbnail/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"image-thumbnail-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/image-thumbnail/tslint.json
Normal file
1
types/image-thumbnail/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user