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

compile TypeScript:... 'select' does not exist in type 'FindConditions<User>' #317

Open
bytesniffer opened this issue Feb 15, 2020 · 1 comment

Comments

@bytesniffer
Copy link

I met some problem,when i npm start on project root,

/home/workspace/mili/node_modules/ts-node/src/index.ts:240
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/user/user.service.ts:486:17 - error TS2345: Argument of type '{ select: { id: boolean; username: boolean; avatarURL: boolean; }; where: { username: string; }; }' is not assignable to parameter of type 'FindConditions<User>'.
  Object literal may only specify known properties, and 'select' does not exist in type 'FindConditions<User>'.

486                 select: {
                    ~~~~~~~~~
487                     id: true,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
489                     avatarURL: true,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
490                 },
    ~~~~~~~~~~~~~~~~~
src/user/user.service.ts:673:17 - error TS2345: Argument of type '{ select: { id: boolean; username: boolean; avatarURL: boolean; }; skip: number; take: number; }' is not assignable to parameter of type 'FindConditions<User>'.
  Object literal may only specify known properties, and 'select' does not exist in type 'FindConditions<User>'.

673                 select: {
                    ~~~~~~~~~
674                     id: true,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
676                     avatarURL: true,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
677                 },
    ~~~~~~~~~~~~~~~~~
src/user/user.service.ts:696:13 - error TS2345: Argument of type '{ select: { id: boolean; username: boolean; avatarURL: boolean; introduce: boolean; job: boolean; company: boolean; }; skip: number; take: number; order: { articleCount: string; }; }' is not assignable to parameter of type 'FindConditions<User>'.
  Object literal may only specify known properties, and 'select' does not exist in type 'FindConditions<User>'.

696             select: {
                ~~~~~~~~~
697                 id: true,
    ~~~~~~~~~~~~~~~~~~~~~~~~~
... 
702                 company: true,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
703             },
    ~~~~~~~~~~~~~

so how to get this right

@MBerka
Copy link

MBerka commented Jun 5, 2021

I do not know the model that was used here, but the normal TypeORM select format looks like:

userRepository.find({ select: ["id", "company"] });

(the select property will be stated to "not exist" if it contains anything other than array of column names).

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