eslint / js

Monorepo for the JS language tools.
BSD 2-Clause "Simplified" License
2.29k stars 196 forks source link

typing for parse() #570

Closed magwas closed 1 year ago

magwas commented 1 year ago

Here is a typing for parse()

declare module "espree" {
  import { type Program } from "estree";
  interface Options {
    range?: boolean;
    loc?: boolean;
    comment?: boolean;
    tokens?: boolean;
    ecmaVersion?: number;

    allowReserved?: boolean;
    sourceType?: "script" | "module" | "commonjs";

    ecmaFeatures?: {
      jsx?: boolean;

      globalReturn?: boolean;

      impliedStrict?: boolean;
    };
  }
  function parse(code: string, options: Options): Program;
}
nzakas commented 1 year ago

Thanks. We decided not to do partial typings for this package as we try to explore doing a more full-featured type definition set.