Skip to content

Commit 0f5a468

Browse files
committed
fix types
1 parent 4361561 commit 0f5a468

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/pluginutils/src/attachScopes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const attachScopes: AttachScopes = function attachScopes(ast, propertyName = 'sc
106106
}
107107

108108
// create new block scope
109-
if (node.type === 'BlockStatement' && !/Function/.test(parent.type)) {
109+
if (node.type === 'BlockStatement' && parent && !/Function/.test(parent.type)) {
110110
newScope = new Scope({
111111
parent: scope,
112112
block: true

packages/pluginutils/types/index.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { BaseNode } from 'estree';
1+
import type { Node } from 'estree';
22

33
export interface AttachedScope {
44
parent?: AttachedScope;
55
isBlockScope: boolean;
66
declarations: { [key: string]: boolean };
7-
addDeclaration(node: BaseNode, isBlockDeclaration: boolean, isVar: boolean): void;
7+
addDeclaration(node: Node, isBlockDeclaration: boolean, isVar: boolean): void;
88
contains(name: string): boolean;
99
}
1010

@@ -37,7 +37,7 @@ export function addExtension(filename: string, ext?: string): string;
3737
* Each `Scope` object has a `scope.contains(name)` method that returns `true`
3838
* if a given name is defined in the current scope or a parent scope.
3939
*/
40-
export function attachScopes(ast: BaseNode, propertyName?: string): AttachedScope;
40+
export function attachScopes(ast: Node, propertyName?: string): AttachedScope;
4141

4242
/**
4343
* Constructs a filter function which can be used to determine whether or not
@@ -66,7 +66,7 @@ export function dataToEsm(data: unknown, options?: DataToEsmOptions): string;
6666
* Extracts the names of all assignment targets based upon specified patterns.
6767
* @param param An `acorn` AST Node.
6868
*/
69-
export function extractAssignedNames(param: BaseNode): string[];
69+
export function extractAssignedNames(param: Node): string[];
7070

7171
/**
7272
* Constructs a bundle-safe identifier from a `string`.

0 commit comments

Comments
 (0)