samouss/react-hooks-sse

Typescript compile error

Closed this issue · 6 comments

Hi,

Maybe I misused your package but I received this error:

src/App.tsx:9:6 - error TS2322: Type '{ children: Element; endpoint: string; }' is not assignable to type 'IntrinsicAttributes & Props'.
  Property 'children' does not exist on type 'IntrinsicAttributes & Props'.

9     <SSEProvider endpoint="https://localhost:8080/sse">

Is it related to the typescript version I'm using?

Thanks in advance
Jerome

Here my ts compiler options:

  "compilerOptions": {
    "target": "ESNext",
    "useDefineForClassFields": true,
    "lib": ["DOM", "DOM.Iterable", "ESNext"],
    "allowJs": false,
    "skipLibCheck": true,
    "esModuleInterop": false,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "ESNext",
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx"
  },

I did use 'vite' to configure my project.

I managed to reproduce the issue with a fresh Vite project. I think the issue is the mismatch between the React typings used VS the new ones. I didn't had the time to work on this project for a while. You should be able to fix the issue by yourself with a fork and updating the typings. I'll try to look at the issue but I don't have any ETA.

Great!! I had reached the same result as you.
FYI, here is the details explained for this change: Removal Of Implicit Children in React 18
Thanks

It should be fixed in the version 2.1.0. Let me know if you have any issue! Cheers!

I confirm that it is okay using 2.1.0.
Thanks a lot for your quick fix.
Regards
Jerome