The `jest-get-type` package provides a core utility function, `getType`, designed to accurately determine the type of any JavaScript value (e.g., 'array', 'object', 'string', 'null', 'undefined', 'function', 'symbol'). It is an integral part of the Jest testing framework's monorepo, ensuring consistent type identification across Jest's various internal components. The current specific package version is 29.6.3, aligning with the Jest 29 ecosystem. However, the broader Jest framework recently released its major version 30.0.0, which targets more frequent major releases after a significant previous gap. This utility is primarily used internally by Jest, but can also be imported directly for robust, Jest-aligned type checking in other projects, especially when consistency with Jest's internal logic is desired. It ships with TypeScript types for an enhanced developer experience.
npm install jest-get-typeVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing `getType` and using it to determine the type of various JavaScript primitives and objects.
Ensure your development and CI/CD environments are running Node.js 18.x or a more recent LTS version before upgrading Jest.
Update your TypeScript dependency to `typescript@^5.4.0` or a newer compatible version.
After upgrading Jest, run tests with the `-u` flag (`jest -u`) to update all snapshots. Review changes carefully.
Be aware that direct external dependencies on internal Jest utilities like `jest-get-type` might be subject to changes aligned with Jest's overall architecture rather than external consumer needs. Always check Jest's main changelog for broader context.
If using CommonJS, ensure `const { getType } = require('jest-get-type');`. If using ESM, ensure `import { getType } from 'jest-get-type';`. Do not use `import getType from 'jest-get-type';` as it is not a default export.Upgrade your Node.js environment to version 18.x or higher. Check your project's `.nvmrc` or CI/CD configuration.
Ensure `jest-get-type` and `@types/jest` (if Jest is also installed) are in your `devDependencies`. Verify `tsconfig.json` includes `node_modules/@types` in `typeRoots` and `moduleResolution` is set appropriately (e.g., `bundler`, `node16`, or `nodenext`).
No dependency data recorded yet.