svelte-input-mask icon indicating copy to clipboard operation
svelte-input-mask copied to clipboard

[FEATURE REQUEST] It would be nice TypeScript support

Open silvioprog opened this issue 4 years ago • 3 comments

Hi.

Supposing this example:

<script>
class Order {
  document?: string;
}

let order = new Order();
</script>

<MaskInput
  bind:value={order.document}
  alwaysShowMask
  maskChar="_"
  mask="0000-000000-00000" />

it would be nice to add TypeScript solving problems like this:

(JSX attribute) value?: undefined
Type 'string | undefined' is not assignable to type 'undefined'.
  Type 'string' is not assignable to type 'undefined'.ts(2322)

Thank you!


EDIT:

To temporary solve the problem I just changed line 5 from export let value = undefined; to export let value = ""; and now the component works fine in a Sapper application with TypeScript support.

silvioprog avatar Dec 02 '20 13:12 silvioprog

Hi @silvioprog It's a great suggestion, however, I just changed my job and country, I don't think I'll have enough time in the nearest future.

You are welcome to PR me, otherwise, I'll fulfill this issue maybe a month later.

xnimorz avatar Dec 02 '20 16:12 xnimorz

I'll use the temporal fix and cut the release, thank you

xnimorz avatar Dec 02 '20 16:12 xnimorz

I've cut a version with value = ''

xnimorz avatar Dec 08 '20 00:12 xnimorz