The DrawEvents.Created layer variable is not of type Layer. As noted by
the in-code documentation, the Leaflet.Draw.DrawEvents.Created.layer
variable is one of Leaflet's vector shapes or a markers.
c6af99b761/src/Leaflet.Draw.Event.js (L31)
The L.Draw.Event.CREATED event is only fired by Draw.Feature in the
_fireCreatedEvent method.
Draw.Feature bequeaths _fireCreatedEvent to it's subclasses Draw.Marker,
Draw.Polyline, and Draw.SimpleShape, which in turn bequeath the method
to Draw.Circle, Draw.Rectangle (both from Draw.SimpleShape),
Draw.CircleMarker (from Draw.Marker), and Draw.Polygon (from
Draw.Polyline).
Draw.Circle, Draw.CircleMarker, Draw.Marker, Draw.Rectangle and
Draw.Polyline override the _fireCreatedEvent to pass instances of their
respective vector classes to _fireCreatedEvent, meaning that the layer
variable is not of type Layer, but instead one of the vector or marker
classes. For example, Draw.Circle passes L.Circle to
L.Draw.Feature.prototype._fireCreatedEvent as the argument to the
`layer` parameter.
Note that Draw.Polygon inherits Draw.Polyline's behavior without
changes, but changes the vector class via the Poly class variable.
This matches the documentation better where most of the Leaflet Draw documentation encourages to use explicit false options (rather than null), as seen in the type comments already in the typing file.