When we run TS code that has type errors, the code doesn't run but the logs also aren't cleared:
{
// The first time we run code, the fetch request for the lib data may still be pending.
const libData = await this.libData
const typeErrors = getTSTypeErrors(code, this.ts, libData)
if (typeErrors.length === 0) {
// If there are no errors, we can run the code
this.logs = []
// eslint-disable-next-line no-eval
eval((await this.ts.transpile(code)) as string)
}
return { errors: typeErrors, output: this.logs }
}
I think this is confusing and it might make more sense to clear the logs if there are type errors
An error will be displayed: "Cannot find name 'abc'." This message comes from the latest code
The output will remain "hello". This is confusing because this message comes from the previous code, the latest has not actually run
Expected behavior A clear and concise description of what you expected to happen.
I think it'd be clearer if we cleared the output logs when there are type errors. This way the errors + output will always both match the latest running code.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Describe the bug
When we run TS code that has type errors, the code doesn't run but the logs also aren't cleared:
I think this is confusing and it might make more sense to clear the logs if there are type errors
To Reproduce Steps to reproduce the behavior:
console.log("hello")
hello
Expected behavior A clear and concise description of what you expected to happen.
I think it'd be clearer if we cleared the output logs when there are type errors. This way the errors + output will always both match the latest running code.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):