diff --git a/types/remote-origin-url/index.d.ts b/types/remote-origin-url/index.d.ts new file mode 100644 index 0000000000..1e1554b945 --- /dev/null +++ b/types/remote-origin-url/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for remote-origin-url 2.0 +// Project: https://github.com/jonschlinkert/remote-origin-url +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = remoteOriginUrl; + +declare function remoteOriginUrl( + options?: string | remoteOriginUrl.Options +): Promise; +declare function remoteOriginUrl(callback: remoteOriginUrl.Callback): void; +declare function remoteOriginUrl( + options: string | remoteOriginUrl.Options, + callback: remoteOriginUrl.Callback +): void; + +declare namespace remoteOriginUrl { + function promise(options?: string | Options): Promise; + function sync(options?: string | Options): string | undefined; + + interface Options { + path?: string; + } + + type Callback = (error: Error | null, url?: string) => void; +} diff --git a/types/remote-origin-url/remote-origin-url-tests.ts b/types/remote-origin-url/remote-origin-url-tests.ts new file mode 100644 index 0000000000..abd18a5fc4 --- /dev/null +++ b/types/remote-origin-url/remote-origin-url-tests.ts @@ -0,0 +1,23 @@ +import origin = require('remote-origin-url'); + +origin(); // $ExpectType Promise +origin('foo'); // $ExpectType Promise +origin({ path: 'foo' }); // $ExpectType Promise +// $ExpectType void +origin((err, url) => { + err; // $ExpectType Error | null + url; // $ExpectType string | undefined +}); +// $ExpectType void +origin({ path: 'foo' }, (err, url) => { + err; // $ExpectType Error | null + url; // $ExpectType string | undefined +}); + +origin.promise(); // $ExpectType Promise +origin.promise('foo'); // $ExpectType Promise +origin.promise({ path: 'foo' }); // $ExpectType Promise + +origin.sync(); // $ExpectType string | undefined +origin.sync('foo'); // $ExpectType string | undefined +origin.sync({ path: 'foo' }); // $ExpectType string | undefined diff --git a/types/remote-origin-url/tsconfig.json b/types/remote-origin-url/tsconfig.json new file mode 100644 index 0000000000..41dea0ad86 --- /dev/null +++ b/types/remote-origin-url/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", + "remote-origin-url-tests.ts" + ] +} diff --git a/types/remote-origin-url/tslint.json b/types/remote-origin-url/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/remote-origin-url/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }