eslint-plugin-total-functions icon indicating copy to clipboard operation
eslint-plugin-total-functions copied to clipboard

no-unsafe-readonly-mutable-assignment failing to identify a ReadonlyShallow correctly

Open danielnixon opened this issue 1 year ago • 1 comments

This is working:

        type Thing = { a: string };

        type OtherThing = { readonly a: string };

        // This is correctly inferred to be ReadonlyShallow        
        type ThingArray = readonly Thing[];
        
        // This is correctly inferred to be ReadonlyDeep
        type OtherThingArray = readonly OtherThing[];

        // ReadonlyDeep
        declare const a: OtherThingArray;

        // Flagged (ReadonlyDeep -> ReadonlyShallow)
        const b: ThingArray = a;

But this isn't:

        type Thing = { a: string };

        type OtherThing = { readonly a: string };

        // ReadonlyDeep
        declare const a: readonly OtherThing[];
        
        // Not flagged (it thinks readonly Thing[] is ReadonlyDeep when it should be ReadonlyShallow)
        const b: readonly Thing[] = a;

danielnixon avatar Mar 19 '23 20:03 danielnixon

Looks like: https://github.com/eslint-functional/eslint-plugin-functional/issues/578#issuecomment-1475391803

danielnixon avatar Mar 19 '23 20:03 danielnixon