deno test and deno test --no-check get different results due to declaration #10861
Labels
bug
Something isn't working correctly
needs investigation
requires further investigation before determining if it is an issue or not
In the code sample below, the parent Example class sets thing to the first arg of the constructor. For the child class, the constructor knows that the super constructor sets thing to the first arg, so it doesn't assign it directly. If I try declaring the type for the thing property on the Example2 class, I get warnings for deno-ts 2564 and 2612. As shown in the screenshot below, one of the recommended fixes is "Prefix with 'declare'" and it resolves the issue.
If I try using the declared property, it doesn't show any warnings or errors.
If I run the above deno tests, the results change after using --no-check. In the example below, the first 2 runs without --no-check are successful. As soon as I run with --no-check, the example 2 test case fails with an error saying "TypeError: Cannot destructure property 'x' of 'example.thing' as it is undefined.". The following 2 runs without --no-check now fail with the same error. The only way to get the error go away without --no-check is to edit the file, but if I run deno test with --no-check again, it ends up causing the issue to happen again. I believe the correct behavior would be for the tests to pass with or without the --no-check flag.
I'm using the latest version of deno.
The text was updated successfully, but these errors were encountered: