Skip to content

Confused over persisted? type for ActiveModel #955

@G-Rath

Description

@G-Rath

I've been exploring using RBS with RubyMine, and found an oddity with how the persisted? type is defined for ActiveModel:

Here it is defined as returning a bool, which is what I'd expect:

However here it is typed as returning false:

It seems that the latter definition "wins" in the eyes of RubyMine causing it flag anything that isn't false:

Image

I personally come from a TypeScript background and have been involved in their version of RBS (DefinitelyTyped), so I'm happy to be involved in improving the types here but since this is the first time I'm really digging into RBS I want to make sure I understand how the types are managed especially these Rails ones that are suffixed with -generated.

Would it be correct to just remove the definition from the -generated file, or is there something else that would need adjusting?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions