mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
- Enables strictNullChecks - Adds options: `nothrow`, `all`, `path`, and `pathExt` - Uses function overloading to pick most specific return types based on `all` and `nothrow` options
36 lines
731 B
TypeScript
36 lines
731 B
TypeScript
|
|
import which = require("which");
|
|
|
|
which("cat", (err, path) => {
|
|
console.log(path);
|
|
});
|
|
|
|
var path = which.sync("cat");
|
|
console.log(path);
|
|
|
|
which("cat", {all: true}, (err, paths) => {
|
|
if(err) return;
|
|
if(paths) {
|
|
for(let path of paths) {
|
|
console.log(path);
|
|
}
|
|
}
|
|
});
|
|
|
|
var paths = which.sync("cat", {all: true});
|
|
for(let path of paths) {
|
|
console.log(path);
|
|
}
|
|
|
|
var paths2 = which.sync("cat", {all: true, nothrow: true});
|
|
if(paths2 !== null) {
|
|
for(let path of paths2) {
|
|
console.log(path);
|
|
}
|
|
}
|
|
|
|
var path2 = which.sync("cat", {path: 'replacement path', pathExt: 'replacement pathext'});
|
|
which("cat", {path: 'replacement path', pathExt: 'replacement pathext'}, (err, path) => {
|
|
const a: string = path!;
|
|
});
|