Home > Software design >  what does this error mean this came while running a nestjs module created
what does this error mean this came while running a nestjs module created

Time:10-22

this error came after running npm run start:dev I did not understand what it does mean?

import { Injectable } from "@nestjs/common";
import { User } from "./users.model";



@Injectable
export class UsersService{

users : Array<User>=[]

getUsers(){
return this.users;
}
}
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

enter image description here

CodePudding user response:

This is maybe a typo. You wrote @Injectable instead of @Injectable().

CodePudding user response:

import { Injectable } from "@nestjs/common";
import { User } from "./users.model";

@Injectable()
export class UsersService {
  users: Array<User> = [];

  getUsers() {
    return this.users;
  }
}

The decorator needs to be corrected to @Injectable().

CodePudding user response:

Syntax error

You have: @Injectable

Needed: @Injectable()

Example:

https://docs.nestjs.com/providers

  • Related