jonaskello / tslint-immutable

TSLint rules to disable mutation in TypeScript.
MIT License
417 stars 14 forks source link

Rule "readonly-array" with option "ignore-return-type" doesn't work with generic parameters. #117

Closed yxliang01 closed 5 years ago

yxliang01 commented 5 years ago

I think for the case of Promise<any[]>, it should still be ignored (covered by this option)?

jonaskello commented 5 years ago

You mean something like this will give warnings when using gnore-return-type option with readonly-array?

function foo(bar: string): Promise<Array<string> {
  return Promise.resolve([]);
}

In that case I agree, the whole return-type should be ignored, including generic params.

yxliang01 commented 5 years ago

@jonaskello Thanks for coming up with this minimal example. :) Yes, this is what I meant.

RebeccaStevens commented 5 years ago

I've been having this issue too. I've been meaning to make an issue on here for it for ages now but never got around to it. Anyway, I'll make a PR to fix this soonish.