From 2ce623713394048ea1fda65c6f6eb5080ceab987 Mon Sep 17 00:00:00 2001 From: Mike North Date: Mon, 10 Dec 2018 15:03:18 -0800 Subject: [PATCH] feat: TypeScript ambient types --- index.d.ts | 22 ++++++++++++++++++++++ package.json | 1 + 2 files changed, 23 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..954204d --- /dev/null +++ b/index.d.ts @@ -0,0 +1,22 @@ +export interface TreeObject { + [k: string]: TreeValue; +} +export type TreeValue = string | TreeObject; + +export function asTree( + treeObj: TreeObject, + showValues: boolean, + hideFunctions: boolean +): string; + +export function asLines( + treeObj: TreeObject, + showValues: boolean, + lineCallback: (line: string) => void +): string; +export function asLines( + treeObj: TreeObject, + showValues: boolean, + hideFunctions: boolean, + lineCallback: (line: string) => void +): string; diff --git a/package.json b/package.json index 0de9eea..77f8151 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "treeify", + "types": "index.d.ts", "version": "1.1.0", "author": "Luke Plaster ", "description": "converts a JS object into a nice and readable tree structure for the console",