Skip to content
This repository was archived by the owner on Sep 17, 2023. It is now read-only.

Commit 3989606

Browse files
committed
Single/MultiContextKey: make a seed unknown by default.
1 parent 11decae commit 3989606

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/simple-context-key.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ export abstract class SimpleContextKey<Value, Src = Value> extends ContextKey<Va
7777
* Single context value reference.
7878
*
7979
* @typeparam Value Context value type.
80+
* @typeparam Seed Value seed type.
8081
*/
81-
export type SingleContextRef<Value> = ContextRef<Value, Value, AIterable<Value>>;
82+
export type SingleContextRef<Value, Seed = unknown> = ContextRef<Value, Value, Seed>;
8283

8384
/**
8485
* Single context value key.
@@ -87,7 +88,9 @@ export type SingleContextRef<Value> = ContextRef<Value, Value, AIterable<Value>>
8788
*
8889
* @typeparam Value Context value type.
8990
*/
90-
export class SingleContextKey<Value> extends SimpleContextKey<Value> implements SingleContextRef<Value> {
91+
export class SingleContextKey<Value>
92+
extends SimpleContextKey<Value>
93+
implements SingleContextRef<Value, AIterable<Value>> {
9194

9295
/**
9396
* A provider of context value used when there is no value associated with this key.
@@ -128,7 +131,7 @@ export class SingleContextKey<Value> extends SimpleContextKey<Value> implements
128131
*
129132
* @typeparam Src Value source type and context value item type.
130133
*/
131-
export type MultiContextRef<Src> = ContextRef<Src[], Src, AIterable<Src>>;
134+
export type MultiContextRef<Src, Seed = unknown> = ContextRef<Src[], Src, Seed>;
132135

133136
/**
134137
* Multiple context values key.
@@ -139,7 +142,9 @@ export type MultiContextRef<Src> = ContextRef<Src[], Src, AIterable<Src>>;
139142
*
140143
* @typeparam Src Value source type and context value item type.
141144
*/
142-
export class MultiContextKey<Src> extends SimpleContextKey<Src[], Src> implements MultiContextRef<Src> {
145+
export class MultiContextKey<Src>
146+
extends SimpleContextKey<Src[], Src>
147+
implements MultiContextRef<Src, AIterable<Src>> {
143148

144149
/**
145150
* A provider of context value used when there is no value associated with this key.

0 commit comments

Comments
 (0)