Merge pull request #21629 from urish/beats

[beats] Add typings
This commit is contained in:
Benjamin Lichtman
2017-11-21 12:05:20 -08:00
committed by GitHub
4 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import beats = require('beats');
const bins: beats.Bin[] = [
{ lo: 0, hi: 512, threshold: 0, decay: 0.005 },
{ lo: 512, hi: 1024, threshold: 0, decay: 0.005 },
];
const detect = beats(bins, 1);
const frequencies = new Uint8Array(1024);
const result = detect(frequencies);

17
types/beats/index.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
// Type definitions for beats 0.0
// Project: https://github.com/hughsk/beats/
// Definitions by: Uri Shaked <https://github.com/urish>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = beats;
declare function beats(bins: ReadonlyArray<beats.Bin>, minSeparation?: number): (frequencies: Uint8Array | Float32Array | ReadonlyArray<number>, dt?: number) => Float32Array;
declare namespace beats {
interface Bin {
lo: number;
hi: number;
threshold: number;
decay: number;
}
}

23
types/beats/tsconfig.json Normal file
View 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",
"beats-tests.ts"
]
}

1
types/beats/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }