Home > Net >  Type 'number' has no properties in common with type 'FindOneOptions<Client>
Type 'number' has no properties in common with type 'FindOneOptions<Client>

Time:06-06

enter image description here

While creating a findOne request using typeorm i get this error, HELP!

CodePudding user response:

According to the TypeORM docs you need to call findOne like this (assuming clientId is also the name of the column in the Client table).

const client = await Client.findOne({
    where: {
        clientId: clientId
    }
});

The error message is telling you that it is expecting a FindOneOptions<Client> but you are giving it a number instead.

  • Related