Skip to content

Commit 905a4ae

Browse files
committed
fix(express): annotate HttpRoute for TS7056 declaration emit
Annotate PostSendMany, PostSendCoins, PostWalletSignTx, and PostWalletTxSignTSS as HttpRoute<'post'> so declaration emit stays within TS limits. WAL-376
1 parent 16392ca commit 905a4ae

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

modules/express/src/typedRoutes/api/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ import { GetResourceDelegations } from './v2/resourceDelegations';
5959
//
6060
// > error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.
6161
//
62-
// As a workaround, only construct expressApi with a single key and add it to the type union at the end
62+
// Workarounds: (1) export heavy httpRoute handlers as `HttpRoute<'post'>` (etc.) in their modules so apiSpec
63+
// inference stays small; (2) only construct expressApi with a single key and add it to the type union at the end.
6364

6465
export const ExpressPingApiSpec = apiSpec({
6566
'express.ping': {

modules/express/src/typedRoutes/api/v2/sendCoins.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as t from 'io-ts';
2-
import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
2+
import { httpRoute, httpRequest, optional, type HttpRoute } from '@api-ts/io-ts-http';
33
import { BitgoExpressError } from '../../schemas/error';
44
import { SendManyResponse, EIP1559Params, MemoParams, TokenEnablement } from './sendmany';
55

@@ -412,7 +412,7 @@ export const SendCoinsRequestBody = {
412412
* @operationId express.wallet.sendcoins
413413
* @tag express
414414
*/
415-
export const PostSendCoins = httpRoute({
415+
export const PostSendCoins: HttpRoute<'post'> = httpRoute({
416416
path: '/api/v2/{coin}/wallet/{id}/sendcoins',
417417
method: 'POST',
418418
request: httpRequest({

modules/express/src/typedRoutes/api/v2/sendmany.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as t from 'io-ts';
22
import { DateFromISOString } from 'io-ts-types';
3-
import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
3+
import { httpRoute, httpRequest, optional, type HttpRoute } from '@api-ts/io-ts-http';
44
import { TransactionRequest as TxRequestResponse } from '@bitgo/public-types';
55
import { BitgoExpressError } from '../../schemas/error';
66

@@ -790,7 +790,7 @@ export const SendManyResponse = t.intersection([
790790
* @operationId express.wallet.sendmany
791791
* @tag Express
792792
*/
793-
export const PostSendMany = httpRoute({
793+
export const PostSendMany: HttpRoute<'post'> = httpRoute({
794794
path: '/api/v2/{coin}/wallet/{id}/sendmany',
795795
method: 'POST',
796796
request: httpRequest({

modules/express/src/typedRoutes/api/v2/walletSignTx.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as t from 'io-ts';
2-
import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
2+
import { httpRoute, httpRequest, optional, type HttpRoute } from '@api-ts/io-ts-http';
33
import { TransactionRequest as TxRequestResponse, TransactionRequestApiVersion } from '@bitgo/public-types';
44
import { BitgoExpressError } from '../../schemas/error';
55
import { Recipient } from './coinSignTx';
@@ -147,7 +147,7 @@ export const WalletSignTxResponse = {
147147
* @operationId express.v2.wallet.signtx
148148
* @tag Express
149149
*/
150-
export const PostWalletSignTx = httpRoute({
150+
export const PostWalletSignTx: HttpRoute<'post'> = httpRoute({
151151
path: '/api/v2/{coin}/wallet/{id}/signtx',
152152
method: 'POST',
153153
request: httpRequest({

modules/express/src/typedRoutes/api/v2/walletTxSignTSS.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as t from 'io-ts';
2-
import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
2+
import { httpRoute, httpRequest, optional, type HttpRoute } from '@api-ts/io-ts-http';
33
import { TransactionRequest as TxRequestResponse, TransactionRequestApiVersion } from '@bitgo/public-types';
44
import { BitgoExpressError } from '../../schemas/error';
55
import { Recipient } from './coinSignTx';
@@ -161,7 +161,7 @@ export const WalletTxSignTSSResponse = {
161161
* @tag express
162162
* @operationId express.v2.wallet.signtxtss
163163
*/
164-
export const PostWalletTxSignTSS = httpRoute({
164+
export const PostWalletTxSignTSS: HttpRoute<'post'> = httpRoute({
165165
path: '/api/v2/{coin}/wallet/{id}/signtxtss',
166166
method: 'POST',
167167
request: httpRequest({

0 commit comments

Comments
 (0)