generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
I created a simple lambda with the following code:
import { InvokeStore } from '@aws/lambda-invoke-store';
export const handler = async (event: unknown) => {
const invokeStore = await InvokeStore.getInstanceAsync();
invokeStore.set('key', 'value');
}My TS config is as folllows:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}When I try to build with tsc, I get this error:
> invoke-store-cjs-issue@1.0.0 build
> tsc
src/index.ts:1:29 - error TS7016: Could not find a declaration file for module '@aws/lambda-invoke-store'. '/Users/svozza/git/github.com/svozza/invoke-store-cjs-issue/node_modules/@aws/lambda-invoke-store/dist-cjs/invoke-store.js' implicitly has an 'any' type.
There are types at '/Users/svozza/git/github.com/svozza/invoke-store-cjs-issue/node_modules/@aws/lambda-invoke-store/dist-types/invoke-store.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
1 import { InvokeStore } from '@aws/lambda-invoke-store';
~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in src/index.ts:1
If I change the compiler options to this, it works:
{
"compilerOptions": {
// ...
"module": "node16",
"moduleResolution": "node15",
// ...
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}I have created a repo with a minimal reproduction here: https://github.com/svozza/invoke-store-cjs-issue.
Metadata
Metadata
Assignees
Labels
No labels