Reinterprets each element in the sequence as the specified result type.
Target type exposed by the returned sequence.
Type of elements within the source iterable.
source
The source iterable.
A sequence that yields the same elements typed as TResult.
TResult
No runtime conversion occurs; ensure the underlying elements are compatible with TResult to avoid downstream failures.
const mixed = [1, 'two', 3, 'four'];const numbers = cast<number>(mixed).where(x => typeof x === 'number');console.log(numbers.toArray()); // [1, 3] Copy
const mixed = [1, 'two', 3, 'four'];const numbers = cast<number>(mixed).where(x => typeof x === 'number');console.log(numbers.toArray()); // [1, 3]
Reinterprets each element in the sequence as the specified result type.