-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing "lock" method in ScreenOrientation #1615
Comments
Hmm it seems it's because it falls under the "two major browsers" threshold since Firefox removed it (duh !). However Chrome Android having the majority of the smartphone market wouldn't it make sense to keep it ? |
for those who experience this compilation error, you may change to this alternative syntax to bypass the compiler error:
|
@saschanaz |
hello, I am facing this issue, can't wait for the fix. |
@liyokuna As a temporary solution I change the source codes of this lib inside VSCode, so the error stops happening, but every time I update VSCode I need to adjust the source code again, as the source code is inside the VScode folder installed on the my computer. It's not a recommended solution, but this way VScode stops reporting unnecessary and incorrect errors. This only works for VScode. |
thanks for the answer but @eduardo-mior i'm on intelli j unfortunately :| |
or just add |
I think the correct way would be adding the now missing interface locally in one of your .ts or .d.ts files: type OrientationLockType = "any" | "landscape" | "landscape-primary" | "landscape-secondary" | "natural" | "portrait" | "portrait-primary" | "portrait-secondary";
interface ScreenOrientation extends EventTarget {
lock(orientation: OrientationLockType): Promise<void>;
} |
yep did that, @mistic100 but i thnik my issue is maybe somewhere else in my ngular project... |
Placing that into a |
the main issue is that |
To be fair both method don't have the same support. https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock#browser_compatibility |
encountered this on vite-react-typescript stack, @HolgerJeromin 's answer worked perfectly. thanks |
I just updated from 5.1.3 to 5.2.2 and I cannot compile anymore because the "lock" method was removed from the ScreenOrientation interface.
I don't think this is correct.
This is the change https://github.com/microsoft/TypeScript/pull/54725/files#diff-dc0eab937d15e62545da3ed7b4f40ad6b24f15dd88fbc6ceda2bfb4ed8356eb0L20901
MDN : https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock
ping @sandersn
thanks
The text was updated successfully, but these errors were encountered: