decimal-type
v3.0.2
Published
[](https://www.npmjs.com/package/decimal-type) [](https://www.npmjs.com/package/decimal-type) [ / Prisma / class-transformer
import { DecimalScalar, DecimalType } from 'decimal-type';
import { Field, InputType } from '@nestjs/graphql';
import { Decimal } from '@prisma/client/runtime';
@InputType()
export class NewTransactionInput {
@Field()
name: string;
@Field(() => DecimalScalar)
@DecimalType()
amount: Decimal;
}NOTE: Don't forget to register the
DecimalScalarscalar with Nest.js. See here for more information.
INFO: If the
@DecimalType()decorator is not used,class-transformerwill not know how to transform theDecimaltype returned by theDecimalScalarscalar into a newDecimalinstance.
