diff --git a/types/bindings/bindings-tests.ts b/types/bindings/bindings-tests.ts new file mode 100644 index 0000000000..e66ab51353 --- /dev/null +++ b/types/bindings/bindings-tests.ts @@ -0,0 +1,4 @@ +import bindings = require('bindings'); + +// Use your bindings defined in your C files +const result = bindings('binding.node').your_c_function(); diff --git a/types/bindings/index.d.ts b/types/bindings/index.d.ts new file mode 100644 index 0000000000..9403a7a92b --- /dev/null +++ b/types/bindings/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for bindings 1.3 +// Project: https://github.com/TooTallNate/node-bindings +// Definitions by: Daniel Perez Alvarez +// 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; diff --git a/types/bindings/tsconfig.json b/types/bindings/tsconfig.json new file mode 100644 index 0000000000..fb9350642a --- /dev/null +++ b/types/bindings/tsconfig.json @@ -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" + ] +} diff --git a/types/bindings/tslint.json b/types/bindings/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/bindings/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }