typescript-docgen-types.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. packageName: string;
  22. sourceFile: string;
  23. sourceLine: number;
  24. title: string;
  25. fullText: string;
  26. weight: number;
  27. category: string;
  28. description: string;
  29. fileName: string;
  30. }
  31. export interface InterfaceInfo extends DeclarationInfo {
  32. kind: 'interface';
  33. extends?: string;
  34. members: Array<PropertyInfo | MethodInfo>;
  35. }
  36. export interface ClassInfo extends DeclarationInfo {
  37. kind: 'class';
  38. implements?: string;
  39. extends?: string;
  40. members: Array<PropertyInfo | MethodInfo>;
  41. }
  42. export interface TypeAliasInfo extends DeclarationInfo {
  43. kind: 'typeAlias';
  44. members?: Array<PropertyInfo | MethodInfo>;
  45. type: ts.TypeNode;
  46. }
  47. export type ParsedDeclaration = TypeAliasInfo | ClassInfo | InterfaceInfo;
  48. export type ValidDeclaration = ts.InterfaceDeclaration | ts.TypeAliasDeclaration | ts.ClassDeclaration;
  49. export type TypeMap = Map<string, string>;