Add ms.macro (#43789)

This commit is contained in:
Cameron Knight
2020-04-10 08:18:30 -07:00
committed by GitHub
parent 43d1dd86ec
commit 69f5a30b3c
4 changed files with 44 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for ms.macro 2.0
// Project: https://github.com/knpwrs/ms.macro#readme
// Definitions by: Cameron Knight <https://github.com/ckknight>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Convert various time formats to milliseconds at build time in Babel.
* @param value The value to convert
* @example
* const ONE_DAY = ms('1 day');
* const TWO_DAYS = ms('2 days');
* @example
* const ONE_DAY = ms`1 day`;
* const TWO_DAYS = ms`2 days`;
*/
export default function ms(value: string | TemplateStringsArray): number;
+4
View File
@@ -0,0 +1,4 @@
import ms from 'ms.macro';
const threeSeconds: number = ms('3 seconds');
const threeHundredMilliseconds: number = ms`300 ms`;
+23
View File
@@ -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",
"ms.macro-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }