mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
Vendored
+12
-10
@@ -409,10 +409,6 @@ interface KnockoutTasks {
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
type KnockoutObservableType<T> = {
|
||||
[P in keyof T]: KnockoutObservable<T[P]>;
|
||||
};
|
||||
|
||||
interface KnockoutStatic {
|
||||
utils: KnockoutUtils;
|
||||
memoization: KnockoutMemoization;
|
||||
@@ -443,12 +439,18 @@ interface KnockoutStatic {
|
||||
contextFor(node: any): any;
|
||||
isSubscribable(instance: any): instance is KnockoutSubscribable<any>;
|
||||
toJSON(viewModel: any, replacer?: Function, space?: any): string;
|
||||
toJS<T>(viewModel: KnockoutObservableArray<T>|KnockoutObservableType<T>[]|KnockoutObservableArray<KnockoutObservableType<T>>|T[]): T[];
|
||||
toJS<T>(viewModel: KnockoutObservable<T>|KnockoutObservableType<T>|KnockoutObservable<KnockoutObservableType<T>>): T;
|
||||
toJS<T>(viewModel: T): T;
|
||||
isObservable<T>(instance: KnockoutObservable<T>|T): instance is KnockoutObservable<T>;
|
||||
isWriteableObservable<T>(instance: KnockoutObservable<T>|T): instance is KnockoutObservable<T>;
|
||||
isComputed<T>(instance: KnockoutObservable<T>|T): instance is KnockoutComputed<T>;
|
||||
|
||||
toJS(viewModel: any): any;
|
||||
|
||||
isObservable(instance: any): instance is KnockoutObservable<any>;
|
||||
isObservable<T>(instance: KnockoutObservable<T>): instance is KnockoutObservable<T>;
|
||||
|
||||
isWriteableObservable(instance: any): instance is KnockoutObservable<any>;
|
||||
isWriteableObservable<T>(instance: KnockoutObservable<T>): instance is KnockoutObservable<T>;
|
||||
|
||||
isComputed(instance: any): instance is KnockoutComputed<any>;
|
||||
isComputed<T>(instance: KnockoutObservable<T> | T): instance is KnockoutComputed<T>;
|
||||
|
||||
dataFor(node: any): any;
|
||||
removeNode(node: Node): void;
|
||||
cleanNode(node: Node): Node;
|
||||
|
||||
@@ -99,6 +99,19 @@ class GetterViewModel {
|
||||
public range: KnockoutObservable<any>;
|
||||
}
|
||||
|
||||
function testToJs() {
|
||||
var objKo = {
|
||||
prop: ko.observable("prop"),
|
||||
subKo: ko.observable({
|
||||
prop: ko.observable("prop")
|
||||
})
|
||||
};
|
||||
|
||||
var objJs = ko.toJS(objKo);
|
||||
objJs.prop; // $ExpectType any
|
||||
objJs.subKo.prop; // $ExpectType any
|
||||
}
|
||||
|
||||
function testGetter() {
|
||||
var model = new GetterViewModel();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user