Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] It would be nice TypeScript support #10

Open
silvioprog opened this issue Dec 2, 2020 · 3 comments
Open

[FEATURE REQUEST] It would be nice TypeScript support #10

silvioprog opened this issue Dec 2, 2020 · 3 comments

Comments

@silvioprog
Copy link

silvioprog commented Dec 2, 2020

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.

@xnimorz
Copy link
Owner

xnimorz commented Dec 2, 2020

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
Copy link
Owner

xnimorz commented Dec 2, 2020

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

@xnimorz
Copy link
Owner

xnimorz commented Dec 8, 2020

I've cut a version with value = ''

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

No branches or pull requests

2 participants