Fix typescript errors
This commit is contained in:
parent
4e445412bb
commit
062d4bbdcb
|
@ -14,8 +14,9 @@ import type {
|
|||
ProjectType,
|
||||
UploadedFileInfo,
|
||||
} from "~/utils/types";
|
||||
import { EditToolbar } from "#components";
|
||||
import { type EditToolbar } from "#components";
|
||||
|
||||
// @ts-ignore
|
||||
export type ToolbarRef = Ref<InstanceType<typeof EditToolbar>>|ComputedRef<InstanceType<typeof EditToolbar>>;
|
||||
export type LockEditOptions<T> = {
|
||||
toolbarRef?: ToolbarRef;
|
||||
|
|
|
@ -154,7 +154,7 @@ const availablePredefinedFields = computed<FieldDefinitionWithId[]>(() => {
|
|||
});
|
||||
|
||||
const currentField = ref<FieldDefinitionWithId|null>(null);
|
||||
const allFieldsPlaceholder = { id: null } as any as FieldDefinitionWithId;
|
||||
const allFieldsPlaceholder = { id: null } as unknown as FieldDefinitionWithId;
|
||||
const currentFieldSelection = computed({
|
||||
get: () => currentField.value ? [currentField.value] : [allFieldsPlaceholder],
|
||||
set: (val) => {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
:upload-file="uploadFile"
|
||||
:rewrite-file-url="rewriteFileUrl"
|
||||
:readonly="readonly"
|
||||
:initial-language="template!.translations.find(tr => tr.id === route.query?.translation_id)?.language || route.query?.language"
|
||||
:initial-language="template!.translations.find(tr => tr.id === route.query?.translation_id)?.language || (route.query?.language as string|undefined)"
|
||||
:history="true"
|
||||
>
|
||||
<template #toolbar-context-menu>
|
||||
|
|
|
@ -95,7 +95,7 @@ const _fetchState = useLazyAsyncData(async () => {
|
|||
return value && !(Array.isArray(value) && value.length === 0) && templateStore.fieldDefinitionList.some(d => d.id === key);
|
||||
})),
|
||||
}],
|
||||
} as any as FindingTemplate;
|
||||
} as unknown as FindingTemplate;
|
||||
|
||||
return {
|
||||
project,
|
||||
|
|
|
@ -34,7 +34,7 @@ const template = ref<FindingTemplate>({
|
|||
title: 'TODO: New Template Title',
|
||||
},
|
||||
}],
|
||||
} as any as FindingTemplate)
|
||||
} as unknown as FindingTemplate)
|
||||
|
||||
async function performCreate() {
|
||||
const obj = await templateStore.create(template.value);
|
||||
|
|
|
@ -88,7 +88,7 @@ export const useProjectStore = defineStore('project', {
|
|||
ensureExists(projectId: string, initialStoreData?: Object) {
|
||||
if (!(projectId in this.data)) {
|
||||
this.data[projectId] = {
|
||||
project: null as any as PentestProject,
|
||||
project: null as unknown as PentestProject,
|
||||
findings: [],
|
||||
sections: [],
|
||||
getByIdSync: null,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import groupBy from "lodash/groupBy";
|
||||
import sortBy from "lodash/sortBy";
|
||||
import pick from "lodash/pick";
|
||||
import type { UserNote, NoteBase } from "~/utils/types";
|
||||
import type { UserNote, NoteBase, ProjectNote } from "~/utils/types";
|
||||
|
||||
export type NoteGroup<T extends NoteBase> = {
|
||||
note: T;
|
||||
|
@ -67,6 +67,11 @@ export const useUserNotesStore = defineStore('usernotes', {
|
|||
clear() {
|
||||
this.useNotesCollab().disconnect();
|
||||
this.notesCollabState.data = { notes: {} };
|
||||
this.notesCollabState.awareness = {
|
||||
self: { path: null },
|
||||
other: {},
|
||||
clients: []
|
||||
};
|
||||
},
|
||||
async createNote(note: UserNote) {
|
||||
note = await $fetch<UserNote>(`/api/v1/pentestusers/self/notes/`, {
|
||||
|
@ -100,7 +105,7 @@ export const useUserNotesStore = defineStore('usernotes', {
|
|||
},
|
||||
useNotesCollab() {
|
||||
const collabState = this.notesCollabState;
|
||||
const collab = useCollab(collabState);
|
||||
const collab = useCollab(collabState as unknown as CollabStoreState<{ notes: {[key: string]: UserNote}}>);
|
||||
|
||||
const hasEditPermissions = computed(() => true);
|
||||
return {
|
||||
|
|
|
@ -88,7 +88,7 @@ export function makeCollabStoreState<T>(options: {
|
|||
}
|
||||
}
|
||||
|
||||
export function useCollab(storeState: CollabStoreState<any>) {
|
||||
export function useCollab<T = any>(storeState: CollabStoreState<T>) {
|
||||
const eventBusBeforeApplyRemoteTextChange = useEventBus('collab:beforeApplyRemoteTextChanges');
|
||||
|
||||
function connect() {
|
||||
|
|
|
@ -233,7 +233,7 @@ export enum ProjectTypeStatus {
|
|||
FINISHED = 'finished',
|
||||
DEPRECATED = 'deprecated',
|
||||
}
|
||||
export const ProjectTypeStatusItems = Object.freeze((ReviewStatusItems as any as {value: ProjectTypeStatus, title: string, icon: string}[]).concat([
|
||||
export const ProjectTypeStatusItems = Object.freeze((ReviewStatusItems as unknown as {value: ProjectTypeStatus, title: string, icon: string}[]).concat([
|
||||
{ value: ProjectTypeStatus.DEPRECATED, title: 'Deprecated', icon: 'mdi-close-octagon-outline' },
|
||||
]))
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ function testFindingSort({ findings, findingOrdering = [], overrideFindingOrder
|
|||
field_enum: { type: 'enum', label: 'Enum Field', choices: [{ value: 'enum1', label: 'Enum Value 1' }, { value: 'enum2', label: 'Enum Value 2' }], default: 'enum2' },
|
||||
},
|
||||
finding_ordering: findingOrdering,
|
||||
} as any as ProjectType;
|
||||
} as unknown as ProjectType;
|
||||
const sortedFindings = sortFindings({
|
||||
findings: reverse(unorderedFindings),
|
||||
projectType,
|
||||
|
@ -41,7 +41,7 @@ describe('Finding Sorting', () => {
|
|||
{ order: 1 },
|
||||
{ order: 2 },
|
||||
{ order: 3 },
|
||||
] as any as PentestFinding[],
|
||||
] as unknown as PentestFinding[],
|
||||
overrideFindingOrder: true,
|
||||
});
|
||||
});
|
||||
|
@ -52,7 +52,7 @@ describe('Finding Sorting', () => {
|
|||
{ order: 0, created: addDays(new Date(), -2).toISOString() },
|
||||
{ order: 0, created: addDays(new Date(), -1).toISOString() },
|
||||
{ order: 0, created: addDays(new Date(), -0).toISOString() },
|
||||
] as any as PentestFinding[],
|
||||
] as unknown as PentestFinding[],
|
||||
overrideFindingOrder: true,
|
||||
});
|
||||
});
|
||||
|
@ -73,7 +73,7 @@ describe('Finding Sorting', () => {
|
|||
created: new Date().toISOString(),
|
||||
order: 0,
|
||||
data: f,
|
||||
})) as any as PentestFinding[],
|
||||
})) as unknown as PentestFinding[],
|
||||
findingOrdering: config.order,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -117,8 +117,11 @@ function micromarkToAnnotatedText(text: string, events: Event[]) {
|
|||
|
||||
|
||||
export function annotatedTextParse() {
|
||||
const micromarkExtensions = this.data('micromarkExtensions') || [];
|
||||
this.parser = parser;
|
||||
// @ts-ignore
|
||||
const self = this;
|
||||
|
||||
const micromarkExtensions = self.data('micromarkExtensions') || [];
|
||||
self.parser = parser;
|
||||
|
||||
function parser(text: string) {
|
||||
const events = parseMicromarkEvents(text, {extensions: micromarkExtensions});
|
||||
|
|
|
@ -136,8 +136,11 @@ function micromarkToLezerSyntaxTree(text: string, events: Event[]) {
|
|||
|
||||
|
||||
export function lezerSyntaxTreeParse() {
|
||||
const micromarkExtensions = this.data('micromarkExtensions') || [];
|
||||
this.Parser = parser;
|
||||
// @ts-ignore
|
||||
const self = this;
|
||||
|
||||
const micromarkExtensions = self.data('micromarkExtensions') || [];
|
||||
self.Parser = parser;
|
||||
|
||||
function parser(text: string) {
|
||||
const events = parseMicromarkEvents(text, {extensions: micromarkExtensions});
|
||||
|
|
Loading…
Reference in New Issue