bun icon indicating copy to clipboard operation
bun copied to clipboard

type-graphql: Unable to infer from TypeSript reflection system

Open jupl opened this issue 1 year ago • 0 comments

What version of Bun is running?

1.1.8

What platform is your computer?

Darwin 23.4.0 x86_64 i386

What steps can reproduce the bug?

Given the sample code below:

import {Query, Resolver, buildSchemaSync} from 'type-graphql'

@Resolver()
class TestResolver {
  @Query()
  field(): string {
    return 'Test'
  }
}

buildSchemaSync({resolvers: [TestResolver]})

And given the following dependencies:

  • type-graphql
  • reflect-metadata

And given the following options set for tsconfig.json:

  • "emitDecoratorMetadata": true
  • "experimentalDecorators": true

I can run the code without issue in Node with TSNode. In Bun if I run:

bun run -r reflect-metadata [file.ts]

I get the error Unable to infer GraphQL type from TypeScript reflection system.. I have to change the Query line to what is below so it can run in Bun, which defeats a benefit of using TypeGraphQL to reduce writing redundant typing information.

  @Query(_type => String)

What is the expected behavior?

No errors when running script in Bun.

What do you see instead?

Unable to infer GraphQL type from TypeScript reflection system.

Additional information

No response

jupl avatar May 18 '24 16:05 jupl