Closed
Description
TypeScript Version: 3.9.0-dev.20200420
Search Terms:
Intersection, Union, 7053
Code
export type TypedArray = Int32Array | Uint8Array;
export function isTypedArray(a: {}): a is Int32Array | Uint8Array {
return a instanceof Int32Array || a instanceof Uint8Array;
}
export function flatten<T extends number|TypedArray>(arr: T) {
if (isTypedArray(arr)) {
arr[1]; // TS 7053
}
}
3.8 behavior: No error
3.9 behavior: Error
Related Issues: I'm guessing this is another empty intersection bug, but I wasn't sure how to de-dup it.
Inspiration is from https://github.com/tensorflow/tfjs/blob/95995e7fec478e86b4baf0d34f902d3e345ee54b/tfjs-core/src/util.ts#L144