As I understand that I cannot assign null to a string variable. I do not understand why the if clause to check that `localStorage.getItem('language')` is set isnt resolving this issue.

Error: Type 'string | null' is not assignable to type 'string'. 
Type 'null' is not assignable to type 'string'.

```
  setLanguage(lang: string) {
    if (lang) {
      this.language = i18n.locale = lang
      localStorage.setItem('language', lang)
    } else {
      if (localStorage.getItem('language')) {
        this.language = i18n.locale = localStorage.getItem('language')
      } else {
        let browserLang = navigator.language.split('-')[0]
        this.language = i18n.locale = browserLang
        localStorage.setItem('language', browserLang)
      }
    }
  }

```

thanks.