Skip to content

Commit

Permalink
improvement(routerlicious-driver): change Object.keys to Object.entri…
Browse files Browse the repository at this point in the history
…es (microsoft#23710)

Prepare for enabling no-unchecked-record-access /
noUncheckedIndexedAccess in routerlicious-driver by switching
Object.keys to Object.entries. Full type safety will require additional
changes in a future PR.
  • Loading branch information
RishhiB authored Feb 6, 2025
1 parent 701bbd5 commit 7da99ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 1 addition & 4 deletions packages/drivers/routerlicious-driver/src/createNewUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import { ISummaryTree, SummaryType } from "@fluidframework/driver-definitions";
* @returns Modified summary tree where the blob contents could be utf8 string only.
*/
export function convertSummaryToCreateNewSummary(summary: ISummaryTree): ISummaryTree {
const keys = Object.keys(summary.tree);
for (const key of keys) {
const summaryObject = summary.tree[key];

for (const [key, summaryObject] of Object.entries(summary.tree)) {
switch (summaryObject.type) {
case SummaryType.Tree: {
summary.tree[key] = convertSummaryToCreateNewSummary(summaryObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export class SummaryTreeUploadManager implements ISummaryUploadManager {
previousFullSnapshot: ISnapshotTreeEx | undefined,
): Promise<string> {
const entries = await Promise.all(
Object.keys(summaryTree.tree).map(async (key) => {
const entry = summaryTree.tree[key];
Object.entries(summaryTree.tree).map(async ([key, entry]) => {
const pathHandle = await this.writeSummaryTreeObject(entry, previousFullSnapshot);
const treeEntry: IGitCreateTreeEntry = {
mode: getGitMode(entry),
Expand Down

0 comments on commit 7da99ae

Please sign in to comment.