diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index b0b4b82..043b528 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -127,7 +127,7 @@ const showWeather = getShow({ }) assert.strictEqual(showWeather.show(Sun), 'Sun') -assert.strictEqual(showWeather.show(Rain(1)), 'Rain 1') +assert.strictEqual(showWeather.show(Rain(1)), 'Rain(1)') ``` Added in v0.1.0 diff --git a/src/index.ts b/src/index.ts index 7df365d..d6d00e8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -156,7 +156,7 @@ export const getOrd = (ords: Ords): Ord => * }) * * assert.strictEqual(showWeather.show(Sun), 'Sun') - * assert.strictEqual(showWeather.show(Rain(1)), 'Rain 1') + * assert.strictEqual(showWeather.show(Rain(1)), 'Rain(1)') * * @since 0.1.0 */ @@ -172,9 +172,9 @@ export const getShow = (shows: Shows): Show => ({ // defined a member for which the value actually can tangibly be `null` // e.g. `Member<'Rain', number | null>`. return k in shows - ? `${k} ${(shows[k as keyof typeof shows] as unknown as Show>) + ? `${k}(${(shows[k as keyof typeof shows] as unknown as Show>) // eslint-disable-next-line @typescript-eslint/no-explicit-any - .show(v as any)}` + .show(v as any)})` : k }, }) diff --git a/test/unit/index.ts b/test/unit/index.ts index 234c390..7bc42cc 100644 --- a/test/unit/index.ts +++ b/test/unit/index.ts @@ -103,8 +103,8 @@ describe("index", () => { }) it("outputs members with values using provived Show instance", () => { - expect(f(A(42))).toBe("A 42") - expect(f(C(42))).toBe("C 24") + expect(f(A(42))).toBe("A(42)") + expect(f(C(42))).toBe("C(24)") }) }) })