Error: Void function return value is used
Error: Void function return value is used
我在 Symfony 5 中使用 Stimulus,当我在 Stimulus 控制器中使用此代码时,PhpStorm 显示错误。
我该如何解决这个问题?
import {Controller} from 'stimulus';
import {index} from "../js/index";
export default class extends Controller{
connect(){
const index1 = index();
}
}
Error: Void function return value is used
我的index()
函数是:
export function index(){
...
}
使用此代码:
import {Controller} from 'stimulus';
import Index from "../js/index";
export default class extends Controller{
connect(){
const index1 = new Index;
index1.index();
}
}
并将其用于您的索引 class:
export default class Index {
index(){
...
}
}
我在 Symfony 5 中使用 Stimulus,当我在 Stimulus 控制器中使用此代码时,PhpStorm 显示错误。
我该如何解决这个问题?
import {Controller} from 'stimulus';
import {index} from "../js/index";
export default class extends Controller{
connect(){
const index1 = index();
}
}
Error: Void function return value is used
我的index()
函数是:
export function index(){
...
}
使用此代码:
import {Controller} from 'stimulus';
import Index from "../js/index";
export default class extends Controller{
connect(){
const index1 = new Index;
index1.index();
}
}
并将其用于您的索引 class:
export default class Index {
index(){
...
}
}