mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 06:55:06 -04:00
fix(ts): cleaned legacy typechecking warning
This commit is contained in:
parent
362f2fa280
commit
e88c1d5f2c
7 changed files with 20 additions and 17 deletions
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
@ -27,5 +27,8 @@ jobs:
|
||||||
- name: Run unit test
|
- name: Run unit test
|
||||||
run: pnpm test
|
run: pnpm test
|
||||||
|
|
||||||
|
- name: Type check
|
||||||
|
run: pnpm typecheck
|
||||||
|
|
||||||
- name: Build the app
|
- name: Build the app
|
||||||
run: pnpm build
|
run: pnpm build
|
||||||
|
|
|
@ -81,7 +81,7 @@ function onFocus() {
|
||||||
<n-auto-complete
|
<n-auto-complete
|
||||||
v-model:value="queryString"
|
v-model:value="queryString"
|
||||||
:options="options"
|
:options="options"
|
||||||
:on-select="(value) => onSelect(String(value))"
|
:on-select="(value: string | number) => onSelect(String(value))"
|
||||||
:render-label="renderOption"
|
:render-label="renderOption"
|
||||||
:default-value="'aa'"
|
:default-value="'aa'"
|
||||||
:get-show="() => displayDropDown"
|
:get-show="() => displayDropDown"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { useClipboard, type MaybeRef } from '@vueuse/core';
|
import { useClipboard, type MaybeRef, get } from '@vueuse/core';
|
||||||
import { useMessage } from 'naive-ui';
|
import { useMessage } from 'naive-ui';
|
||||||
|
|
||||||
export function useCopy({ source, text = 'Copied to the clipboard' }: { source: MaybeRef<string>; text?: string }) {
|
export function useCopy({ source, text = 'Copied to the clipboard' }: { source: MaybeRef<unknown>; text?: string }) {
|
||||||
const { copy } = useClipboard({ source });
|
const { copy } = useClipboard({ source: computed(() => String(get(source))) });
|
||||||
const message = useMessage();
|
const message = useMessage();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -26,7 +26,7 @@ function useQueryParam<T>({ name, defaultValue }: { name: string; defaultValue:
|
||||||
|
|
||||||
return computed<T>({
|
return computed<T>({
|
||||||
get() {
|
get() {
|
||||||
return transformer.fromQuery(proxy.value) as T;
|
return transformer.fromQuery(proxy.value) as unknown as T;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
proxy.value = transformer.toQuery(value as never);
|
proxy.value = transformer.toQuery(value as never);
|
||||||
|
|
|
@ -9,7 +9,7 @@ function sortObjectKeys<T>(obj: T): T {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(obj)) {
|
if (Array.isArray(obj)) {
|
||||||
return obj.map(sortObjectKeys) as T;
|
return obj.map(sortObjectKeys) as unknown as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.keys(obj)
|
return Object.keys(obj)
|
||||||
|
|
|
@ -6,7 +6,7 @@ export type UserAgentResultSection = {
|
||||||
icon?: Component;
|
icon?: Component;
|
||||||
content: {
|
content: {
|
||||||
label: string;
|
label: string;
|
||||||
getValue: (blocks: UAParser.IResult) => string | undefined;
|
getValue: (blocks?: UAParser.IResult) => string | undefined;
|
||||||
undefinedFallback?: string;
|
undefinedFallback?: string;
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,12 +40,12 @@ const sections: UserAgentResultSection[] = [
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
getValue: (block) => block.browser.name,
|
getValue: (block) => block?.browser.name,
|
||||||
undefinedFallback: 'No browser name available',
|
undefinedFallback: 'No browser name available',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Version',
|
label: 'Version',
|
||||||
getValue: (block) => block.browser.version,
|
getValue: (block) => block?.browser.version,
|
||||||
undefinedFallback: 'No browser version available',
|
undefinedFallback: 'No browser version available',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -56,12 +56,12 @@ const sections: UserAgentResultSection[] = [
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
getValue: (block) => block.engine.name,
|
getValue: (block) => block?.engine.name,
|
||||||
undefinedFallback: 'No engine name available',
|
undefinedFallback: 'No engine name available',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Version',
|
label: 'Version',
|
||||||
getValue: (block) => block.engine.version,
|
getValue: (block) => block?.engine.version,
|
||||||
undefinedFallback: 'No engine version available',
|
undefinedFallback: 'No engine version available',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -72,12 +72,12 @@ const sections: UserAgentResultSection[] = [
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
getValue: (block) => block.os.name,
|
getValue: (block) => block?.os.name,
|
||||||
undefinedFallback: 'No OS name available',
|
undefinedFallback: 'No OS name available',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Version',
|
label: 'Version',
|
||||||
getValue: (block) => block.os.version,
|
getValue: (block) => block?.os.version,
|
||||||
undefinedFallback: 'No OS version available',
|
undefinedFallback: 'No OS version available',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -88,17 +88,17 @@ const sections: UserAgentResultSection[] = [
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
label: 'Model',
|
label: 'Model',
|
||||||
getValue: (block) => block.device.model,
|
getValue: (block) => block?.device.model,
|
||||||
undefinedFallback: 'No device model available',
|
undefinedFallback: 'No device model available',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
getValue: (block) => block.device.type,
|
getValue: (block) => block?.device.type,
|
||||||
undefinedFallback: 'No device type available',
|
undefinedFallback: 'No device type available',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Vendor',
|
label: 'Vendor',
|
||||||
getValue: (block) => block.device.vendor,
|
getValue: (block) => block?.device.vendor,
|
||||||
undefinedFallback: 'No device vendor available',
|
undefinedFallback: 'No device vendor available',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -109,7 +109,7 @@ const sections: UserAgentResultSection[] = [
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
label: 'Architecture',
|
label: 'Architecture',
|
||||||
getValue: (block) => block.cpu.architecture,
|
getValue: (block) => block?.cpu.architecture,
|
||||||
undefinedFallback: 'No CPU architecture available',
|
undefinedFallback: 'No CPU architecture available',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue