Skip to content

Prepare for TS 3.7 upgrade#47683

Merged
timroes merged 1 commit intoelastic:masterfrom
timroes:ts-cleanup-code
Oct 9, 2019
Merged

Prepare for TS 3.7 upgrade#47683
timroes merged 1 commit intoelastic:masterfrom
timroes:ts-cleanup-code

Conversation

@timroes
Copy link
Copy Markdown
Contributor

@timroes timroes commented Oct 9, 2019

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.

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/code (Team:Code)


import { DiffKind } from '../common/git_diff';
import { Repository, SourceHit } from '../model';
import { Repository } from '../model';
Copy link
Copy Markdown
Contributor Author

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).

[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)) {
Copy link
Copy Markdown
Contributor Author

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).

@timroes timroes mentioned this pull request Oct 9, 2019
15 tasks
@timroes timroes added the release_note:skip Skip the PR/issue when compiling release notes label Oct 9, 2019
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@timroes timroes merged commit cac2d45 into elastic:master Oct 9, 2019
@timroes timroes deleted the ts-cleanup-code branch October 9, 2019 16:36
timroes pushed a commit to timroes/kibana that referenced this pull request Oct 9, 2019
timroes pushed a commit that referenced this pull request Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes v7.5.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants