Skip to content

[qwik] Re-export main types from core #11897

Closed
@ianlet

Description

@ianlet

Environment


  System:
    OS: Linux 6.10 Arch Linux
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
    Memory: 2.15 GB / 15.37 GB
    Container: Yes
    Shell: 3.7.1 - /usr/bin/fish
  Binaries:
    Node: 21.6.2 - ~/.asdf/installs/nodejs/21.6.2/bin/node
    Yarn: 1.22.19 - ~/.asdf/shims/yarn
    npm: 10.2.4 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 9.2.0 - ~/.asdf/installs/pnpm/9.2.0/bin/pnpm
  Browsers:
    Chromium: 129.0.6668.58
  npmPackages:
    @auth/core: ^0.34.2 => 0.34.2
    @auth/qwik: 0.2.2 => 0.2.2

Reproduction URL

https://github.com/ianlet/qwik-authjs-types

Describe the issue

The framework integration for Qwik doesn't re-export core types such as Session, User, their adapters, etc. which causes these 2 issues:

How to reproduce

In the reproduction repo, we can see here that even if we de-comment the section at the top and adjust to redeclare the proper module, we will still get the highlighted error.

Expected behavior

Using, for example, this:

declare module "@auth/qwik" {
  /**
   * The shape of the user object returned in the OAuth providers' `profile` callback,
   * or the second parameter of the `session` callback, when using a database.
   */
  interface User {}
  /**
   * The shape of the account object returned in the OAuth providers' `account` callback,
   * Usually contains information about the provider being used, like OAuth tokens (`access_token`, etc).
   */
  interface Account {}
 
  /**
   * Returned by `useSession`, `auth`, contains information about the active session.
   */
  interface Session {}
}
 
import { JWT } from "@auth/qwik/jwt"
 
declare module "@auth/qwik/jwt" {
  /** Returned by the `jwt` callback and `auth`, when using JWT sessions */
  interface JWT {
    /** OpenID ID Token */
    idToken?: string
  }
}

we should be able to extend the Session and other core types (User, Account, etc.) when using the @auth/qwik framework.

The documentation on module augmentation for qwik should reflect that as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions