mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-27 06:22:55 +08:00
Adds type defs for [ESTree AST specification](https://github.com/estree/estree) and updates Esprima and Acorn definitions since they follow same spec.
37 lines
898 B
TypeScript
37 lines
898 B
TypeScript
// Type definitions for Esprima v2.1.0
|
|
// Project: http://esprima.org
|
|
// Definitions by: teppeis <https://github.com/teppeis>, RReverser <https://github.com/RReverser>
|
|
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
|
|
/// <reference path="../estree/estree.d.ts" />
|
|
|
|
declare module esprima {
|
|
var version: string
|
|
function parse(code: string, options?: Options): ESTree.Program
|
|
function tokenize(code: string, options?: Options): Array<Token>
|
|
|
|
interface Token {
|
|
type: string
|
|
value: string
|
|
}
|
|
|
|
interface Comment extends ESTree.Node {
|
|
value: string
|
|
}
|
|
|
|
interface Options {
|
|
loc?: boolean
|
|
range?: boolean
|
|
raw?: boolean
|
|
tokens?: boolean
|
|
comment?: boolean
|
|
attachComment?: boolean
|
|
tolerant?: boolean
|
|
source?: boolean
|
|
}
|
|
}
|
|
|
|
declare module "esprima" {
|
|
export = esprima
|
|
}
|