mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 18:20:30 +08:00
Make all Svelte events type-safe
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<script lang="ts">
|
||||
<script lang="ts" strictEvents>
|
||||
import { onMount, createEventDispatcher } from "svelte";
|
||||
import { setRecords } from "./resolver";
|
||||
import type { EnsRecord } from "./resolver";
|
||||
@@ -15,7 +15,7 @@
|
||||
export let records: EnsRecord[];
|
||||
export let registration: Registration;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
const dispatch = createEventDispatcher<{ close: never }>();
|
||||
|
||||
let state: State = {
|
||||
status: Status.Failed,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import type { EnsRecord } from "./resolver";
|
||||
import type { Field } from "@app/Form.svelte";
|
||||
import type { Field, RegistrationRecord } from "@app/Form.svelte";
|
||||
import type { Registration } from "./registrar";
|
||||
import type { Wallet } from "@app/wallet";
|
||||
import type { ethers } from "ethers";
|
||||
@@ -169,16 +169,12 @@
|
||||
});
|
||||
});
|
||||
|
||||
const onSave = async (event: {
|
||||
detail: { name: string; value: string | null }[];
|
||||
}) => {
|
||||
const onSave = async (event: { detail: RegistrationRecord[] }) => {
|
||||
assert(state.status === Status.Found, "registration must be found");
|
||||
|
||||
updateRecords = event.detail
|
||||
.filter(f => f.value !== null)
|
||||
.map(f => {
|
||||
return { name: f.name, value: f.value as string };
|
||||
});
|
||||
updateRecords = event.detail.map(f => {
|
||||
return { name: f.name, value: f.value };
|
||||
});
|
||||
};
|
||||
|
||||
$: if (retry && state.status === Status.NotFound && retries > 0) {
|
||||
|
||||
Reference in New Issue
Block a user