TS: Extract type alias relation

This commit is contained in:
Asger F
2019-11-14 16:00:23 +00:00
parent f11dc11ade
commit e25ee182a0
7 changed files with 84 additions and 4 deletions

View File

@@ -3,6 +3,13 @@ rightHandSide
| tst.ts:2:1:2:16 | type B<T> = T[]; | T[] |
| tst.ts:8:10:8:20 | type C = A; | number |
| tst.ts:15:1:15:23 | type Un ... \| Two; | One \| Two |
getAliasedType
| B<T> | T[] |
| B<number> | number[] |
| Union | One \| Two |
getTypeArgument
| B<T> | 0 | T |
| B<number> | 0 | number |
#select
| tst.ts:1:1:1:16 | type A = number; | tst.ts:1:6:1:6 | A | 0 | tst.ts:1:10:1:15 | number |
| tst.ts:2:1:2:16 | type B<T> = T[]; | tst.ts:2:6:2:6 | B | 1 | tst.ts:2:13:2:15 | T[] |

View File

@@ -6,3 +6,11 @@ select decl, decl.getIdentifier(), decl.getNumTypeParameter(), decl.getDefinitio
query Type rightHandSide(TypeAliasDeclaration decl) {
result = decl.getDefinition().getType()
}
query Type getAliasedType(TypeAliasReference ref) {
result = ref.getAliasedType()
}
query Type getTypeArgument(TypeAliasReference ref, int n) {
result = ref.getTypeArgument(n)
}