mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
instanceof not working with Decimal
This commit is contained in:
parent
003090ed6c
commit
2c77785b77
@ -1,14 +1,11 @@
|
||||
import { GraphQLScalarType, Kind } from 'graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import Decimal from '../../util/decimal'
|
||||
|
||||
export default new GraphQLScalarType({
|
||||
name: 'Decimal',
|
||||
description: 'The `Decimal` scalar type to represent currency values',
|
||||
|
||||
serialize(value: unknown) {
|
||||
if (!(value instanceof Decimal)) {
|
||||
throw new Error('DecimalScalar can only serialize Decimal values')
|
||||
}
|
||||
serialize(value: Decimal) {
|
||||
return value.toString()
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user