-
Notifications
You must be signed in to change notification settings - Fork 47.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
Fix flow types #18204
Fix flow types #18204
Conversation
@@ -158,7 +158,7 @@ describe('InspectedElementContext', () => { | |||
} | |||
|
|||
const ModernContext = React.createContext(); | |||
ModernContext.displayName = 'ModernContext'; | |||
(ModernContext: any).displayName = 'ModernContext'; |
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 guess I should just add displayName
to our internal context type. Will do momentarily.
event.pageY || | ||
(event.touches && ((event: any): TouchEvent).touches[0].pageY); | ||
(event: any).pageY || | ||
(event.touches && (event: any).touches[0].pageY); |
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.
Flow v97 doesn't go very deep here I guess. 🤷♂️
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 757c6f8:
|
@@ -3,6 +3,8 @@ | |||
* | |||
* This source code is licensed under the MIT license found in the | |||
* LICENSE file in the root directory of this source tree. | |||
* | |||
* @flow |
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.
This was the linchpin change that uncovered all of the masked any
type errors.
@@ -37,7 +37,7 @@ function resolveDispatcher() { | |||
export function useContext<T>( | |||
Context: ReactContext<T>, | |||
unstable_observedBits: number | boolean | void, | |||
) { | |||
): T { |
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.
Our internal definition of useContext
was broken.
@@ -66,6 +66,9 @@ export type ReactContext<T> = { | |||
// DEV only | |||
_currentRenderer?: Object | null, | |||
_currentRenderer2?: Object | null, | |||
// This value may be added by application code | |||
// to improve DEV tooling display names | |||
displayName?: 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.
This helps me avoid a bunch of : any
casts for DevTools code and matches the Flow definition.
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.
And would help #18035 😉
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 48ed4cb:
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 0c34969:
|
This seems to cause a parsing error. (Not sure why.) The API is deprecated anyway so I'm being lazy for now and just adding a .
Don’t be certain that it’s unrelated, I saw this recently as a a sign that another task failed. Afk or I’d look for proof. |
The failure is a 401 being returned from the electron repo in its post-install task 😄 Seems unrelated. |
Oh no lol |
While reviewing #17934, I spotted some Flow problems that should have been caught. After investigating, this turned out to be caused by a missing
@flow
pragma in the mainReact.js
file which was causing a lot of React APIs to beany
types for DevTools and the interactions package.