api-platform / admin

A beautiful and fully-featured administration interface builder for hypermedia APIs
https://api-platform.com/docs/admin/
MIT License
481 stars 130 forks source link

[TypeScript] Compilation error when using the `<InputGuesser multiline>` attribute #574

Closed fzaninotto closed 1 month ago

fzaninotto commented 1 month ago

API Platform version(s) affected: 5.0.0

Description

InputGuesser is supposed to pass down all the props it receives to the guessed input. So it must accept all the possible props of all possible inputs.

This works fine for many props (label, readOnly, etc) but not for multiline:

image

How to reproduce

Write the following code:

import { EditGuesser, InputGuesser } from "@api-platform/admin";

export const BookEdit = () => (
  <EditGuesser warnWhenUnsavedChanges>
    <InputGuesser source="isbn" label="ISBN" />
    <InputGuesser source="title" />
    <InputGuesser source="author" />
    <InputGuesser source="description" multiline />
    <InputGuesser source="publicationDate" />
  </EditGuesser>
);

Possible Solution

Fix the types!