stevenpetryk / mafs

React components for interactive math

Home Page:https://mafs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Required, but non exported Vector2 Type

zawie opened this issue · comments

Moveable point:
Screen Shot 2020-10-02 at 12 42 48 AM
Trying to import Vector2:
Screen Shot 2020-10-02 at 12 50 27 AM

I've been playing around implementing mafs in tsx instead of js, however, now that I am using tsx, useMoveablePoint requires a Vector2 type to be passed in, however, mafs doesn't export that type!

wait okay so I imported it `import {Vector2} from 'mafs/typings/math', but it takes 4 parameters???

Ah, makes sense that this would be confusing. Vector2 is just an array of the form [number, number], so you don't have to import anything.

Hopefully this can get cleared up when I consolidate all the types, there won't be confusing types that look like they need to be imported (see #15).

In other words, a valid Vector2 is any array of two numbers.

Should be fixed now, thanks to the type rollup.