Skip to content

Conversation

@aqu1les
Copy link

@aqu1les aqu1les commented Nov 7, 2025

closes #167

Using satisfies Plugin instead of explicitly typing it as Plugin helps avoid type widening and keeps the actual object type intact.
It still makes sure the object matches the Plugin interface, but gives better type inference and works nicer with newer TypeScript versions.

To manually test this change, just create a simple script using this plugin. Now the type definitions will be as expected:
image

Before:
image

Summary by CodeRabbit

  • Refactor
    • Improved type safety for the i18nVue plugin export through enhanced type declaration handling.

@coderabbitai
Copy link

coderabbitai bot commented Nov 7, 2025

Walkthrough

The change updates the TypeScript declaration of the i18nVue export in src/index.ts by replacing an explicit Plugin type annotation with a satisfies Plugin type assertion, enabling more precise type inference while maintaining plugin interface compliance.

Changes

Cohort / File(s) Summary
Type assertion refinement
src/index.ts
Replaced explicit Plugin type annotation with satisfies Plugin assertion on export, allowing TypeScript to infer the specific plugin object type while validating interface conformance

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

  • Single-line type system modification with no runtime behavior changes
  • Validate that the satisfies Plugin assertion correctly enforces type compatibility
  • Confirm the change resolves the TypeScript overload resolution issues referenced in the linked issue

Poem

🐰 A type so shy behind the wall,
Now satisfies the call!
No more Plugin chains so tight,
Inference dances in the light ✨
TypeScript smiles—all is right! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix: Vue plugin type definition' directly summarizes the main change: replacing explicit Plugin type annotation with a satisfies assertion to fix type compatibility issues.
Linked Issues check ✅ Passed The PR addresses issue #167 by replacing the Plugin type annotation with 'satisfies Plugin', which should preserve the actual ObjectPlugin type and resolve TypeScript overload matching errors.
Out of Scope Changes check ✅ Passed The changes are narrowly scoped to fixing the plugin type definition in src/index.ts, directly addressing the TypeScript type compatibility issue without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/index.ts (1)

126-126: Consider adding explicit App type annotation to the app parameter.

While the current implementation works with type inference, adding an explicit type annotation would improve code clarity and type safety, especially since this PR focuses on fixing type definitions.

-  install(app, options: PluginOptionsInterface = {}) {
+  install(app: App, options: PluginOptionsInterface = {}) {

Note: App is already imported from 'vue' (you may need to add it to line 1's import statement if not already present).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 758ddbf and a0c2bf0.

📒 Files selected for processing (1)
  • src/index.ts (2 hunks)
🔇 Additional comments (1)
src/index.ts (1)

125-137: Excellent fix for the type inference issue — verified and approved.

Using satisfies Plugin instead of : Plugin correctly preserves the object literal's specific type (allowing Vue's .use() to match the ObjectPlugin overload) while ensuring Plugin conformance. This directly resolves the "No overload matches this call" error from issue #167.

The project's TypeScript version (^4.9.5) fully supports the satisfies operator, so this change is production-ready with no compatibility concerns.

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.

Errors when building with TypeScript - No overload matches this call

1 participant