Skip to content

Add type for second return type when using Config.get #138

@bashleigh

Description

@bashleigh

Issue type:

  • question
  • bug report
  • feature request
  • documentation issue

nestjs-config version

@nestjs/common+core or other package versions

  • @nestjs/common:
  • @nestjs/core:

Excepted behavior

I want to be able to use strict typing within my service. Using config.get<string>('something', 'something') will mean type string | undefined is used. Need to be able to specify default type like get<string, string>() where get<T, U>(pattern: string, def?: U): T | U

Actual behavior or outcome (for issue)

Cannot compile because string | undefined doesn't match string

Replication/Example

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions