aboutsummaryrefslogtreecommitdiff
path: root/src/types.ts
blob: e3ea7e930a27190e23cb1f77d54a572c963ea795 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import {
  ExportedDeclarations,
  Node,
  SourceFile,
  Type,
  TypeChecker,
} from 'ts-morph'

export interface Ctx {
  sourceFile: SourceFile
  typeChecker: TypeChecker
  entryPoint: ExportedDeclarations
  typeToString: (ty: Type | undefined) => string
  getTypeValue: (ty: Type | undefined) => any

  createResult: (ty: string) => [string, Node | undefined]
  getResultExpr: (key?: string) => string
  printResultNode: () => void

  addCustomEffect: (name: string, expr: string) => void
  runCustomEffect: (name: string, args: Type[]) => Promise<string[]>
  hasCustomEffect: (name: string) => boolean
}