Merge pull request #33645 from adamzerella/types/date-now

[date-now] Add typing for date-now
This commit is contained in:
Nathan Shively-Sanders
2019-03-08 11:31:15 -08:00
committed by GitHub
5 changed files with 48 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import seeded = require('date-now/seed');
import dateNow = require('date-now');
seeded(123);
dateNow();

8
types/date-now/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Type definitions for date-now 1.0
// Project: https://github.com/Raynos/date-now
// Definitions by: Adam Zerella <https://github.com/adamzerella>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function dateNow(): number;
export = dateNow;

6
types/date-now/seed.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/**
* Returns a Date.now() like function that's in sync with the seed value.
*/
declare function seeded(seed: number): number;
export = seeded;

View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [
],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"seed.d.ts",
"date-now-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}