0
我有兩個數據集,每個數據集都是不同的泛型類型。一切正常,除了在初始化其中用於Typeahead/TypeScript - 多個不同類型的數據集
var localDataset: Twitter.Typeahead.Dataset<Node>;
var globalDataset: Twitter.Typeahead.Dataset<Budget>;
...
typeahead(options, localDataset, globalDataset);
我得到的錯誤
Error:(130, 13) TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'Node' is not a valid type argument because it is not a supertype of candidate 'Budget'.
作爲一種變通方法我投的數據集但什麼是正確的解決方案?