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

Remove | any from MapSchema values #77

Closed
JoaoMosmann opened this issue Jun 7, 2020 · 1 comment
Closed

Remove | any from MapSchema values #77

JoaoMosmann opened this issue Jun 7, 2020 · 1 comment

Comments

@JoaoMosmann
Copy link

I wonder what is the reason of the | any type for the keys of a MapSchema.
As the docs state, all values of a MapSchema should be of the same type. So there is no reason for having another type than T

[key: string]: T | any;

@endel
Copy link
Member

endel commented Jun 8, 2020

Hi @JoaoMosmann, glad to see you here again :)

As the MapSchema defines methods and has a list of properties attached to itself, the T | any is supposed to hold both the methods and the properties attached to it. The problem is that any is eager and everything is then treated as any.

I'm working on a fix along with a bunch of other issues here #75

Here's how the new version will look like so far:

protected $items: Map<string, V> = new Map<string, V>();

@endel endel closed this as completed Jun 8, 2020
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

2 participants