mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #9266 from asgerf/js/madman-prep
JS: Some fixes to support proper analysis of d.ts files
This commit is contained in:
11
javascript/ql/test/library-tests/TypeScript/RegressionTests/ExportBaseResolution/test.d.ts
vendored
Normal file
11
javascript/ql/test/library-tests/TypeScript/RegressionTests/ExportBaseResolution/test.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
declare namespace A.B {
|
||||
namespace C {
|
||||
interface I { }
|
||||
}
|
||||
declare var C: number;
|
||||
declare interface C { }
|
||||
}
|
||||
|
||||
declare module 'test' {
|
||||
export = A.B.C;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
| A | namespace | test.d.ts:1:19:1:19 | A | test.d.ts:10:14:10:14 | A |
|
||||
| A | variable | test.d.ts:1:19:1:19 | A | test.d.ts:10:14:10:14 | A |
|
||||
@@ -0,0 +1,5 @@
|
||||
import javascript
|
||||
|
||||
from LexicalName name, LexicalDecl decl, LexicalAccess access
|
||||
where decl.getALexicalName() = name and access.getALexicalName() = name
|
||||
select name.getName(), name.getDeclarationSpace(), decl, access
|
||||
@@ -0,0 +1,3 @@
|
||||
// This file has a corresponding .js file, which will be preferred by import resolution.
|
||||
|
||||
export const x: number;
|
||||
@@ -0,0 +1 @@
|
||||
export const x = 42;
|
||||
@@ -0,0 +1,5 @@
|
||||
import * as declFile from "./only-declaration-file";
|
||||
import * as jsFile from "./has-javascript-file";
|
||||
|
||||
console.log(declFile.x);
|
||||
console.log(jsFile.x);
|
||||
@@ -0,0 +1,3 @@
|
||||
// This file has no corresponding implementation, so it should be seen by import resolution.
|
||||
|
||||
export const x: number;
|
||||
@@ -0,0 +1,2 @@
|
||||
| main.ts:1:1:1:52 | import ... -file"; | ./only-declaration-file | only-declaration-file.d.ts:3:1:4:0 | <toplevel> |
|
||||
| main.ts:2:1:2:48 | import ... -file"; | ./has-javascript-file | has-javascript-file.js:1:1:2:0 | <toplevel> |
|
||||
@@ -0,0 +1,4 @@
|
||||
import javascript
|
||||
|
||||
from Import imprt
|
||||
select imprt, imprt.getImportedPath().getValue(), imprt.getImportedModule()
|
||||
Reference in New Issue
Block a user