Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing comments not working #49

Open
mcandeia opened this issue Aug 12, 2023 · 0 comments
Open

Parsing comments not working #49

mcandeia opened this issue Aug 12, 2023 · 0 comments

Comments

@mcandeia
Copy link

mcandeia commented Aug 12, 2023

I'm trying to parse a simple code with comments but I couldn't make it work.

import { parse } from "https://deno.land/x/[email protected]/mod.ts";

console.log(
  JSON.stringify(parse(
    `
/**
 * @title Any Title
 * @description The Description
 */
export default function MyFunc() {
  return {}
}
`,
    {
      target: "es2019",
      syntax: "typescript",
      tsx: true,
      comments: true,
    },
  )),
);

The output is:

{"type":"Module","span":{"start":69,"end":117,"ctxt":0},"body":[{"type":"ExportDefaultDeclaration","span":{"start":69,"end":117,"ctxt":0},"decl":{"type":"FunctionExpression","identifier":{"type":"Identifier","span":{"start":93,"end":99,"ctxt":0},"value":"MyFunc","optional":false},"params":[],"decorators":[],"span":{"start":84,"end":117,"ctxt":0},"body":{"type":"BlockStatement","span":{"start":102,"end":117,"ctxt":0},"stmts":[{"type":"ReturnStatement","span":{"start":106,"end":115,"ctxt":0},"argument":{"type":"ObjectExpression","span":{"start":113,"end":115,"ctxt":0},"properties":[]}}]},"generator":false,"async":false,"typeParameters":null,"returnType":null}}],"interpreter":null}
@mcandeia mcandeia changed the title Parsing comments won't work Parsing comments not working Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant