sindresorhus/serialize-error

If string is passed as unknown, the value returned from serializeError is badly typed as ErrorObject

Closed this issue · 1 comments

const errorToSerialize: unknown = "hello world";
const serialized = serializeError(errorToSerialize);

// serialized <=> ErrorObject
// typeof serialized === "string'

Confirmed. The return value should be unknown then.