arnold.kokot
arnold.kokot
BABetter Auth
Created by arnold.kokot on 4/7/2025 in #help
Record<string, any> union in returned data object from authClient hook
const { data } = authClient.useActiveOrganization();

if(!data) {
return <>No data.</>;
}

// Data here has Record<string, any> in its type resulting in everything being of type any.
console.log(data.asdf);
// The above produces no error & does not autocomplete.
const { data } = authClient.useActiveOrganization();

if(!data) {
return <>No data.</>;
}

// Data here has Record<string, any> in its type resulting in everything being of type any.
console.log(data.asdf);
// The above produces no error & does not autocomplete.
In the above example I've completly lost typescript, anything im trying to access on data object is basicly of type any. I do have strict mode enabled in tsconfig.json, this is the full type of data :
const data: Prettify<{
id: string;
name: string;
createdAt: Date;
slug: string;
metadata?: any;
logo?: string | null | undefined;
} & Record<string, any> & {
members: (Member & {
user: {
id: string;
name: string;
email: string;
image: string | undefined;
};
})[];
invitations: Invitation[];
}> | null
const data: Prettify<{
id: string;
name: string;
createdAt: Date;
slug: string;
metadata?: any;
logo?: string | null | undefined;
} & Record<string, any> & {
members: (Member & {
user: {
id: string;
name: string;
email: string;
image: string | undefined;
};
})[];
invitations: Invitation[];
}> | null
Notice the Record<string, any> in there, is there anything i can do about it? Is this a bug or am I misunderstanding something?
2 replies