UNPKG

471 BJavaScriptView Raw
1'use strict';
2
3exports.__esModule = true;
4
5const { getScope } = require('./contextCompat');
6
7/** @type {import('./declaredScope').default} */
8exports.default = function declaredScope(context, name, node) {
9 const references = (node ? getScope(context, node) : context.getScope()).references;
10 const reference = references.find((x) => x.identifier.name === name);
11 if (!reference || !reference.resolved) { return undefined; }
12 return reference.resolved.scope.type;
13};