Files
DefinitelyTyped/types/knockout.postbox/index.d.ts
Mathias Lykkegaard Lorenzen d7b5cd9707 knockout.mapping better strong typing when mapping objects back and forth (#19119)
* Update index.d.ts

removed fromjs overload that no longer exists in latest knockout.mapping, and added much better type safety for "fromJS".

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* fix for typescript version.

* more typescript versioning fixes.

* fix for minor bug.

* yet another test fix.

* yet another test fix.
2017-11-15 11:12:34 +00:00

36 lines
1.9 KiB
TypeScript

// Type definitions for knockout-postbox
// Project: https://github.com/rniemeyer/knockout-postbox
// Definitions by: Judah Gabriel Himango <https://debuggerdotbreak.wordpress.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="knockout" />
interface KnockoutPostBox {
subscribe<T>(topic: string, handler: (value: T) => void , target?: any): KnockoutSubscription;
publish<T>(topic: string, value?: T): void;
defaultComparer<T>(newValue: T, oldValue: T): boolean;
serializer: (object: any) => string;
reset(): void;
}
interface KnockoutObservable<T> {
subscribeTo(topic: string, useLastPublishedValueToInitialize?: boolean, transform?: (val: any) => T): KnockoutObservable<T>;
unsubscribeFrom(topic: string): KnockoutObservable<T>;
publishOn(topic: string, skipInitialPublish?: boolean, equalityComparer?: (newValue: T, oldValue: T) => boolean): KnockoutObservable<T>;
stopPublishingOn(topic: string): KnockoutObservable<T>;
syncWith(topic: string, initializeWithLatestValue?: boolean, skipInitialPublish?: boolean, equalityComparer?: (newValue: T, oldValue: T) => boolean): KnockoutObservable<T>;
}
interface KnockoutObservableArray<T> {
subscribeTo(topic: string, useLastPublishedValueToInitialize?: boolean, transform?: (val: any) => any /* T */): KnockoutObservableArray<T>;
unsubscribeFrom(topic: string): KnockoutObservableArray<T>;
publishOn(topic: string, skipInitialPublish?: boolean, equalityComparer?: (newValue: any /* T */, oldValue: any /* T */) => boolean): KnockoutObservableArray<T>;
stopPublishingOn(topic: string): KnockoutObservableArray<T>;
syncWith(topic: string, initializeWithLatestValue?: boolean, skipInitialPublish?: boolean, equalityComparer?: (newValue: any /* T */, oldValue: any /* T */) => boolean): KnockoutObservableArray<T>;
}
interface KnockoutStatic {
postbox: KnockoutPostBox;
}