Generating TypeScript code
Generate TypeScript code from your PHP objects with its types, including backed enums, etc. All this taking in mind the input data types accepted by the data mapper.
use OpenSoutheners\LaravelDataMapper\Support\TypeScript;
map(MyObjectClass::class)->to(TypeScript::class);
The following will return an instance of that same TypeScript
class which can be used within strings or converts to string to get the TypeScript code.
use OpenSoutheners\LaravelDataMapper\Support\TypeScript;
$typeScript = map(MyObjectClass::class)->to(TypeScript::class);
echo (string) $typeScript;
Last updated
Was this helpful?