From 8af0a7e8453088ac1892ce9f2bc2356ffd6cabaf Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Mon, 23 Jan 2017 14:50:52 +0900 Subject: [PATCH 1/6] msgpack: add module declaration --- types/msgpack/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index 7d15442ce3..ff695b7087 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -81,3 +81,7 @@ interface MsgPackCallbackResult { } declare var msgpack: MsgPackStatic; + +declare module "msgpack" { + export = msgpack; +} \ No newline at end of file From 0a32d9d78266e436d0305073475baee846c564e9 Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Sat, 4 Feb 2017 13:13:48 +0900 Subject: [PATCH 2/6] fix declaration --- types/msgpack/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index ff695b7087..6b38b985cb 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -82,6 +82,4 @@ interface MsgPackCallbackResult { declare var msgpack: MsgPackStatic; -declare module "msgpack" { - export = msgpack; -} \ No newline at end of file +export = msgpack; From be2a3869bb744258c9a6b0ad53b038c30b1a7a88 Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Sat, 18 Feb 2017 20:33:40 +0900 Subject: [PATCH 3/6] fix module declaration --- types/msgpack/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index 6b38b985cb..9f869b8eac 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -83,3 +83,4 @@ interface MsgPackCallbackResult { declare var msgpack: MsgPackStatic; export = msgpack; +export as namespacei msgpack; From e423731ecc4644881354a8ca0e16061d2905d39a Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Sat, 18 Feb 2017 20:37:19 +0900 Subject: [PATCH 4/6] fix module declaration --- types/msgpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index 9f869b8eac..d57d49df17 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -83,4 +83,4 @@ interface MsgPackCallbackResult { declare var msgpack: MsgPackStatic; export = msgpack; -export as namespacei msgpack; +export as namespace msgpack; From fb6f6071946f21d8b8b87afb53ad5b639fea89c2 Mon Sep 17 00:00:00 2001 From: ogis-onishi Date: Thu, 23 Mar 2017 10:30:38 +0900 Subject: [PATCH 5/6] add msgpack namespace on MsgPackStatic --- types/msgpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index d57d49df17..15d18d0d70 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -80,7 +80,7 @@ interface MsgPackCallbackResult { ok: boolean; } -declare var msgpack: MsgPackStatic; +declare var msgpack: msgpack.MsgPackStatic; export = msgpack; export as namespace msgpack; From 91c1a8327d157700bc8a854f6225a7fd1a9ae094 Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Thu, 23 Mar 2017 10:51:10 +0900 Subject: [PATCH 6/6] fix namespace --- types/msgpack/index.d.ts | 118 +++++++++++++++++---------------- types/msgpack/msgpack-tests.ts | 14 ++-- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index 15d18d0d70..9d318641ae 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -3,81 +3,83 @@ // Definitions by: Shinya Mochizuki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface MsgPackStatic { - /** - * @param data string or ByteArray. - * @param toString return string value if true. - * - * @return string or ByteArray or false. pack failed if false. - */ - pack(data: any, toString?: boolean): any; +declare namespace msgpack { + interface MsgPackStatic { + /** + * @param data string or ByteArray. + * @param toString return string value if true. + * + * @return string or ByteArray or false. pack failed if false. + */ + pack(data: any, toString?: boolean): any; - /** - * @param data string or ByteArray. - * - * @return string or ByteArray or undefined. unpack failed if undefined. - */ - unpack(data: any): any; + /** + * @param data string or ByteArray. + * + * @return string or ByteArray or undefined. unpack failed if undefined. + */ + unpack(data: any): any; - worker: string; + worker: string; - upload(url: string, option: MsgPackUploadOption, callback: MsgPackUploadCallback): void; + upload(url: string, option: MsgPackUploadOption, callback: MsgPackUploadCallback): void; - download(url: string, option: MsgPackDownloadOption, callback: MsgPackDownloadCallback): void; -} + download(url: string, option: MsgPackDownloadOption, callback: MsgPackDownloadCallback): void; + } -interface MsgPackUploadOption { - /** - * string or ByteArray - */ - data: any; + interface MsgPackUploadOption { + /** + * string or ByteArray + */ + data: any; - /** - * use WebWorker if true. - */ - worker?: boolean; + /** + * use WebWorker if true. + */ + worker?: boolean; - /** - * timeout sec. - */ - timeout?: number; + /** + * timeout sec. + */ + timeout?: number; - before?: (xhr: XMLHttpRequest, option: MsgPackUploadOption) => void; + before?: (xhr: XMLHttpRequest, option: MsgPackUploadOption) => void; - after?: (xhr: XMLHttpRequest, option: MsgPackUploadOption, result: MsgPackCallbackResult) => void; -} + after?: (xhr: XMLHttpRequest, option: MsgPackUploadOption, result: MsgPackCallbackResult) => void; + } -interface MsgPackUploadCallback { - (data: string, option: MsgPackUploadOption, result: MsgPackCallbackResult): void; -} + interface MsgPackUploadCallback { + (data: string, option: MsgPackUploadOption, result: MsgPackCallbackResult): void; + } -interface MsgPackDownloadOption { - /** - * use WebWorker if true. - */ - worker?: boolean; + interface MsgPackDownloadOption { + /** + * use WebWorker if true. + */ + worker?: boolean; - /** - * timeout sec. - */ - timeout?: number; + /** + * timeout sec. + */ + timeout?: number; - before?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption) => void; + before?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption) => void; - after?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => void; -} + after?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => void; + } -interface MsgPackDownloadCallback { - /** - * @param data string or ByteArray - */ - (data: any, option: MsgPackDownloadCallback, result: MsgPackCallbackResult): void; -} + interface MsgPackDownloadCallback { + /** + * @param data string or ByteArray + */ + (data: any, option: MsgPackDownloadCallback, result: MsgPackCallbackResult): void; + } -interface MsgPackCallbackResult { - status: number; + interface MsgPackCallbackResult { + status: number; - ok: boolean; + ok: boolean; + } } declare var msgpack: msgpack.MsgPackStatic; diff --git a/types/msgpack/msgpack-tests.ts b/types/msgpack/msgpack-tests.ts index da0d12b926..b0b9a716a0 100644 --- a/types/msgpack/msgpack-tests.ts +++ b/types/msgpack/msgpack-tests.ts @@ -1,5 +1,3 @@ - - var packed = msgpack.pack(""); msgpack.unpack(packed); @@ -12,17 +10,17 @@ var uploadOption = { data: "", worker: false, timeout: 10, - before: (xhr: XMLHttpRequest, option: MsgPackUploadOption) => { }, - after: (xhr: XMLHttpRequest, option: MsgPackUploadOption, result: MsgPackCallbackResult) => { } + before: (xhr: XMLHttpRequest, option: msgpack.MsgPackUploadOption) => { }, + after: (xhr: XMLHttpRequest, option: msgpack.MsgPackUploadOption, result: msgpack.MsgPackCallbackResult) => { } }; -var uploadCallback = (data: string, option: MsgPackUploadOption, result: MsgPackCallbackResult) => { }; +var uploadCallback = (data: string, option: msgpack.MsgPackUploadOption, result: msgpack.MsgPackCallbackResult) => { }; msgpack.upload(url, uploadOption, uploadCallback); var downloadOption = { worker: false, timeout: 10, - before: (xhr: XMLHttpRequest, option: MsgPackDownloadOption) => { }, - after: (xhr: XMLHttpRequest, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => { } + before: (xhr: XMLHttpRequest, option: msgpack.MsgPackDownloadOption) => { }, + after: (xhr: XMLHttpRequest, option: msgpack.MsgPackDownloadOption, result: msgpack.MsgPackCallbackResult) => { } }; -var downloadCallback = (data: any, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => { }; +var downloadCallback = (data: any, option: msgpack.MsgPackDownloadOption, result: msgpack.MsgPackCallbackResult) => { }; msgpack.download(url, downloadOption, downloadCallback);