-
Notifications
You must be signed in to change notification settings - Fork 394
Update types.ts #1820
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
base: main
Are you sure you want to change the base?
Update types.ts #1820
Conversation
add types for routes & assets in PageEvent
|
❌ Deploy Preview for solid-start-landing-page failed. Why did it fail? →
|
@@ -1,81 +1,92 @@ | |||
import type { JSX } from "solid-js"; | |||
import { RequestEvent } from "solid-js/web"; | |||
import { HTTPEvent } from "vinxi/http"; | |||
import { RouteDefinition } from "@solidjs/router"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. This challenge the router-agnostic principle of solid-start
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if that's why it was previously any
, then i'm ok with it remaining this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make the type extendable like how Tanstack Table does with its meta
. Relevant code.
declare module '@tanstack/table-core' {
interface TableMeta<TData extends RowData> {
foo: string
}
}
So a solid-start user's code could be
import { RouteDefinition } from "@solidjs/router";
export interface Route extends RouteDefinition {
page: boolean;
filePath: string;
id: string;
$component: {
src: string;
import: () => Promise<any>;
};
}
And solid-start's types.ts would need to do something like
export interface PageEventRoutes {}
export interface PageEvent extends RequestEvent {
manifest: any;
assets: Asset[];
routes: PageEventRoutes[];
// remainder of def
}
Giving it an explicit named type would make it easier to extend, I think? idk haven't tested any of this, just theorycrafting.
add types for routes & assets in PageEvent
PR Checklist
Please check if your PR fulfills the following requirements:
What is the current behavior?
What is the new behavior?
Other information