Skip to content

[Live] scalar type coercion when hydrating #526

Closed
@kbond

Description

@kbond

If a component property's type-hint is int and you try to hydrate with '', you get an error. I propose we automatically cast simple, scalar types:

  • int: '' or ' ' => 0
  • float: '' or ' ' => 0.0
  • bool: '' or ' ' => false
  • ?int: '' or ' ' => null
  • ?float: '' or ' ' => null
  • ?bool: '' or ' ' => null

How to handle?

  • int: 'apple'?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions