-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[declarations] doesn't work with builtins #6631
Comments
Flow appears to parse all builtins into a global module. When using |
Thanks for filing this issue. I'm super excited about the use of |
I've been debugging this a bit. I'm looking for a simple place to make the fix but right now it looks like the changes may have to be fairly invasive. |
@LegNeato @mroch I still think that For now for supressing wrong or stale declarations in packages i need to manage 2 files. Maybe it helps to find easy fix ;) All what is under
- [ignore]
+ [supress]
.*/node_modules/react-native/Libraries/Lists/FlatList.js
.*/node_modules/react-native/Libraries/Lists/VirtualizedList.js
.*/node_modules/react-native/Libraries/Lists/SectionList.js
.*/node_modules/react-native/Libraries/CameraRoll/CameraRoll.js
.*/node_modules/react-native/Libraries/ReactNative/requireNativeComponent.js
.*/node_modules/react-native/Libraries/ReactNative/renderApplication.js
.*/node_modules/react-native/Libraries/Components/Switch/Switch.js
.*/node_modules/react-native/Libraries/Animated/src/nodes/AnimatedValue.js
.*/node_modules/react-native/Libraries/Animated/src/nodes/AnimatedInterpolation.js
- declare module 'FlatList' { declare module.exports: any; }
- declare module 'VirtualizedList' { declare module.exports: any; }
- declare module 'SectionList' { declare module.exports: any; }
- declare module 'CameraRoll' { declare module.exports: any; }
- declare module 'renderApplication' { declare module.exports: any; }
- declare module 'requireNativeComponent' { declare module.exports: any; }
- declare module 'Switch' { declare module.exports: any; }
- declare module './AnimatedValue' { declare module.exports: any; }
- declare module './nodes/AnimatedValue' { declare module.exports: any; }
- declare module '../nodes/AnimatedValue' { declare module.exports: any; }
- declare module './AnimatedInterpolation' { declare module.exports: any; }
- declare module 'AnimatedInterpolation' { declare module.exports: any; }
- declare module './nodes/AnimatedInterpolation' { declare module.exports: any; } PS. Please avoid confusing |
Small poll for new name:
I think there is no problem to give a new name in 0.79 😇 |
I actually like On a side note, I'm still not able to use this option correctly with React and React Native, am I missing something or this is a known issue? |
@wcandillon That's this issue 😄 |
@LegNeato Thanks a lot 🙋🏼♂️ Was just double checking 😉Really appreciate your support. |
|
For the record, suppress is spelled with two ps. Other than that it’s IMO the most descriptive name, but hardly the focus of this issue… |
Yeah if you want to change the name can you create a different issue, @nodkz? This issue documents a bug with |
@LegNeato you mention the changes to get this working potentially being quite invasive, would you be willing to share some of what you discovered as to what the issue actually is and what might be needed to overcome it? I'm not terribly well versed in ocaml but would be happy to see if I can help if you'd be willing to get me up to speed on what you know so far. |
@ericketts Essentially all I know is in #6631 (comment). I haven't had time to dig in more and am almost exclusively using Rust these days so I don't personally have a pressing need (also I am an OCaml n00b). I basically just started at my landed changes and tried to follow the callers to see how builtins were handled. I didn't see an obvious place where builtin errors are handled differently than non-builtin, but they must be because |
@nodkz you forgot |
Fixes facebook#6631, facebook#6717, facebook#7803. There are two major flaws in the original approach: 1. Silencing errors at the merge site does not work for builtins, as those errors are computed later, and 2. Putting that suppression in an if/else where the else block parsed comment error suppressions can cause [declarations] to actually create *more* errors, which was misleading a lot of people and masked the source of bugs. We now suppress entire files in error collation, at the very end of the error reporting process.
This name has not gone over well: facebook#6631 (comment) and is confusing in multiple places, such as: https://github.com/facebook/flow/blob/master/website/en/docs/declarations/index.md and https://github.com/facebook/flow/blob/dd93de0a3796897fe07cca8a3bdc621c992a9880/tests/lib_interfaces/.flowconfig#L5-L6 It is difficult to grep for, difficult to distinguish versus type declarations, and is widely used interchangeably with "interfaces". For these reasons and many more, it is best to rename this option now that it is usable.
Fixed in #8105 by my testing. Please try it out. |
Fixes facebook#6631, facebook#6717, facebook#7803. There are two major flaws in the original approach: 1. Silencing errors at the merge site does not work for builtins, as those errors are computed later, and 2. Putting that suppression in an if/else where the else block parsed comment error suppressions can cause [declarations] to actually create *more* errors, which was misleading a lot of people and masked the source of bugs. We now suppress entire files in error collation, at the very end of the error reporting process.
[declarations]
works with your own types or types defined in node modules, but does not suppress errors in flow builtins. See #4916 (comment).Repro in https://github.com/yamov/FlowDeclarations/.
The text was updated successfully, but these errors were encountered: