[Security Solution][Defend Workflows] Fix type errors indicated by TS 4.7.4.#163066
Conversation
0fa197a to
3ff6048
Compare
|
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
3ff6048 to
8a4b0d6
Compare
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
| } | ||
|
|
||
| // @ts-expect-error ts upgrade v4.7.4 | ||
| if (isMounted() && OsqueryForm) { |
There was a problem hiding this comment.
@gergoabraham I remember we had some issues here (not typescript but how it works). Are you sure this change preserves the behavior?
There was a problem hiding this comment.
I am mostly sure, yes...
OsqueryForm comes from useKibana().services.osquery.OsqueryResponseActionTypeForm, which got its value during plugin start, and its value is the return value of getLazyOsqueryResponseActionTypeForm(), which - independently of the lazy load - returns a function component which itself is never falsy, so based on this, I believe there should be no problem.
...but...
I'm happy to test it if you can help what should be tested here. I did some basic tests (i.e. tried to use this component, by throttling network connection so it loads slowly) and there were no issues.
There was a problem hiding this comment.
I tested this manually and I think it still works as expected, thanks!
However - can you please do me a favor and remove the browser filter from here? Lets see if this make the test run then. https://github.com/elastic/kibana/blob/4180a1a105053e5579e6852082bdeaa06f019cd3/x-pack/plugins/osquery/cypress/e2e/all/alerts_response_actions_form.cy.ts#L33C16-L33C16
There was a problem hiding this comment.
thank you for testing it!
removed the browser filters, let's see what happens: dac76a5
There was a problem hiding this comment.
I think something is broken, moreover the artifacts are not build. Feel free to revert this commit and just ship your changes. I'll take care of osquery testing in a separate PR. How does this sound?
This reverts commit dac76a5.
|
@elasticmachine merge upstream |
tomsonpl
left a comment
There was a problem hiding this comment.
LGTM, thanks for the changes and thanks for bearing with me 👍
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |

Summary
TypeScript 4.7.4 shows some errors in our codebase, and the errors are suppressed in PR #162738. This will be merged after the linked PR.
This PR modifies the code so there's no need for suppressing the errors. There were 2 lint errors I couldn't fix.
1️⃣
The following one I didn't manage to fix without a deeper refactor (link)
2️⃣
Also, I have no idea how to fix this (link):
Tried by merging
DandP, or by creating a helper type usinginferto unwrap the type ofdata, but anyway I got type errors, so after some hours, I just let this go. Please let me know if you got an idea.