linq icon indicating copy to clipboard operation
linq copied to clipboard

When using a string for the selector using TypeScript it doe snot compile. Please help I am not very familiar with TypeScript

Open ferodom opened this issue 7 years ago • 2 comments

Like doing this Enumerable.from(dataVals).where("$.indexOf("" + parameterName + "") !== -1").singleOrDefault("", "$").replace(/+/g, " ").split("=")[1];

instead of doing return Enumerable.from(dataVals).where(p=> p.indexOf(parameterName) !== -1).singleOrDefault().replace(/+/g, " ").split("=")[1];

for most cases I can rewrite but I have a few specific that it is easier to use the string selector

Thanks

ferodom avatar Jan 05 '18 20:01 ferodom

I haven't tried this, but I notice that you have some double quotes in there. Not sure what that is about...shouldn't it be: where("$.indexOf(" + parameterName + ") !== -1") ?

mihaifm avatar Jan 07 '18 17:01 mihaifm

I looked at the typescript definitions and if I want to use the "$." syntax all I have to do is add the following typing. select<TResult>(selector: string): IEnumerable<TResult>; in addition to select<TResult>(selector: (element: T, index: number) => TResult): IEnumerable<TResult>;

What do you think? I could submit a pull request

ferodom avatar Jan 18 '18 17:01 ferodom