Improve polylabel ES6 import syntax (#11260)

Using `import * as polylabel from 'polylabel'` is now valid in Typescript vs. require('polylabel').
This commit is contained in:
Denis
2016-09-19 15:15:35 +09:00
committed by Masahiro Wakame
parent 83adc941d1
commit c0ce167c10
2 changed files with 8 additions and 9 deletions
+5 -7
View File
@@ -1,10 +1,8 @@
/// <reference path="./polylabel.d.ts" />
/// <reference path="../node/node.d.ts" />
import polylabel = require('polylabel');
import * as polylabel from 'polylabel';
const polygon = [[[3116,3071],[3118,3068],[3108,3102],[3751,927]]]
let p: number[]
p = polylabel(polygon)
p = polylabel(polygon, 1.0)
p = polylabel(polygon, 1.0, true)
p = polylabel(polygon, 1.0, false)
polylabel(polygon)
polylabel(polygon, 1.0)
polylabel(polygon, 1.0, true)
polylabel(polygon, 1.0, false)
+3 -2
View File
@@ -15,7 +15,7 @@
* - guarantees finding global optimum within the given precision
* - is many times faster (10-40x)
*/
declare module 'polylabel' {
declare module "polylabel" {
/**
* Polylabel returns the pole of inaccessibility coordinate in [x, y] format.
*
@@ -28,6 +28,7 @@ declare module 'polylabel' {
* @example
* var p = polylabel(polygon, 1.0);
*/
function polylabel (polygon: number[][][], precision?: number, debug?: boolean): number[];
function polylabel(polygon: number[][][], precision?: number, debug?: boolean): number[];
namespace polylabel {}
export = polylabel;
}