mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Update types for public-ip to v2.4
This commit is contained in:
10
types/public-ip/index.d.ts
vendored
10
types/public-ip/index.d.ts
vendored
@@ -1,12 +1,16 @@
|
||||
// Type definitions for public-ip 2.3
|
||||
// Type definitions for public-ip 2.4
|
||||
// Project: https://github.com/sindresorhus/public-ip#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function v4(options?: Options): Promise<string>;
|
||||
export function v6(options?: Options): Promise<string>;
|
||||
export function v4(options?: Options): CancelablePromise<string>;
|
||||
export function v6(options?: Options): CancelablePromise<string>;
|
||||
|
||||
export interface Options {
|
||||
https?: boolean;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
export type CancelablePromise<T> = Promise<T> & {
|
||||
cancel(): void;
|
||||
};
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import * as publicIp from 'public-ip';
|
||||
|
||||
let str: string;
|
||||
publicIp.v4().then(ip => {
|
||||
str = ip;
|
||||
ip; // $ExpectType string
|
||||
});
|
||||
publicIp.v4({https: false, timeout: 10}).then(ip => {
|
||||
str = ip;
|
||||
publicIp.v4({ https: false, timeout: 10 }).then(ip => {
|
||||
ip; // $ExpectType string
|
||||
});
|
||||
publicIp.v4().cancel();
|
||||
|
||||
publicIp.v6().then(ip => {
|
||||
str = ip;
|
||||
ip; // $ExpectType string
|
||||
});
|
||||
publicIp.v6({https: false, timeout: 10}).then(ip => {
|
||||
str = ip;
|
||||
publicIp.v6({ https: false, timeout: 10 }).then(ip => {
|
||||
ip; // $ExpectType string
|
||||
});
|
||||
publicIp.v6().cancel();
|
||||
|
||||
Reference in New Issue
Block a user