Skip to content

Commit 3763b24

Browse files
committed
[fix] ActionData type
Closes #6631
1 parent e20425f commit 3763b24

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/blue-glasses-compete.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
[fix] ActionData type

packages/kit/types/index.d.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
TrailingSlash
1717
} from './private.js';
1818
import { SSRNodeLoader, SSRRoute, ValidatedConfig } from './internal.js';
19-
import { HttpError, Redirect, ValidationError } from '../src/runtime/control.js';
19+
import { HttpError, Redirect } from '../src/runtime/control.js';
2020

2121
export { PrerenderOption } from './private.js';
2222

@@ -39,6 +39,12 @@ export type AwaitedActions<T extends Record<string, (...args: any) => any>> = {
3939
[Key in keyof T]: UnpackValidationError<Awaited<ReturnType<T[Key]>>>;
4040
}[keyof T];
4141

42+
// Needs to be here, else ActionData will be resolved to unknown - probably because of "d.ts file imports .js file" in combination with allowJs
43+
interface ValidationError<T extends Record<string, unknown> | undefined = undefined> {
44+
status: number;
45+
data: T;
46+
}
47+
4248
type UnpackValidationError<T> = T extends ValidationError<infer X> ? X : T;
4349

4450
export interface Builder {

0 commit comments

Comments
 (0)