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

AssociationOptionsHasOne does not have scope #172

Open
tteke opened this issue Oct 4, 2018 · 1 comment
Open

AssociationOptionsHasOne does not have scope #172

tteke opened this issue Oct 4, 2018 · 1 comment

Comments

@tteke
Copy link

tteke commented Oct 4, 2018

As the title says AssociationOptionsHasOne does not have a scope although in the Sequelize it is possible to add scole to hasone association.

@billybarnum
Copy link

I take it you're using v4 from the name; it's called HasOneOptions in v5 typings, and it looks like it's fixed in v5 beta.

If you've solved the problem, you might close the issue. If not, you can override locally using typescript's declare module. Here's an example of how I did it for similar issues:

import * as Sequelize from 'sequelize';
declare module 'sequelize' {
    interface AssociationOptionsHasOne {
        sourceKey?: string;
    }

    interface AssociationOptionsBelongsTo {
        scope?: Sequelize.AssociationScope;
    }

    interface DataTypes {
        GEOGRAPHY: any;
        CIDR: any;
        INET: any;
        MACADDR: any;
    }
}

I think it's called "declaration merging" or something, and it's limited. But when you need to add a missing property, it definitely works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants