Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript 4.8.2 does not like the type definitions from sequelize 6.21.4 #14934

Closed
dilyanpalauzov opened this issue Aug 26, 2022 · 9 comments · Fixed by #14996
Closed

Typescript 4.8.2 does not like the type definitions from sequelize 6.21.4 #14934

dilyanpalauzov opened this issue Aug 26, 2022 · 9 comments · Fixed by #14996
Labels
released on @v7 type: typescript For issues and PRs. Things that involve typescript, such as typings and intellisense.

Comments

@dilyanpalauzov
Copy link
Contributor

Upgrading to Typescripte 4.8.2 and running tsc prints on my system:

node_modules/sequelize/types/hooks.d.ts:69:19 - error TS2344: Type 'TAttributes' does not satisfy the constraint '{}'.                  
                                                                                                                                        
69   M extends Model<TAttributes, TCreationAttributes> = Model,                                                                         
                     ~~~~~~~~~~~                                                                                                        
                                                                                                                                        
  node_modules/sequelize/types/hooks.d.ts:70:3                                                                                          
    70   TAttributes = any,                                                                                                             
         ~~~~~~~~~~~~~~~~~                                                                                                              
    This type parameter might need an `extends {}` constraint.                                                                          
                                                                                                                                        
node_modules/sequelize/types/model.d.ts:3252:105 - error TS2344: Type 'TModelAttributes' does not satisfy the constraint '{}'.          
                                                                                                                                        
3252 export type ModelType<TModelAttributes = any, TCreationAttributes = TModelAttributes> = new () => Model<TModelAttributes, TCreation
Attributes>;
                                                                                                             ~~~~~~~~~~~~~~~~

  node_modules/sequelize/types/model.d.ts:3252:23
    3252 export type ModelType<TModelAttributes = any, TCreationAttributes = TModelAttributes> = new () => Model<TModelAttributes, TCrea
tionAttributes>;
                               ~~~~~~~~~~~~~~~~~~~~~~
    This type parameter might need an `extends {}` constraint.

node_modules/sequelize/types/model.d.ts:3260:52 - error TS2344: Type 'S' does not satisfy the constraint '{}'.

3260 export type ModelDefined<S, T> = ModelStatic<Model<S, T>>;
                                                        ~

  node_modules/sequelize/types/model.d.ts:3260:26
    3260 export type ModelDefined<S, T> = ModelStatic<Model<S, T>>;
                                  ~
    This type parameter might need an `extends {}` constraint.

As these errors do not reference my files, I assume that the files with type definitions exported by sequelize 6.21.4 are not good.

@WikiRik WikiRik added the type: typescript For issues and PRs. Things that involve typescript, such as typings and intellisense. label Aug 26, 2022
@WikiRik
Copy link
Member

WikiRik commented Aug 26, 2022

Thanks for letting us know! We have not looked into TypeScript 4.8 support yet, but it will land in the next release.

@benasher44
Copy link

Yep getting same issue here. The fix should just be to switch the constraint to extends {} = {} anywhere where the generic contraint is = {} (tells TypeScript you don't want null or undefined)

@WhiteMinds
Copy link

The conflict comes from microsoft/TypeScript#49119

@donleistman
Copy link

Same issue here

@damlatato
Copy link

damlatato commented Sep 15, 2022

we are having the same issue

@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 7.0.0-alpha.17 🎉

The release is available on:

Your semantic-release bot 📦🚀

@alexey-sh
Copy link

Is there any chance to see the fix in v6.x ?

@ephys
Copy link
Member

ephys commented Mar 25, 2023

You may be having a different issue because this was released in Sequelize 6.23 & 7.0.0-alpha.17 (even though the bot only mentioned one of them, see #14990)

@alexey-sh
Copy link

@ephys thanks for the response.
I have "version": "6.21.4" installed. So I'll consider update to 6.23.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @v7 type: typescript For issues and PRs. Things that involve typescript, such as typings and intellisense.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants