-
Notifications
You must be signed in to change notification settings - Fork 162
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
shareTarget derives full action URL #391
shareTarget derives full action URL #391
Conversation
- Derive the full action URL from the Web Manifest URL. - Extracts mime-types from share-target.
023ac4a
to
bb554dc
Compare
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.
I think this looks good - I'm a little unsure about why we're using undefined instead of null though.
packages/core/src/lib/TwaManifest.ts
Outdated
}); | ||
return twaManifest; | ||
} | ||
|
||
private static verifyShareTarget( | ||
webManifestUrl: URL, shareTarget?: ShareTarget): ShareTarget | undefined { | ||
if (!shareTarget || !shareTarget.action || !shareTarget.params || !shareTarget.params.files) { |
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.
Can this not be if (!shareTarget?.action || !shareTarget.params?.files)
?
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.
Good point. done.
Unfortunately, when a field is defined as optional like |
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.
Looks good with nit.
}); | ||
return twaManifest; | ||
} | ||
|
||
private static verifyShareTarget( | ||
webManifestUrl: URL, shareTarget?: ShareTarget): ShareTarget | undefined { |
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 return type can be ShareTarget?
right?
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 optional syntax only works for attributes, variable declarations and parameters. Not for return types.
Oh, it seems I still don't understand TypeScript. LGTM again. |
Improves #21