Skip to content

Commit

Permalink
Fix tsc error (#1583)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Jul 29, 2021
1 parent 9856621 commit c08be31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions lib/rules/no-use-computed-property-like-method.js
Expand Up @@ -13,6 +13,7 @@ const utils = require('../utils')
/**
* @typedef {import('../utils').ComponentPropertyData} ComponentPropertyData
* @typedef {import('../utils').ComponentObjectPropertyData} ComponentObjectPropertyData
* @typedef {import('../utils').GroupName} GroupName
*
* @typedef {{[key: string]: ComponentPropertyData & { valueType: { type: string | null } }}} PropertyMap
*/
Expand Down Expand Up @@ -167,7 +168,7 @@ const getValueType = ({ property, propertyMap }) => {
}

/**
* @param {Set<string>} groups
* @param {Set<GroupName>} groups
* @param {ObjectExpression} vueNodeMap
* @param {PropertyMap} propertyMap
*/
Expand Down Expand Up @@ -198,18 +199,15 @@ module.exports = {
},
/** @param {RuleContext} context */
create(context) {
/** @type {GroupName[]} */
const GROUP_NAMES = ['data', 'props', 'computed', 'methods']
const groups = new Set(GROUP_NAMES)

/** @type PropertyMap */
const propertyMap = {}

/**@type ObjectExpression */
let vueNodeMap = {}
/** @type {PropertyMap} */
const propertyMap = Object.create(null)

return utils.defineVueVisitor(context, {
onVueObjectEnter(node) {
vueNodeMap = node
const properties = utils.iterateProperties(node, groups)

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

/** @param {ThisExpression} node */
'CallExpression > MemberExpression > ThisExpression'(node) {
addPropertyMap(groups, vueNodeMap, propertyMap)
'CallExpression > MemberExpression > ThisExpression'(
node,
{ node: vueNode }
) {
addPropertyMap(groups, vueNode, propertyMap)

if (node.parent.type !== 'MemberExpression') return
if (node.parent.property.type !== 'Identifier') return
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/style-variables/index.js
Expand Up @@ -31,7 +31,7 @@ class StyleVariablesContext {
}
}

/** @type {Map<VElement, StyleVariablesContext} */
/** @type {Map<VElement, StyleVariablesContext>} */
const cache = new Map()
/**
* Get the style vars context
Expand Down

0 comments on commit c08be31

Please sign in to comment.