Skip to content

Commit 0031ad3

Browse files
committed
fix: Support root module and project when getting source filepath
Issue-mkdocstrings-typescript-25: mkdocstrings/typescript#25
1 parent 5fdf085 commit 0031ad3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/griffe_typedoc/dataclasses.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ class Source:
210210

211211
@property
212212
def filepath(self) -> str:
213-
return self.parent.root.files.filepath(self.parent.root_module.id)
213+
root = self.parent.root
214+
try:
215+
return root.files.filepath(self.parent.root_module.id)
216+
except IndexError:
217+
return root.files.filepath(root.id)
214218

215219
@property
216220
def contents(self) -> str:

0 commit comments

Comments
 (0)