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

How to use SVG type ? #41

Open
mieaw opened this issue Jul 24, 2023 · 3 comments
Open

How to use SVG type ? #41

mieaw opened this issue Jul 24, 2023 · 3 comments

Comments

@mieaw
Copy link

mieaw commented Jul 24, 2023

Error:
Property 'svg' does not exist on type 'JSX.IntrinsicElements'.ts

code:

import * as elements from "typed-html";

export const AddIcon = () => {
  return (
    <svg
      class="inline-block w-7 h-7 fill-[#7F8689] transition-colors group-hover:fill-primary-1 dark:fill-n-4"
      width="24"
      height="24"
      viewBox="0 0 24 24"
    >
      <path d="M12 3a9 9 0 1 1 0 18 9 9 0 1 1 0-18zm0 4.25a.75.75 0 0 0-.75.75h0v3.25H8l-.102.007A.75.75 0 0 0 8 12.75h0 3.25V16l.007.102A.75.75 0 0 0 12.75 16h0v-3.25H16l.102-.007A.75.75 0 0 0 16 11.25h0-3.25V8l-.007-.102A.75.75 0 0 0 12 7.25z"></path>
    </svg>
  );
};
@mieaw
Copy link
Author

mieaw commented Jul 24, 2023

bypass:

export const AddIcon = (): string => {
  return `<svg
  class="inline-block w-7 h-7 fill-[#7F8689] transition-colors group-hover:fill-primary-1 dark:fill-n-4"
  width="24"
  height="24"
  viewBox="0 0 24 24"
>
  <path d="M12 3a9 9 0 1 1 0 18 9 9 0 1 1 0-18zm0 4.25a.75.75 0 0 0-.75.75h0v3.25H8l-.102.007A.75.75 0 0 0 8 12.75h0 3.25V16l.007.102A.75.75 0 0 0 12.75 16h0v-3.25H16l.102-.007A.75.75 0 0 0 16 11.25h0-3.25V8l-.007-.102A.75.75 0 0 0 12 7.25z"></path>
</svg>`;
};


:/

@SamJBarney
Copy link

SamJBarney commented Jul 31, 2023

The src/jsx/intrinsic-elements.d.ts file doesn't contain the definitions for any of svg elements unfortunately. Someone would have to create a PR to do that.

@nicojs
Copy link
Owner

nicojs commented Aug 1, 2023

Yes, svg is notably missing. I remember back in the day not having time for it. Feel free to create a PR for it.

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

3 participants