Skip to content

Fix typesVersions #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025
Merged

Conversation

andrewbranch
Copy link
Member

Fixes #846

Copy link
Contributor

@Copilot 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 fixes issues related to typesVersions handling by updating baseline error outputs and correcting the logic in package JSON and module resolution code.

  • Updated baseline errors to reflect the reduced error count in module resolution tests.
  • Reversed a semver condition and updated the assignment of the paths variable for clarity in cache.go.
  • Modified the package info handling in resolver.go to unconditionally fetch version paths when package info exists.

Reviewed Changes

Copilot reviewed 19 out of 36 changed files in this pull request and generated no comments.

File Description
testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=nodenext).errors.txt Updated baseline error counts and removed outdated error entries.
internal/packagejson/cache.go Fixed semver condition and improved assignment logic for paths variable.
internal/module/resolver.go Changed the logic to always get versionPaths if the package exists, then conditionally process candidate matching.
Files not reviewed (17)
  • testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node16).errors.txt: Language not supported
  • testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node16).errors.txt.diff: Language not supported
  • testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=nodenext).errors.txt.diff: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.ambientModules.errors.txt: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.ambientModules.errors.txt.diff: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.ambientModules.symbols: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.ambientModules.symbols.diff: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.ambientModules.types: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.ambientModules.types.diff: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.multiFile.errors.txt: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.multiFile.errors.txt.diff: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.multiFile.symbols: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.multiFile.symbols.diff: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.multiFile.types: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersions.multiFile.types.diff: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.ambient.symbols: Language not supported
  • testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.ambient.symbols.diff: Language not supported
Comments suppressed due to low confidence (3)

internal/packagejson/cache.go:42

  • Reversing the condition to 'if !ok' now correctly triggers the error trace for invalid semver ranges; please confirm that this change is intended.
if !ok {

internal/packagejson/cache.go:99

  • [nitpick] Using the local 'paths' variable for updating rather than directly modifying v.paths improves clarity; please verify that the subsequent reassignment to v.paths aligns with the expected logic.
paths.Set(key, slice)

internal/module/resolver.go:1261

  • [nitpick] Fetching versionPaths unconditionally when packageInfo exists may change the resolution behavior; please verify that this modification aligns with the intended logic for module resolution.
versionPaths = packageInfo.Contents.GetVersionPaths(r.getTraceFunc())

@andrewbranch andrewbranch added this pull request to the merge queue May 6, 2025
Merged via the queue into microsoft:main with commit 7208173 May 6, 2025
22 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.

typesVersions not respected
2 participants