Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insufficient error information #110

Closed
tomsseisums opened this issue Nov 22, 2017 · 2 comments
Closed

Insufficient error information #110

tomsseisums opened this issue Nov 22, 2017 · 2 comments

Comments

@tomsseisums
Copy link

tomsseisums commented Nov 22, 2017

I am setting up Vue environment with webpack, flow and eslint and testing out how it works.

Apparently, it didn't take much time to hit an interesting case.


Code:

// @flow
type DataFactory = () => { msg: string, bingo?: number }

type ModuleType = {
  +name: string,
  data: DataFactory
}

export default ({
  name: 'HelloWorld',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App',
      bingo: 'string'
    }
  }
} : ModuleType)

Interactive version @ flow.org


The type DataFactory requires that if bingo is provided, it should be a number. As can be seen in the export, it's a string.

On flow.org, that results in quite an expressive error:

9: export default ({                   
                   ^ object literal. This type is incompatible with
17: } : ModuleType)
        ^ object type
   Property `data` is incompatible:
      11:   data () {
                 ^ function. This type is incompatible with
      6:   data: DataFactory           
                 ^ function type
         This parameter is incompatible:
            12:     return {               
                           ^ object literal. This type is incompatible with
            2: type DataFactory = () => { msg: string, bingo?: number }                            
                                        ^ object type
               Property `bingo` is incompatible:
                  14:       bingo: 'string'                 
                                   ^ string. This type is incompatible with
                  2: type DataFactory = () => { msg: string, bingo?: number }
                                                                     ^ number

Where as with eslint, I get:

> yarn lint --no-color --format codeframe
yarn run v1.3.2
$ eslint --ext .js,.vue src --no-color --format codeframe
error: object literal:  This type is incompatible with 'object type'. See line 17 (flowtype-errors/show-errors) at src\components\HelloWorld.vue:33:17:
  31 | }
  32 |
> 33 | export default ({
     |                 ^
  34 |   name: 'HelloWorld',
  35 |   data () {
  36 |     return {


1 error found.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Which appears to be the first message reported (matches the one on flow.org), though, the least descriptive one.

Is it a configuration error or a bug or missing feature or...?

@jdmota
Copy link
Collaborator

jdmota commented Jun 4, 2018

Flow's output changed since this issue was reported. Do you still think that we should output more information? Or can this be closed? Thanks

@tomsseisums
Copy link
Author

I haven't expanded upon this ever since.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants