-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
chore: replace function types #10436
Conversation
@G-Rath a single failure |
@@ -26,7 +26,7 @@ export default { | |||
Please update your configuration.`, | |||
|
|||
preprocessorIgnorePatterns: (options: { | |||
preprocessorIgnorePatterns: Array<string>; | |||
preprocessorIgnorePatterns?: Array<string>; |
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.
While technically at runtime this isn't true (because whole logic is that these functions are being called when options
contains the property they're the value of), given they're deprecated and this doesn't break anything, I think it's fine 🤷
@G-Rath still some type errors here |
@@ -5,6 +5,7 @@ | |||
* LICENSE file in the root directory of this source tree. | |||
*/ | |||
|
|||
import type BabelTraverse from '@babel/traverse'; |
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.
is this in package.json
?
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.
Yup :)
packages/jest-snapshot/src/State.ts
Outdated
@@ -5,6 +5,7 @@ | |||
* LICENSE file in the root directory of this source tree. | |||
*/ | |||
|
|||
import type BabelTraverse from '@babel/traverse'; |
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.
is this in package.json
?
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 problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the types dep. For both I guess
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.
However, this comes from @types/babel__travese
, so we should be good to add that as the dependency 🎉
Can this PR also remove the |
@G-Rath ping 🙂 |
@SimenB this is failing due to
Which I'm not entirely sure is incorrect in this situation. |
Right, I've added some validation that the only |
Yeah, I was wondering a similar thing - my current bet is that it's because But so then I'd expect the output from TS to be correct in this case, because we're only wanting the type. |
@G-Rath pushed a variant that avoid the import statement |
@@ -11,7 +11,9 @@ type Title = { | |||
warning?: string; | |||
}; | |||
|
|||
export type DeprecatedOptions = Record<string, Function>; | |||
export type DeprecatedOptionFunc = (arg: Record<string, any>) => string; |
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.
export type DeprecatedOptionFunc = (arg: Record<string, any>) => string; | |
export type DeprecatedOptionFunc = (arg: Record<string, unknown>) => string; |
?
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.
iirc no because then TS knows too much and would force us to properly type the deprecated types too - I think a good way to make this change would be to do it after the latest deprecated options are removed, so to require all future deprecated options to be more accurately typed.
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.
sounds good 👍
@SimenB er what happened there 😅 |
no idea... |
too late for the commit, tho :P |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Relates to #10177
Test plan
See if CI passes