Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Flow type checking fails #226

Closed
cdlewis opened this issue Jan 10, 2017 · 4 comments
Closed

Flow type checking fails #226

cdlewis opened this issue Jan 10, 2017 · 4 comments

Comments

@cdlewis
Copy link

cdlewis commented Jan 10, 2017

I get a lot of errors trying to include this on a Flow 0.35 project. I'm guessing some of these files just need to be updated for newer versions of Flow. We could also run type checking as part of the test suite.

I'm happy to have a stab at this if you guys are on board.

node_modules/react-native-fetch-blob/android.js:13
 13: const RNFetchBlob:RNFetchBlobNative = NativeModules.RNFetchBlob
                       ^^^^^^^^^^^^^^^^^ identifier `RNFetchBlobNative`. Could not resolve name

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:27
 27:     this.encoding = encoding || 'utf8'
         ^^^^^^^^^^^^^ assignment of property `encoding`
 27:     this.encoding = encoding || 'utf8'
                         ^^^^^^^^ string. This type is incompatible with
 19:   encoding : 'utf8' | 'ascii' | 'base64';
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ string enum

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:32
 32:     this._onData = () => {}
              ^^^^^^^ property `_onData`. Property not found in
 32:     this._onData = () => {}
         ^^^^ RNFetchBlobReadStream

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:33
 33:     this._onEnd = () => {}
              ^^^^^^ property `_onEnd`. Property not found in
 33:     this._onEnd = () => {}
         ^^^^ RNFetchBlobReadStream

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:34
 34:     this._onError = () => {}
              ^^^^^^^^ property `_onError`. Property not found in
 34:     this._onError = () => {}
         ^^^^ RNFetchBlobReadStream

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:35
 35:     this.streamId = 'RNFBRS'+ UUID()
              ^^^^^^^^ property `streamId`. Property not found in
 35:     this.streamId = 'RNFBRS'+ UUID()
         ^^^^ RNFetchBlobReadStream

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:41
 41:         this._onData(detail)
             ^^^^^^^^^^^^^^^^^^^^ call of method `_onData`. Function cannot be called on
 41:         this._onData(detail)
             ^^^^^^^^^^^^^^^^^^^^ property `_onData` of unknown type

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:45
 45:         this._onEnd(detail)
             ^^^^^^^^^^^^^^^^^^^ call of method `_onEnd`. Function cannot be called on
 45:         this._onEnd(detail)
             ^^^^^^^^^^^^^^^^^^^ property `_onEnd` of unknown type

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:49
 49:           this._onError(detail)
               ^^^^^^^^^^^^^^^^^^^^^ call of method `_onError`. Function cannot be called on
 49:           this._onError(detail)
               ^^^^^^^^^^^^^^^^^^^^^ property `_onError` of unknown type

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:64
 64:       RNFetchBlob.readStream(this.path, this.encoding, this.bufferSize || 10240 , this.tick || -1, this.streamId)
                                                                                                             ^^^^^^^^ property `streamId`. Property not found in
 64:       RNFetchBlob.readStream(this.path, this.encoding, this.bufferSize || 10240 , this.tick || -1, this.streamId)
                                                                                                        ^^^^ RNFetchBlobReadStream

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:70
 70:     this._onData = fn
              ^^^^^^^ property `_onData`. Property not found in
 70:     this._onData = fn
         ^^^^ RNFetchBlobReadStream

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:73
 73:   onError(fn) {
               ^^ parameter `fn`. Missing annotation

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:74
 74:     this._onError = fn
              ^^^^^^^^ property `_onError`. Property not found in
 74:     this._onError = fn
         ^^^^ RNFetchBlobReadStream

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:77
 77:   onEnd (fn) {
              ^^ parameter `fn`. Missing annotation

node_modules/react-native-fetch-blob/class/RNFetchBlobReadStream.js:78
 78:     this._onEnd = fn
              ^^^^^^ property `_onEnd`. Property not found in
 78:     this._onEnd = fn
         ^^^^ RNFetchBlobReadStream

node_modules/react-native-fetch-blob/class/RNFetchBlobSession.js:21
 21:   dispose : () => Promise;
                       ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/class/RNFetchBlobSession.js:67
 67:   dispose():Promise {
                 ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/class/RNFetchBlobWriteStream.js:24
 24:     this.append = append
         ^^^^^^^^^^^ assignment of property `append`
 24:     this.append = append
                       ^^^^^^ string. This type is incompatible with
 19:   append : bool;
                ^^^^ boolean

node_modules/react-native-fetch-blob/fs.js:44
 44:     return new RNFetchBlobSession(name)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructor call
 44:     return new RNFetchBlobSession(name)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ undefined (too few arguments, expected default/rest parameters). This type is incompatible with
 37:   constructor(name:string, list:Array<string>) {
                                     ^^^^^^^^^^^^^ array type. See: node_modules/react-native-fetch-blob/class/RNFetchBlobSession.js:37

node_modules/react-native-fetch-blob/fs.js:60
 60: function createFile(path:string, data:string, encoding: 'base64' | 'ascii' | 'utf8'):Promise {
                                                                                          ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/fs.js:102
102:         resolve(new RNFetchBlobWriteStream(streamId, encoding))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructor call
102:         resolve(new RNFetchBlobWriteStream(streamId, encoding))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ undefined (too few arguments, expected default/rest parameters). This type is incompatible with
 21:   constructor(streamId:string, encoding:string, append:string) {
                                                            ^^^^^^ string. See: node_modules/react-native-fetch-blob/class/RNFetchBlobWriteStream.js:21

node_modules/react-native-fetch-blob/fs.js:128
128: function mkdir(path:string):Promise {
                                 ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/fs.js:160
160: function writeFile(path:string, data:string | Array<number>, encoding:?string):Promise {
                                                                                    ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/fs.js:177
177: function appendFile(path:string, data:string | Array<number>, encoding:?string):Promise {
                                                                                     ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/fs.js:215
215: function scanFile(pairs:any):Promise {
                                  ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/fs.js:275
275: function unlink(path:string):Promise {
                                  ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/fs.js:292
292: function exists(path:string):Promise<bool, bool> {
                                  ^^^^^^^^^^^^^^^^^^^ type application of identifier `Promise`. Too many type arguments. Expected at most 1
 17: declare class Promise<+R> {
                            ^ See type parameters of definition here. See lib: node_modules/react-native/flow/Promise.js:17

node_modules/react-native-fetch-blob/fs.js:306
306: function slice(src:string, dest:string, start:number, end:number):Promise {
                                                                       ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/fs.js:319
319:            size = Math.floor(stat.size)
                                       ^^^^ property `size`. Property not found in
319:            size = Math.floor(stat.size)
                                  ^^^^ RNFetchBlobFile

node_modules/react-native-fetch-blob/fs.js:328
328: function isDir(path:string):Promise<bool, bool> {
                                 ^^^^^^^^^^^^^^^^^^^ type application of identifier `Promise`. Too many type arguments. Expected at most 1
 17: declare class Promise<+R> {
                            ^ See type parameters of definition here. See lib: node_modules/react-native/flow/Promise.js:17

node_modules/react-native-fetch-blob/index.js:126
126: function fetchFile(options = {}, method, url, headers = {}, body):Promise {
                                                                       ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/index.js:153
153:         total = stat.size
                          ^^^^ property `size`. Property not found in
153:         total = stat.size
                     ^^^^ RNFetchBlobFile

node_modules/react-native-fetch-blob/index.js:178
178:           resolve(new FetchBlobResponse(null, info, cacheData))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructor call
178:           resolve(new FetchBlobResponse(null, info, cacheData))
                                             ^^^^ null. This type is incompatible with
398:   constructor(taskId:string, info:RNFetchBlobResponseInfo, data:any) {
                          ^^^^^^ string

node_modules/react-native-fetch-blob/index.js:184
184:   promise.progress = (fn) => {
               ^^^^^^^^ property `progress`. Property cannot be assigned on possibly null value
184:   promise.progress = (fn) => {
       ^^^^^^^ null

node_modules/react-native-fetch-blob/index.js:184
184:   promise.progress = (fn) => {
               ^^^^^^^^ property `progress`. Property not found in
184:   promise.progress = (fn) => {
       ^^^^^^^ Promise

node_modules/react-native-fetch-blob/index.js:188
188:   promise.stateChange = (fn) => {
               ^^^^^^^^^^^ property `stateChange`. Property cannot be assigned on possibly null value
188:   promise.stateChange = (fn) => {
       ^^^^^^^ null

node_modules/react-native-fetch-blob/index.js:188
188:   promise.stateChange = (fn) => {
               ^^^^^^^^^^^ property `stateChange`. Property not found in
188:   promise.stateChange = (fn) => {
       ^^^^^^^ Promise

node_modules/react-native-fetch-blob/index.js:192
192:   promise.uploadProgress = (fn) => {
               ^^^^^^^^^^^^^^ property `uploadProgress`. Property cannot be assigned on possibly null value
192:   promise.uploadProgress = (fn) => {
       ^^^^^^^ null

node_modules/react-native-fetch-blob/index.js:192
192:   promise.uploadProgress = (fn) => {
               ^^^^^^^^^^^^^^ property `uploadProgress`. Property not found in
192:   promise.uploadProgress = (fn) => {
       ^^^^^^^ Promise

node_modules/react-native-fetch-blob/index.js:212
212: function fetch(...args:any):Promise {
                                 ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

node_modules/react-native-fetch-blob/index.js:233
233:         promise.onProgress(e.written, e.total, e.chunk)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `onProgress`. Function cannot be called on
233:         promise.onProgress(e.written, e.total, e.chunk)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `onProgress` of unknown type

node_modules/react-native-fetch-blob/index.js:239
239:         promise.onUploadProgress(e.written, e.total)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `onUploadProgress`. Function cannot be called on
239:         promise.onUploadProgress(e.written, e.total)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `onUploadProgress` of unknown type

node_modules/react-native-fetch-blob/index.js:246
246:         promise.onStateChange(e)
             ^^^^^^^^^^^^^^^^^^^^^^^^ call of method `onStateChange`. Function cannot be called on
246:         promise.onStateChange(e)
             ^^^^^^^^^^^^^^^^^^^^^^^^ property `onStateChange` of unknown type

node_modules/react-native-fetch-blob/index.js:253
253:         promise.onExpire(e)
             ^^^^^^^^^^^^^^^^^^^ call of method `onExpire`. Function cannot be called on
253:         promise.onExpire(e)
             ^^^^^^^^^^^^^^^^^^^ property `onExpire` of unknown type

node_modules/react-native-fetch-blob/index.js:259
259:         promise.onPartData(e.chunk)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `onPartData`. Function cannot be called on
259:         promise.onPartData(e.chunk)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `onPartData` of unknown type

node_modules/react-native-fetch-blob/index.js:289
289:       delete promise['progress']
                  ^^^^^^^^^^^^^^^^^^^ access of computed property/element. Indexable signature not found in
289:       delete promise['progress']
                  ^^^^^^^ Promise

node_modules/react-native-fetch-blob/index.js:290
290:       delete promise['uploadProgress']
                  ^^^^^^^^^^^^^^^^^^^^^^^^^ access of computed property/element. Indexable signature not found in
290:       delete promise['uploadProgress']
                  ^^^^^^^ Promise

node_modules/react-native-fetch-blob/index.js:291
291:       delete promise['stateChange']
                  ^^^^^^^^^^^^^^^^^^^^^^ access of computed property/element. Indexable signature not found in
291:       delete promise['stateChange']
                  ^^^^^^^ Promise

node_modules/react-native-fetch-blob/index.js:292
292:       delete promise['part']
                  ^^^^^^^^^^^^^^^ access of computed property/element. Indexable signature not found in
292:       delete promise['part']
                  ^^^^^^^ Promise

node_modules/react-native-fetch-blob/index.js:293
293:       delete promise['cancel']
                  ^^^^^^^^^^^^^^^^^ access of computed property/element. Indexable signature not found in
293:       delete promise['cancel']
                  ^^^^^^^ Promise
@MichaelZC
Copy link

I've been experiencing this as well. +1 Would be great if a quick update to the newer annotations/conventions could be made.

@wkh237
Copy link
Owner

wkh237 commented Jan 13, 2017

Thanks for notifying this issue, I haven't upgrade my flow for a while, basically the flow annotations are just for making the code easier to read ATM, not sure if this is going to be a lot work to fix these lint errors (also keep things working properly). Does it help if I just simply remove the @flow annotation from files ?

@MichaelZC
Copy link

@wkh237 removing the @flow comment should stop the warnings

@wkh237
Copy link
Owner

wkh237 commented Jan 17, 2017

FYI, the flowType annotations already removed in 0.10.2-beta.6 , please try upgrade the package and see if that works properly, thanks 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants