Skip to content

[FEATURE] : Add runtime prop validation utility for SupportUsButton #40

Description

@jikrana1

Feature and its Use Cases

Problem

The component currently relies on TypeScript for compile-time prop validation, which provides excellent type safety during development.

However, runtime validation is not available when type checking is bypassed or when the library is consumed in plain JavaScript. If an invalid prop value is passed (for example, an unsupported Theme value or an incorrectly structured object), the component may behave unexpectedly without providing developers with a clear indication of the issue.

Proposed Solution

Introduce a lightweight runtime prop validation utility that validates important public props during development.

The validation should:

  • Validate important public props at runtime.
  • Display clear and descriptive console.warn() messages for invalid values.
  • Never throw errors or interrupt rendering.
  • Keep existing TypeScript type safety unchanged.
  • Remain framework-agnostic without relying on bundler-specific APIs.

To keep the component clean and maintainable, the validation logic can be extracted into a dedicated utility file.

Suggested Project Structure

src/
├── utils/
│   └── validateProps.ts

Additional Context

This feature is intended only as a development-time enhancement and should not affect production behavior.

If this approach aligns with the project's direction, I would be happy to work on this feature.

If possible, could this issue be assigned to me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions