Add type definition for node-timecodes (#36514)

This commit is contained in:
Mitsuka Hanakura a.k.a. ragg
2019-06-28 08:58:16 -07:00
committed by Ben Lichtman
parent 74703a87eb
commit c4c4c2bc1b
4 changed files with 56 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for node-timecodes 2.5
// Project: https://github.com/Synchronized-TV/node-timecodes
// Definitions by: Mitsuka Hanakura a.k.a. ragg <https://github.com/ra-gg>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface TimecodeOptions {
frameRate?: number;
ms?: boolean;
}
export function toSeconds(timecode: string, frameRate?: number): number;
export function fromSeconds(seconds: number, option?: TimecodeOptions): string;
export const constants: { framerate: number };
declare const _: {
toSeconds: typeof toSeconds;
fromSeconds: typeof fromSeconds;
constants: typeof constants;
};
export default _;
@@ -0,0 +1,11 @@
import timecode, { fromSeconds, toSeconds, TimecodeOptions } from 'node-timecodes';
type Option = TimecodeOptions;
timecode.fromSeconds(1);
timecode.fromSeconds(1, { frameRate: 30, ms: true });
fromSeconds(1);
timecode.toSeconds('00:01:00:00');
timecode.toSeconds('00:01:00:00', 30);
toSeconds('00:01:00:00', 30);
timecode.constants.framerate;
+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",
"node-timecodes-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }