refactor: restore SatisfiesExpression

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-04-01 14:04:48 +09:00
parent 5667f0f839
commit f246699f38
No known key found for this signature in database
GPG key ID: 3E87B98A3F6BAB99
7 changed files with 9 additions and 11 deletions

View file

@ -15,7 +15,7 @@
As this is part of Chart.js's API it makes sense to disable the check here. As this is part of Chart.js's API it makes sense to disable the check here.
*/ */
import { onMounted, ref, shallowRef, watch, PropType } from 'vue'; import { onMounted, ref, shallowRef, watch, PropType } from 'vue';
import { Chart } from 'chart.js'; import { Chart, type ChartDataset } from 'chart.js';
import gradient from 'chartjs-plugin-gradient'; import gradient from 'chartjs-plugin-gradient';
import * as os from '@/os'; import * as os from '@/os';
import { defaultStore } from '@/store'; import { defaultStore } from '@/store';
@ -165,7 +165,7 @@ const render = () => {
fill: x.type === 'area', fill: x.type === 'area',
clip: 8, clip: 8,
hidden: !!x.hidden, hidden: !!x.hidden,
})), } satisfies ChartDataset)),
}, },
options: { options: {
aspectRatio: props.aspectRatio || 2.5, aspectRatio: props.aspectRatio || 2.5,

View file

@ -9,7 +9,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { Chart } from 'chart.js'; import { Chart, type ChartDataset } from 'chart.js';
import gradient from 'chartjs-plugin-gradient'; import gradient from 'chartjs-plugin-gradient';
import * as os from '@/os'; import * as os from '@/os';
import { defaultStore } from '@/store'; import { defaultStore } from '@/store';
@ -83,7 +83,7 @@ async function renderChart() {
barPercentage: 0.7, barPercentage: 0.7,
categoryPercentage: 0.5, categoryPercentage: 0.5,
fill: true, fill: true,
}], }] satisfies ChartDataset[],
}, },
options: { options: {
aspectRatio: 2.5, aspectRatio: 2.5,

View file

@ -16,7 +16,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { Chart } from 'chart.js'; import { Chart, type ChartDataset } from 'chart.js';
import gradient from 'chartjs-plugin-gradient'; import gradient from 'chartjs-plugin-gradient';
import * as os from '@/os'; import * as os from '@/os';
import { useChartTooltip } from '@/scripts/use-chart-tooltip'; import { useChartTooltip } from '@/scripts/use-chart-tooltip';
@ -190,7 +190,7 @@ onMounted(async () => {
categoryPercentage: 0.9, categoryPercentage: 0.9,
fill: true, fill: true,
clip: 8, clip: 8,
}], }] satisfies ChartDataset[],
}, },
options: { options: {
aspectRatio: 5, aspectRatio: 5,

View file

@ -77,7 +77,7 @@ async function renderChart() {
barPercentage: 0.7, barPercentage: 0.7,
categoryPercentage: 0.7, categoryPercentage: 0.7,
fill: true, fill: true,
}, extra); } satisfies ChartDataset, extra);
} }
chartInstance = new Chart(chartEl, { chartInstance = new Chart(chartEl, {

View file

@ -76,7 +76,7 @@ async function renderChart() {
borderRadius: 4, borderRadius: 4,
barPercentage: 0.9, barPercentage: 0.9,
fill: true, fill: true,
}, extra); } satisfies ChartDataset, extra);
} }
chartInstance = new Chart(chartEl, { chartInstance = new Chart(chartEl, {

View file

@ -77,7 +77,7 @@ async function renderChart() {
barPercentage: 0.7, barPercentage: 0.7,
categoryPercentage: 0.7, categoryPercentage: 0.7,
fill: true, fill: true,
}, extra); } satisfies ChartDataset, extra);
} }
chartInstance = new Chart(chartEl, { chartInstance = new Chart(chartEl, {

View file

@ -443,13 +443,11 @@ export const ACHIEVEMENT_BADGES = {
bg: 'linear-gradient(0deg, rgb(144, 224, 255), rgb(255, 168, 252))', bg: 'linear-gradient(0deg, rgb(144, 224, 255), rgb(255, 168, 252))',
frame: 'bronze', frame: 'bronze',
}, },
/*
} as const satisfies Record<typeof ACHIEVEMENT_TYPES[number], { } as const satisfies Record<typeof ACHIEVEMENT_TYPES[number], {
img: string; img: string;
bg: string | null; bg: string | null;
frame: 'bronze' | 'silver' | 'gold' | 'platinum'; frame: 'bronze' | 'silver' | 'gold' | 'platinum';
}>; }>;
*/ } as const;
export const claimedAchievements: typeof ACHIEVEMENT_TYPES[number][] = ($i && $i.achievements) ? $i.achievements.map(x => x.name) : []; export const claimedAchievements: typeof ACHIEVEMENT_TYPES[number][] = ($i && $i.achievements) ? $i.achievements.map(x => x.name) : [];