types: createServerFn does not accept branded strings #3157
Open
Description
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 '() => 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