Files
NapCatQQ/.pnpm-store/v3/files/cf/e25ff7312ded5bf91cd45569d8c107d62db3d792b51e86ddf0b5ced69affbb15a843846bef4f0946f1a0e074125c70777ca84d87a8554194a63202c17d0764
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

22 lines
747 B
Plaintext

"use strict"
/**
* Get the type of a node.
* If TypeScript isn't present, returns `null`.
*
* @param {import('estree').Node} node - A node
* @param {import('@typescript-eslint/parser').ParserServices} parserServices - A parserServices
* @returns {import('typescript').Type | null}
*/
module.exports = function getTypeOfNode(node, parserServices) {
const { esTreeNodeToTSNodeMap, program } = parserServices
if (program === null) {
return null
}
const tsNode = esTreeNodeToTSNodeMap.get(/** @type {any} */ (node))
const checker = program.getTypeChecker()
const nodeType = checker.getTypeAtLocation(tsNode)
const constrained = checker.getBaseConstraintOfType(nodeType)
return constrained ?? nodeType
}