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

Setting url label not working after upgrade from 0.4.2 to 0.6.0 #49

Open
onevcard-team opened this issue Oct 25, 2023 · 2 comments
Open
Assignees

Comments

@onevcard-team
Copy link

Hello,

we have been using version 0.4.2 and are now refactoring our api so we upgraded the package to version 0.6.0 and now a few things are not working anymore.

We are setting a url and also adding a label to it like this:

    card.setProperty("item1URL", "item1.URL", `https\\://onevcard.app/v/${id}`);
    card.setProperty("item1LABLE", "item1.X-ABLabel", "Meine Digitale Visitenkarte");

Now the setProperty does not have the type string anymore for the element rather now the type Element which does not allow to set custom elements like item1URL or item1LABLE. Is there a new way of doing this?

@onevcard-team onevcard-team changed the title Setting url label not working after upgrade from 0.4.2 to 0.6.0 URGENT: Setting url label not working after upgrade from 0.4.2 to 0.6.0 Oct 25, 2023
@joaocarmo joaocarmo self-assigned this Mar 9, 2024
@joaocarmo joaocarmo changed the title URGENT: Setting url label not working after upgrade from 0.4.2 to 0.6.0 Setting url label not working after upgrade from 0.4.2 to 0.6.0 Mar 9, 2024
@joaocarmo joaocarmo added the bug label Mar 9, 2024
@joaocarmo
Copy link
Owner

Thank you for opening an issue, but keep in mind that labeling as URGENT is not necessary. I work on these projects on my free time, although I try to be as responsive as possible.

I'm not sure what the problem is exactly, but I will take a look.

You are also encouraged to fork the library and create a pull request for any issues you might find.

@joaocarmo
Copy link
Owner

I believe you may be referring to a TypeScript error due to the Element type being more restrictive. Unfortunately, we need to ensure that we only allow for valid elements to be added. If you wish to bypass this check, you need to explicitly tell TypeScript to ignore it either by (1) casting it to any or (2) using an annotation.

import VCard from 'vcard-creator'

const vCard = new VCard()

const id = '1234567890'

vCard.setProperty(
  'item1URL' as any, // using a non-standard element
  'item1.URL',
  `https\\://onevcard.app/v/${id}`,
)
vCard.setProperty(
  // @ts-expect-error using a non-standard element
  'item1LABLE',
  'item1.X-ABLabel',
  'Meine Digitale Visitenkarte',
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants