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

@ -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;