Skip to content

Commit

Permalink
fix review findings
Browse files Browse the repository at this point in the history
  • Loading branch information
Flarna committed Mar 20, 2019
1 parent 669f49f commit 44797ba
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion types/node/test/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ import { readFile } from 'fs';
const teEncodeRes: Uint8Array = te.encode("TextEncoder");

// util.types
let b: Boolean;
let b: boolean;
b = util.types.isBigInt64Array(15);
b = util.types.isBigUint64Array(15);
b = util.types.isModuleNamespaceObject(15);
Expand Down
20 changes: 20 additions & 0 deletions types/node/ts3.2/node-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// tslint:disable-next-line:no-bad-reference
import "../node-tests";
import * as util from "util";

//////////////////////////////////////////////////////////
/// Global Tests : https://nodejs.org/api/global.html ///
Expand All @@ -9,3 +10,22 @@ import "../node-tests";
const hrtimeBigint: bigint = process.hrtime.bigint();
}
}

//////////////////////////////////////////////////////////
/// Util Tests ///
//////////////////////////////////////////////////////////
{
{
const value: BigInt64Array | BigUint64Array | number = [] as any;
if (util.types.isBigInt64Array(value)) {
// $ExpectType BigInt64Array
const b = value;
} else if (util.types.isBigUint64Array(value)) {
// $ExpectType BigUint64Array
const b = value;
} else {
// $ExpectType number
const b = value;
}
}
}
2 changes: 1 addition & 1 deletion types/node/util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ declare module "util" {
function isArrayBuffer(object: any): object is ArrayBuffer;
function isAsyncFunction(object: any): boolean;
function isBooleanObject(object: any): object is Boolean;
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* BigInt */);
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
function isDataView(object: any): object is DataView;
function isDate(object: any): object is Date;
function isExternal(object: any): boolean;
Expand Down
2 changes: 1 addition & 1 deletion types/node/v10/node-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ function bufferTests() {
const teEncodeRes: Uint8Array = te.encode("TextEncoder");

// util.types
let b: Boolean;
let b: boolean;
b = util.types.isBigInt64Array(15);
b = util.types.isBigUint64Array(15);
b = util.types.isModuleNamespaceObject(15);
Expand Down
20 changes: 20 additions & 0 deletions types/node/v10/ts3.2/node-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// tslint:disable-next-line:no-bad-reference
import "../node-tests";
import * as util from "util";

//////////////////////////////////////////////////////////
/// Global Tests : https://nodejs.org/api/global.html ///
Expand All @@ -9,3 +10,22 @@ import "../node-tests";
const hrtimeBigint: bigint = process.hrtime.bigint();
}
}

//////////////////////////////////////////////////////////
/// Util Tests ///
//////////////////////////////////////////////////////////
{
{
const value: BigInt64Array | BigUint64Array | number = [] as any;
if (util.types.isBigInt64Array(value)) {
// $ExpectType BigInt64Array
const b = value;
} else if (util.types.isBigUint64Array(value)) {
// $ExpectType BigUint64Array
const b = value;
} else {
// $ExpectType number
const b = value;
}
}
}
2 changes: 1 addition & 1 deletion types/node/v10/util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ declare module "util" {
function isArrayBuffer(object: any): object is ArrayBuffer;
function isAsyncFunction(object: any): boolean;
function isBooleanObject(object: any): object is Boolean;
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* BigInt */);
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);
function isDataView(object: any): object is DataView;
function isDate(object: any): object is Date;
function isExternal(object: any): boolean;
Expand Down

0 comments on commit 44797ba

Please sign in to comment.