TypeScript/tests/cases/compiler/narrowUnknownByTypeofObject.ts

7 lines
111 B
TypeScript
Raw Normal View History

// @strictNullChecks: true
function foo(x: unknown) {
if (typeof x === "object") {
x
}
}