Skip to content

Conversation

@nexoscreator
Copy link

@nexoscreator nexoscreator commented Jan 28, 2025

Replaced withDefaults() in Adsbygoogle.vue with destructured default values for props to align with Vue's best practices and suppress compiler warnings.

🔗 Linked issue

Resolves #207
also #205

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 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

This pull request replaces the use of withDefaults() in Adsbygoogle.vue with destructured default values for props.

Why this change?

  • Aligns with Vue 3's best practices for handling props.
  • Resolves the compiler warning:
    WARN  [@vue/compiler-sfc] withDefaults() is unnecessary when using destructure with defineProps().
    Reactive destructure will be disabled when using withDefaults().
    Prefer using destructure default values, e.g., const { foo = 1 } = defineProps(...).
    

What problem does this solve?

It improves maintainability and readability of the code by eliminating unnecessary usage of withDefaults(), ensuring adherence to modern Vue conventions.

eplaced withDefaults() in Adsbygoogle.vue with destructured default values for props to align with Vue's best practices and suppress compiler warnings.
- Added `fluid` and `autorelaxed` to `AdFormats`.
- Introduced `AdLayouts` type with `in-article`, `in-feed`, and `fixed`.
- Updated `adLayout` type in `ModuleOptions` and `adsbygoogle.vue`.
@nexoscreator nexoscreator closed this by deleting the head repository Jun 30, 2025
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.

Warning: withDefaults() is unnecessary when using defineProps() with destructuring

2 participants