jovo-framework icon indicating copy to clipboard operation
jovo-framework copied to clipboard

Add type checking for request, session and user data

Open acerbisgianluca opened this issue 3 years ago • 1 comments

I'm submitting a...

  • [ ] Bug report
  • [x] Feature request
  • [ ] Documentation issue or request
  • [ ] Other... Please describe:

Expected Behavior

I would find really useful the ability to define custom types/interfaces for this.$data, this.$session.data and this.$user.data that can be set while instanciating the App (or platform) object, similarly to what happens with output and component classes, where you can set config and data interfaces.

Something like this:

interface SessionData {
   isLogged: boolean;
}

const app = new App<SessionData>({...});

acerbisgianluca avatar Feb 23 '22 19:02 acerbisgianluca

Hey @acerbisgianluca We had this on our list a few months ago and it's still a valid feature request.

Here's a workaround for now:

declare module '@jovotech/framework/dist/types/interfaces' {
  interface SessionData {
    isLogged: boolean;
  }
}

aswetlow avatar Feb 24 '22 09:02 aswetlow