Skip to content

Commit dd3f8ae

Browse files
committed
Changed model from (string | Object) to (string | { [key: string]: any; })
Changed the type of the model properties of various interfaces from (string | Object) to (string | { [key: string]: any; }). This change is to improve usability. While (string | Object) is correct and corresponds literally to the angular-formly docs, it does not allow for meaningful use without type casts. Also corrected some formatting to match the prevailing style used in the file.
1 parent 2736167 commit dd3f8ae

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

angular-formly/angular-formly.d.ts

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,34 @@ declare module 'angular-formly' {
1616

1717
declare module AngularFormly {
1818

19-
interface IFieldArray extends Array<IFieldConfigurationObject | IFieldGroup> {
19+
interface IFieldArray extends Array<IFieldConfigurationObject | IFieldGroup> {
2020

21-
}
21+
}
2222

2323
interface IFieldGroup {
2424
data?: {
25-
[key: string]: any;
26-
};
25+
[key: string]: any;
26+
};
2727
className?: string;
2828
elementAttributes?: string;
29-
fieldGroup?: IFieldArray;
29+
fieldGroup?: IFieldArray;
3030
form?: Object;
3131
hide?: boolean;
3232
hideExpression?: string | IExpressionFunction;
3333
key?: string | number;
34-
model?: string | Object;
35-
options?: IFormOptionsAPI;
36-
templateOptions?: ITemplateOptions;
37-
wrapper?: string | string[];
34+
model?: string | {
35+
[key: string]: any;
36+
};
37+
options?: IFormOptionsAPI;
38+
templateOptions?: ITemplateOptions;
39+
wrapper?: string | string[];
3840
}
3941

4042

4143
interface IFormOptionsAPI {
4244
data?: {
43-
[key: string]: any;
44-
};
45+
[key: string]: any;
46+
};
4547
fieldTransform?: Function;
4648
formState?: Object;
4749
removeChromeAutoComplete?: boolean;
@@ -182,8 +184,8 @@ declare module AngularFormly {
182184
* see http://docs.angular-formly.com/docs/field-configuration-object#data-object
183185
*/
184186
data?: {
185-
[key: string]: any;
186-
};
187+
[key: string]: any;
188+
};
187189

188190

189191
/**
@@ -287,7 +289,9 @@ declare module AngularFormly {
287289
*
288290
* see http://docs.angular-formly.com/docs/field-configuration-object#model-object--string
289291
*/
290-
model?: Object | string;
292+
model?: string | {
293+
[key: string]: any;
294+
};
291295

292296

293297
/**
@@ -543,8 +547,8 @@ declare module AngularFormly {
543547
defaultOptions?: IFieldConfigurationObject | Function;
544548
controller?: Function | string | any[];
545549
data?: {
546-
[key: string]: any;
547-
};
550+
[key: string]: any;
551+
};
548552
extends?: string;
549553
link?: ng.IDirectiveLinkFn;
550554
overwriteOk?: boolean;
@@ -612,7 +616,9 @@ declare module AngularFormly {
612616
//The index of the field the form is on (in ng-repeat)
613617
index: number;
614618
//the model of the form (or the model specified by the field if it was specified).
615-
model: Object | string;
619+
model?: string | {
620+
[key: string]: any;
621+
};
616622
//Shortcut to options.validation.errorExistsAndShouldBeVisible
617623
showError: boolean;
618624
//Shortcut to options.templateOptions

0 commit comments

Comments
 (0)