1- import { Document , type YAMLMap , parseDocument } from "yaml" ;
1+ import { Document , parseDocument } from "yaml" ;
22import { RepositoryConnection } from "src/repositoryConnection/RepositoryConnection" ;
33import type { QuartzV5Config , QuartzLockFile } from "./QuartzConfigTypes" ;
44
@@ -10,10 +10,11 @@ const SCHEMA_COMMENT =
1010 "yaml-language-server: $schema=./quartz/plugins/quartz-plugins.schema.json" ;
1111
1212type ConfigFormat = "yaml" | "json" ;
13+ type YamlDocument = InstanceType < typeof Document > ;
1314
1415export class QuartzConfigService {
1516 private repo : RepositoryConnection ;
16- private yamlDocument : Document < YAMLMap > | null = null ;
17+ private yamlDocument : YamlDocument | null = null ;
1718 private configFormat : ConfigFormat | null = null ;
1819
1920 constructor ( repo : RepositoryConnection ) {
@@ -32,7 +33,7 @@ export class QuartzConfigService {
3233 keepSourceTokens : true ,
3334 } ) ;
3435
35- this . yamlDocument = parsed as Document < YAMLMap > ;
36+ this . yamlDocument = parsed ;
3637
3738 return parsed . toJSON ( ) as QuartzV5Config ;
3839 }
@@ -66,7 +67,7 @@ export class QuartzConfigService {
6667 return this . yamlDocument . toString ( ) ;
6768 }
6869
69- const doc = new Document < YAMLMap > ( config ) ;
70+ const doc = new Document ( config ) ;
7071 this . ensureSchemaComment ( doc ) ;
7172
7273 return doc . toString ( ) ;
@@ -160,7 +161,7 @@ export class QuartzConfigService {
160161 ) ;
161162 }
162163
163- private ensureSchemaComment ( doc : Document < YAMLMap > ) : void {
164+ private ensureSchemaComment ( doc : YamlDocument ) : void {
164165 // The `yaml` library attaches a leading `# yaml-language-server: ...`
165166 // line from a parsed document to the first key node's `commentBefore`,
166167 // not to `doc.commentBefore` (which stays null). Checking only
0 commit comments