root.body[0].type === 'ExpressionStatement' &&
root.body[0].expression
- ;(walk as any)(root, {
+ walk(root, {
enter(node: Node & { scopeIds?: Set<string> }, parent: Node | undefined) {
parent && parentStack.push(parent)
if (
node.type.endsWith('Statement')
) {
const scope: Statement[][] = [scriptSetupAst.body]
- ;(walk as any)(node, {
- enter(child: Node, parent: Node) {
+ walk(node, {
+ enter(child: Node, parent: Node | undefined) {
if (isFunctionType(child)) {
this.skip()
}
ctx,
child,
needsSemi,
- parent.type === 'ExpressionStatement'
+ parent!.type === 'ExpressionStatement'
)
}
},
// check root scope first
const ast = ctx.scriptSetupAst!
walkScope(ast, true)
- ;(walk as any)(ast, {
+ walk(ast, {
enter(node: Node, parent?: Node) {
parent && parentStack.push(parent)
export function saveAs(blob: any, name: any): void
}
+declare module 'estree-walker' {
+ export function walk<T>(
+ root: T,
+ options: {
+ enter?: (node: T, parent: T | undefined) => any
+ leave?: (node: T, parent: T | undefined) => any
+ exit?: (node: T) => any
+ } & ThisType<{ skip: () => void }>
+ )
+}
+
declare interface String {
/**
* @deprecated Please use String.prototype.slice instead of String.prototype.substring in the repository.
// check root scope first
walkScope(ast, true)
- ;(walk as any)(ast, {
+ walk(ast, {
enter(node: Node, parent?: Node) {
parent && parentStack.push(parent)
"newLine": "LF",
"useDefineForClassFields": false,
"module": "esnext",
- "moduleResolution": "node",
+ "moduleResolution": "bundler",
"allowJs": false,
"strict": true,
"noUnusedLocals": true,