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

fix: fix resolvePath return type #172

Merged
merged 2 commits into from
Jun 19, 2023
Merged

Conversation

arbassett
Copy link
Contributor

@arbassett arbassett commented May 26, 2023

resolvePath return type is being lost when resolvePathSync is passed to pcall (Promise<any> instead of Promise<string>).

resolve has the same issue but its return type was being cast from Promise<any> to Promise<string> via the function signature. instead of casting any I updated pcall's types to reflect what is happening which fixes resolvePath types to Promise<string>

@codecov
Copy link

codecov bot commented Jun 19, 2023

Codecov Report

Merging #172 (49b7bc8) into main (26063d3) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #172      +/-   ##
==========================================
+ Coverage   85.79%   85.89%   +0.09%     
==========================================
  Files           8        8              
  Lines         859      865       +6     
  Branches      134      134              
==========================================
+ Hits          737      743       +6     
  Misses        122      122              
Impacted Files Coverage Δ
src/_utils.ts 97.77% <100.00%> (+0.15%) ⬆️
src/resolve.ts 88.66% <100.00%> (+0.23%) ⬆️

@pi0 pi0 changed the title fix: update pcall types to properly infer return type fix: fix resolvePath return type Jun 19, 2023
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot! Thanks!

(i have also added explicit types as additional safe guard)

@pi0 pi0 merged commit a7ed66a into unjs:main Jun 19, 2023
@arbassett arbassett deleted the fix-resolvePath-types branch June 19, 2023 13:02
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.

2 participants