mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Add type definitions for modular-scale module
This commit is contained in:
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
// Type definitions for modular-scale 5.1
|
||||
// Project: https://github.com/kristoferjoseph/modular-scale
|
||||
// Definitions by: Mike Fowler <https://github.com/mikefowler>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface ModularScaleOptions {
|
||||
/** The ratio to use in the generated type scale function. Defaults to ModularScaleRatio.goldenSection */
|
||||
ratio?: number;
|
||||
|
||||
/** The base font size (in pixels) to use for the type scale. Defaults to 16 */
|
||||
base?: number;
|
||||
}
|
||||
|
||||
export interface ModularScaleRatio {
|
||||
minorSecond: number;
|
||||
majorSecond: number;
|
||||
minorThird: number;
|
||||
majorThird: number;
|
||||
perfectFourth: number;
|
||||
augFourth: number;
|
||||
perfectFifth: number;
|
||||
minorSixth: number;
|
||||
goldenSection: number;
|
||||
majorSixth: number;
|
||||
minorSeventh: number;
|
||||
majorSeventh: number;
|
||||
octave: number;
|
||||
majorTenth: number;
|
||||
majorEleventh: number;
|
||||
majorTwelfth: number;
|
||||
doubleOctave: number;
|
||||
}
|
||||
|
||||
export interface modularScale {
|
||||
(step: number, relative?: boolean): number;
|
||||
steps(steps: number, relative?: boolean): number[];
|
||||
}
|
||||
|
||||
export const ratios: ModularScaleRatio;
|
||||
|
||||
export default function ModularScale(options: ModularScaleOptions): modularScale;
|
||||
@@ -0,0 +1,5 @@
|
||||
import ModularScale, { ratios } from 'modular-scale';
|
||||
|
||||
const ms = ModularScale({ ratio: ratios.doubleOctave }); // $ExpectType modularScale
|
||||
ms(1); // $ExpectType number
|
||||
ms.steps(1); // $ExpectType number[]
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"modular-scale-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user