fix(ts): cleaned legacy typechecking warning

This commit is contained in:
Corentin Thomasset 2023-04-23 16:12:11 +02:00 committed by Corentin THOMASSET
parent 362f2fa280
commit e88c1d5f2c
7 changed files with 20 additions and 17 deletions

View file

@ -27,5 +27,8 @@ jobs:
- name: Run unit test
run: pnpm test
- name: Type check
run: pnpm typecheck
- name: Build the app
run: pnpm build

View file

@ -81,7 +81,7 @@ function onFocus() {
<n-auto-complete
v-model:value="queryString"
:options="options"
:on-select="(value) => onSelect(String(value))"
:on-select="(value: string | number) => onSelect(String(value))"
:render-label="renderOption"
:default-value="'aa'"
:get-show="() => displayDropDown"

View file

@ -1,8 +1,8 @@
import { useClipboard, type MaybeRef } from '@vueuse/core';
import { useClipboard, type MaybeRef, get } from '@vueuse/core';
import { useMessage } from 'naive-ui';
export function useCopy({ source, text = 'Copied to the clipboard' }: { source: MaybeRef<string>; text?: string }) {
const { copy } = useClipboard({ source });
export function useCopy({ source, text = 'Copied to the clipboard' }: { source: MaybeRef<unknown>; text?: string }) {
const { copy } = useClipboard({ source: computed(() => String(get(source))) });
const message = useMessage();
return {

View file

@ -26,7 +26,7 @@ function useQueryParam<T>({ name, defaultValue }: { name: string; defaultValue:
return computed<T>({
get() {
return transformer.fromQuery(proxy.value) as T;
return transformer.fromQuery(proxy.value) as unknown as T;
},
set(value) {
proxy.value = transformer.toQuery(value as never);

View file

@ -9,7 +9,7 @@ function sortObjectKeys<T>(obj: T): T {
}
if (Array.isArray(obj)) {
return obj.map(sortObjectKeys) as T;
return obj.map(sortObjectKeys) as unknown as T;
}
return Object.keys(obj)

View file

@ -6,7 +6,7 @@ export type UserAgentResultSection = {
icon?: Component;
content: {
label: string;
getValue: (blocks: UAParser.IResult) => string | undefined;
getValue: (blocks?: UAParser.IResult) => string | undefined;
undefinedFallback?: string;
}[];
};

View file

@ -40,12 +40,12 @@ const sections: UserAgentResultSection[] = [
content: [
{
label: 'Name',
getValue: (block) => block.browser.name,
getValue: (block) => block?.browser.name,
undefinedFallback: 'No browser name available',
},
{
label: 'Version',
getValue: (block) => block.browser.version,
getValue: (block) => block?.browser.version,
undefinedFallback: 'No browser version available',
},
],
@ -56,12 +56,12 @@ const sections: UserAgentResultSection[] = [
content: [
{
label: 'Name',
getValue: (block) => block.engine.name,
getValue: (block) => block?.engine.name,
undefinedFallback: 'No engine name available',
},
{
label: 'Version',
getValue: (block) => block.engine.version,
getValue: (block) => block?.engine.version,
undefinedFallback: 'No engine version available',
},
],
@ -72,12 +72,12 @@ const sections: UserAgentResultSection[] = [
content: [
{
label: 'Name',
getValue: (block) => block.os.name,
getValue: (block) => block?.os.name,
undefinedFallback: 'No OS name available',
},
{
label: 'Version',
getValue: (block) => block.os.version,
getValue: (block) => block?.os.version,
undefinedFallback: 'No OS version available',
},
],
@ -88,17 +88,17 @@ const sections: UserAgentResultSection[] = [
content: [
{
label: 'Model',
getValue: (block) => block.device.model,
getValue: (block) => block?.device.model,
undefinedFallback: 'No device model available',
},
{
label: 'Type',
getValue: (block) => block.device.type,
getValue: (block) => block?.device.type,
undefinedFallback: 'No device type available',
},
{
label: 'Vendor',
getValue: (block) => block.device.vendor,
getValue: (block) => block?.device.vendor,
undefinedFallback: 'No device vendor available',
},
],
@ -109,7 +109,7 @@ const sections: UserAgentResultSection[] = [
content: [
{
label: 'Architecture',
getValue: (block) => block.cpu.architecture,
getValue: (block) => block?.cpu.architecture,
undefinedFallback: 'No CPU architecture available',
},
],