Skip to content

Determine immutability for const type parameters #827

@bjb568

Description

@bjb568

Suggestion

Example:

(<const T>(f: () => T) => f)(() => ({ foo: 1 }));

Currently this results in: Return type should have an immutability of at least "Immutable" (actual: "Mutable"). However, the type parameter uses the const keyword so the code is equivalent to the following, which is correctly treated as immutable.

(<T>(f: () => T) => f)(() => ({ foo: 1 } as const));

(Not sure if this is a suggestion for this repo or for is-immutable-type so I made it here.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: ExternalIt was a real bug, but not in the code in this repo.Type: BugInconsistencies or issues which will cause a problem for users or implementors.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions