Function: isGlobalTypeReferenceNamed()
function isGlobalTypeReferenceNamed<MessageIds, Options>(
context: Readonly<TSESLint.RuleContext<MessageIds, Options>>,
node: Readonly<TypeNode>,
typeName: string
): node is TSTypeReference & { typeName: Identifier };
Defined in: _internal/type-reference-node.ts:67
Checks whether a type node references a global type, such as a built-in TypeScript utility type, rather than a same-named local type.
Type Parametersโ
MessageIdsโ
MessageIds extends string
Optionsโ
Options extends readonly unknown[]
Parametersโ
contextโ
Readonly<TSESLint.RuleContext<MessageIds, Options>>
Rule context used for scope resolution.
nodeโ
Readonly<TypeNode>
Type node candidate.
typeNameโ
string
Expected global type name.
Returnsโ
node is TSTypeReference & { typeName: Identifier }
true when the node is an identifier type reference with the
expected name that resolves to the global type.
Remarksโ
A type declared in any enclosing non-global scope (type alias, interface,
class, enum, import, or type parameter) shadows the global type. Value-only
bindings such as const Omit = 1 do not, because types and values live in
separate namespaces. Declarations in the global scope itself, such as
interface merging in a script file, augment the global type instead of
replacing it, so they still count as global.