Skip to content

Commit ac132a0

Browse files
committed
Move MergeLeafTypes into schema-dts-lib
1 parent 7767d82 commit ac132a0

30 files changed

Lines changed: 200 additions & 196 deletions

packages/schema-dts-gen/src/ts/helper_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export function HelperTypes(context: Context, {hasRole}: {hasRole: boolean}) {
9999
factory.createImportDeclaration(
100100
/*modifiers=*/ [],
101101
factory.createImportClause(
102-
SyntaxKind.TypeKeyword,
102+
/*isTypeOnly=*/ true,
103103
/*name=*/ undefined,
104104
factory.createNamedImports([
105105
factory.createImportSpecifier(

packages/schema-dts-gen/test/baselines/category_test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ test(`baseline_${basename(import.meta.url)}`, async () => {
4545
);
4646

4747
expect(actual).toMatchInlineSnapshot(`
48-
"import type { JsonLdObject, IdReference } from "schema-dts-lib";
49-
export type { JsonLdObject, IdReference };
48+
"import type { JsonLdObject, IdReference, MergeLeafTypes } from "schema-dts-lib";
49+
export type { JsonLdObject, IdReference, MergeLeafTypes };
5050
/** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */
5151
export type WithContext<T extends JsonLdObject | string> = T & {
5252
"@context": "https://schema.org";
@@ -67,7 +67,7 @@ export type WithActionConstraints<T extends ActionBase> = T & InputActionConstra
6767
6868
export type Text = string;
6969
70-
interface DistilleryLeaf extends ThingBase {
70+
export interface DistilleryLeaf extends ThingBase {
7171
"@type": "Distillery";
7272
}
7373
/** A distillery. */
@@ -76,7 +76,7 @@ export type Distillery = DistilleryLeaf;
7676
interface ThingBase extends Partial<IdReference> {
7777
"name"?: SchemaValue<Text>;
7878
}
79-
interface ThingLeaf extends ThingBase {
79+
export interface ThingLeaf extends ThingBase {
8080
"@type": "Thing";
8181
}
8282
export type Thing = ThingLeaf | Distillery;

packages/schema-dts-gen/test/baselines/comments_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ test(`baseline_${basename(import.meta.url)}`, async () => {
6565
);
6666

6767
expect(actual).toMatchInlineSnapshot(`
68-
"import type { JsonLdObject, IdReference } from "schema-dts-lib";
69-
export type { JsonLdObject, IdReference };
68+
"import type { JsonLdObject, IdReference, MergeLeafTypes } from "schema-dts-lib";
69+
export type { JsonLdObject, IdReference, MergeLeafTypes };
7070
/** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */
7171
export type WithContext<T extends JsonLdObject | string> = T & {
7272
"@context": "https://schema.org";
@@ -140,7 +140,7 @@ interface ThingBase extends Partial<IdReference> {
140140
*/
141141
"openingHours"?: SchemaValue<Text>;
142142
}
143-
interface ThingLeaf extends ThingBase {
143+
export interface ThingLeaf extends ThingBase {
144144
"@type": "Thing";
145145
}
146146
/**

packages/schema-dts-gen/test/baselines/data_type_union_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ test(`baseline_${basename(import.meta.url)}`, async () => {
4343
);
4444

4545
expect(actual).toMatchInlineSnapshot(`
46-
"import type { JsonLdObject, IdReference } from "schema-dts-lib";
47-
export type { JsonLdObject, IdReference };
46+
"import type { JsonLdObject, IdReference, MergeLeafTypes } from "schema-dts-lib";
47+
export type { JsonLdObject, IdReference, MergeLeafTypes };
4848
/** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */
4949
export type WithContext<T extends JsonLdObject | string> = T & {
5050
"@context": "https://schema.org";
@@ -74,7 +74,7 @@ interface ThingBase extends Partial<IdReference> {
7474
"age"?: SchemaValue<Number>;
7575
"name"?: SchemaValue<Text>;
7676
}
77-
interface ThingLeaf extends ThingBase {
77+
export interface ThingLeaf extends ThingBase {
7878
"@type": "Thing";
7979
}
8080
export type Thing = ThingLeaf;

packages/schema-dts-gen/test/baselines/default_ontology_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ test(`baseline_${basename(import.meta.url)}`, async () => {
3030
);
3131

3232
expect(actual).toMatchInlineSnapshot(`
33-
"import type { JsonLdObject, IdReference } from "schema-dts-lib";
34-
export type { JsonLdObject, IdReference };
33+
"import type { JsonLdObject, IdReference, MergeLeafTypes } from "schema-dts-lib";
34+
export type { JsonLdObject, IdReference, MergeLeafTypes };
3535
/** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */
3636
export type WithContext<T extends JsonLdObject | string> = T & {
3737
"@context": "https://schema.org";
@@ -52,7 +52,7 @@ export type WithActionConstraints<T extends ActionBase> = T & InputActionConstra
5252
5353
interface ThingBase extends Partial<IdReference> {
5454
}
55-
interface ThingLeaf extends ThingBase {
55+
export interface ThingLeaf extends ThingBase {
5656
"@type": "Thing";
5757
}
5858
export type Thing = ThingLeaf;

packages/schema-dts-gen/test/baselines/deprecated_objects_test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ test(`baseline_${basename(import.meta.url)}`, async () => {
6666
);
6767

6868
expect(actual).toMatchInlineSnapshot(`
69-
"import type { JsonLdObject, IdReference } from "schema-dts-lib";
70-
export type { JsonLdObject, IdReference };
69+
"import type { JsonLdObject, IdReference, MergeLeafTypes } from "schema-dts-lib";
70+
export type { JsonLdObject, IdReference, MergeLeafTypes };
7171
/** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */
7272
export type WithContext<T extends JsonLdObject | string> = T & {
7373
"@context": "https://schema.org";
@@ -93,15 +93,15 @@ export type Text = string;
9393
interface CarBase extends ThingBase {
9494
"doorNumber"?: SchemaValue<Number>;
9595
}
96-
interface CarLeaf extends CarBase {
96+
export interface CarLeaf extends CarBase {
9797
"@type": "Car";
9898
}
9999
export type Car = CarLeaf;
100100
101101
interface PersonLikeBase extends ThingBase {
102102
"height"?: SchemaValue<Number>;
103103
}
104-
interface PersonLikeLeaf extends PersonLikeBase {
104+
export interface PersonLikeLeaf extends PersonLikeBase {
105105
"@type": "PersonLike";
106106
}
107107
export type PersonLike = PersonLikeLeaf;
@@ -122,7 +122,7 @@ interface ThingBase extends Partial<IdReference> {
122122
*/
123123
"names2"?: SchemaValue<Text>;
124124
}
125-
interface ThingLeaf extends ThingBase {
125+
export interface ThingLeaf extends ThingBase {
126126
"@type": "Thing";
127127
}
128128
export type Thing = ThingLeaf | Car | PersonLike | Vehicle;
@@ -132,7 +132,7 @@ interface VehicleBase extends ThingBase {
132132
/** @deprecated Consider using http://schema.org/doorNumber instead. */
133133
"doors"?: SchemaValue<Number>;
134134
}
135-
interface VehicleLeaf extends VehicleBase {
135+
export interface VehicleLeaf extends VehicleBase {
136136
"@type": "Vehicle";
137137
}
138138
/** @deprecated Use Car instead. */

packages/schema-dts-gen/test/baselines/duplicate_comments_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ test(`baseline_${basename(import.meta.url)}`, async () => {
4747
);
4848

4949
expect(actual).toMatchInlineSnapshot(`
50-
"import type { JsonLdObject, IdReference } from "schema-dts-lib";
51-
export type { JsonLdObject, IdReference };
50+
"import type { JsonLdObject, IdReference, MergeLeafTypes } from "schema-dts-lib";
51+
export type { JsonLdObject, IdReference, MergeLeafTypes };
5252
/** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */
5353
export type WithContext<T extends JsonLdObject | string> = T & {
5454
"@context": "https://schema.org";
@@ -76,7 +76,7 @@ interface ThingBase extends Partial<IdReference> {
7676
*/
7777
"name"?: SchemaValue<Text>;
7878
}
79-
interface ThingLeaf extends ThingBase {
79+
export interface ThingLeaf extends ThingBase {
8080
"@type": "Thing";
8181
}
8282
/**

packages/schema-dts-gen/test/baselines/enum_skipped_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ test(`baseline_${basename(import.meta.url)}`, async () => {
4343
);
4444

4545
expect(actual).toMatchInlineSnapshot(`
46-
"import type { JsonLdObject, IdReference } from "schema-dts-lib";
47-
export type { JsonLdObject, IdReference };
46+
"import type { JsonLdObject, IdReference, MergeLeafTypes } from "schema-dts-lib";
47+
export type { JsonLdObject, IdReference, MergeLeafTypes };
4848
/** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */
4949
export type WithContext<T extends JsonLdObject | string> = T & {
5050
"@context": "https://schema.org";
@@ -65,7 +65,7 @@ export type WithActionConstraints<T extends ActionBase> = T & InputActionConstra
6565
6666
interface ThingBase extends Partial<IdReference> {
6767
}
68-
interface ThingLeaf extends ThingBase {
68+
export interface ThingLeaf extends ThingBase {
6969
"@type": "Thing";
7070
}
7171
/** A Thing! */

packages/schema-dts-gen/test/baselines/inheritance_multiple_test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ test(`baseline_${basename(import.meta.url)}`, async () => {
4747
);
4848

4949
expect(actual).toMatchInlineSnapshot(`
50-
"import type { JsonLdObject, IdReference } from "schema-dts-lib";
51-
export type { JsonLdObject, IdReference };
50+
"import type { JsonLdObject, IdReference, MergeLeafTypes } from "schema-dts-lib";
51+
export type { JsonLdObject, IdReference, MergeLeafTypes };
5252
/** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */
5353
export type WithContext<T extends JsonLdObject | string> = T & {
5454
"@context": "https://schema.org";
@@ -74,23 +74,23 @@ export type Text = string;
7474
interface PersonLikeBase extends ThingBase {
7575
"height"?: SchemaValue<Number>;
7676
}
77-
interface PersonLikeLeaf extends PersonLikeBase {
77+
export interface PersonLikeLeaf extends PersonLikeBase {
7878
"@type": "PersonLike";
7979
}
8080
export type PersonLike = PersonLikeLeaf;
8181
8282
interface ThingBase extends Partial<IdReference> {
8383
"name"?: SchemaValue<Text>;
8484
}
85-
interface ThingLeaf extends ThingBase {
85+
export interface ThingLeaf extends ThingBase {
8686
"@type": "Thing";
8787
}
8888
export type Thing = ThingLeaf | PersonLike | Vehicle;
8989
9090
interface VehicleBase extends ThingBase {
9191
"doors"?: SchemaValue<Number>;
9292
}
93-
interface VehicleLeaf extends VehicleBase {
93+
export interface VehicleLeaf extends VehicleBase {
9494
"@type": "Vehicle";
9595
}
9696
export type Vehicle = VehicleLeaf;

packages/schema-dts-gen/test/baselines/inheritance_one_test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ test(`baseline_${basename(import.meta.url)}`, async () => {
4242
);
4343

4444
expect(actual).toMatchInlineSnapshot(`
45-
"import type { JsonLdObject, IdReference } from "schema-dts-lib";
46-
export type { JsonLdObject, IdReference };
45+
"import type { JsonLdObject, IdReference, MergeLeafTypes } from "schema-dts-lib";
46+
export type { JsonLdObject, IdReference, MergeLeafTypes };
4747
/** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */
4848
export type WithContext<T extends JsonLdObject | string> = T & {
4949
"@context": "https://schema.org";
@@ -69,15 +69,15 @@ export type Text = string;
6969
interface PersonLikeBase extends ThingBase {
7070
"height"?: SchemaValue<Number>;
7171
}
72-
interface PersonLikeLeaf extends PersonLikeBase {
72+
export interface PersonLikeLeaf extends PersonLikeBase {
7373
"@type": "PersonLike";
7474
}
7575
export type PersonLike = PersonLikeLeaf;
7676
7777
interface ThingBase extends Partial<IdReference> {
7878
"name"?: SchemaValue<Text>;
7979
}
80-
interface ThingLeaf extends ThingBase {
80+
export interface ThingLeaf extends ThingBase {
8181
"@type": "Thing";
8282
}
8383
export type Thing = ThingLeaf | PersonLike;

0 commit comments

Comments
 (0)