synacor / preact-i18n

Simple localization for Preact.
BSD 3-Clause "New" or "Revised" License
206 stars 18 forks source link

Type conflict using preact@^10.5.7 + preact-i18n@2.3.0-preactx + @types/preact-i18n@^1.2.0 #54

Closed drackp2m closed 3 years ago

drackp2m commented 3 years ago

the compilation works, and the page is displayed, but in the console there are tons of errors, such as:

ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/preact-i18n/node_modules/preact/dist/preact.d.ts(942,13):
TS2320: Interface 'Element' cannot simultaneously extend types 'VNode<any>' and 'ReactElement<any, any>'.
  Named property 'key' of types 'VNode<any>' and 'ReactElement<any, any>' are not identical.
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/preact-i18n/node_modules/preact/dist/preact.d.ts(945,13):
TS2320: Interface 'ElementClass' cannot simultaneously extend types 'Component<any, any>' and 'Component<any, {}, any>'.
  Named property 'componentDidUpdate' of types 'Component<any, any>' and 'Component<any, {}, any>' are not identical.
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/preact-i18n/node_modules/preact/dist/preact.d.ts(945,13):
TS2320: Interface 'ElementClass' cannot simultaneously extend types 'Component<any, any>' and 'Component<any, {}, any>'.
  Named property 'componentWillUpdate' of types 'Component<any, any>' and 'Component<any, {}, any>' are not identical.
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/preact-i18n/node_modules/preact/dist/preact.d.ts(945,13):
TS2320: Interface 'ElementClass' cannot simultaneously extend types 'Component<any, any>' and 'Component<any, {}, any>'.
  Named property 'props' of types 'Component<any, any>' and 'Component<any, {}, any>' are not identical.
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/preact-i18n/node_modules/preact/dist/preact.d.ts(945,13):
TS2320: Interface 'ElementClass' cannot simultaneously extend types 'Component<any, any>' and 'Component<any, {}, any>'.
  Named property 'setState' of types 'Component<any, any>' and 'Component<any, {}, any>' are not identical.
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/preact-i18n/node_modules/preact/dist/preact.d.ts(945,13):
TS2320: Interface 'ElementClass' cannot simultaneously extend types 'Component<any, any>' and 'Component<any, {}, any>'.
  Named property 'shouldComponentUpdate' of types 'Component<any, any>' and 'Component<any, {}, any>' are not identical.
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/preact-i18n/node_modules/preact/dist/preact.d.ts(945,13):
TS2320: Interface 'ElementClass' cannot simultaneously extend types 'Component<any, any>' and 'Component<any, {}, any>'.
  Named property 'state' of types 'Component<any, any>' and 'Component<any, {}, any>' are not identical.
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/preact-i18n/node_modules/preact/dist/preact.d.ts(956,8):
TS2300: Duplicate identifier 'LibraryManagedAttributes'.
  ·
  ·
  ·
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/react/index.d.ts(3164,13):
TS2717: Subsequent property declarations must have the same type.  Property 'symbol' must be of type 'SVGAttributes', but here has type 'SVGProps<SVGSymbolElement>'.
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/react/index.d.ts(3165,13):
TS2717: Subsequent property declarations must have the same type.  Property 'text' must be of type 'SVGAttributes', but here has type 'SVGProps<SVGTextElement>'.
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/react/index.d.ts(3167,13):
TS2717: Subsequent property declarations must have the same type.  Property 'tspan' must be of type 'SVGAttributes', but here has type 'SVGProps<SVGTSpanElement>'.
ERROR in /home/user/Projects/drackp2m/esp3d-ui/node_modules/@types/react/index.d.ts(3168,13):
TS2717: Subsequent property declarations must have the same type.  Property 'use' must be of type 'SVGAttributes', but here has type 'SVGProps<SVGUseElement>'.

When I remove the type package, the compilation does not fail, but the imports are not done automatically.

pl12133 commented 3 years ago

The types haven't been updated for the preactx branch AFAIK, we would definitely be open to a PR for the types.

drackp2m commented 3 years ago

Unfortunately I don't have much time to review all that, I finally hid the errors by adding skipLibCheck => true in the compilerOptions section of my tsconfig.json file.

Although the bookstore itself works great. Nice job!!

pl12133 commented 3 years ago

Actually we may just be depending on https://github.com/DefinitelyTyped/DefinitelyTyped/pull/49843

cc @saschazar21 thank you for working on this!

drackp2m commented 3 years ago

Wow how fast you found the thread, hopefully they review / approve it soon. 🥳

drackp2m commented 3 years ago

Finally the pull request of @saschazar21 are merged and the issue has been fixed!

<3