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

Bind function proposal sometimes marked as invalid #18

Open
karolyi opened this issue Mar 28, 2020 · 2 comments
Open

Bind function proposal sometimes marked as invalid #18

karolyi opened this issue Mar 28, 2020 · 2 comments

Comments

@karolyi
Copy link

karolyi commented Mar 28, 2020

Hey,

I use a bind function proposal in my code that I added to my .babelrc:

{
  "presets": [
    "@babel/preset-env"
  ],
  "plugins": [
    "@babel/plugin-proposal-function-bind"
  ]
}

It basically is a notation with which you can use bound function calls without having to use Function.prototype.bind(). An example:

testfunction.bind(this)(param1, param2)

will become

::testfunction(param1, param2)

Here's the problem: lsp-tsserver sometimes marks the :: as invalid (saying expression expected:
image

However, if I put import range from 'lodash/range' to the imports part (the beginning), the error disappears. Honestly, this makes no sense at all:
image

Do you have any idea as to why this could happen?

@rchl
Copy link

rchl commented Mar 28, 2020

Note that this syntax doesn't seem to be supported by Typescript and I believe (might be wrong) that babel configuration is not relevant to typescript checking itself.
So in theory the expected result might be to always mark it as invalid.

@karolyi
Copy link
Author

karolyi commented Mar 28, 2020

test.zip
posting a minimal example.

Ignore the other errors, and focus on the :: part. If you remove the import range line, it will start marking the :: as invalid.

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