mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(semantic): do not resolve references after FormalParameters in TS type (#4241)
Semantic resolves references when exiting `FormalParameters` to ensure references in param initializers don't get bound to bindings inside the function body. However, it shouldn't do this for `FormalParameters` in TS types e.g. `TSTypeAnnotation` because they don't have their own scopes.
This commit is contained in:
parent
7eb960d6e9
commit
22d56bdcac
1 changed files with 1 additions and 1 deletions
|
|
@ -1745,7 +1745,7 @@ impl<'a> SemanticBuilder<'a> {
|
|||
self.function_stack.pop();
|
||||
}
|
||||
AstKind::FormalParameters(parameters) => {
|
||||
if parameters.has_parameter() {
|
||||
if parameters.kind != FormalParameterKind::Signature && parameters.has_parameter() {
|
||||
// `function foo({bar: identifier_reference}) {}`
|
||||
// ^^^^^^^^^^^^^^^^^^^^ Parameter initializer must be resolved
|
||||
// after all parameters have been declared
|
||||
|
|
|
|||
Loading…
Reference in a new issue