Skip to content

Regression on components with inputs using a transform function #483

Closed
@mlz11

Description

@mlz11

Hello 👋🏻,

I believe I encountered a regression after bumping the package @testing-library/angular from v17.1.0 to v17.2.1 while trying to use the new inputs property.

The issue arises with components that have inputs using a transform function that changes the type, such as:

 title = input.required<TitleObject, string>({
    transform: toTitleObject,
  });

Below is the test I wrote :

it('should render', async () => {
    await render(ChildComponent, {
      inputs: {
        title: 'title',
      },
    });
  });

In this case, TypeScript raises an error on the render function 🔴:

Type 'typeof ChildComponent' is not assignable to type 'string'.

When modifying the input so that it has the same type as after the transformation, the TypeScript error is resolved, and the test passes 🟢:

it('should render', async () => {
    await render(ChildComponent, {
      inputs: {
        title: {title: 'title'},
      },
    });
  });

Please find a reproduction sample below:

https://github.com/mlz11/atl-issue-pr-473

If this is confirmed as a bug, I would love to contribute to resolving it.

Thanks for your help!

Metadata

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