Skip to content

Better types for RenderComponentOptions #412

Open
@Christian24

Description

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?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions