From bf7b74abf3b6635d4371d5655a139d8efdcb8d54 Mon Sep 17 00:00:00 2001 From: vvakame Date: Sun, 22 Feb 2015 23:21:10 +0900 Subject: [PATCH 1/2] add archy definitions --- archy/archy-tests.ts | 32 ++++++++++++++++++++++++++++++++ archy/archy.d.ts | 21 +++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 archy/archy-tests.ts create mode 100644 archy/archy.d.ts diff --git a/archy/archy-tests.ts b/archy/archy-tests.ts new file mode 100644 index 000000000..b2f62384f --- /dev/null +++ b/archy/archy-tests.ts @@ -0,0 +1,32 @@ +/// + +import archy = require("archy"); + +var opts: archy.Options = { +}; + +var data: archy.Data = { + label: 'beep', + nodes: [ + 'ity', + { + label: 'boop', + nodes: [ + { + label: 'o_O', + nodes: [ + { + label: 'oh', + nodes: ['hello', 'puny'] + }, + 'human' + ] + }, + 'party\ntime!' + ] + } + ] +}; + +var str = archy(data); +console.log(str); diff --git a/archy/archy.d.ts b/archy/archy.d.ts new file mode 100644 index 000000000..c7145e628 --- /dev/null +++ b/archy/archy.d.ts @@ -0,0 +1,21 @@ +// Type definitions for archy +// Project: https://github.com/substack/node-archy +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "archy" { + function archy(obj: archy.Data, prefix?: string, opts?: archy.Options): string; + function archy(obj: string, prefix?: string, opts?: archy.Options): string; + + module archy { + interface Data { + label?: string; + nodes?: Data[]; + } + interface Options { + unicode?: boolean; + } + } + + export = archy; +} From b3def0f8abb4511e46b682837e3fcf6ce8483515 Mon Sep 17 00:00:00 2001 From: vvakame Date: Sun, 22 Feb 2015 23:25:14 +0900 Subject: [PATCH 2/2] improve archy definition --- archy/archy.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archy/archy.d.ts b/archy/archy.d.ts index c7145e628..3d989a895 100644 --- a/archy/archy.d.ts +++ b/archy/archy.d.ts @@ -9,8 +9,8 @@ declare module "archy" { module archy { interface Data { - label?: string; - nodes?: Data[]; + label: string; + nodes?: (Data | string)[]; } interface Options { unicode?: boolean;