CodeQL library for JavaScript/TypeScript
codeql/javascript-all 1.0.3-dev (changelog, source)

Member predicate Parameter::isDeclaredOptional

Holds if this is a parameter declared optional with the ? token.

Note that this does not hold for rest parameters, and does not in general hold for parameters with defaults.

For example, x, is declared optional below:

function f(x?: number) {}
predicate isDeclaredOptional()