diff --git a/types/clear/clear-tests.ts b/types/clear/clear-tests.ts new file mode 100644 index 0000000000..55da4fc890 --- /dev/null +++ b/types/clear/clear-tests.ts @@ -0,0 +1,21 @@ +// ------------------------------- NODE MODULES ------------------------------- + +import clear from 'clear'; + +// ------------------------------ CUSTOM MODULES ------------------------------ + +// -------------------------------- VARIABLES --------------------------------- + +// ----------------------------- FILE DEFINITION ------------------------------ + +clear(); + +clear({}); + +clear({ + fullClear: true, +}); + +clear({ + fullClear: false, +}); diff --git a/types/clear/index.d.ts b/types/clear/index.d.ts new file mode 100644 index 0000000000..b28b14d2ba --- /dev/null +++ b/types/clear/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for clear 0.1 +// Project: https://github.com/bahamas10/node-clear#readme +// Definitions by: Connor Fitzgerald +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +interface ClearOptions { + /** + * Setting this to false will prevent this module from clearing the screen. + * This will not remove anything from the screen, but instead move your cursor + * to position 0,0. Much like printing a \r instead of a \n to reset the current line of output. + * + * @default true + */ + fullClear?: boolean; +} + +/** + * Clear the terminal screen if possible. + */ +declare function clear(opts?: ClearOptions): void; + +export = clear; diff --git a/types/clear/tsconfig.json b/types/clear/tsconfig.json new file mode 100644 index 0000000000..a505869884 --- /dev/null +++ b/types/clear/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "clear-tests.ts" + ] +} diff --git a/types/clear/tslint.json b/types/clear/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/clear/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }