ShahenS
Convex Community17mo ago
3 replies
Shahen

ts-api-spec no type safety

Hello guys, I am trying multiple repos.
I have a simple "tasks"(same as example in docs) schema and function in project 1.
I ran
npx convex-helpers ts-api-spec
, copied the code over to project 2 in api.ts
But I am not getting any type safety when calling useQuery.

api.ts example:
import { FunctionReference, anyApi } from "convex/server";
import { GenericId as Id } from "convex/values";

export const api: PublicApiType = anyApi as unknown as PublicApiType;
export const internal: InternalApiType = anyApi as unknown as InternalApiType;

export type PublicApiType = {
    auth: {
        signIn: FunctionReference<
            "action",
            "public",
            {
                params?: any;
                provider?: string;
                refreshToken?: string;
                verifier?: string;
            },
            any
        >;
        signOut: FunctionReference<"action", "public", Record<string, never>, any>;
    };
    tasks: {
        get: FunctionReference<"query", "public", Record<string, never>, any>;
    };
};
export type InternalApiType = {};
Was this page helpful?