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

Commit 57aba974 by Jesse Rosenberger Committed by Sushant

docs(typescript): typo with associations (#10707)

1 parent 175da2d0
...@@ -43,7 +43,7 @@ class User extends Model { ...@@ -43,7 +43,7 @@ class User extends Model {
// actively include a relation. // actively include a relation.
public readonly projects?: Project[]; public readonly projects?: Project[];
public static associtations: { public static associations: {
projects: Association<User, Project>; projects: Association<User, Project>;
}; };
} }
......
...@@ -34,7 +34,7 @@ class User extends Model { ...@@ -34,7 +34,7 @@ class User extends Model {
// actively include a relation. // actively include a relation.
public readonly projects?: Project[]; public readonly projects?: Project[];
public static associtations: { public static associations: {
projects: Association<User, Project>; projects: Association<User, Project>;
}; };
} }
...@@ -133,7 +133,7 @@ async function stuff() { ...@@ -133,7 +133,7 @@ async function stuff() {
}); });
const ourUser = await User.findByPk(1, { const ourUser = await User.findByPk(1, {
include: [User.associations.Project], include: [User.associations.projects],
rejectOnEmpty: true, // Specifying true here removes `null` from the return type! rejectOnEmpty: true, // Specifying true here removes `null` from the return type!
}); });
console.log(ourUser.projects![0].name); // Note the `!` null assertion since TS can't know if we included console.log(ourUser.projects![0].name); // Note the `!` null assertion since TS can't know if we included
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!