oxc-project / oxc

⚓ A collection of JavaScript tools written in Rust.

Home Page:https://oxc.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parse uninitialize const declaration in namespace in `.d.ts` file

ArnaudBarre opened this issue · comments

I just discover this and I hate it. Personally I would love to see tools that don't support legacy things like enum and namespaces, but given that OXC already added support for TSModuleBlock in the AST it's propbably better to follow allow this.

Maybe there are other differences, but in .d.ts, this is valid for TS

export namespace builders {
  const breakParent: string;
}

See in TS playground with .ts and .d.ts

I can't reproduce this, the snippet parses correctly:

  • in .ts it produces an correct AST with the error "Missing initializer in const declaration"
  • in .d.ts it produces a correct AST

Oh yeah I completely mess up in my local setup and didn't correctly pass the file name to the parser. So I suppose what is missing is .d.ts support in the playground: #2520