Issue Creation Checklist
Bug Description
ModelStatic TypeScript type looses custom satic methods.
Reproducible Example
const sequelize = ...; // Your Sequelize instance
class Foo extends Model {
static myHelper(): Promise<Foo[]> {
return this.findAll(...); // Custom logic, custom options, etc.
}
}
Foo.init({}, { sequelize });
const F = sequelize.model('Foo') as ModelStatic<Foo>;
F.myHelper(); // TS2339: Property myHelper does not exist on type ModelStatic<Foo>
As a workaround you can type the return of sequelize.model) as typeof M instead.
What do you expect to happen?
The static helpers are kept in the ModelStatic type, and available.
What is actually happening?
The static helpers aren't available on the ModelStatic type.
Environment
- Sequelize version: 6.37.8
- Node.js version: 24.11.1
- If TypeScript related: TypeScript version: 6.0.2
- Database & Version: MySQL 8
- Connector library & Version: mysql2@3.20.0
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
Issue Creation Checklist
Bug Description
ModelStatic TypeScript type looses custom satic methods.
Reproducible Example
As a workaround you can type the return of
sequelize.model)astypeof Minstead.What do you expect to happen?
The static helpers are kept in the ModelStatic type, and available.
What is actually happening?
The static helpers aren't available on the ModelStatic type.
Environment
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.