mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-25 16:02:50 +00:00
Make source prop of Layer optional (#2200)
This commit is contained in:
parent
e06086bda0
commit
288f8df4d3
@ -8,8 +8,9 @@ import type {MapInstance, AnyLayer, CustomLayerInterface} from '../types';
|
||||
// Omiting property from a union type, see
|
||||
// https://github.com/microsoft/TypeScript/issues/39556#issuecomment-656925230
|
||||
type OptionalId<T> = T extends {id: string} ? Omit<T, 'id'> & {id?: string} : T;
|
||||
type OptionalSource<T> = T extends {source: string} ? Omit<T, 'source'> & {source?: string} : T;
|
||||
|
||||
export type LayerProps = OptionalId<AnyLayer | CustomLayerInterface> & {
|
||||
export type LayerProps = OptionalSource<OptionalId<AnyLayer | CustomLayerInterface>> & {
|
||||
/** If set, the layer will be inserted before the specified layer */
|
||||
beforeId?: string;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user