Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: createServerFn does not accept branded strings #3157

Open
ben-pr-p opened this issue Jan 13, 2025 · 0 comments
Open

types: createServerFn does not accept branded strings #3157

ben-pr-p opened this issue Jan 13, 2025 · 0 comments
Labels
types Changes to the typescript types

Comments

@ben-pr-p
Copy link

ben-pr-p commented Jan 13, 2025

Which project does this relate to?

Start

Describe the bug

Code:

export const listWidgets = createServerFn({ method: "GET" }).handler(
  async () => {
    return [
      {
        id: "1" as string & {
          __brand: "id";
        },
        name: "Widget 1",
      },
    ];
  }
);

Type error:
Image

 Type '() => string' is not assignable to type '"Function is not serializable"'

Is the type error.

Steps to Reproduce the Bug or Issue

Code above.

Expected behavior

It should allow branded strings - commonly used for database IDs, etc.

Screenshots or Videos

No response

Platform

    "@tanstack/react-router": "^1.95.5",
    "@tanstack/start": "^1.95.5",

Additional context

No response

@schiller-manuel schiller-manuel added the types Changes to the typescript types label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types Changes to the typescript types
Projects
None yet
Development

No branches or pull requests

2 participants