Skip to content

Commit 31b5834

Browse files
committed
style(config): replace any with unknown in template expansion
1 parent 290f0ef commit 31b5834

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

packages/opencode/src/config/config.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ export namespace Config {
882882
replaceTemplates(value, fileContents)
883883
}
884884

885-
function collectFileReferences(value: any, configDir: string, fileRefs: Map<string, string>): void {
885+
function collectFileReferences(value: unknown, configDir: string, fileRefs: Map<string, string>): void {
886886
if (Array.isArray(value)) {
887887
for (const item of value) {
888888
if (typeof item === "string") {
@@ -895,11 +895,13 @@ export namespace Config {
895895
}
896896

897897
if (value && typeof value === "object") {
898-
for (const key in value) {
899-
if (typeof value[key] === "string") {
900-
extractFileReferences(value[key], configDir, fileRefs)
898+
const obj = value as Record<string, unknown>
899+
for (const key in obj) {
900+
const val = obj[key]
901+
if (typeof val === "string") {
902+
extractFileReferences(val, configDir, fileRefs)
901903
} else {
902-
collectFileReferences(value[key], configDir, fileRefs)
904+
collectFileReferences(val, configDir, fileRefs)
903905
}
904906
}
905907
return
@@ -922,7 +924,7 @@ export namespace Config {
922924
}
923925
}
924926

925-
function replaceTemplates(value: any, fileContents: Map<string, string>): void {
927+
function replaceTemplates(value: unknown, fileContents: Map<string, string>): void {
926928
if (Array.isArray(value)) {
927929
for (let i = 0; i < value.length; i++) {
928930
if (typeof value[i] === "string") {
@@ -935,11 +937,13 @@ export namespace Config {
935937
}
936938

937939
if (value && typeof value === "object") {
938-
for (const key in value) {
939-
if (typeof value[key] === "string") {
940-
value[key] = expandString(value[key], fileContents)
940+
const obj = value as Record<string, unknown>
941+
for (const key in obj) {
942+
const val = obj[key]
943+
if (typeof val === "string") {
944+
obj[key] = expandString(val, fileContents)
941945
} else {
942-
replaceTemplates(value[key], fileContents)
946+
replaceTemplates(val, fileContents)
943947
}
944948
}
945949
return

0 commit comments

Comments
 (0)