Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Specify prototype of object for getObject. #60

Open
christo8989 opened this issue Jul 13, 2017 · 0 comments
Open

Specify prototype of object for getObject. #60

christo8989 opened this issue Jul 13, 2017 · 0 comments

Comments

@christo8989
Copy link

I would love to specify a base object/prototype when I call getObject.

class Person { ... }
this.cookies.getObject('people', Person)

Why?

I'm using typescript and creating "classes" with properties on them. For example:

class Person {
    constructor(
        public firstname: string,
        public lastname: string) { }

    get fullname() {
        return `${this.firstname} ${this.lastname}`;
    }
}

When I use this.cookies.getObject('people'), I lose the fullname property becuase it exists on the prototype.

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

No branches or pull requests

1 participant