Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@typescript-eslint/scope-manager

Package Overview
Dependencies
Maintainers
1
Versions
3178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typescript-eslint/scope-manager - npm Package Compare versions

Comparing version 4.0.2-alpha.10 to 4.0.2-alpha.11

1

dist/referencer/TypeVisitor.d.ts

@@ -18,2 +18,3 @@ import { TSESTree } from '@typescript-eslint/types';

protected TSIndexSignature(node: TSESTree.TSIndexSignature): void;
protected TSInferType(node: TSESTree.TSInferType): void;
protected TSInterfaceDeclaration(node: TSESTree.TSInterfaceDeclaration): void;

@@ -20,0 +21,0 @@ protected TSMappedType(node: TSESTree.TSMappedType): void;

@@ -21,2 +21,3 @@ "use strict";

const definition_1 = require("../definition");
const scope_1 = require("../scope");
class TypeVisitor extends Visitor_1.Visitor {

@@ -102,2 +103,30 @@ constructor(referencer) {

}
TSInferType(node) {
const typeParameter = node.typeParameter;
let scope = __classPrivateFieldGet(this, _referencer).currentScope();
/*
In cases where there is a sub-type scope created within a conditional type, then the generic should be defined in the
conditional type's scope, not the child type scope.
If we define it within the child type's scope then it won't be able to be referenced outside the child type
*/
if (scope.type === scope_1.ScopeType.functionType ||
scope.type === scope_1.ScopeType.mappedType) {
// search up the scope tree to figure out if we're in a nested type scope
let currentScope = scope.upper;
while (currentScope) {
if (currentScope.type === scope_1.ScopeType.functionType ||
currentScope.type === scope_1.ScopeType.mappedType) {
// ensure valid type parents only
currentScope = currentScope.upper;
continue;
}
if (currentScope.type === scope_1.ScopeType.conditionalType) {
scope = currentScope;
break;
}
break;
}
}
scope.defineIdentifier(typeParameter.name, new definition_1.TypeDefinition(typeParameter.name, typeParameter));
}
TSInterfaceDeclaration(node) {

@@ -104,0 +133,0 @@ var _a, _b;

10

package.json
{
"name": "@typescript-eslint/scope-manager",
"version": "4.0.2-alpha.10+4d3ce5f6",
"version": "4.0.2-alpha.11+95f6bf48",
"description": "TypeScript scope analyser for ESLint",

@@ -42,8 +42,8 @@ "keywords": [

"dependencies": {
"@typescript-eslint/types": "4.0.2-alpha.10+4d3ce5f6",
"@typescript-eslint/visitor-keys": "4.0.2-alpha.10+4d3ce5f6"
"@typescript-eslint/types": "4.0.2-alpha.11+95f6bf48",
"@typescript-eslint/visitor-keys": "4.0.2-alpha.11+95f6bf48"
},
"devDependencies": {
"@types/glob": "*",
"@typescript-eslint/typescript-estree": "4.0.2-alpha.10+4d3ce5f6",
"@typescript-eslint/typescript-estree": "4.0.2-alpha.11+95f6bf48",
"glob": "*",

@@ -68,3 +68,3 @@ "jest-specific-snapshot": "*",

},
"gitHead": "4d3ce5f696985389bf53a31d62766041c703c70c"
"gitHead": "95f6bf4818cdec48a0583bf82f928c598af22736"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc