tsc does not pass after running reignore
I ran ts-migrate reignore . on my codebase. When I run tsc, I get a bunch of errors. I made sure that the version of tsc I'm using matches what ts-migrate bundles.
The 126 errors are in this gist.
I manually removed one of the error TS2578: Unused '@ts-expect-error' directive errors, and there was no problem on that line on a subsequent tsc run.
The TS2578: Unused '@ts-expect-error' directive are caused by https://github.com/dsherret/ts-morph/issues/925.
@NickHeiner ts-migrate 0.1.18 has been released with the latest @ts-morph/bootstrap, which should contain a fix for the upstream issue. Are you able to confirm whether it fixes this issue? I don't think there's quite enough information here for me to easily figure it out for myself.
Yes, I'll get back to this hopefully over the next few weeks, and I'll let you know.
Any news here? I'm facing the same issue. I have a cypress test doing cy.text().includes, somehow te-migrate doesn't know that .text() returns a string
It might not be too hard to parse tsc errors and do some simple string replacement "codemod", to remove unused @ts-expect-error
I'm evening seeing things like:
interface FOO {
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'Array'.
emails: Array<{
email: string
label: string
type: 'primary' | 'secondary'
}>
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'Record'.
selectedPreferences: Record<number, boolean>
}
And, with a very strict tsconfig.json compilerOptions, there are tons of other errors that are completely un-touched, when they should have a // @ts-expect-error comment added above them.
false alarm! Using latest ts-migrate (0.1.26) and this command:
yarn ts-migrate migrate . --plugin ts-ignore --sources="node_modules/**/*.d.ts" --sources="node_modules/@types/**/*.{ts,tsx}" --sources="apps/**/*.{ts,tsx}" --sources="libs/**/*.{ts,tsx}"
Seems to create proper @ts-expect-error comments if the --sources are set correctly...