Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

Cannot find name 'Entry'

$
0
0

@leonardofmed wrote:

I made a simple function to unzip a selected file to a temp folder, check if contains a file with specific extension, then return the path of this file:

1unzipAndCheckKML(zipFilePath:string, extractionPath:string, extractionFolder:string): Promise<Entry> {
2	return this.zip.unzip(zipFilePath, extractionPath+extractionFolder).then(() => {
3		return this.file.listDir(extractionPath, extractionFolder).then(entryList => {
4			console.log(entryList);
5			return entryList.find((fileEntry) => {
6				let fileExtension = fileEntry.name.split('.').pop();
7				if (fileExtension === 'kml') {
8					return fileEntry;
9				}
10			});
11		})			
12	});
13}

The problem I’m facing is that the find function is returning a boolean value!

line 1 -> error TS2304: Cannot find name ‘Entry’.
line 5 -> error TS2345: Argument of type ‘(this: void, fileEntry: Entry) => Entry’ is not assignable to parameter of type ‘(value: Entry, index: number, obj: Entry) => boolean’.
Type ‘Entry’ is not assignable to type ‘boolean’.

If I try to declare the type of arrow function as Entry:
entryList.find((fileEntry): Entry => {
, I get this problem:

Cannot find name ‘Entry’.

If I try to change the iteration method I got this same error.


Zip | File

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>