Fix TypeScript error TS1046

This commit is contained in:
tomtargosz 2019-08-14 12:14:14 -05:00 committed by Bartol Karuza
parent 25989a86a0
commit 7d04a4e1f6
1 changed files with 73 additions and 77 deletions

View File

@ -7,85 +7,81 @@
* @format * @format
*/ */
export type GroupType = declare namespace CameraRoll {
'Album' | type GroupType =
'All' | | 'Album'
'Event' | | 'All'
'Faces' | | 'Event'
'Library' | | 'Faces'
'PhotoStream' | | 'Library'
'SavedPhotos'; | 'PhotoStream'
| 'SavedPhotos';
type AssetType = 'All' | 'Videos' | 'Photos';
interface GetPhotosParams {
first: number;
after?: string;
groupTypes?: GroupType;
groupName?: string;
assetType?: AssetType;
mimeTypes?: Array<string>;
}
interface PhotoIdentifier {
node: {
type: string,
group_name: string,
image: {
filename: string,
uri: string,
height: number,
width: number,
isStored?: boolean,
playableDuration: number,
},
timestamp: number,
location?: {
latitude?: number,
longitude?: number,
altitude?: number,
heading?: number,
speed?: number,
},
};
}
interface PhotoIdentifiersPage {
edges: Array<PhotoIdentifier>;
page_info: {
has_next_page: boolean,
start_cursor?: string,
end_cursor?: string,
};
}
export type AssetType = /**
'All' | * `CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.
'Videos' | */
'Photos'; function saveImageWithTag(tag: string): Promise<string>;
export interface GetPhotosParams { /**
first: number, * Delete a photo from the camera roll or media library. photos is an array of photo uri's.
after?: string, */
groupTypes?: GroupType, function deletePhotos(photos: Array<string>): void;
groupName?: string, // deletePhotos: (photos: Array<string>) => void;
assetType?: AssetType,
mimeTypes?: Array<string>, /**
* Saves the photo or video to the camera roll or photo library.
*/
function saveToCameraRoll(tag: string, type?: 'photo' | 'video'): Promise<string>;
/**
* Returns a Promise with photo identifier objects from the local camera
* roll of the device matching shape defined by `getPhotosReturnChecker`.
*/
function getPhotos(params: GetPhotosParams): Promise<PhotoIdentifiersPage>;
} }
export interface PhotoIdentifier { export = CameraRoll;
node: {
type: string,
group_name: string,
image: {
filename: string,
uri: string,
height: number,
width: number,
isStored?: boolean,
playableDuration: number,
},
timestamp: number,
location?: {
latitude?: number,
longitude?: number,
altitude?: number,
heading?: number,
speed?: number,
},
},
}
export interface PhotoIdentifiersPage {
edges: Array<PhotoIdentifier>,
page_info: {
has_next_page: boolean,
start_cursor?: string,
end_cursor?: string,
},
}
export interface CameraRollStatic {
/**
* `CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.
*/
saveImageWithTag: (tag: string) => Promise<string>;
/**
* Delete a photo from the camera roll or media library. photos is an array of photo uri's.
*/
deletePhotos: (photos: Array<string>) => void;
/**
* Saves the photo or video to the camera roll or photo library.
*/
saveToCameraRoll: (tag: string, type?: 'photo' | 'video') => Promise<string>;
/**
* Returns a Promise with photo identifier objects from the local camera
* roll of the device matching shape defined by `getPhotosReturnChecker`.
*/
getPhotos: (params: GetPhotosParams) => Promise<PhotoIdentifiersPage>;
}
let CameraRoll: CameraRollStatic;
export default CameraRoll;