Wener Notes

superjson

约 1 分钟阅读
TypeScript
import { Decimal } from 'decimal.js';

SuperJSON.registerCustom<Decimal, string>(
  {
    isApplicable: (v): v is Decimal => Decimal.isDecimal(v),
    serialize: (v) => v.toJSON(),
    deserialize: (v) => new Decimal(v),
  },
  'decimal.js',
);

关联信息

反向链接、本文链接的其他页面和外部资料。

References

GitHub2 条
最近更新commit 0359fceEdit

On this page