Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinraja committed Jun 18, 2022
1 parent 8573d77 commit 9f5b782
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/ts-morph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,22 @@ export const getProcedureDefinitions = () => {

const appRouterDeclaration = exportDeclaration

const procedures = exportDeclaration.getType().getPropertyOrThrow('queries').getTypeAtLocation(appRouterDeclaration)
const procedures = exportDeclaration
.getType()
.getPropertyOrThrow('queries')
.getTypeAtLocation(appRouterDeclaration)
// get all query procedures
.getProperties()

const procedureDefinitions = procedures.map((procedure) => {
const procedureType =
procedure.getTypeAtLocation(appRouterDeclaration).getCallSignatures()[0].getReturnType().getTypeArguments()[0]
const procedureType = procedure
.getTypeAtLocation(appRouterDeclaration)
// get function type
.getCallSignatures()[0]
// get return type of function
.getReturnType()
// unwrap Promise<Type>
.getTypeArguments()[0]

return {
name: procedure.getName(),
Expand Down

0 comments on commit 9f5b782

Please sign in to comment.