Add MergeLeafTypes helper and export leaf types#210
Conversation
0a55595 to
697c0ac
Compare
|
Random thought (let me know if this is too much of a hassle and I can do part of the change and have you rebase on top of it): I wonder if we can separate the utility types into their own package (e.g. import type { WithContext, Graph, MergeLeafTypes } from "schema-dts-helpers";
export {WithContext, Graph, MergeLeafTypes};instead of the long stanza in each file. It'll make the snapshot tests & churn easier to read, and it means that we can write things the way we want instead of relying on imperatively constructing the AST with codegen. Let me know if you'd like me to make the initial structure for that. |
That's not actually an error, but a problem with the testing -- looks like you need to actively rerun |
|
Thanks, this makes sense. I’m happy to rework the PR in that direction. If you want to sketch the initial helper-package structure, I can rebase on top of it; otherwise I can take a first pass at wiring it up here. Also thanks for the note on testing — I’ll rerun the schema-dts tests with the required build step and update the PR description accordingly. |
697c0ac to
ac132a0
Compare
|
Rebased this PR onto #213 and moved |
| /*modifiers=*/ [], | ||
| factory.createImportClause( | ||
| SyntaxKind.TypeKeyword, | ||
| /*isTypeOnly=*/ true, |
There was a problem hiding this comment.
I think this overload is deprecated, any reason you used it instead of the existing code that passed SyntaxKind.TypeKeyword?
There was a problem hiding this comment.
Switched this back to SyntaxKind.TypeKeyword to match #213; the boolean overload change was accidental during the split.
|
Can you also run: to update the formatting of the .ts and .md files? |
Switch helper_types.ts back to SyntaxKind.TypeKeyword to match google#213. Also run npm run fix:prettier to apply the requested TS/MD formatting updates.
|
Sure, ran npm run fix:prettier and pushed the formatting updates. |
Summary
MergeLeafTypes<>and its internal helper machinery intoschema-dts-libMergeLeafTypesfromschema-dts-libNotes
ThingandProductare unchangedRoleBuiltinleaf type-alias pathWithContext,Graph, andSchemaValueremain in generator helper output;MergeLeafTypes<>lives inschema-dts-libwith the other schema-agnostic helpers*LeafdeclarationsVerification
NODE_OPTIONS=--experimental-vm-modules ./node_modules/.bin/jest packages/schema-dts-gen/test --runInBand -u./node_modules/.bin/tsc -b packages/schema-dts-lib./node_modules/.bin/tsc -b packages/schema-dts-gen/srcnode packages/schema-dts-gen/dist/src/cli/cli.js > packages/schema-dts/lib/schema.ts./node_modules/.bin/tsc -p packages/schema-dts./node_modules/.bin/tsc -p packages/schema-dts/testnpm run fix:prettierFixes #203