Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Convert suppression comments #207

Closed
kevinbarabash opened this issue Feb 24, 2021 · 7 comments
Closed

Convert suppression comments #207

kevinbarabash opened this issue Feb 24, 2021 · 7 comments
Assignees
Labels

Comments

@kevinbarabash
Copy link
Contributor

kevinbarabash commented Feb 24, 2021

e.g.

// $FlowIgnore -> @ts-ignore
// $FlowExpectError -> @ts-expect-error
// $FlowFixMe -> @ts-expect-error

There is no @ts-fix-me, see microsoft/TypeScript#28796

@kevinbarabash
Copy link
Contributor Author

@jtbandes fixing the comment positioning issue will be important for this this work right.

@kevinbarabash
Copy link
Contributor Author

Flow now supports having multiple line comment suppressions for a single expression, e.g.

// $FlowFixMe[prop-missing]
// $FlowFixMe[incompatible-exact]
// $FlowFixMe[incompatible-type]
studentList={studentList}

When handling situations like this we'll probably want to merge these into a single comment, e.g.

// $ts-expect-error: prop-missing, incompatible-type

I think we can drop $FlowFixMe[incompatible-exact] completely since TypeScript doesn't support exact types.

@kevinbarabash
Copy link
Contributor Author

There may be text after the error code, e.g.

// $FlowFixMe[prop-missing]: the `foo` prop is missing

If we're merging multiple comments like this we'll need to figure out a good pattern for doing so.

@kevinbarabash
Copy link
Contributor Author

It looks like @ts-ignore and @ts-expect-error must be in single line comments directly before the issue so we'll have to handle flow suppressions from block comments accordingly.

@meandmax
Copy link

Shouldn't suppressions be stripped as they might be completely different or not needed in TS? :)

@kevinbarabash
Copy link
Contributor Author

@meandmax that's a good point. If we strip out all of the flow suppressions it would be good to have a way to automatically add TypeScript suppressions in to the generated code. I wonder if there's tooling out there that already does this.

@kevinbarabash
Copy link
Contributor Author

Closing in preference of #284.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants