fix(types): add ProviderDefaults to fix provider type resolution
resolves #2014
๐ Linked issue
resolves #2014
โ Type of change
- [ ] ๐ Documentation (updates to the documentation or readme)
- [x] ๐ Bug fix (a non-breaking change that fixes an issue)
- [ ] ๐ Enhancement (improving an existing functionality)
- [ ] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
The ProviderDefaults interface was missing from src/index.d.ts, causing DefaultProvider type to resolve to never during development.
This happened because in src/types/image.ts, the DefaultProvider type is defined as:
type DefaultProvider = ProviderDefaults extends Record<'provider', unknown> ? ProviderDefaults['provider'] : never
Without ProviderDefaults.provider being defined, the conditional type resolves to never, breaking provider type inference.
Changes:
- Added
ProviderDefaultsinterface withprovider: 'ipx'tosrc/index.d.ts - Removed unused
@ts-expect-errordirectives from tests (now that types work correctly)
Testing:
pnpm test:typespasses- Unit tests pass
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 6.99%. Comparing base (9fc971d) to head (53ed7ec).
:warning: Report is 3 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #2056 +/- ##
=====================================
Coverage 6.99% 6.99%
=====================================
Files 78 78
Lines 3629 3629
Branches 140 140
=====================================
Hits 254 254
Misses 3326 3326
Partials 49 49
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Thank you for taking the time to review and for the helpful feedback! ๐ I've updated the PR to only modify src/types/image.ts.
I've taken another look. Not entirely sure I got it right, but I added provider: 'ipx' to ProviderDefaults in src/types/module.ts.
Could you please check if this is the correct approach?๐๐ปโโ๏ธ
I don't think this is right either. that interface is populated dynamically via types that nuxt generates, which should certainly include ipx