Typescript compiler errors using AWS-Amplify in a custom app
See original GitHub issueHello, I tried to convert my application from AppSyncSDK to Amplify but I have some compiler errors when I import it. The errors are:
- node_modules/aws-amplify/lib/Cache/types/Cache.d.ts:38:15 - error TS2304: Cannot find name ‘Storage’.
- node_modules/aws-amplify/lib/Cache/types/Cache.d.ts:39:13 - error TS2304: Cannot find name ‘Cache’.
- node_modules/aws-amplify/lib/Common/RNComponents/index.d.ts:6:29 - error TS2304: Cannot find name ‘Storage’.
- node_modules/aws-amplify/lib/Common/ServiceWorker/ServiceWorker.d.ts:23:29 - error TS2304: Cannot find name ‘ServiceWorker’.
- node_modules/aws-amplify/lib/Common/StorageHelper/index.d.ts:2:30 - error TS2304: Cannot find name ‘Storage’.
I tried to start from scratch with very simple program. The repro app include only 3 files
package.json:
{
"name": "aws_amplify_test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@types/node": "^8.10.18",
"aws-amplify": "0.4.4",
"typescript": "^2.9.1"
}
}
tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es6",
"lib": [ "es6"],
"sourceMap": true,
"noImplicitAny": false,
"outDir": "./dist/"
},
"include": [
"./**/*"
],
"exclude": [
"node_modules",
"./**/*.spec.ts"
]
}
app.ts:
import Amplify from 'aws-amplify';
console.log('Hello world');
When I run TSC compiler I retrieve the previous errors. if It is my fault, could you provide a very simple typescript app with aws-amplify?
Repro in the zip file attached aws_amplify_test.zip
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:10 (1 by maintainers)
Top Results From Across the Web
deploy angular app on AWS amplify gives build failed errors
node_modules/@ngtools/webpack/src/ivy/index.js): Error: Emit Error: Failed to initialize Angular compilation - Cannot read properties of ...
Read more >aws amplify typescript support - JodiStory
Typescript Compiler errors from @aws-amplify/auth #4200 Deploy a Next.js 13 app to AWS with Amplify Hosting Now, lets register a callback ...
Read more >Using the API.ts Typescript types generated by AWS Amplify
We explore using Typescript with AWS Amplify API in React Native, with a particular focus on the types that AWS Amplify generates into...
Read more >API (GraphQL) - Client code generation - AWS Amplify Docs
The amplify codegen types [--nodownload] command generates GraphQL types for Flow and typescript and Swift class in an iOS project. This command downloads ......
Read more >Building Lambda functions with TypeScript
To transpile your TypeScript code, set up a compiler such as esbuild or Microsoft's TypeScript compiler ( tsc ) , which is bundled...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just in case someone else has such problem in nodejs. Solution is to add “dom” to lib in tsconfig.json so that compiler can find definitions.
This turned out to cause new issues in my environment. Having dom as lib trickered host of new errors in the newest version of React-Native typings.