Custom scalar in schema mapped to type
Asked Answered
B

0

9

I'm following the example of getting started using relay with typescript(https://relay.dev/docs/en/quick-start-guide) and it inititlly works as expected. I am trying to modify my schema to include some custom scalars, so my schema looks something like:

scalar DateTime
type Item {
    id: ID!
    name:String!
    created: DateTime
}

I have modified my relay.config.js so it can compile to a type string

module.exports = {
 \\...
    customScalars: {"Date":"string"},

}

I want to map DateTime to a type in moment.js rather just a string that i need parse in each component. In graphql I can see the type GraphQLScalarType where i can parse/serialise a custom type but don't see how to register it so it gets picked up as part of the execution.

I can't find any docs or examples of how to setup.

thanks

Bloomfield answered 10/8, 2020 at 12:53 Comment(1)
Have you found a workaround dealing with custom scalars using relay?Kila

© 2022 - 2024 — McMap. All rights reserved.