Skip to content

Commit

Permalink
get rid of merge confilicts hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
FroggyPanda committed Mar 3, 2024
2 parents 5d5e4c4 + 59457f7 commit 7b7192c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/utils/getDatabaseType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { SourceFile, Node } from 'ts-morph';

export function getDatabaseType(sourceFile: SourceFile) {
const databaseInterface = sourceFile.getInterface('Database');
if (databaseInterface) {
return databaseInterface;
} else {
const node = sourceFile
.getTypeAliasOrThrow('Database')
.getTypeNodeOrThrow();
if (Node.isTypeLiteral(node)) {
return node;
} else {
throw Error('Expected database type to be an object literal.');
}
}
}

0 comments on commit 7b7192c

Please sign in to comment.