-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
generated .../$types.d.ts has imports with '.ts'-extension which causes the new +page.server.ts/+page.svelte data prop to have type 'any' #5899
Comments
(also, this post: #5774 (comment) in the migration guide refers to |
it seems related to the file extensions used in the imports of the generated types in currently, I have import type * as Kit from '@sveltejs/kit';
interface RouteParams extends Partial<Record<string, string>> { id: string }
export type Errors = null;
export type PageData = Kit.AwaitedProperties<Awaited<ReturnType<typeof import('./proxy+page.server.ts').load>>>;
export type PageServerData = Kit.AwaitedProperties<Awaited<ReturnType<typeof import('./proxy+page.server.ts').load>>>;
export type PageServerLoad = Kit.ServerLoad<RouteParams, import('../../$types.js').LayoutServerData>;
export type Action = Kit.Action<RouteParams> which gives me the warning: if I remove the import type * as Kit from '@sveltejs/kit';
interface RouteParams extends Partial<Record<string, string>> { id: string }
export type Errors = null;
export type PageData = Kit.AwaitedProperties<Awaited<ReturnType<typeof import('./proxy+page.server').load>>>;
export type PageServerData = Kit.AwaitedProperties<Awaited<ReturnType<typeof import('./proxy+page.server').load>>>;
export type PageServerLoad = Kit.ServerLoad<RouteParams, import('../../$types.js').LayoutServerData>;
export type Action = Kit.Action<RouteParams> and now could be related to this: kit/packages/kit/src/core/sync/write_types.js Lines 439 to 449 in b30d2b6
|
@dummdidumm not sure if this is working as intended, I still get imports with the tried to remove |
update: see #5899 (comment) for the actual issue
Describe the bug
First off - maybe this is expected? But when I read:
https://kit.svelte.dev/docs/routing#$types
I thought that the
data
prop would be fully typed!With the
+page.server.ts
:and
+page.svelte
:I expected
data
to have the typebut instead, as noted earlier, I get
data: any
(hope you understand the notation used)Reproduction
see the description
can also clone or checkout my repo:
https://github.com/ollema/sersophane/tree/b1380f17998c430e7f91404f92d6fed21e37c001/src/routes/events/%5Bid%5D
I think this is not super hard to reproduce - either it should happen for everyone OR I might have just misinterpreted the $types chapter
Logs
I get this "problem" from vscode when viewing
/home/s0001325/work/sersophane/tsconfig.json
:Tried restarting vscode, tried reinstalling packages etc. it is probably not related but it was not there before the migration. Who knows!
My
tsconfig.json
is very simple:System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: