wix-incubator / corvid-types

Type definitions for Corvid by Wix
MIT License
5 stars 3 forks source link

fix: allow any prop for some specific $w.Element usages #46

Closed dor-itzhaki closed 3 years ago

dor-itzhaki commented 3 years ago

This PR adds 3 AST transformation to our main declarations.d.ts file. The transformation will allow using any property in 3 cases that are currently defined as $w.Element due to lack of "generics" support in our documentation. Note that the user will still get autocomplete for the $w.Element members/methods, but will not get errors when using unknown properties/methods (which hopefully belong to specific elements).

I didn't add any tests yet + due to the upgrade of typescript, some snapshots are broken. I'll fix all of that later, but i'd like to get your feedback.

dor-itzhaki commented 3 years ago

great work! I think that we should also handle (maybe not as part of this task) in all other cases that return $w.Element. for example: onInput(eventHandler: $w.EventHandler): $w.Element; onViewportEnter(handler: $w.EventHandler): $w.Element; or any other $w mixin events defenition

You're right but i think those are less popular... I would actually like to try and create an AST transformation that will make our mixins generic, but holding it off for now