file-drop icon indicating copy to clipboard operation
file-drop copied to clipboard

Typescript typings bind us to react and preact too much

Open PaulKinlan opened this issue 7 years ago • 4 comments

We have to the namespacing for JSX and the custom element name in the code which means I will have to potentially support every framework in the future to ensure typings work.

Instead we should pull the namespace out into some docs and make sure developers include it in their projects... that way they can also change the element name just for their project.

PaulKinlan avatar Oct 18 '18 08:10 PaulKinlan

Hm. I think you should add a separate preact/react.ts file where you export a TypeScript type that the importing project can include and hook up to the JSX namespace.

surma avatar Oct 18 '18 08:10 surma

My worry is that my dependencies now include preact, and then react typings.... I'm not particularly sure we should force people to DL these to use the project. I also worry that in the future I might need something for other new frameworks too....

PaulKinlan avatar Oct 18 '18 09:10 PaulKinlan

Hmmmmmm fair point. You could just export a Props type that can be easily used for the JSX type definitions.

surma avatar Oct 18 '18 12:10 surma

I am going to do this after launch of the project.

PaulKinlan avatar Oct 21 '18 14:10 PaulKinlan