oxc icon indicating copy to clipboard operation
oxc copied to clipboard

fix(semantic): enter scope after `check_type` for `TSConditionalType`

Open DonIsaac opened this issue 4 months ago • 4 comments

When visiting a TSConditionalType, enter a new scope after visiting the check_type, and exit before entering the false_type.

Fixes this case, where B should have a reference. I can't find the issue that was reported with this, if someone finds it please link it to this PR.

type S<A> = A extends /* enter scope */ (infer B extends number ? string : never)
  ? B 
  : /* exit scope before false branch */ false;

Ideally we'd update ast_tools to let us configure the order of enter/leave scopes. CC: @overlookmotel.

DonIsaac avatar Oct 03 '24 14:10 DonIsaac