mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
TypeScript: support syntax for optional tuple type elements
This commit is contained in:
@@ -1073,6 +1073,14 @@ class IsTypeExpr extends @istypeexpr, TypeExpr {
|
||||
TypeExpr getPredicateType() { result = this.getChildTypeExpr(1) }
|
||||
}
|
||||
|
||||
/**
|
||||
* An optional type element in a tuple type, such as `number?` in `[string, number?]`.
|
||||
*/
|
||||
class OptionalTypeExpr extends @optionaltypeexpr, TypeExpr {
|
||||
/** Gets the type `T` in `T?` */
|
||||
TypeExpr getElementType() { result = getChildTypeExpr(0) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A possibly qualified name that refers to a variable from inside a type.
|
||||
*
|
||||
|
||||
@@ -556,7 +556,9 @@ case @typeexpr.kind of
|
||||
| 29 = @infertypeexpr
|
||||
| 30 = @importtypeaccess
|
||||
| 31 = @importnamespaceaccess
|
||||
| 32 = @importvartypeaccess;
|
||||
| 32 = @importvartypeaccess
|
||||
| 33 = @optionaltypeexpr
|
||||
;
|
||||
|
||||
@typeref = @typeaccess | @typedecl;
|
||||
@typeidentifier = @typedecl | @localtypeaccess | @typelabel | @localvartypeaccess | @localnamespaceaccess;
|
||||
|
||||
Reference in New Issue
Block a user