-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Updated Encore object to class for proxy typehinting #263
Updated Encore object to class for proxy typehinting #263
Conversation
8649de6
to
79dbee8
Compare
index.js
Outdated
|
||
// Proxy the API in order to prevent calls to most of its methods | ||
// if the webpackConfig object hasn't been initialized yet. | ||
const publicApiProxy = new Proxy(publicApi, { | ||
const EncoreProxy = new Proxy(Encore, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Encore
class should be instanciated there:
const EncoreProxy = new Proxy(new Encore(), { /* ... */ });
Hey @florentdestremau, Thanks for working on that, only a small thing to fix and all the tests will probably pass :) |
You also forgot to replace some
|
69e6f06
to
fb7498d
Compare
@Lyrkan not sure what to do for the |
@florentdestremau You can leave that one, it represents the config generated by Encore, not the API. I can't really test if the autocompletion works right now (no PHPStorm) but based on the code it looks good to me :) |
This doesn't solve the problem for me actually, when I copy / paste my new Edit: Confirmed, by using my fork I still get |
Did you try closing/reopening PHPStorm and your |
Yes, tried reinstalling node modules after removing them and no results.
|
@florentdestremau I'm back on a computer with PHPStorm and it seems to work, maybe that's related to your PhpStorm configuration? |
Damn, so this is a new problem on my side now 😅 |
Woohoo! Thanks @florentdestremau! Actually, this also didn't work for me at first. Well, it auto-completed only the first 4 methods. The problem was my JavaScript version setting. In PhpStorm, make sure you're using ECMAScript 6 (it defaults to ECMAScript 5.1). This made all the difference for me :) |
…orentdestremau) This PR was squashed before being merged into the master branch (closes #263). Discussion ---------- Updated Encore object to class for proxy typehinting Hello, I'm trying to address #151 with this PR. I have an error in my tests: ``` Public API setOutputPath Error: Encore.configureRuntimeEnvironment is not a recognized property or method. - index.js:942 Object.get /home/florent/dev/opensource/webpack-encore/index.js:942:27 - index.js:17 Context.beforeEach /home/florent/dev/opensource/webpack-encore/test/index.js:17:13 - runnable.js:348 callFn [webpack-encore]/[mocha]/lib/runnable.js:348:21 - runnable.js:340 Hook.Runnable.run [webpack-encore]/[mocha]/lib/runnable.js:340:7 - runner.js:309 next [webpack-encore]/[mocha]/lib/runner.js:309:10 - runner.js:339 Immediate.<anonymous> [webpack-encore]/[mocha]/lib/runner.js:339:5 - timers.js:789 runCallback ``` I'm looking into it but any advice would be welcome so that we all get a proper proxy and autocomplete on :heart: *PHPSTORM* :heart: Commits ------- fb7498d Initiated class in proxy, uniformized @returns 79dbee8 Updated Encore object to class for proxy typehinting
@weaverryan nice catch ! Indeed it works fine with ES6. Love it ! Should #151 be closed then ? |
Hello, I'm trying to address #151 with this PR.
I have an error in my tests:
I'm looking into it but any advice would be welcome so that we all get a proper proxy and autocomplete on ❤️ PHPSTORM ❤️