You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works. The resulting "transformed" type will have its class overridden such that it accepts either a string or any object with a toString method. And this will be reflected in all <svg> elements throughout the codebase.
The type of SVGComponent's props will not have taken into account the transformation, clearly because SVGAttributes here is imported directly from svelte/elements, which contains the default types.
You could also reference the svelteHTML namespace here like so:
But now this will only include the properties defined in ourSVGAttributes interface (that is, class), and not any of the others declared in the default SVGAttributes.
How are you supposed to do this sort of thing?
The text was updated successfully, but these errors were encountered:
You can use ComponentType<SvelteComponent<svelteHTML.IntrinsicElements['svg']>>. But once #2109 is fixed, you can use declare module 'svelte/elements' to define custom typing.
Say you have the following in your
app.d.ts
file:This works. The resulting "transformed" type will have its
class
overridden such that it accepts either a string or any object with atoString
method. And this will be reflected in all<svg>
elements throughout the codebase.But then consider something like this:
The type of
SVGComponent
's props will not have taken into account the transformation, clearly becauseSVGAttributes
here is imported directly fromsvelte/elements
, which contains the default types.You could also reference the
svelteHTML
namespace here like so:But now this will only include the properties defined in our
SVGAttributes
interface (that is,class
), and not any of the others declared in the defaultSVGAttributes
.How are you supposed to do this sort of thing?
The text was updated successfully, but these errors were encountered: