email stays off the TypeScript draft

php dev.to

The two objects did not share a shape. Ada's row had name. The next row had email and no name. I pasted the array into the JSON converter and ran it in the browser. TypeScript drafted export interface Root from the first object, so email stayed off the interface. The PHP DTO used that same first object. Laravel still walked both rows, and CSV still collected every top-level key. [{"id":1,"name":"Ada"},{"id":2,"email":"linus@example.com"}] Laravel keeps the second row Laravel

Read Full Tutorial open_in_new
arrow_back Back to Tutorials