@@ -210,6 +210,55 @@ const testLanguage: Language = {
210210
211211testLanguage . defaultLanguageOptions satisfies LanguageOptions | undefined ;
212212
213+ const testLanguage2 : Language < {
214+ LangOptions : {
215+ howMuch : boolean ;
216+ howMany : number ;
217+ } ;
218+ Code : TestSourceCode ;
219+ RootNode : TestRootNode ;
220+ Node : TestNode ;
221+ } > = {
222+ fileType : "text" ,
223+ lineStart : 1 ,
224+ columnStart : 1 ,
225+ nodeTypeKey : "type" ,
226+ defaultLanguageOptions : {
227+ howMuch : true ,
228+ // @ts -expect-error -- defaultLanguageOptions must match the language options.
229+ howMany : "a lot" ,
230+ } ,
231+
232+ validateLanguageOptions ( languageOptions ) {
233+ languageOptions . howMuch satisfies boolean ;
234+ languageOptions . howMany satisfies number ;
235+ } ,
236+
237+ parse ( file , context ) : ParseResult < TestRootNode > {
238+ context . languageOptions . howMuch satisfies boolean ;
239+ context . languageOptions . howMany satisfies number ;
240+
241+ return {
242+ ok : true ,
243+ ast : {
244+ type : "root" ,
245+ start : 0 ,
246+ length : file . body . length ,
247+ } ,
248+ } ;
249+ } ,
250+
251+ createSourceCode ( file , input , context ) : TestSourceCode {
252+ context . languageOptions . howMuch satisfies boolean ;
253+ context . languageOptions . howMany satisfies number ;
254+ return new TestSourceCode ( String ( file . body ) , input . ast ) ;
255+ } ,
256+ } ;
257+
258+ testLanguage2 . defaultLanguageOptions satisfies
259+ | { howMuch : boolean ; howMany : number }
260+ | undefined ;
261+
213262//-----------------------------------------------------------------------------
214263// Tests for rule-related types
215264//-----------------------------------------------------------------------------
0 commit comments