langfuse-js icon indicating copy to clipboard operation
langfuse-js copied to clipboard

fix: correct return type for dataset item link function call

Open austin-tildei opened this issue 8 months ago • 1 comments

Problem

Re-submit the changes from #535 since they were reverted (unintentionally?)

TypeScript types appear to be inaccurate for the DatasetItem.link return type. The types indicate only an id: string property returned, but at runtime, there is all data associated with DatasetRunItem.

Changes

Re-submit the changes from #535 since they were reverted (unintentionally?)

update the return type of DatasetItem.link to reflect the DatasetRunItem schema, instead of just an object with an id property, as that's what comes back from the API in production.

Release info Sub-libraries affected

Bump level

  • [ ] Major
  • [ ] Minor
  • [X] Patch

Libraries affected

  • [X] All of them
  • [ ] langfuse
  • [ ] langfuse-node

Changelog notes

  • Updated return type for DatasetItem.Link to match DatasetRunItem

[!IMPORTANT] Update return type of LinkDatasetItem in types.ts to match actual API response.

  • TypeScript Types:
    • Update return type of LinkDatasetItem in types.ts from Promise<{ id: string }> to Promise<components['schemas']['DatasetRunItem']> to reflect actual API response.

This description was created by Ellipsis for 4209ee86d57beef9a620f22e29047dcce5ac531c. You can customize this summary. It will automatically update as commits are pushed.

Greptile Summary

Disclaimer: Experimental PR review

Updates the return type of DatasetItem.link function to correctly reflect the full DatasetRunItem schema returned by the API instead of just an ID property.

  • Changed return type in /langfuse-core/src/types.ts from Promise<{ id: string }> to Promise<components['schemas']['DatasetRunItem']>
  • Fixes type mismatch between TypeScript definition and actual API response
  • Improves type safety for dataset run item handling in the SDK

💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!

austin-tildei avatar May 13 '25 15:05 austin-tildei

@austin-tildei is attempting to deploy a commit to the langfuse Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 13 '25 15:05 vercel[bot]

Hey @hassiebp just checking to see if the team can take a look at this one? TIA!

austin-tildei avatar Jun 18 '25 15:06 austin-tildei

This will be addressed in our latest JS SDK major release: https://github.com/orgs/langfuse/discussions/8403 - thanks again for your contribution!

hassiebp avatar Aug 27 '25 15:08 hassiebp