Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jest): Add ./global-types as an alias to ./index #51587

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions types/jest/global-types.d.ts
@@ -0,0 +1,11 @@
// Starting from jest v24.3.0, the jest package provides its own type definition.
// @types/jest now serves a different purpose than that;
// it declares global variables injeced by jest, rather than jest's own API.
//
// Unfortunately, that led to `types: ["jest"]` being resolved to the jest package,
// causing problems when `typeRoots` is configured.
//
// This file enables users to specify `types: ["jest/global-types"]` in tsconfig.json
// to clarify their intention.

/// <reference path="./index.d.ts" />
5 changes: 5 additions & 0 deletions types/jest/test/global-types-tests.ts
@@ -0,0 +1,5 @@
/// <reference path="../global-types.d.ts" />

describe("42", () => {
expect(42).toBe(42);
});
4 changes: 3 additions & 1 deletion types/jest/tsconfig.json
Expand Up @@ -17,6 +17,8 @@
},
"files": [
"index.d.ts",
"jest-tests.ts"
"global-types.d.ts",
"jest-tests.ts",
"test/global-types-tests.ts"
]
}
7 changes: 6 additions & 1 deletion types/jest/tslint.json
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-bad-reference": false
}
}