ko.unwrap uses union types

This commit is contained in:
Daniel Earwicker
2015-01-20 21:47:29 +00:00
parent 0bf824eb63
commit 3497b7ecd3
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -442,7 +442,7 @@ interface KnockoutStatic {
cleanNode(node: Element): Element;
renderTemplate(template: Function, viewModel: any, options?: any, target?: any, renderMode?: any): any;
renderTemplate(template: string, viewModel: any, options?: any, target?: any, renderMode?: any): any;
unwrap(value: any): any;
unwrap<T>(value: KnockoutObservable<T> | T): T;
computedContext: KnockoutComputedContext;
+7
View File
@@ -648,4 +648,11 @@ function test_Components() {
// Empty config for registering custom elements that are handled by name convention
ko.components.register('name', { /* No config needed */ });
}
}
function testUnwrapUnion() {
var possibleObs: KnockoutObservable<number> | number;
var num = ko.unwrap(possibleObs);
}