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
Upgrade Typescript to 4.5.3 to match Kibana #5591
Upgrade Typescript to 4.5.3 to match Kibana #5591
Changes from 7 commits
be0ee89
02026e6
bcb4420
22b4d47
b836660
345db9c
a607fdf
d12815c
e217741
1d29ce0
58826b6
8a6352e
3779869
3684d2c
a1f209e
1a6aa52
dede73b
97a5cd8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Obligatory https://stackoverflow.com/a/68257472/4294462: In TS 4.4+ caught errors default to
unknown
instead ofany
. We could disable this viauseUnknownInCatchVariables
intsconfig.json
, but honestly I think it's a legit change and it's worth checking for a valid Error instance since something likethrow 'foo'
is an allowed error. LMK if you have other thoughts however!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.
Maybe check for
'message' in e
- possibly with a type guard to catch some non-error-but-still-compatible objects?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.
hm, I'd be more tempted to
JSON.stringify()
a custom error object with a message key - that way the user can always get the full error no matter what. This seems like it might be worth DRYing out a helper that checks forinstanceof Error
and tries to return a valid Error type if not. WDYT?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.
Probably too engineery at that point, and leaving as-is makes more sense? 🙂
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.
Fair enough! We can keep it in our back pockets for later if we add more try/catches