add NodePath#baseTypeStrictlyMatches method
This commit is contained in:
parent
45a5cbf72f
commit
01b243347f
@ -76,6 +76,8 @@ function _isBaseType(baseName: string, type?, soft?): boolean {
|
||||
return t.isAnyTypeAnnotation(type);
|
||||
} else if (baseName === "mixed") {
|
||||
return t.isMixedTypeAnnotation(type);
|
||||
} else if (baseName === "void") {
|
||||
return t.isVoidTypeAnnotation(type);
|
||||
} else {
|
||||
if (soft) {
|
||||
return false;
|
||||
@ -105,6 +107,19 @@ export function couldBeBaseType(name: string): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
export function baseTypeStrictlyMatches(right: NodePath) {
|
||||
var left = this.getTypeAnnotation();
|
||||
right = right.getTypeAnnotation();
|
||||
|
||||
if (!t.isAnyTypeAnnotation() && t.isFlowBaseAnnotation(left)) {
|
||||
return right.type === left.type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user