fix: update types

This commit is contained in:
Nate Moore 2023-08-09 10:01:02 -04:00
parent 8ff81c7e20
commit e5aaea52b3

View file

@ -14,7 +14,10 @@ declare const Astro: {
{ {
// @ts-ignore // @ts-ignore
(self.Astro || (self.Astro = {})).assign = (script,value) => Object.assign(script.parentElement,value); (self.Astro || (self.Astro = {})).assign = (script,value) => {
Object.assign(script.parentElement,value);
script.remove();
};
if (!customElements.get('astro-island')) { if (!customElements.get('astro-island')) {
customElements.define( customElements.define(
@ -28,6 +31,7 @@ declare const Astro: {
public rendererUrl = ''; public rendererUrl = '';
public componentUrl = ''; public componentUrl = '';
public componentExport = 'default'; public componentExport = 'default';
public beforeHydrationUrl = '';
connectedCallback() { connectedCallback() {
if (!this.hasAttribute('await-children') || this.firstChild) { if (!this.hasAttribute('await-children') || this.firstChild) {
@ -44,11 +48,12 @@ declare const Astro: {
} }
} }
async childrenConnectedCallback() { async childrenConnectedCallback() {
let { beforeHydrationUrl } = this as any; let { beforeHydrationUrl } = this;
if (beforeHydrationUrl) { if (beforeHydrationUrl) {
await import(beforeHydrationUrl); await import(beforeHydrationUrl);
} }
this.start(); this.start();
this.removeAttribute('await-children');
} }
start() { start() {
const { opts } = this; const { opts } = this;