Skip to content

Ts types#45

Merged
ahellegit merged 16 commits intomainfrom
ts-types
Nov 18, 2025
Merged

Ts types#45
ahellegit merged 16 commits intomainfrom
ts-types

Conversation

@JimA-cyborg
Copy link
Contributor

@JimA-cyborg JimA-cyborg commented Nov 10, 2025

This is the PR for this task: https://github.com/cyborginc/cyborgdb-core/issues/492

Added new typescript types to avoid unknown and type: any. We need to review to make sure that the types make sense and that they're clearly named.

Once this is approved, we should update the documentation to reflect the new types we've added.

Copilot AI review requested due to automatic review settings November 10, 2025 15:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces comprehensive TypeScript type definitions to replace any and unknown types throughout the CyborgDB SDK, improving type safety and developer experience. The changes focus on adding strongly-typed interfaces for API responses, filter expressions, metadata, and error handling.

Key Changes:

  • Added new type definitions file (src/types.ts) with JSON types, filter expressions, and API response interfaces
  • Updated error handling across client.ts and encryptedIndex.ts to use type guards instead of any types
  • Enhanced type safety in LangChain integration and test files

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/types.ts Defines comprehensive type system including JSON types, filter expressions, API response interfaces, and type guard utilities
src/encryptedIndex.ts Replaces any types with proper type guards and strongly-typed return types for all API methods
src/client.ts Updates error handling with type guards and adds proper return type annotations to public methods
src/integrations/langchain/vectorstore.ts Applies new type definitions to replace any types in vector store operations
src/index.ts Exports new type definitions for public API consumption
src/tests/quick_flow.test.ts Adds null safety checks for metadata handling in test assertions
src/tests/basic_test.test.ts Updates function signatures with proper types and renames unused parameters
package.json Adds @langchain/core as external dependency in build configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@kkopczynski-cyborg kkopczynski-cyborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@lubna-khalid lubna-khalid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just had few questions

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ API Contract Change Detected

This PR modifies the public API contract of the CyborgDB JS SDK.

Please provide an explanation for this change:

  • Why is this change necessary?
  • Is this a breaking change or backward compatible?
  • Have you updated the documentation?

This review must be dismissed or addressed before the PR can be merged.

lubna-khalid
lubna-khalid previously approved these changes Nov 18, 2025
Copy link
Contributor

@lubna-khalid lubna-khalid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

ahellegit
ahellegit previously approved these changes Nov 18, 2025
@JimA-cyborg
Copy link
Contributor Author

⚠️ API Contract Change Detected

This PR modifies the public API contract of the CyborgDB JS SDK.

Please provide an explanation for this change:

  • Why is this change necessary?
  • Is this a breaking change or backward compatible?
  • Have you updated the documentation?

This review must be dismissed or addressed before the PR can be merged.

This change came from a different branch that's already been reviewed and approved. I merged it into this branch before we merge this branch into main.

@kkopczynski-cyborg
Copy link
Contributor

@JimA-cyborg can you confirm that the last merge from main into this branch didn't erase all the type definitions that were added? I'm no longer seeing any "files changed" between this branch and main

@JimA-cyborg JimA-cyborg dismissed stale reviews from ahellegit and lubna-khalid via 97466c8 November 18, 2025 15:53
@JimA-cyborg JimA-cyborg dismissed github-actions[bot]’s stale review November 18, 2025 15:56

This PR adds comprehensive TypeScript type definitions to the SDK and establishes an API contract test suite. This is backward compatible - the types only formalize the existing API
behavior. Documentation will be updated in a follow-up PR.

Copy link
Contributor

@kkopczynski-cyborg kkopczynski-cyborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing API contract tests seem to be a separate task, so LGTM!

@ahellegit ahellegit merged commit 1802198 into main Nov 18, 2025
13 of 17 checks passed
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.

4 participants

Comments