While following the tutorial,
To start the dead-letter queue threshold test, in the test directory, create a new file named dead-letter-queue.test.ts with the following code, then save the file:
import { SynthUtils } from '@aws-cdk/assert';
import { Stack } from '@aws-cdk/core';
import dlq = require('../lib/dead-letter-queue');
test('dlq creates an alarm', () => {
const stack = new Stack();
new dlq.DeadLetterQueue(stack, 'DLQ');
expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot();
});
a redline under stack appears in my vs editor:
Argument of type 'import("/Users/kick7spring/Documents/Log/maven/TestingConstructs/node_modules/@aws-cdk/core/lib/stack").Stack' is not assignable to parameter of type 'import("/Users/kick7spring/Documents/Log/maven/TestingConstructs/node_modules/aws-cdk-lib/core/lib/stack").Stack'.
Type 'Stack' is missing the following properties from type 'Stack': _crossRegionReferences, _suppressTemplateIndentation, _terminationProtection, permissionsBoundaryArn, and 7 more
I am new to this, and I do not know how to resolve this.
this is my package.json
{
"name": "testing_constructs",
"version": "0.1.0",
"bin": {
"testing_constructs": "bin/testing_constructs.js"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "jest",
"cdk": "cdk"
},
"devDependencies": {
"@aws-cdk/assertions": "1.203.0",
"@types/babel__traverse": "7.18.2",
"@types/jest": "^27.5.0",
"@types/node": "10.17.27",
"@types/prettier": "2.6.0",
"aws-cdk": "1.203.0",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"ts-node": "^10.8.1",
"typescript": "~3.9.7"
},
"dependencies": {
"@aws-cdk/assert": "^2.68.0",
"@aws-cdk/aws-cloudwatch": "^1.20.0",
"@aws-cdk/aws-sqs": "^1.204.0",
"@aws-cdk/core": "1.204.0",
"source-map-support": "^0.5.21"
}
}
thanks
hi, I update cdk to version 2,
{ "name": "testing_constructs", "version": "0.1.0", "bin": { "testing_constructs": "bin/testing_constructs.js" }, "scripts": { "build": "tsc", "watch": "tsc -w", "test": "jest", "cdk": "cdk" }, "devDependencies": { "@types/jest": "^29.5.5", "@types/node": "20.7.1", "aws-cdk": "2.103.1", "jest": "^29.7.0", "ts-jest": "^29.1.1", "ts-node": "^10.9.1", "typescript": "~5.2.2" }, "dependencies": { "@aws-cdk/assert": "^2.68.0", "@aws-cdk/aws-cloudwatch": "^1.204.0", "@aws-cdk/aws-sqs": "^1.204.0", "aws-cdk-lib": "2.103.1", "constructs": "^10.0.0", "source-map-support": "^0.5.21" } }
kick7spring@kick7springdebijibendiannao TestingConstructs % cdk --version 2.103.1 (build 3bb19ac)
expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot();
there is still a redline under the stack
Argument of type 'import("/Users/kick7spring/Documents/Log/TestingConstructs/node_modules/@aws-cdk/core/lib/stack").Stack' is not assignable to parameter of type 'import("/Users/kick7spring/Documents/Log/TestingConstructs/node_modules/aws-cdk-lib/core/lib/stack").Stack'. Type 'Stack' is missing the following properties from type 'Stack': _crossRegionReferences, _suppressTemplateIndentation, _terminationProtection, permissionsBoundaryArn, and 7 more.ts(2345)