Skip to content

Commit 22c77e2

Browse files
KhraksMamtsoveffect-bot
authored andcommitted
Brand.unbranded getter (#4788)
1 parent 4943681 commit 22c77e2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.changeset/calm-zebras-relate.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"effect": minor
3+
---
4+
5+
`Brand.unbranded` getter has been added

packages/effect/src/Brand.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
import * as Arr from "./Array.js"
2020
import * as Either from "./Either.js"
21-
import { identity } from "./Function.js"
21+
import { identity, unsafeCoerce } from "./Function.js"
2222
import * as Option from "./Option.js"
2323
import type { Predicate } from "./Predicate.js"
2424
import type * as Types from "./Types.js"
@@ -350,3 +350,11 @@ export const all: <Brands extends readonly [Brand.Constructor<any>, ...Array<Bra
350350
is: (args: any): args is any => Either.isRight(either(args))
351351
})
352352
}
353+
354+
/**
355+
* Retrieves the unbranded value from a `Brand` instance.
356+
*
357+
* @since 3.15.0
358+
* @category getters
359+
*/
360+
export const unbranded: <A extends Brand<any>>(branded: A) => Brand.Unbranded<A> = unsafeCoerce

0 commit comments

Comments
 (0)