Skip to content

Commit c805760

Browse files
committed
Fix TypeScript build errors
1 parent 141002a commit c805760

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/react-router/src/vite/makeAutoInstrumentRSCPlugin.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ function collectNamedExports(node: BabelExportNamedDeclaration, into: Set<string
9494
}
9595

9696
if (decl.type === 'VariableDeclaration') {
97-
decl.declarations
98-
.filter(declarator => declarator.type === 'VariableDeclarator' && declarator.id.type === 'Identifier')
99-
.forEach(declarator => {
100-
into.add((declarator.id as t.Identifier).name);
101-
});
97+
for (const declarator of decl.declarations) {
98+
if (declarator.type === 'VariableDeclarator' && declarator.id.type === 'Identifier') {
99+
into.add(declarator.id.name);
100+
}
101+
}
102102
} else {
103103
const name = getDeclarationName(decl);
104104
if (name) {
@@ -135,7 +135,7 @@ function getExportedName(node: t.Identifier | t.StringLiteral): string | undefin
135135

136136
function getDeclarationName(decl: t.Declaration): string | undefined {
137137
if (decl.type === 'FunctionDeclaration' || decl.type === 'ClassDeclaration') {
138-
const id = decl.id as t.Identifier | null | undefined;
138+
const id = (decl as t.FunctionDeclaration | t.ClassDeclaration).id;
139139
return id?.type === 'Identifier' ? id.name : undefined;
140140
}
141141
return undefined;

0 commit comments

Comments
 (0)