DefinitelyTyped/types/tcp-ping/tcp-ping-tests.ts
Ryan Murthick 56c1e21df1
fix(tcp-ping): Fix incorrect typings for probe method (#43653)
* fix(tcp-ping): Fix incorrect typings for probe method

* > revert version bump in comment
2020-04-06 11:19:23 -07:00

31 lines
459 B
TypeScript

import * as tp from 'tcp-ping';
// $ExpectType void
tp.ping({}, (err, result) => {
// $ExpectType Result
result;
// $ExpectType Results[]
result.results;
});
// $ExpectError
tp.ping();
// $ExpectError
tp.ping({});
// $ExpectType void
tp.probe("localhost", 8080, (err, result) => {
// $ExpectType boolean
result;
});
// $ExpectError
tp.probe("localhost", 8080);
// $ExpectError
tp.probe("localhost");
// $ExpectError
tp.probe();