-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Typing definition is incompleted, cannot type SelectionEvent function. #95
Comments
This is expected, v2 is a major release with breaking changes. See semver. |
But how would you import the type SelectionEvent ? |
The problems I suppose is index.ts is only exporting SelectionArea and nothing else. |
I think you misunderstood what I mean @simonwep. It's not because your code is in typescript that all the typing definition can be imported. If your index.ts is not exporting every types, the definiton of those type are not usable. Right now, only SelectionArea is exported. SelectionArea is exported because of this line :
Sure there is a work around here which I just try out now :const selection = new SelectionArea({...});
selection.on("start", ({store, event}) => {...}); // this line work because typescript imply SelectionEvent But if you use it like below, you have to import typing which isn't accessible anymore on v2.const selection = new SelectionArea({...});
const onStart = ({store, event}) => {...}; // store and event are type any
selection.on("start", onStart); |
Allright, gotchya - yes you're right. Sorry, they're not exported anymore - that's a problem. |
Fixed and available in v2.0.1 :) |
What is the problem?
Updating from 1.7.1 to 2.0.0, I had to fix my typescript code with the new SelectionArea instead of Selection, but before I was using Selection.SelectionEvent to type my onStart/onMove/onStop function, but right now, only SelectionArea is available as typing... Not SelectionArea.SelectionEvent.
I try to import :
import { SelectionEvent } from "@simonwep/selection-js/src/types";
but I get :
Cannot find module '@utils' or its corresponding type declarations. TS2307
What is the expected behavior?
Something like this would work :
import SelectionArea, { SelectionEvent, ChangedElements, SelectionStore, ... } from "@simonwep/selection-js";
Your environment:
The text was updated successfully, but these errors were encountered: