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

toObject method on entity is not processing simple objects #25

Closed
4lessandrodev opened this issue Jan 5, 2023 · 0 comments
Closed

toObject method on entity is not processing simple objects #25

4lessandrodev opened this issue Jan 5, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@4lessandrodev
Copy link
Owner

4lessandrodev commented Jan 5, 2023

Describe the bug
toObject method on entity is not processing simple objects

To Reproduce

interface Profile {
  name: string;
  age: number;
}

interface Props {
  id?: UID;
  profile: Profile;
}

class Example extends Entity<Props>{}

const example = Example.create({ profile: { name: "Jane", age:21 } }).value();

console.log(example.toObject()):

> {  
       id: "4666ce4b-10d9-4999-9da8-0caef5b7fd50", 
       createdAt: "2023-01-05T18:34:54.198Z", 
       updatedAt: "2023-01-05T18:34:54.198Z" 
 };

Expected behavior
the toObject method should process simple object and apply it to generated props

console.log(example.toObject()):

> {  
       id: "4666ce4b-10d9-4999-9da8-0caef5b7fd50", 
       createdAt: "2023-01-05T18:34:54.198Z", 
       updatedAt: "2023-01-05T18:34:54.198Z",
       profile: { name: "Jane", age: 21 }
 };

Lib Version
rich-domain v1.15.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant