Skip to content

feat(typescript-client): replace Promise<any> with concrete generated types #1640

Open
solidprinciples wants to merge 1 commit into
vectorize-io:mainfrom
solidprinciples:feat/typescript-promise-types
Open

feat(typescript-client): replace Promise<any> with concrete generated types #1640
solidprinciples wants to merge 1 commit into
vectorize-io:mainfrom
solidprinciples:feat/typescript-promise-types

Conversation

@solidprinciples
Copy link
Copy Markdown

Summary

The directive, mental model, and document methods on HindsightClient were all typed as Promise<any>. The generated types in types.gen.ts already had correct response shapes - they just weren't being used.

  • Replace Promise<any> with concrete types across 13 methods
  • Re-export all new types from the package entry point
  • getMentalModelHistory typed as Promise<unknown> - the OpenAPI spec has no defined response schema for this endpoint

No runtime behavior changes. Types only.

Changes

Method Before After
createDirective Promise<any> Promise<DirectiveResponse>
listDirectives Promise<any> Promise<DirectiveListResponse>
getDirective Promise<any> Promise<DirectiveResponse>
updateDirective Promise<any> Promise<DirectiveResponse>
createMentalModel Promise<any> Promise<CreateMentalModelResponse>
listMentalModels Promise<any> Promise<MentalModelListResponse>
getMentalModel Promise<any> Promise<MentalModelResponse>
refreshMentalModel Promise<any> Promise<AsyncOperationSubmitResponse>
updateMentalModel Promise<any> Promise<MentalModelResponse>
getMentalModelHistory Promise<any> Promise<unknown>
getDocument Promise<any | null> Promise<DocumentResponse | null>
listDocuments Promise<any> Promise<ListDocumentsResponse>
updateDocument Promise<any> Promise<UpdateDocumentResponse>

Test plan

  • tsc --noEmit passes clean
  • All 32 existing tests pass

@solidprinciples
Copy link
Copy Markdown
Author

@nicoloboschi - noticed the package.json links to your fork/repo (?) - worthwhile to update it in this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant