question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build failing with typescript

See original GitHub issue

Hi guys,

Any idea why this fails to compile? I followed all the guidelines correctly. Server works in dev mode.

Code for the line 44:

// ...
const db: Prisma = new Prisma(prismaOptions)
const typeDefs = importSchema('app-schema.graphql')
const schema = makeExecutableSchema({typeDefs, resolvers})
const server = new GraphQLServer({
  schema,
  directiveResolvers: directiveResolvers,
  context: req => {
    return {
      ...req,
      db,
    }
  },
})

Build failed output:

$ rimraf dist && tsc --pretty
src/index.ts:40:34 - error TS2345: Argument of type '{ schema: GraphQLSchema; directiveResolvers: { isAuthenticated: (next: any, source: any, args: an...' is not assignable to parameter of type 'Props'.
  Types of property 'schema' are incompatible.
    Type 'GraphQLSchema' is not assignable to type 'GraphQLSchema'. Two different types with this name exist, but they are unrelated.
      Types of property 'astNode' are incompatible.
        Type 'SchemaDefinitionNode' is not assignable to type 'SchemaDefinitionNode'. Two different types with this name exist, but they are unrelated.
          Types of property 'loc' are incompatible.
            Type 'Location' is not assignable to type 'Location'. Two different types with this name exist, but they are unrelated.
              Types of property 'startToken' are incompatible.
                Type 'Token' is not assignable to type 'Token'. Two different types with this name exist, but they are unrelated.
                  Types of property 'prev' are incompatible.
                    Type 'Token' is not assignable to type 'Token'. Two different types with this name exist, but they are unrelated.

 40 const server = new GraphQLServer({
                                     ~
 41   schema,
    ~~~~~~~~~
...
 48   },
    ~~~~
 49 })
    ~

thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
oiojin831commented, Jun 30, 2018

I don’t know this is same for everyone else, but after I added yarn add --dev @types/graphql everything works fine for me

0reactions
0zkr1commented, Jun 28, 2018

I’m having similar issue with IResolver. My project compiles if I modify it but appending | any at Interface.d.ts definition. (I’m breaking the type checking like other cited solutions)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript build failure - visual studio 2013 - Stack Overflow
I'm currently having two projects with typescript 1.1 that are opened in visual studio 2013 with typescript 1.8 installed. VS asks to upgrade...
Read more >
Build fails due to a Typescript Error - Build/Test Issues
The root issue is that your typescript build step requires certain files to be present on paths relative to the solution being compiled....
Read more >
Mongoose 6.1.5 typescript build fail · Issue #11180 - GitHub
My build is failing after updating mongoose to 6.1.5 but it was working fine in 6.1.4 If the current behavior is a bug,...
Read more >
Documentation - Integrating with Build Tools - TypeScript
Right-Click -> Manage NuGet Packages · Search for Microsoft.TypeScript.MSBuild · Hit Install · When install is complete, rebuild!
Read more >
build definition started to fail on typescript webpack operation
I have a prebuild step of running webpack, which compiles the typescript code and creates a set of packed javascript files. This step...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found