excitement-engineer / graphql-iso-date

A set of RFC 3339 compliant date/time GraphQL scalar types.
MIT License
523 stars 50 forks source link

Newer versions of Flow causing issues with JSON.stringify #103

Open sheepsteak opened 5 years ago

sheepsteak commented 5 years ago

In newer versions of Flow (>=0.95) the types for JSON.stringify have been changed which is causing errors when using graphql-iso-date.

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/graphql-iso-date/dist/date/index.js.flow:48:11

Cannot add 'Date canno...' and JSON.stringify(...) because undefined [1] is incompatible with string [2].

     node_modules/graphql-iso-date/dist/date/index.js.flow
      44│       )
      45│     } else {
      46│       throw new TypeError(
 [2]  47│         'Date cannot represent a non string, or non Date type ' +
      48│           JSON.stringify(value)
      49│       )
      50│     }
      51│   },

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491│     ): string | void;

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/graphql-iso-date/dist/date/index.js.flow:55:50

Cannot coerce JSON.stringify(...) to string because undefined [1] should not be coerced.

     node_modules/graphql-iso-date/dist/date/index.js.flow
      52│   parseValue (value) {
      53│     if (!(typeof value === 'string' || value instanceof String)) {
      54│       throw new TypeError(
      55│         `Date cannot represent non string type ${JSON.stringify(value)}`
      56│       )
      57│     }
      58│

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491│     ): string | void;

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/graphql-iso-date/dist/dateTime/index.js.flow:64:43

Cannot add 'DateTime c...' + 'non numeri...' and JSON.stringify(...) because undefined [1] is incompatible with
string [2].

     node_modules/graphql-iso-date/dist/dateTime/index.js.flow
      60│       )
      61│     } else {
      62│       throw new TypeError(
 [2]  63│         'DateTime cannot be serialized from a non string, ' +
      64│         'non numeric or non Date type ' + JSON.stringify(value)
      65│       )
      66│     }
      67│   },

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491│     ): string | void;

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/graphql-iso-date/dist/dateTime/index.js.flow:71:54

Cannot coerce JSON.stringify(...) to string because undefined [1] should not be coerced.

     node_modules/graphql-iso-date/dist/dateTime/index.js.flow
      68│   parseValue (value) {
      69│     if (!(typeof value === 'string' || value instanceof String)) {
      70│       throw new TypeError(
      71│         `DateTime cannot represent non string type ${JSON.stringify(value)}`
      72│       )
      73│     }
      74│

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491│     ): string | void;

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/graphql-iso-date/dist/time/index.js.flow:55:31

Cannot add 'Time canno...' + 'or non Dat...' and JSON.stringify(...) because undefined [1] is incompatible with
string [2].

     node_modules/graphql-iso-date/dist/time/index.js.flow
      51│       )
      52│     } else {
      53│       throw new TypeError(
 [2]  54│         'Time cannot be serialized from a non string, ' +
      55│         'or non Date type ' + JSON.stringify(value)
      56│       )
      57│     }
      58│   },

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491│     ): string | void;

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/graphql-iso-date/dist/time/index.js.flow:62:50

Cannot coerce JSON.stringify(...) to string because undefined [1] should not be coerced.

     node_modules/graphql-iso-date/dist/time/index.js.flow
      59│   parseValue (value: mixed): Date {
      60│     if (!(typeof value === 'string' || value instanceof String)) {
      61│       throw new TypeError(
      62│         `Time cannot represent non string type ${JSON.stringify(value)}`
      63│       )
      64│     }
      65│

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491│     ): string | void;

Found 6 errors