Closed

Description
TypeScript Version: 3.5.0-rc / next
Search Terms: 3.5, 3.5 union, 3.5 strict
Code
test.ts:
function fooT<T = string>(bar: T[] | T | undefined) {
if (bar !== undefined && !Array.isArray(bar))
throw new Error("expected array")
else if (bar !== undefined && bar.length === 0) console.log("empty array")
else console.log("array or undef.")
}
CLI:
npx typescript@3.4.5 --strict true test.ts // compiles
npx typescript@next --strict true test.ts // error
Expected behavior:
Compiles and behaves like ts 3.4.5
Actual behavior:
Error:
test.ts:4:37 - error TS2339: Property 'length' does not exist on type 'T | T[]'.
Property 'length' does not exist on type 'T'.
Related Issues:
Cannot judge, if it is a duplicate of #31380 .
This is some specific case to base further evaluation on.