Skip to content

Commit 3496c20

Browse files
author
Jakob Nielsen
committed
fix(sample): sample 12 type generation fails due to wrong path
ts-morph package added graphql.schema.ts update with generate-typings script
1 parent 95834b3 commit 3496c20

4 files changed

Lines changed: 62 additions & 15 deletions

File tree

File renamed without changes.

sample/12-graphql-schema-first/package-lock.json

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

sample/12-graphql-schema-first/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"supertest": "6.1.6",
5151
"ts-jest": "27.0.7",
5252
"ts-loader": "9.2.6",
53+
"ts-morph": "^12.2.0",
5354
"ts-node": "10.4.0",
5455
"tsconfig-paths": "3.11.0",
5556
"typescript": "4.4.2"
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
1-
/** ------------------------------------------------------
1+
2+
/*
3+
* -------------------------------------------------------
24
* THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
35
* -------------------------------------------------------
46
*/
57

68
/* tslint:disable */
79
/* eslint-disable */
810
export class CreateCatInput {
9-
name?: string;
10-
age?: number;
11+
name?: Nullable<string>;
12+
age?: Nullable<number>;
1113
}
1214

1315
export abstract class IQuery {
14-
abstract cats(): Cat[] | Promise<Cat[]>;
16+
abstract cats(): Nullable<Nullable<Cat>[]> | Promise<Nullable<Nullable<Cat>[]>>;
1517

16-
abstract cat(id: string): Cat | Promise<Cat>;
18+
abstract cat(id: string): Nullable<Cat> | Promise<Nullable<Cat>>;
1719
}
1820

1921
export abstract class IMutation {
20-
abstract createCat(createCatInput?: CreateCatInput): Cat | Promise<Cat>;
22+
abstract createCat(createCatInput?: Nullable<CreateCatInput>): Nullable<Cat> | Promise<Nullable<Cat>>;
2123
}
2224

2325
export abstract class ISubscription {
24-
abstract catCreated(): Cat | Promise<Cat>;
26+
abstract catCreated(): Nullable<Cat> | Promise<Nullable<Cat>>;
2527
}
2628

2729
export class Owner {
28-
id: number;
29-
name: string;
30-
age?: number;
31-
cats?: Cat[];
30+
id: number;
31+
name: string;
32+
age?: Nullable<number>;
33+
cats?: Nullable<Cat[]>;
3234
}
3335

3436
export class Cat {
35-
id?: number;
36-
name?: string;
37-
age?: number;
38-
owner?: Owner;
37+
id?: Nullable<number>;
38+
name?: Nullable<string>;
39+
age?: Nullable<number>;
40+
owner?: Nullable<Owner>;
3941
}
42+
43+
type Nullable<T> = T | null;

0 commit comments

Comments
 (0)