-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug with TS & DynamoDB plugin with TS option strict
is enabled
#100
Comments
strict
is enabled
Hi @j0k3r thanks for steps to repro. I think you might have because you mentioned that it's similar to #70 and that resolution was this in the tsconfig {
"compilerOptions": {
"types": [
"@aws-lite/dynamodb-types"
]
}
} But I just want to double check. Also, a new version of aws-lite went out very recently that requires explicit loading of plugins. Are you using That'll help me differentiate pre-0.17 vs latest. Thanks |
Hey @tbeseda,
Yes, sorry I didn't mention it. We do have that package:
Yes it's enabled. {
"compilerOptions": {
"incremental": true,
"target": "es2016",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitAny": true,
"skipLibCheck": true,
"noEmit": true,
"types": [
"@aws-lite/dynamodb-types",
"@types/jest"
]
},
"include": [
"src",
"tests",
"jest.config.ts",
"webpack.config.js"
],
"exclude": [
"node_modules/**/*",
".serverless/**/*",
".webpack/**/*",
".vscode/**/*"
]
}
We are using the latest client:
This is how we are creating the client: import awsLite from '@aws-lite/client'
import dynamodb from '@aws-lite/dynamodb'
const awsLiteConfig = {
region: 'eu-west-1',
plugins: [dynamodb],
autoloadPlugins: false,
}
const aws = await awsLite(awsLiteConfig) Overall, the error is still here. |
Thanks for getting back to me and adding more info. I'm working on an update to type defs today, so I can look into this with your configuration today. |
hey @tbeseda I am facing same types issue. Cannot find type definition file for '@aws-lite/sqs-types'. Tried "typeRoots": ["node_modules/@types", "src/@types", "@aws-lite/sqs-types"],
"types": ["@aws-lite/sqs-types"],
|
Ran into this in my first foray into declare module "@aws-lite/client" {
interface AwsLiteClient {
SSM: AwsLiteSSM;
}
} This is good, it merges SSM stuff into the client. The actual TS error is in the import statement (either You can make this go away with: declare module '@aws-lite/ssm'; It's not clear to me where this should happen - it can be:
It's worth noting that |
Thanks for the diagnostics here @keithlayne - very helpful. I'm taking a look at this today to see how much can be handled automatically by aws-lite and what we should advise consumers do. |
Okay finally an update here: I recreated the issue locally in a fresh TS project with the following config: {
"scripts": {
"build": "tsc"
},
"devDependencies": {
"@aws-lite/ssm-types": "^0.2.5",
"@types/node": "^20.12.7",
"typescript": "^5.4.5"
},
"dependencies": {
"@aws-lite/client": "^0.20.0",
"@aws-lite/ssm": "^0.2.3"
}
} {
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"target": "ES6",
"types": [
"@aws-lite/ssm-types"
]
}
} my working index.ts: import awsLite from '@aws-lite/client'
import awsLiteSsm from '@aws-lite/ssm'
(async () => {
const aws = await awsLite({
plugins: [awsLiteSsm]
})
await aws.SSM.GetParameter({
Name: 'foobar',
WithDecryption: true,
})
})() this required a couple updates to the base aws-lite/client types. namely: /// <reference types="node" />
// ...
declare module "@aws-lite/client";
export default function awsLite(config: AwsLiteConfig): Promise<AwsLiteClient>; further, I added a declare module '@aws-lite/ssm'; I was not able to use that one-liner in the aws-lite/ssm-types. I get:
Ideally, I could get this working by only changing the types package and not adding a file to the plugin. Research continues. Suggestions welcome! |
Any update on this. Just looking at trying aws-lite for dynamodb usage and encountered this exact issue. |
Having the same issue here. I think there is a mistake somewhere, but I'm still unable to figure out what. To see this issue in action: https://stackblitz.com/edit/stackblitz-starters-u8a5t1 (execute The setup is also a bit unusual. My suggestion would be to publish the types in the https://github.com/DefinitelyTyped/DefinitelyTyped repo instead. Or start rewriting this SDK to TypeScript, so that the typings can be included in the same packages as the source code. A workaround is to add a file, e.g. declare module '@aws-lite/dynamodb' {
export * from '@aws-lite/dynamodb-types'
} |
Describe the issue
When using the plugin with TS, I got the error:
I've properly updated my tsconfig.json.
The bug appear because I've these options defined in the config file:
Enable at least one of those option, raise the above error when running
yarn tsc
.Might be the same as #70 but maybe without the same option in tsconfig file.
Expected behavior
It compiles without error.
Steps to reproduce
strict
ornoImplicitAny
set totrue
yarn tsc
Platform / version
How urgent do you feel this bug is?
P2
Additional context
No response
The text was updated successfully, but these errors were encountered: