Skip to content

Commit

Permalink
chore: remove acorn-walk ambient type definitions (#4391)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Feb 9, 2022
1 parent efd71e9 commit 903b464
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/utils/pureComments.ts
@@ -1,5 +1,5 @@
import * as acorn from 'acorn';
import { type BaseWalker, base as basicWalker } from 'acorn-walk';
import { base as basicWalker } from 'acorn-walk';
import {
BinaryExpression,
CallExpression,
Expand Down Expand Up @@ -29,7 +29,7 @@ interface NodeWithComments extends acorn.Node {
function handlePureAnnotationsOfNode(
node: acorn.Node,
state: CommentState,
type: string = node.type
type = node.type
): void {
const { annotations } = state;
let comment = annotations[state.annotationIndex];
Expand All @@ -38,7 +38,7 @@ function handlePureAnnotationsOfNode(
comment = annotations[++state.annotationIndex];
}
if (comment && comment.end <= node.end) {
(basicWalker as BaseWalker<CommentState>)[type](node, state, handlePureAnnotationsOfNode);
basicWalker[type](node, state, handlePureAnnotationsOfNode);
while ((comment = annotations[state.annotationIndex]) && comment.end <= node.end) {
++state.annotationIndex;
annotateNode(node, comment, false);
Expand Down
11 changes: 0 additions & 11 deletions typings/declarations.d.ts
Expand Up @@ -9,17 +9,6 @@ declare module 'rollup-plugin-string' {
export const string: import('rollup').PluginImpl;
}

declare module 'acorn-walk' {
type WalkerCallback<TState> = (node: acorn.Node, state: TState) => void;
type RecursiveWalkerFn<TState> = (
node: acorn.Node,
state: TState,
callback: WalkerCallback<TState>
) => void;
export type BaseWalker<TState> = Record<string, RecursiveWalkerFn<TState>>;
export const base: BaseWalker<unknown>;
}

declare module 'is-reference' {
export default function is_reference(
node: NodeWithFieldDefinition,
Expand Down

0 comments on commit 903b464

Please sign in to comment.