Skip to content

Commit d8d4872

Browse files
authored
Merge pull request #78 from Contentstack-Solutions/staging
Merge staging to master
2 parents c825c9a + a22b876 commit d8d4872

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Contentstack Solutions
3+
Copyright (c) 2024 Contentstack Solutions
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "contentstack-cli-tsgen",
33
"description": "Generate TypeScript typings from a Stack.",
4-
"version": "2.2.1",
4+
"version": "2.2.2",
55
"author": "Michael Davis",
66
"bugs": "https://github.com/Contentstack-Solutions/contentstack-cli-tsgen/issues",
77
"dependencies": {

src/lib/stack/schema.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ export type Field = GlobalField &
5252
ReferenceField &
5353
GroupField &
5454
EnumField &
55-
BlockField &
56-
{ field_metadata: FieldMetaData };
55+
BlockField
5756
export type Schema = Array<Field>;
5857

5958
export type ContentType = {
@@ -63,8 +62,4 @@ export type ContentType = {
6362
reference_to?: string;
6463
data_type?: string;
6564
schema_type?: string;
66-
} & Identifier;
67-
68-
export type FieldMetaData = {
69-
ref_multiple?: boolean;
70-
}
65+
} & Identifier;

src/lib/tsgen/factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ export default function (userOptions: TSGenOptions) {
313313
references.push(name_type(field.reference_to))
314314
}
315315

316-
return ['(', references.join(' | '), ')', field.field_metadata?.ref_multiple ? '[]' : ''].join('')
316+
return ["(", references.join(" | "), ")", "[]"].join("");
317317
}
318318

319319
return function (contentType: ContentstackTypes.ContentType): TSGenResult|any {

tests/tsgen/references.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe("references", () => {
2929
version: 5 ;
3030
title: string ;
3131
url: string ;
32-
single_reference: (IReferenceChild) ;
32+
single_reference: (IReferenceChild)[] ;
3333
multiple_reference?: (IReferenceChild | IBoolean | IBuiltinExample)[] ;
3434
}"
3535
`);

0 commit comments

Comments
 (0)