Property 'QueryTypes' does not exist on type 'Sequelize'.
See original GitHub issueIssue Description
Type script error for raw queries after upgrade to v5 and removing @types/sequelize from dependencies.
What are you doing?
const { Sequelize } = require('sequelize');
const sequelize = new Sequelize(...);
sequelize.query('SELECT ...', { type: sequelize.QueryTypes.SELECT });
What do you expect to happen?
Code should continue to compile.
What is actually happening?
Typescript compiler error:
Property 'QueryTypes' does not exist on type 'Sequelize'.
Environment
- Sequelize version: 5.19.2
- Node.js version: 12
- Operating System: MacOS
- If TypeScript related: TypeScript version: 3.6.3
Issue Template Checklist
How does this problem relate to dialects?
- I think this problem happens regardless of the dialect.
- I think this problem happens only for the following dialect(s):
- I don’t know, I was using PUT-YOUR-DIALECT-HERE, with connector library version XXX and database version XXX
Would you be willing to resolve this issue by submitting a Pull Request?
- Yes, I have the time and I know how to start.
- Yes, I have the time but I don’t know how to start, I would need guidance.
- No, I don’t have the time, although I believe I could do it if I had the time…
- No, I don’t have the time and I wouldn’t even know how to start.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Property 'Op' does not exist on type 'typeof Sequelize'
I'm getting this error on build using tsc. import { Sequelize } from 'sequelize-typescript';.
Read more >How to use QueryTypes function in Sequelize - Tabnine
models.sequelize.query(request, {type: models.sequelize.QueryTypes.SELECT}).then(function(result){ if(result.length > 0)
Read more >TypeScript - Sequelize
As Sequelize heavily relies on runtime property assignments, TypeScript won't be very useful out of the box. A decent amount of manual type...
Read more >sequelize-typescript - npm
Start using sequelize-typescript in your project by running `npm i ... If the type cannot or should not be inferred, use:.
Read more >How To Use Sequelize with Node.js and MySQL - DigitalOcean
Note: You can manage model synchronization by passing force parameters to force the creation of a new table if it does not exist, ......
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
Yup, I’m working on it (I’m working on a major docs rewrite actually)! Stay tuned.
I disagree, when people try to use TypeScript and get this error, like you did, they can fix it by casting (bad, as you said), or change it to the clean solution:
I’ll leave this open as a WIP docs issue
The current documentation uses
const { QueryTypes } = require('sequelize');
, I’ll close this now.