Closed as not planned
Closed as not planned
Description
⚙ Compilation target
N/A
⚙ Library
N/A
Missing / Incorrect Definition
From src/compiler/checker.ts
:
isArrayType(type: Type): type is TypeReference;
This implies that if isArrayType
returns false then type
is not a TypeReference
which may not be the case as pointed out by #55010 (comment).
If instead an interface ArrayType was added like so:
interface ArrayType extends TypeReference {}
and isArrayType
updated like so:
isArrayType(type: Type): type is ArrayType;
Then the signature would be safe and correct. This will then allow the externally available compiler API to match the internal one. Currently because the internal signature of isArrayType
is not safe the external signature instead is:
isArrayType(type: Type): boolean;
Sample Code
if (typeChecker.isArrayType(type)) {
// complains that type is not TypeReference
typeChecker.getTypeArguments(type);
}
Documentation Link
Continuation of #55010