Fix typing errors

This commit is contained in:
thepaperpilot 2022-07-10 02:20:51 -05:00
parent f90e226fe1
commit 717f13ebe0
2 changed files with 5 additions and 3 deletions

View file

@ -46,7 +46,7 @@ export default defineComponent({
backgroundAlpha: 0 backgroundAlpha: 0
}); });
resizeListener.value?.appendChild(app.value.view); resizeListener.value?.appendChild(app.value.view);
props.onInit(app.value as Application); props.onInit?.(app.value as Application);
} }
updateBounds(); updateBounds();
if (props.onHotReload) { if (props.onHotReload) {

View file

@ -35,7 +35,7 @@ export interface FeatureNode {
* An injection key that a {@link Context} will use to provide a function that registers a {@link FeatureNode} with the given id and HTML element. * An injection key that a {@link Context} will use to provide a function that registers a {@link FeatureNode} with the given id and HTML element.
*/ */
export const RegisterNodeInjectionKey: InjectionKey<(id: string, element: HTMLElement) => void> = export const RegisterNodeInjectionKey: InjectionKey<(id: string, element: HTMLElement) => void> =
Symbol("RegisterNode"); Symbol("RegisterNode");
/** /**
* An injection key that a {@link Context} will use to provide a function that unregisters a {@link FeatureNode} with the given id. * An injection key that a {@link Context} will use to provide a function that unregisters a {@link FeatureNode} with the given id.
*/ */
@ -196,7 +196,9 @@ export function createLayer<T extends LayerOptions>(
const layer = {} as T & Partial<BaseLayer>; const layer = {} as T & Partial<BaseLayer>;
const emitter = (layer.emitter = createNanoEvents<LayerEvents>()); const emitter = (layer.emitter = createNanoEvents<LayerEvents>());
layer.on = emitter.on.bind(emitter); layer.on = emitter.on.bind(emitter);
layer.emit = emitter.emit.bind(emitter); layer.emit = emitter.emit.bind(emitter) as <K extends keyof LayerEvents>(
...args: [K, ...Parameters<LayerEvents[K]>]
) => void;
layer.nodes = ref({}); layer.nodes = ref({});
layer.id = id; layer.id = id;