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

O.Invert doesn't work for interfaces (just for types) #208

Closed
regevbr opened this issue Mar 2, 2021 · 0 comments
Closed

O.Invert doesn't work for interfaces (just for types) #208

regevbr opened this issue Mar 2, 2021 · 0 comments

Comments

@regevbr
Copy link
Contributor

regevbr commented Mar 2, 2021

🐞 Bug Report

Describe the bug

O.Invert doesn't work for interfaces (just for types)

Reproduce the bug

type O_INVERT = {
    A: 'Av';
};

type INVERT_O = {
    Av: 'A';
};

interface O_INVERT1 {
    A: 'Av';
}

interface INVERT1_O {
    Av: 'A';
}

checks([
    check<O.Invert<O_INVERT>, INVERT_O, Test.Pass>(), // PASSES
    check<O.Invert<O_INVERT1>, INVERT1_O, Test.Pass>(), // FAILS
])

Expected behavior

Both tests in the example should pass

Additional context

The reason for this issue is explained here:

Object types have an implicit index signature, but interfaces don't (for safety reasons), so they don't extend an index type.

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