Skip to content
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

BREAKING(path): remove runtime type-checking #4954

Closed
wants to merge 1 commit into from

Conversation

iuioiua
Copy link
Collaborator

@iuioiua iuioiua commented Jun 4, 2024

What's changed

This change removes assertPath() and its use from @std/path.

Why was this change made?

assertPath() was an internal function that checked whether a provided string was a string (see implementation). In other words, it could catch an incorrectly typed variable when either not using TypeScript or bypassing the type-checker. In most environments, this function wasn't useful. Hence, the removal.

While the topic of runtime type-checking is still being discussed in #3888, this change was made to be consistent with the rest of the Standard Library in the meantime, which doesn't perform initial type-checking of arguments.

Migration guide

If using an environment that doesn't use TypeScript or bypasses the type-checker, and if needed, check that variables passed to @std/path API are the correct type manually.

Related

@github-actions github-actions bot added the path label Jun 4, 2024
Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.18%. Comparing base (cfb169e) to head (49fd253).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4954   +/-   ##
=======================================
  Coverage   92.18%   92.18%           
=======================================
  Files         487      486    -1     
  Lines       38751    38714   -37     
  Branches     5395     5394    -1     
=======================================
- Hits        35721    35688   -33     
+ Misses       2974     2970    -4     
  Partials       56       56           

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

@iuioiua iuioiua marked this pull request as ready for review June 4, 2024 08:47
@iuioiua iuioiua requested a review from kt3k as a code owner June 4, 2024 08:47
@kt3k
Copy link
Member

kt3k commented Jun 4, 2024

There seems no consensus reached in #3888. I'd suggest we should discuss this after the stabilization.

@iuioiua
Copy link
Collaborator Author

iuioiua commented Jun 4, 2024

We should be consistent in the meantime. We can come to a decision for the codebase as a whole later, right?

@kt3k
Copy link
Member

kt3k commented Jun 4, 2024

As I commented in #4946 (comment), there isn't such consistency in std.

@iuioiua iuioiua closed this Jul 10, 2024
@iuioiua iuioiua deleted the path-remove-assertPath branch July 10, 2024 05:29
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.

2 participants