mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
TypeScript: support unknown static type
This commit is contained in:
@@ -2188,6 +2188,11 @@ class TupleType extends ArrayType, @tupletype {
|
||||
*/
|
||||
class AnyType extends Type, @anytype {}
|
||||
|
||||
/**
|
||||
* The predefined `unknown` type.
|
||||
*/
|
||||
class UnknownType extends Type, @unknowntype {}
|
||||
|
||||
/**
|
||||
* The predefined `string` type.
|
||||
*/
|
||||
|
||||
@@ -610,6 +610,7 @@ case @type.kind of
|
||||
| 20 = @thistype
|
||||
| 21 = @numberliteraltype
|
||||
| 22 = @stringliteraltype
|
||||
| 23 = @unknowntype
|
||||
;
|
||||
|
||||
@booleanliteraltype = @truetype | @falsetype;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| tst.ts:40:5:40:15 | unknownType | unknown |
|
||||
@@ -0,0 +1,5 @@
|
||||
import javascript
|
||||
|
||||
from Expr e
|
||||
where e.getType() instanceof UnknownType
|
||||
select e, e.getType()
|
||||
@@ -32,3 +32,9 @@ const uniqueSymbolType: unique symbol = null;
|
||||
let objectType: object;
|
||||
let intersection: string & {x: string};
|
||||
let tuple: [number, string];
|
||||
|
||||
let tupleWithOptionalElement: [number, string, number?];
|
||||
let emptyTuple: [];
|
||||
let tupleWithRestElement: [number, ...string[]];
|
||||
let tupleWithOptionalAndRestElements: [number, string?, ...number[]];
|
||||
let unknownType: unknown;
|
||||
Reference in New Issue
Block a user