Module build failed. Syntax Error: Unexpected reserved word 'public'

Hi folks,

Disclaimer: sorry, I am an absolute beginner. Please excuse any stupid questions or descriptions of the problem. I have never programmed anything else than simple homepages so far, so working in the terminal etc. is all quite new to me.

System Info:
System: MacOS Ventura 10.0.1
NPM Version: 8.19.2
Node Version: v18.12.1
ionic: 6.20.5

Problem: I am taking my very first steps on Ionic following this tutorial to build my first app: Build Camera API for iOS, Android & Web.

I am currently at this step: Then, open tab2.page.html and call the addPhotoToGallery()function when the FAB is tapped/clicked:

I saved everything and ran ionic serve.
However, that’s when I get an error:

[ng] ./src/app/tab2/tab2.page.ts - Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js):
[ng] SyntaxError: /Users/philipps/photo-gallery/src/app/tab2/tab2.page.ts: Unexpected reserved word ‘public’. (30:12)
[ng]
[ng] 28 | i0.ɵɵproperty(“fullscreen”, true);
[ng] 29 | } }, dependencies: [i1.IonContent, i1.IonFab, i1.IonFabButton, i1.IonHeader, i1.IonIcon, i1.IonTitle, i1.IonToolbar, i2.ExploreContainerComponent], styles: [“\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZVJvb3QiOiIifQ== */”] });
[ng] > 30 | constructor(public, photoService, PhotoService);
[ng] | ^
[ng] 31 | { }
[ng] 32 | addPhotoToGallery();
[ng] 33 | {
[ng]
[ng] Error: src/app/services/photo.service.ts:14:1 - error TS1128: Declaration or statement expected.
[ng]
[ng] 14 public async addNewToGallery() {
[ng] ~~~~~~
[ng]
[ng]
[ng] Error: src/app/services/photo.service.ts:14:8 - error TS1434: Unexpected keyword or identifier.
[ng]
[ng] 14 public async addNewToGallery() {
[ng] ~~~~~
[ng]
[ng]
[ng] Error: src/app/services/photo.service.ts:14:8 - error TS2304: Cannot find name ‘async’.
[ng]
[ng] 14 public async addNewToGallery() {
[ng] ~~~~~
[ng]
[ng]
[ng] Error: src/app/services/photo.service.ts:14:14 - error TS2304: Cannot find name ‘addNewToGallery’.
[ng]
[ng] 14 public async addNewToGallery() {
[ng] ~~~~~~~~~~~~~~~
[ng]
[ng]
[ng] Error: src/app/services/photo.service.ts:14:32 - error TS1005: ‘;’ expected.
[ng]
[ng] 14 public async addNewToGallery() {
[ng] ~
[ng]
[ng]
[ng] Error: src/app/tab2/tab2.page.html:29:30 - error TS2339: Property ‘addPhotoToGallery’ does not exist on type ‘Tab2Page’.
[ng]
[ng] 29 <ion-fab-button (click)=“addPhotoToGallery()”>
[ng] ~~~~~~~~~~~~~~~~~
[ng]
[ng] src/app/tab2/tab2.page.ts:5:16
[ng] 5 templateUrl: ‘tab2.page.html’,
[ng] ~~~~~~~~~~~~~~~~
[ng] Error occurs in the template of component Tab2Page.
[ng]
[ng]
[ng] Error: src/app/tab2/tab2.page.ts:15:1 - error TS2304: Cannot find name ‘constructor’.
[ng]
[ng] 15 constructor(public photoService: PhotoService) { }
[ng] ~~~~~~~~~~~
[ng]
[ng]
[ng] Error: src/app/tab2/tab2.page.ts:15:13 - error TS2304: Cannot find name ‘public’.
[ng]
[ng] 15 constructor(public photoService: PhotoService) { }
[ng] ~~~~~~
[ng]
[ng]
[ng] Error: src/app/tab2/tab2.page.ts:15:20 - error TS1005: ‘,’ expected.
[ng]
[ng] 15 constructor(public photoService: PhotoService) { }
[ng] ~~~~~~~~~~~~
[ng]
[ng]
[ng] Error: src/app/tab2/tab2.page.ts:15:20 - error TS2552: Cannot find name ‘photoService’. Did you mean ‘PhotoService’?
[ng]
[ng] 15 constructor(public photoService: PhotoService) { }
[ng] ~~~~~~~~~~~~
[ng]
[ng]
[ng] Error: src/app/tab2/tab2.page.ts:15:32 - error TS1005: ‘,’ expected.
[ng]
[ng] 15 constructor(public photoService: PhotoService) { }
[ng] ~
[ng]
[ng]
[ng] Error: src/app/tab2/tab2.page.ts:15:48 - error TS1005: ‘;’ expected.
[ng]
[ng] 15 constructor(public photoService: PhotoService) { }
[ng] ~
[ng]
[ng]
[ng] Error: src/app/tab2/tab2.page.ts:17:1 - error TS2304: Cannot find name ‘addPhotoToGallery’.
[ng]
[ng] 17 addPhotoToGallery() {
[ng] ~~~~~~~~~~~~~~~~~
[ng]
[ng]
[ng] Error: src/app/tab2/tab2.page.ts:17:21 - error TS1005: ‘;’ expected.
[ng]
[ng] 17 addPhotoToGallery() {
[ng] ~
[ng]
[ng]
[ng] Error: src/app/tab2/tab2.page.ts:18:3 - error TS2532: Object is possibly ‘undefined’.
[ng]
[ng] 18 this.photoService.addNewToGallery();
[ng] ~~~~
[ng]
[ng]
[ng]