gpt4 book ai didi

typescript - Visual Studio Code 中的红色下划线

转载 作者:搜寻专家 更新时间:2023-10-30 21:08:53 26 4
gpt4 key购买 nike

我有这些红色的花体:

enter image description here

我正在创建带下划线的变量,如下所示:

import SearchFilterViewModel = SearchFilter.SearchFilterViewModel;
import SearchResultsViewModel = SearchResults.SearchResultsViewModel;
import AddProductViewModel = AddProduct.AddProductViewModel;
import Validator = Validation.Validator;

module Bindings {
export class Binder {
constructor() {
searchFilterViewModel = new SearchFilterViewModel();
searchFilterViewModel.errors = ko.validation.group(searchFilterViewModel);
searchResultsViewModel = new SearchResultsViewModel();
addProductViewModel = new AddProductViewModel();
ko.applyBindings(searchFilterViewModel, $("#search-filter-page")[0]);
ko.applyBindings(searchResultsViewModel, $("#search-results-page")[0]);
ko.applyBindings(addProductViewModel, $("#add-product-page")[0]);
}
}
}

然后:

$(document).ready(function () {
//apply bindings
var binder = new Binder();
}

因此代码可以正常编译并运行。如何去掉那些红色下划线?

最佳答案

您必须声明属性(默认为公共(public)):

module Bindings {
export class Binder {
searchFilterViewModel:SearchFilterViewModel;
constructor() {
this.searchFilterViewModel = new SearchFilterViewModel();

关于typescript - Visual Studio Code 中的红色下划线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38452234/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com