Open
Description
any
type in getAccessTokenPayloadSecurely
isn't not helping making our code cleanr. Docs https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/sessions/claims/access-token-payload#reading-the-payload-on-the-frontend says it can return an object.
import Session from 'supertokens-web-js/recipe/session';
async function someFunc() {
if (await Session.doesSessionExist()) {
let accessTokenPayload = await Session.getAccessTokenPayloadSecurely();
let customClaimValue = accessTokenPayload.customClaim
}
}
// supertokens-auth-react/recipe/session/index.d.ts
static getAccessToken(input?: { userContext?: UserContext }): Promise<string | undefined>;
static getAccessTokenPayloadSecurely(input?: { userContext?: UserContext }): Promise<any>;
Could you replace any
for something like type | undefined
to improve cases like mine:
import { Data, type Either, type Option } from 'effect'
export type Listener = {
initialized: () => void
sessionUpdated: (
session: Either.Either<
Option.Option<SessionPayload>,
ErrorAbc
>,
) => void
}
Metadata
Metadata
Assignees
Labels
No labels