mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
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.
This commit is contained in:
committed by
John Reilly
parent
a9d7f1bf8b
commit
d7b5cd9707
+1
-1
@@ -2,10 +2,10 @@
|
||||
// Project: https://github.com/rniemeyer/knockout-amd-helpers
|
||||
// Definitions by: David Sichau <https://github.com/DavidSichau>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
interface KnockoutAMDModule {
|
||||
baseDir: string;
|
||||
initializer: string;
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/brianmhunt/knockout-secure-binding
|
||||
// Definitions by: Pine Mizune <https://github.com/pine613>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
@@ -28,4 +29,4 @@ declare module "knockout-secure-binding" {
|
||||
};
|
||||
|
||||
export = klass;
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/One-com/knockout-transformations
|
||||
// Definitions by: John Reilly <https://github.com/johnnyreilly>, Wim Looman <https://github.com/Nemo157>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/mbest/knockout-deferred-updates
|
||||
// Definitions by: Sebastián Galiano <https://github.com/sgaliano>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
@@ -42,4 +43,4 @@ interface KnockoutUtils {
|
||||
// Deferred extender
|
||||
interface KnockoutExtenders {
|
||||
deferred(target: any, value: boolean): any;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: http://romanych.github.com/ko.editables/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/SteveSanderson/knockout-es5
|
||||
// Definitions by: Sebastián Galiano <https://github.com/sgaliano>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/LucasLorentz/knockout.mapper
|
||||
// Definitions by: Brandon Meyer <https://github.com/BMeyerKC>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
Vendored
+16
-6
@@ -1,7 +1,9 @@
|
||||
// Type definitions for Knockout.Mapping 2.0
|
||||
// Project: https://github.com/SteveSanderson/knockout.mapping
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>,
|
||||
// Mathias Lorenzen <https://github.com/ffMathy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
@@ -33,17 +35,25 @@ declare global {
|
||||
update?: (options: KnockoutMappingUpdateOptions) => void;
|
||||
key?: (data: any) => any;
|
||||
}
|
||||
|
||||
type KnockoutObservableType<T> = {
|
||||
[P in keyof T]: KnockoutObservable<T[P]>;
|
||||
};
|
||||
|
||||
interface KnockoutMapping {
|
||||
isMapped(viewModel: any): boolean;
|
||||
fromJS(jsObject: any): any;
|
||||
fromJS(jsObject: any, targetOrOptions: any): any;
|
||||
fromJS(jsObject: any, inputOptions: any, target: any): any;
|
||||
fromJS<T>(jsObject: T[]): KnockoutObservableType<T>[];
|
||||
fromJS<T>(jsObject: T[], targetOrOptions: any): KnockoutObservableType<T>[];
|
||||
fromJS<T>(jsObject: T[], inputOptions: any, target: any): KnockoutObservableType<T>[];
|
||||
fromJS<T>(jsObject: T): KnockoutObservableType<T>;
|
||||
fromJS<T>(jsObject: T, targetOrOptions: any): KnockoutObservableType<T>;
|
||||
fromJS<T>(jsObject: T, inputOptions: any, target: any): KnockoutObservableType<T>;
|
||||
fromJSON(jsonString: string): any;
|
||||
fromJSON(jsonString: string, targetOrOptions: any): any;
|
||||
fromJSON(jsonString: string, inputOptions: any, target: any): any;
|
||||
toJS(rootObject: any, options?: KnockoutMappingOptions): any;
|
||||
toJSON(rootObject: any, options?: KnockoutMappingOptions): any;
|
||||
toJS<T>(rootObject: KnockoutObservableArray<T>|T, options?: KnockoutMappingOptions): T[];
|
||||
toJS<T>(rootObject: KnockoutObservableType<T>|T, options?: KnockoutMappingOptions): T;
|
||||
toJSON(rootObject: any, options?: KnockoutMappingOptions): string;
|
||||
defaultOptions(): KnockoutMappingOptions;
|
||||
resetDefaultOptions(): void;
|
||||
getType(x: any): any;
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// 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" />
|
||||
|
||||
|
||||
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/stevesanderson/knockout-projections
|
||||
// Definitions by: John Reilly <https://github.com/johnnyreilly>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/mbest/knockout.punches
|
||||
// Definitions by: Stephen Lautier <https://github.com/johnnyreilly>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/Igorbek/knockout.rx
|
||||
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout"/>
|
||||
/// <reference types="rx"/>
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/ericmbarnard/Knockout-Validation
|
||||
// Definitions by: Dan Ludwig <https://github.com/danludwig>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: http://coderenaissance.github.com/knockout.viewmodel/
|
||||
// Definitions by: Oisin Grehan <https://github.com/oising>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
Vendored
+7
-6
@@ -1,12 +1,13 @@
|
||||
// Type definitions for Knockout v3.4.0
|
||||
// Project: http://knockoutjs.com
|
||||
// Definitions 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>
|
||||
// Definitions 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>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
interface KnockoutExtensionFunctions {
|
||||
[key: string]: any;
|
||||
|
||||
@@ -484,8 +484,8 @@ function test_mappingplugin() {
|
||||
ko.mapping.fromJS(data, {}, this);
|
||||
|
||||
var alice, aliceMappingOptions, bob, bobMappingOptions;
|
||||
var viewModel = ko.mapping.fromJS(alice, aliceMappingOptions);
|
||||
ko.mapping.fromJS(bob, bobMappingOptions, viewModel);
|
||||
var aliceViewModel = ko.mapping.fromJS(alice, aliceMappingOptions);
|
||||
ko.mapping.fromJS(bob, bobMappingOptions, aliceViewModel);
|
||||
|
||||
var obj;
|
||||
var result = ko.mapping.fromJS(obj, {
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/CodeSeven/kolite
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
/// <reference types="knockout" />
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/CodeSeven/kolite
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
/// <reference types="knockout" />
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/CodeSeven/kolite
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
/// <reference types="knockout" />
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/kamranayub/UnderscoreKO
|
||||
// Definitions by: Maurits Elbers <https://github.com/MagicMau>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/davewatts/valerie
|
||||
// Definitions by: Howard Richards <https://github.com/conficient>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user