Add types for bindings 1.3

This commit is contained in:
Daniel Perez Alvarez 2017-12-10 15:46:18 -08:00
parent 85c17c4f49
commit d3f02a9035
No known key found for this signature in database
GPG Key ID: D36F1EE02B396949
4 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,4 @@
import bindings = require('bindings');
// Use your bindings defined in your C files
const result = bindings('binding.node').your_c_function();

13
types/bindings/index.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
// Type definitions for bindings 1.3
// Project: https://github.com/TooTallNate/node-bindings
// Definitions by: Daniel Perez Alvarez <https://github.com/unindented>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* The main `bindings()` function loads the compiled bindings for a given module.
* It uses V8's Error API to determine the parent filename that this function is
* being invoked from, which is then used to find the root directory.
*/
declare function bindings(mod: string): any;
export = bindings;

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",
"bindings-tests.ts"
]
}

View File

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