const opts = {
suggestedName: 'data',
types: [
{
description: 'NewCSV',
accept: { 'text/csv': ['.csv'] },
},
],
};
const handle = await (window).showSaveFilePicker(opts);
Run Code Online (Sandbox Code Playgroud)
现在我有类型错误Property 'showSaveFilePicker' does not exit on type 'Window & typeof globalThis',提供 type as any解决了类型错误的问题。
const handle = await (<any>window).showSaveFilePicker(opts);
Run Code Online (Sandbox Code Playgroud)
但它仍然会显示 eslint 错误Unsafe call of an anytyped value。所以我知道的唯一解决方案是禁用该文件的 eslint。有没有其他方法可以避免类型错误和 eslint 错误?