@@ -281,16 +281,16 @@ export function getOptionalEnvVar(paramName: string): string | undefined {
281281 * in tests, while clearly signalling in regular code that the consumer of the `ReadOnlyEnv` instance
282282 * will only read from it.
283283 */
284- export class ReadOnlyEnv < T extends string | undefined = string | undefined > {
285- constructor ( protected readonly vars : Record < string , T > ) { }
284+ export class ReadOnlyEnv {
285+ constructor ( protected readonly vars : Record < string , string | undefined > ) { }
286286
287287 /** Clones the object while detaching the underlying environment from the original. */
288288 public clone ( ) : this {
289289 return Object . create ( this , { vars : { value : { ...this . vars } } } ) as this;
290290 }
291291
292292 /** Gets a copy of the underlying environment. */
293- public get ( ) : Record < string , T > {
293+ public get ( ) : Record < string , string | undefined > {
294294 return { ...this . vars } ;
295295 }
296296
@@ -305,7 +305,7 @@ export class ReadOnlyEnv<T extends string | undefined = string | undefined> {
305305 }
306306
307307 /** Gets the entries of the underlying `ProcessEnv`. */
308- public entries ( ) : Array < [ string , T ] > {
308+ public entries ( ) : Array < [ string , string | undefined ] > {
309309 return Object . entries ( this . vars ) ;
310310 }
311311
@@ -335,19 +335,17 @@ export class ReadOnlyEnv<T extends string | undefined = string | undefined> {
335335 * Use `ReadOnlyEnv` instead if you only plan to read from the environment.
336336 * This type allows writing to the environment.
337337 */
338- export class Env <
339- T extends string | undefined = string | undefined ,
340- > extends ReadOnlyEnv < T > {
338+ export class Env extends ReadOnlyEnv {
341339 private changed : boolean = false ;
342340
343341 /** Sets an environment variable. */
344- public set ( name : string , value : T ) : void {
342+ public set ( name : string , value : string ) : void {
345343 this . vars [ name ] = value ;
346344 this . changed = true ;
347345 }
348346
349347 /** Sets all environment variables given by `vars`. */
350- public setAll ( vars : Record < string , T > ) : void {
348+ public setAll ( vars : Record < string , string > ) : void {
351349 for ( const [ key , val ] of Object . entries ( vars ) ) {
352350 this . set ( key , val ) ;
353351 }
@@ -361,7 +359,7 @@ export class Env<
361359 * @param name The name of the environment variable to set and export.
362360 * @param val The value to set and export for the environment variable.
363361 */
364- public export ( name : string , val : T ) : void {
362+ public export ( name : string , val : string ) : void {
365363 // Setting the environment variable for this instance is always OK, including
366364 // in tests, since we use fresh `Env` instances whenever needed. This allows
367365 // tests to pass that rely on that part of the `core.exportVariable` behaviour.
0 commit comments