Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Property refinements are unsound #75

Closed
vkurchatkin opened this issue Apr 11, 2020 · 1 comment
Closed

Property refinements are unsound #75

vkurchatkin opened this issue Apr 11, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@vkurchatkin
Copy link

function test(x: { a: string | number }): { a: string } | undefined {
    if (typeof x.a === 'string') {
        return x;
    }
}

const a:  { a: string | number } = { a: 'foo' };
const b = test(a);

a.a = 1;

if (b !== undefined) {
    b.a.toUpperCase(); // runtime error
}
@JSMonk
Copy link
Owner

JSMonk commented Apr 14, 2020

Yes. It's a big problem. We will try to fix it soon. Thank you for your contribution ^_^.

@JSMonk JSMonk added the bug Something isn't working label Apr 24, 2020
@JSMonk JSMonk closed this as completed May 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants