Help writing more TypeScript documentation
See original GitHub issueWhen doing a query the manual says to do this:
const ourUser = await User.findByPk(1, {
include: [User.associations.Project],
rejectOnEmpty: true, // Specifying true here removes `null` from the return type!
});
if we’re wanting to load multiple nested models, how should i go about doing this:
const user = await User.findAll({
attributes: ['id', 'name', 'email'],
include: {
model: Role,
required: true,
where: { projectId },
include: [
{
model: Project,
required: true
},
{
model: Group,
required: true,
where: { code: 'cli' }
}
]
}
});
Currently I’m getting the error
Type '{ model: typeof Role; required: boolean; where: { projectId: any; }; include: ({ model: typeof Project; required: boolean; } | { model: typeof Group; required: boolean; where: { code: string; }; })[]; }' is not assignable to type 'Includeable[]'.
Object literal may only specify known properties, and 'model' does not exist in type 'Includeable[]'.ts(2322)
Issue Analytics
- State:
- Created 4 years ago
- Comments:26 (11 by maintainers)
Top Results From Across the Web
The starting point for learning TypeScript
TypeScript Documentation. Get Started. Quick introductions based on your background or preference. TS for the New Programmer · TypeScript for JS ...
Read more >Documenting Your TypeScript Projects: There Are Options
Whether you're a TypeScript developer, a JavaScript developer or any type of developer really, you most likely hate writing documentation.
Read more >Writing more descriptive intellisense docs for Typescript Union ...
You can't really annotate union members. You can, however, express your union differently — by using overloads or by choosing to use an...
Read more >Generating Documentation for TypeScript Projects
These annotations are all optional and the more you add, the more the compiler can help you. Compiling the TypeScript version results in ......
Read more >Working with JavaScript in Visual Studio Code
While IntelliSense should just work for most JavaScript projects without any ... You can read more about writing d.ts in the TypeScript documentation....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry for the slow reply. @SimonSchick.
I’m sure this is is an ignorant question, but why is
Model
typed as a class instead of an interface now?@SimonSchick First, just wanted to say thanks for all your work on this, i’m excited about using sequelize with typescript. Just wanted to chime in I do hope you find time to address these issues in v6. When I realized
create
wasn’t typesafe, I felt 😢😿😭