diff --git a/types/knockout/index.d.ts b/types/knockout/index.d.ts index d4031b2337..5076a05231 100644 --- a/types/knockout/index.d.ts +++ b/types/knockout/index.d.ts @@ -1,10 +1,10 @@ // Type definitions for Knockout v3.4.0 // Project: http://knockoutjs.com -// Definitions by: Boris Yankov , -// Igor Oleinikov , -// Clément Bourgeois , -// Matt Brooks , -// Benjamin Eckardt , +// Definitions by: Boris Yankov , +// Igor Oleinikov , +// Clément Bourgeois , +// Matt Brooks , +// Benjamin Eckardt , // Mathias Lorenzen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -150,10 +150,10 @@ interface KnockoutAllBindingsAccessor { has(name: string): boolean; } -interface KnockoutBindingHandler { +interface KnockoutBindingHandler { after?: Array; - init?: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => void | { controlsDescendantBindings: boolean; }; - update?: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => void; + init?: (element: E, valueAccessor: () => V, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: VM, bindingContext: KnockoutBindingContext) => void | { controlsDescendantBindings: boolean; }; + update?: (element: E, valueAccessor: () => V, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: VM, bindingContext: KnockoutBindingContext) => void; options?: any; preprocess?: (value: string, name: string, addBindingCallback?: (name: string, value: string) => void) => string; [s: string]: any; @@ -440,7 +440,7 @@ interface KnockoutStatic { contextFor(node: any): any; isSubscribable(instance: any): instance is KnockoutSubscribable; toJSON(viewModel: any, replacer?: Function, space?: any): string; - + toJS(viewModel: any): any; isObservable(instance: any): instance is KnockoutObservable; @@ -451,7 +451,7 @@ interface KnockoutStatic { isComputed(instance: any): instance is KnockoutComputed; isComputed(instance: KnockoutObservable | T): instance is KnockoutComputed; - + dataFor(node: any): any; removeNode(node: Node): void; cleanNode(node: Node): Node; diff --git a/types/knockout/test/index.ts b/types/knockout/test/index.ts index a106d7af9b..38f439efb7 100644 --- a/types/knockout/test/index.ts +++ b/types/knockout/test/index.ts @@ -192,7 +192,7 @@ function test_bindings() { var value = ko.utils.unwrapObservable(valueAccessor()); $(element).toggle(value); } - }; + } as KnockoutBindingHandler | boolean>; ko.bindingHandlers.hasFocus = { init: function (element, valueAccessor) { $(element).focus(function () { @@ -211,7 +211,7 @@ function test_bindings() { else element.blur(); } - }; + } as KnockoutBindingHandler>; ko.bindingHandlers.allowBindings = { init: function (elem, valueAccessor) { var shouldAllowBindings = ko.utils.unwrapObservable(valueAccessor()); @@ -749,4 +749,4 @@ interface MyObservableArray extends KnockoutObservableArray { interface MyComputed extends KnockoutComputed { isBeautiful?: boolean; -} \ No newline at end of file +}