TypeScript Version: 2.4.1
Code
declareinterfaceT{foo: string;}constimmutable: T|ReadonlyArray<T>=[];if(Array.isArray(immutable)){constx=immutable;// Any[] - Should be ReadonlyArray<T>}constmutable: T|Array<T>=[];if(Array.isArray(mutable)){constx=mutable;// T[]}Expected behavior: Should type narrow to ReadonlyArray<T>, or at the very least T[].
Actual behavior: Narrows to any[]. Doesn't trigger warnings in noImplicitAny mode either.
TypeScript Version: 2.4.1
Code
Expected behavior: Should type narrow to
ReadonlyArray<T>, or at the very leastT[].Actual behavior: Narrows to
any[]. Doesn't trigger warnings in noImplicitAny mode either.