Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: better generic support for registerAs #173

Merged
merged 2 commits into from Feb 9, 2021

Conversation

JasonHK
Copy link
Contributor

@JasonHK JasonHK commented Apr 11, 2020

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

This is how to specify the return type of a config factory before this commit:

import { registerAs } from '@nestjs/config';
import { ConfigFactory } from '@nestjs/config/dist/interfaces';

registerAs<ConfigFactory<DatabaseConfig>>('database', () => ({
  host: 'host',
  port: 4000,
}));

interface DatabaseConfig {
  host: string;
  port: number;
}

What is the new behavior?

Better support to specify the return type of a config factory.

import { registerAs } from '@nestjs/config';

registerAs<DatabaseConfig>('database', () => ({
  host: 'host',
  port: 4000,
}));

interface DatabaseConfig {
  host: string;
  port: number;
}

Does this PR introduce a breaking change?

[x] Yes
[ ] No

The commit will break the code which already utilizing the generic of
registerAs function.

Other information

Add support to specify the return type of a config factory.

BREAKING CHANGE:

The commit will break the code which already utilizing the generic of
`registerAs` function.
@JasonHK JasonHK changed the title feat(@nestjs/config): better generic support for registerAs feat: better generic support for registerAs Apr 11, 2020
@kamilmysliwiec kamilmysliwiec added enhancement New feature or request status: blocked labels May 7, 2020
@JasonHK
Copy link
Contributor Author

JasonHK commented May 26, 2020

@kamilmysliwiec The PR should be able to be merged now. Could you please review it?

@kamilmysliwiec
Copy link
Member

@JasonHK PR looks great, but it introduces a breaking change which means that we can't really merge it till the next major release.

@kamilmysliwiec kamilmysliwiec changed the base branch from master to 8.0.0 February 9, 2021 12:04
@kamilmysliwiec kamilmysliwiec merged commit b085a2c into nestjs:8.0.0 Feb 9, 2021
@JasonHK JasonHK deleted the feat/register-as branch February 12, 2021 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request status: blocked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants