mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #3500 from danielearwicker/master
Use union types (TS 1.4) for ko.unwrap and ko.utils.unwrapObservable
This commit is contained in:
Vendored
+2
-2
@@ -306,7 +306,7 @@ interface KnockoutUtils {
|
||||
|
||||
triggerEvent(element: any, eventType: any): void;
|
||||
|
||||
unwrapObservable<T>(value: KnockoutObservable<T>): T;
|
||||
unwrapObservable<T>(value: KnockoutObservable<T> | T): T;
|
||||
|
||||
peekObservable<T>(value: KnockoutObservable<T>): T;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user