mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
Merge pull request #31686 from BendingBender/remote-origin-url
[remote-origin-url] Add types
This commit is contained in:
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for remote-origin-url 2.0
|
||||
// Project: https://github.com/jonschlinkert/remote-origin-url
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = remoteOriginUrl;
|
||||
|
||||
declare function remoteOriginUrl(
|
||||
options?: string | remoteOriginUrl.Options
|
||||
): Promise<string | undefined>;
|
||||
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<string | undefined>;
|
||||
function sync(options?: string | Options): string | undefined;
|
||||
|
||||
interface Options {
|
||||
path?: string;
|
||||
}
|
||||
|
||||
type Callback = (error: Error | null, url?: string) => void;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import origin = require('remote-origin-url');
|
||||
|
||||
origin(); // $ExpectType Promise<string | undefined>
|
||||
origin('foo'); // $ExpectType Promise<string | undefined>
|
||||
origin({ path: 'foo' }); // $ExpectType Promise<string | undefined>
|
||||
// $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<string | undefined>
|
||||
origin.promise('foo'); // $ExpectType Promise<string | undefined>
|
||||
origin.promise({ path: 'foo' }); // $ExpectType Promise<string | undefined>
|
||||
|
||||
origin.sync(); // $ExpectType string | undefined
|
||||
origin.sync('foo'); // $ExpectType string | undefined
|
||||
origin.sync({ path: 'foo' }); // $ExpectType string | undefined
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user