Skip to content

Commit 39b59a4

Browse files
committed
docs(semantic): add docs for JSDocTagTypePart
1 parent 05a291e commit 39b59a4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

crates/oxc_semantic/src/jsdoc/parser/jsdoc_parts.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,31 @@ impl<'a> JSDocTagKindPart<'a> {
107107
}
108108
}
109109

110+
/// Represents the raw type content inside a JSDoc tag's curly braces `{}`.
111+
///
112+
/// This struct captures the type expression including the curly braces.
113+
/// It stores the raw string slice as it appears in the source (with the
114+
/// enclosing braces) and its corresponding span.
115+
///
116+
/// For example, in a JSDoc tag like:
117+
///
118+
/// ```js
119+
/// /**
120+
/// * @param {foo=} bar
121+
/// * ^^^^
122+
/// * This is the `JSDocTagTypePart`, covering the full type expression
123+
/// */
124+
/// ```
110125
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
111126
pub struct JSDocTagTypePart<'a> {
127+
/// The raw, unprocessed type expression string inside `{}`, including the braces.
128+
/// For example: `"{foo=}"`, `"{Array<string>}"`, or `"{number | undefined}"`.
112129
raw: &'a str,
130+
131+
/// The span in the source text covering the entire `{...}` expression, including the braces.
113132
pub span: Span,
114133
}
134+
115135
impl<'a> JSDocTagTypePart<'a> {
116136
pub fn new(part_content: &'a str, span: Span) -> Self {
117137
debug_assert!(part_content.starts_with('{'));

0 commit comments

Comments
 (0)