Hi! This error seems really obvious so I am assuming I’m doing something wrong, but the tutorial seems to have us import a Photo type from @capacitor/camera, as well as declaring a Photo interface. When compiling the code as copied, it complains about this collision.
import { Injectable } from '@angular/core';
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
import { Filesystem, Directory } from '@capacitor/filesystem';
import { Storage } from '@capacitor/storage';
@Injectable({
providedIn: 'root'
})
export class PhotoService {
public photos: Photo[] = [];
constructor() { }
public async addNewToGallery() {
const capturedPhoto = await Camera.getPhoto({
resultType: CameraResultType.Uri,
source: CameraSource.Camera,
quality: 100
});
this.photos.unshift({
filepath: "soon...",
webviewPath: capturedPhoto.webPath
});
}
}
export interface Photo {
filepath: string;
webviewPath: string;
}
As mentioned, the error thrown is
[ng] Error: src/app/services/photo.service.ts:22:7 - error TS2345: Argument of type '{ filepath: string; webviewPath: string; }' is not assignable to parameter of type 'Photo'.
[ng] Object literal may only specify known properties, and 'filepath' does not exist in type 'Photo'.
Wondering if I’m missing something, or if this is an error in the tutorial and I should simply refrain from importing the Photo type / rename the interface type something different.