| 1 | import type { InterfaceDeclaration, TypeAliasDeclaration } from "typescript"; |
| 2 | import type { TextRange, DocComment } from "@microsoft/tsdoc"; |
| 3 | import ts from "typescript"; |
| 4 | |
| 5 | export type TypeDeclarationNode = InterfaceDeclaration | TypeAliasDeclaration; |
| 6 | |
| 7 | export interface FoundNode<T extends TypeDeclarationNode = TypeDeclarationNode> { |
| 8 | node: T; |
| 9 | textRange?: TextRange; |
| 10 | docComment?: DocComment; |
| 11 | } |
| 12 | |
| 13 | export function isInterfaceDeclarationFoundNode( |
| 14 | foundNode: FoundNode |
| 15 | ): foundNode is FoundNode<InterfaceDeclaration> { |
| 16 | return ts.isInterfaceDeclaration(foundNode.node); |
| 17 | } |
| 18 | |
| 19 | export interface InterfaceDoc { |
| 20 | name: string; |
| 21 | filename?: string; |
| 22 | members: MemberDoc[]; |
| 23 | extends: string[]; |
| 24 | inheritedMembers: MemberDoc[]; |
| 25 | hasDocComment: boolean; |
| 26 | } |
| 27 | |
| 28 | export interface Parameter { |
| 29 | name: string; |
| 30 | description: string; |
| 31 | } |
| 32 | |
| 33 | export interface TypeAliasDoc { |
| 34 | name: string; |
| 35 | summary?: string; |
| 36 | parameters: Parameter[]; |
| 37 | returns?: string; |
| 38 | declaration: string; |
| 39 | discussion?: string; |
| 40 | examples: string[]; |
| 41 | } |
| 42 | |
| 43 | export interface MemberDoc { |
| 44 | name: string; |
| 45 | excluded: boolean; |
| 46 | summary?: string; |
| 47 | optional: boolean; |
| 48 | parameters: Parameter[]; |
| 49 | returns?: string; |
| 50 | declaration: string; |
| 51 | discussion?: string; |
| 52 | examples: string[]; |
| 53 | default?: string; |
| 54 | deprecated?: boolean | string; |
| 55 | category?: string; |
| 56 | hasDocComment: boolean; |
| 57 | } |