Suppose I have the following Typescript code:
const x = 123
const f = () => x
Is it possible to do something such that Typescript compiler can produce an error/warning during compile time saying that function f is capturing an external variable x ?
P/S: I am solely looking for the technical possibility of this mechanism, explanation of why I should not do this will not be accepted as answer.