Code Monkey home page Code Monkey logo

Comments (8)

steida avatar steida commented on June 12, 2024

Add

export const GQLMax140Chars = asNexusMethod(
  new RegularExpression('Max140Chars', /[\s\S]{0,140}/),
  'max140Chars',
);

export const GQLMax1024Chars = asNexusMethod(
  new RegularExpression('Max1024Chars', /[\s\S]{0,1024}/),
  'Max1024Chars',
);

from este.

steida avatar steida commented on June 12, 2024

Ups. Relay does not support custom scalars mapping. That's bad.

facebook/relay#2518

from este.

steida avatar steida commented on June 12, 2024

But we can fix 'any' type generated with Relay manually via mapped types. OK, that's good enough. API integrity is the must.

from este.

steida avatar steida commented on June 12, 2024

But Nexus has the same problem. It generates any type for any custom scalar. That sucks. OK, use default scalars until both Nexus and Relay will support custom scalar TS types generation.

from este.

steida avatar steida commented on June 12, 2024

Oh, Nexus supports custom mapping.

typegenAutoConfig: {
    // debug: true,
    sources: [{ source: path.join(__dirname, './types.ts'), alias: 'types' }],
    contextType: 'types.Context',
    backingTypeMap: {
      EmailAddress: 'string',
    },
  },

from este.

steida avatar steida commented on June 12, 2024

Hmm, but Relay does not support it yet and useMutation leverages types for input component fields.

facebook/relay#2718

from este.

steida avatar steida commented on June 12, 2024

But we can patch it!

Low priority, but having restricted GraphQL types would be nice.

from este.

steida avatar steida commented on June 12, 2024

Sunsetting.

from este.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.