How to avoid circular references brought by decorator? #7246
Replies: 2 comments
-
IntroWhy type and type decorators are needed?Creator(especially starting from Cocos Creator 3D) usually expects to understand the type information(let's say, type) of a class field. Editor uses that type to determine what a value is allowed to feed for the property and how it should properly show that field. Sometimes Editor may deduce directly from the fields' runtime value, once if:
In all other cases Editor is unable to deduce, for example:
As a result, Creator provides a serial of (legacy) decorators to allow developers to manually specify the type information. Decorators are executed in module execution stage. Let's skip the stuffs that how ES modules are imported. Only thing you should know is: since sometimes these decorators need types exported from another modules, the circular reference problem is a real headache. |
Beta Was this translation helpful? Give feedback.
-
ProgressRecently I found that block decorator proposal may help to this! See tc39/proposal-decorators#340 for my post. |
Beta Was this translation helpful? Give feedback.
-
This may be a long long discussion..
Beta Was this translation helpful? Give feedback.
All reactions