@@ -74,6 +74,9 @@ function isIdent(u: unknown, ...names: string[]): u is Identifier {
7474 return isNode ( u , 'Identifier' ) && names . includes ( u . name ) ;
7575}
7676
77+ /**
78+ * A CallExpression following the `EmberObject.extend(Mixin, {})` pattern.
79+ */
7780export interface EOExtendExpression extends CallExpression {
7881 callee : EOExtendExpressionCallee ;
7982 arguments : EOExtendArg [ ] ;
@@ -124,6 +127,10 @@ function isEOExtendExpressionCalleeProperty(
124127 return isIdent ( u , 'extend' ) ;
125128}
126129
130+ /**
131+ * The ObjectExpression argument from the `EmberObject.extend(Mixin, {})`
132+ * pattern.
133+ */
127134export interface EOExpression extends ObjectExpression {
128135 properties : EOExpressionProp [ ] ;
129136}
@@ -146,7 +153,7 @@ function isEOMixin(u: unknown): u is EOMixin {
146153 return isNode ( u , 'Identifier' ) ;
147154}
148155
149- /** A top-level instance property in an Ember Object's ObjectExpression */
156+ /** A top-level instance property in an EOExpression */
150157export interface EOProp extends ObjectProperty {
151158 key : Identifier ;
152159}
@@ -155,7 +162,7 @@ function isEOProp(u: unknown): u is EOProp {
155162 return isNode ( u , 'ObjectProperty' ) && isNode ( u . key , 'Identifier' ) ;
156163}
157164
158- /** A top-level instance property in an Ember Object's ObjectExpression */
165+ /** A top-level instance method in an EOExpression */
159166export interface EOMethod extends ObjectMethod {
160167 key : Identifier ;
161168}
@@ -164,6 +171,10 @@ export function isEOMethod(u: unknown): u is EOMethod {
164171 return isNode ( u , 'ObjectMethod' ) && isNode ( u . key , 'Identifier' ) ;
165172}
166173
174+ /**
175+ * A top-level instance property in an EOExpression where the value is a
176+ * `FunctionExpression`.
177+ */
167178export interface EOFunctionExpressionProp extends EOProp {
168179 value : FunctionExpression ;
169180}
@@ -174,15 +185,22 @@ export function isEOFunctionExpressionProp(
174185 return isEOProp ( u ) && isNode ( u . value , 'FunctionExpression' ) ;
175186}
176187
177- export interface EOCallExpressionProp extends EOProp {
188+ /**
189+ * A top-level instance property in an EOExpression where the value is a
190+ * `CallExpression`. These represent computed properties.
191+ */
192+ export interface EOComputedProp extends EOProp {
178193 value : EOCallExpression ;
179194}
180195
181- export function isEOCallExpressionProp ( u : unknown ) : u is EOCallExpressionProp {
196+ export function isEOCallExpressionProp ( u : unknown ) : u is EOComputedProp {
182197 return isEOProp ( u ) && isEOCallExpression ( u . value ) ;
183198}
184199
185- /** A CallExpression value for an EOProperty */
200+ /**
201+ * A top-level instance property in an EOExpression where the value is a
202+ * `CallExpression`.
203+ */
186204export interface EOCallExpression extends CallExpression {
187205 callee : EOCallExpressionCallee ;
188206}
@@ -217,7 +235,10 @@ export function isEOCallExpressionInnerCallee(
217235 return isNode ( u , 'CallExpression' ) && isNode ( u . callee , 'Identifier' ) ;
218236}
219237
220- /** An EOProperty that should be transformed into a class decorator */
238+ /**
239+ * A top-level instance property in an EOExpression that should be transformed
240+ * into a class decorator.
241+ */
221242export interface EOClassDecoratorProp extends EOProp {
222243 value : EOClassDecoratorValue ;
223244 key : EOClassDecoratorKey ;
@@ -245,6 +266,10 @@ function isEOClassDecoratorKey(u: unknown): u is EOClassDecoratorKey {
245266 return isIdent ( u , ...CLASS_DECORATOR_NAMES ) ;
246267}
247268
269+ /**
270+ * A top-level instance property in an EOExpression representing the `actions`
271+ * object.
272+ */
248273export interface EOActionsProp extends EOProp {
249274 value : EOActionsObjectExpression ;
250275 key : EOActionsObjectKey ;
@@ -274,12 +299,19 @@ function isEOAction(u: unknown): u is EOAction {
274299 return isEOActionMethod ( u ) || isEOActionProp ( u ) ;
275300}
276301
302+ /**
303+ * An instance property in an EOActionsProp representing a method-style action.
304+ */
277305type EOActionMethod = EOMethod ;
278306
279307export function isEOActionMethod ( u : unknown ) : u is EOActionMethod {
280308 return isEOMethod ( u ) ;
281309}
282310
311+ /**
312+ * An instance property in an EOActionsProp representing an identifier-style
313+ * action.
314+ */
283315export interface EOActionProp extends EOProp {
284316 value : Identifier ;
285317}
@@ -296,6 +328,10 @@ function isEOActionsObjectKey(u: unknown): u is EOActionsObjectKey {
296328 return isIdent ( u , ACTIONS_NAME ) ;
297329}
298330
331+ /**
332+ * A top-level instance property in an EOExpression representing a simple
333+ * Property (typically a primitive).
334+ */
299335export interface EOSimpleProp extends EOProp {
300336 value : Exclude <
301337 EOProp [ 'value' ] ,
@@ -323,7 +359,11 @@ interface EOActionInfiniteCall extends CallExpression {
323359 callee : EOActionInfiniteCallCallee ;
324360}
325361
326- export function makeEOActionInfiniteCallAssertion (
362+ /**
363+ * Makes a type predicate to check for an action that would call itself once
364+ * transformed, resulting in an infinite loop.
365+ */
366+ export function makeEOActionInfiniteCallPredicate (
327367 name : string
328368) : ( u : unknown ) => u is EOActionInfiniteCall {
329369 return function isEOActionInfiniteCallForName (
@@ -363,7 +403,11 @@ interface EOActionInfiniteLiteral extends StringLiteral {
363403 value : string ;
364404}
365405
366- export function makeEOActionInfiniteLiteralAssertion (
406+ /**
407+ * Makes a type predicate to check for an action that would call itself once
408+ * transformed, resulting in an infinite loop.
409+ */
410+ export function makeEOActionInfiniteLiteralPredicate (
367411 name : string
368412) : ( u : unknown ) => u is EOActionInfiniteLiteral {
369413 return function isEOActionInfiniteLiteralForName (
@@ -400,7 +444,10 @@ export interface DecoratorImportDeclaration extends ImportDeclaration {
400444 source : StringLiteral ;
401445}
402446
403- export function makeDecoratorImportDeclarationAssertion (
447+ /**
448+ * Makes a type predicate to find an import declaration with the given name.
449+ */
450+ export function makeDecoratorImportDeclarationPredicate (
404451 path : string
405452) : ( u : unknown ) => u is DecoratorImportDeclaration {
406453 return function isDecoratorImportDeclarationForPath (
0 commit comments