mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
committed by
Leon Senft
parent
cfa7664361
commit
43d61ecbb2
@@ -8,7 +8,6 @@
|
||||
|
||||
import {DocEntry} from '../../../src/ngtsc/docs';
|
||||
import {
|
||||
ClassEntry,
|
||||
EntryType,
|
||||
InterfaceEntry,
|
||||
MemberTags,
|
||||
@@ -382,5 +381,29 @@ runInEachFileSystem(() => {
|
||||
expect(ageSetterEntry.type).toBe('number');
|
||||
expect(ageSetterEntry.memberTags).toContain(MemberTags.Inherited);
|
||||
});
|
||||
|
||||
it('should extract return type for call signature', () => {
|
||||
env.write(
|
||||
'index.ts',
|
||||
`
|
||||
export interface AsyncValidatorFn {
|
||||
(
|
||||
control: AbstractControl,
|
||||
): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>;
|
||||
}
|
||||
`,
|
||||
);
|
||||
|
||||
const docs: DocEntry[] = env.driveDocsExtraction('index.ts');
|
||||
const interfaceEntry = docs[0] as InterfaceEntry;
|
||||
expect(interfaceEntry.members.length).toBe(1);
|
||||
|
||||
const methodEntry = interfaceEntry.members[0] as MethodEntry;
|
||||
expect(methodEntry.memberType).toBe(MemberType.Method);
|
||||
expect(methodEntry.name).toBe('');
|
||||
expect(methodEntry.implementation.returnType).toBe(
|
||||
'Promise<ValidationErrors | null> | Observable<ValidationErrors | null>',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user