@types/knockout
Advanced tools
Comparing version 3.4.59 to 3.4.60
@@ -10,2 +10,3 @@ // Type definitions for Knockout v3.4.0 | ||
// Leonardo Lombardi <https://github.com/ltlombardi> | ||
// Retsam <https://github.com/Retsam> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -25,4 +26,4 @@ // TypeScript Version: 2.3 | ||
interface KnockoutObservableArrayFunctions<T> { | ||
// General Array functions | ||
// The functions of observable arrays that don't mutate the array | ||
interface KnockoutReadonlyObservableArrayFunctions<T> { | ||
/** | ||
@@ -40,2 +41,5 @@ * Returns the index of the first occurrence of a value in an array. | ||
slice(start: number, end?: number): T[]; | ||
} | ||
// The functions of observable arrays that mutate the array | ||
interface KnockoutObservableArrayFunctions<T> extends KnockoutReadonlyObservableArrayFunctions<T> { | ||
/** | ||
@@ -161,3 +165,8 @@ * Removes and returns all the remaining elements starting from a given index. | ||
interface KnockoutComputed<T> extends KnockoutObservable<T>, KnockoutComputedFunctions<T> { | ||
interface KnockoutReadonlyComputed<T> extends KnockoutReadonlyObservable<T> { | ||
isActive(): boolean; | ||
getDependenciesCount(): number; | ||
} | ||
interface KnockoutComputed<T> extends KnockoutReadonlyComputed<T>, KnockoutObservable<T>, KnockoutComputedFunctions<T> { | ||
fn: KnockoutComputedFunctions<any>; | ||
@@ -170,4 +179,2 @@ | ||
dispose(): void; | ||
isActive(): boolean; | ||
getDependenciesCount(): number; | ||
extend(requestedExtenders: { [key: string]: any; }): KnockoutComputed<T>; | ||
@@ -182,2 +189,19 @@ } | ||
/** | ||
* While all observable arrays are writable at runtime, this type is analogous to the native ReadonlyArray type: | ||
* casting an observable array to this type expresses the intention that it shouldn't be mutated. | ||
*/ | ||
interface KnockoutReadonlyObservableArray<T> extends KnockoutReadonlyObservable<ReadonlyArray<T>>, KnockoutReadonlyObservableArrayFunctions<T> { | ||
// NOTE: Keep in sync with KnockoutObservableArray<T>, see note on KnockoutObservableArray<T> | ||
subscribe(callback: (newValue: KnockoutArrayChange<T>[]) => void, target: any, event: "arrayChange"): KnockoutSubscription; | ||
subscribe(callback: (newValue: T[]) => void, target: any, event: "beforeChange"): KnockoutSubscription; | ||
subscribe(callback: (newValue: T[]) => void, target?: any, event?: "change"): KnockoutSubscription; | ||
subscribe<TEvent>(callback: (newValue: TEvent) => void, target: any, event: string): KnockoutSubscription; | ||
} | ||
/* | ||
NOTE: In theory this should extend both Observable<T[]> and ReadonlyObservableArray<T>, | ||
but can't since they both provide conflicting typings of .subscribe. | ||
So it extends Observable<T[]> and duplicates the subscribe definitions, which should be kept in sync | ||
*/ | ||
interface KnockoutObservableArray<T> extends KnockoutObservable<T[]>, KnockoutObservableArrayFunctions<T> { | ||
@@ -200,5 +224,8 @@ subscribe(callback: (newValue: KnockoutArrayChange<T>[]) => void, target: any, event: "arrayChange"): KnockoutSubscription; | ||
interface KnockoutObservable<T> extends KnockoutSubscribable<T>, KnockoutObservableFunctions<T> { | ||
/** | ||
* While all observable are writable at runtime, this type is analogous to the native ReadonlyArray type: | ||
* casting an observable to this type expresses the intention that this observable shouldn't be mutated. | ||
*/ | ||
interface KnockoutReadonlyObservable<T> extends KnockoutSubscribable<T>, KnockoutObservableFunctions<T> { | ||
(): T; | ||
(value: T): void; | ||
@@ -208,2 +235,8 @@ peek(): T; | ||
valueWillMutate?: { (): void; }; | ||
} | ||
interface KnockoutObservable<T> extends KnockoutReadonlyObservable<T> { | ||
(value: T): void; | ||
// Since .extend does arbitrary thing to an observable, it's not safe to do on a readonly observable | ||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable<T>; | ||
@@ -210,0 +243,0 @@ } |
{ | ||
"name": "@types/knockout", | ||
"version": "3.4.59", | ||
"version": "3.4.60", | ||
"description": "TypeScript definitions for Knockout", | ||
@@ -41,5 +41,11 @@ "license": "MIT", | ||
"githubUsername": "ltlombardi" | ||
}, | ||
{ | ||
"name": "Retsam", | ||
"url": "https://github.com/Retsam", | ||
"githubUsername": "Retsam" | ||
} | ||
], | ||
"main": "", | ||
"types": "index", | ||
"repository": { | ||
@@ -51,4 +57,4 @@ "type": "git", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "93504cf13bca508b66d56a0e90ba8279c8d45d2528c15409807743bfd763f6e2", | ||
"typesPublisherContentHash": "974f9fb2ff5fafdc1e08a004260fc54cf66745bd6d9c5269c95919ef4b9f6488", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Mon, 10 Sep 2018 22:50:10 GMT | ||
* Last updated: Mon, 19 Nov 2018 19:48:59 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: ko | ||
# Credits | ||
These definitions were written by Boris Yankov <https://github.com/borisyankov>, Igor Oleinikov <https://github.com/Igorbek>, Clément Bourgeois <https://github.com/moonpyk>, Matt Brooks <https://github.com/EnableSoftware>, Benjamin Eckardt <https://github.com/BenjaminEckardt>, Mathias Lorenzen <https://github.com/ffMathy>, Leonardo Lombardi <https://github.com/ltlombardi>. | ||
These definitions were written by Boris Yankov <https://github.com/borisyankov>, Igor Oleinikov <https://github.com/Igorbek>, Clément Bourgeois <https://github.com/moonpyk>, Matt Brooks <https://github.com/EnableSoftware>, Benjamin Eckardt <https://github.com/BenjaminEckardt>, Mathias Lorenzen <https://github.com/ffMathy>, Leonardo Lombardi <https://github.com/ltlombardi>, Retsam <https://github.com/Retsam>. |
34900
639