11import { logger } from '../../../logger' ;
22import { getRepoContents } from '../../../modules/platform/forgejo/forgejo-helper' ;
33import type { RepoContents } from '../../../modules/platform/forgejo/types' ;
4+ import type { Nullish } from '../../../types' ;
45import { ExternalHostError } from '../../../types/errors/external-host-error' ;
56import type { Preset , PresetConfig } from '../types' ;
67import { PRESET_DEP_NOT_FOUND , fetchPreset , parsePreset } from '../util' ;
@@ -12,7 +13,7 @@ export async function fetchJSONFile(
1213 fileName : string ,
1314 endpoint : string ,
1415 tag ?: string | null ,
15- ) : Promise < Preset > {
16+ ) : Promise < Nullish < Preset > > {
1617 let res : RepoContents ;
1718 try {
1819 res = await getRepoContents ( repo , fileName , tag , {
@@ -28,8 +29,7 @@ export async function fetchJSONFile(
2829 throw new Error ( PRESET_DEP_NOT_FOUND ) ;
2930 }
3031
31- // TODO: null check #22198
32- return parsePreset ( res . contentString ! , fileName ) ;
32+ return parsePreset ( res . contentString , fileName ) ;
3333}
3434
3535export function getPresetFromEndpoint (
@@ -38,7 +38,7 @@ export function getPresetFromEndpoint(
3838 presetPath ?: string ,
3939 endpoint = Endpoint ,
4040 tag ?: string ,
41- ) : Promise < Preset | undefined > {
41+ ) : Promise < Nullish < Preset > > {
4242 return fetchPreset ( {
4343 repo,
4444 filePreset,
@@ -54,6 +54,6 @@ export function getPreset({
5454 presetName = 'default' ,
5555 presetPath,
5656 tag = undefined ,
57- } : PresetConfig ) : Promise < Preset | undefined > {
57+ } : PresetConfig ) : Promise < Nullish < Preset > > {
5858 return getPresetFromEndpoint ( repo , presetName , presetPath , Endpoint , tag ) ;
5959}
0 commit comments