Skip to content

Conversation

@ieedan
Copy link
Contributor

@ieedan ieedan commented Aug 13, 2024

This improves use when creating reusable components on top of the input.

  • Adds undefined to the country variable type
  • Removes newly dead code

Why?

In use cases when you are creating a reusable component that consumes TelInput you will create type errors by making your country prop optional.

export type Props = {
    // Component API calls for an optional country
    country?: CountryCode | null;
    // -- snip --
}

This will have a type error saying type CountryCode | null is not assignable to CountryCode | null | undefined

<TelInput
    bind:country
/>

Using npm link this PR removes the type error from my component.

ieedan added 3 commits August 13, 2024 07:07
- This allows the country to not be provided allowing for easier use in reusable components
@vercel
Copy link

vercel bot commented Aug 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-tel-input ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 13, 2024 0:23am

@gyurielf
Copy link
Owner

Thank you.

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