Skip to content

Commit e51d975

Browse files
committed
Fixed tsc error
1 parent a744a9d commit e51d975

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

lib/rules/require-valid-default-prop.js

+8-11
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,6 @@ module.exports = {
116116
* @type {ScopeStack | null}
117117
*/
118118
let scopeStack = null
119-
/**
120-
* @param {FunctionExpression | FunctionDeclaration | ArrowFunctionExpression} node
121-
*/
122-
function onFunctionEnter(node) {
123-
scopeStack = {
124-
upper: scopeStack,
125-
body: node.body,
126-
returnTypes: null
127-
}
128-
}
129119

130120
function onFunctionExit() {
131121
scopeStack = scopeStack && scopeStack.upper
@@ -300,7 +290,11 @@ module.exports = {
300290
* @param {VueObjectData} data
301291
*/
302292
':function'(node, { node: vueNode }) {
303-
onFunctionEnter(node)
293+
scopeStack = {
294+
upper: scopeStack,
295+
body: node.body,
296+
returnTypes: null
297+
}
304298

305299
const data = vueObjectPropsContexts.get(vueNode)
306300
if (!data) {
@@ -317,6 +311,9 @@ module.exports = {
317311
* @param {ReturnStatement} node
318312
*/
319313
ReturnStatement(node) {
314+
if (!scopeStack) {
315+
return
316+
}
320317
if (scopeStack.returnTypes && node.argument) {
321318
const type = getValueType(node.argument)
322319
if (type) {

0 commit comments

Comments
 (0)