Skip to content

Commit 722ed36

Browse files
cater for shapes where keys are not all strings
1 parent d87d3a8 commit 722ed36

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

common/api-review/firestore-lite.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function addDoc<T>(reference: CollectionReference<T>, data: WithFieldValu
1414

1515
// @public
1616
export type AddPrefixToKeys<Prefix extends string, T extends Record<string, unknown>> = {
17-
[K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
17+
[K in keyof T as K extends string ? `${Prefix}.${K}`: K]+?: T[K]
1818
};
1919

2020
// @public

common/api-review/firestore.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function addDoc<T>(reference: CollectionReference<T>, data: WithFieldValu
1414

1515
// @public
1616
export type AddPrefixToKeys<Prefix extends string, T extends Record<string, unknown>> = {
17-
[K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
17+
[K in keyof T as K extends string ? `${Prefix}.${K}`: K]+?: T[K]
1818
};
1919

2020
// @public

packages/firestore/src/lite-api/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export type AddPrefixToKeys<
6666
T extends Record<string, unknown>
6767
> =
6868
// Remap K => Prefix.K. See https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#key-remapping-via-as
69-
{ [K in keyof T & string as `${Prefix}.${K}`]+?: T[K] };
69+
{ [K in keyof T as K extends string ? `${Prefix}.${K}`: K]+?: T[K] };
7070

7171
/**
7272
* Given a union type `U = T1 | T2 | ...`, returns an intersected type

0 commit comments

Comments
 (0)