Git Product home page Git Product logo

Comments (8)

hayes avatar hayes commented on September 3, 2024

That doesn't seem expected, can you share more about your setup (eg what options/types are passed to your builder) or a reproduction? I don't see anything wrong with your setup, but I also haven't seen this in any of the other APIs I've worked on, so there is probably some combination of settings or something that is off

from pothos.

emroot avatar emroot commented on September 3, 2024

yeah for sure.
it only happens in VS code, when I run my pnpm type-check no ts errors there.

// builder.ts
import SchemaBuilder from '@pothos/core';
import WithInputPlugin from '@pothos/plugin-with-input';
import { DateTimeResolver, JSONResolver } from 'graphql-scalars';
import PrismaPlugin from '@pothos/plugin-prisma';
import PrismaUtilsPlugin from '@pothos/plugin-prisma-utils';
import RelayPlugin from '@pothos/plugin-relay';
import ScopeAuthPlugin from '@pothos/plugin-scope-auth';
import TracingPlugin, { isRootField } from '@pothos/plugin-tracing';
import ValidationPlugin from '@pothos/plugin-validation';
import { createSentryWrapper } from '@pothos/tracing-sentry';
import { Prisma } from '@prisma/client';
import { GraphqlContext } from '../pothos/context';
import type PrismaTypes from '../prisma/pothos-types';
import db from '../services/prisma';

const traceResolver = createSentryWrapper({
  includeArgs: true,
  includeSource: true,
});

const builder = new SchemaBuilder<{
  AuthScopes: {
    ...
  };
  Context: GraphqlContext;
  Objects: {
    ...
  };
  PrismaTypes: PrismaTypes;
  Scalars: {
    ID: {
      Output: number | string;
      Input: string;
    };
    DateTime: {
      Output: Date;
      Input: Date;
    };
    JSONObject: {
      Input: any;
      Output: any;
    };
  };
  Tracing: boolean | { formatMessage: (duration: number) => string };
}>({
  plugins: [
    TracingPlugin,
    WithInputPlugin,
    RelayPlugin,
    ScopeAuthPlugin,
    PrismaPlugin,
    PrismaUtilsPlugin,
    ValidationPlugin,
  ],
  relay: {
    cursorType: 'ID',
  },
  scopeAuth: {
    cacheKey: (value) => JSON.stringify(value),
    authScopes: async (context) => ({
      ...
    }),
  },
  prisma: {
    client: db,
    dmmf: Prisma.dmmf,
  },
  tracing: {
    default: (config) => isRootField?.(config),
    wrap: (resolver, options) => traceResolver(resolver, options),
  },
});

builder.queryType();
builder.mutationType();

builder.addScalarType('DateTime', DateTimeResolver, {});
builder.addScalarType('JSONObject', JSONResolver, {});

export { builder };
// schema.prisma
generator pothos {
  clientOutput = "@prisma/client"
  provider     = "prisma-pothos-types"
  output       = "./pothos-types.ts"
  prismaUtils  = true
}

Just tried upgrading my typescript from "typescript": "5.4.5" to "typescript": "5.5.4" and not I'm seeing this error when running pnpm type-check

from pothos.

hayes avatar hayes commented on September 3, 2024

Id recommend clearing out any tsbuildinfo files, and remove and reinstall node modules, and then restart vs code. If it's not showing up when you rub type checking via the cli, it might be a caching issue

from pothos.

emroot avatar emroot commented on September 3, 2024

Updated vs code to use my workspace version of typescript, instead of the default vs code (latest typescript) and it worked.

But looks like the issue is definitely with typescript 5.5.x

What version of ts are you using? Curious if this is just me or if other are having the same problem with ts 5.5.x

from pothos.

hayes avatar hayes commented on September 3, 2024

I've been using 5.5.4 without issues

from pothos.

emroot avatar emroot commented on September 3, 2024

ok thanks. I'll dig a little more on my end and see if I find anything.

from pothos.

hayes avatar hayes commented on September 3, 2024

We can leave this open for until we figure out whats going on. I just noticed you are using the validation plugin, which doesn't have a 4.0 version (its been renamed to plugin-zod)

from pothos.

hayes avatar hayes commented on September 3, 2024

Pushed up a repo with most of the code you provided on a branch of an old bug reproduction repo I had: https://github.com/hayes/pothos-prisma-alias-bug/tree/mh--expose-nullable-bug.

I wasn't able to reproduce the issue, but I am curious if this presents the same issue, or if you can expand it with whatever is missing that causes the issue

from pothos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.