spatie/typescript-transformer

[BUG] Unresolved array-key type

Closed this issue · 1 comments

I use spatie/laravel-data to trigger the bug

Example:

class Input extends BaseInput
{
    /**
     * @param  Collection<array-key, array-key>  $product_ids
     */
    public function __construct(
        public Collection $product_ids,
    ) {
    }
}
php artisan typescript:transform

# ouput error
# Could not transform type: array-key

See:

https://github.com/spatie/typescript-transformer/blob/main/src/Actions/TranspileTypeToTypeScriptAction.php#L42

If Type implements the \phpDocumentor\Reflection\PseudoType interface, it should call \phpDocumentor\Reflection\PseudoType::underlyingType() to return the correct Type

This should be fixed with the newest version of TypeScript transformer.