How to configure ESLint to accept types when using allowSyntheticDefaultImports
?
In my code I have block of code like this:
type PromiseType = Promise<void> | Promise<FirebaseFirestore.WriteResult[]>
and the VSCode accept this, without any extra import.
But, when I run eslint I got:
35:46 error 'FirebaseFirestore' is not defined no-undef
And when I build the project I got:
src/index.ts:83:22 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type 'PromiseType[]' is not assignable to parameter of type 'Iterable<void | PromiseLike<void>>'.
The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
Type 'IteratorResult<PromiseType, any>' is not assignable to type 'IteratorResult<void | PromiseLike<void>, any>'.
Type 'IteratorYieldResult<PromiseType>' is not assignable to type 'IteratorResult<void | PromiseLike<void>, any>'.
Type 'IteratorYieldResult<PromiseType>' is not assignable to type 'IteratorYieldResult<void | PromiseLike<void>>'.
Type 'PromiseType' is not assignable to type 'void | PromiseLike<void>'.
Type 'Promise<WriteResult[]>' is not assignable to type 'void | PromiseLike<void>'.
Type 'Promise<WriteResult[]>' is not assignable to type 'PromiseLike<void>'.
Types of property 'then' are incompatible.
Type '<TResult1 = WriteResult[], TResult2 = never>(onfulfilled?: ((value: WriteResult[]) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | ... 1 more ... | undefined) => Promise<...>' is not assignable to type '<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => PromiseLike<...>'.
Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
Type 'WriteResult[]' is not assignable to type 'void'.
83 return Promise.all(promises)
~~~~~~~~
node_modules/typescript/lib/lib.es2015.iterable.d.ts:226:5
226 all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The last overload is declared here.
question from:
https://stackoverflow.com/questions/65921266/eslint-with-allowsyntheticdefaultimports 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…