TypeScript/tests/cases/compiler/arrayBufferIsViewNarrowsType.ts
John Vilk f10c7cc154 Change ArrayBuffer.isView declaration to type guard for ArrayBufferView.
Also adds a test that checks that `ArrayBuffer.isView` appropriately narrows its argument to `ArrayBufferView`.

Fixes #5308.
2015-10-18 20:05:30 -04:00

5 lines
154 B
TypeScript

var obj: Object;
if (ArrayBuffer.isView(obj)) {
// isView should be a guard that narrows type to ArrayBufferView.
var ab: ArrayBufferView = obj;
}