diff --git a/types/jest/package.json b/types/jest/package.json index d2dd38a8831b4e..dc5864c662aaf0 100644 --- a/types/jest/package.json +++ b/types/jest/package.json @@ -3,5 +3,9 @@ "dependencies": { "jest-diff": "^25.2.1", "pretty-format": "^25.2.1" + }, + "types": "index", + "typesVersions": { + ">=3.2.0-0": { "*": ["ts3.2/*"] } } } diff --git a/types/jest/ts3.2/index.d.ts b/types/jest/ts3.2/index.d.ts new file mode 100644 index 00000000000000..8dbfc0e7c60fa1 --- /dev/null +++ b/types/jest/ts3.2/index.d.ts @@ -0,0 +1,23 @@ +// tslint:disable-next-line:no-bad-reference +/// + +declare namespace jest { + interface Matchers { + /** + * For comparing numbers or big integer values. + */ + toBeGreaterThan(expected: number | bigint): R; + /** + * For comparing numbers or big integer values. + */ + toBeGreaterThanOrEqual(expected: number | bigint): R; + /** + * For comparing numbers or big integer values. + */ + toBeLessThan(expected: number | bigint): R; + /** + * For comparing numbers or big integer values. + */ + toBeLessThanOrEqual(expected: number | bigint): R; + } +} diff --git a/types/jest/ts3.2/jest-tests.ts b/types/jest/ts3.2/jest-tests.ts new file mode 100644 index 00000000000000..b53c5b1f868202 --- /dev/null +++ b/types/jest/ts3.2/jest-tests.ts @@ -0,0 +1,13 @@ +/* Basic matchers */ + +describe('', () => { + it('', () => { + expect(BigInt(0)).toBeGreaterThan(BigInt(1)); + + expect(BigInt(0)).toBeGreaterThanOrEqual(BigInt(1)); + + expect(BigInt(0)).toBeLessThan(BigInt(1)); + + expect(BigInt(0)).toBeLessThanOrEqual(BigInt(1)); + }); +}); diff --git a/types/jest/ts3.2/tsconfig.json b/types/jest/ts3.2/tsconfig.json new file mode 100644 index 00000000000000..dc2701483baba1 --- /dev/null +++ b/types/jest/ts3.2/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["dom", "es6", "esnext", "es2020"], + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": ["../../"], + "target": "esnext", + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jest-tests.ts" + ] +} diff --git a/types/jest/ts3.2/tslint.json b/types/jest/ts3.2/tslint.json new file mode 100644 index 00000000000000..ad93d8fc0d9ca6 --- /dev/null +++ b/types/jest/ts3.2/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-unnecessary-generics": false + } +} \ No newline at end of file