Skip to content

Commit f7ddabd

Browse files
authored
Merge pull request #217 from weaverryan/no-id-typescript
Don't always output id in typescript interface
2 parents 66387f3 + 4228235 commit f7ddabd

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

src/generators/TypescriptInterfaceGenerator.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,6 @@ export default class TypescriptInterfaceGenerator extends BaseGenerator {
6363
};
6464
}
6565

66-
// If id is not present, add it manually with default values
67-
if (!("id" in fields)) {
68-
fields["id"] = {
69-
notrequired: true,
70-
name: "id",
71-
type: "string",
72-
description: null,
73-
readonly: false
74-
};
75-
}
76-
7766
// Parse fields to add relevant imports, required for Typescript
7867
const fieldsArray = Object.keys(fields).map(e => fields[e]);
7968
const imports = {};

src/generators/TypescriptInterfaceGenerator.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ test("Generate a typescript interface", () => {
5353
foo: any;
5454
foobar?: string[];
5555
readonly bar: string;
56-
id?: string;
5756
}
5857
`;
5958
expect(
@@ -104,7 +103,6 @@ test("Generate a typescript interface without references to other interfaces", (
104103
'@id'?: string;
105104
foo: any;
106105
readonly bar: string;
107-
id?: string;
108106
}
109107
`;
110108
expect(

0 commit comments

Comments
 (0)