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

MapOf issue with undefined value #1906

Closed
jdeniau opened this issue Jun 16, 2022 · 1 comment
Closed

MapOf issue with undefined value #1906

jdeniau opened this issue Jun 16, 2022 · 1 comment

Comments

@jdeniau
Copy link
Member

jdeniau commented Jun 16, 2022

Memo for myself :

const i: MapOf<{ foo?: string }> = Map({
      foo: 'foo',
    });

triggers an error

Type 'MapOf<{ foo: string; }>' is not assignable to type 'MapOf<{ foo?: string | undefined; }>'.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.ts(2322)

In fact as string object is more specific than string | undefined, it should be valid.

It seems that the comparison is "swapped"

@jdeniau jdeniau changed the title ObjectLikeMap issue with undefined value MapOf issue with undefined value Feb 20, 2023
@jdeniau
Copy link
Member Author

jdeniau commented Aug 28, 2023

Fixed by #1932 and #1958

@jdeniau jdeniau closed this as completed Aug 28, 2023
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