diff --git a/types/jest/package.json b/types/jest/package.json index d2dd38a8831b4ed..45bcfcc4d4e2a56 100644 --- a/types/jest/package.json +++ b/types/jest/package.json @@ -3,5 +3,10 @@ "dependencies": { "jest-diff": "^25.2.1", "pretty-format": "^25.2.1" + }, + "types": "index", + "typesVersions": { + ">=3.8.0-0": { "*": ["ts3.8/*"] }, + ">=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 000000000000000..8dbfc0e7c60fa16 --- /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 000000000000000..b53c5b1f8682020 --- /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 000000000000000..dc2701483baba15 --- /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 000000000000000..ad93d8fc0d9ca6b --- /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 diff --git a/types/jest/ts3.8/index.d.ts b/types/jest/ts3.8/index.d.ts new file mode 100644 index 000000000000000..ec0882128b6ba6c --- /dev/null +++ b/types/jest/ts3.8/index.d.ts @@ -0,0 +1,2 @@ +// tslint:disable-next-line:no-bad-reference +/// diff --git a/types/jest/ts3.8/jest-tests.ts b/types/jest/ts3.8/jest-tests.ts new file mode 100644 index 000000000000000..8e37f0757bed967 --- /dev/null +++ b/types/jest/ts3.8/jest-tests.ts @@ -0,0 +1,13 @@ +/* Basic matchers */ + +describe('', () => { + it('', () => { + expect(0n).toBeGreaterThan(1n); + + expect(0n).toBeGreaterThanOrEqual(1n); + + expect(0n).toBeLessThan(1n); + + expect(0n).toBeLessThanOrEqual(1n); + }); +}); diff --git a/types/jest/ts3.8/tsconfig.json b/types/jest/ts3.8/tsconfig.json new file mode 100644 index 000000000000000..18de26be8c24998 --- /dev/null +++ b/types/jest/ts3.8/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": "es2020", + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jest-tests.ts" + ] +} diff --git a/types/jest/ts3.8/tslint.json b/types/jest/ts3.8/tslint.json new file mode 100644 index 000000000000000..ad93d8fc0d9ca6b --- /dev/null +++ b/types/jest/ts3.8/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-unnecessary-generics": false + } +} \ No newline at end of file