Skip to content

Commit edbf006

Browse files
author
Anatoly Ostrovsky
committed
Type fixes on repeat and interpreter
1 parent a520826 commit edbf006

12 files changed

Lines changed: 528 additions & 239 deletions

File tree

@types/animations/interface.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export interface AnimateService {
101101
*/
102102
move(
103103
element: Element,
104-
parent: Element,
104+
parent: Element | null,
105105
after?: Element,
106106
options?: AnimationOptions,
107107
): AnimateRunner;

@types/core/compile/compile.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ export const DirectiveSuffix: "Directive";
22
export class CompileProvider {
33
static $inject: string[];
44
/**
5-
* @param {import('../../interface.ts').Provider} $provide
5+
* @param {ng.ProvideService} $provide
66
* @param {import('../sanitize/sanitize-uri.js').SanitizeUriProvider} $sanitizeUriProvider
77
*/
88
constructor(
9-
$provide: import("../../interface.ts").Provider,
9+
$provide: ng.ProvideService,
1010
$sanitizeUriProvider: import("../sanitize/sanitize-uri.js").SanitizeUriProvider,
1111
);
1212
/**
@@ -15,13 +15,13 @@ export class CompileProvider {
1515
* @param {string|Object} name Name of the directive in camel-case (i.e. `ngBind` which will match
1616
* as `ng-bind`), or an object map of directives where the keys are the names and the values
1717
* are the factories.
18-
* @param {Function|Array} directiveFactory An injectable directive factory function. See the
18+
* @param {Function|Array<Function>} directiveFactory An injectable directive factory function. See the
1919
* {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
2020
* @returns {CompileProvider} Self for chaining.
2121
*/
2222
directive: (
2323
name: string | any,
24-
directiveFactory: Function | any[],
24+
directiveFactory: Function | Array<Function>,
2525
) => CompileProvider;
2626
/**
2727
* @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),

@types/core/parse/interface.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface CompiledExpressionProps {
1919
* Assigns a value to a context.
2020
* If value is not provided, may return the getter.
2121
*/
22-
_assign?: (context: any, value: any) => any;
22+
_assign?: (scope: ng.Scope, value: any, locals?: object) => any;
2323
}
2424
/**
2525
* Expression function with context and optional locals/assign.
@@ -28,7 +28,7 @@ export interface CompiledExpressionProps {
2828
export type CompiledExpressionFunction = (
2929
context?: Scope | typeof Proxy<Scope>,
3030
locals?: object,
31-
assign?: any,
31+
_assign?: any,
3232
) => any;
3333
/**
3434
* A compiled expression that is both a function and includes expression metadata.

@types/core/parse/interpreter.d.ts

Lines changed: 110 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -31,198 +31,250 @@ export class ASTInterpreter {
3131
* Unary plus operation.
3232
* @param {function} argument - The argument function.
3333
* @param {Object} [context] - The context.
34-
* @returns {function} The unary plus function.
34+
* @returns {CompiledExpressionFunction} The unary plus function.
3535
*/
36-
"unary+"(argument: Function, context?: any): Function;
36+
"unary+"(argument: Function, context?: any): CompiledExpressionFunction;
3737
/**
3838
* Unary minus operation.
3939
* @param {function} argument - The argument function.
4040
* @param {Object} [context] - The context.
41-
* @returns {function} The unary minus function.
41+
* @returns {CompiledExpressionFunction} The unary minus function.
4242
*/
43-
"unary-"(argument: Function, context?: any): Function;
43+
"unary-"(argument: Function, context?: any): CompiledExpressionFunction;
4444
/**
4545
* Unary negation operation.
4646
* @param {function} argument - The argument function.
4747
* @param {Object} [context] - The context.
48-
* @returns {function} The unary negation function.
48+
* @returns {CompiledExpressionFunction} The unary negation function.
4949
*/
50-
"unary!"(argument: Function, context?: any): Function;
50+
"unary!"(argument: Function, context?: any): CompiledExpressionFunction;
5151
/**
5252
* Binary plus operation.
5353
* @param {function} left - The left operand function.
5454
* @param {function} right - The right operand function.
5555
* @param {Object} [context] - The context.
56-
* @returns {function} The binary plus function.
56+
* @returns {CompiledExpressionFunction} The binary plus function.
5757
*/
58-
"binary+"(left: Function, right: Function, context?: any): Function;
58+
"binary+"(
59+
left: Function,
60+
right: Function,
61+
context?: any,
62+
): CompiledExpressionFunction;
5963
/**
6064
* Binary minus operation.
6165
* @param {function} left - The left operand function.
6266
* @param {function} right - The right operand function.
6367
* @param {Object} [context] - The context.
64-
* @returns {function} The binary minus function.
68+
* @returns {CompiledExpressionFunction} The binary minus function.
6569
*/
66-
"binary-"(left: Function, right: Function, context?: any): Function;
70+
"binary-"(
71+
left: Function,
72+
right: Function,
73+
context?: any,
74+
): CompiledExpressionFunction;
6775
/**
6876
* Binary multiplication operation.
6977
* @param {function} left - The left operand function.
7078
* @param {function} right - The right operand function.
7179
* @param {Object} [context] - The context.
72-
* @returns {function} The binary multiplication function.
80+
* @returns {CompiledExpressionFunction} The binary multiplication function.
7381
*/
74-
"binary*"(left: Function, right: Function, context?: any): Function;
75-
"binary/"(
76-
left: any,
77-
right: any,
78-
context: any,
79-
): (
80-
scope: any,
81-
locals: any,
82-
assign: any,
83-
) =>
84-
| number
85-
| {
86-
value: number;
87-
};
82+
"binary*"(
83+
left: Function,
84+
right: Function,
85+
context?: any,
86+
): CompiledExpressionFunction;
8887
/**
8988
* Binary division operation.
9089
* @param {function} left - The left operand function.
9190
* @param {function} right - The right operand function.
9291
* @param {Object} [context] - The context.
93-
* @returns {function} The binary division function.
92+
* @returns {CompiledExpressionFunction} The binary division function.
9493
*/
95-
"binary%"(left: Function, right: Function, context?: any): Function;
94+
"binary/"(
95+
left: Function,
96+
right: Function,
97+
context?: any,
98+
): CompiledExpressionFunction;
99+
/**
100+
* Binary modulo operation.
101+
* @param {function} left - The left operand function.
102+
* @param {function} right - The right operand function.
103+
* @param {Object} [context] - The context.
104+
* @returns {CompiledExpressionFunction} The binary division function.
105+
*/
106+
"binary%"(
107+
left: Function,
108+
right: Function,
109+
context?: any,
110+
): CompiledExpressionFunction;
96111
/**
97112
* Binary strict equality operation.
98113
* @param {function} left - The left operand function.
99114
* @param {function} right - The right operand function.
100115
* @param {Object} [context] - The context.
101-
* @returns {function} The binary strict equality function.
116+
* @returns {CompiledExpressionFunction} The binary strict equality function.
102117
*/
103-
"binary==="(left: Function, right: Function, context?: any): Function;
118+
"binary==="(
119+
left: Function,
120+
right: Function,
121+
context?: any,
122+
): CompiledExpressionFunction;
104123
/**
105124
* Binary strict inequality operation.
106125
* @param {function} left - The left operand function.
107126
* @param {function} right - The right operand function.
108127
* @param {Object} [context] - The context.
109-
* @returns {function} The binary strict inequality function.
128+
* @returns {CompiledExpressionFunction} The binary strict inequality function.
110129
*/
111-
"binary!=="(left: Function, right: Function, context?: any): Function;
130+
"binary!=="(
131+
left: Function,
132+
right: Function,
133+
context?: any,
134+
): CompiledExpressionFunction;
112135
/**
113136
* Binary equality operation.
114137
* @param {function} left - The left operand function.
115138
* @param {function} right - The right operand function.
116139
* @param {Object} [context] - The context.
117-
* @returns {function} The binary equality function.
140+
* @returns {CompiledExpressionFunction} The binary equality function.
118141
*/
119-
"binary=="(left: Function, right: Function, context?: any): Function;
142+
"binary=="(
143+
left: Function,
144+
right: Function,
145+
context?: any,
146+
): CompiledExpressionFunction;
120147
/**
121148
* Binary inequality operation.
122149
* @param {function} left - The left operand function.
123150
* @param {function} right - The right operand function.
124151
* @param {Object} [context] - The context.
125-
* @returns {function} The binary inequality function.
152+
* @returns {CompiledExpressionFunction} The binary inequality function.
126153
*/
127-
"binary!="(left: Function, right: Function, context?: any): Function;
154+
"binary!="(
155+
left: Function,
156+
right: Function,
157+
context?: any,
158+
): CompiledExpressionFunction;
128159
/**
129160
* Binary less-than operation.
130161
* @param {function} left - The left operand function.
131162
* @param {function} right - The right operand function.
132163
* @param {Object} [context] - The context.
133-
* @returns {function} The binary less-than function.
164+
* @returns {CompiledExpressionFunction} The binary less-than function.
134165
*/
135-
"binary<"(left: Function, right: Function, context?: any): Function;
166+
"binary<"(
167+
left: Function,
168+
right: Function,
169+
context?: any,
170+
): CompiledExpressionFunction;
136171
/**
137172
* Binary greater-than operation.
138173
* @param {function} left - The left operand function.
139174
* @param {function} right - The right operand function.
140175
* @param {Object} [context] - The context.
141-
* @returns {function} The binary greater-than function.
176+
* @returns {CompiledExpressionFunction} The binary greater-than function.
142177
*/
143-
"binary>"(left: Function, right: Function, context?: any): Function;
178+
"binary>"(
179+
left: Function,
180+
right: Function,
181+
context?: any,
182+
): CompiledExpressionFunction;
144183
/**
145184
* Binary less-than-or-equal-to operation.
146185
* @param {function} left - The left operand function.
147186
* @param {function} right - The right operand function.
148187
* @param {Object} [context] - The context.
149-
* @returns {function} The binary less-than-or-equal-to function.
188+
* @returns {CompiledExpressionFunction} The binary less-than-or-equal-to function.
150189
*/
151-
"binary<="(left: Function, right: Function, context?: any): Function;
190+
"binary<="(
191+
left: Function,
192+
right: Function,
193+
context?: any,
194+
): CompiledExpressionFunction;
152195
/**
153196
* Binary greater-than-or-equal-to operation.
154197
* @param {function} left - The left operand function.
155198
* @param {function} right - The right operand function.
156199
* @param {Object} [context] - The context.
157-
* @returns {function} The binary greater-than-or-equal-to function.
200+
* @returns {CompiledExpressionFunction} The binary greater-than-or-equal-to function.
158201
*/
159-
"binary>="(left: Function, right: Function, context?: any): Function;
202+
"binary>="(
203+
left: Function,
204+
right: Function,
205+
context?: any,
206+
): CompiledExpressionFunction;
160207
/**
161208
* Binary logical AND operation.
162209
* @param {function} left - The left operand function.
163210
* @param {function} right - The right operand function.
164211
* @param {Object} [context] - The context.
165-
* @returns {function} The binary logical AND function.
212+
* @returns {CompiledExpressionFunction} The binary logical AND function.
166213
*/
167-
"binary&&"(left: Function, right: Function, context?: any): Function;
214+
"binary&&"(
215+
left: Function,
216+
right: Function,
217+
context?: any,
218+
): CompiledExpressionFunction;
168219
/**
169220
* Binary logical OR operation.
170221
* @param {function} left - The left operand function.
171222
* @param {function} right - The right operand function.
172223
* @param {Object} [context] - The context.
173-
* @returns {function} The binary logical OR function.
224+
* @returns {CompiledExpressionFunction} The binary logical OR function.
174225
*/
175-
"binary||"(left: Function, right: Function, context?: any): Function;
226+
"binary||"(
227+
left: Function,
228+
right: Function,
229+
context?: any,
230+
): CompiledExpressionFunction;
176231
/**
177232
* Ternary conditional operation.
178233
* @param {function} test - The test function.
179234
* @param {function} alternate - The alternate function.
180235
* @param {function} consequent - The consequent function.
181236
* @param {Object} [context] - The context.
182-
* @returns {function} The ternary conditional function.
237+
* @returns {CompiledExpressionFunction} The ternary conditional function.
183238
*/
184239
"ternary?:"(
185240
test: Function,
186241
alternate: Function,
187242
consequent: Function,
188243
context?: any,
189-
): Function;
244+
): CompiledExpressionFunction;
190245
/**
191246
* Returns the value of a literal.
192247
* @param {*} value - The literal value.
193248
* @param {Object} [context] - The context.
194-
* @returns {import("./interface.ts").CompiledExpressionFunction} The function returning the literal value.
249+
* @returns {CompiledExpressionFunction} The function returning the literal value.
195250
*/
196-
value(
197-
value: any,
198-
context?: any,
199-
): import("./interface.ts").CompiledExpressionFunction;
251+
value(value: any, context?: any): CompiledExpressionFunction;
200252
/**
201253
* Returns the value of an identifier.
202254
* @param {string} name - The identifier name.
203255
* @param {Object} [context] - The context.
204256
* @param {boolean|1} [create] - Whether to create the identifier if it does not exist.
205-
* @returns {import("./interface.ts").CompiledExpressionFunction} The function returning the identifier value.
257+
* @returns {CompiledExpressionFunction} The function returning the identifier value.
206258
*/
207259
identifier(
208260
name: string,
209261
context?: any,
210262
create?: boolean | 1,
211-
): import("./interface.ts").CompiledExpressionFunction;
263+
): CompiledExpressionFunction;
212264
/**
213265
* Returns the value of a non-computed member expression.
214266
* @param {function} left - The left operand function.
215267
* @param {string} right - The right operand function.
216268
* @param {Object} [context] - The context.
217269
* @param {boolean|1} [create] - Whether to create the member if it does not exist.
218-
* @returns {function} The function returning the non-computed member value.
270+
* @returns {CompiledExpressionFunction} The function returning the non-computed member value.
219271
*/
220272
nonComputedMember(
221273
left: Function,
222274
right: string,
223275
context?: any,
224276
create?: boolean | 1,
225-
): Function;
277+
): CompiledExpressionFunction;
226278
#private;
227279
}
228280
export type ASTNode = import("./ast/ast-node.ts").ASTNode;

0 commit comments

Comments
 (0)