The jest package is written in JavaScript, which is a dynamically typed language. This means that JavaScript does not have static types that are checked at compile time, unlike TypeScript.
TypeScript, on the other hand, is a statically typed superset of JavaScript. It adds static types to JavaScript, which are checked at compile time. This helps catch errors early, provides better tooling (like autocompletion), and improves readability and maintainability.
The type definitions for a JavaScript library (like jest) describe the shapes and behaviors of the objects and functions provided by the library. They allow TypeScript to check the types of the values we're working with at compile time, even though the library itself is written in JavaScript.
These type definitions are not included in the original JavaScript packages because they are not needed for JavaScript development. They are only needed when you're using TypeScript. Therefore, they are provided as separate packages (like @types/jest) in the DefinitelyTyped project.
DefinitelyTyped is a large repository of TypeScript type definitions for thousands of JavaScript libraries. It's maintained by the community and is a separate project from TypeScript itself.