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

NestApplication does not correctly implement INestApplication #4036

Closed
ghost opened this issue Feb 11, 2020 · 5 comments
Closed

NestApplication does not correctly implement INestApplication #4036

ghost opened this issue Feb 11, 2020 · 5 comments
Labels
needs triage This issue has not been looked into

Comments

@ghost
Copy link

ghost commented Feb 11, 2020

Bug Report

ERROR in C:/_myplace/gen3/platform-libs/node_modules/@nestjs/core/nest-application.d.ts(44,5):
TS2416: Property 'enableCors' in type 'NestApplication' is not assignable to the same property in base type 'INestApplication'.
Type '(options?: CorsOptions | undefined) => void' is not assignable to type '(options?: CorsOptions | undefined) => this'.
Type 'void' is not assignable to type 'this'.

It is defined as void

enableCors(options?: CorsOptions): void;

Implement with a return type

public enableCors(options?: CorsOptions): void {

The only use of the function actually uses the return type

return this.enableCors();

@ghost ghost added the needs triage This issue has not been looked into label Feb 11, 2020
@kamilmysliwiec
Copy link
Member

Please, provide a minimal repository which reproduces your issue.

@msanguineti
Copy link

msanguineti commented Feb 13, 2020

@kamilmysliwiec I do not think it is closed

I am getting the same error after updating from v6.10.14 to v6.11.7

node_modules/@nestjs/core/nest-application.d.ts:44:5 - error TS2416: Property 'enableCors' in type 'NestApplication' is not assignable to the same property in base type 'INestApplication'.
  Type '(options?: CorsOptions) => void' is not assignable to type '(options?: CorsOptions) => this'.
    Type 'void' is not assignable to type 'this'.

44     enableCors(options?: CorsOptions): void;

It was changed here #3656

@kamilmysliwiec
Copy link
Member

Please, ensure that your @nestjs/common, @nestjs/core, and @nestjs/platform-{express/fastify} versions match.

@msanguineti
Copy link

That was exactly the problem... it was failing in CI when updating deps, but only because it was updating one dep at the time... sorry.

@lock
Copy link

lock bot commented May 20, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

2 participants