@@ -194,6 +194,14 @@ interface ClassifiedPrismaNextConfig {
194194 target : "postgresql" | "unknown" | UnsupportedBranchDatabaseSchemaTarget ;
195195}
196196
197+ interface SupportedPrismaNextConfig extends ClassifiedPrismaNextConfig {
198+ target : "postgresql" | "unknown" ;
199+ }
200+
201+ interface UnsupportedPrismaNextConfig extends ClassifiedPrismaNextConfig {
202+ target : UnsupportedBranchDatabaseSchemaTarget ;
203+ }
204+
197205interface PrismaOrmSchemaSelection {
198206 schema : BranchDatabaseSchema | null ;
199207 unsupportedSchema : UnsupportedBranchDatabaseSchema | null ;
@@ -341,16 +349,26 @@ async function selectPrismaOrmSchema(
341349 } ;
342350}
343351
352+ function selectPrismaNextConfig (
353+ cwd : string ,
354+ candidates : ClassifiedPrismaNextConfig [ ] ,
355+ mode : "supported" ,
356+ ) : SupportedPrismaNextConfig | null ;
357+ function selectPrismaNextConfig (
358+ cwd : string ,
359+ candidates : ClassifiedPrismaNextConfig [ ] ,
360+ mode : "unsupported" ,
361+ ) : UnsupportedPrismaNextConfig | null ;
344362function selectPrismaNextConfig (
345363 cwd : string ,
346364 candidates : ClassifiedPrismaNextConfig [ ] ,
347365 mode : "supported" | "unsupported" ,
348366) : ClassifiedPrismaNextConfig | null {
349- const matches = candidates . filter ( ( candidate ) => {
350- const isSupported =
351- candidate . target === "postgresql" || candidate . target === "unknown" ;
352- return mode === "supported" ? isSupported : ! isSupported ;
353- } ) ;
367+ const matches = candidates . filter (
368+ mode === "supported"
369+ ? isSupportedPrismaNextConfig
370+ : isUnsupportedPrismaNextConfig ,
371+ ) ;
354372
355373 return (
356374 sortByPreferredRelativePath (
@@ -367,6 +385,18 @@ function selectPrismaNextConfig(
367385 ) ;
368386}
369387
388+ function isSupportedPrismaNextConfig (
389+ candidate : ClassifiedPrismaNextConfig ,
390+ ) : candidate is SupportedPrismaNextConfig {
391+ return candidate . target === "postgresql" || candidate . target === "unknown" ;
392+ }
393+
394+ function isUnsupportedPrismaNextConfig (
395+ candidate : ClassifiedPrismaNextConfig ,
396+ ) : candidate is UnsupportedPrismaNextConfig {
397+ return ! isSupportedPrismaNextConfig ( candidate ) ;
398+ }
399+
370400function sortByPreferredRelativePath (
371401 cwd : string ,
372402 candidates : string [ ] ,
0 commit comments