Closed vimode closed 1 year ago
Ah, this is an interesting issue. Thanks for filing!
The Horror | Horror
issue is, as the last line of the type error suggests, because the class Horror
one would write in src/index.ts
is different from the class Horror
already written in src/solution.ts
.:
Property '#consumed' in type 'Horror' refers to a different member that cannot be accessed from within type 'Horror'.
As for how to fix it... hmm. Tricky. I'll work on this.
When I add the arg to just check the src/solution.ts it shows the following error
error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher. ...
Ah, did you specify a file to get that? npm run tsc -- src/solution.ts
or similar? tsc
will not reading from tsconfig.json
in that case, and instead uses the default compiler options. Which as of 2023 are still older than ECMAScript 2015.
When I run the test, it will show 'No tests found' but pressing 'a' will run all the tests properly.
Does it specifically say:
No tests found related to files changed since last commit.
Press `a` to run all tests, or run Jest with `--watchAll`.
If so: yes, that's Jest's default behavior.
I believe this should be fixed by #277. But please post back if not and I can take another look!
Everything works as it should! Thanks for the quick fix.
Thank you for taking the time to explain the issue but I guess I need to understand a lot more about types and testing to understand the fix. These projects have been very helpful.
Bug Report Checklist
main
branch of the repository.Expected
tsc
cli should check for errors in index.tstest
script should run all the tests in the projectActual
There are multiple issues with this project and I am unsure how to help to fix them.
TSC compilation(?) error
npm run tsc -- --watch
The command when run inside the project directory as instructed shows errors from index.test.ts file instead of showing it for index.ts
Excerpt of the CLI output
When I add the arg to just check the src/solution.ts it shows the following error
The config seems to be targeting es2021 but it still shows that error, not sure why.
Running tests
npm run test -- --watch
When I run the test, it will show 'No tests found' but pressing 'a' will run all the tests properly.
I hope I was able to explain the issues and you are able to check those, if you need more information please let me know I will try my best to provide all the information needed.
Impacted Project
/classes/horror-factory/
https://github.com/LearningTypeScript/projects/tree/main/projects/classes/horror-factory
Additional Info
No response