mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
48 lines
990 B
TypeScript
48 lines
990 B
TypeScript
import fs = require("fs");
|
|
import grasp = require("grasp");
|
|
|
|
grasp(); // $ExpectError
|
|
grasp({ args: [] }); // $ExpectType void
|
|
|
|
// $ExpectType void
|
|
grasp({
|
|
args: [],
|
|
error: console.error,
|
|
callback: console.log,
|
|
exit: process.exit,
|
|
console,
|
|
stdin: process.stdin,
|
|
fs,
|
|
input: "foo bar"
|
|
});
|
|
|
|
// $ExpectError
|
|
grasp({ args: [], textFormat: { cyan: "cyan" } });
|
|
|
|
// $ExpectType string
|
|
grasp.VERSION;
|
|
|
|
const fooquery = grasp.search("fooquery"); // $ExpectError
|
|
const equery = grasp.search("equery");
|
|
const squery = grasp.search("squery");
|
|
|
|
// $ExpectType Node[]
|
|
grasp.search("equery", "pattern", "input");
|
|
|
|
// $ExpectType Node[]
|
|
equery("pattern")("input");
|
|
|
|
// $ExpectType (input: string) => Node[]
|
|
squery("pattern");
|
|
|
|
const replacer = grasp.replace("equery", "pattern");
|
|
|
|
// $ExpectType string
|
|
replacer("replacement", "input");
|
|
|
|
// $ExpectType string
|
|
replacer((getRaw, node, query, named) => {
|
|
getRaw(node); // $ExpectType string
|
|
return "foo";
|
|
}, "input");
|