On Typescript 5.2+ the ScreenOrientation plugin currently generates an error due to the OrientationLockType missing in Typescript’s lib.dom.d.ts. This is due to Firefox removing the enum, meaning it fell below Typescript’s two browser threshold for including it.
There is a patch for Capacitor which is hopefully going to be in the next release: fix(screen-orientation): Add OrientationLockType by dtarnawsky · Pull Request #1914 · ionic-team/capacitor-plugins · GitHub
In the meantime, the following seems to work while waiting for the patch to be released (if someone has a better way than this, please feel free to comment!):
Create definitions.d.ts in src directory with the following:
declare type OrientationLockType = 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';