cubing / scramble-display

🔀 An HTML library to display puzzle scrambles. No knowledge of Javascript required!
https://experiments.cubing.net/scramble-display/
GNU General Public License v3.0
20 stars 1 forks source link

Type Definitions for JSX? #6

Open saranshgrover opened 4 years ago

saranshgrover commented 4 years ago

I'm trying to use the package for a typescript/react timer - and I'm unable to use the <scramble-display/> element. TS/JSX gets mad at me because the element is lowercase which means that it should be an intrinsic element (which it isn't). An easy fix for this is to add the following namesapce:

declare namespace JSX {
    interface IntrinsicElements {
        'scramble-display': any // https://wespeter.com/posts/consuming-web-component-react-typescript/
    }
}

I'm currently doing this myself - but it may be nice to have this in the package itself. The any type would ideally be replaced by the Element type, but I'm not sure if that typing is already there or not.