admin管理员组

文章数量:1430645

Reading the code of Vue.js I found this:

function isPrimitive (value) {
  return (
    typeof value === 'string' ||
    typeof value === 'number' ||
    // $flow-disable-line
    typeof value === 'symbol' ||
    typeof value === 'boolean'
  )
}

What is the purpose of the // $flow-disable-line ment? Does it alter in any way the evaluation?

Reading the code of Vue.js I found this:

function isPrimitive (value) {
  return (
    typeof value === 'string' ||
    typeof value === 'number' ||
    // $flow-disable-line
    typeof value === 'symbol' ||
    typeof value === 'boolean'
  )
}

What is the purpose of the // $flow-disable-line ment? Does it alter in any way the evaluation?

Share Improve this question asked Mar 18, 2018 at 21:13 mzcarlosmzcarlos 2213 silver badges12 bronze badges 1
  • 3 A google search for $flow-disable-line indicates that it disables Flow JS error reporting on the following line. – Pointy Commented Mar 18, 2018 at 21:14
Add a ment  | 

1 Answer 1

Reset to default 6

What is it

You will notice in the repo that there is a .flowconfig with the following option:

suppress_ment= \\(.\\|\n\\)*\\$flow-disable-line

Which seems to be a way to disable errors for the next line in Flow JS

Why does Vue use it

From flows documentation:

Symbols are not currently supported by Flow. You can see these two issues for more information (see link)

So since flow doesn't support symbols, and vue needs to utilize symbols, it only makes sense to disable errors on the line using them.

Hope this helps!

本文标签: vuejsjavascript What is a flow disable lineStack Overflow