Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix @deprecated with no body #76

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sphinx_js/typedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,9 @@ def short_name(self) -> str:

def _top_level_properties(self) -> TopLevelPropertiesDict:
deprecated: Sequence[ir.DescriptionItem] | bool
deprecated = self.comment.get_tag_one("deprecated") or False
deprecated = self.comment.get_tag_one("deprecated")
if not deprecated:
deprecated = "deprecated" in self.comment.tags
return dict(
name=self.short_name(),
path=ir.Pathname(self.path),
Expand Down
7 changes: 6 additions & 1 deletion tests/test_build_ts/source/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ export function selfReferential(b: typeof selfReferential) {}
/**
* @deprecated since v20!
*/
export function deprecatedFunction() {}
export function deprecatedFunction1() {}

/**
* @deprecated
*/
export function deprecatedFunction2() {}


/**
Expand Down
4 changes: 3 additions & 1 deletion tests/test_build_ts/source/docs/deprecated.rst
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.. js:autofunction:: deprecatedFunction
.. js:autofunction:: deprecatedFunction1

.. js:autofunction:: deprecatedFunction2
8 changes: 7 additions & 1 deletion tests/test_build_ts/test_build_ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,17 @@ def test_deprecated(self):
"deprecated",
dedent(
"""\
deprecatedFunction()
deprecatedFunction1()

Note:

Deprecated: since v20!

deprecatedFunction2()

Note:

Deprecated.
"""
),
)
Expand Down
Loading