@@ -129,42 +129,44 @@ export class SingleContextKey<Value>
129
129
/**
130
130
* Multiple context value reference.
131
131
*
132
+ * Represents context value as read-only array of source values.
133
+ *
132
134
* @typeparam Src Value source type and context value item type.
133
135
*/
134
- export type MultiContextRef < Src , Seed = unknown > = ContextRef < Src [ ] , Src , Seed > ;
136
+ export type MultiContextRef < Src , Seed = unknown > = ContextRef < readonly Src [ ] , Src , Seed > ;
135
137
136
138
/**
137
139
* Multiple context values key.
138
140
*
139
- * Represents context value as array of source values.
141
+ * Represents context value as read-only array of source values.
140
142
*
141
143
* Associated with empty array by default.
142
144
*
143
145
* @typeparam Src Value source type and context value item type.
144
146
*/
145
147
export class MultiContextKey < Src >
146
- extends SimpleContextKey < Src [ ] , Src >
148
+ extends SimpleContextKey < readonly Src [ ] , Src >
147
149
implements MultiContextRef < Src , AIterable < Src > > {
148
150
149
151
/**
150
152
* A provider of context value used when there is no value associated with this key.
151
153
*/
152
- readonly byDefault : ContextValueProvider < ContextValues , Src [ ] > ;
154
+ readonly byDefault : ContextValueProvider < ContextValues , readonly Src [ ] > ;
153
155
154
156
/**
155
157
* Constructs multiple context values key.
156
158
*
157
159
* @param name Human-readable key name.
158
160
* @param byDefault Optional default value provider. If unspecified then the default value is empty array.
159
161
*/
160
- constructor ( name : string , byDefault : ContextValueProvider < ContextValues , Src [ ] > = valuesProvider ( ) ) {
162
+ constructor ( name : string , byDefault : ContextValueProvider < ContextValues , readonly Src [ ] > = valuesProvider ( ) ) {
161
163
super ( name ) ;
162
164
this . byDefault = byDefault ;
163
165
}
164
166
165
167
grow < Ctx extends ContextValues > (
166
- opts : ContextValueOpts < Ctx , Src [ ] , Src , AIterable < Src > > ,
167
- ) : Src [ ] | null | undefined {
168
+ opts : ContextValueOpts < Ctx , readonly Src [ ] , Src , AIterable < Src > > ,
169
+ ) : readonly Src [ ] | null | undefined {
168
170
169
171
const result = [ ...opts . seed ] ;
170
172
0 commit comments