-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
chore(TS): export FabricObjectProps and GroupProps #9025
Conversation
This is possible now in fabric |
That PR doesn't remove |
Both should be respected imo |
I'm not following, it doesn't seem the case here. |
the prop uuid is not defined by any class, right? Strictly speaking. |
Yes, but what do you mean with |
For discussion sake: My point is we are patching instead of addressing the issues TS is causing us. |
I'm not following your discussion honestly.
I'm not using Just to make it clear, what's the expected code? To create a new class |
I am indeed, in a very strict manner of TS |
Ah I see. But it's then a significant breaking change that should be document, i.e. not supporting extra properties in constructor without subclassing. Anyway I'm fine with creating a new subclass for tests. Nervertheless exporting the types it's still useful to just use them since once you do declaration merging for anything, you can't import anymore from submodules. So I can't use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @jiayihu
Just to be clear about this:
We don't have submodules, submodules aren't supported. So we export all the types from fabric.ts, every type we need. |
More type exports to allow declaration merging.
TFabricObjectProps
is also exported because it's convenient. Unfortunately it seems that when you do declaration merging, you can't import types from submodules anymoree.g. import { TFabricObjectProps } from "fabric/dist/src/shapes/Object/types"
. I haven't found a solution yet, so for now exportingTFabricObjectProps
seems convenient since it's quite a useful type anyway.I took the chance to change
GroupEvents
to interface as well, even though I don't need it. It may probably be a good practice as library author to useInterface
by default and export all the interface types at the top-level to allow declaration merging. Especially for a library like fabric that relies so much on extension vs composition.