-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add definitely-type OpenLayers typings and use to fix type mismatches #244
Conversation
6812c29
to
c2a108a
Compare
|
||
constructor(private elementRef: ElementRef) {} | ||
|
||
ngOnInit() { | ||
this.html = this.elementRef.nativeElement.innerHTML; | ||
this.instance = new Attribution(this); | ||
this.label = this.elementRef.nativeElement.innerHTML; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell, this component is only used in conjunction with AttributionsComponent
to call setAttributions()
, which takes an AttributionLike
(which is a type alias for string | string[] | (FrameState): (string|Array<string>)
), so using the Attribution
control here was incorrect.
As such, I modified this and AttributionsComponent
to work with string
s instead.
@@ -11,9 +11,7 @@ import { Extent } from 'ol/extent'; | |||
<ng-content></ng-content> | |||
`, | |||
}) | |||
export class LayerImageComponent extends LayerComponent implements OnInit, OnChanges { | |||
public source: Image; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source
field here and in several other layers was seemingly unused, and conflicted with the source
field in the layer Options
interface, so I removed them.
165630f
to
54c24f7
Compare
@@ -18,6 +17,8 @@ export class DragBoxInteractionComponent implements OnInit, OnDestroy { | |||
@Input() | |||
boxEndCondition: EndCondition; | |||
|
|||
onBoxEnd = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to 5.3.3
docs onBoxEnd
is not optional (https://openlayers.org/en/v5.3.0/apidoc/module-ol_interaction_DragBox.html), but this is actually a typo in the documentation (openlayers/openlayers#9042). Unfortunately the typings on DefinitelyTyped also have this typo.
54c24f7
to
ee29464
Compare
ee29464
to
e324643
Compare
Superseded by #247 |
Mostly this is effectively non-functional changes to note which interfaces each component implements, with a few tweaks where the typings were incorrect, and also fixes a few incorrect imports that didn't work at all (most notably for me, the
SourceVectorTileComponent
had incorrect imports, which is what led me to type check this project).This should fix #235