不要怂,就是干,撸起袖子干!

Commit 8d1972f6 by Mirko Jotic Committed by Sushant

fix(types): reorder model.get overload (#10797)

1 parent 0c447227
Showing with 6 additions and 2 deletions
......@@ -2476,8 +2476,8 @@ export abstract class Model<T = any, T2 = any> extends Hooks {
* @param options.plain If set to true, included instances will be returned as plain objects
*/
public get(options?: { plain?: boolean; clone?: boolean }): object;
public get(key: string, options?: { plain?: boolean; clone?: boolean }): unknown;
public get<K extends keyof this>(key: K, options?: { plain?: boolean; clone?: boolean }): this[K];
public get(key: string, options?: { plain?: boolean; clone?: boolean }): unknown;
/**
* Set is used to update values on the instance (the sequelize representation of the instance that is,
......
import { Association, HasOne, Model, Sequelize, DataTypes } from 'sequelize';
import { Association, HasOne, Model, Sequelize } from 'sequelize';
class MyModel extends Model {
public num: number;
public static associations: {
other: HasOne;
};
......@@ -13,6 +14,9 @@ class OtherModel extends Model {}
const assoc: Association = MyModel.associations.other;
const Instance: MyModel = new MyModel({ int: 10 });
const num: number = Instance.get('num');
MyModel.findOne({
include: [
{ model: OtherModel, paranoid: true }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!