Skip to content

Commit c08be31

Browse files
authored
Fix tsc error (#1583)
1 parent 9856621 commit c08be31

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

Diff for: lib/rules/no-use-computed-property-like-method.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const utils = require('../utils')
1313
/**
1414
* @typedef {import('../utils').ComponentPropertyData} ComponentPropertyData
1515
* @typedef {import('../utils').ComponentObjectPropertyData} ComponentObjectPropertyData
16+
* @typedef {import('../utils').GroupName} GroupName
1617
*
1718
* @typedef {{[key: string]: ComponentPropertyData & { valueType: { type: string | null } }}} PropertyMap
1819
*/
@@ -167,7 +168,7 @@ const getValueType = ({ property, propertyMap }) => {
167168
}
168169

169170
/**
170-
* @param {Set<string>} groups
171+
* @param {Set<GroupName>} groups
171172
* @param {ObjectExpression} vueNodeMap
172173
* @param {PropertyMap} propertyMap
173174
*/
@@ -198,18 +199,15 @@ module.exports = {
198199
},
199200
/** @param {RuleContext} context */
200201
create(context) {
202+
/** @type {GroupName[]} */
201203
const GROUP_NAMES = ['data', 'props', 'computed', 'methods']
202204
const groups = new Set(GROUP_NAMES)
203205

204-
/** @type PropertyMap */
205-
const propertyMap = {}
206-
207-
/**@type ObjectExpression */
208-
let vueNodeMap = {}
206+
/** @type {PropertyMap} */
207+
const propertyMap = Object.create(null)
209208

210209
return utils.defineVueVisitor(context, {
211210
onVueObjectEnter(node) {
212-
vueNodeMap = node
213211
const properties = utils.iterateProperties(node, groups)
214212

215213
for (const property of properties) {
@@ -222,8 +220,11 @@ module.exports = {
222220
},
223221

224222
/** @param {ThisExpression} node */
225-
'CallExpression > MemberExpression > ThisExpression'(node) {
226-
addPropertyMap(groups, vueNodeMap, propertyMap)
223+
'CallExpression > MemberExpression > ThisExpression'(
224+
node,
225+
{ node: vueNode }
226+
) {
227+
addPropertyMap(groups, vueNode, propertyMap)
227228

228229
if (node.parent.type !== 'MemberExpression') return
229230
if (node.parent.property.type !== 'Identifier') return

Diff for: lib/utils/style-variables/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class StyleVariablesContext {
3131
}
3232
}
3333

34-
/** @type {Map<VElement, StyleVariablesContext} */
34+
/** @type {Map<VElement, StyleVariablesContext>} */
3535
const cache = new Map()
3636
/**
3737
* Get the style vars context

0 commit comments

Comments
 (0)