sveltejs / kit

web development, streamlined
https://svelte.dev/docs/kit
MIT License
18.71k stars 1.94k forks source link

Binding element 'update' implicitly has an 'any' type. (ts) #10491

Closed Bishwas-py closed 4 months ago

Bishwas-py commented 1 year ago

Describe the bug

When I imported (in +page.svelte) a Svelte component that has a form with use:enhace in it. It gave me the issue of Binding element 'update' implicitly has an 'any' type. (ts) on running npm run check. Is there a type that I missed to assign or something, like the SubmitFunction?

Reproduction

Create a svelte component, apply form-actions based use:enhance in that component and import that component in the relative +page.svelte. And run npm run check.

Logs

src/item/sectionComponents/blogs/tables/ContentRow.svelte:75:22

Error: Binding element 'update' implicitly has an 'any' type. (ts)
        <form method="POST" use:enhance={()=>{
            async ({ update }) => {
                update();

System Info

System:
    OS: Linux 6.2 Fedora Linux 36 (Workstation Edition)
    CPU: (8) x64 AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx
    Memory: 2.61 GB / 9.57 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 18.1.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.8.1 - /usr/local/bin/npm
    pnpm: 7.29.1 - ~/.local/share/pnpm/pnpm
  Browsers:
    Chrome: 115.0.5790.102
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0 
    @sveltejs/adapter-node: ^1.1.6 => 1.3.1 
    @sveltejs/kit: ^1.20.4 => 1.22.3 
    svelte: ^4.0.5 => 4.0.5 
    vite: ^4.4.2 => 4.4.3

Severity

annoyance

gtm-nayan commented 4 months ago

You're not returning the function so it can't infer the types.