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

Better types for RenderComponentOptions #412

Open
Christian24 opened this issue Sep 11, 2023 · 0 comments · May be fixed by #413
Open

Better types for RenderComponentOptions #412

Christian24 opened this issue Sep 11, 2023 · 0 comments · May be fixed by #413

Comments

@Christian24
Copy link

Hi,

I wish RenderComponentOptions were typed a little more. I have seen something along the lines of:

 const routingMock = new RouterMock()
        const ourPageMenuButtons: MenuButton[] = [{ name: 'testName', path: 'testPath' },
        { name: 'testName2', path: 'testPath2' }, { name: 'testName3', path: 'testPath3' }];
        await render(MenuComponent, {
            componentProviders: [ {provide: Router, usevalue: routingMock} ],
            componentProperties: {
                pageMenuButtons: ourPageMenuButtons
            }
        });

useValue isn't written correctly, there is no error in the static code analysis, because the actual type is just any[].

Maybe we can change it to something like:

export interface ProviderInterface {
  provide: any;
  useValue: any;
  multi?: boolean;
}
... RenderComponentOptions
imports?: Array<Type<any>|ModuleWithProviders<unknown>|any[]>;
providers?: Array<ProviderInterface | TypeProvider | EnvironmentProviders>;
componentProviders?: Array<ProviderInterface | TypeProvider | EnvironmentProviders>;

What do you think?

@Christian24 Christian24 linked a pull request Sep 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant