moved pagecontext and introduced types to navigation/start/index.ts
MODIFY
packages/kit/src/runtime/navigation/start/index.ts
packages/kit/src/runtime/navigation/start/index.ts
@@ -6,10 +6,7 @@ import goto from '../goto';
import { page_store } from './page_store';
import { layout, ErrorComponent, components } from 'MANIFEST';
import root from 'ROOT';
-
-// TODO
-// import { PageContext } from '@sapper/common';
-type PageContext = any;
+import { PageContext } from '../types';
declare const __SVELTE__;
export const initial_data: InitialData = typeof __SVELTE__ !== 'undefined' && __SVELTE__;
@@ -22,8 +19,8 @@ let current_branch: Branch = [];
let current_query = '{}';
const stores = {
- page: page_store({}),
- preloading: writable(null),
+ page: page_store<PageContext>({} as any),
+ preloading: writable<boolean>(false),
session: writable(initial_data && initial_data.session)
};

MODIFY
packages/kit/src/runtime/navigation/types.ts
packages/kit/src/runtime/navigation/types.ts
@@ -43,3 +43,7 @@ export interface Page {
params: Record<string, string>;
query: Record<string, string | string[]>;
}
+
+export interface PageContext extends Page {
+ error?: Error
+};

MODIFY
packages/kit/src/runtime/stores/index.ts
packages/kit/src/runtime/stores/index.ts
import { getContext } from 'svelte';
import { Readable, Writable } from 'svelte/store';
-import { Page } from '../navigation/types';
+import { PageContext } from '../navigation/types';
// these Svelte types are not exported, so repeating them here.
type Subscriber<T> = (value: T) => void;
type Updater<T> = (value: T) => T;
-export type PageContext = Page & { error?: Error };
-
// const ssr = (import.meta as any).env.SSR;
const ssr = typeof window === 'undefined'; // TODO why doesn't previous line work in build?

moved pagecontext and introduced types to navigation/start/index.ts