Given the following PHP doc:

/**
 * Retrieve all completed order IDs associated with the given products.
 *
 * @template T of 'id'|'product=>id'
 * @param WC_Product[] $products Array of daily package products
 * @param array $interval Array of start and end datetime to filter (UTC)
 * @param T $fields Fields to select. Can be 'id' or 'product=>id'
 *
 * @return (T is 'id' ? int[] : array<int, int[]>)
 */

I'd expect my_functions( $products, $interval, 'parent=>id' ) to infer array<int, int[]> but that's not happening, devsense is just inferring int[]

    JoeHoyle thank you for the test case.

    Yes, we expect T to be a type, not a literal value.

    We'll try to implement this or at least fix this case within the next update.

      Write a Reply...