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

TypeScript: ol/control/Control setMap does not allow for undefined #12758

Closed
jumpinjackie opened this issue Sep 15, 2021 · 0 comments · Fixed by #12759
Closed

TypeScript: ol/control/Control setMap does not allow for undefined #12758

jumpinjackie opened this issue Sep 15, 2021 · 0 comments · Fixed by #12759
Labels

Comments

@jumpinjackie
Copy link
Contributor

Describe the bug
The setMap method of the Control class does not allow passing in undefined in TypeScript.

If you look at the underlying code in this method, it is clear that this.map_ being set/get can be undefined

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to pass undefined to setMap of any Control instance.

Expected behavior

It should be allowed, instead the TypeScript compiler will error: Argument of type 'undefined' is not assignable to parameter of type 'PluggableMap'

jumpinjackie added a commit to jumpinjackie/openlayers that referenced this issue Sep 15, 2021
…onsequently the return type of getMap() now can also be undefined as well.
ahocevar added a commit that referenced this issue Sep 17, 2021
#12758: Allow undefined to be passed to control setMap(). Also fix type of getMap()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant