sequelize / sequelize-typescript

Decorators and some other features for sequelize
MIT License
2.79k stars 282 forks source link

Type error when using .schema() on a model (2.0.0-beta.0) #823

Open Vilsol opened 4 years ago

Vilsol commented 4 years ago

Versions

I'm submitting a ... [x] bug report [ ] feature request

Actual behavior:

src/sq-ts.ts:8:9 - error TS2740: Type 'Model<{}, {}>' is missing the following properties from type 'Thing': $add, $set, $get, $count, and 3 more.

   const broken: Thing = await Thing.schema('test').findOne()
          ~~~~~~

Expected behavior: No type error

Steps to reproduce: Use the code from below with the versions specified above.

Related code:

import { Model } from 'sequelize-typescript';

class Thing extends Model<Thing> {
}

(async () => {
  const working: Thing = await Thing.findOne()
  const broken: Thing = await Thing.schema('test').findOne()
})()
pkhadson commented 3 years ago

News? I have same problem