kiwilan / typescriptable-laravel

PHP package for Laravel to type Eloquent models, routes, Spatie Settings with autogenerated TypeScript. Optional NPM package for Inertia.
https://packagist.org/packages/kiwilan/typescriptable-laravel
MIT License
33 stars 3 forks source link

[Feature]: Add a flag to declare model timestamps as not nullable #84

Open joelstein opened 3 weeks ago

joelstein commented 3 weeks ago

What happened?

First of all, thanks for this excellent package. Also, I couldn't figure out how to request a feature, so this is coming through as a bug report. Sorry!

Laravel's model timestamps always makes created_at and updated_at nullable (here's why).

This causes the types to be like:

created_at?: string
updated_at?: string

Even though they will always have a value.

Would you consider adding a config option to force model timestamps always to be strings instead of nullable strings?

How to reproduce the bug

(The bug report form requires me to put something here...)

Package Version

3.1

PHP Version

8.3.13

Which operating systems does with happen with?

macOS

Notes

No response

ewilan-riviere commented 3 weeks ago

Thanks!

It's a very good idea! I will work on it in this week ;)