typescript-docgen-types.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import ts from 'typescript';
  2. export interface MethodParameterInfo {
  3. name: string;
  4. type: string;
  5. }
  6. export interface MemberInfo {
  7. name: string;
  8. description: string;
  9. type: string;
  10. fullText: string;
  11. }
  12. export interface PropertyInfo extends MemberInfo {
  13. kind: 'property';
  14. defaultValue: string;
  15. }
  16. export interface MethodInfo extends MemberInfo {
  17. kind: 'method';
  18. parameters: MethodParameterInfo[];
  19. }
  20. export interface DeclarationInfo {
  21. sourceFile: string;
  22. sourceLine: number;
  23. title: string;
  24. fullText: string;
  25. weight: number;
  26. category: string;
  27. description: string;
  28. fileName: string;
  29. }
  30. export interface InterfaceInfo extends DeclarationInfo {
  31. kind: 'interface';
  32. extends?: string;
  33. members: Array<PropertyInfo | MethodInfo>;
  34. }
  35. export interface ClassInfo extends DeclarationInfo {
  36. kind: 'class';
  37. implements?: string;
  38. extends?: string;
  39. members: Array<PropertyInfo | MethodInfo>;
  40. }
  41. export interface TypeAliasInfo extends DeclarationInfo {
  42. kind: 'typeAlias';
  43. members?: Array<PropertyInfo | MethodInfo>;
  44. type: ts.TypeNode;
  45. }
  46. export type ParsedDeclaration = TypeAliasInfo | ClassInfo | InterfaceInfo;
  47. export type ValidDeclaration = ts.InterfaceDeclaration | ts.TypeAliasDeclaration | ts.ClassDeclaration;
  48. export type TypeMap = Map<string, string>;