[chmodr] add typings

This commit is contained in:
Dimitri Benin 2017-08-24 16:38:07 +02:00
parent cc1e320ed6
commit 09b8a3e046
4 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,14 @@
import chmodr = require('chmodr');
import { URL } from 'url';
chmodr('', '', err => {
err; // $ExpectType ErrnoException
});
chmodr(new Buffer(''), '', () => {});
chmodr(new URL(''), '', () => {});
chmodr(new URL(''), 1, () => {});
chmodr.sync('', '');
chmodr.sync(new Buffer(''), '');
chmodr.sync(new URL(''), '');
chmodr.sync(new URL(''), 1);

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

@ -0,0 +1,17 @@
// Type definitions for chmodr 1.0
// Project: https://github.com/isaacs/chmodr#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { URL } from 'url';
export = chmodr;
declare function chmodr(path: chmodr.PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void;
declare namespace chmodr {
function sync(path: PathLike, mode: string | number): void;
type PathLike = string | Buffer | URL;
}

View File

@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"chmodr-tests.ts"
]
}

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

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