Skip to content

Commit

Permalink
improvement: eliminate explicit any in loadAndValidateYaml
Browse files Browse the repository at this point in the history
  • Loading branch information
stefreak committed Oct 9, 2023
1 parent 08cdd1d commit 53ab9b8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/src/config/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export async function loadAndValidateYaml(
version: DocumentOptions["version"] = "1.2"
): Promise<YamlDocumentWithSource[]> {
try {
return Array.from(parseAllDocuments(content, { merge: true, strict: false, version }) || []).map((doc: any) => {
return Array.from(parseAllDocuments(content, { merge: true, strict: false, version }) || []).map((doc) => {
if (doc.errors.length > 0) {
throw doc.errors[0]
}
Expand All @@ -110,8 +110,10 @@ export async function loadAndValidateYaml(
// We call this here to catch this error early and prevent crashes later on.
doc.toJS()

doc.source = content
return doc
const docWithSource = doc as YamlDocumentWithSource
docWithSource.source = content

return docWithSource
})
} catch (loadErr) {
// We try to find the error using a YAML linter
Expand Down

0 comments on commit 53ab9b8

Please sign in to comment.