fix: expose TypeScript package subpaths#2818
Open
DivyamTalwar wants to merge 1 commit into
Open
Conversation
|
@DivyamTalwar is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
2d4e7a4 to
3875801
Compare
The TypeScript docs reference package subpaths that were not present in the export map, so consumers following those examples could not rely on package-level resolution for metrics, models, kebab-case test cases, or evaluate helpers. This also aligns the existing annotation type subpath with a runtime export. Constraint: Keep the change additive and limited to documented or already-advertised TypeScript entrypoints. Rejected: Renaming or removing the existing testCase subpath | It may already be used by package consumers. Confidence: high Scope-risk: narrow Directive: Keep future public TypeScript subpaths covered by package export smoke tests. Tested: cd typescript && npm test -- package-exports.test.ts; cd typescript && npm run test:package-exports; cd typescript && npm run lint; temporary external TypeScript consumer compile check; git diff --check origin/main...HEAD Not-tested: Full cd typescript && npm test -- --runInBand passes locally | existing suite requires missing OPENAI_API_KEY and CONFIDENT_API_KEY, has an optional OpenAI Agents MCP dependency resolution failure, and includes an existing bad import in test/test-core/evaluate.test.ts.
3875801 to
6f880f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The TypeScript package documents imports such as
deepeval/metrics,deepeval/models,deepeval/test-case, anddeepeval/evaluate, but thosesubpaths were not exposed through the package export map. The broken examples are
in
typescript/src/metrics/README.mdlines 22-23, 196, and 205, plustypescript/src/models/README.mdline 116. This adds the missing export andtypesVersionsentries, preserves the existing camelCasedeepeval/testCasealias for compatibility, and reconciles the already-advertised
deepeval/annotationtype subpath with a runtime export.Changes
./metrics,./models,./test-case, and./evaluate../metricsand./models, test-case examples use kebab-case./test-case,and evaluation examples use
./evaluate../annotationto match the existingtypesVersions.annotationentry.typesVersions.typesVersionsin sync,while also covering the currently documented subpaths and the existing
./testCasecompatibility alias.even when the broader Jest suite fails earlier.
sufficient for checkout and package validation.
Why this matters
Users following the TypeScript examples should be able to import the documented
SDK entrypoints through the published package. TypeScript users also should not
see type metadata for a subpath that fails at runtime. The new tests make the
current package metadata and built export contract explicit so future export-map
regressions are caught early.
Tests
Commands run:
cd typescript && npm ci— passedcd typescript && npm test -- package-exports.test.ts— passed(17 tests)
cd typescript && npm run test:package-exports— passedcd typescript && npm run lint— passed with existing warnings insrc/test-case/llm-test-case.tsandsrc/tracing/tracing.tscd typescript && npx prettier --check test/test-core/package-exports.test.ts test/test-core/package-exports-smoke.cjs— passed
cd typescript && npm run build— passed as part ofnpm run test:package-exportsrequire.resolve,require, dynamicimport(), and emitted file checksfor
deepeval/metrics,deepeval/models,deepeval/test-case,deepeval/evaluate,deepeval/testCase, and safe package subpaths after build— passed through
npm run test:package-exportsnpm packandnpm install --omit=dev— passed throughnpm run test:package-exportsdeepeval/integrations/langchain—passed; the smoke test verifies
@langchain/coreis absent in the productionconsumer install and that CJS/ESM imports fail with the expected missing-peer
error
node_modules/deepevalsymlink and imports fromdeepeval/annotation,deepeval/metrics,deepeval/models,deepeval/test-case,deepeval/evaluate, anddeepeval/testCase— passedgit diff --check origin/main...HEAD— passed before commitAlso run:
cd typescript && npm test -- --runInBand— failed for pre-existing localenvironment/repo reasons: missing
OPENAI_API_KEY, missingCONFIDENT_API_KEY, optional OpenAI Agents MCP dependency resolution, and anexisting bad import in
test/test-core/evaluate.test.ts. Theevaluate.test.tsfailure imports an internal source path(
../../src/confident/evaluate) that is absent onmain; it is separate fromthe
deepeval/evaluatepackage subpath added here.runs export validation after successful dependency installation even when
unrelated Jest failures occur earlier in the job, so the new package-export
contract remains visible.
formatting drift in 66 source files. The PR-owned test files pass targeted
Prettier checks and are no longer listed by that workflow.
Risk
Risk level: low
The change is additive package metadata and keeps the existing
./testCaseentrypoint intact. Rollback is straightforward: remove the added export/type
entries and the package export smoke test.
Issue
No existing issue. This was discovered during repository analysis.
Notes for maintainers
This intentionally supports only the subpaths already used by the TypeScript
examples, the existing compatibility alias, or an existing
typesVersionspublictype entry. Other namespace-style entrypoints can be considered separately if
maintainers want broader export-map symmetry.