os apiwithdialog better types

This commit is contained in:
kakkokari-gtyih 2024-10-16 19:16:39 +09:00
parent 5f98a810a9
commit f6670da3f0
8 changed files with 444 additions and 2495 deletions

View file

@ -52,7 +52,7 @@ watch(name, () => {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
name: name.value || null,
}, undefined, {
'0b3f9f6a-2f4d-4b1f-9fb4-49d3a2fd7191': {
'YOUR_NAME_CONTAINS_PROHIBITED_WORDS': {
title: i18n.ts.yourNameContainsProhibitedWords,
text: i18n.ts.yourNameContainsProhibitedWordsDescription,
},

View file

@ -32,7 +32,7 @@ import { focusParent } from '@/scripts/focus.js';
export const openingWindowsCount = ref(0);
type CustomErrorDef<T> = {
[key in T extends { id: infer C; } ? C extends string ? C : string : string]?: { title?: string; text: string; };
[key in T extends { code: infer C; } ? C extends string ? Exclude<C, keyof Misskey.entities.CommonErrorTypes> : string : string]?: { title?: string; text: string; };
};
export function apiWithDialog<

View file

@ -207,7 +207,7 @@ function save() {
isBot: !!profile.isBot,
isCat: !!profile.isCat,
}, undefined, {
'0b3f9f6a-2f4d-4b1f-9fb4-49d3a2fd7191': {
'YOUR_NAME_CONTAINS_PROHIBITED_WORDS': {
title: i18n.ts.yourNameContainsProhibitedWords,
text: i18n.ts.yourNameContainsProhibitedWordsDescription,
},

View file

@ -246,7 +246,7 @@ export function getNoteMenu(props: {
os.apiWithDialog(pin ? 'i/pin' : 'i/unpin', {
noteId: appearNote.id,
}, undefined, {
'72dab508-c64d-498f-8740-a8eec1ba385a': {
'PIN_LIMIT_EXCEEDED': {
text: i18n.ts.pinLimitExceeded,
},
});