Skip to content

Commit

Permalink
fix: fix incorrect return types for orThrow methods
Browse files Browse the repository at this point in the history
  • Loading branch information
allohamora committed Sep 7, 2023
1 parent 523a352 commit 504dda4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/env/env.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class EnvManager<NodeEnv extends string, Config extends BaseConfig = Base
return this.get(key);
}

public getForOrThrow<Key extends keyof Config>(envRecord: EnvRecord<NodeEnv, Key>): Config[Key] {
public getForOrThrow<Key extends keyof Config>(envRecord: EnvRecord<NodeEnv, Key>): NonNullable<Config[Key]> {
const key = this.getKeyOrThrow(envRecord);

return this.getOrThrow(key);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/manager.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class Manager<Source extends Record<string, unknown>> {
return this.source[key];
}

public getOrThrow<Key extends keyof Source>(key: Key): Source[Key] {
public getOrThrow<Key extends keyof Source>(key: Key): NonNullable<Source[Key]> {
const value = this.source[key];

if (value === null || value === undefined) {
Expand Down

0 comments on commit 504dda4

Please sign in to comment.