mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
[tsscmp] introduce typings (#36370)
This commit is contained in:
committed by
Benjamin Lichtman
parent
e7e3d0f57d
commit
fe61074c48
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for tsscmp 1.0
|
||||
// Project: https://github.com/suryagh/tsscmp#readme
|
||||
// Definitions by: Gareth Jones <https://github.com/g-rath>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = timeSafeCompare;
|
||||
|
||||
declare function timeSafeCompare(a: number, b: number): boolean;
|
||||
declare function timeSafeCompare(a: string, b: string): boolean;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"tsscmp-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,26 @@
|
||||
import timeSafeCompare = require('tsscmp');
|
||||
|
||||
timeSafeCompare(); // $ExpectError
|
||||
timeSafeCompare(''); // $ExpectError
|
||||
timeSafeCompare(1); // $ExpectError
|
||||
|
||||
timeSafeCompare('', ''); // $ExpectType boolean
|
||||
timeSafeCompare(1, 1); // $ExpectType boolean
|
||||
|
||||
timeSafeCompare('', 1); // $ExpectError
|
||||
timeSafeCompare(1, ''); // $ExpectError
|
||||
|
||||
timeSafeCompare({}, {}); // $ExpectError
|
||||
timeSafeCompare([], []); // $ExpectError
|
||||
|
||||
timeSafeCompare({}, ''); // $ExpectError
|
||||
timeSafeCompare([], ''); // $ExpectError
|
||||
|
||||
timeSafeCompare([], 1); // $ExpectError
|
||||
timeSafeCompare({}, 1); // $ExpectError
|
||||
|
||||
timeSafeCompare('', {}); // $ExpectError
|
||||
timeSafeCompare('', []); // $ExpectError
|
||||
|
||||
timeSafeCompare(1, []); // $ExpectError
|
||||
timeSafeCompare(1, {}); // $ExpectError
|
||||
Reference in New Issue
Block a user