Skip to content

Commit 01309d7

Browse files
committed
TS: Add test for named re-export and exportsAs
1 parent 7895448 commit 01309d7

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export class C {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import type { C } from "./namedReexport";
2+
3+
let c: C;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type { C } from "./exportClass";
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
getAVarReference
2+
| C | exportClass.ts:1:14:1:14 | C |
23
| Foo | tst.ts:5:5:5:7 | Foo |
4+
| c | importRexportedClass.ts:3:5:3:5 | c |
35
| f | exportFunction.ts:1:17:1:17 | f |
46
| ns | importFunction.ts:1:10:1:11 | ns |
57
| ns | importFunction.ts:3:1:3:2 | ns |
68
| ns | importType.ts:3:12:3:13 | ns |
79
getAnExportAccess
810
| Foo | tst.ts:3:15:3:17 | Foo |
911
getATypeDecl
12+
| C | exportClass.ts:1:14:1:14 | C |
13+
| C | importRexportedClass.ts:1:15:1:15 | C |
1014
| Foo | tst.ts:1:15:1:17 | Foo |
1115
| ns | importFunction.ts:1:10:1:11 | ns |
1216
| types | tst.ts:7:18:7:22 | types |
1317
calls
1418
| importFunction.ts:3:1:3:6 | ns.f() | importType.ts:3:19:3:24 | f() {} |
19+
exportsAs
20+
| exportClass.ts:1:1:1:17 | export class C {} | C | C | type |
21+
| exportClass.ts:1:1:1:17 | export class C {} | C | C | variable |
22+
| exportFunction.ts:1:1:1:22 | export ... f() {} | f | f | variable |
23+
| importType.ts:3:1:3:27 | export ... ) {} }; | ns | ns | variable |
24+
| namedReexport.ts:1:1:1:39 | export ... Class"; | C | C | type |
25+
| tst.ts:3:1:3:20 | export type { Foo }; | Foo | Foo | namespace |
26+
| tst.ts:3:1:3:20 | export type { Foo }; | Foo | Foo | type |

javascript/ql/test/library-tests/TypeScript/TypeOnlyImportExport/test.ql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ query TypeDecl getATypeDecl(LocalTypeName t) {
1515
query Function calls(DataFlow::InvokeNode invoke) {
1616
result = invoke.getACallee()
1717
}
18+
19+
query predicate exportsAs(ExportDeclaration exprt, LexicalName v, string name, string kind) {
20+
exprt.exportsAs(v, name) and
21+
kind = v.getDeclarationSpace()
22+
}

0 commit comments

Comments
 (0)