diff --git a/e2e-tests/standalone-parser/CHANGELOG.md b/e2e-tests/standalone-parser/CHANGELOG.md index e7e0d1e..26cc94f 100644 --- a/e2e-tests/standalone-parser/CHANGELOG.md +++ b/e2e-tests/standalone-parser/CHANGELOG.md @@ -1,5 +1,13 @@ # node-server +## 1.0.61 + +### Patch Changes + +- Updated dependencies + - @beff/cli@0.0.63 + - @beff/client@0.0.64 + ## 1.0.60 ### Patch Changes diff --git a/e2e-tests/standalone-parser/package.json b/e2e-tests/standalone-parser/package.json index 2d43ce1..786f5dc 100644 --- a/e2e-tests/standalone-parser/package.json +++ b/e2e-tests/standalone-parser/package.json @@ -1,6 +1,6 @@ { "name": "standalone-parser", - "version": "1.0.60", + "version": "1.0.61", "description": "", "main": "index.js", "scripts": { @@ -11,7 +11,7 @@ "author": "", "license": "ISC", "dependencies": { - "@beff/cli": "workspace:^0.0.62", + "@beff/cli": "workspace:^0.0.63", "@beff/client": "workspace:^", "vitest": "^0.34.4", "zod": "^3.23.5" diff --git a/packages/beff-cli/CHANGELOG.md b/packages/beff-cli/CHANGELOG.md index 35af443..083cbad 100644 --- a/packages/beff-cli/CHANGELOG.md +++ b/packages/beff-cli/CHANGELOG.md @@ -1,5 +1,11 @@ # @beff/cli +## 0.0.63 + +### Patch Changes + +- fix omit and intersection + ## 0.0.62 ### Patch Changes diff --git a/packages/beff-cli/package.json b/packages/beff-cli/package.json index 9ddf088..d73dd07 100644 --- a/packages/beff-cli/package.json +++ b/packages/beff-cli/package.json @@ -1,6 +1,6 @@ { "name": "@beff/cli", - "version": "0.0.62", + "version": "0.0.63", "description": "", "bin": { "beff": "./bin/index.js" diff --git a/packages/beff-client/CHANGELOG.md b/packages/beff-client/CHANGELOG.md index ab5a801..79a1336 100644 --- a/packages/beff-client/CHANGELOG.md +++ b/packages/beff-client/CHANGELOG.md @@ -1,5 +1,13 @@ # @beff/client +## 0.0.64 + +### Patch Changes + +- fix omit and intersection +- Updated dependencies + - @beff/cli@0.0.63 + ## 0.0.63 ### Patch Changes diff --git a/packages/beff-client/package.json b/packages/beff-client/package.json index 68c613e..6b90cd6 100644 --- a/packages/beff-client/package.json +++ b/packages/beff-client/package.json @@ -1,6 +1,6 @@ { "name": "@beff/client", - "version": "0.0.63", + "version": "0.0.64", "description": "", "main": "dist/cjs/index.js", "scripts": { @@ -20,7 +20,7 @@ "author": "", "license": "ISC", "dependencies": { - "@beff/cli": "workspace:^0.0.62", + "@beff/cli": "workspace:^0.0.63", "zod": "^3.23.5" }, "devDependencies": { diff --git a/packages/beff-core/src/type_to_schema.rs b/packages/beff-core/src/type_to_schema.rs index df8ca8d..4d71bf0 100644 --- a/packages/beff-core/src/type_to_schema.rs +++ b/packages/beff-core/src/type_to_schema.rs @@ -293,6 +293,16 @@ impl<'a, 'b, R: FileManager> TypeToSchema<'a, 'b, R> { _ => self.error(span, DiagnosticInfoMessage::ShouldHaveObjectAsTypeArgument), } } + JsonSchema::AllOf(vs) => { + let mut acc = BTreeMap::new(); + + for v in vs { + let extracted = self.extract_object(v, span)?; + acc.extend(extracted); + } + + Ok(acc) + } _ => self.error(span, DiagnosticInfoMessage::ShouldHaveObjectAsTypeArgument), } } diff --git a/packages/beff-core/tests/print_parser.rs b/packages/beff-core/tests/print_parser.rs index dabd076..e73bc9e 100644 --- a/packages/beff-core/tests/print_parser.rs +++ b/packages/beff-core/tests/print_parser.rs @@ -622,6 +622,17 @@ mod tests { export type ABC = {} export type KABC = keyof ABC + parse.buildParsers<{ KABC: KABC }>(); + "#)); + } + #[test] + fn ok_omit_intersection() { + insta::assert_snapshot!(ok(r#" + export type A = {a: string} + export type B = {b: string} + + export type KABC = Omit<A & B, 'a'> + parse.buildParsers<{ KABC: KABC }>(); "#)); } diff --git a/packages/beff-core/tests/snapshots/print_parser__tests__ok_omit_intersection.snap.new b/packages/beff-core/tests/snapshots/print_parser__tests__ok_omit_intersection.snap.new new file mode 100644 index 0000000..453cf52 --- /dev/null +++ b/packages/beff-core/tests/snapshots/print_parser__tests__ok_omit_intersection.snap.new @@ -0,0 +1,10 @@ +--- +source: packages/beff-core/tests/print_parser.rs +assertion_line: 630 +expression: "ok(r#\"\n export type A = {a: string}\n export type B = {b: string}\n\n export type KABC = Omit<A & B, 'a'>\n \n parse.buildParsers<{ KABC: KABC }>();\n \"#)" +--- +type A = { "a": string }; +type B = { "b": string }; +type KABC = { "b": string }; +type KABC = KABC; + diff --git a/packages/beff-wasm/package.json b/packages/beff-wasm/package.json index eaa9dc1..2c5b53a 100644 --- a/packages/beff-wasm/package.json +++ b/packages/beff-wasm/package.json @@ -41,7 +41,7 @@ }, "devDependencies": { "@babel/code-frame": "^7.22.13", - "@beff/cli": "workspace:^0.0.62", + "@beff/cli": "workspace:^0.0.63", "@types/babel__code-frame": "^7.0.4", "@types/node": "^20.6.2", "@types/vscode": "^1.73.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5fa3332..ea93da6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,7 +34,7 @@ importers: e2e-tests/standalone-parser: dependencies: '@beff/cli': - specifier: workspace:^0.0.62 + specifier: workspace:^0.0.63 version: link:../../packages/beff-cli '@beff/client': specifier: workspace:^ @@ -55,7 +55,7 @@ importers: packages/beff-client: dependencies: '@beff/cli': - specifier: workspace:^0.0.62 + specifier: workspace:^0.0.63 version: link:../beff-cli zod: specifier: ^3.23.5 @@ -89,7 +89,7 @@ importers: specifier: ^7.22.13 version: 7.22.13 '@beff/cli': - specifier: workspace:^0.0.62 + specifier: workspace:^0.0.63 version: link:../beff-cli '@types/babel__code-frame': specifier: ^7.0.4