koajs / koajs/jwt

[feat] Add a `State` type export

Open
#197 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
1.3k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

## Describe the feature

I'd like to have a `State` type export so that I don't have to manually construct the state for each app I use this package in. e.g.

```ts
export interface State extends Koa.DefaultState {
// include the [key]: JwtPayload property
jwtOriginalError?: Error
}
```

## Checklist

- [x] I have searched through GitHub issues for similar issues.
- [x] I have completely read through the README and documentation.

Contributor guide

Open the contributing guide

Research direction

Start at the package's public export entry point and inspect how its current middleware types use Koa.DefaultState. Add the requested State type export with the documented JWT payload and original-error properties, then verify that consumers can import it without constructing the interface themselves.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
authentication, backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.