mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #31493 from BendingBender/is-typedarray
[is-typedarray] Add types
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for is-typedarray 1.0
|
||||
// Project: https://github.com/hughsk/is-typedarray
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export = isTypedArray;
|
||||
|
||||
declare function isTypedArray(candidate: any): candidate is isTypedArray.TypedArray;
|
||||
|
||||
declare namespace isTypedArray {
|
||||
function strict(candidate: any): candidate is TypedArray;
|
||||
function loose(candidate: any): candidate is TypedArray;
|
||||
|
||||
type TypedArray =
|
||||
| Int8Array
|
||||
| Int16Array
|
||||
| Int32Array
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Uint16Array
|
||||
| Uint32Array
|
||||
| Float32Array
|
||||
| Float64Array
|
||||
| Buffer;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import isTypedArray = require('is-typedarray');
|
||||
|
||||
const buf: any = new Buffer(1);
|
||||
|
||||
// $ExpectType any
|
||||
buf;
|
||||
|
||||
if (isTypedArray(buf)) {
|
||||
// $ExpectType TypedArray
|
||||
buf;
|
||||
}
|
||||
if (isTypedArray.strict(buf)) {
|
||||
// $ExpectType TypedArray
|
||||
buf;
|
||||
}
|
||||
if (isTypedArray.loose(buf)) {
|
||||
// $ExpectType TypedArray
|
||||
buf;
|
||||
}
|
||||
@@ -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",
|
||||
"is-typedarray-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user