mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #2896 from asger-semmle/typescript-3.8
TS: Support Typescript 3.8
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
import { ns } from "./reexport";
|
||||
|
||||
ns.foo();
|
||||
@@ -0,0 +1 @@
|
||||
export function foo() {}
|
||||
@@ -0,0 +1 @@
|
||||
export * as ns from "./lib";
|
||||
@@ -0,0 +1 @@
|
||||
| reexport.ts:1:8:1:14 | * as ns |
|
||||
@@ -0,0 +1,3 @@
|
||||
import javascript
|
||||
|
||||
query ExportNamespaceSpecifier test_ExportNamespaceSpecifier() { any() }
|
||||
@@ -0,0 +1,5 @@
|
||||
propAccess
|
||||
| #privateField | tst.ts:5:9:5:26 | this.#privateField |
|
||||
| #privateField | tst.ts:6:9:6:26 | this.#privateField |
|
||||
fieldDecl
|
||||
| #privateField | tst.ts:2:5:2:23 | #privateField: any; |
|
||||
@@ -0,0 +1,9 @@
|
||||
import javascript
|
||||
|
||||
query PropAccess propAccess(string name) {
|
||||
result.getPropertyName() = name
|
||||
}
|
||||
|
||||
query FieldDeclaration fieldDecl(string name) {
|
||||
result.getName() = name
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class C {
|
||||
#privateField: any;
|
||||
|
||||
constructor(x: any) {
|
||||
this.#privateField = x;
|
||||
this.#privateField(y);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export class C {}
|
||||
@@ -0,0 +1 @@
|
||||
export function f() {}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { ns } from "./importType";
|
||||
|
||||
ns.f(); // Calls local method in 'importType'
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { C } from "./namedReexport";
|
||||
|
||||
let c: C;
|
||||
@@ -0,0 +1,3 @@
|
||||
export type * as ns from "./exportFunction";
|
||||
|
||||
export var ns = { f() {} };
|
||||
@@ -0,0 +1 @@
|
||||
export type { C } from "./exportClass";
|
||||
@@ -0,0 +1,26 @@
|
||||
getAVarReference
|
||||
| C | exportClass.ts:1:14:1:14 | C |
|
||||
| Foo | tst.ts:5:5:5:7 | Foo |
|
||||
| c | importRexportedClass.ts:3:5:3:5 | c |
|
||||
| f | exportFunction.ts:1:17:1:17 | f |
|
||||
| ns | importFunction.ts:1:10:1:11 | ns |
|
||||
| ns | importFunction.ts:3:1:3:2 | ns |
|
||||
| ns | importType.ts:3:12:3:13 | ns |
|
||||
getAnExportAccess
|
||||
| Foo | tst.ts:3:15:3:17 | Foo |
|
||||
getATypeDecl
|
||||
| C | exportClass.ts:1:14:1:14 | C |
|
||||
| C | importRexportedClass.ts:1:15:1:15 | C |
|
||||
| Foo | tst.ts:1:15:1:17 | Foo |
|
||||
| ns | importFunction.ts:1:10:1:11 | ns |
|
||||
| types | tst.ts:7:18:7:22 | types |
|
||||
calls
|
||||
| importFunction.ts:3:1:3:6 | ns.f() | importType.ts:3:19:3:24 | f() {} |
|
||||
exportsAs
|
||||
| exportClass.ts:1:1:1:17 | export class C {} | C | C | type |
|
||||
| exportClass.ts:1:1:1:17 | export class C {} | C | C | variable |
|
||||
| exportFunction.ts:1:1:1:22 | export ... f() {} | f | f | variable |
|
||||
| importType.ts:3:1:3:27 | export ... ) {} }; | ns | ns | variable |
|
||||
| namedReexport.ts:1:1:1:39 | export ... Class"; | C | C | type |
|
||||
| tst.ts:3:1:3:20 | export type { Foo }; | Foo | Foo | namespace |
|
||||
| tst.ts:3:1:3:20 | export type { Foo }; | Foo | Foo | type |
|
||||
@@ -0,0 +1,22 @@
|
||||
import javascript
|
||||
|
||||
query VarRef getAVarReference(Variable v) {
|
||||
result = v.getAReference()
|
||||
}
|
||||
|
||||
query VarRef getAnExportAccess(LocalTypeName t) {
|
||||
result = t.getAnExportAccess()
|
||||
}
|
||||
|
||||
query TypeDecl getATypeDecl(LocalTypeName t) {
|
||||
result = t.getADeclaration()
|
||||
}
|
||||
|
||||
query Function calls(DataFlow::InvokeNode invoke) {
|
||||
result = invoke.getACallee()
|
||||
}
|
||||
|
||||
query predicate exportsAs(ExportDeclaration exprt, LexicalName v, string name, string kind) {
|
||||
exprt.exportsAs(v, name) and
|
||||
kind = v.getDeclarationSpace()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { Foo } from "foo";
|
||||
|
||||
export type { Foo };
|
||||
|
||||
var Foo = 45;
|
||||
|
||||
import type * as types from "types";
|
||||
|
||||
export type * as blah from "blah";
|
||||
@@ -3,3 +3,9 @@ class Foo {}
|
||||
|
||||
declare class Bar extends Baz {} // OK
|
||||
declare class Baz {}
|
||||
|
||||
export type { I }; // OK - does not refer to the constant 'I'
|
||||
|
||||
const I = 45;
|
||||
|
||||
interface I {}
|
||||
|
||||
Reference in New Issue
Block a user