Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
cool
Browse files Browse the repository at this point in the history
  • Loading branch information
KATT committed Sep 30, 2023
1 parent c3feafe commit 5729d2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/handlers/tsonUnknownObjectGuard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TsonType } from "../types.js";
import { isPlainObject } from "../isPlainObject.js";
import { TsonType } from "../types.js";

export class UnknownObjectGuardError extends Error {
/**
Expand Down
17 changes: 9 additions & 8 deletions src/tson.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { isPlainObject } from "./isPlainObject.js";
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { isPlainObject } from "./isPlainObject.js";
import {
TsonAllTypes,
TsonDeserializeFn,
Expand Down Expand Up @@ -83,13 +84,13 @@ export function createTsonSerialize(opts: TsonOptions): TsonSerializeFn {
walk: WalkFn,
) => TsonSerializedValue;

const $serialize: Serializer = (value, nonce, walk): TsonTuple => [
handler.key as TsonTypeHandlerKey,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
walk(handler.serialize!(value)),
nonce,
];

const $serialize: Serializer = handler.serialize
? (value, nonce, walk): TsonTuple => [
handler.key as TsonTypeHandlerKey,
walk(handler.serialize(value)),
nonce,
]
: (value, _nonce, walk) => walk(value);
return {
...handler,
$serialize,
Expand Down

0 comments on commit 5729d2c

Please sign in to comment.