From 02f03824f17d974d2517f5fbb39540e351c6b7d3 Mon Sep 17 00:00:00 2001 From: Pavel Bakshy Date: Thu, 10 Sep 2015 17:47:36 +0300 Subject: [PATCH] ko.plus: Replaced Callback type with Function --- ko.plus/ko.plus-tests.ts | 2 ++ ko.plus/ko.plus.d.ts | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ko.plus/ko.plus-tests.ts b/ko.plus/ko.plus-tests.ts index 992332e2b..7dd1053b2 100644 --- a/ko.plus/ko.plus-tests.ts +++ b/ko.plus/ko.plus-tests.ts @@ -43,6 +43,8 @@ function CommandTests() { action: () => { return "Hello cmd4"; } }); + // initialize command with action with typed argument + var cmd5 = ko.command((message: string) => { return message; }); // test execute the command cmd1(); diff --git a/ko.plus/ko.plus.d.ts b/ko.plus/ko.plus.d.ts index 65301aa7c..dacf6121f 100644 --- a/ko.plus/ko.plus.d.ts +++ b/ko.plus/ko.plus.d.ts @@ -23,7 +23,7 @@ // interface KnockoutStatic { // create a command - two overloads - command: (param: KoPlus.Callback | KoPlus.CommandOptions) => KoPlus.Command; + command: (param: Function | KoPlus.CommandOptions) => KoPlus.Command; editable: KoPlus.EditableStatic; editableArray: KoPlus.EditableArrayStatic; @@ -60,8 +60,6 @@ interface KnockoutBindingHandlers { // namespace for ko.plus types // declare module KoPlus { - // predefine a callback type - export type Callback = () => void; //#region Command types @@ -91,9 +89,9 @@ declare module KoPlus { fail: (callback: (error: string) => void) => Command; - always: (callback: Callback) => Command; + always: (callback: Function) => Command; - then: (resolve: Callback, reject: Callback) => Command; + then: (resolve: Function, reject: Function) => Command; } // @@ -102,7 +100,7 @@ declare module KoPlus { // export interface CommandOptions { // [required] sets the command action method - action: Callback; + action: Function; // [optional] function to determine if command can be executed canExecute?: () => boolean;