type window.location ?

Estou usando o window.location e me deparei com algumas coisinhas e preciso de uma ajuda, estou usando nextjs 13

Type error: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'. 
<div className={styles.linkedin} onClick={()=> window.location.href = user?.linkedinURL}>Linkedin</div>
    |                                                      ^
 37 |       <div className={styles.github} onClick={()=> window.location.href = user?.githubURL}>Github</div>

Isso acontece pois se user em user?.linkedinURL não exitir, então user?.linkedinURL será unefined e window.location.href espera receber uma string. Você pode transformar o código no seguinte:

<div 
    className={styles.linkedin} 
    onClick={() => {
        if (user?.linkedinURL) window.location.href = user?.linkedinURL
    }}
>
  Linkedin
</div>