Closed mrrosenkilde2 closed 3 months ago
I tried to reproduce your bug with these settings:
kiwilan/typescriptable-laravel
v1.12.03spatie/laravel-medialibrary
v11.6A repository is available here: https://github.com/ewilan-riviere/laravel-typescriptable-test/tree/issue-71
The output of php artisan typescriptable
command is:
declare namespace App.Models {
export interface ExampleMediaModel {
media?: any[]
media_count?: number
id?: number
}
}
Can you provide a repository with the bug?
What happened?
When a model uses the trait Spatie\MediaLibrary\InteractsWithMedia, the output looks like this:
How to reproduce the bug
follow the installation instructions: https://github.com/kiwilan/typescriptable-laravel Install: https://github.com/spatie/laravel-medialibrary
run
php artisan make:model DemoModel
Add the InteractsWithMedia trait, and add "use Spatie\Medialibrary\InteractsWithMedia", file should look like this:run
php artisan typescriptable
Generated output:
Package Version
1.12.03
PHP Version
8.3.4
Which operating systems does with happen with?
Windows
Notes
There is currently a workaround by adding a file like so:
And then change
use Spatie\MediaLibrary\InteractsWithMedia
To use that file instead in your models.php artisan about: Environment ...................................................................................................................................... Application Name ......................................................................................................................... Laravel Laravel Version .......................................................................................................................... 10.48.9 PHP Version ................................................................................................................................ 8.3.4 Composer Version ........................................................................................................................... 2.7.2 Environment ................................................................................................................................ local Debug Mode ............................................................................................................................... ENABLED URL .................................................................................................................................... localhost Maintenance Mode ............................................................................................................................. OFF
Features Enabled ......................................................................................................................... Default Version .................................................................................................................................... 6.7.0
composer info spatie/laravel-medialibrar: name : spatie/laravel-medialibrary descrip. : Associate files with Eloquent models keywords : cms, conversion, downloads, images, laravel, laravel-medialibrary, media, spatie versions : * 11.4.7 released : 2024-04-24, this week type : library license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText homepage : https://github.com/spatie/laravel-medialibrary source : [git] https://github.com/spatie/laravel-medialibrary.git 85f5f8284f827b8f2b426943e357e3df117ad1f5 dist : [zip] https://api.github.com/repos/spatie/laravel-medialibrary/zipball/85f5f8284f827b8f2b426943e357e3df117ad1f5 85f5f8284f827b8f2b426943e357e3df117ad1f5 path : C:\Users\Dennis\Herd\tid\vendor\spatie\laravel-medialibrary names : spatie/laravel-medialibrary