add types for intrinsic-scale

This commit is contained in:
Shalom Peles
2018-08-07 19:10:51 +03:00
parent 6b9e17df58
commit 496621c80d
4 changed files with 43 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for intrinsic-scale 3.0
// Project: https://github.com/bfred-it/intrinsic-scale#readme
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function contain(parentWidth: number, parentHeight: number, childWidth: number, childHeight: number): IntrinsicScale;
export function cover(parentWidth: number, parentHeight: number, childWidth: number, childHeight: number): IntrinsicScale;
export interface IntrinsicScale {
width: number,
height: number,
x: number,
y: number
}
@@ -0,0 +1,4 @@
import { cover, contain } from ".";
const intrinsicScale = cover(100, 100, 50, 50);
const { x, y, width, height } = contain(1,2,3,4);
+23
View File
@@ -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",
"intrinsic-scale-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }