Is occurrence typing (flow-sensitive typing) a form of dependent typing? I take occurrence typing to be typing that &quot;... allows the type system to ascribe more precise types based on whether a [check] succeeds or fails.&quot; (adapted from the Racket docs with &quot;predicate check&quot; replaced with &quot;check&quot;)
Here's a TypeScript example:
function foo(x: string | number) {
    switch (typeof x) {
        case &quot;string&quot;:
            // the type of x is `string` here:
            x.length
            break
         case &quot;number&quot;:
            // the type of x is `number` here:
            x * 3
            break
    }
}


playground link
I take &quot;dependent types&quot; to mean &quot;types that depend on terms&quot;. reference reference
The type of x (a type) depends on x (a term). So is there dependent typing in the example above? More generally, is occurrence typing a form of dependent typing?
I could see an argument that the answer is &quot;no&quot; if we interpret &quot;dependency&quot; such that it is expressed via binding. So then a &quot;dependent type&quot; would be a type T x where  T is a type and x is a term. But then maybe even on this definition occurrence typing counts as dependent typing, if we allow T to be something fancy like a type-level x -&gt; if x is a string then string else number.
No, I would not consider this a dependent type.  The type of x does not depend on the value of x.
I suppose you could say that the type of the expression x depends on the type of the variable x, but that doesn't make this dependent typing.
You link to Wikipedia, but the Wikipedia article on dependent types say &quot;a dependent type is a type whose definition depends on a value&quot; and says &quot; The return type of a dependent function may depend on the value (not just type) of one of its arguments&quot; and &quot;A dependent pair may have a second value of which the type depends on the first value&quot;.  Here the type of x does not depend on values; only on the types of the variables.  Beware that these English sentences describing terms like &quot;dependent types&quot; or &quot;occurrence types&quot; are not to be taken too seriously and you need to look at the precise mathematical formalism if you want to be precise.
I would not consider the feature you describe as dependent typing.  Rather, I would consider it an instance of flow-sensitive typing.