TwicPics / components

A Web component library that brings the power of TwicPics to your favorite web framework.
MIT License
54 stars 2 forks source link

Typescript support #14

Closed juan-kreuzfahrtberater closed 10 months ago

juan-kreuzfahrtberater commented 2 years ago

I am currently trying to use the TwicImg component in a tsx / nuxt application i had to declare globally a .d.ts file with the following content

declare let TwicImg: any;

i assume there should be a TwicImg type so that it can be used with tsx

jaubourg commented 2 years ago

That's weird, there should be a d.ts distributed with the package that takes care of this. @mbgspcii

Strift commented 2 years ago

I think I've had TypeScript auto-completion when using the React module, but not the Nuxt one. So maybe it's related to some Vue/Nuxt specifics.

jaubourg commented 2 years ago

@Strift it definitely is.

The Vue approach is to use a function that adds the TwicImg and TwicVideo to :

  1. the global Vue object in Vue2
  2. the App object in Vue3

The issue is that there never is an actual inclusion of TwicImg and/or TwicVideo in Vue / Nuxt. So there is no associated typescript definition.

I'm curious as to how other Vue components libs tackle the issue.

For reference, here is the code for the installation of the components in Vue (register is defined here).

mbgspcii commented 2 years ago

HI @juan-kreuzfahrtberater

We have been working on the problem you have reported.

In order to be sure that it actually fixes your concern, can you provide us with a user case that we could test on our side before making a release ?

Sincerely yours.

Miguel