Pick up the `DataCollectionOf` attribute from spatie/laravel-data
Closed this issue · 1 comments
bram-pkg commented
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 DataCollectionOf
attribute.
bram-pkg commented
I'm considering making a PR for this, it does not sound THAT hard. I would appreciate a little guidance, though - some of the code can be quite hard to follow.