最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

vue.js - javascript: What is a flow disable line? - Stack Overflow

programmeradmin0浏览0评论

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!

发布评论

评论列表(0)

  1. 暂无评论