Generate types for TSImportType

This commit is contained in:
Nicolò Ribaudo 2019-01-11 11:46:15 +01:00
parent 4c2f8d9337
commit 28b70e5910
3 changed files with 24 additions and 1 deletions

View File

@ -939,6 +939,9 @@ export function assertTSModuleDeclaration(
export function assertTSModuleBlock(node: Object, opts?: Object = {}): void {
assert("TSModuleBlock", node, opts);
}
export function assertTSImportType(node: Object, opts?: Object = {}): void {
assert("TSImportType", node, opts);
}
export function assertTSImportEqualsDeclaration(
node: Object,
opts?: Object = {},

View File

@ -914,6 +914,11 @@ export function TSModuleBlock(...args: Array<any>): Object {
}
export { TSModuleBlock as tsModuleBlock };
export { TSModuleBlock as tSModuleBlock };
export function TSImportType(...args: Array<any>): Object {
return builder("TSImportType", ...args);
}
export { TSImportType as tsImportType };
export { TSImportType as tSImportType };
export function TSImportEqualsDeclaration(...args: Array<any>): Object {
return builder("TSImportEqualsDeclaration", ...args);
}

View File

@ -3031,6 +3031,20 @@ export function isTSModuleBlock(node: Object, opts?: Object): boolean {
return false;
}
export function isTSImportType(node: Object, opts?: Object): boolean {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSImportType") {
if (typeof opts === "undefined") {
return true;
} else {
return shallowEqual(node, opts);
}
}
return false;
}
export function isTSImportEqualsDeclaration(
node: Object,
opts?: Object,
@ -4254,7 +4268,8 @@ export function isTSType(node: Object, opts?: Object): boolean {
"TSIndexedAccessType" === nodeType ||
"TSMappedType" === nodeType ||
"TSLiteralType" === nodeType ||
"TSExpressionWithTypeArguments" === nodeType
"TSExpressionWithTypeArguments" === nodeType ||
"TSImportType" === nodeType
) {
if (typeof opts === "undefined") {
return true;