Update types (BigInt)

This commit is contained in:
Nicolò Ribaudo
2018-05-24 00:19:27 +02:00
parent c992f5b61e
commit dccaec7691
4 changed files with 41 additions and 3 deletions

View File

@@ -125,6 +125,19 @@ Aliases: `Expression`, `Terminatorless`
---
### bigIntLiteral
```javascript
t.bigIntLiteral(value)
```
See also `t.isBigIntLiteral(node, opts)` and `t.assertBigIntLiteral(node, opts)`.
Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
- `value`: `string` (required)
---
### binaryExpression
```javascript
t.binaryExpression(operator, left, right)

View File

@@ -711,6 +711,9 @@ export function assertExportNamespaceSpecifier(
export function assertPrivateName(node: Object, opts?: Object = {}): void {
assert("PrivateName", node, opts);
}
export function assertBigIntLiteral(node: Object, opts?: Object = {}): void {
assert("BigIntLiteral", node, opts);
}
export function assertTSParameterProperty(
node: Object,
opts?: Object = {},

View File

@@ -644,6 +644,10 @@ export function PrivateName(...args: Array<any>): Object {
return builder("PrivateName", ...args);
}
export { PrivateName as privateName };
export function BigIntLiteral(...args: Array<any>): Object {
return builder("BigIntLiteral", ...args);
}
export { BigIntLiteral as bigIntLiteral };
export function TSParameterProperty(...args: Array<any>): Object {
return builder("TSParameterProperty", ...args);
}

View File

@@ -2246,6 +2246,20 @@ export function isPrivateName(node: Object, opts?: Object): boolean {
return false;
}
export function isBigIntLiteral(node: Object, opts?: Object): boolean {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BigIntLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return shallowEqual(node, opts);
}
}
return false;
}
export function isTSParameterProperty(node: Object, opts?: Object): boolean {
if (!node) return false;
@@ -3097,6 +3111,7 @@ export function isExpression(node: Object, opts?: Object): boolean {
"OptionalCallExpression" === nodeType ||
"Import" === nodeType ||
"DoExpression" === nodeType ||
"BigIntLiteral" === nodeType ||
"TSAsExpression" === nodeType ||
"TSTypeAssertion" === nodeType ||
"TSNonNullExpression" === nodeType
@@ -3481,7 +3496,8 @@ export function isPureish(node: Object, opts?: Object): boolean {
"BooleanLiteral" === nodeType ||
"ArrowFunctionExpression" === nodeType ||
"ClassDeclaration" === nodeType ||
"ClassExpression" === nodeType
"ClassExpression" === nodeType ||
"BigIntLiteral" === nodeType
) {
if (typeof opts === "undefined") {
return true;
@@ -3606,7 +3622,8 @@ export function isLiteral(node: Object, opts?: Object): boolean {
"NullLiteral" === nodeType ||
"BooleanLiteral" === nodeType ||
"RegExpLiteral" === nodeType ||
"TemplateLiteral" === nodeType
"TemplateLiteral" === nodeType ||
"BigIntLiteral" === nodeType
) {
if (typeof opts === "undefined") {
return true;
@@ -3636,7 +3653,8 @@ export function isImmutable(node: Object, opts?: Object): boolean {
"JSXText" === nodeType ||
"JSXFragment" === nodeType ||
"JSXOpeningFragment" === nodeType ||
"JSXClosingFragment" === nodeType
"JSXClosingFragment" === nodeType ||
"BigIntLiteral" === nodeType
) {
if (typeof opts === "undefined") {
return true;