Skip to content

[v3] Type error with the new error parameters #16722

Closed

Description

@WarningImHack3r

With the following App.Error:

declare global {
	namespace App {
		interface Error {
			/**
			 * A description, going in pair with a custom message.
			 * When provided, the error code is shown much more subtly
			 * and the description is shown where the title used to be.
			 */
			description?: string;
			/**
			 * Additional links to suggest going to in a button on the error page.
			 * Internal links must be `resolve`d for safety purposes, while
			 * external links can also be provided.
			 */
			links?: {
				text: string;
				href: ResolvedPathname | `https://${string}`;
			}[];
		}
	}
}

The deprecated error signature I used to use was:

error(status: number, body: Omit<App.Error, "status"> & {
    status?: App.Error["status"];
}): never

Like this:

error(400, {
	message: "...",
	description: "...",
	links: [/*...*/]
});

But now, when using the new format:

error(400, "...", {
	description: "...",
	links: [/*...*/]
});

It says the third parameter is not assignable to never, matching:

error(status: number, message?: string | undefined): never

With this error:

No overload matches this call. Overload 1 of 6,
(status: number, body: string, properties: never): never
, gave the following error. Argument of type
{ description: string; links: { text: string; href: string; }[]; }
is not assignable to parameter of type never. Overload 2 of 6,
(status: number, message: string, properties: never): never
, gave the following error. Argument of type
{ description: string; links: { text: string; href: string; }[]; }
is not assignable to parameter of type never. (ts 2769)

Presumably because my App.Error doesn't contain a status & message?

Originally posted by @WarningImHack3r in #16540 (comment)


I can indeed reproduce the issue on a fresh project: https://stackblitz.com/edit/github-uywelz5a?file=src%2Froutes%2F%2Bpage.server.ts
It functionally works, but the types don't and this errors out on the third param.

Activity

  1. added a commit that references this issue on Aug 11, 2026
    c5d0ce2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions