How can I use FileSystem API in TypeScript in an Angular 4 application?
I added @types/filesystem to devDependencies, but I still get compile errors like
Property 'resolveLocalFileSystemURL' does not exist on type 'Window'.
Cannot find name 'FileError'.
Cannot find name 'FileEntry'.
My tsconfig.json is almost the same as the one generated by angular-cli, I just added "node_modules/typed-cordova-plugin-purchase to typeRoots:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types",
"node_modules/typed-cordova-plugin-purchase"
],
"lib": [
"es2016",
"dom"
]
}
}
Should I import anything? Are there any examples of using FileSystem in Typescript?
typesor you added it totypesif you have them. PropertypeRootsnever hurts. Please, provide tsconfig in the question.window.requestFileSystemthrows the same kind of error.