Skip to content

Type errors in database errors code #14000

Closed

Description

@andrejleitner

Issue Creation Checklist

[x] I have read the contribution guidelines

Bug Description

SSCCE

Here is the link to the SSCCE for this issue: N.A.

What do you expect to happen?

Typescript compilation to work smoothly.

What is actually happening?

There are some type errors from sequelize codebase:

node_modules/sequelize/lib/errors/database/exclusion-constraint-error.ts:23:5 - error TS2322: Type '(DatabaseErrorSubclassOptions & ExclusionConstraintErrorOptions) | {}' is not assignable to type 'DatabaseErrorSubclassOptions & ExclusionConstraintErrorOptions'.
  Type '{}' is not assignable to type 'DatabaseErrorSubclassOptions & ExclusionConstraintErrorOptions'.
    Type '{}' is missing the following properties from type 'ExclusionConstraintErrorOptions': constraint, fields, table

23     options = options || {};
       ~~~~~~~

node_modules/sequelize/lib/errors/database/foreign-key-constraint-error.ts:29:5 - error TS2322: Type '(ForeignKeyConstraintErrorOptions & DatabaseErrorSubclassOptions) | {}' is not assignable to type 'ForeignKeyConstraintErrorOptions & DatabaseErrorSubclassOptions'.
  Type '{}' is not assignable to type 'ForeignKeyConstraintErrorOptions & DatabaseErrorSubclassOptions'.
    Type '{}' is missing the following properties from type 'ForeignKeyConstraintErrorOptions': table, fields, value, index, reltype

29     options = options || {};
       ~~~~~~~

node_modules/sequelize/lib/errors/database/unknown-constraint-error.ts:23:5 - error TS2322: Type '(UnknownConstraintErrorOptions & DatabaseErrorSubclassOptions) | {}' is not assignable to type 'UnknownConstraintErrorOptions & DatabaseErrorSubclassOptions'.
  Type '{}' is not assignable to type 'UnknownConstraintErrorOptions & DatabaseErrorSubclassOptions'.
    Type '{}' is missing the following properties from type 'UnknownConstraintErrorOptions': constraint, fields, table

23     options = options || {};
       ~~~~~~~


Found 3 errors.

Additional context

Appeared after the version upgrade: 6.7.0 > 6.14.0

Environment

  • Sequelize version: 6.14.0
  • Node.js version: 16.13.1
  • TypeScript version: 4.3.5

Bug Report 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.

Activity

  1. changed the title [-]Type errors in database errors after upgrade[/-] [+]Type errors in database errors code[/+] on Jan 24, 2022
  2. ephys commented on Jan 24, 2022

    @ephys
    Member

    This problem does really exist but it's weird it went unreported. Maybe it was shadowed by types/lib/errors.d.ts which wasn't deleted.

    The fact that tsc is reporting errors in /lib for end-users is also an issue. That's likely due to tsc not being able to map /lib to /dist/lib yet

    I think we should move /lib to /src & make /lib the folder for runnable code again, like it was before. We can then add src to .npmignore

  3. added
    type: bug
    typescript
    on Jan 24, 2022
  4. WikiRik commented on Jan 24, 2022

    @WikiRik
    Member

    The fact that tsc is reporting errors in /lib for end-users is also an issue. That's likely due to tsc not being able to map /lib to /dist/lib yet

    I think we should move /lib to /src & make /lib the folder for runnable code again, like it was before. We can then add src to .npmignore

    Can you make a separate PR for this?

  5. github-actions commented on Feb 7, 2022

    @github-actions
    Contributor

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

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

released on @v7type: bugtypescript

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions