opened
matheusdavidson
username_0
<!--
PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.

ISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.
-->

## I'm submitting a...
<!-- 
Please search GitHub for a similar issue or PR before submitting.
Check one of the following options wusername_2 "x" -->
<pre><code>
[ ] Regression <!--(a behavior that used to work and stopped working in a new release)-->
[x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
</code></pre>

## Current behavior
vscode shows an error when adding a provider to a module:
```
ts]
Argument of type '{ providers: { provide: string; useFactory: () => Promise<any>; }[][]; exports: { provide: string...' is not assignable to parameter of type 'ModuleMetadata'.
  Types of property 'providers' are incompatible.
    Type '{ provide: string; useFactory: () => Promise<any>; }[][]' is not assignable to type 'Provider[]'.
      Type '{ provide: string; useFactory: () => Promise<any>; }[]' is not assignable to type 'Provider'.
        Type '{ provide: string; useFactory: () => Promise<any>; }[]' is not assignable to type 'FactoryProvider'.
          Property 'provide' is missing in type '{ provide: string; useFactory: () => Promise<any>; }[]'.
```

The app boots fine when ```npm start``` but vscode tells that something is wrong wusername_2 TS.

## Expected behavior
Import a provider to a module wusername_2out error


## Minimal reproduction of the problem wusername_2 instructions
I have generated a new app wusername_2 nest cli and took ```app.module.ts```, ```cats```  and ```database``` folder from this sample: https://gusername_2ub.com/nestjs/nest/tree/master/sample/14-mongoose-base .

Open ```cats.module.ts``` or ```database.module.ts``` in vscode and you should see the error.


## Environment
<pre>
<code>
[System Information]
OS Version     : macOS High Sierra
NodeJS Version : v9.10.1
NPM Version    : 5.8.0
[Nest Information]
microservices version : 5.0.0-beta.6
websockets version    : 5.0.0-beta.6
mongoose version      : 3.0.1
testing version       : 5.0.0-beta.6
common version        : 5.0.0-beta.6
core version          : 5.0.0-beta.6
</code></pre>
TS error on adding provider to a module
issue
created
kamilmysliwiec
username_1
Have you tried updating to latest RC version? Tag @rc
comment
created
ith
username_2
@username_1 same issue wusername_2
```  "dependencies": {
    "@nestjs/common": "5.0.0",
    "@nestjs/core": "5.0.0",
    "@nestjs/swagger": "2.0.0",
    "@nestjs/typeorm": "3.0.0",
```
After install wusername_2 @rc same error (version `5.0.0-rc.4`).

Node version is: `v10.1.0`. Full error for one of the services (running perfectly fine `4.6.6`)
```
src/modules/config/config.module.ts(5,9): error TS2345: Argument of type '{ components: (typeof ConfigService)[]; providers: (typeof ConfigService)[]; }' is not assignable to parameter of type 'ModuleMetadata'.
  Types of property 'providers' are incompatible.
    Type '(typeof ConfigService)[]' is not assignable to type 'Provider[] | undefined'.
      Type '(typeof ConfigService)[]' is not assignable to type 'Provider[]'.
        Type 'typeof ConfigService' is not assignable to type 'Provider'.
          Type 'typeof ConfigService' is not assignable to type 'FactoryProvider'.
            Property 'provide' is missing in type 'typeof ConfigService'.
```
comment
created
ith
username_2
Although above might by my error. Will check it out in the evening and get back to you.
comment
created
ith
username_2
Solved on my side. In my case one of providers had `private constructor(...)`. Don't ask why ;)

@username_0 check if by any chance it's not the case in your code.
comment
created
matheusdavidson
username_0
@username_1, @username_2, upgrading to final V5 solves the problem, thank you.
comment
closed
matheusdavidson
username_0
issue
created
matheusdavidson
username_0
Actually this still happens wusername_2 V5.

If you take the 14 sample folders and put in a new app wusername_2 v5, you'll get errors when importing the providers.

I was able to use injecting the provider directly into the module, but not so good because i can't have separate providers to inject into modules.
comment
reopened
matheusdavidson
username_0
<!--
PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.

ISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.
-->

## I'm submitting a...
<!-- 
Please search GitHub for a similar issue or PR before submitting.
Check one of the following options wusername_2 "x" -->
<pre><code>
[ ] Regression <!--(a behavior that used to work and stopped working in a new release)-->
[x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
</code></pre>

## Current behavior
vscode shows an error when adding a provider to a module:
```
ts]
Argument of type '{ providers: { provide: string; useFactory: () => Promise<any>; }[][]; exports: { provide: string...' is not assignable to parameter of type 'ModuleMetadata'.
  Types of property 'providers' are incompatible.
    Type '{ provide: string; useFactory: () => Promise<any>; }[][]' is not assignable to type 'Provider[]'.
      Type '{ provide: string; useFactory: () => Promise<any>; }[]' is not assignable to type 'Provider'.
        Type '{ provide: string; useFactory: () => Promise<any>; }[]' is not assignable to type 'FactoryProvider'.
          Property 'provide' is missing in type '{ provide: string; useFactory: () => Promise<any>; }[]'.
```

The app boots fine when ```npm start``` but vscode tells that something is wrong wusername_2 TS.

## Expected behavior
Import a provider to a module wusername_2out error


## Minimal reproduction of the problem wusername_2 instructions
I have generated a new app wusername_2 nest cli and took ```app.module.ts```, ```cats```  and ```database``` folder from this sample: https://gusername_2ub.com/nestjs/nest/tree/master/sample/14-mongoose-base .

Open ```cats.module.ts``` or ```database.module.ts``` in vscode and you should see the error.


## Environment
<pre>
<code>
[System Information]
OS Version     : macOS High Sierra
NodeJS Version : v9.10.1
NPM Version    : 5.8.0
[Nest Information]
microservices version : 5.0.0-beta.6
websockets version    : 5.0.0-beta.6
mongoose version      : 3.0.1
testing version       : 5.0.0-beta.6
common version        : 5.0.0-beta.6
core version          : 5.0.0-beta.6
</code></pre>
TS error on adding provider to a module
issue
created
kamilmysliwiec
username_1
@username_0 honestly, I don't understand what do you mean. I took 14 sample app and everything is working fine, 0 compilation errors, no warnings.
comment
closed
kamilmysliwiec
username_1
issue
created
alxizr
username_3
I am having the same issue. Was this issue solved ? 


[System Information]
OS Version     : Windows 10
NodeJS Version : v12.0.0
NPM Version    : 6.9.0

[Nest Information]
platform-express version : 6.5.3
common version           : 6.5.3
core version             : 6.5.3

i took example 14 and did 2 things:
#1 - changed mongodb database url
#2 - created a User entity just as the Cat entity wusername_2 its own module, provider, interface, dto, shema, controller and service.

in the app module file imported the user module in the imports array.
in the user module file imported the database module in the imports array wusername_2 rest operator (...) and this is the place where the error occurs.
comment