How to extend Hono's JWTPayload

I want to extend the default JWTPayload interface.
import type { JWTPayload } from 'hono/utils/jwt/types'

export interface DekadaJWTPayload extends JWTPayload {
sub: string
jti: string
adminId: string
crmUserId: string
cmsUserId: string
studentId: string
teacherId: string
}
import type { JWTPayload } from 'hono/utils/jwt/types'

export interface DekadaJWTPayload extends JWTPayload {
sub: string
jti: string
adminId: string
crmUserId: string
cmsUserId: string
studentId: string
teacherId: string
}
am trying to extend JWTPayload via a .d.ts file but TypeScript doesn't seem to pick up the augmentation.
import { DekadaJWTPayload } from '@dekada/types';
import 'hono/utils/jwt/types';

declare module 'hono/utils/jwt/types' {
interface JWTPayload extends DekadaJWTPayload {}
}
import { DekadaJWTPayload } from '@dekada/types';
import 'hono/utils/jwt/types';

declare module 'hono/utils/jwt/types' {
interface JWTPayload extends DekadaJWTPayload {}
}
What I'm trying to do, is to make typescript pick types after verify helper from hono/jwt.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?