benjamn / ast-types

Esprima-compatible implementation of the Mozilla JS Parser API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

t.exportSpecifier() doesn't work in ^0.14.0

jedwards1211 opened this issue · comments

I don't fully understand what's supposed to happen when a node type is defined in two places (esprima and es6) but it seems to be causing problems for exportSpecifier:

> var t = require('ast-types').builders
undefined
> t.exportSpecifier()
Uncaught:
Error: no value or default function given for field "exported" of ExportSpecifier("id": Identifier | null, "name": Identifier | null)
    at addParam (/Users/andy/temp/node_modules/ast-types/lib/types.js:443:27)
    at /Users/andy/temp/node_modules/ast-types/lib/types.js:477:21
    at Array.forEach (<anonymous>)
    at Object.builder [as exportSpecifier] (/Users/andy/temp/node_modules/ast-types/lib/types.js:475:46)
> t.exportSpecifier(t.identifier('foo'), t.identifier('bar'))
Uncaught:
Error: no value or default function given for field "exported" of ExportSpecifier("id": Identifier | null, "name": Identifier | null)
    at addParam (/Users/andy/temp/node_modules/ast-types/lib/types.js:443:27)
    at /Users/andy/temp/node_modules/ast-types/lib/types.js:477:21
    at Array.forEach (<anonymous>)
    at Object.builder [as exportSpecifier] (/Users/andy/temp/node_modules/ast-types/lib/types.js:475:46)

I noticed that field names id and name come from the esprima defs, whereas the field name exported comes from the es6 defs.

sorry for the duplicate issue, there was a GitHub glitch when I first submitted it