-
Notifications
You must be signed in to change notification settings - Fork 58
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
Typescript error? #14
Comments
I have the same problem.
When I import like this in Typescript, Flatten is undefined. In the index.js, if I change But I think that's not the best solution. |
Use the following syntax to import flatten in Typescript:
|
My problem has been solved. I think it's nothing about this library, but my own fault. Maybe this issue can be closed? |
I am also not so experienced with TypeScript but the last suggestion seems correct for now. Later I am planning to redesign the library to es6 modules, then TypeScript support will be more straightforward. |
I've just found that moving to es6 module system (import/export) make things even less straightforward.
@SamuelQZQ , can you check if this works in your case? |
I import like this :
If I do not use My full compilerOptions
|
Maybe it is because I am inexperienced with Typescript, but if you import something in Typescript it tries to load the default property of the exported object, which gives me the error:
new flatten_js_1.default.Point(x, y);
TypeError: Cannot read property 'Point' of undefined
because in the index.js is only module.exports = f (if I change it to
module.exports.default = f;
it fixes the problem for me)
The text was updated successfully, but these errors were encountered: