add NodePath#baseTypeStrictlyMatches method

This commit is contained in:
Sebastian McKenzie 2015-06-25 22:55:46 +01:00
parent 45a5cbf72f
commit 01b243347f

View File

@ -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
*/