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

Add type checking for request, session and user data #1250

Open
1 of 4 tasks
acerbisgianluca opened this issue Feb 23, 2022 · 1 comment
Open
1 of 4 tasks

Add type checking for request, session and user data #1250

acerbisgianluca opened this issue Feb 23, 2022 · 1 comment

Comments

@acerbisgianluca
Copy link
Contributor

acerbisgianluca commented Feb 23, 2022

I'm submitting a...

  • Bug report
  • 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>({...});
@aswetlow
Copy link
Member

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;
  }
}

@acerbisgianluca acerbisgianluca changed the title Add type checking for request, component, session and user data Add type checking for request, session and user data Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants