When upgrading to flow-bin 0.103.0, I get this flow error.
Error ------------------------------------------------------------------------- node_modules/mobx/lib/mobx.js.flow:118:8
Cannot extend `Array` [1] with `IObservableArray` because:
- boolean [2] is incompatible with mixed [3] in the return value of the first argument of property `find`.
- boolean [4] is incompatible with mixed [5] in the return value of the first argument of property `findIndex`.
node_modules/mobx/lib/mobx.js.flow:118:8
v-----------------------------------------------
118| export interface IObservableArray<T> extends Array<T> {
119| spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[];
120| observe(
121| listener: (changeData: IArrayChange<T> | IArraySplice<T>) => void,
122| fireImmediately?: boolean
123| ): Lambda;
124| intercept(handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>): Lambda;
125| intercept(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda;
126| intercept<T>(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda;
127| clear(): T[];
128| replace(newItems: T[]): T[];
129| find(
130| predicate: (item: T, index: number, array: Array<T>) => boolean,
131| thisArg?: any,
132| fromIndex?: number
133| ): T | any;
134| findIndex(
135| predicate: (item: T, index: number, array: Array<T>) => boolean,
136| thisArg?: any,
137| fromIndex?: number
138| ): number;
139| remove(value: T): boolean;
140| }
^
References:
node_modules/mobx/lib/mobx.js.flow:118:46
118| export interface IObservableArray<T> extends Array<T> {
^^^^^^^^ [1]
node_modules/mobx/lib/mobx.js.flow:130:65
130| predicate: (item: T, index: number, array: Array<T>) => boolean,
^^^^^^^ [2]
../../../AppData/Local/Temp/flow/flowlib_379ba966/core.js:260:68
260| find(callbackfn: (value: T, index: number, array: Array<T>) => mixed, thisArg?: any): T | void;
^^^^^ [3]
node_modules/mobx/lib/mobx.js.flow:135:65
135| predicate: (item: T, index: number, array: Array<T>) => boolean,
^^^^^^^ [4]
../../../AppData/Local/Temp/flow/flowlib_379ba966/core.js:261:73
261| findIndex(callbackfn: (value: T, index: number, array: Array<T>) => mixed, thisArg?: any): number;
^^^^^ [5]
https://github.com/facebook/flow/commit/00be88084a2ef41fadce99352b15f683f3c67f36
Looks like the return types for this callbacks never was boolean
@fredyc when is there likely to be a release for this and your dependents like mobx-react
@wadethestealth No idea, I don't do releases around here.
cc @ItamarShDev @xaviergonz
2 months and still not published ... Please ... :/
@Donov4n You could use the [untyped] option in .flowconfig to suppress the error for now. Not ideal but it allows you to upgrade flow.
[untyped]
.*/node_modules/mobx/.*
Reference: https://github.com/facebook/flow/issues/5568
Pretty sure this one has been released, as there have been a few releases in the mean time. Not sure why it is still open. Closing now. If I'm missing something, let me know.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.
Most helpful comment
2 months and still not published ... Please ... :/