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

Mapping exception when extending another class and not adding @EsField() to child class #13

Open
jvvvch opened this issue Feb 13, 2021 · 0 comments

Comments

@jvvvch
Copy link

jvvvch commented Feb 13, 2021

Minimal way to reproduce:

@EsEntity()
export class A {
    @EsField({ type: 'text' })
    a: string;
}

@EsEntity() 
export class B extends A {
    b: string;
}

When you run it, you will have the following exception:

const currentMappingProperty = mapping.properties.get(propertyName);
                                                       ^
TypeError: Cannot read property 'properties' of undefined
    at mergeProperties 

It happens because it tries to access properties of the child class, but it just doesn't have any defined mapping properties. Can be fixed by adding a placeholder property to child class and decorate it with @EsField(), but I think it would be better if the service itself understood that there is no properties in the child class and didn't try to get them.

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

1 participant