generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
I’m using spatie/laravel-model-states, but the cast for the state field is not handled properly. Every time I regenerate my types, I have to manually re-add the type string for every field that it is a state. It would be helpful to support this library, ideally by defining a type with all possible state values instead of a generic string. Alternatively, having a way to implement custom type definitions would solve the issue.
Another improvement could be to set undeterminable types as any, logging a warning in the console. This would help prevent syntax errors that currently require manual fixes (e.g., for git hooks).
How to reproduce the bug
After running php artisan typescriptable the field is empty, causing a syntax error:
export interface MyModel {
id: number
state:
created_at?: string
updated_at?: string
}Package Version
3.1
PHP Version
8.4
Which operating systems does with happen with?
No response
Notes
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working