From 213a1c62d1cad7741aee9c4cc2df9777072543e5 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 28 Sep 2023 17:08:01 -0700 Subject: [PATCH] Change rendering of predicate types (#88) I think this is clearer --- sphinx_js/typedoc.py | 5 +++-- tests/test_build_ts/test_build_ts.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sphinx_js/typedoc.py b/sphinx_js/typedoc.py index 9ed14531..4a850185 100644 --- a/sphinx_js/typedoc.py +++ b/sphinx_js/typedoc.py @@ -1165,9 +1165,10 @@ class PredicateType(TypeBase): targetType: "TypeD" def _render_name_root(self, converter: Converter) -> Iterator[str | ir.TypeXRef]: - yield self.name - yield " is " + yield ir.TypeXRefIntrinsic("boolean") + yield " (typeguard for " yield from self.targetType.render_name(converter) + yield ")" AnyNode = Node | Project | Signature diff --git a/tests/test_build_ts/test_build_ts.py b/tests/test_build_ts/test_build_ts.py index 6ef5d560..d94be374 100644 --- a/tests/test_build_ts/test_build_ts.py +++ b/tests/test_build_ts/test_build_ts.py @@ -185,7 +185,7 @@ def test_predicate(self): * **c** (any) -- Returns: - c is "ConstructorlessClass()" + boolean (typeguard for "ConstructorlessClass()") """ ), )