Hello,
I tried to convert my application from AppSyncSDK to Amplify but I have some compiler errors when I import it.
The errors are:
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
I add a missing information. I want to use in a node application.
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.
@vallyscode solution worked. This issue should probably be marked as solved.
Closing as the solution is posted above. Please reopen if there are any further questions or concerns.
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.
@HintikkaKimmo did you fixed, i have exact same issue
@jordanranz The answer posted above only works as a solution in some environments as pointed out by @HintikkaKimmo and the original issue is therefore not solved. ServiceWorker
or dom
is hardly available in a React Native app for example even if you would falsely tell the TS compiler that they are, as the supposed solution suggests.
Most helpful comment
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.