Skip to content

Commit

Permalink
fix(isolated-declarations): cannot infer nested as const (#3807)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Jun 21, 2024
1 parent d8ecce5 commit cb8a272
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/oxc_isolated_declarations/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ impl<'a> IsolatedDeclarations<'a> {
Expression::ArrowFunctionExpression(func) => {
self.transform_arrow_function_to_ts_type(func)
}
Expression::TSAsExpression(expr) => {
if expr.type_annotation.is_const_type_reference() {
self.transform_expression_to_ts_type(&expr.expression)
} else {
Some(self.ast.copy(&expr.type_annotation))
}
}
_ => None,
}
}
Expand Down

0 comments on commit cb8a272

Please sign in to comment.