From 288f8df4d380ada23db3ff6dd407c9b40bba78fc Mon Sep 17 00:00:00 2001 From: Xiaoji Chen Date: Wed, 14 Jun 2023 09:56:43 -0700 Subject: [PATCH] Make source prop of Layer optional (#2200) --- src/components/layer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/layer.ts b/src/components/layer.ts index 115b21d9..a1e53dd0 100644 --- a/src/components/layer.ts +++ b/src/components/layer.ts @@ -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 extends {id: string} ? Omit & {id?: string} : T; +type OptionalSource = T extends {source: string} ? Omit & {source?: string} : T; -export type LayerProps = OptionalId & { +export type LayerProps = OptionalSource> & { /** If set, the layer will be inserted before the specified layer */ beforeId?: string; };