type ImmutablePrimitive = | undefined | null | boolean | string | number | Function; type ImmutableArray = ReadonlyArray>; type ImmutableMap = ReadonlyMap, Immutable>; type ImmutableSet = ReadonlySet>; type ImmutableObject = { readonly [K in keyof T]: Immutable }; // https://github.com/microsoft/TypeScript/issues/13923#issuecomment-557509399 export type Immutable = T extends ImmutablePrimitive ? T : T extends Array ? ImmutableArray : T extends Map ? ImmutableMap : T extends Set ? ImmutableSet : ImmutableObject; export type DecodedJWTHeader = { typ: "JWT"; alg: "RS256"; kid?: string; }; export type DecodedJWTPayload = Partial<{ [key: string]: any; iss: string; sub: string; aud: string | string[]; exp: number; nbf: number; iat: number; jti: string; }>;