forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update comparison methods to support BigInt
As per jestjs/jest#8382 TypeScript 3.2+ supports BigInt with esnext target. TypeScript 3.8+ supports it with es2020 target. dtslint is very particular on how the `typesVersions` should be handled, hence the code duplication.
- Loading branch information
Showing
9 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// tslint:disable-next-line:no-bad-reference | ||
/// <reference path="../index.d.ts" /> | ||
|
||
declare namespace jest { | ||
interface Matchers<R, T = {}> { | ||
/** | ||
* 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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "dtslint/dt.json", | ||
"rules": { | ||
"no-unnecessary-generics": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// tslint:disable-next-line:no-bad-reference | ||
/// <reference path="../ts3.2/index.d.ts" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* Basic matchers */ | ||
|
||
describe('', () => { | ||
it('', () => { | ||
expect(0n).toBeGreaterThan(1n); | ||
|
||
expect(0n).toBeGreaterThanOrEqual(1n); | ||
|
||
expect(0n).toBeLessThan(1n); | ||
|
||
expect(0n).toBeLessThanOrEqual(1n); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "dtslint/dt.json", | ||
"rules": { | ||
"no-unnecessary-generics": false | ||
} | ||
} |