You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ?
Reacted by Eduardo Mior, tsukumi, Lorenzo Dalla Muta, Alexey Shamrin, Karol Kozicki, Tomas, Erik Baer, Daniel Harte, jcesarmobile, mmarzullotv and 2 more
Lionel (MC) (@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.
Placing that into a d.ts file included in your project will also augment the global types and allow things to work. You definitely do not need to be overwriting any files in VS Code or node_modules to add things to the globals like this.
the main issue is that unlock is there, while lock was removed. even if there is a valid reason to remove lock, it should be consistent, since both of the methods have the same support.
Activity
mistic100 commentedon Aug 28, 2023
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 ?
richso commentedon Nov 24, 2023
for those who experience this compilation error, you may change to this alternative syntax to bypass the compiler error:
window.screen.orientation['lock']('landscape');tsukumijima commentedon Dec 31, 2023
Kagami Sascha Rosylight (@saschanaz)
I am running into the same problem. This is an obvious regression and should be corrected ASAP.
liyokuna commentedon Jan 18, 2024
hello,
I am facing this issue, can't wait for the fix.
the temp solution from richso is not working on my angular project.
eduardo-mior commentedon Jan 18, 2024
Lionel (MC) (@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.
liyokuna commentedon Jan 18, 2024
thanks for the answer but Eduardo Mior (@eduardo-mior) i'm on intelli j unfortunately :|
mistic100 commentedon Jan 18, 2024
or just add
// @ts-ignorebefore the lineHolgerJeromin commentedon Jan 18, 2024
I think the correct way would be adding the now missing interface locally in one of your .ts or .d.ts files:
liyokuna commentedon Jan 18, 2024
yep did that, Damien Sorel (@mistic100) but i thnik my issue is maybe somewhere else in my ngular project...
jakebailey commentedon Jan 18, 2024
Placing that into a
d.tsfile included in your project will also augment the global types and allow things to work. You definitely do not need to be overwriting any files in VS Code ornode_modulesto add things to the globals like this.Knagis commentedon Feb 29, 2024
the main issue is that
unlockis there, whilelockwas removed. even if there is a valid reason to removelock, it should be consistent, since both of the methods have the same support.mistic100 commentedon Feb 29, 2024
To be fair both method don't have the same support.
https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock#browser_compatibility
https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/unlock#browser_compatibility
haroldjeshua commentedon Nov 19, 2024
encountered this on vite-react-typescript stack, Holger Jeromin (@HolgerJeromin) 's answer worked perfectly. thanks
rozsazoltan commentedon Mar 31, 2025
Holger Jeromin (@HolgerJeromin)'s solution can be shortened by using the already declared
OrientationType:danielhjacobs commentedon Sep 17, 2026
Seems fixed as of TS 6