Since navigator.userAgent's information will be reduced so I want to migrate to User-Agent Client Hints but it shows error like this:
How do I solve this, please help. Many thanks
Since navigator.userAgent's information will be reduced so I want to migrate to User-Agent Client Hints but it shows error like this:
How do I solve this, please help. Many thanks
TypeScript doesn't ship with type declarations for the experimental Navigator.userAgentData property by default.
You could install e.g. this package which claims to add the types or just look at its implementation to see how to write the declarations yourself.
You need to install types for Navigator.userAgentData
Install user agent types from npm:
npm i -D user-agent-data-types
In the tsconfig.json add:
{
"compilerOptions": {
...
"types": [
"./node_modules/user-agent-data-types"
]
},
}
Now you should be able to see userAgentData property on navigator object.