Skip to content

Conversation

@emmatown
Copy link
Member

@emmatown emmatown commented Apr 1, 2025

The Session type parameter currently needs to be provided in a number places in .keystone/types currently which is confusing and easy to mess up since you have to remember to include the Session type in every place and if you forget you won't get an error, the Session type will just be any. This PR should be more straightforward since it only needs to be set once with module augmentation like this:

declare module ".keystone/types" {
  interface Session {
    something: string
  }
}

Note this is using module augmentation on the generated types rather than augmenting types in Keystone itself, this means that if you have multiple Keystone projects in the same TypeScript compilation, they won't interfere since the module augmentation only effects the specific generated types for each Keystone project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants