biodiv / contactjs

Pointer gestures for your webapp
MIT License
77 stars 6 forks source link

v2.0.3 Missing Some Type Declarations #26

Closed SE2Dev closed 2 years ago

SE2Dev commented 2 years ago

It seems that v2.0.3 is missing a few types that are pretty important. I added them at one point after the initial TypeScript migration, but it seems they got lost when the v2 branch got merged.

I added them back in the following commits:

We should probably release a version v2.0.4 that includes these changes.

biodiv commented 2 years ago

Yes we should include those types and release v2.0.4.

The line

export const GestureEvent = CustomEvent<GestureEventData>;

gives me the following error:

'(' expected
Value of type '{ new <T>(type: string, eventInitDict?: CustomEventInit<T> | undefined): CustomEvent<T>; prototype: CustomEvent<any>; }' is not callable. Did you mean to include 'new'?ts(2348)

I tried replacing constwith type but could not figure out how to create a type using CustomEvent.

SE2Dev commented 2 years ago

The reason it needs to be const is because we're not just creating a type alias, but a variable that references the constructor for CustomEvent. I suspect your dependencies may be out of date, in which case I'd suggest running npm install - but I can change it to make more sense if needed.

biodiv commented 2 years ago

Updating the dependencies solved the issue - thanks! I will prepare v2.0.4

SE2Dev commented 2 years ago

I saw that you created a release for v2.0.4. We still need to release a new version of the NPM package though.

SE2Dev commented 2 years ago

@biodiv It turns out that there's an issue with Parcel's type declaration support for GestureEvent in v2.1.0.

I've pushed 737fbcad0411541f533d665cc757d499d3ccdcb4 which serves as a workaround for the time being.

We'll need a v2.1.1 release for the NPM package though.

biodiv commented 2 years ago

Thanks for figuring this out! I just updated the npm package

SE2Dev commented 2 years ago

Closing because it's fixed in v2.1.1