svelte-input-mask
svelte-input-mask copied to clipboard
[FEATURE REQUEST] It would be nice TypeScript support
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.
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.
I'll use the temporal fix and cut the release, thank you
I've cut a version with value = ''