-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Prepare for TS 3.7 upgrade #47683
Prepare for TS 3.7 upgrade #47683
Conversation
Pinging @elastic/code (Team:Code) |
@@ -8,7 +8,7 @@ import { DetailSymbolInformation } from '@elastic/lsp-extension'; | |||
import { IRange } from 'monaco-editor'; | |||
|
|||
import { DiffKind } from '../common/git_diff'; | |||
import { Repository, SourceHit } from '../model'; | |||
import { Repository } from '../model'; |
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.
ℹ️ There was a bug in TS that you could import something and have a different export with the same name, which has been fixed in 3.7, why this wouldn't work anymore. In this specific case we can simply remove SourceHit
since it was not used in that file at all (but actually just declared later in this file).
@@ -93,7 +93,7 @@ export const search = handleActions<SearchState, SearchPayload>( | |||
{ | |||
[String(changeSearchScope)]: (state: SearchState, action: Action<SearchScope>) => | |||
produce<SearchState>(state, draft => { | |||
if (Object.values(SearchScope).includes(action.payload)) { | |||
if (action.payload && Object.values(SearchScope).includes(action.payload)) { |
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 have honestly no idea why this didn't already fail earlier. Since action.payload
can also be undefined
, you need to check that it's not undefined before calling includes
(at least in 3.7 it's failing now).
💚 Build Succeeded |
Summary
This PR is in preparation for upgrading TypeScript to 3.7 (see #47188).
See the comments inline for an explanation of what's changed. This PR should not change any functionality.