Skip to content
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

Strange error when typechecking. #1021

Closed
zsszatmari opened this issue Oct 31, 2015 · 3 comments
Closed

Strange error when typechecking. #1021

zsszatmari opened this issue Oct 31, 2015 · 3 comments
Labels

Comments

@zsszatmari
Copy link

Hi!

I am trying to use flow together with the seamless-immutable package, and add a declaration so it would typecheck. I get strange error:

declare class ImmutableExt<T>
{
    merge(x : any, options : ?any) : Immutable<T>;
}
type Immutable<T> = T & ImmutableExt<T>;
declare function immutable<T>(x : T) : Immutable<T>;

type ProgressState = Immutable<{failedActions: Array<any>, succeededActions: Array<any>}>;

function progress(state /*: ?ProgressState */) /*: ProgressState */
{
    if (!state) {
        return immutable({failedActions: [], succeededActions: []});
    } else {
        return state;
    }

    // curiously, if I only have return state, without any if's, it typechecks
}
 33:    merge(x : any, options : ?any) : Immutable<T>;
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `merge`. Property not found in
 45:        return state;
              ^^^^^ object type


Found 1 error
@samwgoldman
Copy link
Member

Maybe related to #582.

@samwgoldman
Copy link
Member

This is still failing after the fix for #582.

@calebmer calebmer added the bug label Jul 19, 2017
@TrySound TrySound closed this as completed Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants