Closed GregEisenberg closed 3 years ago
@kamilmysliwiec should we add this as a step to the resource generation (check if @nestjs/mapped-types
is installed and install it if not) or just add a note in the docs saying this package should be installed?
If you are asking me - my opinion is that since the resource generation code inserts import { PartialType } from '@nestjs/mapped-types';
then the resource generation code is responsible to (check if @nestjs/mapped-types is installed and install it if not)
Added in @nestjs/schematics@7.3.0
In my case @nestjs/mapped-types did not install with the command nest g resource user because he needed administrator rights for some reason.
Solution: sudo nest g resource user
Mac/Linux
@HolikovOleksandr everything went fine here on Linux:
npm i -g @nestjs/cli@latest # 10.3.0
nest new test-project
cd test-project
npm install --save @nestjs/typeorm typeorm postgres pg
nest g resource user
npm run start
Please provide a minimum reproduction if you want us to take a look on it again.
Also, I'd suggest you to avoid using the globally installed nestjs CLI. Use the one per project instead (via npx nest
/yarn nest
)
Bug Report
After running
nest g resource user
to create a new resource module for "user" (with controller, service and entities stubbed) the pre-generatedupdate-user.dto.ts
fails to resolveimport { PartialType } from '@nestjs/mapped-types';
Current behavior
Assuming
npm i -g @nestjs/cli
has been runnest new test-project
to create a test projectnpm install --save @nestjs/typeorm typeorm postgres pg
to get TypeOrm and Postgres support in placenest g resource user
to create a user modulenpm start run
to test(its possible #2 is not a required step of the repro)
Expected behavior
awesomeness
Actual behavior
Possible Solution
worked around by manually running
npm i --save @nestjs/mapped-types
which is fine - but no place in the docs does it reference that this package would have to be installed separately - thus I decided I would submit this issue.Environment
BTW - thanks for the awesome NestJS platform!