Skip to content

The inferred type of 'create' cannot be named #1484

Description

@shishkin

Screenshot

$ tsc --build tsconfig.build.json
src/gql/client.generated/modules/client.ts:59:14 - error TS2742: The inferred type of 'create' cannot be named without a reference to '.pnpm/@wollybeard+kit@0.107.0_@effect+platform@0.93.8_effect@3.19.16__effect@3.19.16_zod@4.3.6/node_modules/@wollybeard/kit/configurator'. This is likely not portable. A type annotation is necessary.

59 export const create = $$Utilities.createConstructorWithContext(context);
                ~~~~~~

src/gql/client.generated/modules/client.ts:59:14 - error TS2742: The inferred type of 'create' cannot be named without a reference to '.pnpm/@wollybeard+kit@0.107.0_@effect+platform@0.93.8_effect@3.19.16__effect@3.19.16_zod@4.3.6/node_modules/@wollybeard/kit/ware'. This is likely not portable. A type annotation is necessary.

59 export const create = $$Utilities.createConstructorWithContext(context);
                ~~~~~~


Found 2 errors.

Description

Getting this error when trying to build declarations (.d.ts) for a project with generated graffle client with latest tsc after upgrading to the latest graffle@8.0.0-next.223 from graffle@8.0.0-next.173.

Had the same issue with latest tsup. Tried tsup's experimental declarations, same issue. Then went to barebones tsc. Still same issue when emitting declarations.

Reproduction Steps/Repo Link

Here is my graffle config:

import { Generator } from "graffle/generator";

const config = Generator.configure({
    schema: {
        type: "sdlFile",
        dirOrFilePath: "./src/schema.generated.graphql",
    },
    outputDirPath: "./src/gql/client.generated/",
    customScalars: true,
    scalars: "./src/gql/scalars/scalars.ts",
    lint: {
        missingGraphqlSP: false,
    },
});

export default config;

Here is my client module for which declarations fail:

import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
import { Graffle } from "./client.generated/_.js";

export interface GraphqlClient {
    fetch<
        TResult extends Record<string, any>,
        TVariables extends Record<string, any>,
    >(
        document: TypedDocumentNode<TResult, TVariables>,
        variables?: TVariables,
    ): Promise<TResult | null>;
}

export function graphqlClient(url: string = "/graphql"): GraphqlClient {
    const graffle = Graffle.create().transport({
        url: url,
    });
    return {
        fetch: (doc, vars) =>
            /* @ts-expect-error */
            graffle.gql(doc).$send(
                /* @ts-expect-error */
                vars,
            ),
    };
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions