Skip to content

Commit c479cb4

Browse files
KhraksMamtsoveffect-bot
authored andcommitted
Default never type for MutableHasMap.empty & MutableList.empty (#4768)
1 parent 0dfcd2d commit c479cb4

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.changeset/friendly-geese-boil.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"effect": minor
3+
---
4+
5+
Default `never` type has been added to `MutableHasMap.empty` & `MutableList.empty` ctors

packages/effect/src/MutableHashMap.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class BucketIterator<K, V> implements Iterator<[K, V]> {
102102
* @since 2.0.0
103103
* @category constructors
104104
*/
105-
export const empty = <K, V>(): MutableHashMap<K, V> => {
105+
export const empty = <K = never, V = never>(): MutableHashMap<K, V> => {
106106
const self = Object.create(MutableHashMapProto)
107107
self.referential = new Map()
108108
self.buckets = new Map()

packages/effect/src/MutableList.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const makeNode = <T>(value: T): LinkedListNode<T> => ({
9797
* @since 2.0.0
9898
* @category constructors
9999
*/
100-
export const empty = <A>(): MutableList<A> => {
100+
export const empty = <A = never>(): MutableList<A> => {
101101
const list = Object.create(MutableListProto)
102102
list.head = undefined
103103
list.tail = undefined

0 commit comments

Comments
 (0)