-
Currently, when creating typescript definitions of spatie/laravel-data objects, it's required to add an docblock static the arrayable type of the property: #[TypeScript]
class UserData extends Data {
public function __construct(
public string $name,
/** @var PostData[] $posts */
#[DataCollectionOf(PostData::class)]
public DataCollection $posts,
) {}
} It would be great if it was possible to remove the docblock there and infer the type from the |
Beta Was this translation helpful? Give feedback.
Answered by
bram-pkg
Oct 31, 2023
Replies: 1 comment
-
Turns out I was very dumb and missed the part of the documentation for Link: https://spatie.be/docs/laravel-data/v3/advanced-usage/typescript |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
bram-pkg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turns out I was very dumb and missed the part of the documentation for
laravel-data
which instructs you to add the custom transformer from that package.Link: https://spatie.be/docs/laravel-data/v3/advanced-usage/typescript