you can use
window?.navigation?.canGoBack
To check the available options for window, you can do the following:
console.log(window);