Skip to content

Commit 0e0942c

Browse files
committed
style(lib): replace keyof never with PropertyKey
1 parent cd1ac32 commit 0e0942c

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/operations/collections.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const toWeakSet: <Value extends object>() => Reducer<
110110
* @category Collections
111111
* @since v0.0.1
112112
*/
113-
export const toObject: <Key extends keyof never, Value>() => RawKeyedReducer<
113+
export const toObject: <Key extends PropertyKey, Value>() => RawKeyedReducer<
114114
Key,
115115
Value,
116116
Record<Key, Value>
@@ -322,7 +322,7 @@ export const toMultiple: {
322322
Reducers extends
323323
| readonly [RawReducerWithoutFinish<Value, any>]
324324
| readonly RawReducerWithoutFinish<Value, any>[]
325-
| Readonly<Record<keyof never, RawReducerWithoutFinish<Value, any>>>,
325+
| Readonly<Record<PropertyKey, RawReducerWithoutFinish<Value, any>>>,
326326
>(
327327
reducers: Reducers,
328328
): Reducer<
@@ -363,7 +363,7 @@ export const toMultiple: {
363363
)[]
364364
| Readonly<
365365
Record<
366-
keyof never,
366+
PropertyKey,
367367
| RawReducerWithoutFinish<Value, any>
368368
| RawOptionalReducerWithoutFinish<Value>
369369
| FunctionReducer<Value>

src/operations/generators.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import type {
5555
*/
5656
export const keys: {
5757
<Key>(object: ReadonlyMap<Key, unknown>): Iterable<Key>
58-
<Key extends keyof never>(
58+
<Key extends PropertyKey>(
5959
object: Readonly<Record<Key, unknown>>,
6060
): Iterable<Key>
6161
}
@@ -121,7 +121,7 @@ export const values: <Value>(
121121
object:
122122
| ReadonlyMap<unknown, Value>
123123
| ReadonlySet<Value>
124-
| Readonly<Record<keyof never, Value>>,
124+
| Readonly<Record<PropertyKey, Value>>,
125125
) => Iterable<Value>
126126

127127
/**
@@ -189,7 +189,7 @@ export const entries: {
189189
<Key, Value>(object: {
190190
entries: () => Iterable<[Key, Value]>
191191
}): Iterable<[Key, Value]>
192-
<Key extends keyof never, Value>(
192+
<Key extends PropertyKey, Value>(
193193
object: Readonly<Record<Key, Value>>,
194194
): Iterable<[Key, Value]>
195195
}

test/setup.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ expect.extend({
1111
let pass =
1212
typeof received === `object` &&
1313
received != null &&
14-
typeof (received as Record<keyof never, unknown>)[Symbol.iterator] ===
14+
typeof (received as Record<PropertyKey, unknown>)[Symbol.iterator] ===
1515
`function`
1616

1717
let values1
@@ -49,7 +49,7 @@ expect.extend({
4949
let pass =
5050
typeof received === `object` &&
5151
received != null &&
52-
typeof (received as Record<keyof never, unknown>)[
52+
typeof (received as Record<PropertyKey, unknown>)[
5353
Symbol.asyncIterator
5454
] === `function`
5555

@@ -141,10 +141,10 @@ expect.extend({
141141
received != null &&
142142
[`add`, `finish`].every(
143143
methodName =>
144-
typeof (received as Record<keyof never, unknown>)[methodName] ===
144+
typeof (received as Record<PropertyKey, unknown>)[methodName] ===
145145
`function`,
146146
) &&
147-
!(received as Record<keyof never, unknown>).create
147+
!(received as Record<PropertyKey, unknown>).create
148148

149149
return {
150150
pass,
@@ -160,7 +160,7 @@ expect.extend({
160160
[`create`, `add`, `finish`, keyed && `get`].filter(Boolean).every(
161161
methodName =>
162162
// eslint-disable-next-line typescript/no-unsafe-member-access
163-
typeof (received as Record<keyof never, unknown>)[methodName] ===
163+
typeof (received as Record<PropertyKey, unknown>)[methodName] ===
164164
`function`,
165165
)
166166

0 commit comments

Comments
 (0)