diff --git a/types/polygons-intersect/index.d.ts b/types/polygons-intersect/index.d.ts new file mode 100644 index 0000000000..87fd174e69 --- /dev/null +++ b/types/polygons-intersect/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for polygons-intersect 1.0 +// Project: https://github.com/DudaGod/polygons-intersect#readme +// Definitions by: Konrad Klockgether +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Finds all points where the polygons intersect each other. + */ +declare function intersection( + poly1: Array<{ x: number, y: number }>, + poly2: Array<{ x: number, y: number }> +): Array<{ x: number, y: number }>; + +export = intersection; diff --git a/types/polygons-intersect/polygons-intersect-tests.ts b/types/polygons-intersect/polygons-intersect-tests.ts new file mode 100644 index 0000000000..104c93c788 --- /dev/null +++ b/types/polygons-intersect/polygons-intersect-tests.ts @@ -0,0 +1,5 @@ +import polygonsIntersect = require('polygons-intersect'); + +const poly1 = [{x: 10, y: 10}, {x: 10, y: 30}, {x: 30, y: 30}, {x: 30, y: 10}]; +const poly2 = [{x: 20, y: 20}, {x: 20, y: 40}, {x: 40, y: 40}, {x: 40, y: 20}]; +polygonsIntersect(poly1, poly2); diff --git a/types/polygons-intersect/tsconfig.json b/types/polygons-intersect/tsconfig.json new file mode 100644 index 0000000000..20c8856f07 --- /dev/null +++ b/types/polygons-intersect/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "polygons-intersect-tests.ts" + ] +} diff --git a/types/polygons-intersect/tslint.json b/types/polygons-intersect/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/polygons-intersect/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }