mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add types for protocols (#37806)
This commit is contained in:
parent
0e0bf529e2
commit
0dde9f096f
14
types/protocols/index.d.ts
vendored
Normal file
14
types/protocols/index.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// Type definitions for protocols 1.4
|
||||
// Project: https://github.com/IonicaBizau/protocols
|
||||
// Definitions by: Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* @param input The input url.
|
||||
* @param first If `true`, the first protocol will be returned. If number, it will represent the zero-based index of the protocols array.
|
||||
* @returns The array of protocols or the specified protocol.
|
||||
*/
|
||||
declare function protocols(input: string, first: true | number): string;
|
||||
declare function protocols(input: string, first?: false): string[];
|
||||
|
||||
export = protocols;
|
||||
6
types/protocols/protocols-tests.ts
Normal file
6
types/protocols/protocols-tests.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import protocols = require('protocols');
|
||||
|
||||
protocols('git+ssh://git@some-host.com/and-the-path/name'); // $ExpectType string[]
|
||||
protocols('http://example.com', true); // $ExpectType string
|
||||
protocols('ftp://example.com', 1); // $ExpectType string
|
||||
protocols('https://example.com', false); // $ExpectType string[]
|
||||
23
types/protocols/tsconfig.json
Normal file
23
types/protocols/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"protocols-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/protocols/tslint.json
Normal file
1
types/protocols/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user