Meituan-Dianping/mpvue · error

props must be strings when using array syntax.

Error message

props must be strings when using array syntax.

What it means

Raised in normalizeProps while converting the props option to the canonical object format: the option is an array (the shorthand syntax props: ['foo', 'bar']) but one of its entries is not a string (a number, object, null, etc.). Only string entries can be camelized into prop names; the offending entry is skipped, so the resulting component silently lacks that prop.

Source

Thrown at src/core/util/options.js:254

/**
 * Ensure all props option syntax are normalized into the
 * Object-based format.
 */
function normalizeProps (options: Object) {
  const props = options.props
  if (!props) return
  const res = {}
  let i, val, name
  if (Array.isArray(props)) {
    i = props.length
    while (i--) {
      val = props[i]
      if (typeof val === 'string') {
        name = camelize(val)
        res[name] = { type: null }
      } else if (process.env.NODE_ENV !== 'production') {
        warn('props must be strings when using array syntax.')
      }
    }
  } else if (isPlainObject(props)) {
    for (const key in props) {
      val = props[key]
      name = camelize(key)
      res[name] = isPlainObject(val)
        ? val
        : { type: val }
    }
  }
  options.props = res
}

/**
 * Normalize all injections into Object-based format
 */
function normalizeInject (options: Object) {

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Make every array entry a string: props: ['title', 'isVisible']
  2. For props needing types/defaults, use object syntax: props: { title: String, count: { type: Number, default: 0 } }
  3. Check for accidental non-string values from spreads, computed keys, or copy-paste into the array
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/core/util/options.js:254 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Meituan-Dianping/mpvue@6c5d78ee04 (2026-09-02). Data as JSON: /api/errors/639de51fdea3a580. Report an issue: GitHub.