ua-parser-js
ua-parser-js copied to clipboard
No typing for the sub-modules
Library version v2.0.0-alpha.3
The /enums sub-module (and the rest) don't seem to ship with type declarations, so TypeScript complains when you try to import from them:
It seems that it was resolved in this commit https://github.com/faisalman/ua-parser-js/commit/d6d8ac7cb43d610e54e1e4355da35b0e7ea76a43.
However, types were added for other submodules, but not enums.
Could you add types for enums as well?
+1 to this, it would be great to be able to use the enums from this package.
Really odd this isn't caught by a test or something similar. I'll open a PR for this shortly.
https://github.com/faisalman/ua-parser-js/pull/772
Am I the only one who has still problems with this?
import { Bots } from "ua-parser-js/extensions";
import { isBot } from "ua-parser-js/helpers";
Am I the only one who has still problems with this?
import { Bots } from "ua-parser-js/extensions"; import { isBot } from "ua-parser-js/helpers";
We are experiencing the same issue.
This is still not working for me, has anyone actually gotten this to work? import { Browser } from 'ua-parser-js/enums';
error: Cannot find module 'ua-parser-js/enums' or its corresponding type declarations.
Edit: Nevermind I figured it out. I needed to update my moduleResolution in my tsconfig
I think this has been fixed now on @ua-parser-js/pro-enterprise:2.0.3? Working for me at least:
import {
Browser,
BrowserType,
Device,
OS,
} from "@ua-parser-js/pro-enterprise/enums";