-
Notifications
You must be signed in to change notification settings - Fork 132
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
506 deprecate name field in API calls #722
Conversation
✅ Deploy Preview for lambent-kulfi-cf51a7 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
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.
Nice
Co-authored-by: Hugh Troeger <htroeger@factset.com> Co-authored-by: Matt Jamieson <10372+mattjamieson@users.noreply.github.com>
Thanks @mattjamieson @greyseer256, suggestions applied |
|
||
export function open(app: AppIdentifier | String, context?: Context): Promise<AppMetadata> { | ||
if (isString(app)) { | ||
return rejectIfNoGlobal(() => window.fdc3.open(app, context)); |
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.
Shouldn't these overloads be wrapping the string as an AppIdentifier internally? Otherwise why is there a check and if-else?
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.
The typeguard and check were needed as typescript will allow us to declare the different types for the function overload, but in the implementation, javascript won't (the second declaration will just overwrite the first, which typescript knows and will spit out as an error).
Hence, this looks odd in this utility file, but works correctly and looks correct in the types/docs (and provides the overload for use in other languages that actually care about the types of function arguments, which JS does not). Hence, JS implementations will still use a single function to implement both signatures and will have to do some similar type checking internally.
Makes a bit more sense when you see it in VS code and it highlights that one of the calls fdc3.open is the deprecated form:
I can't wrap the name
as an AppIdentifier
internally as we're missing the required appId
.
Co-authored-by: Brian Ingenito <28159742+bingenito@users.noreply.github.com>
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.
LGTM
resolves #506
Removes the
TargetApp
union type (string | Appmetadata
) which splits the signatures foropen
,raiseIntent
andraiseIntentForContext
into two versions, then deprecates the version based on on thename
field. Also makesname
optional, butappId
required and splitsAppMetadata
intoAppIdentifier
andAppMetadata
which extends it - this helps to clarify what the requirements are for function calls, vs. the return types (thanks for the suggestion @thorsent).Also:
As discussed at #683