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

JSX type definition in Preact 8 is moved into preact namespace or JSX type definition is added to global for compatibility #1811

Closed
38elements opened this issue Jul 27, 2019 · 6 comments
Labels
8.x Related to 8.x or prior versions enhancement help wanted types

Comments

@38elements
Copy link
Contributor

38elements commented Jul 27, 2019

The namespace of JSX was changed.
This is breaking change.
I think that it is better to specify in the release notes.

preact/src/index.d.ts

Lines 6 to 8 in b4e059a

declare namespace preact {
export import JSX = JSXInternal;

preact/src/preact.d.ts

Lines 168 to 170 in 3aaa578

declare global {
namespace JSX {
interface Element extends preact.VNode<any> {

To solve the following issue, I think that it is better to add JSX type definition to global.

developit/unistore#158

I think it is better that JSX type definition in global be deprecated.

@38elements 38elements changed the title Add JSX type definition to global namespace for compatibility Add JSX type definition to global for compatibility Jul 27, 2019
@ForsakenHarmony
Copy link
Member

To solve the following issue, I think that it is better to add JSX type definition to global.

I think it is better that JSX type definition in global be deprecated.

So uhh which one are you asking for?

global was removed because it conflicted with react

@ForsakenHarmony ForsakenHarmony added needs-more-info The issue doesn't contain enough information to be able to help question types labels Jul 27, 2019
@38elements
Copy link
Contributor Author

38elements commented Jul 27, 2019

So uhh which one are you asking for?

JSX is added to global.
And JSX exists global until Preact 8 support is terminated.

Or JSX in Preact 8 is moved into preact namespace.

@38elements 38elements changed the title Add JSX type definition to global for compatibility JSX type definition in Preact 8 is moved into preact namespace or JSX type definition is added to global for compatibility Jul 29, 2019
@38elements
Copy link
Contributor Author

I think it is better that JSX type definition in Preact 8 is moved into preact namespace.

@38elements 38elements reopened this Jul 29, 2019
@ForsakenHarmony ForsakenHarmony added enhancement help wanted 8.x Related to 8.x or prior versions and removed needs-more-info The issue doesn't contain enough information to be able to help question labels Jul 29, 2019
@ForsakenHarmony
Copy link
Member

Release in v8.5.0

@aMarCruz
Copy link

aMarCruz commented Aug 25, 2019

Great, now porting my 8.x preact app to 10 breaks my toolchain because "JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists".

image

My app uses JavaScript with TS 3.5 only to enable // @ts-check.
Using @types/react fixes this issue but breaks other things, I'm not using preact/compat.

@38elements
Copy link
Contributor Author

In 8.4.x, JSX exists in global namespace.
In 8.5+, JSX exists in global namespace and preact namespace.
In 10, JSX exists in preact namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Related to 8.x or prior versions enhancement help wanted types
Projects
None yet
Development

No branches or pull requests

3 participants