Skip to content

Commit

Permalink
[fix] improve type of init (#2544)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Oct 7, 2021
1 parent ff35e8d commit 2302a9e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-bags-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[fix] improve type of `init`
2 changes: 1 addition & 1 deletion packages/kit/src/core/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function preview({

const app_file = resolve(cwd, `${SVELTE_KIT}/output/server/app.js`);

/** @type {import('types/app').App} */
/** @type {import('types/internal').App} */
const app = await import(pathToFileURL(app_file).href);

/** @type {import('sirv').RequestHandler} */
Expand Down
9 changes: 1 addition & 8 deletions packages/kit/types/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ import { ReadOnlyFormData, RequestHeaders } from './helper';
import { ServerResponse } from './hooks';

export interface App {
init(options?: {
paths: {
base: string;
assets: string;
};
prerendering: boolean;
read(file: string): Buffer;
}): void;
init(): void;
render(incoming: IncomingRequest): Promise<ServerResponse>;
}

Expand Down
9 changes: 9 additions & 0 deletions packages/kit/types/internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ export interface PrerenderOptions {
}

export interface App extends PublicApp {
init(options?: {
paths: {
base: string;
assets: string;
};
prerendering: boolean;
read(file: string): Buffer;
}): void;

render(
incoming: IncomingRequest,
options?: {
Expand Down

0 comments on commit 2302a9e

Please sign in to comment.