mirror of
https://github.com/appium/appium.git
synced 2026-02-22 03:08:47 -06:00
fix(typedoc-plugin-appium): allow commands as properties referencing async methods
Instead of only inspecting `ReflectionKind.Method`, we now examine `ReflectionKind.Property`, which can be of type `ReflectionType` pointing to an async function. Example:
```js
async function baz() {}
class Foo {
async bar() {} // ReflectionKind.Method
baz = baz; // ReflectionKind.Property referencing a function
}
```
Also ensures `static` methods aren't picked up; this could happen if a static method shares the same name with a known command method as defined in the builtin routes.
This commit is contained in:
@@ -260,12 +260,18 @@ export function isExternalDriverDeclarationReflection(
|
||||
export function isAsyncMethodDeclarationReflection(
|
||||
value: any
|
||||
): value is AsyncMethodDeclarationReflection {
|
||||
if (
|
||||
!isDeclarationReflection(value) ||
|
||||
!value.kindOf(ReflectionKind.Method | ReflectionKind.Property) ||
|
||||
value.flags.isStatic
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
const signatures =
|
||||
(value.type instanceof ReflectionType ? value.type.declaration.signatures : value.signatures) ??
|
||||
[];
|
||||
return Boolean(
|
||||
isDeclarationReflection(value) &&
|
||||
value.kindOf(ReflectionKind.Method) &&
|
||||
value.signatures?.find(
|
||||
(sig) => sig.type instanceof ReferenceType && sig.type.name === 'Promise'
|
||||
)
|
||||
signatures.find((sig) => sig.type instanceof ReferenceType && sig.type.name === 'Promise')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user