graphql-prisma-typescript icon indicating copy to clipboard operation
graphql-prisma-typescript copied to clipboard

TypeScript Compile Issue

Open piesrtasty opened this issue 6 years ago • 10 comments

I keep running into the following and can't get the project running :(

Users/lukehamilton/Development/projects/lyra-api/node_modules/ts-node/src/index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/resolvers/Query.ts(22,3): error TS2322: Type '(_parent: QueryParent, _args: {}, ctx: Context) => Promise<PlaceNode[]>' is not assignable to type '(parent: QueryParent, args: {}, ctx: Context, info: GraphQLResolveInfo) => HomeParent[] | Promise<HomeParent[]>'.
  Type 'Promise<PlaceNode[]>' is not assignable to type 'HomeParent[] | Promise<HomeParent[]>'.
    Type 'Promise<PlaceNode[]>' is not assignable to type 'Promise<HomeParent[]>'.
      Type 'PlaceNode[]' is not assignable to type 'HomeParent[]'.
        Type 'PlaceNode' is not assignable to type 'HomeParent'.
          Property 'numRatings' is missing in type 'PlaceNode'.
src/resolvers/Query.ts(24,3): error TS2322: Type '(_parent: QueryParent, { min, max }: ArgsHomesInPriceRange, ctx: Context) => Promise<PlaceNode[]>' is not assignable to type '(parent: QueryParent, args: ArgsHomesInPriceRange, ctx: Context, info: GraphQLResolveInfo) => HomeParent[] | Promise<HomeParent[]>'.
  Type 'Promise<PlaceNode[]>' is not assignable to type 'HomeParent[] | Promise<HomeParent[]>'.
    Type 'Promise<PlaceNode[]>' is not assignable to type 'Promise<HomeParent[]>'.
src/resolvers/Query.ts(33,3): error TS2322: Type '(_parent: QueryParent, _args: {}, ctx: Context) => Promise<RestaurantNode[]>' is not assignable to type '(parent: QueryParent, args: {}, ctx: Context, info: GraphQLResolveInfo) => ReservationParent[] | Promise<ReservationParent[]>'.
  Type 'Promise<RestaurantNode[]>' is not assignable to type 'ReservationParent[] | Promise<ReservationParent[]>'.
    Type 'Promise<RestaurantNode[]>' is not assignable to type 'Promise<ReservationParent[]>'.
      Type 'RestaurantNode[]' is not assignable to type 'ReservationParent[]'.
        Type 'RestaurantNode' is not assignable to type 'ReservationParent'.
          Property 'pictures' is missing in type 'RestaurantNode'.
src/resolvers/Query.ts(35,3): error TS2322: Type '(_parent: QueryParent, _args: {}, ctx: Context) => Promise<NeighbourhoodNode[]>' is not assignable to type '(parent: QueryParent, args: {}, ctx: Context, info: GraphQLResolveInfo) => NeighbourhoodParent[] | Promise<NeighbourhoodParent[]>'.
  Type 'Promise<NeighbourhoodNode[]>' is not assignable to type 'NeighbourhoodParent[] | Promise<NeighbourhoodParent[]>'.
    Type 'Promise<NeighbourhoodNode[]>' is not assignable to type 'Promise<NeighbourhoodParent[]>'.
      Type 'NeighbourhoodNode[]' is not assignable to type 'NeighbourhoodParent[]'.
        Type 'NeighbourhoodNode' is not assignable to type 'NeighbourhoodParent'.
          Property 'city' is missing in type 'NeighbourhoodNode'.
src/resolvers/Query.ts(40,3): error TS2322: Type '(_parent: QueryParent, { cities }: ArgsExperiencesByCity, ctx: Context) => Promise<CityNode[]>' is not assignable to type '(parent: QueryParent, args: ArgsExperiencesByCity, ctx: Context, info: GraphQLResolveInfo) => ExperiencesByCityParent[] | Promise<ExperiencesByCityParent[]>'.
  Type 'Promise<CityNode[]>' is not assignable to type 'ExperiencesByCityParent[] | Promise<ExperiencesByCityParent[]>'.
    Type 'Promise<CityNode[]>' is not assignable to type 'Promise<ExperiencesByCityParent[]>'.
      Type 'CityNode[]' is not assignable to type 'ExperiencesByCityParent[]'.
        Type 'CityNode' is not assignable to type 'ExperiencesByCityParent'.
          Property 'experiences' is missing in type 'CityNode'.

    at createTSError (/Users/lukehamilton/Development/projects/lyra-api/node_modules/ts-node/src/index.ts:261:12)
    at getOutput (/Users/lukehamilton/Development/projects/lyra-api/node_modules/ts-node/src/index.ts:367:40)
    at Object.compile (/Users/lukehamilton/Development/projects/lyra-api/node_modules/ts-node/src/index.ts:558:11)
    at Module.m._compile (/Users/lukehamilton/Development/projects/lyra-api/node_modules/ts-node/src/index.ts:439:43)
    at Module._extensions..js (module.js:664:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/lukehamilton/Development/projects/lyra-api/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)

piesrtasty avatar Sep 22 '18 06:09 piesrtasty

Same here!

CristhianParraJS avatar Sep 28 '18 21:09 CristhianParraJS

same error for me

PinkyJie avatar Sep 29 '18 14:09 PinkyJie

Looking into this now

abhiaiyer91 avatar Sep 29 '18 17:09 abhiaiyer91

Alright, this should be resolved!

abhiaiyer91 avatar Sep 29 '18 17:09 abhiaiyer91

hello, it seems it's not :(

plmercereau avatar Oct 09 '18 23:10 plmercereau

What is the TS compile error you are receiving?

abhiaiyer91 avatar Oct 09 '18 23:10 abhiaiyer91

    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/resolvers/Query.ts(8,3): error TS2322: Type '(_parent: QueryParent, _args: {}, ctx: Context) => Promise<ExperienceNode[]>' is not assignable to type '(parent: QueryParent, args: {}, ctx: Context, info: GraphQLResolveInfo) => ExperienceParent[] | Promise<ExperienceParent[]>'.
  Type 'Promise<ExperienceNode[]>' is not assignable to type 'ExperienceParent[] | Promise<ExperienceParent[]>'.
    Type 'Promise<ExperienceNode[]>' is not assignable to type 'Promise<ExperienceParent[]>'.
      Type 'ExperienceNode[]' is not assignable to type 'ExperienceParent[]'.
        Type 'ExperienceNode' is not assignable to type 'ExperienceParent'.
          Property 'location' is missing in type 'ExperienceNode'.
src/resolvers/Query.ts(11,38): error TS2322: Type 'Promise<PlaceNode[]>' is not assignable to type 'PlaceParent[] | Promise<PlaceParent[]>'.
  Type 'Promise<PlaceNode[]>' is not assignable to type 'Promise<PlaceParent[]>'.
    Type 'PlaceNode[]' is not assignable to type 'PlaceParent[]'.
      Type 'PlaceNode' is not assignable to type 'PlaceParent'.
        Property 'reviews' is missing in type 'PlaceNode'.
src/resolvers/Query.ts(13,5): error TS2322: Type 'Promise<PlaceNode[]>' is not assignable to type 'PlaceParent[] | Promise<PlaceParent[]>'.
  Type 'Promise<PlaceNode[]>' is not assignable to type 'Promise<PlaceParent[]>'.
src/resolvers/Query.ts(22,5): error TS2322: Type 'Promise<RestaurantNode[]>' is not assignable to type 'ReservationParent[] | Promise<ReservationParent[]>'.
  Type 'Promise<RestaurantNode[]>' is not assignable to type 'Promise<ReservationParent[]>'.
    Type 'RestaurantNode[]' is not assignable to type 'ReservationParent[]'.
      Type 'RestaurantNode' is not assignable to type 'ReservationParent'.
        Property 'pictures' is missing in type 'RestaurantNode'.
src/resolvers/Query.ts(24,5): error TS2322: Type 'Promise<NeighbourhoodNode[]>' is not assignable to type 'NeighbourhoodParent[] | Promise<NeighbourhoodParent[]>'.
  Type 'Promise<NeighbourhoodNode[]>' is not assignable to type 'Promise<NeighbourhoodParent[]>'.
    Type 'NeighbourhoodNode[]' is not assignable to type 'NeighbourhoodParent[]'.
      Type 'NeighbourhoodNode' is not assignable to type 'NeighbourhoodParent'.
        Property 'city' is missing in type 'NeighbourhoodNode'.
src/resolvers/Query.ts(29,5): error TS2322: Type 'Promise<CityNode[]>' is not assignable to type 'ExperiencesByCityParent[] | Promise<ExperiencesByCityParent[]>'.
  Type 'Promise<CityNode[]>' is not assignable to type 'Promise<ExperiencesByCityParent[]>'.
    Type 'CityNode[]' is not assignable to type 'ExperiencesByCityParent[]'.
      Type 'CityNode' is not assignable to type 'ExperiencesByCityParent'.
        Property 'experiences' is missing in type 'CityNode'.

I am a bit confused in the new resolvers generators, with the things around Xyz types and XyzParent interfaces, but I guess the error may be related to this

plmercereau avatar Oct 09 '18 23:10 plmercereau

Same problem. Can't run this project due to typescript compilation error

   return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/resolvers/Query.ts(8,3): error TS2322: Type '(_parent: QueryParent, _args: {}, ctx: Context) => Promise<ExperienceNode[]>' is not assignable to type '(parent: QueryParent, args: {}, ctx: Context, info: GraphQLResolveInfo) => ExperienceParent[] | Promise<ExperienceParent[]>'.
  Type 'Promise<ExperienceNode[]>' is not assignable to type 'ExperienceParent[] | Promise<ExperienceParent[]>'.
    Type 'Promise<ExperienceNode[]>' is not assignable to type 'Promise<ExperienceParent[]>'.
      Type 'ExperienceNode[]' is not assignable to type 'ExperienceParent[]'.
        Type 'ExperienceNode' is not assignable to type 'ExperienceParent'.
          Property 'location' is missing in type 'ExperienceNode'.
src/resolvers/Query.ts(11,38): error TS2322: Type 'Promise<PlaceNode[]>' is not assignable to type 'PlaceParent[] | Promise<PlaceParent[]>'.
  Type 'Promise<PlaceNode[]>' is not assignable to type 'Promise<PlaceParent[]>'.
    Type 'PlaceNode[]' is not assignable to type 'PlaceParent[]'.
      Type 'PlaceNode' is not assignable to type 'PlaceParent'.
        Property 'reviews' is missing in type 'PlaceNode'.
src/resolvers/Query.ts(13,5): error TS2322: Type 'Promise<PlaceNode[]>' is not assignable to type 'PlaceParent[] | Promise<PlaceParent[]>'.
  Type 'Promise<PlaceNode[]>' is not assignable to type 'Promise<PlaceParent[]>'.
src/resolvers/Query.ts(22,5): error TS2322: Type 'Promise<RestaurantNode[]>' is not assignable to type 'ReservationParent[] | Promise<ReservationParent[]>'.
  Type 'Promise<RestaurantNode[]>' is not assignable to type 'Promise<ReservationParent[]>'.
    Type 'RestaurantNode[]' is not assignable to type 'ReservationParent[]'.
      Type 'RestaurantNode' is not assignable to type 'ReservationParent'.
        Property 'pictures' is missing in type 'RestaurantNode'.
src/resolvers/Query.ts(24,5): error TS2322: Type 'Promise<NeighbourhoodNode[]>' is not assignable to type 'NeighbourhoodParent[] | Promise<NeighbourhoodParent[]>'.
  Type 'Promise<NeighbourhoodNode[]>' is not assignable to type 'Promise<NeighbourhoodParent[]>'.
    Type 'NeighbourhoodNode[]' is not assignable to type 'NeighbourhoodParent[]'.
      Type 'NeighbourhoodNode' is not assignable to type 'NeighbourhoodParent'.
        Property 'city' is missing in type 'NeighbourhoodNode'.
src/resolvers/Query.ts(29,5): error TS2322: Type 'Promise<CityNode[]>' is not assignable to type 'ExperiencesByCityParent[] | Promise<ExperiencesByCityParent[]>'.
  Type 'Promise<CityNode[]>' is not assignable to type 'Promise<ExperiencesByCityParent[]>'.
    Type 'CityNode[]' is not assignable to type 'ExperiencesByCityParent[]'.
      Type 'CityNode' is not assignable to type 'ExperiencesByCityParent'.
        Property 'experiences' is missing in type 'CityNode'.
src/resolvers/Query.ts(43,17): error TS2322: Type '{ me: null; bookings: null; }' is not assignable to type 'ViewerParent | Promise<ViewerParent | null> | null'.
  Type '{ me: null; bookings: null; }' is not assignable to type 'Promise<ViewerParent | null>'.
    Property 'then' is missing in type '{ me: null; bookings: null; }'.

mikepuglisi avatar Oct 23 '18 15:10 mikepuglisi

Will be fixed here https://github.com/prisma/graphql-prisma-typescript/pull/376

abhiaiyer91 avatar Oct 23 '18 16:10 abhiaiyer91

Awesome!

plmercereau avatar Oct 24 '18 15:10 plmercereau