TypeScriptのProperty 'get' does not exist on type 'never' エラーについて

Cover Image for TypeScriptのProperty 'get' does not exist on type 'never' エラーについて
monotalk
monotalk

JavaScriptで書いていたReactのプロジェクトをTypeScriptに移行している。
TSLintのエラー修正が終わって、ビルドしてみると以下のエラーが出力された。

ERROR in ./src/js/sw/client/swRegister.tsx
./src/js/sw/client/swRegister.tsx
[tsl] ERROR in ./src/js/sw/client/swRegister.tsx(103,64)
      TS2339: Property 'get' does not exist on type 'never'.
npm ERR! code ELIFECYCLE

以下のStackOverFlowの記事を見ると、 typescript - 'Property does not exist on type 'never' - Stack Overflow

if (instance == null) {
    console.log('Instance is null or undefined');
} else {
    console.log(instance!.name); // ok now
}

のように書けば良いことがわかる。
fieldに !ビックリマークが付与されていて、何かと思った以下に記載があった。
TypeScriptの!(exclamation mark) - ponpoko04's blog

コンパイラーに、安全であることを伝えることができる。