Skip to content

ActionData generated type missing some properties in the template because of the way it does union #8865

@madupuis90

Description

@madupuis90

Describe the bug

This seems to be only a problem whenever you are using form actions with multiple named actions.
If you have multiple actions that return different objects, you will get "Property 'x' does not exist on type" errors from typescript.

This is a bit annoying since you then have to define your own types instead of using SvelteKit generated types.

(I'm not sure if this is a bug or intended)

Related ?:

Reproduction

https://github.com/madupuis90/form-actions-type-github

This is the simply a create svelte app using the form action examples from the docs (with implemented register function instead of commented)

If you look in +page.svelte you will see the invalid types. Commenting the register action clears the errors.

Logs

No response

System Info

System:
    OS: Linux 5.10 Ubuntu 20.04.5 LTS (Focal Fossa)
    CPU: (6) x64 Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
    Memory: 46.58 GB / 50.16 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 19.2.0 - ~/.nvm/versions/node/v19.2.0/bin/node
    npm: 9.2.0 - ~/.nvm/versions/node/v19.2.0/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.0 => 1.0.2
    @sveltejs/kit: ^1.0.0 => 1.3.10
    svelte: ^3.54.0 => 3.55.1
    vite: ^4.0.0 => 4.1.1

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions