Skip to content

Commit

Permalink
Make source prop of Layer optional (#2200)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress authored Jun 14, 2023
1 parent e06086b commit 288f8df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 288f8df

Please sign in to comment.