Also adds a test that checks that `ArrayBuffer.isView` appropriately narrows its argument to `ArrayBufferView`. Fixes #5308.
14 lines
373 B
TypeScript
14 lines
373 B
TypeScript
//// [arrayBufferIsViewNarrowsType.ts]
|
|
var obj: Object;
|
|
if (ArrayBuffer.isView(obj)) {
|
|
// isView should be a guard that narrows type to ArrayBufferView.
|
|
var ab: ArrayBufferView = obj;
|
|
}
|
|
|
|
//// [arrayBufferIsViewNarrowsType.js]
|
|
var obj;
|
|
if (ArrayBuffer.isView(obj)) {
|
|
// isView should be a guard that narrows type to ArrayBufferView.
|
|
var ab = obj;
|
|
}
|