flowts icon indicating copy to clipboard operation
flowts copied to clipboard

Remove suppression comments

Open meandmax opened this issue 4 years ago • 4 comments

What do you think about removing all sorts of flow suppression comments? Happy to do it if nothing speaks against it :)

meandmax avatar Jun 20 '21 06:06 meandmax

While it is easy to remove, and in many cases it indeed can be removed - often there can be same sort of type error to be ignored in typescript as well…

So decided to better keep it as is to have additional hints when manually fixing remaining types after migration

zxbodya avatar Jun 20 '21 18:06 zxbodya

Interesting :) I believe in our codebase most of the suppression comments are added due to flow and only in rare cases there would be a similar issue in TS. Have you thought about removing them and automatically adding ts suppressions at the end of the conversion? Wit something like: https://github.com/airbnb/ts-migrate/blob/master/packages/ts-migrate-plugins/src/plugins/ts-ignore.ts

meandmax avatar Jun 20 '21 22:06 meandmax

May be we could add that functionality behind a cli flag? :)

meandmax avatar Jun 20 '21 22:06 meandmax

Indeed, I have similar observation :) But still - in some cases, there is a similar issue with TS, so would it useful.

About having automatic ts-ignores - that is indeed something, I am planing to look into, that would be indeed very helpful to unblock migration in some cases.

However, on its own, I think, it will add more ignores that is actually needed…

And, I am thinking to do it only as part of bigger effort:

  • adding logic to generate tsconfig (both simple case and monorepo with project references)
  • installing missing type definitions
  • trying to fix typical error patterns using type information (for example, one such case I noticed - having functional components returning ReactNode… which is fine in flow but is not for TS)

zxbodya avatar Jun 20 '21 22:06 zxbodya