react-native-navigation的迁移库

1234567891011121314151617181920
  1. import { DeclarationReflection, ReflectionKind } from 'typedoc';
  2. export interface EnumContext {
  3. name: string;
  4. values: string[];
  5. }
  6. export class EnumParser {
  7. public parse(enumReflections: DeclarationReflection[]): EnumContext[] {
  8. return enumReflections.map((r) => this.parseEnum(r));
  9. }
  10. private parseEnum(enumReflection: DeclarationReflection): EnumContext {
  11. return {
  12. name: enumReflection.name,
  13. values: enumReflection.getChildrenByKind(ReflectionKind.EnumMember).map((child) => child.name)
  14. };
  15. }
  16. }