feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.97k stars 742 forks source link

$select should not be limited by query properties in _find #3418

Open AshotN opened 5 months ago

AshotN commented 5 months ago

Steps to reproduce

Trying to call _find like this leads to a type error if website is not available in query properties.

_find is not limited by query properties

export const companyQueryProperties = Type.Pick(companySchema, ['name', 'active', 'id', 'created_at'])
 const companys = await app.service('company')._find({
      paginate: false,
      query: {
        $select: ['name', 'website']
      },
      user: context.params.user
    })

Expected behavior

TypeScript should be aware that underscore methods have access to everything

Actual behavior

Type  "website"  is not assignable to type  "id" | "name" | "active" | "created_at" 

System configuration

"@feathersjs/feathers": "5.0.21",