Skip to content

Commit

Permalink
Merge pull request #709 from jonobr1/708-types-error
Browse files Browse the repository at this point in the history
Fixing TypeScript Errors
  • Loading branch information
jonobr1 authored Oct 3, 2023
2 parents 0f0ea36 + 024a081 commit c342680
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/**/*.d.ts
49 changes: 49 additions & 0 deletions tests/typescript/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import Two from "two.js";

const two = new Two({
fullscreen: true,
autostart: false
});

let path;

path = new Two.Line(5, 5, 10, 10);
two.add(path);

path = new Two.Circle(3, 3, 10);
two.add(path);

path = new Two.Rectangle(25, 25, 5, 5);
two.add(path);

path = new Two.Polygon(30, 30, 5, 7);
two.add(path);

path = new Two.ArcSegment(5, 25, 5, 10, 0, Math.PI);
two.add(path);

path = new Two.Ellipse(5, 30, 10, 5);
two.add(path);

path = new Two.Star(30, 5, 10, 5);
two.add(path);

path = new Two.Points([
new Two.Anchor(-2, 0),
new Two.Anchor(2, 0)
]);
two.add(path);

path = new Two.Path([
new Two.Anchor(-1, 0),
new Two.Anchor(1, 0)
]);
path.closed = false;
path.automatic = true;
path.position.set(
two.width / 2, two.height / 2
);
path.scale = new Two.Vector(1, 1);
two.add(path);

two.appendTo(document.body);
15 changes: 15 additions & 0 deletions tests/typescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "typescript",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"typescript": "^5.2.2",
"two.js": "file:../.."
}
}
1 change: 1 addition & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2857,6 +2857,7 @@ declare module "two.js/src/shapes/line" {
right: Anchor;
}
import { Path } from "two.js/src/path";
import { Anchor } from "two.js/src/anchor";
}
declare module "two.js/src/shapes/rounded-rectangle" {
/**
Expand Down

0 comments on commit c342680

Please sign in to comment.