Skip to content

Commit 3bd8f0f

Browse files
committed
fix: remove Type suffix from serialised routes
1 parent 3567b41 commit 3bd8f0f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/serialize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function stringifyRouteTree(tree: RouteTree, indent = 2): string {
7272
if (!value) {
7373
continue
7474
}
75-
const key = keys[_key] || JSON.stringify(_key)
75+
const key = keys[_key] || JSON.stringify((_key as string).replace(/Type$/, ''))
7676
if (typeof value === 'string') {
7777
properties += `${' '.repeat(indent)}${key}: ${value}\n`
7878
}

test/serialize.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ describe('serialize', () => {
3131
interface InternalRoutes {
3232
"/": {
3333
"GET": {
34-
"responseType": { type: 'headers', method: 'POST' }
35-
"headersType": { authorization: 'string' }
34+
"response": { type: 'headers', method: 'POST' }
35+
"headers": { authorization: 'string' }
3636
}
3737
}
3838
"/bob": {
3939
[DynamicParam]: {
4040
"POST": {
41-
"responseType": { type: 'headers', method: 'POST' }
42-
"headersType": { authorization: 'string' }
41+
"response": { type: 'headers', method: 'POST' }
42+
"headers": { authorization: 'string' }
4343
}
4444
}
4545
}

0 commit comments

Comments
 (0)