How to add type definitions for model-viewer methods in React #3280
Answered
by
elalish
misaelvillaverde
asked this question in
Q&A
-
I'm having some trouble finding how should I declare the definitions for the model-viewer methods (like toBlob), the error I'm getting right now is: I have the following definition for the model-viewer as an IntrinsicElement on the global jsx scope: declare global {
namespace JSX {
interface IntrinsicElements {
"model-viewer": {
src: string;
"ios-src"?: string;
"camera-controls"?: boolean;
"disable-zoom"?: boolean;
"auto-rotate"?: boolean;
ar?: boolean;
autoplay?: boolean;
"shadow-intensity"?: number | string;
"ar-scale"?: number | string;
toBlob?: () => Promise<Blob>;
} & React.DetailedHTMLProps<
React.HTMLAttributes<HTMLElement>,
HTMLElement
>;
}
}
} Have you guys had this problem before? |
Beta Was this translation helpful? Give feedback.
Answered by
elalish
Mar 17, 2022
Replies: 1 comment 3 replies
-
I think you need to specify the types of its arguments as well. We're trying to make this easier with our next release; Ideally you should be able to import our |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
misaelvillaverde
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you need to specify the types of its arguments as well. We're trying to make this easier with our next release; Ideally you should be able to import our
lib
and get all our TS declarations automatically.