Closed creilly8 closed 3 months ago
@creilly8 Your code is correct, the issue is really with the augen
type checker code generator. If I run npx tsc
from the server
dir, I see errors like below. The augen
code makes assumptions, that each file under server/route
will have a similarly named file under server/shared/types/routes
dir. So, reusing hic.ts
to define request, response types for 2 different routes breaks this assumption. I could either (a) fix augen, or (b) temporarily separate types/routes/hic.ts
into types/routes/hicdata.ts
and types/routes/hicgenome.ts
(and fix augen later).
$ npx tsc
shared/checkers-raw/index.ts:10:10 - error TS2305: Module '"../types/routes/hicdata.ts"' has no exported member 'HicdataRequest'.
10 import { HicdataRequest, HicdataResponse } from '../types/routes/hicdata.ts'
~~~~~~~~~~~~~~
shared/checkers-raw/index.ts:10:26 - error TS2305: Module '"../types/routes/hicdata.ts"' has no exported member 'HicdataResponse'.
10 import { HicdataRequest, HicdataResponse } from '../types/routes/hicdata.ts'
~~~~~~~~~~~~~~~
shared/checkers-raw/index.ts:11:53 - error TS2307: Cannot find module '../types/routes/hicgenome.ts' or its corresponding type declarations.
11 import { HicGenomeRequest, HicGenomeResponse } from '../types/routes/hicgenome.ts'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
shared/checkers/index.ts:10:10 - error TS2305: Module '"../types/routes/hicdata.js"' has no exported member 'HicdataRequest'.
10 import { HicdataRequest, HicdataResponse } from "../types/routes/hicdata.js";
~~~~~~~~~~~~~~
shared/checkers/index.ts:10:26 - error TS2305: Module '"../types/routes/hicdata.js"' has no exported member 'HicdataResponse'.
10 import { HicdataRequest, HicdataResponse } from "../types/routes/hicdata.js";
~~~~~~~~~~~~~~~
Found 5 errors in 2 files.
Errors Files
3 shared/checkers-raw/index.ts:10
2 shared/checkers/index.ts:10
@creilly8 Your code is correct, the issue is really with the
augen
type checker code generator. If I runnpx tsc
from theserver
dir, I see errors like below. Theaugen
code makes assumptions, that each file underserver/route
will have a similarly named file underserver/shared/types/routes
dir. So, reusinghic.ts
to define request, response types for 2 different routes breaks this assumption. I could either (a) fix augen, or (b) temporarily separatetypes/routes/hic.ts
intotypes/routes/hicdata.ts
andtypes/routes/hicgenome.ts
(and fix augen later).$ npx tsc shared/checkers-raw/index.ts:10:10 - error TS2305: Module '"../types/routes/hicdata.ts"' has no exported member 'HicdataRequest'. 10 import { HicdataRequest, HicdataResponse } from '../types/routes/hicdata.ts' ~~~~~~~~~~~~~~ shared/checkers-raw/index.ts:10:26 - error TS2305: Module '"../types/routes/hicdata.ts"' has no exported member 'HicdataResponse'. 10 import { HicdataRequest, HicdataResponse } from '../types/routes/hicdata.ts' ~~~~~~~~~~~~~~~ shared/checkers-raw/index.ts:11:53 - error TS2307: Cannot find module '../types/routes/hicgenome.ts' or its corresponding type declarations. 11 import { HicGenomeRequest, HicGenomeResponse } from '../types/routes/hicgenome.ts' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ shared/checkers/index.ts:10:10 - error TS2305: Module '"../types/routes/hicdata.js"' has no exported member 'HicdataRequest'. 10 import { HicdataRequest, HicdataResponse } from "../types/routes/hicdata.js"; ~~~~~~~~~~~~~~ shared/checkers/index.ts:10:26 - error TS2305: Module '"../types/routes/hicdata.js"' has no exported member 'HicdataResponse'. 10 import { HicdataRequest, HicdataResponse } from "../types/routes/hicdata.js"; ~~~~~~~~~~~~~~~ Found 5 errors in 2 files. Errors Files 3 shared/checkers-raw/index.ts:10 2 shared/checkers/index.ts:10
I see. Thanks for letting me know. I will split into two files so augen
can be fixed when it's convenient.
Description
Addresses the concern about the hicdata and hicgenome routes using the same types. @siosonel, please let me know if this addresses the concerns about the types. All tests pass on my local.
Changes:
hicdata
andhicgenome
routes.Test with:
Checklist
Check each task that has been performed or verified to be not applicable.