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

Created on 27 Jul 2019  路  6Comments  路  Source: preactjs/preact

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

https://github.com/preactjs/preact/blob/b4e059ad00ff2d4dc71b0d69d4a148a204da6d5f/src/index.d.ts#L6-L8

https://github.com/preactjs/preact/blob/3aaa578270c0c6cd1fb7f5cf992737eec2934433/src/preact.d.ts#L168-L170

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

https://github.com/developit/unistore/pull/158

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

8.x enhancement help wanted types

All 6 comments

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

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.

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

Release in v8.5.0

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matthewmueller picture matthewmueller  路  3Comments

nopantsmonkey picture nopantsmonkey  路  3Comments

jasongerbes picture jasongerbes  路  3Comments

kossnocorp picture kossnocorp  路  3Comments

adriaanwm picture adriaanwm  路  3Comments