mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 06:50:19 +00:00
Add type definition for node-timecodes (#36514)
This commit is contained in:
committed by
Ben Lichtman
parent
74703a87eb
commit
c4c4c2bc1b
Vendored
+21
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user