TS: Support const type assertions

This commit is contained in:
Asger F
2019-04-10 12:54:42 +01:00
parent d5ae69d40a
commit c1c7ebfc48
9 changed files with 51 additions and 9 deletions

View File

@@ -585,6 +585,9 @@ class TypeExpr extends ExprOrType, @typeexpr {
/** Holds if this is the `bigint` type. */
predicate isBigInt() { none() }
/** Holds if this is the `const` keyword, occurding in a type assertion such as `x as const`. */
predicate isConstKeyword() { none() }
/** Gets this type expression, with any surrounding parentheses removed. */
override TypeExpr stripParens() { result = this }
@@ -638,6 +641,8 @@ private class KeywordTypeExpr extends @keywordtypeexpr, TypeExpr {
override predicate isUnknownKeyword() { getName() = "unknown" }
override predicate isBigInt() { getName() = "bigint" }
override predicate isConstKeyword() { getName() = "const" }
}
/**