const function = <T>(
input: string | ArrayLike<T>
) => (output: string | ArrayLike<T>, position = 0) => {
// perform operations with input and output
}
const result = function ('abc')
In this scenario, the resulting value is assigned as :
(output: string | ArrayLike<string>, position? number) => void
However, I am seeking for the outcome to be defined as (output: string, position? number) => void
, adhering to the type of input
supplied to function
which was a string.
Additionally, I comprehend why the generic type T
is perceived as a string - but my requirement demands an ArrayLike of T or a string exclusively and not a combination of both...
This specification is necessary to streamline the return type of a call to result.
Your assistance on this matter would be greatly appreciated ;)