mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
Merge pull request #7976 from jvilk/fix_node_buffer
[node] Export Buffer and SlowBuffer from "buffer" module.
This commit is contained in:
@@ -16,6 +16,8 @@ import * as path from "path";
|
||||
import * as readline from "readline";
|
||||
import * as childProcess from "child_process";
|
||||
import * as os from "os";
|
||||
// Specifically test buffer module regression.
|
||||
import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer";
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
@@ -169,6 +171,14 @@ function bufferTests() {
|
||||
index = buffer.indexOf(23);
|
||||
index = buffer.indexOf(buffer);
|
||||
}
|
||||
|
||||
// Imported Buffer from buffer module works properly
|
||||
{
|
||||
let b = new ImportedBuffer('123');
|
||||
b.writeUInt8(0, 6);
|
||||
let sb = new ImportedSlowBuffer(43);
|
||||
b.writeUInt8(0, 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
3
node/node.d.ts
vendored
3
node/node.d.ts
vendored
@@ -411,6 +411,9 @@ interface NodeBuffer {
|
||||
************************************************/
|
||||
declare module "buffer" {
|
||||
export var INSPECT_MAX_BYTES: number;
|
||||
var BuffType: typeof Buffer;
|
||||
var SlowBuffType: typeof SlowBuffer;
|
||||
export { BuffType as Buffer, SlowBuffType as SlowBuffer };
|
||||
}
|
||||
|
||||
declare module "querystring" {
|
||||
|
||||
Reference in New Issue
Block a user