Question: It seems like it would be reasonable for the Typescript compiler to emit non-undefined & non-null checks into the resulting JS when using the non-null assertion operator. I.e.,:

```
function fun1(node: SomeType | undefined) {
    fun2(node!);
}

```

should get converted to: 

```
function fun1(node) {
    if (node === undefined || node === null) {
        throw new Error('The non-null assertion failed!');
    }
    fun2(node);
}

```

However, as fas as the docs say, it will just get transpiled just to:

```
function fun1(node) {
    fun2(node);
}

```

Why is that so? What's the reason behind not adding the checks into the output JS code?

Answer: 
The point of the non-null assertion operator is to tell the TypeScript compiler that you already know the variable is not null. Consider the following scenario:

```
function fun1(node: SomeType | undefined) {
    throwIfUndefined(node);
    node!.fun2();
}

```

You call a function which you know will throw an exception if `node` is undefined. Thus, there is really no need to check if node is undefined before the call to `fun2`. However, the TypeScript compiler can't infer that, so without the exclamation it will refuse to compile your code because it thinks you didn't handle the null case. But if you as the programmer know that condition would never happen, why insert a redundant check that will cost CPU cycles in the end product? The non-null assertion operator is really just a way to tell the compiler, "yes, I know you can't tell that this variable won't be null, but I'm doing so get out of my way."

Besides, what would be the point of throwing an error right before code that would throw an error anyway? A message like 'The non-null assertion failed!' is no more helpful than the standard null reference message.
That is type assertion, that means you tell the compiler that that variable is not null, not to ask the compiler to check that variable. Basically, your idea is possible, but throwing an error is not the purpose of type assertion. And that's the different between TypeScript and Javascript (type check and value check)