Skip to content

Commit c3d33db

Browse files
committed
Fix all but one type error
1 parent 83dec2a commit c3d33db

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

codegen/lib/connect.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,28 @@ export const connect = (
2525
({ isUndocumented }) => !isUndocumented,
2626
)
2727

28+
const nodes = [...namespaces, ...routes]
29+
2830
const routeIndexes: Record<string, Set<string>> = {}
2931

3032
const rootRouteKey = `${rootPath}/seam-http.ts`
3133
files[rootRouteKey] = { contents: Buffer.from('\n') }
3234
const file = files[rootRouteKey] as unknown as File
3335
file.layout = 'route.hbs'
34-
setRouteLayoutContext(file, null, blueprint)
36+
setRouteLayoutContext(file, null, nodes)
3537

3638
routeIndexes[''] ??= new Set()
3739
routeIndexes['']?.add('seam-http.js')
3840

39-
for (const node of [...namespaces, ...routes]) {
41+
for (const node of nodes) {
4042
const path = toFilePath(node.path)
4143
const name = kebabCase(node.name)
4244

4345
const k = `${rootPath}/${path}/${name}.ts`
4446
files[k] = { contents: Buffer.from('\n') }
4547
const file = files[k] as unknown as File
4648
file.layout = 'route.hbs'
47-
setRouteLayoutContext(file, node, blueprint)
49+
setRouteLayoutContext(file, node, nodes)
4850

4951
routeIndexes[path] ??= new Set()
5052
routeIndexes[path]?.add(`${name}.js`)
@@ -115,7 +117,7 @@ const getClassName = (name: string | null): string =>
115117
const setRouteLayoutContext = (
116118
file: Partial<RouteLayoutContext>,
117119
node: Route | Namespace | null,
118-
blueprint: Blueprint,
120+
nodes: Array<Route | Namespace>,
119121
): void => {
120122
file.className = getClassName(node?.path ?? null)
121123
file.skipClientSessionImport =
@@ -131,7 +133,7 @@ const setRouteLayoutContext = (
131133
)
132134
}
133135

134-
file.subroutes = [...blueprint.routes, ...blueprint.namespaces]
136+
file.subroutes = nodes
135137
.sort((n1, n2) => n1.name.localeCompare(n2.name))
136138
.filter(({ parentPath }) => parentPath === (node?.path ?? null))
137139
.map((r) => getSubrouteLayoutContext(r))

0 commit comments

Comments
 (0)