Skip to content
  • Héctor Ramos's avatar
    Fix failure due to missing Metro flow types · f4d627c8
    Héctor Ramos authored
    Summary:
    Fixes the Flow failure due to an undefined Ast type.
    
    Before:
    
    ```
     $ npm run flow -- check
    
    > react-native@1000.0.0 flow /Users/hramos/git/react-native
    > flow "check"
    
    Error: local-cli/__tests__/fs-mock-test.js:27
     27:   beforeEach(() => {
           ^^^^^^^^^^ beforeEach. Could not resolve name
    
    Error: local-cli/__tests__/fs-mock-test.js:53
     53:       expect(content).toEqual('beep');
               ^^^^^^ expect. Could not resolve name
    
    Error: local-cli/__tests__/fs-mock-test.js:88
     88:         expect(content).toEqual('hello, world!');
                 ^^^^^^ expect. Could not resolve name
    
    Error: local-cli/__tests__/fs-mock-test.js:100
    100:       expect(content).toEqual('hello, world!');
               ^^^^^^ expect. Could not resolve name
    
    Error: node_modules/metro/src/Bundler/util.js.flow:46
     46: ): Ast {
            ^^^ Ast. Could not resolve name
    
    Error: node_modules/metro/src/ModuleGraph/worker/collect-dependencies.js.flow:283
    283: const xp = (module.exports = (ast: Ast) =>
                                            ^^^ Ast. Could not resolve name
    
    Error: node_modules/metro/src/assetTransformer.js.flow:29
     29: ): Promise<{ast: Ast}> {
                          ^^^ Ast. Could not resolve name
    ```
    
    After
    
    ```
    $ npm run flow -- check
    
    > react-native@1000.0.0 flow /Users/hramos/git/react-native
    > flow "check"
    
    Error: local-cli/__tests__/fs-mock-test.js:27
     27:   beforeEach(() => {
           ^^^^^^^^^^ beforeEach. Could not resolve name
    
    Error: local-cli/__tests__/fs-mock-test.js:53
     53:       expect(content).toEqual('beep');
               ^^^^^^ expect. Could not resolve name
    
    Error: local-cli/__tests__/fs-mock-test.js:88
     88:         expect(content).toEqual('hello, world!');
                 ^^^^^^ expect. Could not resolve name
    
    Error: local-cli/__tests__/fs-mock-test.js:100
    100:       expect(content).toEqual('hello, world!');
               ^^^^^^ expect. Could not resolve name
    ```
    
    [ GENERAL ] [ BUGFIX] [ .flowconfig ] - Have Flow ignore Metro node_nodules
    Closes https://github.com/facebook/react-native/pull/17187
    
    Differential Revision: D6572303
    
    Pulled By: hramos
    
    fbshipit-source-id: aa256b9725970fcc2a6da6578c83e7c0875e3cfd
    f4d627c8