[DevEx]: Close the last 5 backend environment type gaps
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, nodejs
Research direction
Read the five listed TypeScript errors in api/helpers/game-states/validate-all-cards.js, utils/config-utils.js, utils/dev-ports.js, and api/responses/forbidden.js, along with the relevant type-check configuration. First land or account for #1397 and #1411, then run npm run typecheck:backend with checkJs: true. Done means the backend reports zero errors without behavior changes.
Written by the indexing model from the issue text.
Description
Part of #1399. Depends on #1401. Overlaps #1397.
Summary
Clear the last backend type errors so the gate in #1404 can be strict from day one. After #1401 there are 27; 14 of them are fixed by #1397 alone and 8 more are split out into #1411, leaving 5 environment gaps here.
What's left after #1401
14 × TS2307 — already fixed by #1397. Every one is an extensionless require of a JSON enum:
api/controllers/game/{move,ready}.js, .../ai/{ai-move,create-vs-ai}.js,
.../spectate/join.js, api/controllers/StatsController.js,
api/helpers/{find-open-games,find-spectatable-games,is-game-full}.js,
api/hooks/customGameHook/index.js -> utils/GameStatus
api/helpers/game-states/ai/{get-legal-moves,get-move-bodies-for-move-type}.js,
.../ai/minimax/get-minimax-score.js -> utils/MoveType, utils/TargetType
Nothing to do here beyond landing #1397 first.
8 × malformed JSDoc (TS1005 + TS8024) in StatsController.js and convert-card-to-str.js — split out into #1411 as a comment-only change. Land that first or alongside this.
5 × environment gaps (TS2339), each needing a small declaration or config tweak rather than a code change:
| Site | Error | Likely fix |
|---|---|---|
api/helpers/game-states/validate-all-cards.js:59 |
Property 'difference' does not exist on type 'Set<string>' |
Set.prototype.difference is ES2025; raise lib or use a helper |
utils/config-utils.js:7 |
Property 'Cypress' does not exist on Window |
declare it (shared with #1403) |
utils/config-utils.js:14 |
Property 'cuttle' does not exist on Window |
same |
utils/dev-ports.js:30 |
Property 'loadEnvFile' does not exist on type 'Process' |
Node 22 API; needs current @types/node |
api/responses/forbidden.js:3 |
Property 'res' does not exist on type '{ exports: ... }' |
sails binds this to the request context; see note below |
On forbidden.js: sails invokes custom responses with this bound to a req/res context, which TypeScript cannot infer — it sees this as the module object. Since the project does not use JSDoc for type declarations (#1399), prefer declaring the sails response context in a .d.ts alongside the globals from #1401. If that proves awkward for a 3-line file, a single @this annotation is an acceptable documented exception — say so in the PR rather than quietly setting the precedent.
Note utils/config-utils.js is consumed by both the client and the server, so its two window errors appear in the frontend run too — fixing them here clears them from both.
Not in this issue
The two MoveType enum errors that checkJs originally surfaced here (get-log.js referencing SEVEN_UNTARGETED_ONE_OFF / SEVEN_TARGETED_ONE_OFF) are already fixed in #1398, which is why the count is 13 and not 15. They are the proof this whole exercise is worth doing: three shipped bugs, none caught by lint, unit tests, or e2e.
Acceptance
- With #1397 and #1411 landed,
npm run typecheck:backendundercheckJs: truereports 0 errors - No behavior change — every item here is a declaration or a config value
- Dominant language
- JavaScript
- Stars
- 195
- Forks
- 145
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 32
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cuttle-cards/cuttle
-
good first issue internationalization
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
cuttle-cards/cuttle#1474 ·
Maintainers usually reply within 1 day
-
enhancement version-minor
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
cuttle-cards/cuttle#1467 ·
Maintainers usually reply within 1 day
-
dev experience
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
cuttle-cards/cuttle#1461 ·
Maintainers usually reply within 1 day
-
[DevEx]: Convert the gameHistory store to TypeScriptMay be free again @aniruddh18122006-cyber claimed this 27 days ago, and no pull request is open. Opendev experience frontend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cuttle-cards/cuttle#1424 · 1 comment ·
Maintainers usually reply within 1 day
-
dev experience frontend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
cuttle-cards/cuttle#1422 · 1 comment ·
Maintainers usually reply within 1 day
All issues in cuttle-cards/cuttle
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
hugomrdias/playwright-test#753 ·
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
KonstantinStarovoytov/kitden#21 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
guybedford/es-module-shims#556 ·
-
app ernst:4-klein
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
NewspeedyNL/PidLane#683 ·
Maintainers usually reply within 1 day