Skip to content

Commit 6a383b5

Browse files
fix: resolve TypeScript compilation error with proper cross-package imports
- Export runtime schema from @pgsql/transform package index - Add @pgsql/transform as dependency to @pgsql/traverse - Use proper package import instead of direct file import - Maintain all enhanced traverse functionality (NodePath, early return, runtime schema) Co-Authored-By: Dan Lynch <[email protected]>
1 parent 039e907 commit 6a383b5

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

packages/transform/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ export { PG15ToPG17Transformer } from './transformers-direct/v15-to-v17';
2323
export { PG16ToPG17Transformer } from './transformers-direct/v16-to-v17';
2424

2525
export { PG13Node, PG14Node, PG15Node, PG16Node, PG17Node, PG13Types, PG14Types, PG15Types, PG16Types, PG17Types };
26+
27+
export { runtimeSchema as PG17RuntimeSchema, FieldSpec, NodeSpec } from './17/runtime-schema';

packages/traverse/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"test:watch": "jest --watch"
3131
},
3232
"dependencies": {
33-
"@pgsql/types": "^17.6.1"
33+
"@pgsql/types": "^17.6.1",
34+
"@pgsql/transform": "^17.7.1"
3435
},
3536
"keywords": [
3637
"sql",

packages/traverse/src/traverse.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11

22
import type { Node, ParseResult } from '@pgsql/types';
3-
import { runtimeSchema } from '../../transform/src/17/runtime-schema';
3+
import type { FieldSpec, NodeSpec } from '@pgsql/transform';
4+
import { PG17RuntimeSchema as runtimeSchema } from '@pgsql/transform';
45

5-
const schemaMap = new Map(runtimeSchema.map(spec => [spec.name, spec]));
6+
const schemaMap = new Map<string, NodeSpec>(runtimeSchema.map((spec: NodeSpec) => [spec.name, spec]));
67

78
export type NodeTag = keyof Node;
89

@@ -85,7 +86,9 @@ export function walk(
8586
const value = nodeData[key];
8687
if (Array.isArray(value)) {
8788
value.forEach((item, index) => {
88-
walk(item, actualCallback, path, [...path.keyPath, key, index]);
89+
if (typeof item === 'object' && item !== null) {
90+
walk(item, actualCallback, path, [...path.keyPath, key, index]);
91+
}
8992
});
9093
} else if (typeof value === 'object' && value !== null) {
9194
walk(value, actualCallback, path, [...path.keyPath, key]);

0 commit comments

Comments
 (0)