mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Add type definitions for buffer-from
This commit is contained in:
6
types/buffer-from/buffer-from-tests.ts
Normal file
6
types/buffer-from/buffer-from-tests.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import bufferFrom = require('buffer-from');
|
||||
|
||||
bufferFrom([1, 2, 3, 4]); // $ExpectType Buffer
|
||||
bufferFrom(new Uint8Array([1, 2, 3, 4]).buffer, 1, 2); // $ExpectType Buffer
|
||||
bufferFrom('test', 'utf8'); // $ExpectType Buffer
|
||||
bufferFrom(bufferFrom('test')); // $ExpectType Buffer
|
||||
12
types/buffer-from/index.d.ts
vendored
Normal file
12
types/buffer-from/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for buffer-from 1.1
|
||||
// Project: https://github.com/LinusU/buffer-from#readme
|
||||
// Definitions by: Nat Burns <https://github.com/burnnat>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare function bufferFrom(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
||||
declare function bufferFrom(str: string, encoding?: string): Buffer;
|
||||
declare function bufferFrom(data: ReadonlyArray<any> | Buffer): Buffer;
|
||||
|
||||
export = bufferFrom;
|
||||
23
types/buffer-from/tsconfig.json
Normal file
23
types/buffer-from/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"buffer-from-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/buffer-from/tslint.json
Normal file
1
types/buffer-from/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user