Skip to content

Commit

Permalink
fix typescript for babel-types
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhauhau committed Jun 14, 2019
1 parent f92c2ae commit 6ae7efc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/babel-types/scripts/generators/typescript.js
Expand Up @@ -100,6 +100,11 @@ for (const type in t.NODE_FIELDS) {
lines.push(
`export function ${toFunctionName(type)}(${args.join(", ")}): ${type};`
);
} else {
lines.push(
`declare function _${toFunctionName(type)}(${args.join(", ")}): ${type};`,
`export { _${toFunctionName(type)} as ${toFunctionName(type)}}`
);
}
}

Expand Down
11 changes: 9 additions & 2 deletions packages/babel-types/src/definitions/experimental.js
Expand Up @@ -146,8 +146,8 @@ defineType("OptionalCallExpression", {
});

defineType("ClassPrivateProperty", {
visitor: ["key", "value"],
builder: ["key", "value"],
visitor: ["key", "value", "decorators"],
builder: ["key", "value", "decorators"],
aliases: ["Property", "Private"],
fields: {
key: {
Expand All @@ -157,6 +157,13 @@ defineType("ClassPrivateProperty", {
validate: assertNodeType("Expression"),
optional: true,
},
decorators: {
validate: chain(
assertValueType("array"),
assertEach(assertNodeType("Decorator")),
),
optional: true,
},
},
});

Expand Down

0 comments on commit 6ae7efc

Please sign in to comment.