Skip to content

fix(path): accept readonly array in common() - #7368

Open
dannyshafer wants to merge 1 commit into
denoland:mainfrom
dannyshafer:path-common-readonly-2
Open

dannyshafer wants to merge 1 commit into
denoland:mainfrom
dannyshafer:path-common-readonly-2

Conversation

@dannyshafer

Copy link
Copy Markdown

Summary

common() in @std/path (and the posix and windows variants, plus the internal _common/common.ts helper) now takes readonly string[] instead of string[].

Motivation

Part of #5831. common() never mutates its paths argument, so callers holding a readonly array (for example one declared as const) currently get a type error for no reason. Other modules have already been updated the same way (#5832, #5735, #6639, #6911).

Test plan

  • Added common() accepts readonly arrays to path/common_test.ts, covering common(), posix.common() and windows.common(). It fails type-checking (TS2345) without the change and passes with it.
  • deno test path/: all common tests pass. The only failure was isGlob works with the input that includes large number of open brackets, a timing test that timed out in the (slow) environment this was run in and is unrelated to this change.
  • deno fmt --check path/ and deno lint path/ are clean.

This PR was prepared with an AI coding agent (Claude Code).

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.03%. Comparing base (f834d02) to head (c3f74e3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7368      +/-   ##
==========================================
- Coverage   95.04%   95.03%   -0.02%     
==========================================
  Files         619      618       -1     
  Lines       52012    51757     -255     
  Branches     9450     9403      -47     
==========================================
- Hits        49434    49185     -249     
+ Misses       2031     2022       -9     
- Partials      547      550       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant