sapper.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. declare module '@sapper/app' {
  2. // from sapper/runtime/src/app/types.ts
  3. // sapper doesn't export its types yet
  4. interface Redirect {
  5. statusCode: number
  6. location: string
  7. }
  8. // end
  9. function goto(href: string, opts?: { replaceState: boolean }): Promise<unknown>
  10. function prefetch(href: string): Promise<{ redirect?: Redirect; data?: unknown }>
  11. function prefetchRoutes(pathnames: string[]): Promise<unknown>
  12. function start(opts: { target: Node }): Promise<unknown>
  13. const stores: () => unknown
  14. export { goto, prefetch, prefetchRoutes, start, stores }
  15. }
  16. declare module '@sapper/server' {
  17. import { RequestHandler } from 'express'
  18. interface MiddlewareOptions {
  19. session?: (req: Express.Request, res: Express.Response) => unknown
  20. ignore?: unknown
  21. }
  22. function middleware(opts?: MiddlewareOptions): RequestHandler
  23. export { middleware }
  24. }
  25. declare module '@sapper/service-worker' {
  26. const timestamp: number
  27. const files: string[]
  28. const shell: string[]
  29. const routes: { pattern: RegExp }[]
  30. export { timestamp, files, files as assets, shell, routes }
  31. }