Skip to content

Commit 7b7192c

Browse files
committed
get rid of merge confilicts hopefully
2 parents 5d5e4c4 + 59457f7 commit 7b7192c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/utils/getDatabaseType.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { SourceFile, Node } from 'ts-morph';
2+
3+
export function getDatabaseType(sourceFile: SourceFile) {
4+
const databaseInterface = sourceFile.getInterface('Database');
5+
if (databaseInterface) {
6+
return databaseInterface;
7+
} else {
8+
const node = sourceFile
9+
.getTypeAliasOrThrow('Database')
10+
.getTypeNodeOrThrow();
11+
if (Node.isTypeLiteral(node)) {
12+
return node;
13+
} else {
14+
throw Error('Expected database type to be an object literal.');
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)