We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have this class method: (using Typescript 1.0.1 and latest lodash type definitions)
getSelected(type: string, one:boolean):void; getSelected(type: string, one:boolean):IDataItem[]; getSelected(type, one:boolean = true):IDataItem { if (one) { return _.reduce<IDataItem, IDataItem>(sections[type], (current: IDataItem, p: IDataItem) => { return p.selected === true ? p : current; }, void 0); } else { return _.filter<IDataItem>(sections[type], (p: IDataItem):boolean => { return p.selected === true && p.enabled === true; }); } }
it's giving me:
planner.ts(801,24): error TS2012: Cannot convert 'IDataItem[]' to 'IDataItem': Type 'IDataItem[]' is missing property 'name' from type 'IDataItem'.
for _.reduce, it works properly. sections[type] are IDataItem[]
_.reduce
sections[type]
IDataItem[]
The text was updated successfully, but these errors were encountered:
not a problem with lodash, but from my lack of understanding typescript overloads
Sorry, something went wrong.
No branches or pull requests
I have this class method: (using Typescript 1.0.1 and latest lodash type definitions)
it's giving me:
for
_.reduce
, it works properly.sections[type]
areIDataItem[]
The text was updated successfully, but these errors were encountered: