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

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

Open
danielnixon opened this issue Mar 19, 2023 · 1 comment

Comments

@danielnixon
Copy link
Owner

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
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant