How to properly type sharedModel if if doesn't contain awareness property? (YDocument)

In order to get the awareness property on sharedModel I am using the approach shown below. I think I am doing it wrong. Does anyone have any guidance on the correct way to do this?

Thank you.

((notebookPanel.content.model?.sharedModel as unknown) as ymodels.YDocument<any>).awareness.setLocalStateField('user', { name: hubUser });