TypeScript errors in Plain English

TypeScript Error Translator

Error #2

Type '{ <R = any>(options: FirstDocumentMutationOptions): Observable<SanityDocument<R>>; <R = any>(options: AllDocumentsMutationOptions): Observable<...>; (options: FirstDocumentIdMutationOptions): Observable<...>; (options: AllDocumentIdsMutationOptions): Observable<...>; <R = any>(options?: BaseMutationOptions | undefin...' is not assignable to type '{ <R = any>(options: FirstDocumentMutationOptions): Promise<SanityDocument<R>>; <R = any>(options: AllDocumentsMutationOptions): Promise<...>; (options: FirstDocumentIdMutationOptions): Promise<...>; (options: AllDocumentIdsMutationOptions): Promise<...>; <R = any>(options?: BaseMutationOptions | undefined): Promise...'.

Translation

I was expecting a type matching A, but instead you passed B.

Explanation

You can assign variables types to give me hints about what kind of types you want to allow in that variable. For instance:

const num: number = 0;

This tells me that num will always be a number.

But sometimes, you'll break that pact you made with me. For instance:

const num: number = 'some string';

In your case, you said that this type was the only thing assignable to that variable:

{ <R = any>(options: FirstDocumentMutationOptions): Promise<SanityDocument<R>>; <R = any>(options: AllDocumentsMutationOptions): Promise<...>; (options: FirstDocumentIdMutationOptions): Promise<...>; (options: AllDocumentIdsMutationOptions): Promise<...>; <R = any>(options?: BaseMutationOptions | undefined): Promise...

And you passed me this instead:

{ <R = any>(options: FirstDocumentMutationOptions): Observable<SanityDocument<R>>; <R = any>(options: AllDocumentsMutationOptions): Observable<...>; (options: FirstDocumentIdMutationOptions): Observable<...>; (options: AllDocumentIdsMutationOptions): Observable<...>; <R = any>(options?: BaseMutationOptions | undefin...

Error #1

Property 'commit' in type 'ObservablePatch' is not assignable to the same property in base type 'Patch'.

Translation

Could not find a translation for error code #2416:

Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'.

Add a translation