DEV Community

Discussion on: A Beginner’s Guide to GraphQL

Collapse
 
mdings profile image
Maarten Dings

That's the type checking (===) failing there. I had the same issue. Replace the find functions to double equal checks instead of triple, then it should work: users.find(user => user.id == id)
Not sure why the typecheck doesn't work. Perhaps the ID! in schema.graphql is returning a string by default?

Thread Thread
 
danbraun profile image
Dan Braun

Yup, that was it.

Thread Thread
 
rorixrebel profile image
Miguel Valdes

spent like 30 mins trying to get it to work, triple = kills the functionality

Thread Thread
 
maybebored profile image
Mayuran • Edited

This helped me better understand '==' vs '==='

github.com/getify/You-Dont-Know-JS...

EDIT: 'ID' type is serialised to String in graphql. So really, the comparison works as expected. If anything, this needs better error handling.

apollographql.com/docs/apollo-serv...