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

DynamicModule is not assignable to type #19

Open
heshuai326 opened this issue Aug 26, 2019 · 1 comment
Open

DynamicModule is not assignable to type #19

heshuai326 opened this issue Aug 26, 2019 · 1 comment

Comments

@heshuai326
Copy link

`
import { RedisModule } from 'nestjs-redis';

@module({
imports: [
RedisModule.register({
name: '',
host: '',
port: 6379,
db: 1,
password: '',
keyPrefix: '_dream'
}),
})

return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
src/app.module.ts(33,5): error TS2322: Type 'DynamicModule' is not assignable to type 'Type | DynamicModule | Promise | ForwardReference'.
Type 'import("E:/serve/node_modules/nestjs-redis/node_modules/@nestjs/common/interfaces/modules/dynamic-module.interface").DynamicModule' is not assignable to type 'import("E:/serve/node_modules/@nestjs/common/interfaces/modules/dynamic-module.interface").DynamicModule'.
Types of property 'imports' are incompatible.
Type '(DynamicModule | Type | Promise | ForwardReference)[]' is not assignable to type '(Type | DynamicModule | Promise | ForwardReference)[]'.
Type 'DynamicModule | Type | Promise | ForwardReference' is not assignable to type 'Type | DynamicModule | Promise | ForwardReference'.
Type 'DynamicModule' is not assignable to type 'Type | DynamicModule | Promise | ForwardReference'.

at createTSError (E:\serve\node_modules\ts-node\src\index.ts:261:12)
at getOutput (E:\serve\node_modules\ts-node\src\index.ts:367:40)
at Object.compile (E:\serve\node_modules\ts-node\src\index.ts:558:11)
at Module.m._compile (E:\serve\node_modules\ts-node\src\index.ts:439:43)
at Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Object.require.extensions.(anonymous function) [as .ts] (E:\serve\node_modules\ts-node\src\index.ts:442:12)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)

I use yarn to instead of npm but the error still
yarn add nestjs-redis -S
(https://github.com/kyknow/nestjs-redis/issues/11)

@andrii33
Copy link

I believe that happened because of the different versions of the nestjs in your app and module.

The Redis module uses version 6 https://github.com/kyknow/nestjs-redis/blob/master/package.json#L24
And your app is probably 8 or 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants