mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #59350 [console-log-tree] Added definitions by @ChocolateLoverRaj
* [console-log-tree] Added definitions * Remove extra space in `types/console-log-tree/index.d.ts` Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com> * Add optional params to `parse` Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>
This commit is contained in:
27
types/console-log-tree/console-log-tree-tests.ts
Normal file
27
types/console-log-tree/console-log-tree-tests.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import logTree = require('console-log-tree');
|
||||
|
||||
// $ExpectType string
|
||||
const treeString = logTree.parse([{
|
||||
name: 'Planets',
|
||||
children: [{
|
||||
name: 'Earth',
|
||||
children: [{
|
||||
name: 'Moon'
|
||||
}]
|
||||
}, {
|
||||
name: 'Venus'
|
||||
}]
|
||||
}, {
|
||||
name: 'Empty Tree'
|
||||
}]);
|
||||
|
||||
// $ExpectType void
|
||||
logTree.log({
|
||||
name: 'My Tree'
|
||||
});
|
||||
|
||||
// $ExpectError
|
||||
logTree.log({});
|
||||
|
||||
// $ExpectError
|
||||
logTree({ name: 'Hello' });
|
||||
14
types/console-log-tree/index.d.ts
vendored
Normal file
14
types/console-log-tree/index.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// Type definitions for console-log-tree 1.2
|
||||
// Project: https://github.com/QiShaoXuan/log-tree#readme
|
||||
// Definitions by: Rajas Paranjpe <https://github.com/ChocolateLoverRaj>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace library;
|
||||
|
||||
export interface Tree {
|
||||
name: string;
|
||||
children?: readonly Tree[];
|
||||
}
|
||||
|
||||
export function parse(tree: Tree | readonly Tree[], parentPre?: string, treeStr?: string): string;
|
||||
export function log(tree: Tree | readonly Tree[]): void;
|
||||
23
types/console-log-tree/tsconfig.json
Normal file
23
types/console-log-tree/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"console-log-tree-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/console-log-tree/tslint.json
Normal file
3
types/console-log-tree/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "@definitelytyped/dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user