Skip to content
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
11 changes: 10 additions & 1 deletion crates/oxc_ast/src/ast_impl/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,21 @@ impl<'a> From<Argument<'a>> for ArrayExpressionElement<'a> {
}
}

impl ObjectPropertyKind<'_> {
impl<'a> ObjectPropertyKind<'a> {
/// Returns `true` if this object property is a [spread](SpreadElement).
#[inline]
pub fn is_spread(&self) -> bool {
matches!(self, Self::SpreadProperty(_))
}

/// Returns [`Some`] for non-spread [object properties](ObjectProperty).
#[inline]
pub fn as_property(&self) -> Option<&ObjectProperty<'a>> {
match self {
Self::ObjectProperty(prop) => Some(prop),
Self::SpreadProperty(_) => None,
}
}
}

impl<'a> PropertyKey<'a> {
Expand Down
2 changes: 2 additions & 0 deletions crates/oxc_linter/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ mod typescript {
pub mod consistent_type_definitions;
pub mod consistent_type_imports;
pub mod explicit_function_return_type;
pub mod explicit_module_boundary_types;
pub mod no_confusing_non_null_assertion;
pub mod no_duplicate_enum_values;
pub mod no_dynamic_delete;
Expand Down Expand Up @@ -958,6 +959,7 @@ oxc_macros::declare_all_lint_rules! {
typescript::consistent_indexed_object_style,
typescript::consistent_type_definitions,
typescript::consistent_type_imports,
typescript::explicit_module_boundary_types,
typescript::explicit_function_return_type,
typescript::no_inferrable_types,
typescript::no_confusing_non_null_assertion,
Expand Down
Loading
Loading