Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Identity] What if we accepted the PEM certificate string contents? #18017
[Identity] What if we accepted the PEM certificate string contents? #18017
Changes from 1 commit
a28c510
4489a39
ce5e11a
da5aa2d
180a1fa
482df8c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
this is clever to avoid folks providing both on accident, at least in TS
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.
Nitpick, I think
certificatePath?: undefined;
is slightly better. It makes it clear that if you access this value you will getundefined
, which is assignable only to otherundefined
things, whereasnever
is assignable to any constraint.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 only thing that I find weird is that if I wanted to use
undefined
here I also need to put the question mark, socertificatePath?: undefined
, which seems redundant, but it’s necessary for the exclusive-or type to work. Perhaps I’m missing something 🤔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 what's weird is because we want strictly
{ a: string } | { b: string }
, but because{a: "foo", b: "bar" }
satisfies both of them using TS rules, we have to tell it{ a: string, b?: undefined } | { a?: undefined, b: string }
because we want to support{a: "foo"}
and{b: "bar"}
(the other prop is not present at all, hence the question mark) but we also want the compiler to complain if the key is present and set to anything except undefined (like a string, which would create the confusion.)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.
@xirzec I think you have captured what’s weird! — I didn’t quite get the suggestion though 🤔