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

DynamicDialog: Add generic support to DynamicDialogConfig #11665

Closed
Tazaf opened this issue Jun 28, 2022 · 0 comments · Fixed by #11666
Closed

DynamicDialog: Add generic support to DynamicDialogConfig #11665

Tazaf opened this issue Jun 28, 2022 · 0 comments · Fixed by #11666
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@Tazaf
Copy link
Contributor

Tazaf commented Jun 28, 2022

Describe the feature you would like to see added

To prevent the use and access of an any property through DyamicDialogConfig.data, it would be nice (and pretty easy) to give users the option of custom typing it with the help of generics.

Is your feature request related to a problem?

No response

Describe the solution you'd like

No response

Describe alternatives you have considered

I tried adding the type with some TypeScript shenanigan, but this solution is not maintainable and superfluously convoluted:

import { DynamicDialogConfig as UnsafeDynamicDialogConfig from 'primeng/dynamicdialog';

declare class DynamicDialogConfig extends UnsafeDynamicDialogConfig {
  data?: { foo?: Foo; };
}

@Component({ /* ... */})
export class SomeComponent {
  foo?: Foo;
  constructor(config: DynamicDialogConfig) {
    this.foo = config.data.foo;
  }
}

EDIT: Well... it does actually work so... 🤷

Additional context

No response

@cetincakiroglu cetincakiroglu added this to the 14.0.3 milestone Sep 9, 2022
@cetincakiroglu cetincakiroglu linked a pull request Sep 9, 2022 that will close this issue
@cetincakiroglu cetincakiroglu added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants