-
Notifications
You must be signed in to change notification settings - Fork 134
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
DesktopAgent: Method generation creates multiple overloads #883
Comments
The overloads are all for deprecated functions, which you could remove as they are inherently optional (although that may indeed cause typing issues). We can't remove them from the FDC3 Standard until a later major release, however. Given that you have top-level imports for the types that have weird inline imports I would look to whatever code generation tool you are using for a solution to that issue. There are indeed some capitalized Lines 546 to 566 in e8d0248
A PR should be raised to fix that. Do you have any other concrete asks (apart from removal of the overloads, which we can't do soon due to our governance/versioning policy)? |
@Anlanther I agree with what @kriswest said about the how it's notable that the weird inline imports already have top-level imports for those types. The behaviour you're experiencing must be a result of the IDE / TypeScript config that you're using (whether explicitly or implicitly). I don't experience the weird inline imports when I implement the interface in my environment, so I do not believe this is a bug in I can't speak with authority on this, but as for the apparent need to remove method overloads after implementing the interface in order to match the documentation, I'm not so sure I personally agree with this as a strategy if you were following the FDC3 2.0 spec. The overloads (multiple declarations immediately followed by the same-named implementation) are perfectly valid TypeScript syntax, and they are there for a reason - they clearly show the current and the deprecated function signatures that are included in the FDC3 2.0 spec. So if implementing the If you are in fact implementing a desktop agent in a browser (whether for demo or other purposes), personally I think it would be good practice to:
This would make the boundaries between the desktop agent and the application clearer. It would also provide clarity on whether your agent and application were using the current or the deprecated versions of the various FDC3 methods (because you'd benefit from the As @kriswest pointed out, the overloads could potentially be removed in future versions of the spec (i.e. beyond 2.0). But right now, the spec clearly establishes current and deprecated signatures - and since TypeScript supports overloaded class method declarations and overloaded function declarations, I believe you should be able to implement the I actually think in your specific case the weird inline import syntax clouded the issue. I believe it was the confusion around equivalence of the Related to this, there's currently an inconsistency between the method signatures in |
@Anlanther We believe the questions in this issue are answered. Hence, closing this issue - feel free to reopen if you have further comments. Please note, we've raised a separate issue to deal with the use of the |
Minor Issue
Area of Issue
[ ] App Directory
[x ] API
[ ] Context Data
[ ] Intents
[ ] Use Cases
[ ] Other
Issue Description:
When implementing the DesktopAgent on another class, automatic method generation leads to multiple overloads, such as with the
open()
andraiseIntent()
methods. The generated methods also include inline imports and when other method overloads are removed to match documentation, there are incompatibility issues.Additional Context:
This is what is generated when implementing the DesktopAgent on a fresh new class and what also happens when starting a project from scratch (Angular). As can be seen, there are overloads for methods such as
open()
andraiseIntent()
. Both also include an odd inline import (Promise<import("@finos/fdc3").AppIdentifier>
):Example error when removing i.e.
open()
overloads...Removed:
open(name: String, context?: Context | undefined): Promise<AppIdentifier>;
open(name: unknown, context?: unknown): Promise<import("@finos/fdc3").AppIdentifier>
Kept:
open(app: AppIdentifier, context?: Context | undefined): Promise<AppIdentifier>;
Result:
Also had to replace all generated
String
withstring
.The text was updated successfully, but these errors were encountered: