Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] add typescript definitions #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

clhenrick
Copy link

to resolve #2

@clhenrick
Copy link
Author

@Fil I need to test this out still, so not ready to merge yet.

@clhenrick
Copy link
Author

Seems to work for me when I import this branch into a Typescript project:

import versor = require("versor");

const v0 = versor([ 0, 0, 0 ]);
const v1 = versor([ 90, 0, 0 ]);

const delta = versor.delta(v0, v1);

const delta2 = versor.delta(v0, v1, 0.5);

const cartesian = versor.cartesian([-80, 44]);

const rotation = versor.rotation([10, 30, 40, 4]);

const multiply = versor.multiply([10, 20, 30, 40], [0, 20, 30, 50]);

// typescript yells at this for example
versor.delta("a", "b");

// it also yells about this
versor("a");

// and this
versor.multiply([0, 1, 2]);

@clhenrick
Copy link
Author

clhenrick commented Oct 12, 2018

in Typescript if you use the import * as versor from "versor" method then you need to use versor.default() to do the equivalent of versor() as when using common js var versor = require("versor").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Request for type definition file
1 participant