8000 Expose adapter `init` & `render` types for Adapter Authors · Issue #2249 · sveltejs/kit · GitHub
[go: up one dir, main page]

Skip to content
Expose adapter init & render types for Adapter Authors #2249
@jthegedus

Description

@jthegedus

Describe the bug

Updating the Firebase adapter to the changes from #2215 was made easier by typing render, however finding the exact types for this was difficult. Once I found the type my refactoring was much easier and I even discovered a bug in my adapter for the Header types.

Expose the types.

Not sure if this constitutes a bug or feature request. I went bug because I think this is expected but not the current case.

Reproduction

You can see I have had to reference internal types @sveltejs/kit/types/internal to type this function:

/**
 * @param {import('firebase-functions').https.Request} request
 * @return {import('@sveltejs/kit/types/internal').Incoming}
 */
function toSvelteKitRequest(request) {

https://github.com/jthegedus/svelte-adapter-firebase/blob/c9c355eed0b26225ca4c549f7966aa695bccba37/src/files/handler.js#L29

I am not even sure I got the correct type.

Logs

No response

System Info

svelte-adapter-firebase on  fix/sync-kit
6934
-rawbody-changes [$⇕] is 📦 v0.10.4 via ⬢ v14.17.5 on ☁️  
➜ npx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"
npx: installed 1 in 1.319s

  System:
    OS: Linux 5.11 Pop!_OS 21.04
    CPU: (8) x64 AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx
    Memory: 6.73 GB / 15.32 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 14.17.5 - ~/.asdf/installs/nodejs/14.17.5/bin/node
    npm: 6.14.14 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Chrome: 92.0.4515.131
    Firefox: 91.0
  npmPackages:
    @sveltejs/kit: ^1.0.0-next.152 => 1.0.0-next.152

Severity

serious, but I can work around it

Additional Information

I believe exposing these types will make adapter development and refactoring more robust.

init is probably not necessary, though I do not know if it takes params and what they may be, so perhaps for visibility sake.

It would be good to just be able to force a type on

// TODO: hardcoding the relative location makes this brittle
import {init, render} from '../output/server/app.js';

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0