@devp0nt/error0 1.0.0-next.44 → 1.0.0-next.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.test.ts +11 -0
package/package.json
CHANGED
package/src/index.test.ts
CHANGED
|
@@ -633,6 +633,17 @@ describe('Error0', () => {
|
|
|
633
633
|
`)
|
|
634
634
|
})
|
|
635
635
|
|
|
636
|
+
it('Error0 assignable to LikeError0', () => {
|
|
637
|
+
type LikeError0 = {
|
|
638
|
+
from: (error: unknown) => Error
|
|
639
|
+
serialize: (error: Error) => Record<string, unknown>
|
|
640
|
+
}
|
|
641
|
+
expectTypeOf<typeof Error0>().toExtend<LikeError0>()
|
|
642
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
643
|
+
const AppError = Error0.use(statusPlugin)
|
|
644
|
+
expectTypeOf<typeof AppError>().toExtend<LikeError0>()
|
|
645
|
+
})
|
|
646
|
+
|
|
636
647
|
// we will have no variants
|
|
637
648
|
// becouse you can thorw any errorm and when you do AppError.from(yourError)
|
|
638
649
|
// can use adapt to assign desired props to error, it is enough for transport
|