Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Pin Typescript to prevent new type checking. #1764

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

tom-andersen
Copy link
Contributor

@tom-andersen tom-andersen commented Aug 30, 2022

We are experiencing type checking errors with new version 4.8.2 of typescript. So we are pinning to previous version 4.7.4.

See example of errors below:

dev/src/bulk-writer.ts:583:26 - error TS2345: Argument of type 'DocumentReference' is not assignable to parameter of type 'DocumentReference'.
The types returned by 'parent.where(...).get()' are incompatible between these types.
Type 'Promise<QuerySnapshot>' is not assignable to type 'Promise<QuerySnapshot>'.
Type 'QuerySnapshot' is not assignable to type 'QuerySnapshot'.
Types of property 'docs' are incompatible.
Type 'QueryDocumentSnapshot[]' is not assignable to type 'QueryDocumentSnapshot[]'.
Type 'QueryDocumentSnapshot' is not assignable to type 'QueryDocumentSnapshot'.
Types of property 'isEqual' are incompatible.
Type '(other: DocumentSnapshot) => boolean' is not assignable to type '(other: DocumentSnapshot) => boolean'.
Types of parameters 'other' and 'other' are incompatible.
Type 'DocumentSnapshot' is not assignable to type 'DocumentSnapshot'.
The types returned by 'ref.parent.where(...).get()' are incompatible between these types.
Type 'Promise<QuerySnapshot>' is not assignable to type 'Promise<QuerySnapshot>'.
Type 'QuerySnapshot' is not assignable to type 'QuerySnapshot'.
Types of property 'docs' are incompatible.
Type 'QueryDocumentSnapshot[]' is not assignable to type 'QueryDocumentSnapshot[]'.
Type 'QueryDocumentSnapshot' is not assignable to type 'QueryDocumentSnapshot'.
The types returned by 'data()' are incompatible between these types.
Type 'unknown' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'unknown'.

583 return this._enqueue(documentRef, 'create', bulkCommitBatch =>
~~~~~~~~~~~

dev/src/bulk-writer.ts:623:26 - error TS2345: Argument of type 'DocumentReference' is not assignable to parameter of type 'DocumentReference'.
The types returned by 'parent.where(...).get()' are incompatible between these types.
Type 'Promise<QuerySnapshot>' is not assignable to type 'Promise<QuerySnapshot>'.
Type 'QuerySnapshot' is not assignable to type 'QuerySnapshot'.
Types of property 'docs' are incompatible.
Type 'QueryDocumentSnapshot[]' is not assignable to type 'QueryDocumentSnapshot[]'.
Type 'QueryDocumentSnapshot' is not assignable to type 'QueryDocumentSnapshot'.
Types of property 'isEqual' are incompatible.
Type '(other: DocumentSnapshot) => boolean' is not assignable to type '(other: DocumentSnapshot) => boolean'.
Types of parameters 'other' and 'other' are incompatible.
Type 'DocumentSnapshot' is not assignable to type 'DocumentSnapshot'.
The types returned by 'ref.parent.where(...).get()' are incompatible between these types.
Type 'Promise<QuerySnapshot>' is not assignable to type 'Promise<QuerySnapshot>'.
Type 'QuerySnapshot' is not assignable to type 'QuerySnapshot'.
Types of property 'docs' are incompatible.
Type 'QueryDocumentSnapshot[]' is not assignable to type 'QueryDocumentSnapshot[]'.
Type 'QueryDocumentSnapshot' is not assignable to type 'QueryDocumentSnapshot'.
The types returned by 'data()' are incompatible between these types.
Type 'unknown' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'unknown'.

623 return this._enqueue(documentRef, 'delete', bulkCommitBatch =>
~~~~~~~~~~~

dev/src/bulk-writer.ts:683:26 - error TS2345: Argument of type 'DocumentReference' is not assignable to parameter of type 'DocumentReference'.
The types returned by 'parent.where(...).get()' are incompatible between these types.
Type 'Promise<QuerySnapshot>' is not assignable to type 'Promise<QuerySnapshot>'.
Type 'QuerySnapshot' is not assignable to type 'QuerySnapshot'.
Types of property 'docs' are incompatible.
Type 'QueryDocumentSnapshot[]' is not assignable to type 'QueryDocumentSnapshot[]'.
Type 'QueryDocumentSnapshot' is not assignable to type 'QueryDocumentSnapshot'.
Types of property 'isEqual' are incompatible.
Type '(other: DocumentSnapshot) => boolean' is not assignable to type '(other: DocumentSnapshot) => boolean'.
Types of parameters 'other' and 'other' are incompatible.
Type 'DocumentSnapshot' is not assignable to type 'DocumentSnapshot'.
The types returned by 'ref.parent.where(...).get()' are incompatible between these types.
Type 'Promise<QuerySnapshot>' is not assignable to type 'Promise<QuerySnapshot>'.
Type 'QuerySnapshot' is not assignable to type 'QuerySnapshot'.
Types of property 'docs' are incompatible.
Type 'QueryDocumentSnapshot[]' is not assignable to type 'QueryDocumentSnapshot[]'.
Type 'QueryDocumentSnapshot' is not assignable to type 'QueryDocumentSnapshot'.
The types returned by 'data()' are incompatible between these types.
Type 'unknown' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'unknown'.

683 return this._enqueue(documentRef, 'set', bulkCommitBatch => {
~~~~~~~~~~~

dev/src/bulk-writer.ts:747:26 - error TS2345: Argument of type 'DocumentReference' is not assignable to parameter of type 'DocumentReference'.
The types returned by 'parent.where(...).get()' are incompatible between these types.
Type 'Promise<QuerySnapshot>' is not assignable to type 'Promise<QuerySnapshot>'.
Type 'QuerySnapshot' is not assignable to type 'QuerySnapshot'.
Types of property 'docs' are incompatible.
Type 'QueryDocumentSnapshot[]' is not assignable to type 'QueryDocumentSnapshot[]'.
Type 'QueryDocumentSnapshot' is not assignable to type 'QueryDocumentSnapshot'.
Types of property 'isEqual' are incompatible.
Type '(other: DocumentSnapshot) => boolean' is not assignable to type '(other: DocumentSnapshot) => boolean'.
Types of parameters 'other' and 'other' are incompatible.
Type 'DocumentSnapshot' is not assignable to type 'DocumentSnapshot'.
The types returned by 'ref.parent.where(...).get()' are incompatible between these types.
Type 'Promise<QuerySnapshot>' is not assignable to type 'Promise<QuerySnapshot>'.
Type 'QuerySnapshot' is not assignable to type 'QuerySnapshot'.
Types of property 'docs' are incompatible.
Type 'QueryDocumentSnapshot[]' is not assignable to type 'QueryDocumentSnapshot[]'.
Type 'QueryDocumentSnapshot' is not assignable to type 'QueryDocumentSnapshot'.
The types returned by 'data()' are incompatible between these types.
Type 'unknown' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'unknown'.

747 return this._enqueue(documentRef, 'update', bulkCommitBatch =>
~~~~~~~~~~~

dev/src/write-batch.ts:198:7 - error TS2345: Argument of type 'WithFieldValue' is not assignable to parameter of type 'WithFieldValue'.
Type 'T' is not assignable to type 'WithFieldValue'.
Type 'T' is not assignable to type '{ [x: string]: any; }'.

198 data as firestore.WithFieldValue
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

dev/src/write-batch.ts:192:10
192 create(
~
This type parameter might need an extends { [x: string]: any; } constraint.
dev/src/write-batch.ts:192:10
192 create(
~
This type parameter might need an extends firestore.WithFieldValue<firestore.DocumentData> constraint.

dev/src/write-batch.ts:339:50 - error TS2345: Argument of type 'T' is not assignable to parameter of type 'WithFieldValue'.
Type 'T' is not assignable to type '{ [x: string]: any; }'.

339 firestoreData = ref._converter.toFirestore(data as T);
~~~~~~~~~

dev/src/write-batch.ts:323:7
323 set(
~
This type parameter might need an extends { [x: string]: any; } constraint.
dev/src/write-batch.ts:323:7
323 set(
~
This type parameter might need an extends firestore.WithFieldValue<firestore.DocumentData> constraint.

dev/src/write-batch.ts:490:24 - error TS2769: No overload matches this call.
Overload 1 of 2, '(o: { [s: string]: unknown; } | ArrayLike): [string, unknown][]', gave the following error.
Argument of type 'UpdateData' is not assignable to parameter of type '{ [s: string]: unknown; } | ArrayLike'.
Type 'T | (T extends {} ? { [K in keyof T]?: FieldValue | UpdateData<T[K]> | undefined; } & UnionToIntersection<{ [K in keyof T & string]: ChildUpdateFields<K, T[K]>; }[keyof T & string]> : Partial<...>)' is not assignable to type '{ [s: string]: unknown; } | ArrayLike'.
Type 'Primitive & T' is not assignable to type '{ [s: string]: unknown; } | ArrayLike'.
Type 'undefined & T' is not assignable to type '{ [s: string]: unknown; } | ArrayLike'.
Type 'undefined & T' is not assignable to type 'ArrayLike'.
Type 'UpdateData' is not assignable to type 'ArrayLike'.
Type 'T | (T extends {} ? { [K in keyof T]?: FieldValue | UpdateData<T[K]> | undefined; } & UnionToIntersection<{ [K in keyof T & string]: ChildUpdateFields<K, T[K]>; }[keyof T & string]> : Partial<...>)' is not assignable to type 'ArrayLike'.
Type 'Primitive & T' is not assignable to type 'ArrayLike'.
Type 'undefined & T' is not assignable to type 'ArrayLike'.
Overload 2 of 2, '(o: {}): [string, any][]', gave the following error.
Argument of type 'UpdateData' is not assignable to parameter of type '{}'.
Type 'T | (T extends {} ? { [K in keyof T]?: FieldValue | UpdateData<T[K]> | undefined; } & UnionToIntersection<{ [K in keyof T & string]: ChildUpdateFields<K, T[K]>; }[keyof T & string]> : Partial<...>)' is not assignable to type '{}'.
Type 'Primitive & T' is not assignable to type '{}'.
Type 'undefined & T' is not assignable to type '{}'.

490 Object.entries(dataOrField as firestore.UpdateData).forEach(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 7 errors in 2 files.

@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: firestore Issues related to the googleapis/nodejs-firestore API. labels Aug 30, 2022
@tom-andersen tom-andersen marked this pull request as ready for review August 30, 2022 13:44
@tom-andersen tom-andersen requested review from a team as code owners August 30, 2022 13:44
@tom-andersen tom-andersen added the owlbot:run Add this label to trigger the Owlbot post processor. label Aug 30, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Aug 30, 2022
@tom-andersen tom-andersen merged commit dd01b27 into main Aug 30, 2022
@tom-andersen tom-andersen deleted the tomandersen/pinTypescript branch August 30, 2022 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants