fix: remove useless @ts-ignore and migrate to @ts-expect-error (#293)

* fix: vite primevue/treenode import error

* refactor: remove useless @ts-ignore and replace with @ts-expect-error

* build(tsconfig): enable incremental to speed up secondary time type check
This commit is contained in:
余腾靖
2024-08-04 19:22:24 +08:00
committed by GitHub
parent 7e669b0f68
commit b5a919e8b2
31 changed files with 135 additions and 202 deletions

View File

@@ -206,7 +206,6 @@ export class EzWidget {
}
get isConvertedToInput() {
// @ts-ignore : this type is valid for converted widgets
return this.widget.type === 'converted-widget'
}
@@ -297,12 +296,12 @@ export class EzNode {
// * @returns { Record<string, type extends "inputs" ? EzInput : EzOutput> & (type extends "inputs" ? EzInput [] : EzOutput[]) }
// */
// #getSlotItems(type) {
// // @ts-ignore : these items are correct
// // @ts-expect-error : these items are correct
// return (this.node[type] ?? []).reduce((p, s, i) => {
// if (s.name in p) {
// throw new Error(`Unable to store input ${s.name} on array as name conflicts.`);
// }
// // @ts-ignore
// // @ts-expect-error
// p.push((p[s.name] = new (type === "inputs" ? EzInput : EzOutput)(this, i, s)));
// return p;
// }, Object.assign([], { $: this }));
@@ -320,24 +319,20 @@ export class EzNode {
typeof nodeProperty === 'function'
? nodeProperty()
: this.node[nodeProperty]
// @ts-ignore
return (items ?? []).reduce(
(p, s, i) => {
if (!s) return p
const name = s[nameProperty]
const item = new ctor(this, i, s)
// @ts-ignore
p.push(item)
if (name) {
// @ts-ignore
if (name in p) {
throw new Error(
`Unable to store ${nodeProperty} ${name} on array as name conflicts.`
)
}
}
// @ts-ignore
p[name] = item
return p
},
@@ -404,7 +399,7 @@ export class EzGraph {
this.app.graph.clear()
setTimeout(async () => {
await this.app.loadGraphData(graph)
// @ts-ignore
// @ts-expect-error
r()
}, 10)
})
@@ -419,7 +414,6 @@ export class EzGraph {
* }>}> }
*/
toPrompt() {
// @ts-ignore
return this.app.graphToPrompt()
}
}
@@ -452,7 +446,6 @@ export const Ez = {
app.graph.clear()
}
// @ts-ignore : this proxy handles utility methods & node creation
const factory = new Proxy(
{},
{

View File

@@ -50,7 +50,6 @@ export async function start(config: StartConfig = {}): Promise<StartResult> {
app.canvasContainer.prepend(canvasEl)
await app.setup(canvasEl)
// @ts-ignore
return { ...Ez.graph(app, LiteGraph, LGraphCanvas), app }
}
@@ -92,11 +91,8 @@ export function makeNodeDef(name, input, output = {}) {
}, {})
}
for (const k in output) {
// @ts-ignore
nodeDef.output.push(output[k])
// @ts-ignore
nodeDef.output_name.push(k)
// @ts-ignore
nodeDef.output_is_list.push(false)
}

View File

@@ -67,11 +67,9 @@ export function mockApi(config: APIConfig = {}) {
apiURL: jest.fn((x) => 'src/' + x),
fileURL: jest.fn((x) => 'src/' + x),
createUser: jest.fn((username) => {
// @ts-ignore
if (username in userConfig.users) {
return { status: 400, json: () => 'Duplicate' }
}
// @ts-ignore
userConfig.users[username + '!'] = username
return { status: 200, json: () => username + '!' }
}),