Adding functions from typescript lib files to analysis
- Langage dominant
- CodeQL
- Étoiles
- 10.1k
- Forks
- 2.1k
- Merge moyen
- 2 j 15 h
- PR mergées (30 j)
- 141
Description
Hello,
I want to be able to get the CallSignatureType for functions defined in the typescript lib files. I can't seem to get this to work. However, getting the getReturnTypeAnnotation seems to work for some functions. Please let me know how to add typescript lib files to my analysis so I can get call signatures consistently. Do I have to copy over the .d.ts files from the typescript source?
JavaScript file:
```
let x = BigInt.asUintN(64, 0);
let cachedTextEncoder = new TextEncoder('utf-8');
let y = cachedTextEncoder.encode("hi")
```
The following CodeQL query returns no results:
```
from Function called_function, CallExpr call
where called_function.getName() = call.getCalleeName()
select call, called_function.getCallSignature()
```
The following CodeQL query returns results for the `cachedTextEncoder.encode` call:
```
from Function called_function, CallExpr call
where called_function.getName() = call.getCalleeName()
select call, called_function.getCallSignature()
```
I am building the codeql database as follows after running `tsc --init` in the directory with the js file I want to analyze.
```
codeql database create --language=javascript -- ql_db
```
Thank you!
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Reproduisez le problème à l’aide du fichier JavaScript indiqué, de la commande de création de la base de données et des deux requêtes CodeQL. Commencez par vérifier comment les fichiers lib de TypeScript et leurs déclarations .d.ts sont inclus dans l’analyse ; le travail est terminé lorsque des appels tels que BigInt.asUintN et TextEncoder.encode exposent systématiquement un CallSignatureType.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, typescript
- Domaine
- devtools
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 35/100